@g3nomaly/skills 0.3.0 → 1.0.0
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 +95 -0
- package/dist/cli/adapter.d.ts +30 -0
- package/dist/cli/adapter.d.ts.map +1 -0
- package/dist/cli/adapter.js +86 -0
- package/dist/cli/adapter.js.map +1 -0
- package/dist/cli/commands/add.d.ts +17 -0
- package/dist/cli/commands/add.d.ts.map +1 -0
- package/dist/cli/commands/add.js +108 -0
- package/dist/cli/commands/add.js.map +1 -0
- package/dist/cli/commands/hook.d.ts +6 -0
- package/dist/cli/commands/hook.d.ts.map +1 -0
- package/dist/cli/commands/hook.js +18 -0
- package/dist/cli/commands/hook.js.map +1 -0
- package/dist/cli/commands/init.d.ts +22 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +119 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/ls.d.ts +4 -0
- package/dist/cli/commands/ls.d.ts.map +1 -0
- package/dist/cli/commands/ls.js +8 -0
- package/dist/cli/commands/ls.js.map +1 -0
- package/dist/cli/commands/remove.d.ts +12 -0
- package/dist/cli/commands/remove.d.ts.map +1 -0
- package/dist/cli/commands/remove.js +60 -0
- package/dist/cli/commands/remove.js.map +1 -0
- package/dist/cli/commands/update.d.ts +13 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/commands/update.js +49 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +72 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/decisions/index.d.ts +6 -0
- package/dist/decisions/index.d.ts.map +1 -0
- package/dist/decisions/index.js +5 -0
- package/dist/decisions/index.js.map +1 -0
- package/dist/decisions/paths.d.ts +4 -0
- package/dist/decisions/paths.d.ts.map +1 -0
- package/dist/decisions/paths.js +12 -0
- package/dist/decisions/paths.js.map +1 -0
- package/dist/decisions/read.d.ts +18 -0
- package/dist/decisions/read.d.ts.map +1 -0
- package/dist/decisions/read.js +45 -0
- package/dist/decisions/read.js.map +1 -0
- package/dist/decisions/write.d.ts +20 -0
- package/dist/decisions/write.d.ts.map +1 -0
- package/dist/decisions/write.js +48 -0
- package/dist/decisions/write.js.map +1 -0
- package/dist/filetree/ensure.d.ts +7 -0
- package/dist/filetree/ensure.d.ts.map +1 -0
- package/dist/filetree/ensure.js +36 -0
- package/dist/filetree/ensure.js.map +1 -0
- package/dist/filetree/entries.d.ts +9 -0
- package/dist/filetree/entries.d.ts.map +1 -0
- package/dist/filetree/entries.js +49 -0
- package/dist/filetree/entries.js.map +1 -0
- package/dist/filetree/frontmatter.d.ts +16 -0
- package/dist/filetree/frontmatter.d.ts.map +1 -0
- package/dist/filetree/frontmatter.js +43 -0
- package/dist/filetree/frontmatter.js.map +1 -0
- package/dist/filetree/generate.d.ts +16 -0
- package/dist/filetree/generate.d.ts.map +1 -0
- package/dist/filetree/generate.js +62 -0
- package/dist/filetree/generate.js.map +1 -0
- package/dist/filetree/index.d.ts +17 -0
- package/dist/filetree/index.d.ts.map +1 -0
- package/dist/filetree/index.js +13 -0
- package/dist/filetree/index.js.map +1 -0
- package/dist/filetree/levels.d.ts +25 -0
- package/dist/filetree/levels.d.ts.map +1 -0
- package/dist/filetree/levels.js +45 -0
- package/dist/filetree/levels.js.map +1 -0
- package/dist/filetree/locate.d.ts +44 -0
- package/dist/filetree/locate.d.ts.map +1 -0
- package/dist/filetree/locate.js +76 -0
- package/dist/filetree/locate.js.map +1 -0
- package/dist/filetree/paths.d.ts +15 -0
- package/dist/filetree/paths.d.ts.map +1 -0
- package/dist/filetree/paths.js +38 -0
- package/dist/filetree/paths.js.map +1 -0
- package/dist/filetree/read.d.ts +23 -0
- package/dist/filetree/read.d.ts.map +1 -0
- package/dist/filetree/read.js +36 -0
- package/dist/filetree/read.js.map +1 -0
- package/dist/filetree/remove.d.ts +9 -0
- package/dist/filetree/remove.d.ts.map +1 -0
- package/dist/filetree/remove.js +17 -0
- package/dist/filetree/remove.js.map +1 -0
- package/dist/filetree/root.d.ts +9 -0
- package/dist/filetree/root.d.ts.map +1 -0
- package/dist/filetree/root.js +15 -0
- package/dist/filetree/root.js.map +1 -0
- package/dist/filetree/status.d.ts +21 -0
- package/dist/filetree/status.d.ts.map +1 -0
- package/dist/filetree/status.js +55 -0
- package/dist/filetree/status.js.map +1 -0
- package/dist/hooks/cli.d.ts +29 -0
- package/dist/hooks/cli.d.ts.map +1 -0
- package/dist/hooks/cli.js +65 -0
- package/dist/hooks/cli.js.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/grilling/.claude-plugin/plugin.json +7 -0
- package/dist/plugins/grilling/skills/domain-modeling/ADR-FORMAT.md +47 -0
- package/dist/plugins/grilling/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/dist/plugins/grilling/skills/domain-modeling/SKILL.md +74 -0
- package/dist/plugins/grilling/skills/domain-modeling/agents/openai.yaml +3 -0
- package/dist/plugins/grilling/skills/grill-me/SKILL.md +7 -0
- package/dist/plugins/grilling/skills/grill-me/agents/openai.yaml +5 -0
- package/dist/plugins/grilling/skills/grill-with-docs/SKILL.md +7 -0
- package/dist/plugins/grilling/skills/grill-with-docs/agents/openai.yaml +5 -0
- package/dist/plugins/grilling/skills/grilling/SKILL.md +12 -0
- package/dist/plugins/grilling/skills/grilling/agents/openai.yaml +3 -0
- package/dist/plugins/speech/.claude-plugin/plugin.json +7 -0
- package/dist/plugins/speech/skills/emphasise/SKILL.md +49 -0
- package/dist/plugins/speech/skills/emphasise/agents/openai.yaml +5 -0
- package/dist/plugins/speech/skills/unslop/SKILL.md +80 -0
- package/dist/plugins/task-manager/.claude-plugin/plugin.json +11 -0
- package/dist/plugins/task-manager/hooks/hooks.json +19 -0
- package/dist/plugins/task-manager/skills/decisions/SKILL.md +39 -0
- package/dist/plugins/task-manager/skills/decisions/agents/openai.yaml +5 -0
- package/dist/plugins/task-manager/skills/decisions/references/usage.md +26 -0
- package/dist/plugins/task-manager/skills/task-manager/SKILL.md +99 -0
- package/dist/plugins/task-manager/skills/vocabulary/SKILL.md +42 -0
- package/dist/plugins/task-manager/skills/vocabulary/agents/openai.yaml +5 -0
- package/dist/plugins/task-manager/skills/vocabulary/references/usage.md +26 -0
- package/dist/plugins/using-hooks/.claude-plugin/plugin.json +7 -0
- package/dist/plugins/using-hooks/skills/hook-post-tool-use/SKILL.md +79 -0
- package/dist/plugins/using-hooks/skills/hook-post-tool-use/agents/openai.yaml +5 -0
- package/dist/plugins/using-hooks/skills/hook-pre-tool-use/SKILL.md +84 -0
- package/dist/plugins/using-hooks/skills/hook-pre-tool-use/agents/openai.yaml +5 -0
- package/dist/plugins/using-hooks/skills/hook-stop/SKILL.md +69 -0
- package/dist/plugins/using-hooks/skills/hook-stop/agents/openai.yaml +5 -0
- package/dist/plugins/using-hooks/skills/hook-user-prompt-submit/SKILL.md +64 -0
- package/dist/plugins/using-hooks/skills/hook-user-prompt-submit/agents/openai.yaml +5 -0
- package/dist/plugins/workflow/.claude-plugin/plugin.json +16 -0
- package/dist/plugins/workflow/agents/reviewer.md +9 -0
- package/dist/plugins/workflow/skills/execute/SKILL.md +21 -0
- package/dist/plugins/workflow/skills/execute/agents/openai.yaml +5 -0
- package/dist/plugins/workflow/skills/orchestrator/SKILL.md +27 -0
- package/dist/plugins/workflow/skills/orchestrator/agents/openai.yaml +5 -0
- package/dist/plugins/workflow/skills/plan/SKILL.md +18 -0
- package/dist/plugins/workflow/skills/plan/agents/openai.yaml +5 -0
- package/dist/plugins/workflow/skills/plan/references/task-frontmatter.md +33 -0
- package/dist/plugins/workflow/skills/review/SKILL.md +25 -0
- package/dist/plugins/workflow/skills/review/agents/openai.yaml +5 -0
- package/dist/plugins/workflow/skills/run/SKILL.md +33 -0
- package/dist/plugins/workflow/skills/run/agents/openai.yaml +5 -0
- package/dist/plugins/workflow/skills/run/references/sub-agents.md +46 -0
- package/dist/plugins/workflow/skills/sync/SKILL.md +18 -0
- package/dist/plugins/workflow/skills/sync/agents/openai.yaml +5 -0
- package/dist/plugins/workflow/skills/worktree/SKILL.md +38 -0
- package/dist/plugins/workflow/skills/worktree/agents/openai.yaml +5 -0
- package/dist/plugins/workflow/skills/worktree/references/git-commands.md +27 -0
- package/dist/plugins/writing/.claude-plugin/plugin.json +7 -0
- package/dist/plugins/writing/skills/writing-great-hooks/SKILL.md +192 -0
- package/dist/plugins/writing/skills/writing-great-hooks/agents/openai.yaml +5 -0
- package/dist/plugins/writing/skills/writing-great-skills/GLOSSARY.md +201 -0
- package/dist/plugins/writing/skills/writing-great-skills/SKILL.md +92 -0
- package/dist/plugins/writing/skills/writing-great-skills/agents/openai.yaml +5 -0
- package/dist/plugins/writing/skills/writing-great-tasks/SKILL.md +136 -0
- package/dist/plugins/writing/skills/writing-great-tasks/agents/openai.yaml +5 -0
- package/dist/plugins/writing/skills/writing-great-tasks/templates/template_task.md +108 -0
- package/dist/registry/index.d.ts +5 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +6 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/loadPackageRegistry.d.ts +14 -0
- package/dist/registry/loadPackageRegistry.d.ts.map +1 -0
- package/dist/registry/loadPackageRegistry.js +59 -0
- package/dist/registry/loadPackageRegistry.js.map +1 -0
- package/dist/registry/readSkillDir.d.ts +12 -0
- package/dist/registry/readSkillDir.d.ts.map +1 -0
- package/dist/registry/readSkillDir.js +59 -0
- package/dist/registry/readSkillDir.js.map +1 -0
- package/dist/registry/types.d.ts +53 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +35 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/registry/userManifest.d.ts +7 -0
- package/dist/registry/userManifest.d.ts.map +1 -0
- package/dist/registry/userManifest.js +21 -0
- package/dist/registry/userManifest.js.map +1 -0
- package/dist/remote/fetch.d.ts +16 -0
- package/dist/remote/fetch.d.ts.map +1 -0
- package/dist/remote/fetch.js +41 -0
- package/dist/remote/fetch.js.map +1 -0
- package/dist/remote/index.d.ts +7 -0
- package/dist/remote/index.d.ts.map +1 -0
- package/dist/remote/index.js +5 -0
- package/dist/remote/index.js.map +1 -0
- package/dist/remote/manifest.d.ts +23 -0
- package/dist/remote/manifest.d.ts.map +1 -0
- package/dist/remote/manifest.js +116 -0
- package/dist/remote/manifest.js.map +1 -0
- package/dist/remote/registry.d.ts +18 -0
- package/dist/remote/registry.d.ts.map +1 -0
- package/dist/remote/registry.js +58 -0
- package/dist/remote/registry.js.map +1 -0
- package/dist/schemas/config.d.ts +3 -0
- package/dist/schemas/config.d.ts.map +1 -0
- package/dist/schemas/config.js +3 -0
- package/dist/schemas/config.js.map +1 -0
- package/dist/schemas/decision.d.ts +43 -0
- package/dist/schemas/decision.d.ts.map +1 -0
- package/dist/schemas/decision.js +24 -0
- package/dist/schemas/decision.js.map +1 -0
- package/dist/schemas/index.d.ts +17 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +10 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/phase.d.ts +46 -0
- package/dist/schemas/phase.d.ts.map +1 -0
- package/dist/schemas/phase.js +16 -0
- package/dist/schemas/phase.js.map +1 -0
- package/dist/schemas/plan.d.ts +44 -0
- package/dist/schemas/plan.d.ts.map +1 -0
- package/dist/schemas/plan.js +15 -0
- package/dist/schemas/plan.js.map +1 -0
- package/dist/schemas/primitives.d.ts +38 -0
- package/dist/schemas/primitives.d.ts.map +1 -0
- package/dist/schemas/primitives.js +33 -0
- package/dist/schemas/primitives.js.map +1 -0
- package/dist/schemas/task.d.ts +70 -0
- package/dist/schemas/task.d.ts.map +1 -0
- package/dist/schemas/task.js +19 -0
- package/dist/schemas/task.js.map +1 -0
- package/dist/schemas/term.d.ts +17 -0
- package/dist/schemas/term.d.ts.map +1 -0
- package/dist/schemas/term.js +22 -0
- package/dist/schemas/term.js.map +1 -0
- package/dist/schemas/validation.d.ts +24 -0
- package/dist/schemas/validation.d.ts.map +1 -0
- package/dist/schemas/validation.js +39 -0
- package/dist/schemas/validation.js.map +1 -0
- package/dist/task-manager/hooks/add-decision.d.ts +2 -0
- package/dist/task-manager/hooks/add-decision.d.ts.map +1 -0
- package/dist/task-manager/hooks/add-decision.js +19 -0
- package/dist/task-manager/hooks/add-decision.js.map +1 -0
- package/dist/task-manager/hooks/cleanup.d.ts +2 -0
- package/dist/task-manager/hooks/cleanup.d.ts.map +1 -0
- package/dist/task-manager/hooks/cleanup.js +27 -0
- package/dist/task-manager/hooks/cleanup.js.map +1 -0
- package/dist/task-manager/hooks/get-decision.d.ts +2 -0
- package/dist/task-manager/hooks/get-decision.d.ts.map +1 -0
- package/dist/task-manager/hooks/get-decision.js +11 -0
- package/dist/task-manager/hooks/get-decision.js.map +1 -0
- package/dist/task-manager/hooks/get-entry.d.ts +2 -0
- package/dist/task-manager/hooks/get-entry.d.ts.map +1 -0
- package/dist/task-manager/hooks/get-entry.js +20 -0
- package/dist/task-manager/hooks/get-entry.js.map +1 -0
- package/dist/task-manager/hooks/get-term.d.ts +2 -0
- package/dist/task-manager/hooks/get-term.d.ts.map +1 -0
- package/dist/task-manager/hooks/get-term.js +13 -0
- package/dist/task-manager/hooks/get-term.js.map +1 -0
- package/dist/task-manager/hooks/guard-tree.d.ts +2 -0
- package/dist/task-manager/hooks/guard-tree.d.ts.map +1 -0
- package/dist/task-manager/hooks/guard-tree.js +63 -0
- package/dist/task-manager/hooks/guard-tree.js.map +1 -0
- package/dist/task-manager/hooks/index.d.ts +4 -0
- package/dist/task-manager/hooks/index.d.ts.map +1 -0
- package/dist/task-manager/hooks/index.js +32 -0
- package/dist/task-manager/hooks/index.js.map +1 -0
- package/dist/task-manager/hooks/list-decisions.d.ts +2 -0
- package/dist/task-manager/hooks/list-decisions.d.ts.map +1 -0
- package/dist/task-manager/hooks/list-decisions.js +20 -0
- package/dist/task-manager/hooks/list-decisions.js.map +1 -0
- package/dist/task-manager/hooks/list-entries.d.ts +2 -0
- package/dist/task-manager/hooks/list-entries.d.ts.map +1 -0
- package/dist/task-manager/hooks/list-entries.js +19 -0
- package/dist/task-manager/hooks/list-entries.js.map +1 -0
- package/dist/task-manager/hooks/list-terms.d.ts +2 -0
- package/dist/task-manager/hooks/list-terms.d.ts.map +1 -0
- package/dist/task-manager/hooks/list-terms.js +8 -0
- package/dist/task-manager/hooks/list-terms.js.map +1 -0
- package/dist/task-manager/hooks/next-entry.d.ts +2 -0
- package/dist/task-manager/hooks/next-entry.d.ts.map +1 -0
- package/dist/task-manager/hooks/next-entry.js +23 -0
- package/dist/task-manager/hooks/next-entry.js.map +1 -0
- package/dist/task-manager/hooks/remove-term.d.ts +2 -0
- package/dist/task-manager/hooks/remove-term.d.ts.map +1 -0
- package/dist/task-manager/hooks/remove-term.js +15 -0
- package/dist/task-manager/hooks/remove-term.js.map +1 -0
- package/dist/task-manager/hooks/set-state.d.ts +2 -0
- package/dist/task-manager/hooks/set-state.d.ts.map +1 -0
- package/dist/task-manager/hooks/set-state.js +15 -0
- package/dist/task-manager/hooks/set-state.js.map +1 -0
- package/dist/task-manager/hooks/set-term.d.ts +2 -0
- package/dist/task-manager/hooks/set-term.d.ts.map +1 -0
- package/dist/task-manager/hooks/set-term.js +27 -0
- package/dist/task-manager/hooks/set-term.js.map +1 -0
- package/dist/task-manager/hooks/sync-tree.d.ts +2 -0
- package/dist/task-manager/hooks/sync-tree.d.ts.map +1 -0
- package/dist/task-manager/hooks/sync-tree.js +28 -0
- package/dist/task-manager/hooks/sync-tree.js.map +1 -0
- package/dist/task-manager/index.d.ts +2 -0
- package/dist/task-manager/index.d.ts.map +1 -0
- package/dist/task-manager/index.js +3 -0
- package/dist/task-manager/index.js.map +1 -0
- package/dist/vocabulary/file.d.ts +15 -0
- package/dist/vocabulary/file.d.ts.map +1 -0
- package/dist/vocabulary/file.js +80 -0
- package/dist/vocabulary/file.js.map +1 -0
- package/dist/vocabulary/index.d.ts +4 -0
- package/dist/vocabulary/index.d.ts.map +1 -0
- package/dist/vocabulary/index.js +4 -0
- package/dist/vocabulary/index.js.map +1 -0
- package/dist/vocabulary/match.d.ts +22 -0
- package/dist/vocabulary/match.d.ts.map +1 -0
- package/dist/vocabulary/match.js +31 -0
- package/dist/vocabulary/match.js.map +1 -0
- package/dist/workflow/gates.d.ts +24 -0
- package/dist/workflow/gates.d.ts.map +1 -0
- package/dist/workflow/gates.js +34 -0
- package/dist/workflow/gates.js.map +1 -0
- package/dist/workflow/hooks/advance-step.d.ts +2 -0
- package/dist/workflow/hooks/advance-step.d.ts.map +1 -0
- package/dist/workflow/hooks/advance-step.js +51 -0
- package/dist/workflow/hooks/advance-step.js.map +1 -0
- package/dist/workflow/hooks/current-step.d.ts +2 -0
- package/dist/workflow/hooks/current-step.d.ts.map +1 -0
- package/dist/workflow/hooks/current-step.js +24 -0
- package/dist/workflow/hooks/current-step.js.map +1 -0
- package/dist/workflow/hooks/index.d.ts +4 -0
- package/dist/workflow/hooks/index.d.ts.map +1 -0
- package/dist/workflow/hooks/index.js +10 -0
- package/dist/workflow/hooks/index.js.map +1 -0
- package/dist/workflow/hooks/ready-phases.d.ts +2 -0
- package/dist/workflow/hooks/ready-phases.d.ts.map +1 -0
- package/dist/workflow/hooks/ready-phases.js +15 -0
- package/dist/workflow/hooks/ready-phases.js.map +1 -0
- package/dist/workflow/index.d.ts +8 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +6 -0
- package/dist/workflow/index.js.map +1 -0
- package/dist/workflow/phase.d.ts +16 -0
- package/dist/workflow/phase.d.ts.map +1 -0
- package/dist/workflow/phase.js +22 -0
- package/dist/workflow/phase.js.map +1 -0
- package/dist/workflow/steps.d.ts +15 -0
- package/dist/workflow/steps.d.ts.map +1 -0
- package/dist/workflow/steps.js +32 -0
- package/dist/workflow/steps.js.map +1 -0
- package/package.json +62 -3
- package/README.md +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../src/filetree/frontmatter.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,KAAK,GAAG,KAAK,CAAC;AASpB;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAY;IAC7C,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IACzC,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IAElC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,mBAAmB,CAAC,IAAI,EAAE;YAClC,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,KAAK,+BAA+B,EAAE;SAChF,CAAC,CAAC;IACL,CAAC;IAED,MAAM,WAAW,GAAY,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEzD,IAAI,OAAO,WAAW,KAAK,QAAQ,IAAI,WAAW,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QAC1F,MAAM,IAAI,mBAAmB,CAAC,IAAI,EAAE;YAClC,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,6BAA6B,EAAE;SACnE,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;AAC3C,CAAC;AAED,0DAA0D;AAC1D,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAY;IAChD,OAAO,CAAC,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC;AAChD,CAAC;AAED,iFAAiF;AACjF,SAAS,aAAa,CAAC,IAAY;IACjC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE/B,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IAE/C,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,KAAK,KAAK,CAAC,CAAC;IACxF,IAAI,OAAO,KAAK,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAEhC,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACzC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;KAC9D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type TreeLevel } from "./levels";
|
|
2
|
+
/**
|
|
3
|
+
* Rebuilds one folder's index from the entries directly under it, replacing
|
|
4
|
+
* whatever was there. Plans and phases are read from `<name>/<name>.md`, tasks
|
|
5
|
+
* from `tasks/<id>.md`, so the result only depends on that one folder.
|
|
6
|
+
*
|
|
7
|
+
* @throws FileValidationError when an entry fails its schema or its identifier
|
|
8
|
+
* does not match the folder or file it was read from
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateIndex(dir: string, level: TreeLevel): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Rebuilds every index in the tree, from the root folder down.
|
|
13
|
+
* Run `ensureTree` first — a plan or phase without its folder throws here.
|
|
14
|
+
*/
|
|
15
|
+
export declare function generateTree(root: string): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/filetree/generate.ts"],"names":[],"mappings":"AAOA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAKvD;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAYhF;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9D"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// packages/skills/src/filetree/generate.ts
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { parseFile } from "../schemas/validation";
|
|
4
|
+
import { PlanIndexSchema } from "../schemas/plan";
|
|
5
|
+
import { PhaseIndexSchema } from "../schemas/phase";
|
|
6
|
+
import { TaskIndexSchema } from "../schemas/task";
|
|
7
|
+
import { CHILD_LEVEL } from "./levels";
|
|
8
|
+
import { childDirFor, indexPathFor } from "./paths";
|
|
9
|
+
import { listEntryNames } from "./entries";
|
|
10
|
+
import { readEntry } from "./read";
|
|
11
|
+
/**
|
|
12
|
+
* Rebuilds one folder's index from the entries directly under it, replacing
|
|
13
|
+
* whatever was there. Plans and phases are read from `<name>/<name>.md`, tasks
|
|
14
|
+
* from `tasks/<id>.md`, so the result only depends on that one folder.
|
|
15
|
+
*
|
|
16
|
+
* @throws FileValidationError when an entry fails its schema or its identifier
|
|
17
|
+
* does not match the folder or file it was read from
|
|
18
|
+
*/
|
|
19
|
+
export async function generateIndex(dir, level) {
|
|
20
|
+
switch (level) {
|
|
21
|
+
case "root":
|
|
22
|
+
await writeIndex(dir, level, PlanIndexSchema, { plans: await collect(dir, level) });
|
|
23
|
+
return;
|
|
24
|
+
case "plan":
|
|
25
|
+
await writeIndex(dir, level, PhaseIndexSchema, { phases: await collect(dir, level) });
|
|
26
|
+
return;
|
|
27
|
+
case "phase":
|
|
28
|
+
await writeIndex(dir, level, TaskIndexSchema, { tasks: await collect(dir, level) });
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Rebuilds every index in the tree, from the root folder down.
|
|
34
|
+
* Run `ensureTree` first — a plan or phase without its folder throws here.
|
|
35
|
+
*/
|
|
36
|
+
export async function generateTree(root) {
|
|
37
|
+
await generateFrom(resolve(root), "root");
|
|
38
|
+
}
|
|
39
|
+
/** `dir` is absolute; `childDirFor` keeps it that way down the walk. */
|
|
40
|
+
async function generateFrom(dir, level) {
|
|
41
|
+
await generateIndex(dir, level);
|
|
42
|
+
const child = CHILD_LEVEL[level];
|
|
43
|
+
if (child === null)
|
|
44
|
+
return;
|
|
45
|
+
for (const name of await listEntryNames(dir, level)) {
|
|
46
|
+
await generateFrom(childDirFor(dir, name), child);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** Reads and validates every entry of `dir`, in queue order. */
|
|
50
|
+
async function collect(dir, level) {
|
|
51
|
+
const entries = [];
|
|
52
|
+
for (const name of await listEntryNames(dir, level)) {
|
|
53
|
+
entries.push((await readEntry(dir, level, name)).meta);
|
|
54
|
+
}
|
|
55
|
+
return entries;
|
|
56
|
+
}
|
|
57
|
+
async function writeIndex(dir, level, schema, index) {
|
|
58
|
+
const file = indexPathFor(dir, level);
|
|
59
|
+
const validated = parseFile(schema, file, index);
|
|
60
|
+
await Bun.write(file, `${JSON.stringify(validated, null, 2)}\n`);
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/filetree/generate.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,OAAO,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TASKS_DIR, MARKDOWN, } from "./levels";
|
|
2
|
+
export type { TreeLevel } from "./levels";
|
|
3
|
+
export { indexPathFor, entryPathFor, childDirFor, tasksDirFor, levelFor } from "./paths";
|
|
4
|
+
export { listEntryNames } from "./entries";
|
|
5
|
+
export { readDocument, readFrontmatter } from "./frontmatter";
|
|
6
|
+
export type { Document } from "./frontmatter";
|
|
7
|
+
export { readEntry } from "./read";
|
|
8
|
+
export type { EntryOf, EntryDocument } from "./read";
|
|
9
|
+
export { listAllEntries, locateEntry, locateEntryOfType, resolveParent } from "./locate";
|
|
10
|
+
export type { EntryLocation, ParentFolder } from "./locate";
|
|
11
|
+
export { setEntryStatus, setStatusLine } from "./status";
|
|
12
|
+
export type { StatusChange } from "./status";
|
|
13
|
+
export { removeEntry } from "./remove";
|
|
14
|
+
export { resolveFiletreeRoot } from "./root";
|
|
15
|
+
export { ensureTree } from "./ensure";
|
|
16
|
+
export { generateIndex, generateTree } from "./generate";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/filetree/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,GACT,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEzF,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC9D,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzF,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzD,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// packages/skills/src/filetree/index.ts
|
|
2
|
+
export { LEVELS, INDEX_FILES, CHILD_LEVEL, ENTRY_KIND, ENTRY_TYPE, ID_FIELD, TASKS_DIR, MARKDOWN, } from "./levels";
|
|
3
|
+
export { indexPathFor, entryPathFor, childDirFor, tasksDirFor, levelFor } from "./paths";
|
|
4
|
+
export { listEntryNames } from "./entries";
|
|
5
|
+
export { readDocument, readFrontmatter } from "./frontmatter";
|
|
6
|
+
export { readEntry } from "./read";
|
|
7
|
+
export { listAllEntries, locateEntry, locateEntryOfType, resolveParent } from "./locate";
|
|
8
|
+
export { setEntryStatus, setStatusLine } from "./status";
|
|
9
|
+
export { removeEntry } from "./remove";
|
|
10
|
+
export { resolveFiletreeRoot } from "./root";
|
|
11
|
+
export { ensureTree } from "./ensure";
|
|
12
|
+
export { generateIndex, generateTree } from "./generate";
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/filetree/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,GACT,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEzF,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAG9D,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGnC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzF,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The three depths of the tree, named after the folder that holds them.
|
|
3
|
+
* A `root` folder holds plans, a `plan` folder holds phases, a `phase` folder
|
|
4
|
+
* holds tasks. Every `paths`, `entries` and `filetree` function is keyed by this.
|
|
5
|
+
*/
|
|
6
|
+
export declare const LEVELS: readonly ["root", "plan", "phase"];
|
|
7
|
+
export type TreeLevel = (typeof LEVELS)[number];
|
|
8
|
+
/** Index file each level writes, in the folder whose entries it lists. */
|
|
9
|
+
export declare const INDEX_FILES: Record<TreeLevel, string>;
|
|
10
|
+
/** Level of the folder opened by an entry, or `null` where entries are leaves. */
|
|
11
|
+
export declare const CHILD_LEVEL: Record<TreeLevel, TreeLevel | null>;
|
|
12
|
+
/** What a level's entries are called, for messages and hook output. */
|
|
13
|
+
export declare const ENTRY_TYPE: Record<TreeLevel, "plan" | "phase" | "task">;
|
|
14
|
+
/** Frontmatter field carrying an entry's identifier, per level. */
|
|
15
|
+
export declare const ID_FIELD: Record<TreeLevel, "name" | "id">;
|
|
16
|
+
/** Folder inside a phase holding its task files. */
|
|
17
|
+
export declare const TASKS_DIR = "tasks";
|
|
18
|
+
/**
|
|
19
|
+
* How a level's entries sit on disk. A `folder` entry owns a directory named
|
|
20
|
+
* after it holding `<name>.md`; a `file` entry is a `.md` file in `TASKS_DIR`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const ENTRY_KIND: Record<TreeLevel, "folder" | "file">;
|
|
23
|
+
/** Extension of every file carrying an entry's frontmatter. */
|
|
24
|
+
export declare const MARKDOWN = ".md";
|
|
25
|
+
//# sourceMappingURL=levels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"levels.d.ts","sourceRoot":"","sources":["../../src/filetree/levels.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,MAAM,YAAI,MAAM,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AAEzD,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhD,0EAA0E;AAC1E,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAIjD,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAI3D,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAInE,CAAC;AAEF,mEAAmE;AACnE,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAIrD,CAAC;AAEF,oDAAoD;AACpD,eAAO,MAAM,SAAS,UAAU,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,SAAS,EAAE,QAAQ,GAAG,MAAM,CAI3D,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM,QAAQ,QAAQ,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// packages/skills/src/filetree/levels.ts
|
|
2
|
+
/**
|
|
3
|
+
* The three depths of the tree, named after the folder that holds them.
|
|
4
|
+
* A `root` folder holds plans, a `plan` folder holds phases, a `phase` folder
|
|
5
|
+
* holds tasks. Every `paths`, `entries` and `filetree` function is keyed by this.
|
|
6
|
+
*/
|
|
7
|
+
export const LEVELS = ["root", "plan", "phase"];
|
|
8
|
+
/** Index file each level writes, in the folder whose entries it lists. */
|
|
9
|
+
export const INDEX_FILES = {
|
|
10
|
+
root: "root-index.json",
|
|
11
|
+
plan: "plan-index.json",
|
|
12
|
+
phase: "phase-index.json",
|
|
13
|
+
};
|
|
14
|
+
/** Level of the folder opened by an entry, or `null` where entries are leaves. */
|
|
15
|
+
export const CHILD_LEVEL = {
|
|
16
|
+
root: "plan",
|
|
17
|
+
plan: "phase",
|
|
18
|
+
phase: null,
|
|
19
|
+
};
|
|
20
|
+
/** What a level's entries are called, for messages and hook output. */
|
|
21
|
+
export const ENTRY_TYPE = {
|
|
22
|
+
root: "plan",
|
|
23
|
+
plan: "phase",
|
|
24
|
+
phase: "task",
|
|
25
|
+
};
|
|
26
|
+
/** Frontmatter field carrying an entry's identifier, per level. */
|
|
27
|
+
export const ID_FIELD = {
|
|
28
|
+
root: "name",
|
|
29
|
+
plan: "name",
|
|
30
|
+
phase: "id",
|
|
31
|
+
};
|
|
32
|
+
/** Folder inside a phase holding its task files. */
|
|
33
|
+
export const TASKS_DIR = "tasks";
|
|
34
|
+
/**
|
|
35
|
+
* How a level's entries sit on disk. A `folder` entry owns a directory named
|
|
36
|
+
* after it holding `<name>.md`; a `file` entry is a `.md` file in `TASKS_DIR`.
|
|
37
|
+
*/
|
|
38
|
+
export const ENTRY_KIND = {
|
|
39
|
+
root: "folder",
|
|
40
|
+
plan: "folder",
|
|
41
|
+
phase: "file",
|
|
42
|
+
};
|
|
43
|
+
/** Extension of every file carrying an entry's frontmatter. */
|
|
44
|
+
export const MARKDOWN = ".md";
|
|
45
|
+
//# sourceMappingURL=levels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"levels.js","sourceRoot":"","sources":["../../src/filetree/levels.ts"],"names":[],"mappings":"AAAA,yCAAyC;AAEzC;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AAIzD,0EAA0E;AAC1E,MAAM,CAAC,MAAM,WAAW,GAA8B;IACpD,IAAI,EAAG,iBAAiB;IACxB,IAAI,EAAG,iBAAiB;IACxB,KAAK,EAAE,kBAAkB;CAC1B,CAAC;AAEF,kFAAkF;AAClF,MAAM,CAAC,MAAM,WAAW,GAAwC;IAC9D,IAAI,EAAG,MAAM;IACb,IAAI,EAAG,OAAO;IACd,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF,uEAAuE;AACvE,MAAM,CAAC,MAAM,UAAU,GAAiD;IACtE,IAAI,EAAG,MAAM;IACb,IAAI,EAAG,OAAO;IACd,KAAK,EAAE,MAAM;CACd,CAAC;AAEF,mEAAmE;AACnE,MAAM,CAAC,MAAM,QAAQ,GAAqC;IACxD,IAAI,EAAG,MAAM;IACb,IAAI,EAAG,MAAM;IACb,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF,oDAAoD;AACpD,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC;AAEjC;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAyC;IAC9D,IAAI,EAAG,QAAQ;IACf,IAAI,EAAG,QAAQ;IACf,KAAK,EAAE,MAAM;CACd,CAAC;AAEF,+DAA+D;AAC/D,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type TreeLevel } from "./levels";
|
|
2
|
+
/** Where one entry sits, from the folder that lists it. */
|
|
3
|
+
export interface EntryLocation {
|
|
4
|
+
/** Level of `dir` — the folder whose index lists this entry. */
|
|
5
|
+
level: TreeLevel;
|
|
6
|
+
/** What this entry is: a `root` folder lists plans, a `phase` folder tasks. */
|
|
7
|
+
type: "plan" | "phase" | "task";
|
|
8
|
+
name: string;
|
|
9
|
+
dir: string;
|
|
10
|
+
file: string;
|
|
11
|
+
/** Names from the tree root down to and including this entry. */
|
|
12
|
+
trail: string[];
|
|
13
|
+
}
|
|
14
|
+
/** Where a folder's entries are listed, and at which level. */
|
|
15
|
+
export interface ParentFolder {
|
|
16
|
+
dir: string;
|
|
17
|
+
level: TreeLevel;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Every entry in the tree, in the order the queue runs: each folder's entries
|
|
21
|
+
* alphabetically, and each entry's own entries directly after it.
|
|
22
|
+
*/
|
|
23
|
+
export declare function listAllEntries(root: string): Promise<EntryLocation[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Finds the one entry named `name` anywhere in the tree.
|
|
26
|
+
*
|
|
27
|
+
* @throws Error when nothing is named `name`, or when two entries are — a name
|
|
28
|
+
* the caller cannot act on is reported rather than resolved by guessing
|
|
29
|
+
*/
|
|
30
|
+
export declare function locateEntry(root: string, name: string): Promise<EntryLocation>;
|
|
31
|
+
/**
|
|
32
|
+
* `locateEntry` for a caller that only accepts one kind of entry, such as a
|
|
33
|
+
* hook whose `--in` must name a plan.
|
|
34
|
+
*
|
|
35
|
+
* @throws Error when the entry named `name` is of another type
|
|
36
|
+
*/
|
|
37
|
+
export declare function locateEntryOfType(root: string, name: string, type: EntryLocation["type"]): Promise<EntryLocation>;
|
|
38
|
+
/**
|
|
39
|
+
* Folder whose entries `parent` holds, or the tree root when no parent is named.
|
|
40
|
+
*
|
|
41
|
+
* @param parent name of a plan or phase; a task holds nothing
|
|
42
|
+
*/
|
|
43
|
+
export declare function resolveParent(root: string, parent?: string): Promise<ParentFolder>;
|
|
44
|
+
//# sourceMappingURL=locate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locate.d.ts","sourceRoot":"","sources":["../../src/filetree/locate.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAInE,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,KAAK,EAAE,SAAS,CAAC;IACjB,+EAA+E;IAC/E,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,+DAA+D;AAC/D,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAI3E;AA0BD;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAcpF;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,GAC1B,OAAO,CAAC,aAAa,CAAC,CAQxB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAWxF"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// packages/skills/src/filetree/locate.ts
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { CHILD_LEVEL, ENTRY_TYPE } from "./levels";
|
|
4
|
+
import { childDirFor, entryPathFor } from "./paths";
|
|
5
|
+
import { listEntryNames } from "./entries";
|
|
6
|
+
/**
|
|
7
|
+
* Every entry in the tree, in the order the queue runs: each folder's entries
|
|
8
|
+
* alphabetically, and each entry's own entries directly after it.
|
|
9
|
+
*/
|
|
10
|
+
export async function listAllEntries(root) {
|
|
11
|
+
const found = [];
|
|
12
|
+
await collectFrom(resolve(root), "root", [], found);
|
|
13
|
+
return found;
|
|
14
|
+
}
|
|
15
|
+
async function collectFrom(dir, level, trail, found) {
|
|
16
|
+
const child = CHILD_LEVEL[level];
|
|
17
|
+
for (const name of await listEntryNames(dir, level)) {
|
|
18
|
+
const here = [...trail, name];
|
|
19
|
+
found.push({
|
|
20
|
+
level,
|
|
21
|
+
type: ENTRY_TYPE[level],
|
|
22
|
+
name,
|
|
23
|
+
dir,
|
|
24
|
+
file: entryPathFor(dir, level, name),
|
|
25
|
+
trail: here,
|
|
26
|
+
});
|
|
27
|
+
if (child !== null)
|
|
28
|
+
await collectFrom(childDirFor(dir, name), child, here, found);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Finds the one entry named `name` anywhere in the tree.
|
|
33
|
+
*
|
|
34
|
+
* @throws Error when nothing is named `name`, or when two entries are — a name
|
|
35
|
+
* the caller cannot act on is reported rather than resolved by guessing
|
|
36
|
+
*/
|
|
37
|
+
export async function locateEntry(root, name) {
|
|
38
|
+
const matches = (await listAllEntries(root)).filter((entry) => entry.name === name);
|
|
39
|
+
const [first, second] = matches;
|
|
40
|
+
if (first === undefined) {
|
|
41
|
+
throw new Error(`nothing in ${resolve(root)} is named "${name}"`);
|
|
42
|
+
}
|
|
43
|
+
if (second !== undefined) {
|
|
44
|
+
throw new Error(`"${name}" is ambiguous: ${first.file} and ${second.file} both answer to it`);
|
|
45
|
+
}
|
|
46
|
+
return first;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* `locateEntry` for a caller that only accepts one kind of entry, such as a
|
|
50
|
+
* hook whose `--in` must name a plan.
|
|
51
|
+
*
|
|
52
|
+
* @throws Error when the entry named `name` is of another type
|
|
53
|
+
*/
|
|
54
|
+
export async function locateEntryOfType(root, name, type) {
|
|
55
|
+
const entry = await locateEntry(root, name);
|
|
56
|
+
if (entry.type !== type) {
|
|
57
|
+
throw new Error(`"${name}" is a ${entry.type}, not a ${type}`);
|
|
58
|
+
}
|
|
59
|
+
return entry;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Folder whose entries `parent` holds, or the tree root when no parent is named.
|
|
63
|
+
*
|
|
64
|
+
* @param parent name of a plan or phase; a task holds nothing
|
|
65
|
+
*/
|
|
66
|
+
export async function resolveParent(root, parent) {
|
|
67
|
+
if (parent === undefined)
|
|
68
|
+
return { dir: resolve(root), level: "root" };
|
|
69
|
+
const entry = await locateEntry(root, parent);
|
|
70
|
+
const child = CHILD_LEVEL[entry.level];
|
|
71
|
+
if (child === null) {
|
|
72
|
+
throw new Error(`"${parent}" is a ${entry.type}, which holds no entries`);
|
|
73
|
+
}
|
|
74
|
+
return { dir: childDirFor(entry.dir, entry.name), level: child };
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=locate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locate.js","sourceRoot":"","sources":["../../src/filetree/locate.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAkB,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAqB3C;;;GAGG;A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E,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type TreeLevel } from "./levels";
|
|
2
|
+
/** Path of the index file a folder at `level` owns. */
|
|
3
|
+
export declare function indexPathFor(dir: string, level: TreeLevel): string;
|
|
4
|
+
/** Folder owned by a `folder` entry — holds its own file and the level below it. */
|
|
5
|
+
export declare function childDirFor(dir: string, entryName: string): string;
|
|
6
|
+
/** Folder holding a phase's task files. */
|
|
7
|
+
export declare function tasksDirFor(phaseDir: string): string;
|
|
8
|
+
/** Path of the `.md` file describing one entry of a folder at `level`. */
|
|
9
|
+
export declare function entryPathFor(dir: string, level: TreeLevel, entryName: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Level of `dir` given the tree it belongs to, from how deep it sits under
|
|
12
|
+
* `root`. Throws when `dir` sits outside `root` or below a phase folder.
|
|
13
|
+
*/
|
|
14
|
+
export declare function levelFor(root: string, dir: string): TreeLevel;
|
|
15
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/filetree/paths.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwD,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAEhG,uDAAuD;AACvD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,CAElE;AAED,oFAAoF;AACpF,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,2CAA2C;AAC3C,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,0EAA0E;AAC1E,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAIrF;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAe7D"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// packages/skills/src/filetree/paths.ts
|
|
2
|
+
import { join, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { ENTRY_KIND, INDEX_FILES, LEVELS, MARKDOWN, TASKS_DIR } from "./levels";
|
|
4
|
+
/** Path of the index file a folder at `level` owns. */
|
|
5
|
+
export function indexPathFor(dir, level) {
|
|
6
|
+
return join(dir, INDEX_FILES[level]);
|
|
7
|
+
}
|
|
8
|
+
/** Folder owned by a `folder` entry — holds its own file and the level below it. */
|
|
9
|
+
export function childDirFor(dir, entryName) {
|
|
10
|
+
return join(dir, entryName);
|
|
11
|
+
}
|
|
12
|
+
/** Folder holding a phase's task files. */
|
|
13
|
+
export function tasksDirFor(phaseDir) {
|
|
14
|
+
return join(phaseDir, TASKS_DIR);
|
|
15
|
+
}
|
|
16
|
+
/** Path of the `.md` file describing one entry of a folder at `level`. */
|
|
17
|
+
export function entryPathFor(dir, level, entryName) {
|
|
18
|
+
return ENTRY_KIND[level] === "folder"
|
|
19
|
+
? join(dir, entryName, `${entryName}${MARKDOWN}`)
|
|
20
|
+
: join(tasksDirFor(dir), `${entryName}${MARKDOWN}`);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Level of `dir` given the tree it belongs to, from how deep it sits under
|
|
24
|
+
* `root`. Throws when `dir` sits outside `root` or below a phase folder.
|
|
25
|
+
*/
|
|
26
|
+
export function levelFor(root, dir) {
|
|
27
|
+
const rel = relative(resolve(root), resolve(dir));
|
|
28
|
+
if (rel.startsWith("..")) {
|
|
29
|
+
throw new Error(`${dir} is not inside the tree at ${root}`);
|
|
30
|
+
}
|
|
31
|
+
const depth = rel === "" ? 0 : rel.split(sep).length;
|
|
32
|
+
const level = LEVELS[depth];
|
|
33
|
+
if (level === undefined) {
|
|
34
|
+
throw new Error(`${dir} is ${depth} folders below ${root}; the tree is ${LEVELS.length} deep`);
|
|
35
|
+
}
|
|
36
|
+
return level;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/filetree/paths.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAkB,MAAM,UAAU,CAAC;AAEhG,uDAAuD;AACvD,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,KAAgB;IACxD,OAAO,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,SAAiB;IACxD,OAAO,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAC9B,CAAC;AAED,2CAA2C;AAC3C,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,OAAO,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AACnC,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,KAAgB,EAAE,SAAiB;IAC3E,OAAO,UAAU,CAAC,KAAK,CAAC,KAAK,QAAQ;QACnC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,SAAS,GAAG,QAAQ,EAAE,CAAC;QACjD,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,GAAG,QAAQ,EAAE,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,GAAW;IAChD,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IAElD,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,8BAA8B,IAAI,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,KAAK,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAE5B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,OAAO,KAAK,kBAAkB,IAAI,iBAAiB,MAAM,CAAC,MAAM,OAAO,CAAC,CAAC;IACjG,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Plan } from "../schemas/plan";
|
|
2
|
+
import { type Phase } from "../schemas/phase";
|
|
3
|
+
import { type Task } from "../schemas/task";
|
|
4
|
+
import { type TreeLevel } from "./levels";
|
|
5
|
+
/** Entry a folder at `L` holds — a root folder holds plans, a plan folder phases. */
|
|
6
|
+
export type EntryOf<L extends TreeLevel> = L extends "root" ? Plan : L extends "plan" ? Phase : Task;
|
|
7
|
+
/** One entry as it sits on disk: where it was read from, its fields, its prose. */
|
|
8
|
+
export interface EntryDocument<L extends TreeLevel> {
|
|
9
|
+
file: string;
|
|
10
|
+
meta: EntryOf<L>;
|
|
11
|
+
body: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Reads one entry of a folder at `level` and checks it against its schema.
|
|
15
|
+
* Every read of a plan, phase or task file goes through here.
|
|
16
|
+
*
|
|
17
|
+
* @param dir folder whose index lists the entry
|
|
18
|
+
* @param name folder name for a plan or phase, task id for a task
|
|
19
|
+
* @throws FileValidationError when a field fails its schema, or when the
|
|
20
|
+
* identifier inside the file disagrees with the folder or file it was read from
|
|
21
|
+
*/
|
|
22
|
+
export declare function readEntry<L extends TreeLevel>(dir: string, level: L, name: string): Promise<EntryDocument<L>>;
|
|
23
|
+
//# sourceMappingURL=read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/filetree/read.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAIpD,qFAAqF;AACrF,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,SAAS,IAAI,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,CAAC,SAAS,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;AAErG,mFAAmF;AACnF,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,SAAS;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAQD;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAAC,CAAC,SAAS,SAAS,EACjD,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,CAAC,EACR,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAe3B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// packages/skills/src/filetree/read.ts
|
|
2
|
+
import { FileValidationError, parseFile } from "../schemas/validation";
|
|
3
|
+
import { PlanSchema } from "../schemas/plan";
|
|
4
|
+
import { PhaseSchema } from "../schemas/phase";
|
|
5
|
+
import { TaskSchema } from "../schemas/task";
|
|
6
|
+
import { ID_FIELD } from "./levels";
|
|
7
|
+
import { entryPathFor } from "./paths";
|
|
8
|
+
import { readDocument } from "./frontmatter";
|
|
9
|
+
const SCHEMAS = {
|
|
10
|
+
root: PlanSchema,
|
|
11
|
+
plan: PhaseSchema,
|
|
12
|
+
phase: TaskSchema,
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Reads one entry of a folder at `level` and checks it against its schema.
|
|
16
|
+
* Every read of a plan, phase or task file goes through here.
|
|
17
|
+
*
|
|
18
|
+
* @param dir folder whose index lists the entry
|
|
19
|
+
* @param name folder name for a plan or phase, task id for a task
|
|
20
|
+
* @throws FileValidationError when a field fails its schema, or when the
|
|
21
|
+
* identifier inside the file disagrees with the folder or file it was read from
|
|
22
|
+
*/
|
|
23
|
+
export async function readEntry(dir, level, name) {
|
|
24
|
+
const file = entryPathFor(dir, level, name);
|
|
25
|
+
const { frontmatter, body } = await readDocument(file);
|
|
26
|
+
const meta = parseFile(SCHEMAS[level], file, frontmatter);
|
|
27
|
+
const idField = ID_FIELD[level];
|
|
28
|
+
const identifier = meta[idField];
|
|
29
|
+
if (identifier !== name) {
|
|
30
|
+
throw new FileValidationError(file, [
|
|
31
|
+
{ field: idField, message: `is "${String(identifier)}" but it was read as "${name}"` },
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
return { file, meta, body };
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/filetree/read.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAa,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAc,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAa,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAkB,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAY7C,MAAM,OAAO,GAAG;IACd,IAAI,EAAG,UAAU;IACjB,IAAI,EAAG,WAAW;IAClB,KAAK,EAAE,UAAU;CACT,CAAC;AAEX;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,GAAW,EACX,KAAQ,EACR,IAAY;IAEZ,MAAM,IAAI,GAAG,YAAY,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAC5C,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,WAAW,CAAe,CAAC;IAExE,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,UAAU,GAAI,IAAgC,CAAC,OAAO,CAAC,CAAC;IAE9D,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;QACxB,MAAM,IAAI,mBAAmB,CAAC,IAAI,EAAE;YAClC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,MAAM,CAAC,UAAU,CAAC,yBAAyB,IAAI,GAAG,EAAE;SACvF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EntryLocation } from "./locate";
|
|
2
|
+
/**
|
|
3
|
+
* Deletes an entry — a task's `.md` file, or a plan or phase folder with
|
|
4
|
+
* everything under it. Removing something already gone is not an error, so a
|
|
5
|
+
* plan and a phase inside it can both be handed in. Regenerate the tree
|
|
6
|
+
* afterwards.
|
|
7
|
+
*/
|
|
8
|
+
export declare function removeEntry(entry: EntryLocation): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=remove.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../src/filetree/remove.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAMrE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// packages/skills/src/filetree/remove.ts
|
|
2
|
+
import { rm } from "node:fs/promises";
|
|
3
|
+
import { ENTRY_KIND } from "./levels";
|
|
4
|
+
import { childDirFor } from "./paths";
|
|
5
|
+
/**
|
|
6
|
+
* Deletes an entry — a task's `.md` file, or a plan or phase folder with
|
|
7
|
+
* everything under it. Removing something already gone is not an error, so a
|
|
8
|
+
* plan and a phase inside it can both be handed in. Regenerate the tree
|
|
9
|
+
* afterwards.
|
|
10
|
+
*/
|
|
11
|
+
export async function removeEntry(entry) {
|
|
12
|
+
const target = ENTRY_KIND[entry.level] === "folder"
|
|
13
|
+
? childDirFor(entry.dir, entry.name)
|
|
14
|
+
: entry.file;
|
|
15
|
+
await rm(target, { recursive: true, force: true });
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../src/filetree/remove.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,KAAoB;IACpD,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,QAAQ;QACjD,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC;QACpC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;IAEf,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Absolute path of the tree, from `skills.settings.filetreeRoot` in
|
|
3
|
+
* `.g3n.config.json`. Falls back to the schema default when the project has no
|
|
4
|
+
* config file yet.
|
|
5
|
+
*
|
|
6
|
+
* @param projectRoot folder holding `.g3n.config.json`
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveFiletreeRoot(projectRoot: string): Promise<string>;
|
|
9
|
+
//# sourceMappingURL=root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/filetree/root.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAI9E"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// packages/skills/src/filetree/root.ts
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { loadSkillsConfig } from "@g3nomaly/core/config";
|
|
4
|
+
/**
|
|
5
|
+
* Absolute path of the tree, from `skills.settings.filetreeRoot` in
|
|
6
|
+
* `.g3n.config.json`. Falls back to the schema default when the project has no
|
|
7
|
+
* config file yet.
|
|
8
|
+
*
|
|
9
|
+
* @param projectRoot folder holding `.g3n.config.json`
|
|
10
|
+
*/
|
|
11
|
+
export async function resolveFiletreeRoot(projectRoot) {
|
|
12
|
+
const config = await loadSkillsConfig(projectRoot);
|
|
13
|
+
return resolve(projectRoot, config.settings.filetreeRoot);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../src/filetree/root.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,WAAmB;IAC3D,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAEnD,OAAO,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type TaskStatus } from "../schemas/primitives";
|
|
3
|
+
/** What a status change did, for a caller that reports it. */
|
|
4
|
+
export interface StatusChange<T extends string = TaskStatus> {
|
|
5
|
+
from: T;
|
|
6
|
+
to: T;
|
|
7
|
+
}
|
|
8
|
+
/** `setStatusLine` for a plan, phase or task file. */
|
|
9
|
+
export declare function setEntryStatus(file: string, to: TaskStatus): Promise<StatusChange>;
|
|
10
|
+
/**
|
|
11
|
+
* Rewrites the `status:` line in a file's frontmatter and leaves every other
|
|
12
|
+
* byte alone, so comments, key order and quoting survive the change. Regenerate
|
|
13
|
+
* the owning index afterwards — this touches the `.md` file only.
|
|
14
|
+
*
|
|
15
|
+
* @param schema the set of statuses the file may hold
|
|
16
|
+
* @throws FileValidationError when the frontmatter has no `status:` line, or
|
|
17
|
+
* holds a status outside `schema`
|
|
18
|
+
* @throws Error when the file already has status `to`
|
|
19
|
+
*/
|
|
20
|
+
export declare function setStatusLine<T extends string>(file: string, to: T, schema: z.ZodType<T>): Promise<StatusChange<T>>;
|
|
21
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/filetree/status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAMtE,8DAA8D;AAC9D,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,UAAU;IACzD,IAAI,EAAE,CAAC,CAAC;IACR,EAAE,EAAE,CAAC,CAAC;CACP;AAED,sDAAsD;AACtD,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAExF;AAED;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CAAC,CAAC,SAAS,MAAM,EAClD,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,EACL,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAyB1B"}
|