feat(update,fix,doctor): auto-populate markers, validate YAML/model ids, add agentrig fix + --auto-fix - #15
Merged
Conversation
…ds, add agentrig fix + --auto-fix Closes the entire feedback loop from the markbook update-experience report — fewer surgical edits after `agentrig update` on any target repo. What changed ============ 1. Marker populator (src/core/markers.ts). The <!-- AGENTRIG:skills-inventory:start --> ... :end --> block in AGENTS.md is now rewritten deterministically by both `compile` AND `update`. `skillsInventory()` walks .agents/skills/ on disk (with manifest fallback) so user-added skills appear alongside AgentRig-bundled ones — surfaced by running on this repo's own 6 markbook-* skills. 2. YAML validation (src/core/validate.ts). `validateYaml()` parses every .agentrig/**/*.yml using `parseAllDocuments` so multi-doc scenario files are tolerated. `update` runs it post-install and exits non-zero on syntax errors. 3. Model-ID validation. `validateModelIds()` matches every .agentrig/agents/*.yml's `model:` against the Copilot SDK registry (live, when reachable) or a curated allowlist (offline fallback), with "did you mean…" suggestions. 4. `agentrig fix` + `agentrig update --auto-fix`. New deterministic repair engine (src/core/fix.ts): restores broken YAML from canonical, replaces unknown model ids with the safe `auto` fallback. Writes .bak backups; no agent / network needed. 5. `--diff` drift classification. Preserved files tagged 🔴 broken / 🟡 stale / 🟢 enhancement / ⚪ mixed with a per-severity summary at the top. 6. `update` enumerates added + preserved files inline (no more "11 files preserved" without naming them). 7. New files grouped + summarized by parent dir. 8. `doctor` install provenance + model-ID validation. Detects when the global `agentrig` binary resolves to a linked checkout vs the registry, and surfaces YAML / model-id validation findings; exits non-zero on any blocker. 9. Reconciliation history (state.json.reconciled[]). Records every preserved-file decision with a canonical hash so a future `update` skips re-prompting on files the user has consciously diverged on — unless canonical has drifted past the recorded hash. Audit changes ============= - New `marker-populated` check type in BOTH src/core/audit.ts and knowledge/templates/eval/static-audit.mjs (the in-repo audit) so they stay in lock-step. - `agents-skills-inventory` upgraded from a loose `file-contains` substring match to `marker-populated` — the audit now fails (correctly) if the block is empty, has unfilled placeholders, or omits any skill under .agents/skills/. - Knowledge bundle bumped 0.5.0 → 0.6.0; Changeset at .changeset/update-workflow-improvements.md. Docs ==== - README: new `fix` row + `--auto-fix` flag in Commands table; new "Self-healing the install" subsection. - docs/commands.md: extended `update`, `compile`, `doctor`; new `fix` section. - docs/getting-started.md: iterate block includes `--auto-fix` + `fix`. - knowledge/templates/AGENTS.md: notes that the skills-inventory marker is auto-populated. - .agents/wiki/skills-inventory-populator-enumerates-disk.md (new): gotcha log for the disk-enumeration fix (per critical rule #2). Verification ============ - `npm run build` clean under TypeScript strict. - CLI audit + in-repo `static-audit.mjs` both 100% / 100%. - Round-trip: broke state-machine.yml + injected `model: gpt-5` → both audits caught it → `agentrig fix` restored both → 100% recovered. - Doctor on this dev checkout correctly reports `linked checkout` + `npm latest: 0.10.0`. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Merged
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.
What this PR does
Implements all 9 improvements reported from the
@doidor/markbookagentrig updateexperience, so the next update on any target repo no longer needs the surgical hand-patching that motivated the report.<!-- AGENTRIG:skills-inventory:start -->block inAGENTS.mdis auto-rewritten by bothcompileandupdate; enumerates.agents/skills/on disk so user-added skills (e.g. the 6markbook-*skills in this very repo) appear alongside AgentRig-bundled onessrc/core/markers.ts(new),src/core/install.ts(filesystem walker)update— usesparseAllDocumentsso multi-doc scenario files are tolerated; broken state-machine.yml now blocks the updatesrc/core/validate.ts(new)listModels()when available, curated allowlist as offline fallback, "did you mean…" suggestionssrc/core/validate.ts, surfaced indoctorandupdateagentrig fix+agentrig update --auto-fix— deterministic repair engine; restores broken YAML from canonical and replaces unknown model ids (e.g. the retiredgpt-5) with the safeautofallback; writes.bakbackups; no agent / network neededsrc/core/fix.ts(new),src/commands/fix.ts(new)--diffdrift classification — preserved files tagged🔴 broken/🟡 stale/🟢 enhancement/⚪ mixedwith a per-severity summary at the topsrc/commands/update.ts:diffPreserved--skip-agentenumerates preserved files inline — no more "11 files preserved" without naming themsrc/commands/update.ts:logFileListdoctordetects npm-link installs + checks npm latest —linked-checkoutvsregistryprovenance, surfaces validation findings (YAML / model-id) as exit-blocking failuressrc/commands/doctor.ts:detectInstallProvenancestate.json.reconciled[]records per-file decisions + the canonical hash at decision time; the nextupdateskips re-prompting on files the user consciously diverged on, unless canonical has drifted past the recorded hashsrc/core/state.ts:ReconciledRecord,src/commands/update.ts:alreadyDivergedOnAudit upgrade
marker-populatedcheck type in bothsrc/core/audit.tsandknowledge/templates/eval/static-audit.mjsso CLI + in-repo audit stay in lock-step.agents-skills-inventoryupgraded from a loosefile-containssubstring match tomarker-populated— the audit now fails (correctly) if the block is empty, has unfilled placeholders, or omits any skill under.agents/skills/. This is what surfaced the disk-enumeration bug fixed in Automate releases via Changesets #1.Bonus find logged as a gotcha
The new strict check immediately caught a latent bug: the original
skillsInventory()only iteratedmanifest.artifacts, so user-added skills under.agents/skills/were silently dropped from the populated block. Fixed and logged in.agents/wiki/skills-inventory-populator-enumerates-disk.mdper critical-rule #2.Docs
README.md— newfixrow +--auto-fixflag in Commands table; new "Self-healing the install" subsection.docs/commands.md— extendedupdate,compile,doctor; newfixsection.docs/getting-started.md— iterate block now includes--auto-fix+fix.knowledge/templates/AGENTS.md— notes that the skills-inventory marker is auto-populated.Verification
npm run buildclean under TypeScript strict.static-audit.mjsboth 100% / 100%..agentrig/harness/state-machine.yml(appended invalid YAML).model: gpt-5(retired ID) into.agentrig/agents/developer.yml.eval --static→ P1 + P2 FAIL.doctor→ surfaced both validation findings + "did you mean…" suggestions + linked-checkout detection.agentrig fix→ restored state-machine.yml from canonical, replacedgpt-5withauto.eval --static→ back to 100%.0.5.0 → 0.6.0; Changeset at.changeset/update-workflow-improvements.md(minor bump).Out of scope
validateModelhook.