Skip to content

fix: audit cleanup, CLI extraction, and performance refactor#242

Merged
Maleick merged 3 commits into
mainfrom
audit-cli-extraction
May 11, 2026
Merged

fix: audit cleanup, CLI extraction, and performance refactor#242
Maleick merged 3 commits into
mainfrom
audit-cli-extraction

Conversation

@Maleick
Copy link
Copy Markdown
Owner

@Maleick Maleick commented May 11, 2026

Summary

  • Audit cleanup of configs, branches, and stale references
  • Extract 2110-line src/cli.ts into thin dispatcher + helpers + commands
  • Convert core dynamic imports to static (perf improvement)
  • Remove ensureOption helper for cleaner arg access

Details

Config fixes:

  • tsconfig.json: lib from ES2022 to ES2024
  • INSTALL.md: pinned version 3.13.1 -> 3.14.2
  • CONTRIBUTING.md: stale claude-era grep command
  • scripts/cleanup.sh: dead experiments/tmp code removed
  • OpenCode global config: deduplicated duplicate context-mode plugin

Git housekeeping:

  • Pruned 17 stale local branches + stale remote tracking refs

CLI extraction:

  • src/cli-helpers.ts — formatting, escaping, parsing utilities
  • src/cli-commands.ts — all 27 command handler functions
  • src/cli.ts — thin dispatcher (~130 lines, down from 2110)
  • All 797 tests pass, typecheck + build clean

Performance refactor:

  • Converted run-manager.js and helpers.js dynamic imports to static
  • Removed ensureOption helper, simplified command arg access

Verification

  • All 797 tests pass
  • tsc --noEmit clean
  • npm audit clean (0 vulns)
  • npm run verify:pack passes (164 files)

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Performance

- 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)
Copilot AI review requested due to automatic review settings May 11, 2026 13:28
Maleick added 2 commits May 11, 2026 08:30
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.
@Maleick Maleick changed the title fix: audit cleanup and CLI extraction fix: audit cleanup, CLI extraction, and performance refactor May 11, 2026
@Maleick Maleick merged commit a7fc23c into main May 11, 2026
1 check failed
@Maleick Maleick deleted the audit-cli-extraction branch May 11, 2026 13:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts and src/cli-commands.ts, leaving src/cli.ts as 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.

Comment thread src/cli-commands.ts
const warnings = Array.isArray(cp.warnings) ? cp.warnings : [];
if (warnings.length > 0) {
for (const w of warnings) console.log(`\u1f638 Context pressure: ${formatDisplayValue(w)}`);
}
Comment thread src/cli-commands.ts
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 thread src/cli-commands.ts
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 thread src/cli-helpers.ts
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 thread src/cli.ts
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");
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 3.18.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants