@g3nomaly/skills 1.0.0 → 1.0.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/dist/cli/adapter.d.ts +19 -16
- package/dist/cli/adapter.d.ts.map +1 -1
- package/dist/cli/adapter.js +39 -63
- package/dist/cli/adapter.js.map +1 -1
- package/dist/cli/commands/add.d.ts +7 -10
- package/dist/cli/commands/add.d.ts.map +1 -1
- package/dist/cli/commands/add.js +12 -98
- package/dist/cli/commands/add.js.map +1 -1
- package/dist/cli/commands/ls.d.ts +9 -2
- package/dist/cli/commands/ls.d.ts.map +1 -1
- package/dist/cli/commands/ls.js +21 -5
- package/dist/cli/commands/ls.js.map +1 -1
- package/dist/cli/commands/remove.d.ts +7 -7
- package/dist/cli/commands/remove.d.ts.map +1 -1
- package/dist/cli/commands/remove.js +11 -56
- package/dist/cli/commands/remove.js.map +1 -1
- package/dist/cli/commands/source.d.ts +29 -0
- package/dist/cli/commands/source.d.ts.map +1 -0
- package/dist/cli/commands/source.js +31 -0
- package/dist/cli/commands/source.js.map +1 -0
- package/dist/cli/commands/update.d.ts +6 -6
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +9 -43
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/index.js +79 -58
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +2 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -8
- package/dist/index.js.map +1 -1
- package/dist/packages/index.d.ts +3 -0
- package/dist/packages/index.d.ts.map +1 -0
- package/dist/packages/index.js +3 -0
- package/dist/packages/index.js.map +1 -0
- package/dist/packages/install.d.ts +24 -0
- package/dist/packages/install.d.ts.map +1 -0
- package/dist/packages/install.js +47 -0
- package/dist/packages/install.js.map +1 -0
- package/dist/registry/index.d.ts +4 -2
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +3 -2
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/locate.d.ts +22 -0
- package/dist/registry/locate.d.ts.map +1 -0
- package/dist/registry/locate.js +81 -0
- package/dist/registry/locate.js.map +1 -0
- package/dist/registry/manifest.d.ts +9 -0
- package/dist/registry/manifest.d.ts.map +1 -0
- package/dist/registry/manifest.js +14 -0
- package/dist/registry/manifest.js.map +1 -0
- package/dist/registry/readSkillDir.d.ts +8 -6
- package/dist/registry/readSkillDir.d.ts.map +1 -1
- package/dist/registry/readSkillDir.js +19 -24
- package/dist/registry/readSkillDir.js.map +1 -1
- package/dist/registry/readSource.d.ts +9 -0
- package/dist/registry/readSource.d.ts.map +1 -0
- package/dist/registry/readSource.js +30 -0
- package/dist/registry/readSource.js.map +1 -0
- package/dist/registry/types.d.ts +16 -16
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/registry/types.js +13 -23
- package/dist/registry/types.js.map +1 -1
- package/dist/sources/builtins.d.ts +4 -0
- package/dist/sources/builtins.d.ts.map +1 -0
- package/dist/sources/builtins.js +5 -0
- package/dist/sources/builtins.js.map +1 -0
- package/dist/sources/index.d.ts +2 -0
- package/dist/sources/index.d.ts.map +1 -0
- package/dist/sources/index.js +3 -0
- package/dist/sources/index.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +7 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +20 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +8 -32
- package/dist/cli/commands/hook.d.ts +0 -6
- package/dist/cli/commands/hook.d.ts.map +0 -1
- package/dist/cli/commands/hook.js +0 -18
- package/dist/cli/commands/hook.js.map +0 -1
- package/dist/decisions/index.d.ts +0 -6
- package/dist/decisions/index.d.ts.map +0 -1
- package/dist/decisions/index.js +0 -5
- package/dist/decisions/index.js.map +0 -1
- package/dist/decisions/paths.d.ts +0 -4
- package/dist/decisions/paths.d.ts.map +0 -1
- package/dist/decisions/paths.js +0 -12
- package/dist/decisions/paths.js.map +0 -1
- package/dist/decisions/read.d.ts +0 -18
- package/dist/decisions/read.d.ts.map +0 -1
- package/dist/decisions/read.js +0 -45
- package/dist/decisions/read.js.map +0 -1
- package/dist/decisions/write.d.ts +0 -20
- package/dist/decisions/write.d.ts.map +0 -1
- package/dist/decisions/write.js +0 -48
- package/dist/decisions/write.js.map +0 -1
- package/dist/filetree/ensure.d.ts +0 -7
- package/dist/filetree/ensure.d.ts.map +0 -1
- package/dist/filetree/ensure.js +0 -36
- package/dist/filetree/ensure.js.map +0 -1
- package/dist/filetree/entries.d.ts +0 -9
- package/dist/filetree/entries.d.ts.map +0 -1
- package/dist/filetree/entries.js +0 -49
- package/dist/filetree/entries.js.map +0 -1
- package/dist/filetree/frontmatter.d.ts +0 -16
- package/dist/filetree/frontmatter.d.ts.map +0 -1
- package/dist/filetree/frontmatter.js +0 -43
- package/dist/filetree/frontmatter.js.map +0 -1
- package/dist/filetree/generate.d.ts +0 -16
- package/dist/filetree/generate.d.ts.map +0 -1
- package/dist/filetree/generate.js +0 -62
- package/dist/filetree/generate.js.map +0 -1
- package/dist/filetree/index.d.ts +0 -17
- package/dist/filetree/index.d.ts.map +0 -1
- package/dist/filetree/index.js +0 -13
- package/dist/filetree/index.js.map +0 -1
- package/dist/filetree/levels.d.ts +0 -25
- package/dist/filetree/levels.d.ts.map +0 -1
- package/dist/filetree/levels.js +0 -45
- package/dist/filetree/levels.js.map +0 -1
- package/dist/filetree/locate.d.ts +0 -44
- package/dist/filetree/locate.d.ts.map +0 -1
- package/dist/filetree/locate.js +0 -76
- package/dist/filetree/locate.js.map +0 -1
- package/dist/filetree/paths.d.ts +0 -15
- package/dist/filetree/paths.d.ts.map +0 -1
- package/dist/filetree/paths.js +0 -38
- package/dist/filetree/paths.js.map +0 -1
- package/dist/filetree/read.d.ts +0 -23
- package/dist/filetree/read.d.ts.map +0 -1
- package/dist/filetree/read.js +0 -36
- package/dist/filetree/read.js.map +0 -1
- package/dist/filetree/remove.d.ts +0 -9
- package/dist/filetree/remove.d.ts.map +0 -1
- package/dist/filetree/remove.js +0 -17
- package/dist/filetree/remove.js.map +0 -1
- package/dist/filetree/root.d.ts +0 -9
- package/dist/filetree/root.d.ts.map +0 -1
- package/dist/filetree/root.js +0 -15
- package/dist/filetree/root.js.map +0 -1
- package/dist/filetree/status.d.ts +0 -21
- package/dist/filetree/status.d.ts.map +0 -1
- package/dist/filetree/status.js +0 -55
- package/dist/filetree/status.js.map +0 -1
- package/dist/hooks/cli.d.ts +0 -29
- package/dist/hooks/cli.d.ts.map +0 -1
- package/dist/hooks/cli.js +0 -65
- package/dist/hooks/cli.js.map +0 -1
- package/dist/hooks/index.d.ts +0 -3
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js +0 -3
- package/dist/hooks/index.js.map +0 -1
- package/dist/plugins/grilling/.claude-plugin/plugin.json +0 -7
- package/dist/plugins/grilling/skills/domain-modeling/ADR-FORMAT.md +0 -47
- package/dist/plugins/grilling/skills/domain-modeling/CONTEXT-FORMAT.md +0 -60
- package/dist/plugins/grilling/skills/domain-modeling/SKILL.md +0 -74
- package/dist/plugins/grilling/skills/domain-modeling/agents/openai.yaml +0 -3
- package/dist/plugins/grilling/skills/grill-me/SKILL.md +0 -7
- package/dist/plugins/grilling/skills/grill-me/agents/openai.yaml +0 -5
- package/dist/plugins/grilling/skills/grill-with-docs/SKILL.md +0 -7
- package/dist/plugins/grilling/skills/grill-with-docs/agents/openai.yaml +0 -5
- package/dist/plugins/grilling/skills/grilling/SKILL.md +0 -12
- package/dist/plugins/grilling/skills/grilling/agents/openai.yaml +0 -3
- package/dist/plugins/speech/.claude-plugin/plugin.json +0 -7
- package/dist/plugins/speech/skills/emphasise/SKILL.md +0 -49
- package/dist/plugins/speech/skills/emphasise/agents/openai.yaml +0 -5
- package/dist/plugins/speech/skills/unslop/SKILL.md +0 -80
- package/dist/plugins/task-manager/.claude-plugin/plugin.json +0 -11
- package/dist/plugins/task-manager/hooks/hooks.json +0 -19
- package/dist/plugins/task-manager/skills/decisions/SKILL.md +0 -39
- package/dist/plugins/task-manager/skills/decisions/agents/openai.yaml +0 -5
- package/dist/plugins/task-manager/skills/decisions/references/usage.md +0 -26
- package/dist/plugins/task-manager/skills/task-manager/SKILL.md +0 -99
- package/dist/plugins/task-manager/skills/vocabulary/SKILL.md +0 -42
- package/dist/plugins/task-manager/skills/vocabulary/agents/openai.yaml +0 -5
- package/dist/plugins/task-manager/skills/vocabulary/references/usage.md +0 -26
- package/dist/plugins/using-hooks/.claude-plugin/plugin.json +0 -7
- package/dist/plugins/using-hooks/skills/hook-post-tool-use/SKILL.md +0 -79
- package/dist/plugins/using-hooks/skills/hook-post-tool-use/agents/openai.yaml +0 -5
- package/dist/plugins/using-hooks/skills/hook-pre-tool-use/SKILL.md +0 -84
- package/dist/plugins/using-hooks/skills/hook-pre-tool-use/agents/openai.yaml +0 -5
- package/dist/plugins/using-hooks/skills/hook-stop/SKILL.md +0 -69
- package/dist/plugins/using-hooks/skills/hook-stop/agents/openai.yaml +0 -5
- package/dist/plugins/using-hooks/skills/hook-user-prompt-submit/SKILL.md +0 -64
- package/dist/plugins/using-hooks/skills/hook-user-prompt-submit/agents/openai.yaml +0 -5
- package/dist/plugins/workflow/.claude-plugin/plugin.json +0 -16
- package/dist/plugins/workflow/agents/reviewer.md +0 -9
- package/dist/plugins/workflow/skills/execute/SKILL.md +0 -21
- package/dist/plugins/workflow/skills/execute/agents/openai.yaml +0 -5
- package/dist/plugins/workflow/skills/orchestrator/SKILL.md +0 -27
- package/dist/plugins/workflow/skills/orchestrator/agents/openai.yaml +0 -5
- package/dist/plugins/workflow/skills/plan/SKILL.md +0 -18
- package/dist/plugins/workflow/skills/plan/agents/openai.yaml +0 -5
- package/dist/plugins/workflow/skills/plan/references/task-frontmatter.md +0 -33
- package/dist/plugins/workflow/skills/review/SKILL.md +0 -25
- package/dist/plugins/workflow/skills/review/agents/openai.yaml +0 -5
- package/dist/plugins/workflow/skills/run/SKILL.md +0 -33
- package/dist/plugins/workflow/skills/run/agents/openai.yaml +0 -5
- package/dist/plugins/workflow/skills/run/references/sub-agents.md +0 -46
- package/dist/plugins/workflow/skills/sync/SKILL.md +0 -18
- package/dist/plugins/workflow/skills/sync/agents/openai.yaml +0 -5
- package/dist/plugins/workflow/skills/worktree/SKILL.md +0 -38
- package/dist/plugins/workflow/skills/worktree/agents/openai.yaml +0 -5
- package/dist/plugins/workflow/skills/worktree/references/git-commands.md +0 -27
- package/dist/plugins/writing/.claude-plugin/plugin.json +0 -7
- package/dist/plugins/writing/skills/writing-great-hooks/SKILL.md +0 -192
- package/dist/plugins/writing/skills/writing-great-hooks/agents/openai.yaml +0 -5
- package/dist/plugins/writing/skills/writing-great-skills/GLOSSARY.md +0 -201
- package/dist/plugins/writing/skills/writing-great-skills/SKILL.md +0 -92
- package/dist/plugins/writing/skills/writing-great-skills/agents/openai.yaml +0 -5
- package/dist/plugins/writing/skills/writing-great-tasks/SKILL.md +0 -136
- package/dist/plugins/writing/skills/writing-great-tasks/agents/openai.yaml +0 -5
- package/dist/plugins/writing/skills/writing-great-tasks/templates/template_task.md +0 -108
- package/dist/registry/loadPackageRegistry.d.ts +0 -14
- package/dist/registry/loadPackageRegistry.d.ts.map +0 -1
- package/dist/registry/loadPackageRegistry.js +0 -59
- package/dist/registry/loadPackageRegistry.js.map +0 -1
- package/dist/registry/userManifest.d.ts +0 -7
- package/dist/registry/userManifest.d.ts.map +0 -1
- package/dist/registry/userManifest.js +0 -21
- package/dist/registry/userManifest.js.map +0 -1
- package/dist/remote/fetch.d.ts +0 -16
- package/dist/remote/fetch.d.ts.map +0 -1
- package/dist/remote/fetch.js +0 -41
- package/dist/remote/fetch.js.map +0 -1
- package/dist/remote/index.d.ts +0 -7
- package/dist/remote/index.d.ts.map +0 -1
- package/dist/remote/index.js +0 -5
- package/dist/remote/index.js.map +0 -1
- package/dist/remote/manifest.d.ts +0 -23
- package/dist/remote/manifest.d.ts.map +0 -1
- package/dist/remote/manifest.js +0 -116
- package/dist/remote/manifest.js.map +0 -1
- package/dist/remote/registry.d.ts +0 -18
- package/dist/remote/registry.d.ts.map +0 -1
- package/dist/remote/registry.js +0 -58
- package/dist/remote/registry.js.map +0 -1
- package/dist/schemas/config.d.ts +0 -3
- package/dist/schemas/config.d.ts.map +0 -1
- package/dist/schemas/config.js +0 -3
- package/dist/schemas/config.js.map +0 -1
- package/dist/schemas/decision.d.ts +0 -43
- package/dist/schemas/decision.d.ts.map +0 -1
- package/dist/schemas/decision.js +0 -24
- package/dist/schemas/decision.js.map +0 -1
- package/dist/schemas/index.d.ts +0 -17
- package/dist/schemas/index.d.ts.map +0 -1
- package/dist/schemas/index.js +0 -10
- package/dist/schemas/index.js.map +0 -1
- package/dist/schemas/phase.d.ts +0 -46
- package/dist/schemas/phase.d.ts.map +0 -1
- package/dist/schemas/phase.js +0 -16
- package/dist/schemas/phase.js.map +0 -1
- package/dist/schemas/plan.d.ts +0 -44
- package/dist/schemas/plan.d.ts.map +0 -1
- package/dist/schemas/plan.js +0 -15
- package/dist/schemas/plan.js.map +0 -1
- package/dist/schemas/primitives.d.ts +0 -38
- package/dist/schemas/primitives.d.ts.map +0 -1
- package/dist/schemas/primitives.js +0 -33
- package/dist/schemas/primitives.js.map +0 -1
- package/dist/schemas/task.d.ts +0 -70
- package/dist/schemas/task.d.ts.map +0 -1
- package/dist/schemas/task.js +0 -19
- package/dist/schemas/task.js.map +0 -1
- package/dist/schemas/term.d.ts +0 -17
- package/dist/schemas/term.d.ts.map +0 -1
- package/dist/schemas/term.js +0 -22
- package/dist/schemas/term.js.map +0 -1
- package/dist/schemas/validation.d.ts +0 -24
- package/dist/schemas/validation.d.ts.map +0 -1
- package/dist/schemas/validation.js +0 -39
- package/dist/schemas/validation.js.map +0 -1
- package/dist/task-manager/hooks/add-decision.d.ts +0 -2
- package/dist/task-manager/hooks/add-decision.d.ts.map +0 -1
- package/dist/task-manager/hooks/add-decision.js +0 -19
- package/dist/task-manager/hooks/add-decision.js.map +0 -1
- package/dist/task-manager/hooks/cleanup.d.ts +0 -2
- package/dist/task-manager/hooks/cleanup.d.ts.map +0 -1
- package/dist/task-manager/hooks/cleanup.js +0 -27
- package/dist/task-manager/hooks/cleanup.js.map +0 -1
- package/dist/task-manager/hooks/get-decision.d.ts +0 -2
- package/dist/task-manager/hooks/get-decision.d.ts.map +0 -1
- package/dist/task-manager/hooks/get-decision.js +0 -11
- package/dist/task-manager/hooks/get-decision.js.map +0 -1
- package/dist/task-manager/hooks/get-entry.d.ts +0 -2
- package/dist/task-manager/hooks/get-entry.d.ts.map +0 -1
- package/dist/task-manager/hooks/get-entry.js +0 -20
- package/dist/task-manager/hooks/get-entry.js.map +0 -1
- package/dist/task-manager/hooks/get-term.d.ts +0 -2
- package/dist/task-manager/hooks/get-term.d.ts.map +0 -1
- package/dist/task-manager/hooks/get-term.js +0 -13
- package/dist/task-manager/hooks/get-term.js.map +0 -1
- package/dist/task-manager/hooks/guard-tree.d.ts +0 -2
- package/dist/task-manager/hooks/guard-tree.d.ts.map +0 -1
- package/dist/task-manager/hooks/guard-tree.js +0 -63
- package/dist/task-manager/hooks/guard-tree.js.map +0 -1
- package/dist/task-manager/hooks/index.d.ts +0 -4
- package/dist/task-manager/hooks/index.d.ts.map +0 -1
- package/dist/task-manager/hooks/index.js +0 -32
- package/dist/task-manager/hooks/index.js.map +0 -1
- package/dist/task-manager/hooks/list-decisions.d.ts +0 -2
- package/dist/task-manager/hooks/list-decisions.d.ts.map +0 -1
- package/dist/task-manager/hooks/list-decisions.js +0 -20
- package/dist/task-manager/hooks/list-decisions.js.map +0 -1
- package/dist/task-manager/hooks/list-entries.d.ts +0 -2
- package/dist/task-manager/hooks/list-entries.d.ts.map +0 -1
- package/dist/task-manager/hooks/list-entries.js +0 -19
- package/dist/task-manager/hooks/list-entries.js.map +0 -1
- package/dist/task-manager/hooks/list-terms.d.ts +0 -2
- package/dist/task-manager/hooks/list-terms.d.ts.map +0 -1
- package/dist/task-manager/hooks/list-terms.js +0 -8
- package/dist/task-manager/hooks/list-terms.js.map +0 -1
- package/dist/task-manager/hooks/next-entry.d.ts +0 -2
- package/dist/task-manager/hooks/next-entry.d.ts.map +0 -1
- package/dist/task-manager/hooks/next-entry.js +0 -23
- package/dist/task-manager/hooks/next-entry.js.map +0 -1
- package/dist/task-manager/hooks/remove-term.d.ts +0 -2
- package/dist/task-manager/hooks/remove-term.d.ts.map +0 -1
- package/dist/task-manager/hooks/remove-term.js +0 -15
- package/dist/task-manager/hooks/remove-term.js.map +0 -1
- package/dist/task-manager/hooks/set-state.d.ts +0 -2
- package/dist/task-manager/hooks/set-state.d.ts.map +0 -1
- package/dist/task-manager/hooks/set-state.js +0 -15
- package/dist/task-manager/hooks/set-state.js.map +0 -1
- package/dist/task-manager/hooks/set-term.d.ts +0 -2
- package/dist/task-manager/hooks/set-term.d.ts.map +0 -1
- package/dist/task-manager/hooks/set-term.js +0 -27
- package/dist/task-manager/hooks/set-term.js.map +0 -1
- package/dist/task-manager/hooks/sync-tree.d.ts +0 -2
- package/dist/task-manager/hooks/sync-tree.d.ts.map +0 -1
- package/dist/task-manager/hooks/sync-tree.js +0 -28
- package/dist/task-manager/hooks/sync-tree.js.map +0 -1
- package/dist/task-manager/index.d.ts +0 -2
- package/dist/task-manager/index.d.ts.map +0 -1
- package/dist/task-manager/index.js +0 -3
- package/dist/task-manager/index.js.map +0 -1
- package/dist/vocabulary/file.d.ts +0 -15
- package/dist/vocabulary/file.d.ts.map +0 -1
- package/dist/vocabulary/file.js +0 -80
- package/dist/vocabulary/file.js.map +0 -1
- package/dist/vocabulary/index.d.ts +0 -4
- package/dist/vocabulary/index.d.ts.map +0 -1
- package/dist/vocabulary/index.js +0 -4
- package/dist/vocabulary/index.js.map +0 -1
- package/dist/vocabulary/match.d.ts +0 -22
- package/dist/vocabulary/match.d.ts.map +0 -1
- package/dist/vocabulary/match.js +0 -31
- package/dist/vocabulary/match.js.map +0 -1
- package/dist/workflow/gates.d.ts +0 -24
- package/dist/workflow/gates.d.ts.map +0 -1
- package/dist/workflow/gates.js +0 -34
- package/dist/workflow/gates.js.map +0 -1
- package/dist/workflow/hooks/advance-step.d.ts +0 -2
- package/dist/workflow/hooks/advance-step.d.ts.map +0 -1
- package/dist/workflow/hooks/advance-step.js +0 -51
- package/dist/workflow/hooks/advance-step.js.map +0 -1
- package/dist/workflow/hooks/current-step.d.ts +0 -2
- package/dist/workflow/hooks/current-step.d.ts.map +0 -1
- package/dist/workflow/hooks/current-step.js +0 -24
- package/dist/workflow/hooks/current-step.js.map +0 -1
- package/dist/workflow/hooks/index.d.ts +0 -4
- package/dist/workflow/hooks/index.d.ts.map +0 -1
- package/dist/workflow/hooks/index.js +0 -10
- package/dist/workflow/hooks/index.js.map +0 -1
- package/dist/workflow/hooks/ready-phases.d.ts +0 -2
- package/dist/workflow/hooks/ready-phases.d.ts.map +0 -1
- package/dist/workflow/hooks/ready-phases.js +0 -15
- package/dist/workflow/hooks/ready-phases.js.map +0 -1
- package/dist/workflow/index.d.ts +0 -8
- package/dist/workflow/index.d.ts.map +0 -1
- package/dist/workflow/index.js +0 -6
- package/dist/workflow/index.js.map +0 -1
- package/dist/workflow/phase.d.ts +0 -16
- package/dist/workflow/phase.d.ts.map +0 -1
- package/dist/workflow/phase.js +0 -22
- package/dist/workflow/phase.js.map +0 -1
- package/dist/workflow/steps.d.ts +0 -15
- package/dist/workflow/steps.d.ts.map +0 -1
- package/dist/workflow/steps.js +0 -32
- package/dist/workflow/steps.js.map +0 -1
package/dist/filetree/locate.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAY;IAC/C,MAAM,KAAK,GAAoB,EAAE,CAAC;IAClC,MAAM,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACpD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,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7E,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAAY,EACZ,IAAY,EACZ,IAA2B;IAE3B,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAE5C,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,UAAU,KAAK,CAAC,IAAI,WAAW,IAAI,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAY,EAAE,MAAe;IAC/D,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAEvE,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEvC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,IAAI,MAAM,UAAU,KAAK,CAAC,IAAI,0BAA0B,CAAC,CAAC;IAC5E,CAAC;IAED,OAAO,EAAE,GAAG,EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AACnE,CAAC"}
|
package/dist/filetree/paths.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/filetree/paths.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/fil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,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"}
|
package/dist/filetree/read.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/filetree/read.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/filetree/remove.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/filetree/root.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/filetree/root.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/filetree/status.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { StatusSchema } from "../schemas/primitives";
|
|
2
|
-
import { FileValidationError } from "../schemas/validation";
|
|
3
|
-
const FENCE = "---";
|
|
4
|
-
const STATUS_LINE = /^(status:\s*)(\S+)(\s*)$/;
|
|
5
|
-
/** `setStatusLine` for a plan, phase or task file. */
|
|
6
|
-
export async function setEntryStatus(file, to) {
|
|
7
|
-
return setStatusLine(file, to, StatusSchema);
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Rewrites the `status:` line in a file's frontmatter and leaves every other
|
|
11
|
-
* byte alone, so comments, key order and quoting survive the change. Regenerate
|
|
12
|
-
* the owning index afterwards — this touches the `.md` file only.
|
|
13
|
-
*
|
|
14
|
-
* @param schema the set of statuses the file may hold
|
|
15
|
-
* @throws FileValidationError when the frontmatter has no `status:` line, or
|
|
16
|
-
* holds a status outside `schema`
|
|
17
|
-
* @throws Error when the file already has status `to`
|
|
18
|
-
*/
|
|
19
|
-
export async function setStatusLine(file, to, schema) {
|
|
20
|
-
const lines = (await Bun.file(file).text()).split("\n");
|
|
21
|
-
const closing = closingFenceAt(lines, file);
|
|
22
|
-
for (let index = 1; index < closing; index++) {
|
|
23
|
-
const match = STATUS_LINE.exec(lines[index] ?? "");
|
|
24
|
-
if (match === null)
|
|
25
|
-
continue;
|
|
26
|
-
const from = schema.safeParse(match[2]);
|
|
27
|
-
if (!from.success) {
|
|
28
|
-
throw new FileValidationError(file, [{ field: "status", message: `is "${match[2]}"` }]);
|
|
29
|
-
}
|
|
30
|
-
if (from.data === to) {
|
|
31
|
-
throw new Error(`${file} is already "${to}"`);
|
|
32
|
-
}
|
|
33
|
-
lines[index] = `${match[1]}${to}${match[3]}`;
|
|
34
|
-
await Bun.write(file, lines.join("\n"));
|
|
35
|
-
return { from: from.data, to };
|
|
36
|
-
}
|
|
37
|
-
throw new FileValidationError(file, [
|
|
38
|
-
{ field: "status", message: "has no status: line in the frontmatter" },
|
|
39
|
-
]);
|
|
40
|
-
}
|
|
41
|
-
function closingFenceAt(lines, file) {
|
|
42
|
-
if (lines[0]?.trimEnd() !== FENCE) {
|
|
43
|
-
throw new FileValidationError(file, [
|
|
44
|
-
{ field: "(frontmatter)", message: `no ${FENCE} block at the top of the file` },
|
|
45
|
-
]);
|
|
46
|
-
}
|
|
47
|
-
const closing = lines.findIndex((line, index) => index > 0 && line.trimEnd() === FENCE);
|
|
48
|
-
if (closing === -1) {
|
|
49
|
-
throw new FileValidationError(file, [
|
|
50
|
-
{ field: "(frontmatter)", message: `the ${FENCE} block is never closed` },
|
|
51
|
-
]);
|
|
52
|
-
}
|
|
53
|
-
return closing;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=status.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":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@@ -1,29 +0,0 @@
|
|
|
1
|
-
/** One hook as `g3n-skills hook <name>` runs it: the flags after the name, untouched. */
|
|
2
|
-
export type Hook = (argv: readonly string[]) => Promise<void>;
|
|
3
|
-
/** Value of `--flag <value>`, or `undefined` when the flag is absent. */
|
|
4
|
-
export declare function readFlag(argv: readonly string[], flag: string): string | undefined;
|
|
5
|
-
/** Value of `--flag <value>`, or a stated failure when it is missing. */
|
|
6
|
-
export declare function requireFlag(argv: readonly string[], flag: string, example: string): string;
|
|
7
|
-
export declare function hasFlag(argv: readonly string[], flag: string): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Narrows a flag value to one of a fixed set, naming the whole set when it is
|
|
10
|
-
* not one of them. A schema would report the same rejection as parser output,
|
|
11
|
-
* which is not what a caller reading stderr can act on.
|
|
12
|
-
*/
|
|
13
|
-
export declare function oneOf<T extends string>(value: string, allowed: readonly T[], flag: string): T;
|
|
14
|
-
/**
|
|
15
|
-
* Tree root the script works on: `--root` verbatim, otherwise the folder named
|
|
16
|
-
* by `skills.settings.filetreeRoot` under `--project` (default: the working
|
|
17
|
-
* directory).
|
|
18
|
-
*/
|
|
19
|
-
export declare function resolveRoot(argv: readonly string[]): Promise<string>;
|
|
20
|
-
/** Everything piped to the hook on stdin, or `""` when it was run from a terminal. */
|
|
21
|
-
export declare function readStdin(): Promise<string>;
|
|
22
|
-
/** The only thing a script writes to stdout. */
|
|
23
|
-
export declare function printJson(value: unknown, argv: readonly string[]): void;
|
|
24
|
-
/**
|
|
25
|
-
* Runs a script's `main` and turns anything thrown into a message on stderr and
|
|
26
|
-
* a non-zero exit, so no rejection escapes as a stack trace.
|
|
27
|
-
*/
|
|
28
|
-
export declare function runHook(main: () => Promise<void>): void;
|
|
29
|
-
//# sourceMappingURL=cli.d.ts.map
|
package/dist/hooks/cli.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/hooks/cli.ts"],"names":[],"mappings":"AAIA,yFAAyF;AACzF,MAAM,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE9D,yEAAyE;AACzE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUlF;AAED,yEAAyE;AACzE,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAO1F;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAI7F;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAK1E;AAED,sFAAsF;AACtF,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAEjD;AAED,gDAAgD;AAChD,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAEvE;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAKvD"}
|
package/dist/hooks/cli.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// packages/skills/src/hooks/cli.ts
|
|
2
|
-
import { resolve } from "node:path";
|
|
3
|
-
import { resolveFiletreeRoot } from "../filetree/root";
|
|
4
|
-
/** Value of `--flag <value>`, or `undefined` when the flag is absent. */
|
|
5
|
-
export function readFlag(argv, flag) {
|
|
6
|
-
const at = argv.indexOf(flag);
|
|
7
|
-
if (at === -1)
|
|
8
|
-
return undefined;
|
|
9
|
-
const value = argv[at + 1];
|
|
10
|
-
if (value === undefined || value.startsWith("--")) {
|
|
11
|
-
throw new Error(`${flag} requires a value`);
|
|
12
|
-
}
|
|
13
|
-
return value;
|
|
14
|
-
}
|
|
15
|
-
/** Value of `--flag <value>`, or a stated failure when it is missing. */
|
|
16
|
-
export function requireFlag(argv, flag, example) {
|
|
17
|
-
const value = readFlag(argv, flag);
|
|
18
|
-
if (value === undefined) {
|
|
19
|
-
throw new Error(`${flag} is required, e.g. ${flag} ${example}`);
|
|
20
|
-
}
|
|
21
|
-
return value;
|
|
22
|
-
}
|
|
23
|
-
export function hasFlag(argv, flag) {
|
|
24
|
-
return argv.includes(flag);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Narrows a flag value to one of a fixed set, naming the whole set when it is
|
|
28
|
-
* not one of them. A schema would report the same rejection as parser output,
|
|
29
|
-
* which is not what a caller reading stderr can act on.
|
|
30
|
-
*/
|
|
31
|
-
export function oneOf(value, allowed, flag) {
|
|
32
|
-
if (allowed.includes(value))
|
|
33
|
-
return value;
|
|
34
|
-
throw new Error(`${flag} must be one of ${allowed.join(", ")}, got "${value}"`);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Tree root the script works on: `--root` verbatim, otherwise the folder named
|
|
38
|
-
* by `skills.settings.filetreeRoot` under `--project` (default: the working
|
|
39
|
-
* directory).
|
|
40
|
-
*/
|
|
41
|
-
export async function resolveRoot(argv) {
|
|
42
|
-
const override = readFlag(argv, "--root");
|
|
43
|
-
if (override !== undefined)
|
|
44
|
-
return resolve(override);
|
|
45
|
-
return resolveFiletreeRoot(resolve(readFlag(argv, "--project") ?? process.cwd()));
|
|
46
|
-
}
|
|
47
|
-
/** Everything piped to the hook on stdin, or `""` when it was run from a terminal. */
|
|
48
|
-
export async function readStdin() {
|
|
49
|
-
return process.stdin.isTTY ? "" : Bun.stdin.text();
|
|
50
|
-
}
|
|
51
|
-
/** The only thing a script writes to stdout. */
|
|
52
|
-
export function printJson(value, argv) {
|
|
53
|
-
console.log(JSON.stringify(value, null, hasFlag(argv, "--pretty") ? 2 : 0));
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Runs a script's `main` and turns anything thrown into a message on stderr and
|
|
57
|
-
* a non-zero exit, so no rejection escapes as a stack trace.
|
|
58
|
-
*/
|
|
59
|
-
export function runHook(main) {
|
|
60
|
-
main().catch((error) => {
|
|
61
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
62
|
-
process.exit(1);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=cli.js.map
|
package/dist/hooks/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/hooks/cli.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAKvD,yEAAyE;AACzE,MAAM,UAAU,QAAQ,CAAC,IAAuB,EAAE,IAAY;IAC5D,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,EAAE,KAAK,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IAEhC,MAAM,KAAK,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IAC3B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,mBAAmB,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,W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D,MAAM,UAAU,SAAS,CAAC,KAAc,EAAE,IAAuB;IAC/D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,IAAyB;IAC/C,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QAC9B,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/hooks/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1G,YAAY,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC"}
|
package/dist/hooks/index.js
DELETED
package/dist/hooks/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "grilling",
|
|
3
|
-
"description": "Relentless interviews that stress-test a plan, plus the domain model they feed.",
|
|
4
|
-
"version": "0.1.0",
|
|
5
|
-
"license": "UNLICENSED",
|
|
6
|
-
"skills": ["./skills/grilling", "./skills/grill-me", "./skills/grill-with-docs", "./skills/domain-modeling"]
|
|
7
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# ADR Format
|
|
2
|
-
|
|
3
|
-
ADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.
|
|
4
|
-
|
|
5
|
-
Create the `docs/adr/` directory lazily — only when the first ADR is needed.
|
|
6
|
-
|
|
7
|
-
## Template
|
|
8
|
-
|
|
9
|
-
```md
|
|
10
|
-
# {Short title of the decision}
|
|
11
|
-
|
|
12
|
-
{1-3 sentences: what's the context, what did we decide, and why.}
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
That's it. An ADR can be a single paragraph. The value is in recording *that* a decision was made and *why* — not in filling out sections.
|
|
16
|
-
|
|
17
|
-
## Optional sections
|
|
18
|
-
|
|
19
|
-
Only include these when they add genuine value. Most ADRs won't need them.
|
|
20
|
-
|
|
21
|
-
- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`) — useful when decisions are revisited
|
|
22
|
-
- **Considered Options** — only when the rejected alternatives are worth remembering
|
|
23
|
-
- **Consequences** — only when non-obvious downstream effects need to be called out
|
|
24
|
-
|
|
25
|
-
## Numbering
|
|
26
|
-
|
|
27
|
-
Scan `docs/adr/` for the highest existing number and increment by one.
|
|
28
|
-
|
|
29
|
-
## When to offer an ADR
|
|
30
|
-
|
|
31
|
-
All three of these must be true:
|
|
32
|
-
|
|
33
|
-
1. **Hard to reverse** — the cost of changing your mind later is meaningful
|
|
34
|
-
2. **Surprising without context** — a future reader will look at the code and wonder "why on earth did they do it this way?"
|
|
35
|
-
3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons
|
|
36
|
-
|
|
37
|
-
If a decision is easy to reverse, skip it — you'll just reverse it. If it's not surprising, nobody will wonder why. If there was no real alternative, there's nothing to record beyond "we did the obvious thing."
|
|
38
|
-
|
|
39
|
-
### What qualifies
|
|
40
|
-
|
|
41
|
-
- **Architectural shape.** "We're using a monorepo." "The write model is event-sourced, the read model is projected into Postgres."
|
|
42
|
-
- **Integration patterns between contexts.** "Ordering and Billing communicate via domain events, not synchronous HTTP."
|
|
43
|
-
- **Technology choices that carry lock-in.** Database, message bus, auth provider, deployment target. Not every library — just the ones that would take a quarter to swap out.
|
|
44
|
-
- **Boundary and scope decisions.** "Customer data is owned by the Customer context; other contexts reference it by ID only." The explicit no-s are as valuable as the yes-s.
|
|
45
|
-
- **Deliberate deviations from the obvious path.** "We're using manual SQL instead of an ORM because X." Anything where a reasonable reader would assume the opposite. These stop the next engineer from "fixing" something that was deliberate.
|
|
46
|
-
- **Constraints not visible in the code.** "We can't use AWS because of compliance requirements." "Response times must be under 200ms because of the partner API contract."
|
|
47
|
-
- **Rejected alternatives when the rejection is non-obvious.** If you considered GraphQL and picked REST for subtle reasons, record it — otherwise someone will suggest GraphQL again in six months.
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# CONTEXT.md Format
|
|
2
|
-
|
|
3
|
-
## Structure
|
|
4
|
-
|
|
5
|
-
```md
|
|
6
|
-
# {Context Name}
|
|
7
|
-
|
|
8
|
-
{One or two sentence description of what this context is and why it exists.}
|
|
9
|
-
|
|
10
|
-
## Language
|
|
11
|
-
|
|
12
|
-
**Order**:
|
|
13
|
-
{A one or two sentence description of the term}
|
|
14
|
-
_Avoid_: Purchase, transaction
|
|
15
|
-
|
|
16
|
-
**Invoice**:
|
|
17
|
-
A request for payment sent to a customer after delivery.
|
|
18
|
-
_Avoid_: Bill, payment request
|
|
19
|
-
|
|
20
|
-
**Customer**:
|
|
21
|
-
A person or organization that places orders.
|
|
22
|
-
_Avoid_: Client, buyer, account
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Rules
|
|
26
|
-
|
|
27
|
-
- **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.
|
|
28
|
-
- **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.
|
|
29
|
-
- **Only include terms specific to this project's context.** General programming concepts (timeouts, error types, utility patterns) don't belong even if the project uses them extensively. Before adding a term, ask: is this a concept unique to this context, or a general programming concept? Only the former belongs.
|
|
30
|
-
- **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.
|
|
31
|
-
|
|
32
|
-
## Single vs multi-context repos
|
|
33
|
-
|
|
34
|
-
**Single context (most repos):** One `CONTEXT.md` at the repo root.
|
|
35
|
-
|
|
36
|
-
**Multiple contexts:** A `CONTEXT-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:
|
|
37
|
-
|
|
38
|
-
```md
|
|
39
|
-
# Context Map
|
|
40
|
-
|
|
41
|
-
## Contexts
|
|
42
|
-
|
|
43
|
-
- [Ordering](./src/ordering/CONTEXT.md) — receives and tracks customer orders
|
|
44
|
-
- [Billing](./src/billing/CONTEXT.md) — generates invoices and processes payments
|
|
45
|
-
- [Fulfillment](./src/fulfillment/CONTEXT.md) — manages warehouse picking and shipping
|
|
46
|
-
|
|
47
|
-
## Relationships
|
|
48
|
-
|
|
49
|
-
- **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking
|
|
50
|
-
- **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices
|
|
51
|
-
- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
The skill infers which structure applies:
|
|
55
|
-
|
|
56
|
-
- If `CONTEXT-MAP.md` exists, read it to find contexts
|
|
57
|
-
- If only a root `CONTEXT.md` exists, single context
|
|
58
|
-
- If neither exists, create a root `CONTEXT.md` lazily when the first term is resolved
|
|
59
|
-
|
|
60
|
-
When multiple contexts exist, infer which one the current topic relates to. If unclear, ask.
|