Skip to content

Migrate JSONC reader + line locators to agent-gov-core@v0.1.1#35

Merged
Conalh merged 3 commits into
mainfrom
migrate-to-agent-gov-core
May 22, 2026
Merged

Migrate JSONC reader + line locators to agent-gov-core@v0.1.1#35
Conalh merged 3 commits into
mainfrom
migrate-to-agent-gov-core

Conversation

@Conalh
Copy link
Copy Markdown
Owner

@Conalh Conalh commented May 22, 2026

Summary

  • Adopts agent-gov-core@v0.1.1 for the JSONC reader and JSON line locators — the first consumer migration off the shared library.
  • Side-effect bug fix: JSONC comments and trailing commas are now stripped before JSON.parse. The old reader would have thrown on Claude settings files containing // comments.
  • The async ENOENT wrapper stays in ScopeTrail because that semantics (missing settings → empty config) is ScopeTrail-specific, not a shared concern.

Deletes the local copies of escapeRegExp, lineOfPattern, and the raw JSON.parse path; lineOfJsonKey / lineOfJsonStringValue now thinly wrap the core implementations to preserve the existing number | undefined return shape.

Test plan

  • npm run build — clean tsc build
  • npm test — 37/37 existing tests pass against the migrated reader
  • CI green on this PR

🤖 Generated with Claude Code

Conalh and others added 3 commits May 21, 2026 18:40
Replaces local hand-rolled JSON.parse and regex line locators with the
shared primitives. Side-effect: JSONC comments and trailing commas are
now stripped before parsing — the previous implementation would have
thrown on Claude settings with `//` comments.

The async ENOENT wrapper stays here because that's ScopeTrail-specific
behavior (missing settings = empty config, not a parse error).

All 37 existing tests pass against the migrated reader.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Action used to run dist/index.js directly without npm install, which worked
when ScopeTrail had no runtime deps. Now that discovery.ts imports
agent-gov-core, the action needs to populate node_modules first.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The pre-migration invariant 'no npm ci in action.yml' is replaced with
'no npm run build at action time' — dist/ is still committed and consumers
still skip the TypeScript compile, but they do an --omit=dev install so
runtime imports (now including agent-gov-core) resolve.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Conalh Conalh merged commit 062f357 into main May 22, 2026
3 checks passed
@Conalh Conalh deleted the migrate-to-agent-gov-core branch May 22, 2026 01:44
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.

1 participant