fix: audit cleanup, CLI extraction, and performance refactor#242
Merged
Conversation
- tsconfig: ES2022 lib -> ES2024 - INSTALL.md pinned version 3.13.1 -> 3.14.2 - CONTRIBUTING.md stale claude-era grep pattern - scripts/cleanup.sh dead code removal - OpenCode global config deduplicate context-mode plugin - Prune 17 stale local branches + stale remote refs - Extract src/cli.ts into cli-helpers.ts + cli-commands.ts (2110 -> 130 line dispatcher + helpers + commands)
Converted run-manager.js and helpers.js dynamic imports to static imports in cli-commands.ts since these modules are used by most commands. Reduces async overhead on every CLI invocation.
Direct property access on CommandGroup with type assertions replaces ensureOption() calls. Reduces indirection and clarifies that grouped args are string | string[]. Removes ~20 lines of boilerplate.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR performs repository “audit cleanup” updates (config + docs + scripts) and refactors the Node CLI by extracting a previously monolithic src/cli.ts into a thin dispatcher plus helper and command modules.
Changes:
- Update TypeScript config/doc references as part of audit cleanup (e.g., TS lib target, pinned install version, contributor grep guidance).
- Extract CLI parsing/helpers and command handlers into
src/cli-helpers.tsandsrc/cli-commands.ts, leavingsrc/cli.tsas a dispatcher. - Remove dead cleanup logic from
scripts/cleanup.sh.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Updates TS lib to ES2024 to match the configured target. |
| src/cli.ts | Replaced large CLI implementation with a dispatcher and centralized usage text. |
| src/cli-helpers.ts | New shared CLI parsing/formatting helpers extracted from the former cli.ts. |
| src/cli-commands.ts | New module containing extracted command handlers for CLI subcommands. |
| scripts/cleanup.sh | Removes tmp cleanup logic for dead experiments/temp artifacts. |
| INSTALL.md | Updates pinned package version in installation instructions. |
| CONTRIBUTING.md | Updates the “stale references” ripgrep pattern for the current naming/paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const warnings = Array.isArray(cp.warnings) ? cp.warnings : []; | ||
| if (warnings.length > 0) { | ||
| for (const w of warnings) console.log(`\u1f638 Context pressure: ${formatDisplayValue(w)}`); | ||
| } |
| if (subCmd === "export") { | ||
| const { exportPack } = await import("./strategy-pack.js"); | ||
| const result = exportPack(grouped.repo as string | undefined, grouped["state-path"] as string | undefined); | ||
| if (!result) { console.error("No run state found."); return 1; } |
Comment on lines
+830
to
+831
| const options = ["--repo", "--goal", "--metric", "--direction", "--verify", "--guard", "--mode", "--scope", "--iterations", "--duration", "--num-drafts", "--branch-policy", "--json", "--results-path", "--state-path", "--fresh-start", "--memory-path", "--format", "--shell"]; | ||
| if (shell === "bash" || shell === "zsh") { |
Comment on lines
+86
to
+90
| export const readScoreHistoryFile = (filePath: string): string => { | ||
| assertRegularBoundedFile(filePath); | ||
| if (typeof fsConstants.O_NOFOLLOW !== "number") { | ||
| throw new Error("Platform does not support O_NOFOLLOW"); | ||
| } |
Comment on lines
69
to
70
| console.error(" --max-debug-depth Max debug experiment depth before stop"); | ||
| console.error(" --branch-failure-budget Per-branch failure budget before stop"); |
|
🎉 This PR is included in version 3.18.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/cli.tsinto thin dispatcher + helpers + commandsensureOptionhelper for cleaner arg accessDetails
Config fixes:
tsconfig.json: lib from ES2022 to ES2024INSTALL.md: pinned version 3.13.1 -> 3.14.2CONTRIBUTING.md: stale claude-era grep commandscripts/cleanup.sh: dead experiments/tmp code removedGit housekeeping:
CLI extraction:
src/cli-helpers.ts— formatting, escaping, parsing utilitiessrc/cli-commands.ts— all 27 command handler functionssrc/cli.ts— thin dispatcher (~130 lines, down from 2110)Performance refactor:
ensureOptionhelper, simplified command arg accessVerification
Type of Change