Skip to content

Conversation

@jdalton
Copy link
Contributor

@jdalton jdalton commented Nov 6, 2025

Summary

This PR removes the brotli compression system and pkg dependency, simplifying the CLI build and distribution process.

Changes

1. Remove Compression Scripts

  • Delete compress-cli.mjs scripts from packages/cli/ and packages/cli-with-sentry/
  • Add copy-cli.mjs scripts to copy built CLI directly to dist/

2. Simplify Index Loader

  • Update src/index.mts to directly require the built bundle (no decompression)
  • Remove brotli decompression logic
  • Remove pkg-related code

3. Update Build Process

  • Modify build scripts to use new copy approach instead of compression
  • Update esbuild configs to output uncompressed cli.js
  • Update verify-package scripts for new structure

4. Remove Dependency

  • Remove pkg dependency from package.json

Trade-offs

Before: ~13MB uncompressed → ~1.7MB compressed (87% reduction)
After: Ships uncompressed bundle (~13MB)

This change prioritizes:

  • ✅ Simpler build process
  • ✅ Faster build times (no compression step)
  • ✅ Easier debugging (readable source)
  • ✅ Removes pkg dependency

At the cost of:

  • ❌ Larger npm package size

Test Plan

  • Type check passes
  • Security checks pass
  • Verify CLI works correctly when installed from npm
  • Verify all commands function properly
  • Compare package size before/after

Related

Related to commit 3b99270 (chore: remove pkg dependency and related build scripts)

Test User added 11 commits November 5, 2025 21:00
Remove experimental ask and console commands that are no longer needed.
The ask command provided natural language query interface, but is being
command provided an interactive TUI that is superseded by better tooling.

Files removed:
- packages/cli/src/commands/ask/cmd-ask.mts
- packages/cli/src/commands/ask/handle-ask.mts
- packages/cli/src/commands/ask/output-ask.mts
- packages/cli/src/commands/console/InteractiveConsoleApp.tsx
- packages/cli/src/commands/console/cmd-console.mts
- packages/cli/src/commands/console/handle-console.mts
- packages/cli/src/commands/console/mouse-handler.mts
Remove documentation that is now obsolete after SDK restructuring:
- dev/ci-testing.md
- dev/scripts.md
- dev/testing.md
- incremental-builds.md
- migration-v3.md
- security.md

These docs are either outdated, covered in monorepo-level docs, or no
longer relevant after the package consolidation in recent refactoring.
CI optimization:
- Add lint-setup-script to ensure dependencies are built before linting
- Disable redundant type-check job since check script already runs it
- Reduces duplicate work and improves CI efficiency

LLM script updates:
- Update semantic index generator to be command-agnostic
- Remove ask command references from README
- Clean up deprecated documentation about socket ask integration
Fixed two bugs in the lint script that caused linting to fail when
biome.json excluded files were changed:

1. Pattern matching: The isExcludedByBiome() function incorrectly
   converted glob patterns like **/package.json to regex. The **/ was
   replaced with .* first, then the remaining * was replaced with
   [^/]*, resulting in broken patterns that failed to match root-level
   files. Now uses placeholder approach to preserve regex metacharacters.

2. Config discovery: The getBiomeExcludePatterns() function only looked
   for biome.json in process.cwd(), failing when running from package
   subdirectories. Now searches up to 3 parent directories to find the
   config file, supporting monorepo structure.

These fixes allow the check script to pass when only excluded files
(like package.json) are changed, preventing false failures in CI.
Removed @yao-pkg/pkg dependency and build:smol script as part of
ongoing cleanup of unused build tooling. Also removed Makefile which
is no longer needed.
- Fix import statement formatting
- Fix multiline string formatting
- Convert let to const where appropriate
- Add spawnSync to imports from @socketsecurity/lib/spawn
- Remove require() call that triggered n/no-extraneous-require lint error
- Use getExecPath() directly in sync version (SEA detection unavailable in sync mode)
- Update JSDoc to clarify sync limitations

Fixes linting error:
  src/utils/spawn/spawn-node.mts:173:33
  error "@socketsecurity/lib" is extraneous n/no-extraneous-require
This commit completes the removal of the pkg-based compression system
and simplifies the CLI loader to directly require the built bundle.

Changes:
- Remove compress-cli.mjs scripts (no longer needed)
- Simplify src/index.mts to directly load cli.js (no decompression)
- Add copy-cli.mjs scripts to copy built CLI to dist/
- Update build scripts to use new copy approach
- Update esbuild configs to output uncompressed cli.js
- Update verify-package scripts for new structure

The CLI now ships as an uncompressed bundle, removing the ~10MB→1.7MB
compression at the cost of larger npm package size. This simplifies
the build process and removes the pkg dependency.

Related to previous commit: 3b99270 (chore: remove pkg dependency and related build scripts)
@jdalton jdalton closed this Nov 8, 2025
@jdalton jdalton deleted the remove-brotli-compression branch November 8, 2025 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants