fix(kyberforge): fix scope walk-up and manifest-parsing bugs from PR #93 review
A fresh /code-review of the APM-native authoring retarget (PR #93) found several correctness bugs beyond the ones already fixed on this branch: - new-agent.sh silently walked a marker-less subdirectory under $HOME up to user scope, contradicting its own usage text ("user scope is checked directly, no walk-up") and risking scaffolding into shared global ~/.claude or ~/.copilot directories instead of the intended local path. - The hand-copied apm.yml type: manifest detector in new-agent.sh and new-skill.sh accepted mismatched quotes (e.g. `type: "skill'`) that validate.sh's regex correctly rejects, and silently dropped a final apm.yml line lacking a trailing newline — causing the scaffolder and validator to disagree on scope for identical input. - Plugin-scope agent frontmatter could still contain the apm-agent.md template's HTML comments at ship time with no audit signal, yet apm compile copies frontmatter verbatim and <!-- --> breaks YAML parsing on both downstream harnesses. - ADR-0016 asserted agent-audit already implements a SUGGESTION heuristic for tool-restriction-needing plugin-scope agents; it doesn't. - agent-audit/README.md still described the old plugin-pair model this PR replaced with a single-file allowlist model. - validate.sh's project/user-scope CC-only/Copilot-only field checks and counterpart-missing check lost their only test coverage when the old plugin-pair fixture was deleted. Also replaces an echo-into-sed two-value parse (4 forks per call) with a single space-separated echo + read in both scaffolders. Regression tests added for every fix above, including one for a bug this pass introduced and the test suite caught: an initial two-line echo + `read` attempt silently dropped the second value, since `read` consumes only one line regardless of embedded newlines. Full suite: 158 bats tests, 39 shell-script tests, 12/12 summary categories, 0 failures. Refs: #89, #93
This commit is contained in:
@@ -40,11 +40,13 @@ Absent `tools:` means inherit-all-tools on both harnesses — the one value that
|
||||
on either target, unlike a present, harness-specific value that is guaranteed wrong on at least
|
||||
one of them.
|
||||
|
||||
`agent-audit`, at plugin scope, flags — as a **SUGGESTION**, not a FAIL, since this is an
|
||||
upstream schema limitation rather than an authoring mistake — any agent whose description or
|
||||
body implies a need for tool restriction or a Claude-only behavior the frontmatter can no
|
||||
longer express. This gives visibility into the gap without pretending the schema can do
|
||||
something it can't.
|
||||
`agent-audit`, at plugin scope, is intended to flag — as a **SUGGESTION**, not a FAIL, since
|
||||
this is an upstream schema limitation rather than an authoring mistake — any agent whose
|
||||
description or body implies a need for tool restriction or a Claude-only behavior the
|
||||
frontmatter can no longer express. This would give visibility into the gap without pretending
|
||||
the schema can do something it can't. **Not yet implemented**: `check_apm_agent_file()` in
|
||||
`validate.sh` currently validates only the field allowlist, `name`, `description`, and
|
||||
body-emptiness/length — it has no heuristic for this case. Tracked as follow-up work.
|
||||
|
||||
### Scope boundary
|
||||
|
||||
|
||||
Reference in New Issue
Block a user