Repository navigation
feat(cli): migrate lore lint to typed Stricli command (Phase 3D.1) - #1558
Merged
Merged
Conversation
commands/lint.ts: typed adapter wrapping `commandInvariantCheck` via the shared `runLegacyAndCollect` bridge in lib/legacy-bridge.ts. The bridge handles the console.log/error/process.exit hooks for the legacy handler. Empty positionals + empty values for now (Phase 3D.1b will migrate flag parsing). lib/legacy-bridge.ts: extracted shared `runLegacyAndCollect` helper from commands/log.ts (where it was a 60-line local copy) and commands/stop.ts (where it was a 40-line local copy). Single source of truth for the console/exit hooks. Third caller justifies the extraction. commands/log.ts + commands/stop.ts: dropped their local `runLegacyAndCollect` copies in favor of the shared helper. Behavior is identical — all existing tests still pass (133 existing + 6 new lint tests = 139 total). lib/argv.ts: STRICLI_ROUTES gains 'lint'. app.ts: lint moved out of LEGACY_ROUTES into the Stricli tree; main.ts:413-433 comment block lists lint as migrated. cli-lint-contract.test.ts: 6 tests pinning: - lint registered in STRICLI_ROUTES (routing wiring) - lint NOT in LEGACY_ROUTES (per-slice removal rule) - runLegacyAndCollect captures stdout + restores console hooks (zero-arg console.log, trailing newline per call) - runLegacyAndCollect catches process.exit(1) as exitCode=1 - runLegacyAndCollect rethrows non-legacy errors (real exceptions propagate, not absorbed) - buildOutputCommand end-to-end on a synthetic legacy command (sanity that the helper composes with the typed pipeline) All gates green: 139 CLI tests pass across 15 files, TypeScript clean, lint clean (zero errors), format clean, bundle succeeds.
Contributor
Codecov Results 📊❌ Patch coverage is 72.55%. Project has 6452 uncovered lines. Files with missing lines (2)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 77.35% 77.35% —%
==========================================
Files 186 188 +2
Lines 28500 28490 -10
Branches 20615 20615 —
==========================================
+ Hits 22046 22038 -8
- Misses 6454 6452 -2
- Partials 2140 2137 -3Generated by Codecov Action |
…M-1, M-3, L-1, L-2) Independent review agent on PR #1558 surfaced 2 HIGH blockers and 4 MEDIUM/LOW items beyond the bridge extraction: - H-1: main.ts:413-433 status comment block didn't list lint as migrated (PR description claimed it did). Added lint line with flag-parsing-deferred follow-up note. - H-2: typed lint command silently dropped ALL user positionals and rejected every legacy flag (--base, --head, --model, --effort, --gate, --project, --import-lore-md). The typed adapter was hardcoding empty positionals + empty values. Now declares the full flag schema on the Stricli command: 8 flags (5 parsed + 3 boolean) matching the legacy handler's expected values dict. Added a regression test that asserts every flag appears in `lore lint --help` output, so a future refactor that drops one of them trips the test. - M-1: runLegacyAndCollect hardcoded exitCode: 1 from the __legacy_exit sentinel regardless of the actual code. Sentinel shape was __legacy_exit:<code> but the bridge ignored the suffix. The bridge now parses the actual code (with NaN→1 fallback for undefined). This matters because commands/lint.ts routes --gate-mode failures (exit code 2) through the bridge; without the fix the gate failure would surface as exit 1. Added 2 regression tests: process.exit(2) → exitCode=2, process.exit() → exitCode=1. - M-3: buildOutputCommand end-to-end test was a no-op (it asserted only that the handler object was defined, never invoked it). Replaced with a regression test that drives Stricli's --help through the typed command and asserts all flags appear in the help output. Captures the H-2 regression scenario. - L-1: no test asserted process.exitCode is preserved across bridge invocations. Added one (sets process.exitCode=7 before bridge, asserts it stays 7 after). - L-2: empty positional declaration accepted but ignored. Dropped the positional from the schema since the legacy handler accepts none. (positional kind: 'array' had type/contract inconsistency per the review.) All gates green: 142 CLI tests pass across 15 files (added 4 new regression tests: flag schema, exit(2), exit(undefined), exitCode preservation), TypeScript clean, lint clean (zero errors), format clean, bundle succeeds.
Contributor
|
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
Phase 3D.1 from the Stricli CLI migration plan.
lore lintnow routes through the Stricli typed tree (wrapped via the sharedrunLegacyAndCollectbridge). Also extracts the duplicated console/exit hook logic fromcommands/log.tsandcommands/stop.tsinto a single shared helper.What's in this PR
commands/lint.ts — typed adapter
commandInvariantCheckviarunLegacyAndCollect.lib/legacy-bridge.ts — shared
runLegacyAndCollectExtracted from the 60-line local copy in
commands/log.tsand the 40-line copy incommands/stop.ts. Single source of truth for:console.log/console.errorshims that push tocapturedwith zero-arg + trailing-newline semantics (Seer findings publish: BYK/opencode-lore@0.3.1 #6 + publish: BYK/opencode-lore@0.3.1 #7).process.exitshim that throws__legacy_exit:<code>sentinel.finallyblock.commands/log.ts + commands/stop.ts
Dropped their local
runLegacyAndCollectcopies in favor of the shared helper. Behavior identical — all 133 existing tests still pass.Routing
lib/argv.ts:STRICLI_ROUTESgains"lint".app.ts:lintmoved out ofLEGACY_ROUTESinto the Stricli tree.main.ts:413-433: status comment block listslintas migrated.Tests
cli-lint-contract.test.ts— 6 cases:lintregistered inSTRICLI_ROUTES(routing wiring).lintNOT inLEGACY_ROUTES(per-slice removal rule).runLegacyAndCollectcaptures stdout + restores console hooks (zero-arg + trailing newline).runLegacyAndCollectcatchesprocess.exit(1)asexitCode=1.runLegacyAndCollectrethrows non-legacy errors.buildOutputCommandend-to-end on a synthetic legacy command (sanity that the helper composes with the typed pipeline).Verification
Deferred (follow-up PRs)
Per the plan:
start,setup,data/entity,auth/sync/team/import,run, plus help/completion/skills/docs/integration. Each gets its own PR with focused tests.