fix(kyberforge): address independent review of #154
Quote the template description so the raw scaffold is valid YAML, reject newline-containing names in new-instructions.sh, correct the empty-compile facts (exit 1, --clean exits 0), and finish removing commit steps from the skill-author, agent-author and forge references. Adds regression tests. Refs #148 Co-Authored-By: Claude Code <[email protected]> Claude-Session: https://claude.ai/code/session_01KkT7RSDwDbmrM9T34b6sTi
This commit is contained in:
1 parent
d576695bb9
commit
68fa2abb62
11 files changed
+34
-17
No files matched your search
@@ -1,6 +1,6 @@
|
||||
---
|
||||
# Delete these comments once filled in; Copilot receives this file verbatim.
|
||||
description: FILL IN: one line on what this rule covers. Only Copilot and Cursor keep it.
|
||||
description: "FILL IN: one line on what this rule covers. Only Copilot and Cursor keep it."
|
||||
applyTo: "FILL IN: quoted glob, e.g. **/*.py"
|
||||
# applyTo is always quoted: an unquoted ** is a YAML alias error and the rule
|
||||
# deploys unscoped. Several globs: "**/*.css,**/*.scss". Delete the line only
|
||||
|
||||
@@ -50,7 +50,7 @@ For Claude Code the body's first line or heading is the only descriptive text th
|
||||
- `--target claude` writes `CLAUDE.md`; Gemini writes `GEMINI.md` and `AGENTS.md`; every other target writes `AGENTS.md`.
|
||||
- Compile skips instructions already deployed natively, for Claude, Copilot and Antigravity only. With rules populated, `--target claude` exits 0, prints "produced no output files" and writes nothing. `--force-instructions` (alias `--no-dedup`) overrides.
|
||||
- Cursor, Windsurf, Kiro, Grok, Codex and OpenCode have no dedup: compile writes `AGENTS.md` that repeats rules the tool already loads natively.
|
||||
- A compile with no instruction primitives exits 0.
|
||||
- A package with no instruction primitives (skills only) makes plain `apm compile` exit 1 with "No instruction files found"; `apm compile --clean` exits 0.
|
||||
|
||||
## Native format facts
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ fi
|
||||
NAME="$1"
|
||||
ROOT="${2/#\~/$HOME}"
|
||||
|
||||
if ! grep -qE '^[a-z0-9]+(-[a-z0-9]+)*$' <<< "$NAME"; then
|
||||
if [[ ! $NAME =~ ^[a-z0-9]+(-[a-z0-9]+)*$ ]]; then
|
||||
echo "Error: name must use lowercase letters, numbers, and hyphens only." >&2
|
||||
echo " No leading, trailing, or consecutive hyphens." >&2
|
||||
echo " Received: '$NAME'" >&2
|
||||
|
||||
@@ -21,7 +21,7 @@ make_package() {
|
||||
fill() {
|
||||
sed -i -E \
|
||||
-e '/^#/{/^# FILL IN/!d}' \
|
||||
-e 's/^description: FILL IN.*/description: Python style rules/' \
|
||||
-e 's/^description: .?FILL IN.*/description: Python style rules/' \
|
||||
-e 's/^applyTo: .*/applyTo: "**\/*.py"/' \
|
||||
-e 's/^# FILL IN.*/# Python style/' \
|
||||
-e 's/^- FILL IN.*/- Use type hints./' \
|
||||
@@ -217,3 +217,21 @@ need_apm() {
|
||||
assert_output --partial "Missing 'description'"
|
||||
assert_output --partial "Empty content"
|
||||
}
|
||||
|
||||
@test "rejects a name containing a newline" {
|
||||
make_package
|
||||
run bash "$SCRIPT" $'my-rule\nextra' "$ROOT"
|
||||
assert_failure
|
||||
assert_output --partial "lowercase letters"
|
||||
assert [ ! -d "$ROOT/.apm" ]
|
||||
}
|
||||
|
||||
@test "the raw scaffold is valid YAML and compiles with no parse warnings" {
|
||||
need_apm
|
||||
make_package
|
||||
run bash "$SCRIPT" my-rule "$ROOT"
|
||||
assert_success
|
||||
cd "$ROOT"
|
||||
run apm compile --dry-run --target claude
|
||||
refute_output --partial "Failed to parse"
|
||||
}
|
||||
Reference in new issue
Block a user