feat(loop-sync): make --auto-fix actually fix things - #523
Merged
cobusgreyling merged 1 commit intoAug 17, 2026
Merged
Conversation
--auto-fix was parsed by the CLI, documented in --help, and threaded into runSync(), but runSync() never read it back -- the flag was a complete no-op. Running loop-sync . --auto-fix produced identical output to running without the flag, with no indication that nothing had been fixed. --dry-run had the same problem: destructured, never used. Implements real auto-fix, scoped to what can be fixed correctly without guessing project-specific intent: - Missing STATE.md, gate.yaml, loop-budget.md, and loop-run-log.md are scaffolded with minimal, pattern-agnostic defaults (loop-run-log.md keeps the marker append-run-log.mjs depends on; gate.yaml ships a secure-by-default denylist). - A LOOP.md that exists but doesn't reference STATE.md gets a reference line appended. - LOOP.md and AGENTS.md are never fabricated when missing -- their content is pattern-specific (the goal, the workflow), so guessing it would be actively wrong. Those still just point at loop-init, now with --auto-fix mentioned as an option for the rest. - --dry-run now does what it always claimed to: with --auto-fix, it reports what would be scaffolded/changed without writing anything. The scaffold content is inlined in source rather than read from this monorepo's templates/*.template files, since loop-sync ships as a standalone npm package (files: ["dist"]) that runs against arbitrary target directories -- a path relative to the installed package wouldn't resolve once installed outside this checkout. Test plan: 4 new tests covering scaffold-on-missing, LOOP.md/AGENTS.md never being fabricated, --dry-run writing nothing, and the STATE.md reference append. Full clean rebuild + npm test: 15/15 passing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
cobusgreyling
approved these changes
Aug 17, 2026
cobusgreyling
left a comment
Owner
There was a problem hiding this comment.
Implements the documented --auto-fix/--dry-run flags that were previously no-ops. Scope is right: only pattern-agnostic files are scaffolded, LOOP.md/AGENTS.md stay report-only, dry-run writes nothing. Tests cover the four cases I care about.
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.
Problem
--auto-fix was parsed by the CLI, documented in --help, and threaded
into runSync(), but runSync() never read it back -- the flag was a
complete no-op. Running loop-sync . --auto-fix produced identical
output to running without the flag, with no indication that nothing
had been fixed. --dry-run had the same problem: destructured, never
used.
Fix
Implements real auto-fix, scoped to what can be fixed correctly
without guessing project-specific intent:
scaffolded with minimal, pattern-agnostic defaults (loop-run-log.md
keeps the marker append-run-log.mjs depends on; gate.yaml ships a
secure-by-default denylist).
reference line appended.
content is pattern-specific (the goal, the workflow), so guessing it
would be actively wrong. Those still just point at loop-init, now
with --auto-fix mentioned as an option for the rest.
reports what would be scaffolded/changed without writing anything.
The scaffold content is inlined in source rather than read from this
monorepo's templates/*.template files, since loop-sync ships as a
standalone npm package (files: ["dist"]) that runs against arbitrary
target directories -- a path relative to the installed package
wouldn't resolve once installed outside this checkout.
Test plan
4 new tests covering scaffold-on-missing, LOOP.md/AGENTS.md never
being fabricated, --dry-run writing nothing, and the STATE.md
reference append. Full clean rebuild + npm test: 15/15 passing.