Skip to content

Import scripts with one base name; placeholder warnings for declared keys - #73

Merged
llima merged 13 commits into
mainfrom
fix/import-scripts-and-param-warnings
Oct 23, 2026
Merged

llima merged 13 commits into
mainfrom
fix/import-scripts-and-param-warnings

Conversation

@llima

@llima llima commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Version bumped to 0.34.2 (patch). Merging publishes craftar@0.34.2 to npm after approval in the npm environment.
  • import groups scripts and hooks that share a base name (compared without case: run-x.ps1 + run-x.sh, X.PS1 + x.sh) into one ingredient whose files lists every file. Before, the second file became a bogus same-profile variant <name>--<profile> with as: <name>. Two files whose names differ only in case are rejected (that ingredient only; they would collide on a case-insensitive checkout). A file left in a script or hook folder that import writes, and not in its files, is warned. A secret or marker rejection in a grouped script names the file that holds it. mergeEmitted is the one merge, shared with drift promote.
  • An unresolved {{key}} is warned only when some ingredient declares the key under params (with or without a default), or when it is under integrations. at Forge schema 3 or above. Any other {{…}}, such as an Angular template, is left verbatim silently. Plan.missingParams and the sync refusal for a declared key with no value are unchanged.
  • No emitted byte changes. Two visible effects, both in the README to 0.34.2:
    • --json warnings arrays can be shorter (no key changes), and doctor --strict can exit 0 where it exited 1.
    • A Forge imported before 0.34.2 keeps its shape until a re-import, which rewrites the old variant with both files.

Test plan

  • npm run typecheck: pass
  • npm run build: pass
  • npx vitest run --exclude test/ci.test.ts --maxWorkers=6: 3414 passed, 11 skipped (141 files), at e5e87fc
  • Oracle skipped: no fixture on this machine
  • New tests: test/import-script-groups.test.ts and test/param-warning-declared.test.ts, each shown failing before the fix. Mutation runs prove mergeEmitted, the integrations. exception and the same-run staging overlay (now tested with a pair of skills).
  • CI on ubuntu and windows. The case-collision test skips on a case-insensitive file system through a synchronous probe.

llima added 13 commits October 23, 2026 13:37
readEmitted returns one part per file; the scripts/hooks loop now groups
them by the ingredient name (lowercased base name) and merges with a
shared mergeEmitted helper. drift-promote also uses this helper.
One script/hook ingredient per base name; old Forges keep working,
a re-import updates the variant with both files.
Also add proper assertions in test 7 (S3), test 9 for grouped script
rejection location (S1), and unit tests for mergeEmitted (N5).
Add fileWhere helper for the three-way path logic (skill dir layout,
grouped script/hook, other). Use path.posix.dirname instead of
split/slice/join. Copy merged.warnings into report.warnings for the
script/hook loop (N1).
Warn when the key is declared by ANY resolved ingredient (with or
without a default), not just when declared without a default. A
default reaches only its own ingredient's files.
@llima
llima merged commit 8fd9759 into main Oct 23, 2026
8 checks passed
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