Skip to content

feat(tools): add loop-sync CLI for drift detection and configuration …#47

Open
hsms4710-pixel wants to merge 2 commits into
cobusgreyling:mainfrom
hsms4710-pixel:feat/add-loop-sync-tool
Open

feat(tools): add loop-sync CLI for drift detection and configuration …#47
hsms4710-pixel wants to merge 2 commits into
cobusgreyling:mainfrom
hsms4710-pixel:feat/add-loop-sync-tool

Conversation

@hsms4710-pixel

@hsms4710-pixel hsms4710-pixel commented Jun 22, 2026

Copy link
Copy Markdown

Summary

Adds loop-sync CLI tool for detecting drift between STATE.md and LOOP.md files, and synchronizing them. Addresses a common pain point where state and loop definitions become out of sync over time.

Changes

  • New pattern or starter (followed templates/pattern-template.md + updated registry.yaml)
  • Doc / example improvement
  • Tool change (loop-sync)
  • Story (includes real failure or surprise + lesson)

Checklist (from CONTRIBUTING)

  • All required sections present for patterns
  • Links work from README, patterns/README, starters/README, docs/index
  • No secrets, tokens, internal company URLs
  • STATE.md* examples use .example suffix
  • Safety-related content references docs/safety.md
  • Ran node tools/loop-audit/dist/cli.js . (score: 100/100) and addressed findings

Testing / Dogfood

  • loop-audit passes on this repo (score: 100/100)
  • Manual review of generated output - loop-sync . and test suite pass

Screenshots / Examples (if UI or command output)

Real loop-sync . output against this repo:

Loop Sync Report
=============================================
Score: 80/100 (healthy)

Found 2 issue(s):

[WARNINGS]:
   - LOOP.md: LOOP.md does not reference STATE.md
   - STATE.md <-> LOOP.md: Low structural similarity between STATE.md and LOOP.md

Suggestions:
   - Review STATE.md and LOOP.md for consistency

…sync

- Detect drift between STATE.md ↔ LOOP.md
- Check for missing required files (STATE.md, LOOP.md, AGENTS.md)
- Scan skills directory for version information
- Calculate consistency score (0-100) with health levels
- Provide actionable suggestions for fixing issues
- Support JSON and human-readable output formats
- Include comprehensive test suite

This tool helps teams maintain consistent Loop configurations
across their repositories and detect configuration drift early.

Closes #none (new feature)

@cobusgreyling cobusgreyling left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for the contribution. CI passed on our side. Before merge please:

  1. Add built dist/ files (see how loop-init / loop-audit do it package.json points at dist/cli.js but no dist is committed)

  2. Wire into repo CI / root tooling like the other tools

  3. Complete the PR checklist

@hsms4710-pixel

Copy link
Copy Markdown
Author

Audit Check Failure - Permission Issue

The audit check is failing with a 403 error:

POST /repos/cobusgreyling/loop-engineering/issues/47/comments
-> 403 Resource not accessible by integration

Root Cause

This is not a code issue with this PR. It is a GitHub Actions permission limitation for fork PRs:

  1. This PR is from a fork (hsms4710-pixel/loop-engineering)
  2. GitHub uses read-only tokens for fork PR workflows (security restriction)
  3. The audit.yml workflow tries to post a comment to this PR
  4. Posting comments requires issues: write permission
  5. The read-only token does not have this permission -> 403 error

Note

The validate check passed, and the audit logic itself works correctly (it calculated a score of 100/100). The only issue is posting the result as a comment.

The workflow permissions may need to be adjusted to handle fork PRs correctly.

- Build dist/ directory for loop-sync CLI
- Add !tools/loop-sync/dist/ to .gitignore
- Add test:loop-sync and update test:tools, build:tools scripts
- Fix TypeScript types in sync.ts (add help? and json? to SyncOptions)
@hsms4710-pixel

Copy link
Copy Markdown
Author

All 3 requirements are now met:

  1. Added dist/ directory (built output committed, matching loop-audit and loop-init convention)
  2. Wired into root tooling (test:loop-sync and build:tools scripts added to root package.json)
  3. Completed PR checklist (updated PR description following the template, all applicable items checked)

loop-audit passes with score 100/100. Ready for review.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants