feat(harness): /orchestrator:sync — re-stamp managed files after plugin updates (closes #38) - #46
Merged
Merged
Conversation
…in updates (closes #38)
…rd/bound version parse; doc error vocab (#38) Reviewers found two linked defects: (1) sync.sh derived shipped_version by parsing scaffold.sh's MANAGED_VERSION= variable instead of the template file's own marker line, so the two could drift and a restamp would never converge (infinite re-restamp); (2) an oversized/malformed installed version marker made the -gt/-eq integer guards silently evaluate false under `if` (set -e does not abort there), falling through to a downgrade cp. Fix: derive shipped_version from managed_version_of() against the template path itself (the exact bytes a restamp writes), eliminating the scaffold.sh parse entirely and making restamp inherently idempotent. Add is_sane_version() to bound every parsed version (installed and shipped) to 1-9 digits before any integer comparison; malformed/oversized installed markers are now reported as a conflict instead of falling through to cp. Broken-install conditions (missing template, template with no valid marker) now consistently emit `error:` to stderr and exit nonzero, documented in both sync.sh's header and SKILL.md's vocabulary list.
robercano
approved these changes
Jul 4, 2026
robercano-ghbot
pushed a commit
that referenced
this pull request
Jul 5, 2026
…; sync is now shipped (#46) - Union-merge docs/USAGE.md: keep #48's plugin-flow rewrite structure, fold in main's phone-testing section for /orchestrator:test-pr (renamed from the unnamespaced /test-pr to match this branch's convention). - Update USAGE.md and MIGRATION.md: /orchestrator:sync is no longer "forthcoming" — it shipped in #46 — so document it as available and point at .claude/skills/sync/SKILL.md instead of telling readers to fall back to /orchestrator:setup.
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.
Packaging phase 3:
/orchestrator:syncAdds the sibling of
/orchestrator:setupthat reconciles scaffolded-but-MANAGED files in a consuming repo after a plugin update. Mirrors the setup deliverable's structure, style, version-marker convention, and shell idioms.Files (all under
.claude/**, module:harness).claude/commands/sync-orchestrator.md— thin command entry (pointer to the skill), mirroringsetup-orchestrator.md..claude/skills/sync/SKILL.md— the reconcile flow: read version markers, re-stamp managed files, three-way local-edit detection, print a diff summary, never touch user-owned files..claude/skills/sync/sync.sh— idempotent, offline, no-network reconcile logic mirroringscaffold.sh.Behavior
.claude/workflows/feature-fanout.js) using the@orchestrator-managed <name> vNmarkers/orchestrator:setupwrites. The managed-file table is one-line-per-file for easy extension.gates.json,CLAUDE.md,settings.local.json,.claude/state/(reuses the MANIFEST ownership classification — no divergent scheme).conflictand left untouched — never silently overwritten (offer merge or leave).shipped_versionis derived from the template's own marker (the bytes a restamp writes), so restamp is inherently idempotent.is_sane_versionbounds parsed version integers so a malformed/oversized marker can't bypass the never-downgrade guard.conflictexits 0.Verification
.claude/gates.jsonis still the template placeholder — no real commands).bash -nclean onsync.sh.all, every lens APPROVE after one fix iteration. Reviewers independently ran the full re-stamp ladder plus idempotency and malformed-marker regression cases against throwaway trees.Closes #38.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WNHtY86twXHEKsLEucSJyY