dsh-pstack 0.1.0 → 0.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +92 -117
- package/assets/agents/comment-sicko.md +1 -1
- package/assets/agents/poteto-agent.md +2 -2
- package/assets/docs/guide/01-setup.md +9 -9
- package/assets/docs/guide/02-poteto-mode.md +4 -4
- package/assets/docs/guide/05-build-and-clean.md +3 -3
- package/assets/docs/guide/06-verify-and-ship.md +2 -2
- package/assets/docs/guide/07-overnight.md +10 -12
- package/assets/docs/guide/09-make-it-yours.md +2 -6
- package/assets/docs/guide/10-recipes-and-pitfalls.md +3 -3
- package/assets/docs/guide/README.md +1 -1
- package/assets/docs/guide/images/design.jpg +0 -0
- package/assets/docs/guide/images/overnight.jpg +0 -0
- package/assets/docs/guide/images/recipes.jpg +0 -0
- package/assets/docs/guide/images/router.jpg +0 -0
- package/assets/docs/guide/images/understanding.jpg +0 -0
- package/assets/docs/guide/images/verification.jpg +0 -0
- package/assets/docs/harness/dsh.md +60 -65
- package/assets/docs/pstack-models.example.md +40 -9
- package/assets/skills/architect/SKILL.md +12 -12
- package/assets/skills/arena/SKILL.md +11 -11
- package/assets/skills/automate-me/SKILL.md +15 -14
- package/assets/skills/benchmark-checklist/SKILL.md +0 -2
- package/assets/skills/blast-radius/SKILL.md +5 -5
- package/assets/skills/bro/SKILL.md +0 -2
- package/assets/skills/correct/SKILL.md +0 -2
- package/assets/skills/create-formal-verification-skill/SKILL.md +2 -2
- package/assets/skills/create-verification-skill/SKILL.md +2 -2
- package/assets/skills/figure-it-out/SKILL.md +13 -13
- package/assets/skills/how/SKILL.md +6 -6
- package/assets/skills/how/references/explainer-prompt.md +1 -1
- package/assets/skills/in-your-own-words/SKILL.md +0 -2
- package/assets/skills/interrogate/SKILL.md +9 -7
- package/assets/skills/interrogate/references/rubric.md +1 -1
- package/assets/skills/ketchup/SKILL.md +4 -4
- package/assets/skills/maintain-formal-verification-skill/SKILL.md +2 -2
- package/assets/skills/maintain-verification-skill/SKILL.md +3 -3
- package/assets/skills/no-comments/SKILL.md +7 -7
- package/assets/skills/poteto-help/SKILL.md +32 -31
- package/assets/skills/poteto-help/references/prompting.md +1 -1
- package/assets/skills/poteto-help/references/recipes.md +1 -1
- package/assets/skills/poteto-mode/SKILL.md +17 -19
- package/assets/skills/poteto-mode/playbooks/authoring-a-skill.md +3 -3
- package/assets/skills/poteto-mode/playbooks/autonomous-run.md +6 -4
- package/assets/skills/poteto-mode/playbooks/autopilot-full.md +6 -6
- package/assets/skills/poteto-mode/playbooks/autopilot-stack.md +2 -2
- package/assets/skills/poteto-mode/playbooks/babysit.md +3 -3
- package/assets/skills/poteto-mode/playbooks/bug-fix.md +7 -7
- package/assets/skills/poteto-mode/playbooks/eval.md +3 -3
- package/assets/skills/poteto-mode/playbooks/feature.md +8 -8
- package/assets/skills/poteto-mode/playbooks/hillclimb.md +3 -3
- package/assets/skills/poteto-mode/playbooks/investigation.md +2 -2
- package/assets/skills/poteto-mode/playbooks/multi-phase-plan.md +21 -21
- package/assets/skills/poteto-mode/playbooks/opening-a-pr.md +6 -6
- package/assets/skills/poteto-mode/playbooks/orchestrate.md +13 -13
- package/assets/skills/poteto-mode/playbooks/pause-safely.md +2 -2
- package/assets/skills/poteto-mode/playbooks/perf-issue.md +6 -6
- package/assets/skills/poteto-mode/playbooks/prototype.md +4 -4
- package/assets/skills/poteto-mode/playbooks/refactoring.md +9 -9
- package/assets/skills/poteto-mode/playbooks/runtime-forensics.md +3 -3
- package/assets/skills/poteto-mode/playbooks/session-pickup.md +2 -2
- package/assets/skills/poteto-mode/playbooks/shipping.md +2 -2
- package/assets/skills/poteto-mode/playbooks/trace-forensics.md +2 -2
- package/assets/skills/poteto-mode/playbooks/visual-parity.md +5 -5
- package/assets/skills/poteto-mode/playbooks/worktree-cleanup.md +14 -6
- package/assets/skills/poteto-mode/scripts/check-plan.mjs +85 -70
- package/assets/skills/poteto-mode/scripts/check-plan.test.mjs +343 -0
- package/assets/skills/poteto-mode/scripts/orch/orch.mjs +4282 -0
- package/assets/skills/poteto-mode/scripts/orch/orch.test.mjs +2042 -0
- package/assets/skills/poteto-mode/scripts/watch-pr/cli.test.mjs +5101 -0
- package/assets/skills/poteto-mode/scripts/watch-pr/github.test.mjs +1177 -0
- package/assets/skills/poteto-mode/scripts/watch-pr/policy.test.mjs +1441 -0
- package/assets/skills/poteto-mode/scripts/watch-pr/watch-pr.mjs +4601 -0
- package/assets/skills/poteto-mode/scripts/worktree-audit.mjs +675 -0
- package/assets/skills/principle-attack-the-premise/SKILL.md +0 -2
- package/assets/skills/principle-boundary-discipline/SKILL.md +0 -2
- package/assets/skills/principle-build-the-lever/SKILL.md +0 -3
- package/assets/skills/principle-encode-lessons-in-structure/SKILL.md +0 -2
- package/assets/skills/principle-exhaust-the-design-space/SKILL.md +0 -2
- package/assets/skills/principle-experience-first/SKILL.md +0 -2
- package/assets/skills/principle-explain-the-number/SKILL.md +0 -2
- package/assets/skills/principle-fix-root-causes/SKILL.md +0 -2
- package/assets/skills/principle-foundational-thinking/SKILL.md +0 -2
- package/assets/skills/principle-guard-the-context-window/SKILL.md +0 -2
- package/assets/skills/principle-laziness-protocol/SKILL.md +0 -2
- package/assets/skills/principle-make-operations-idempotent/SKILL.md +0 -2
- package/assets/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +0 -2
- package/assets/skills/principle-minimize-reader-load/SKILL.md +0 -2
- package/assets/skills/principle-model-the-domain/SKILL.md +0 -2
- package/assets/skills/principle-never-block-on-the-human/SKILL.md +0 -2
- package/assets/skills/principle-outcome-oriented-execution/SKILL.md +0 -2
- package/assets/skills/principle-prove-it-works/SKILL.md +2 -2
- package/assets/skills/principle-redesign-from-first-principles/SKILL.md +0 -2
- package/assets/skills/principle-separate-before-serializing-shared-state/SKILL.md +0 -2
- package/assets/skills/principle-sequence-verifiable-units/SKILL.md +0 -2
- package/assets/skills/principle-subtract-before-you-add/SKILL.md +0 -2
- package/assets/skills/principle-test-behavior-not-implementation/SKILL.md +0 -2
- package/assets/skills/principle-type-system-discipline/SKILL.md +0 -2
- package/assets/skills/recall/SKILL.md +9 -9
- package/assets/skills/reflect/SKILL.md +20 -21
- package/assets/skills/reflect/references/divergent-reviewer.md +4 -4
- package/assets/skills/reflect/references/judgment-reviewer.md +2 -2
- package/assets/skills/reflect/references/synthesizer.md +6 -6
- package/assets/skills/reflect/references/tooling-reviewer.md +2 -2
- package/assets/skills/setup-pstack/SKILL.md +28 -37
- package/assets/skills/sharpen/SKILL.md +0 -2
- package/assets/skills/show-me-your-work/SKILL.md +9 -9
- package/assets/skills/show-me-your-work/scripts/log.mjs +108 -0
- package/assets/skills/swarm/SKILL.md +8 -6
- package/assets/skills/tdd/SKILL.md +0 -2
- package/assets/skills/teach/SKILL.md +2 -2
- package/assets/skills/technical-writing/SKILL.md +2 -2
- package/assets/skills/typescript-best-practices/SKILL.md +6 -4
- package/assets/skills/unslop/SKILL.md +0 -2
- package/assets/skills/why/SKILL.md +9 -9
- package/cordis.patch.yml +33 -14
- package/dist/frontmatter-BQX3ekwP.mjs +229 -0
- package/dist/frontmatter-BQX3ekwP.mjs.map +1 -0
- package/dist/history.d.mts +429 -0
- package/dist/history.mjs +1129 -0
- package/dist/history.mjs.map +1 -0
- package/dist/host-contract-o47JH_r8.d.mts +527 -0
- package/dist/index.d.mts +273 -11
- package/dist/index.mjs +248 -148
- package/dist/index.mjs.map +1 -1
- package/dist/paths-D_JlVmBk.mjs +42 -0
- package/dist/paths-D_JlVmBk.mjs.map +1 -0
- package/dist/script.d.mts +193 -0
- package/dist/script.mjs +782 -0
- package/dist/script.mjs.map +1 -0
- package/dist/subagent.d.mts +306 -100
- package/dist/subagent.mjs +1309 -343
- package/dist/subagent.mjs.map +1 -1
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +55 -41
- package/static/icon.png +0 -0
- package/assets/skills/poteto-mode/scripts/bootstrap.ts +0 -62
- package/assets/skills/poteto-mode/scripts/bun.lock +0 -67
- package/assets/skills/poteto-mode/scripts/check-plan.test.ts +0 -96
- package/assets/skills/poteto-mode/scripts/orch/orch.test.ts +0 -761
- package/assets/skills/poteto-mode/scripts/orch/orch.ts +0 -590
- package/assets/skills/poteto-mode/scripts/orch/store.ts +0 -1677
- package/assets/skills/poteto-mode/scripts/package.json +0 -16
- package/assets/skills/poteto-mode/scripts/watch-pr/cli.test.ts +0 -224
- package/assets/skills/poteto-mode/scripts/watch-pr/cli.ts +0 -223
- package/assets/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.ts +0 -129
- package/assets/skills/poteto-mode/scripts/watch-pr/github.test.ts +0 -436
- package/assets/skills/poteto-mode/scripts/watch-pr/github.ts +0 -718
- package/assets/skills/poteto-mode/scripts/watch-pr/policy.test.ts +0 -420
- package/assets/skills/poteto-mode/scripts/watch-pr/policy.ts +0 -836
- package/assets/skills/poteto-mode/scripts/watch-pr/render.ts +0 -169
- package/assets/skills/poteto-mode/scripts/watch-pr/tsconfig.json +0 -13
- package/assets/skills/poteto-mode/scripts/watch-pr/types.compile.ts +0 -93
- package/assets/skills/poteto-mode/scripts/watch-pr/types.ts +0 -413
- package/assets/skills/poteto-mode/scripts/watch-pr/watch-pr +0 -6
- package/assets/skills/poteto-mode/scripts/worktree-audit.sh +0 -127
- package/assets/skills/show-me-your-work/scripts/log.sh +0 -42
- package/dist/LICENSE +0 -22
- package/dist/README.md +0 -159
- package/dist/assets/agents/comment-sicko.md +0 -32
- package/dist/assets/agents/poteto-agent.md +0 -8
- package/dist/assets/docs/guide/01-setup.md +0 -64
- package/dist/assets/docs/guide/02-poteto-mode.md +0 -139
- package/dist/assets/docs/guide/03-understand.md +0 -79
- package/dist/assets/docs/guide/04-design.md +0 -133
- package/dist/assets/docs/guide/05-build-and-clean.md +0 -83
- package/dist/assets/docs/guide/06-verify-and-ship.md +0 -152
- package/dist/assets/docs/guide/07-overnight.md +0 -122
- package/dist/assets/docs/guide/08-principles.md +0 -72
- package/dist/assets/docs/guide/09-make-it-yours.md +0 -100
- package/dist/assets/docs/guide/10-recipes-and-pitfalls.md +0 -180
- package/dist/assets/docs/guide/README.md +0 -38
- package/dist/assets/docs/harness/dsh.md +0 -65
- package/dist/assets/docs/pstack-models.example.md +0 -23
- package/dist/assets/skills/architect/SKILL.md +0 -81
- package/dist/assets/skills/architect/references/design-red-flags.md +0 -57
- package/dist/assets/skills/architect/references/rationale-template.md +0 -35
- package/dist/assets/skills/architect/references/runner-prompt.md +0 -20
- package/dist/assets/skills/arena/SKILL.md +0 -50
- package/dist/assets/skills/automate-me/SKILL.md +0 -105
- package/dist/assets/skills/benchmark-checklist/SKILL.md +0 -41
- package/dist/assets/skills/blast-radius/SKILL.md +0 -52
- package/dist/assets/skills/bro/SKILL.md +0 -9
- package/dist/assets/skills/correct/SKILL.md +0 -34
- package/dist/assets/skills/create-formal-verification-skill/SKILL.md +0 -43
- package/dist/assets/skills/create-verification-skill/SKILL.md +0 -46
- package/dist/assets/skills/create-verification-skill/references/feature-map-example/README.md +0 -47
- package/dist/assets/skills/create-verification-skill/references/feature-map-example/create-note.md +0 -39
- package/dist/assets/skills/create-verification-skill/references/feature-map-example/search.md +0 -45
- package/dist/assets/skills/figure-it-out/SKILL.md +0 -54
- package/dist/assets/skills/how/SKILL.md +0 -38
- package/dist/assets/skills/how/references/explainer-prompt.md +0 -55
- package/dist/assets/skills/how/references/explorer-prompt.md +0 -35
- package/dist/assets/skills/in-your-own-words/SKILL.md +0 -9
- package/dist/assets/skills/interrogate/SKILL.md +0 -69
- package/dist/assets/skills/interrogate/references/code-quality-review.md +0 -47
- package/dist/assets/skills/interrogate/references/lead-judgment.md +0 -39
- package/dist/assets/skills/interrogate/references/reviewer-prompt.md +0 -62
- package/dist/assets/skills/interrogate/references/rubric.md +0 -77
- package/dist/assets/skills/ketchup/SKILL.md +0 -45
- package/dist/assets/skills/maintain-formal-verification-skill/SKILL.md +0 -60
- package/dist/assets/skills/maintain-verification-skill/SKILL.md +0 -41
- package/dist/assets/skills/no-comments/SKILL.md +0 -26
- package/dist/assets/skills/poteto-help/SKILL.md +0 -161
- package/dist/assets/skills/poteto-help/references/prompting.md +0 -51
- package/dist/assets/skills/poteto-help/references/recipes.md +0 -51
- package/dist/assets/skills/poteto-mode/SKILL.md +0 -153
- package/dist/assets/skills/poteto-mode/playbooks/authoring-a-skill.md +0 -12
- package/dist/assets/skills/poteto-mode/playbooks/autonomous-run.md +0 -13
- package/dist/assets/skills/poteto-mode/playbooks/autopilot-full.md +0 -25
- package/dist/assets/skills/poteto-mode/playbooks/autopilot-stack.md +0 -12
- package/dist/assets/skills/poteto-mode/playbooks/babysit.md +0 -23
- package/dist/assets/skills/poteto-mode/playbooks/bug-fix.md +0 -15
- package/dist/assets/skills/poteto-mode/playbooks/eval.md +0 -25
- package/dist/assets/skills/poteto-mode/playbooks/feature.md +0 -21
- package/dist/assets/skills/poteto-mode/playbooks/hillclimb.md +0 -21
- package/dist/assets/skills/poteto-mode/playbooks/investigation.md +0 -14
- package/dist/assets/skills/poteto-mode/playbooks/multi-phase-plan.md +0 -155
- package/dist/assets/skills/poteto-mode/playbooks/opening-a-pr.md +0 -34
- package/dist/assets/skills/poteto-mode/playbooks/orchestrate.md +0 -112
- package/dist/assets/skills/poteto-mode/playbooks/pause-safely.md +0 -10
- package/dist/assets/skills/poteto-mode/playbooks/perf-issue.md +0 -25
- package/dist/assets/skills/poteto-mode/playbooks/prototype.md +0 -14
- package/dist/assets/skills/poteto-mode/playbooks/refactoring.md +0 -16
- package/dist/assets/skills/poteto-mode/playbooks/runtime-forensics.md +0 -11
- package/dist/assets/skills/poteto-mode/playbooks/session-pickup.md +0 -11
- package/dist/assets/skills/poteto-mode/playbooks/shipping.md +0 -12
- package/dist/assets/skills/poteto-mode/playbooks/trace-forensics.md +0 -14
- package/dist/assets/skills/poteto-mode/playbooks/visual-parity.md +0 -11
- package/dist/assets/skills/poteto-mode/playbooks/worktree-cleanup.md +0 -12
- package/dist/assets/skills/poteto-mode/references/bugbot-triage.md +0 -142
- package/dist/assets/skills/poteto-mode/scripts/bootstrap.ts +0 -62
- package/dist/assets/skills/poteto-mode/scripts/bun.lock +0 -67
- package/dist/assets/skills/poteto-mode/scripts/check-plan.mjs +0 -205
- package/dist/assets/skills/poteto-mode/scripts/check-plan.test.ts +0 -96
- package/dist/assets/skills/poteto-mode/scripts/orch/orch.test.ts +0 -761
- package/dist/assets/skills/poteto-mode/scripts/orch/orch.ts +0 -590
- package/dist/assets/skills/poteto-mode/scripts/orch/store.ts +0 -1677
- package/dist/assets/skills/poteto-mode/scripts/package.json +0 -16
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/cli.test.ts +0 -224
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/cli.ts +0 -223
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.ts +0 -129
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/github.test.ts +0 -436
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/github.ts +0 -718
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/policy.test.ts +0 -420
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/policy.ts +0 -836
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/render.ts +0 -169
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/tsconfig.json +0 -13
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/types.compile.ts +0 -93
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/types.ts +0 -413
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/watch-pr +0 -6
- package/dist/assets/skills/poteto-mode/scripts/worktree-audit.sh +0 -127
- package/dist/assets/skills/principle-attack-the-premise/SKILL.md +0 -23
- package/dist/assets/skills/principle-boundary-discipline/SKILL.md +0 -36
- package/dist/assets/skills/principle-build-the-lever/SKILL.md +0 -26
- package/dist/assets/skills/principle-encode-lessons-in-structure/SKILL.md +0 -13
- package/dist/assets/skills/principle-exhaust-the-design-space/SKILL.md +0 -11
- package/dist/assets/skills/principle-experience-first/SKILL.md +0 -21
- package/dist/assets/skills/principle-explain-the-number/SKILL.md +0 -19
- package/dist/assets/skills/principle-fix-root-causes/SKILL.md +0 -23
- package/dist/assets/skills/principle-foundational-thinking/SKILL.md +0 -23
- package/dist/assets/skills/principle-guard-the-context-window/SKILL.md +0 -14
- package/dist/assets/skills/principle-laziness-protocol/SKILL.md +0 -12
- package/dist/assets/skills/principle-make-operations-idempotent/SKILL.md +0 -24
- package/dist/assets/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +0 -16
- package/dist/assets/skills/principle-minimize-reader-load/SKILL.md +0 -20
- package/dist/assets/skills/principle-model-the-domain/SKILL.md +0 -26
- package/dist/assets/skills/principle-never-block-on-the-human/SKILL.md +0 -17
- package/dist/assets/skills/principle-outcome-oriented-execution/SKILL.md +0 -23
- package/dist/assets/skills/principle-prove-it-works/SKILL.md +0 -24
- package/dist/assets/skills/principle-redesign-from-first-principles/SKILL.md +0 -18
- package/dist/assets/skills/principle-separate-before-serializing-shared-state/SKILL.md +0 -18
- package/dist/assets/skills/principle-sequence-verifiable-units/SKILL.md +0 -19
- package/dist/assets/skills/principle-subtract-before-you-add/SKILL.md +0 -20
- package/dist/assets/skills/principle-test-behavior-not-implementation/SKILL.md +0 -22
- package/dist/assets/skills/principle-type-system-discipline/SKILL.md +0 -15
- package/dist/assets/skills/recall/SKILL.md +0 -37
- package/dist/assets/skills/reflect/SKILL.md +0 -70
- package/dist/assets/skills/reflect/references/divergent-reviewer.md +0 -38
- package/dist/assets/skills/reflect/references/judgment-reviewer.md +0 -37
- package/dist/assets/skills/reflect/references/synthesizer.md +0 -56
- package/dist/assets/skills/reflect/references/tooling-reviewer.md +0 -48
- package/dist/assets/skills/setup-pstack/SKILL.md +0 -76
- package/dist/assets/skills/sharpen/SKILL.md +0 -18
- package/dist/assets/skills/show-me-your-work/SKILL.md +0 -84
- package/dist/assets/skills/show-me-your-work/references/decision-log-template.tsv +0 -1
- package/dist/assets/skills/show-me-your-work/scripts/log.sh +0 -42
- package/dist/assets/skills/swarm/SKILL.md +0 -41
- package/dist/assets/skills/tdd/SKILL.md +0 -44
- package/dist/assets/skills/teach/SKILL.md +0 -23
- package/dist/assets/skills/technical-writing/SKILL.md +0 -108
- package/dist/assets/skills/typescript-best-practices/SKILL.md +0 -32
- package/dist/assets/skills/typescript-best-practices/references/patterns.md +0 -328
- package/dist/assets/skills/unslop/SKILL.md +0 -64
- package/dist/assets/skills/why/SKILL.md +0 -100
- package/dist/assets/skills/why/references/epistemics.md +0 -71
- package/dist/assets/skills/why/references/investigator-prompt.md +0 -84
- package/dist/assets/skills/why/references/source-playbook.md +0 -17
- package/dist/assets/skills/why/references/sources/code-archaeology.md +0 -51
- package/dist/assets/skills/why/references/sources/databricks.md +0 -70
- package/dist/assets/skills/why/references/sources/datadog.md +0 -97
- package/dist/assets/skills/why/references/sources/incident-postmortem.md +0 -5
- package/dist/assets/skills/why/references/sources/linear.md +0 -48
- package/dist/assets/skills/why/references/sources/notion.md +0 -55
- package/dist/assets/skills/why/references/sources/sentry.md +0 -66
- package/dist/assets/skills/why/references/sources/slack.md +0 -17
- package/dist/assets/skills/why/references/synthesizer-prompt.md +0 -129
- package/dist/cordis.patch.yml +0 -20
- package/dist/paths-Bbai4CaT.mjs +0 -16
- package/dist/paths-Bbai4CaT.mjs.map +0 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
//#region src/frontmatter.ts
|
|
2
|
+
const SKILL_CONSUMED_FIELDS = [
|
|
3
|
+
"name",
|
|
4
|
+
"description",
|
|
5
|
+
"disable-model-invocation",
|
|
6
|
+
"user-invocable",
|
|
7
|
+
"whenToUse"
|
|
8
|
+
];
|
|
9
|
+
const SKILL_DROPPED_FIELDS = [
|
|
10
|
+
"icon",
|
|
11
|
+
"color",
|
|
12
|
+
"paths"
|
|
13
|
+
];
|
|
14
|
+
const AGENT_CONSUMED_FIELDS = ["name", "description"];
|
|
15
|
+
const AGENT_DROPPED_FIELDS = ["is_background"];
|
|
16
|
+
const MAX_SKILL_NAME_LENGTH = 64;
|
|
17
|
+
const SKILL_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
18
|
+
var FrontmatterError = class extends Error {
|
|
19
|
+
constructor(message) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.name = "FrontmatterError";
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
function parseFrontmatter(source) {
|
|
25
|
+
const eol = detectEol(source);
|
|
26
|
+
const lines = (eol === "\r\n" ? source.replaceAll("\r\n", "\n") : source).split("\n");
|
|
27
|
+
if (lines[0] !== "---") throw new FrontmatterError("frontmatter: file must start with a \"---\" line");
|
|
28
|
+
const closing = lines.indexOf("---", 1);
|
|
29
|
+
if (closing === -1) throw new FrontmatterError("frontmatter: missing closing \"---\" delimiter");
|
|
30
|
+
const data = parseBlock(lines.slice(1, closing));
|
|
31
|
+
const body = lines.slice(closing + 1).join("\n");
|
|
32
|
+
return {
|
|
33
|
+
data,
|
|
34
|
+
body: eol === "\r\n" ? body.replaceAll("\n", eol) : body
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function validateSkillFrontmatter(data, source) {
|
|
38
|
+
rejectUnknownFields(data, source, SKILL_CONSUMED_FIELDS, SKILL_DROPPED_FIELDS);
|
|
39
|
+
const name = readName(data, source);
|
|
40
|
+
const description = readDescription(data, source);
|
|
41
|
+
const whenToUse = data["whenToUse"];
|
|
42
|
+
if (whenToUse !== void 0 && whenToUse.trim() === "") throw new FrontmatterError(`${source}: "whenToUse" must not be empty`);
|
|
43
|
+
return {
|
|
44
|
+
name,
|
|
45
|
+
description,
|
|
46
|
+
disableModelInvocation: readBoolean(data, "disable-model-invocation", source, false),
|
|
47
|
+
userInvocable: readBoolean(data, "user-invocable", source, true),
|
|
48
|
+
...whenToUse === void 0 ? {} : { whenToUse }
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function validateAgentFrontmatter(data, source) {
|
|
52
|
+
rejectUnknownFields(data, source, AGENT_CONSUMED_FIELDS, AGENT_DROPPED_FIELDS);
|
|
53
|
+
return {
|
|
54
|
+
name: readName(data, source),
|
|
55
|
+
description: readDescription(data, source)
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function serializeSkillFrontmatter(data) {
|
|
59
|
+
const lines = [
|
|
60
|
+
"---",
|
|
61
|
+
`name: ${formatScalar(data.name)}`,
|
|
62
|
+
`description: ${formatScalar(data.description)}`
|
|
63
|
+
];
|
|
64
|
+
if (data.disableModelInvocation) lines.push("disable-model-invocation: true");
|
|
65
|
+
if (!data.userInvocable) lines.push("user-invocable: false");
|
|
66
|
+
if (data.whenToUse !== void 0) lines.push(`whenToUse: ${formatScalar(data.whenToUse)}`);
|
|
67
|
+
lines.push("---");
|
|
68
|
+
return `${lines.join("\n")}\n`;
|
|
69
|
+
}
|
|
70
|
+
function serializeAgentFrontmatter(data) {
|
|
71
|
+
return [
|
|
72
|
+
"---",
|
|
73
|
+
`name: ${formatScalar(data.name)}`,
|
|
74
|
+
`description: ${formatScalar(data.description)}`,
|
|
75
|
+
"---",
|
|
76
|
+
""
|
|
77
|
+
].join("\n");
|
|
78
|
+
}
|
|
79
|
+
function skillDroppedFields(data, source) {
|
|
80
|
+
return droppedFields(data, source, SKILL_DROPPED_FIELDS);
|
|
81
|
+
}
|
|
82
|
+
function agentDroppedFields(data, source) {
|
|
83
|
+
return droppedFields(data, source, AGENT_DROPPED_FIELDS);
|
|
84
|
+
}
|
|
85
|
+
function droppedFields(data, source, fields) {
|
|
86
|
+
return fields.flatMap((field) => {
|
|
87
|
+
const value = data[field];
|
|
88
|
+
return value === void 0 ? [] : [{
|
|
89
|
+
file: source,
|
|
90
|
+
field,
|
|
91
|
+
value
|
|
92
|
+
}];
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function detectEol(source) {
|
|
96
|
+
if (!source.includes("\r\n")) return "\n";
|
|
97
|
+
const withoutCrlf = source.replaceAll("\r\n", "");
|
|
98
|
+
if (withoutCrlf.includes("\r") || withoutCrlf.includes("\n")) throw new FrontmatterError("frontmatter: mixed line endings are not supported");
|
|
99
|
+
return "\r\n";
|
|
100
|
+
}
|
|
101
|
+
function parseBlock(lines) {
|
|
102
|
+
const data = {};
|
|
103
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
104
|
+
const line = lines[index];
|
|
105
|
+
const trimmed = line.trim();
|
|
106
|
+
if (trimmed === "" || trimmed.startsWith("#")) continue;
|
|
107
|
+
if (trimmed !== line) throw new FrontmatterError(`frontmatter: unexpected indented line "${trimmed}"`);
|
|
108
|
+
const entry = /^([A-Za-z_][A-Za-z0-9_-]*):(.*)$/.exec(line);
|
|
109
|
+
if (entry === null) throw new FrontmatterError(`frontmatter: expected "key: value", got "${line}"`);
|
|
110
|
+
const key = entry[1];
|
|
111
|
+
const rest = entry[2];
|
|
112
|
+
if (rest !== "" && !rest.startsWith(" ")) throw new FrontmatterError(`frontmatter: missing space after "${key}:"`);
|
|
113
|
+
if (Object.hasOwn(data, key)) throw new FrontmatterError(`frontmatter: duplicate key "${key}"`);
|
|
114
|
+
const raw = rest.trim();
|
|
115
|
+
if (raw === ">" || raw === ">-" || raw === "|" || raw === "|-") {
|
|
116
|
+
const block = [];
|
|
117
|
+
let cursor = index + 1;
|
|
118
|
+
while (cursor < lines.length) {
|
|
119
|
+
const candidate = lines[cursor];
|
|
120
|
+
if (candidate.trim() !== "" && !candidate.startsWith(" ") && !candidate.startsWith(" ")) break;
|
|
121
|
+
block.push(candidate);
|
|
122
|
+
cursor += 1;
|
|
123
|
+
}
|
|
124
|
+
while (block.length > 0 && block.at(-1).trim() === "") block.pop();
|
|
125
|
+
if (block.length === 0) throw new FrontmatterError(`frontmatter: "${key}" has an empty ${raw} block`);
|
|
126
|
+
data[key] = parseBlockScalar(block, raw, key);
|
|
127
|
+
index = cursor - 1;
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
data[key] = parseScalar(raw, key);
|
|
131
|
+
}
|
|
132
|
+
return data;
|
|
133
|
+
}
|
|
134
|
+
function parseScalar(raw, key) {
|
|
135
|
+
if (raw === "") return "";
|
|
136
|
+
if (raw.startsWith("\"")) return parseDoubleQuoted(raw, key);
|
|
137
|
+
if (raw.startsWith("'")) return parseSingleQuoted(raw, key);
|
|
138
|
+
return raw;
|
|
139
|
+
}
|
|
140
|
+
function parseDoubleQuoted(raw, key) {
|
|
141
|
+
if (raw.length < 2 || !raw.endsWith("\"")) throw new FrontmatterError(`frontmatter: unterminated double-quoted value for "${key}"`);
|
|
142
|
+
const inner = raw.slice(1, -1);
|
|
143
|
+
let value = "";
|
|
144
|
+
for (let index = 0; index < inner.length; index += 1) {
|
|
145
|
+
const character = inner[index];
|
|
146
|
+
if (character !== "\\") {
|
|
147
|
+
value += character;
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
const escaped = inner[index += 1];
|
|
151
|
+
if (escaped === "\"") value += "\"";
|
|
152
|
+
else if (escaped === "\\") value += "\\";
|
|
153
|
+
else if (escaped === "n") value += "\n";
|
|
154
|
+
else throw new FrontmatterError(`frontmatter: unsupported escape "\\${escaped ?? ""}" in "${key}"`);
|
|
155
|
+
}
|
|
156
|
+
return value;
|
|
157
|
+
}
|
|
158
|
+
function parseSingleQuoted(raw, key) {
|
|
159
|
+
if (raw.length < 2 || !raw.endsWith("'")) throw new FrontmatterError(`frontmatter: unterminated single-quoted value for "${key}"`);
|
|
160
|
+
const inner = raw.slice(1, -1);
|
|
161
|
+
let value = "";
|
|
162
|
+
for (let index = 0; index < inner.length; index += 1) {
|
|
163
|
+
const character = inner[index];
|
|
164
|
+
if (character !== "'") {
|
|
165
|
+
value += character;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (inner[index + 1] === "'") {
|
|
169
|
+
value += "'";
|
|
170
|
+
index += 1;
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
throw new FrontmatterError(`frontmatter: unescaped single quote in "${key}"`);
|
|
174
|
+
}
|
|
175
|
+
return value;
|
|
176
|
+
}
|
|
177
|
+
function parseBlockScalar(lines, indicator, key) {
|
|
178
|
+
const indents = lines.filter((line) => line.trim() !== "").map((line) => /^\s*/.exec(line)[0].length);
|
|
179
|
+
const indent = Math.min(...indents);
|
|
180
|
+
const content = lines.map((line) => line.trim() === "" ? "" : line.slice(indent));
|
|
181
|
+
const text = indicator.startsWith("|") ? content.join("\n") : fold(content);
|
|
182
|
+
if (text.trim() === "") throw new FrontmatterError(`frontmatter: "${key}" block is empty`);
|
|
183
|
+
return indicator.endsWith("-") ? text : `${text}\n`;
|
|
184
|
+
}
|
|
185
|
+
function fold(lines) {
|
|
186
|
+
const paragraphs = [[]];
|
|
187
|
+
for (const line of lines) if (line === "") paragraphs.push([]);
|
|
188
|
+
else paragraphs.at(-1).push(line);
|
|
189
|
+
return paragraphs.map((paragraph) => paragraph.join(" ")).join("\n");
|
|
190
|
+
}
|
|
191
|
+
function rejectUnknownFields(data, source, consumed, dropped) {
|
|
192
|
+
const unknown = Object.keys(data).filter((key) => !consumed.includes(key) && !dropped.includes(key));
|
|
193
|
+
if (unknown.length > 0) throw new FrontmatterError(`${source}: unknown frontmatter field(s) ${unknown.join(", ")}`);
|
|
194
|
+
}
|
|
195
|
+
function readName(data, source) {
|
|
196
|
+
const value = data["name"];
|
|
197
|
+
if (value === void 0 || value.trim() === "") throw new FrontmatterError(`${source}: missing "name"`);
|
|
198
|
+
if (!SKILL_NAME_PATTERN.test(value)) throw new FrontmatterError(`${source}: "name" must be kebab-case, got "${value}"`);
|
|
199
|
+
if (value.length > 64) throw new FrontmatterError(`${source}: "name" is longer than 64 characters`);
|
|
200
|
+
return value;
|
|
201
|
+
}
|
|
202
|
+
function readDescription(data, source) {
|
|
203
|
+
const value = data["description"];
|
|
204
|
+
if (value === void 0 || value.trim() === "") throw new FrontmatterError(`${source}: missing "description"`);
|
|
205
|
+
return value;
|
|
206
|
+
}
|
|
207
|
+
function readBoolean(data, key, source, fallback) {
|
|
208
|
+
const value = data[key];
|
|
209
|
+
if (value === void 0) return fallback;
|
|
210
|
+
if (value === "true") return true;
|
|
211
|
+
if (value === "false") return false;
|
|
212
|
+
throw new FrontmatterError(`${source}: "${key}" must be true or false, got "${value}"`);
|
|
213
|
+
}
|
|
214
|
+
function formatScalar(value) {
|
|
215
|
+
return needsQuotes(value) ? `"${escapeDoubleQuoted(value)}"` : value;
|
|
216
|
+
}
|
|
217
|
+
function needsQuotes(value) {
|
|
218
|
+
if (value === "" || value.trim() !== value) return true;
|
|
219
|
+
if (/[\n\r\t]/.test(value)) return true;
|
|
220
|
+
if (/^[-?:,[\]{}#&*!|>'"%@`]/.test(value)) return true;
|
|
221
|
+
return /: | #|:$/.test(value);
|
|
222
|
+
}
|
|
223
|
+
function escapeDoubleQuoted(value) {
|
|
224
|
+
return value.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"").replaceAll("\n", "\\n").replaceAll("\r", "\\r");
|
|
225
|
+
}
|
|
226
|
+
//#endregion
|
|
227
|
+
export { SKILL_CONSUMED_FIELDS as a, parseFrontmatter as c, skillDroppedFields as d, validateAgentFrontmatter as f, MAX_SKILL_NAME_LENGTH as i, serializeAgentFrontmatter as l, AGENT_DROPPED_FIELDS as n, SKILL_DROPPED_FIELDS as o, validateSkillFrontmatter as p, FrontmatterError as r, agentDroppedFields as s, AGENT_CONSUMED_FIELDS as t, serializeSkillFrontmatter as u };
|
|
228
|
+
|
|
229
|
+
//# sourceMappingURL=frontmatter-BQX3ekwP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter-BQX3ekwP.mjs","names":[],"sources":["../src/frontmatter.ts"],"sourcesContent":["/**\n * Frontmatter parsing for pstack skills and agents.\n *\n * This is a deliberately small YAML subset, not YAML. It reads the shapes the\n * upstream files use: plain scalars, single and double quotes, folded (`>` and\n * `>-`) and literal (`|` and `|-`) blocks, comments, and blank lines. Nesting\n * and multi-document streams are rejected rather than half-supported.\n */\n\nexport interface Frontmatter {\n readonly data: Readonly<Record<string, string>>;\n readonly body: string;\n}\n\nexport interface SkillFrontmatter {\n readonly name: string;\n readonly description: string;\n readonly disableModelInvocation: boolean;\n readonly userInvocable: boolean;\n readonly whenToUse?: string;\n}\n\nexport interface AgentFrontmatter {\n readonly name: string;\n readonly description: string;\n}\n\nexport interface DroppedFrontmatterField {\n readonly file: string;\n readonly field: string;\n readonly value: string;\n}\n\nexport const SKILL_CONSUMED_FIELDS = [\n \"name\",\n \"description\",\n \"disable-model-invocation\",\n \"user-invocable\",\n \"whenToUse\",\n] as const;\n\nexport const SKILL_DROPPED_FIELDS = [\"icon\", \"color\", \"paths\"] as const;\n\nexport const AGENT_CONSUMED_FIELDS = [\"name\", \"description\"] as const;\n\nexport const AGENT_DROPPED_FIELDS = [\"is_background\"] as const;\n\nexport const MAX_SKILL_NAME_LENGTH = 64;\n\nconst SKILL_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\n\nexport class FrontmatterError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"FrontmatterError\";\n }\n}\n\nexport function parseFrontmatter(source: string): Frontmatter {\n const eol = detectEol(source);\n const text = eol === \"\\r\\n\" ? source.replaceAll(\"\\r\\n\", \"\\n\") : source;\n const lines = text.split(\"\\n\");\n\n if (lines[0] !== \"---\") {\n throw new FrontmatterError('frontmatter: file must start with a \"---\" line');\n }\n const closing = lines.indexOf(\"---\", 1);\n if (closing === -1) {\n throw new FrontmatterError('frontmatter: missing closing \"---\" delimiter');\n }\n\n const data = parseBlock(lines.slice(1, closing));\n const body = lines.slice(closing + 1).join(\"\\n\");\n return { data, body: eol === \"\\r\\n\" ? body.replaceAll(\"\\n\", eol) : body };\n}\n\nexport function validateSkillFrontmatter(\n data: Readonly<Record<string, string>>,\n source: string,\n): SkillFrontmatter {\n rejectUnknownFields(data, source, SKILL_CONSUMED_FIELDS, SKILL_DROPPED_FIELDS);\n\n const name = readName(data, source);\n const description = readDescription(data, source);\n const whenToUse = data[\"whenToUse\"];\n if (whenToUse !== undefined && whenToUse.trim() === \"\") {\n throw new FrontmatterError(`${source}: \"whenToUse\" must not be empty`);\n }\n\n return {\n name,\n description,\n disableModelInvocation: readBoolean(data, \"disable-model-invocation\", source, false),\n userInvocable: readBoolean(data, \"user-invocable\", source, true),\n ...(whenToUse === undefined ? {} : { whenToUse }),\n };\n}\n\nexport function validateAgentFrontmatter(\n data: Readonly<Record<string, string>>,\n source: string,\n): AgentFrontmatter {\n rejectUnknownFields(data, source, AGENT_CONSUMED_FIELDS, AGENT_DROPPED_FIELDS);\n return { name: readName(data, source), description: readDescription(data, source) };\n}\n\nexport function serializeSkillFrontmatter(data: SkillFrontmatter): string {\n const lines = [\n \"---\",\n `name: ${formatScalar(data.name)}`,\n `description: ${formatScalar(data.description)}`,\n ];\n if (data.disableModelInvocation) lines.push(\"disable-model-invocation: true\");\n if (!data.userInvocable) lines.push(\"user-invocable: false\");\n if (data.whenToUse !== undefined) lines.push(`whenToUse: ${formatScalar(data.whenToUse)}`);\n lines.push(\"---\");\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nexport function serializeAgentFrontmatter(data: AgentFrontmatter): string {\n return [\n \"---\",\n `name: ${formatScalar(data.name)}`,\n `description: ${formatScalar(data.description)}`,\n \"---\",\n \"\",\n ].join(\"\\n\");\n}\n\nexport function skillDroppedFields(\n data: Readonly<Record<string, string>>,\n source: string,\n): readonly DroppedFrontmatterField[] {\n return droppedFields(data, source, SKILL_DROPPED_FIELDS);\n}\n\nexport function agentDroppedFields(\n data: Readonly<Record<string, string>>,\n source: string,\n): readonly DroppedFrontmatterField[] {\n return droppedFields(data, source, AGENT_DROPPED_FIELDS);\n}\n\nfunction droppedFields(\n data: Readonly<Record<string, string>>,\n source: string,\n fields: readonly string[],\n): readonly DroppedFrontmatterField[] {\n return fields.flatMap((field) => {\n const value = data[field];\n return value === undefined ? [] : [{ file: source, field, value }];\n });\n}\n\nfunction detectEol(source: string): \"\\n\" | \"\\r\\n\" {\n if (!source.includes(\"\\r\\n\")) return \"\\n\";\n const withoutCrlf = source.replaceAll(\"\\r\\n\", \"\");\n if (withoutCrlf.includes(\"\\r\") || withoutCrlf.includes(\"\\n\")) {\n throw new FrontmatterError(\"frontmatter: mixed line endings are not supported\");\n }\n return \"\\r\\n\";\n}\n\nfunction parseBlock(lines: readonly string[]): Record<string, string> {\n const data: Record<string, string> = {};\n\n for (let index = 0; index < lines.length; index += 1) {\n const line = lines[index] as string;\n const trimmed = line.trim();\n if (trimmed === \"\" || trimmed.startsWith(\"#\")) continue;\n if (trimmed !== line) {\n throw new FrontmatterError(`frontmatter: unexpected indented line \"${trimmed}\"`);\n }\n\n const entry = /^([A-Za-z_][A-Za-z0-9_-]*):(.*)$/.exec(line);\n if (entry === null) {\n throw new FrontmatterError(`frontmatter: expected \"key: value\", got \"${line}\"`);\n }\n const key = entry[1] as string;\n const rest = entry[2] as string;\n if (rest !== \"\" && !rest.startsWith(\" \")) {\n throw new FrontmatterError(`frontmatter: missing space after \"${key}:\"`);\n }\n if (Object.hasOwn(data, key)) {\n throw new FrontmatterError(`frontmatter: duplicate key \"${key}\"`);\n }\n\n const raw = rest.trim();\n if (raw === \">\" || raw === \">-\" || raw === \"|\" || raw === \"|-\") {\n const block: string[] = [];\n let cursor = index + 1;\n while (cursor < lines.length) {\n const candidate = lines[cursor] as string;\n if (candidate.trim() !== \"\" && !candidate.startsWith(\" \") && !candidate.startsWith(\"\\t\"))\n break;\n block.push(candidate);\n cursor += 1;\n }\n while (block.length > 0 && (block.at(-1) as string).trim() === \"\") block.pop();\n if (block.length === 0) {\n throw new FrontmatterError(`frontmatter: \"${key}\" has an empty ${raw} block`);\n }\n data[key] = parseBlockScalar(block, raw, key);\n index = cursor - 1;\n continue;\n }\n\n data[key] = parseScalar(raw, key);\n }\n\n return data;\n}\n\nfunction parseScalar(raw: string, key: string): string {\n if (raw === \"\") return \"\";\n if (raw.startsWith('\"')) return parseDoubleQuoted(raw, key);\n if (raw.startsWith(\"'\")) return parseSingleQuoted(raw, key);\n return raw;\n}\n\nfunction parseDoubleQuoted(raw: string, key: string): string {\n if (raw.length < 2 || !raw.endsWith('\"')) {\n throw new FrontmatterError(`frontmatter: unterminated double-quoted value for \"${key}\"`);\n }\n const inner = raw.slice(1, -1);\n let value = \"\";\n for (let index = 0; index < inner.length; index += 1) {\n const character = inner[index] as string;\n if (character !== \"\\\\\") {\n value += character;\n continue;\n }\n const escaped = inner[(index += 1)];\n if (escaped === '\"') value += '\"';\n else if (escaped === \"\\\\\") value += \"\\\\\";\n else if (escaped === \"n\") value += \"\\n\";\n else\n throw new FrontmatterError(\n `frontmatter: unsupported escape \"\\\\${escaped ?? \"\"}\" in \"${key}\"`,\n );\n }\n return value;\n}\n\nfunction parseSingleQuoted(raw: string, key: string): string {\n if (raw.length < 2 || !raw.endsWith(\"'\")) {\n throw new FrontmatterError(`frontmatter: unterminated single-quoted value for \"${key}\"`);\n }\n const inner = raw.slice(1, -1);\n let value = \"\";\n for (let index = 0; index < inner.length; index += 1) {\n const character = inner[index] as string;\n if (character !== \"'\") {\n value += character;\n continue;\n }\n if (inner[index + 1] === \"'\") {\n value += \"'\";\n index += 1;\n continue;\n }\n throw new FrontmatterError(`frontmatter: unescaped single quote in \"${key}\"`);\n }\n return value;\n}\n\nfunction parseBlockScalar(lines: readonly string[], indicator: string, key: string): string {\n const indents = lines\n .filter((line) => line.trim() !== \"\")\n .map((line) => (/^\\s*/.exec(line) as RegExpExecArray)[0].length);\n const indent = Math.min(...indents);\n const content = lines.map((line) => (line.trim() === \"\" ? \"\" : line.slice(indent)));\n\n const text = indicator.startsWith(\"|\") ? content.join(\"\\n\") : fold(content);\n if (text.trim() === \"\") {\n throw new FrontmatterError(`frontmatter: \"${key}\" block is empty`);\n }\n return indicator.endsWith(\"-\") ? text : `${text}\\n`;\n}\n\nfunction fold(lines: readonly string[]): string {\n const paragraphs: string[][] = [[]];\n for (const line of lines) {\n if (line === \"\") paragraphs.push([]);\n else (paragraphs.at(-1) as string[]).push(line);\n }\n return paragraphs.map((paragraph) => paragraph.join(\" \")).join(\"\\n\");\n}\n\nfunction rejectUnknownFields(\n data: Readonly<Record<string, string>>,\n source: string,\n consumed: readonly string[],\n dropped: readonly string[],\n): void {\n const unknown = Object.keys(data).filter(\n (key) => !consumed.includes(key) && !dropped.includes(key),\n );\n if (unknown.length > 0) {\n throw new FrontmatterError(`${source}: unknown frontmatter field(s) ${unknown.join(\", \")}`);\n }\n}\n\nfunction readName(data: Readonly<Record<string, string>>, source: string): string {\n const value = data[\"name\"];\n if (value === undefined || value.trim() === \"\") {\n throw new FrontmatterError(`${source}: missing \"name\"`);\n }\n if (!SKILL_NAME_PATTERN.test(value)) {\n throw new FrontmatterError(`${source}: \"name\" must be kebab-case, got \"${value}\"`);\n }\n if (value.length > MAX_SKILL_NAME_LENGTH) {\n throw new FrontmatterError(\n `${source}: \"name\" is longer than ${MAX_SKILL_NAME_LENGTH} characters`,\n );\n }\n return value;\n}\n\nfunction readDescription(data: Readonly<Record<string, string>>, source: string): string {\n const value = data[\"description\"];\n if (value === undefined || value.trim() === \"\") {\n throw new FrontmatterError(`${source}: missing \"description\"`);\n }\n return value;\n}\n\nfunction readBoolean(\n data: Readonly<Record<string, string>>,\n key: string,\n source: string,\n fallback: boolean,\n): boolean {\n const value = data[key];\n if (value === undefined) return fallback;\n if (value === \"true\") return true;\n if (value === \"false\") return false;\n throw new FrontmatterError(`${source}: \"${key}\" must be true or false, got \"${value}\"`);\n}\n\nfunction formatScalar(value: string): string {\n return needsQuotes(value) ? `\"${escapeDoubleQuoted(value)}\"` : value;\n}\n\nfunction needsQuotes(value: string): boolean {\n if (value === \"\" || value.trim() !== value) return true;\n if (/[\\n\\r\\t]/.test(value)) return true;\n if (/^[-?:,[\\]{}#&*!|>'\"%@`]/.test(value)) return true;\n return /: | #|:$/.test(value);\n}\n\nfunction escapeDoubleQuoted(value: string): string {\n return value\n .replaceAll(\"\\\\\", \"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