@kynetic-ai/spec 0.1.2 → 0.3.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/README.md +250 -17
- package/dist/acp/client.d.ts +18 -4
- package/dist/acp/client.d.ts.map +1 -1
- package/dist/acp/client.js +44 -26
- package/dist/acp/client.js.map +1 -1
- package/dist/acp/framing.d.ts +2 -2
- package/dist/acp/framing.d.ts.map +1 -1
- package/dist/acp/framing.js +37 -29
- package/dist/acp/framing.js.map +1 -1
- package/dist/acp/index.d.ts +6 -7
- package/dist/acp/index.d.ts.map +1 -1
- package/dist/acp/index.js +3 -3
- package/dist/acp/index.js.map +1 -1
- package/dist/acp/types.d.ts +5 -5
- package/dist/acp/types.d.ts.map +1 -1
- package/dist/acp/types.js +18 -18
- package/dist/acp/types.js.map +1 -1
- package/dist/agents/adapters.d.ts.map +1 -1
- package/dist/agents/adapters.js +24 -13
- package/dist/agents/adapters.js.map +1 -1
- package/dist/agents/index.d.ts +2 -2
- package/dist/agents/index.js +2 -2
- package/dist/agents/spawner.d.ts +4 -4
- package/dist/agents/spawner.d.ts.map +1 -1
- package/dist/agents/spawner.js +6 -6
- package/dist/agents/spawner.js.map +1 -1
- package/dist/cli/batch-context.d.ts +43 -0
- package/dist/cli/batch-context.d.ts.map +1 -0
- package/dist/cli/batch-context.js +93 -0
- package/dist/cli/batch-context.js.map +1 -0
- package/dist/cli/batch-exec.d.ts +116 -0
- package/dist/cli/batch-exec.d.ts.map +1 -0
- package/dist/cli/batch-exec.js +694 -0
- package/dist/cli/batch-exec.js.map +1 -0
- package/dist/cli/batch.d.ts +4 -2
- package/dist/cli/batch.d.ts.map +1 -1
- package/dist/cli/batch.js +15 -14
- package/dist/cli/batch.js.map +1 -1
- package/dist/cli/command-annotations.d.ts +23 -0
- package/dist/cli/command-annotations.d.ts.map +1 -0
- package/dist/cli/command-annotations.js +27 -0
- package/dist/cli/command-annotations.js.map +1 -0
- package/dist/cli/commands/agents.d.ts +46 -0
- package/dist/cli/commands/agents.d.ts.map +1 -0
- package/dist/cli/commands/agents.js +377 -0
- package/dist/cli/commands/agents.js.map +1 -0
- package/dist/cli/commands/batch.d.ts +20 -0
- package/dist/cli/commands/batch.d.ts.map +1 -0
- package/dist/cli/commands/batch.js +214 -0
- package/dist/cli/commands/batch.js.map +1 -0
- package/dist/cli/commands/clone-for-testing.d.ts +1 -1
- package/dist/cli/commands/clone-for-testing.d.ts.map +1 -1
- package/dist/cli/commands/clone-for-testing.js +37 -47
- package/dist/cli/commands/clone-for-testing.js.map +1 -1
- package/dist/cli/commands/derive.d.ts +1 -1
- package/dist/cli/commands/derive.d.ts.map +1 -1
- package/dist/cli/commands/derive.js +140 -88
- package/dist/cli/commands/derive.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts +11 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +152 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/export.d.ts +12 -0
- package/dist/cli/commands/export.d.ts.map +1 -0
- package/dist/cli/commands/export.js +134 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/commands/help.d.ts +1 -1
- package/dist/cli/commands/help.d.ts.map +1 -1
- package/dist/cli/commands/help.js +163 -37
- package/dist/cli/commands/help.js.map +1 -1
- package/dist/cli/commands/inbox.d.ts +1 -1
- package/dist/cli/commands/inbox.d.ts.map +1 -1
- package/dist/cli/commands/inbox.js +178 -56
- package/dist/cli/commands/inbox.js.map +1 -1
- package/dist/cli/commands/index.d.ts +31 -19
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +31 -19
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/init.d.ts +5 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +108 -57
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/item.d.ts +1 -1
- package/dist/cli/commands/item.d.ts.map +1 -1
- package/dist/cli/commands/item.js +557 -274
- package/dist/cli/commands/item.js.map +1 -1
- package/dist/cli/commands/link.d.ts +1 -1
- package/dist/cli/commands/link.d.ts.map +1 -1
- package/dist/cli/commands/link.js +55 -46
- package/dist/cli/commands/link.js.map +1 -1
- package/dist/cli/commands/log.d.ts +1 -1
- package/dist/cli/commands/log.d.ts.map +1 -1
- package/dist/cli/commands/log.js +57 -51
- package/dist/cli/commands/log.js.map +1 -1
- package/dist/cli/commands/merge-driver.d.ts +19 -0
- package/dist/cli/commands/merge-driver.d.ts.map +1 -0
- package/dist/cli/commands/merge-driver.js +398 -0
- package/dist/cli/commands/merge-driver.js.map +1 -0
- package/dist/cli/commands/meta.d.ts +1 -1
- package/dist/cli/commands/meta.d.ts.map +1 -1
- package/dist/cli/commands/meta.js +533 -399
- package/dist/cli/commands/meta.js.map +1 -1
- package/dist/cli/commands/module.d.ts +1 -1
- package/dist/cli/commands/module.d.ts.map +1 -1
- package/dist/cli/commands/module.js +30 -25
- package/dist/cli/commands/module.js.map +1 -1
- package/dist/cli/commands/plan-import.d.ts +11 -0
- package/dist/cli/commands/plan-import.d.ts.map +1 -0
- package/dist/cli/commands/plan-import.js +516 -0
- package/dist/cli/commands/plan-import.js.map +1 -0
- package/dist/cli/commands/plan.d.ts +10 -0
- package/dist/cli/commands/plan.d.ts.map +1 -0
- package/dist/cli/commands/plan.js +421 -0
- package/dist/cli/commands/plan.js.map +1 -0
- package/dist/cli/commands/ralph.d.ts +1 -1
- package/dist/cli/commands/ralph.d.ts.map +1 -1
- package/dist/cli/commands/ralph.js +1097 -169
- package/dist/cli/commands/ralph.js.map +1 -1
- package/dist/cli/commands/refs.d.ts +13 -0
- package/dist/cli/commands/refs.d.ts.map +1 -0
- package/dist/cli/commands/refs.js +283 -0
- package/dist/cli/commands/refs.js.map +1 -0
- package/dist/cli/commands/search.d.ts +1 -1
- package/dist/cli/commands/search.d.ts.map +1 -1
- package/dist/cli/commands/search.js +199 -37
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/serve.d.ts +10 -0
- package/dist/cli/commands/serve.d.ts.map +1 -0
- package/dist/cli/commands/serve.js +491 -0
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/session.d.ts +25 -6
- package/dist/cli/commands/session.d.ts.map +1 -1
- package/dist/cli/commands/session.js +811 -127
- package/dist/cli/commands/session.js.map +1 -1
- package/dist/cli/commands/setup-seeding.d.ts +81 -0
- package/dist/cli/commands/setup-seeding.d.ts.map +1 -0
- package/dist/cli/commands/setup-seeding.js +292 -0
- package/dist/cli/commands/setup-seeding.js.map +1 -0
- package/dist/cli/commands/setup.d.ts +77 -3
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +1233 -274
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/commands/shadow.d.ts +1 -1
- package/dist/cli/commands/shadow.d.ts.map +1 -1
- package/dist/cli/commands/shadow.js +70 -50
- package/dist/cli/commands/shadow.js.map +1 -1
- package/dist/cli/commands/skill-crud.d.ts +58 -0
- package/dist/cli/commands/skill-crud.d.ts.map +1 -0
- package/dist/cli/commands/skill-crud.js +753 -0
- package/dist/cli/commands/skill-crud.js.map +1 -0
- package/dist/cli/commands/skill-diff.d.ts +27 -0
- package/dist/cli/commands/skill-diff.d.ts.map +1 -0
- package/dist/cli/commands/skill-diff.js +840 -0
- package/dist/cli/commands/skill-diff.js.map +1 -0
- package/dist/cli/commands/skill-install.d.ts +53 -0
- package/dist/cli/commands/skill-install.d.ts.map +1 -0
- package/dist/cli/commands/skill-install.js +452 -0
- package/dist/cli/commands/skill-install.js.map +1 -0
- package/dist/cli/commands/skill.d.ts +20 -0
- package/dist/cli/commands/skill.d.ts.map +1 -0
- package/dist/cli/commands/skill.js +36 -0
- package/dist/cli/commands/skill.js.map +1 -0
- package/dist/cli/commands/task.d.ts +1 -1
- package/dist/cli/commands/task.d.ts.map +1 -1
- package/dist/cli/commands/task.js +569 -346
- package/dist/cli/commands/task.js.map +1 -1
- package/dist/cli/commands/tasks.d.ts +26 -1
- package/dist/cli/commands/tasks.d.ts.map +1 -1
- package/dist/cli/commands/tasks.js +227 -122
- package/dist/cli/commands/tasks.js.map +1 -1
- package/dist/cli/commands/trait.d.ts +1 -1
- package/dist/cli/commands/trait.d.ts.map +1 -1
- package/dist/cli/commands/trait.js +166 -101
- package/dist/cli/commands/trait.js.map +1 -1
- package/dist/cli/commands/triage.d.ts +7 -0
- package/dist/cli/commands/triage.d.ts.map +1 -0
- package/dist/cli/commands/triage.js +569 -0
- package/dist/cli/commands/triage.js.map +1 -0
- package/dist/cli/commands/util.d.ts +7 -0
- package/dist/cli/commands/util.d.ts.map +1 -0
- package/dist/cli/commands/util.js +30 -0
- package/dist/cli/commands/util.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +1 -1
- package/dist/cli/commands/validate.d.ts.map +1 -1
- package/dist/cli/commands/validate.js +264 -83
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/commands/workflow.d.ts +16 -0
- package/dist/cli/commands/workflow.d.ts.map +1 -0
- package/dist/cli/commands/workflow.js +851 -0
- package/dist/cli/commands/workflow.js.map +1 -0
- package/dist/cli/exit-codes.d.ts +7 -0
- package/dist/cli/exit-codes.d.ts.map +1 -1
- package/dist/cli/exit-codes.js +26 -18
- package/dist/cli/exit-codes.js.map +1 -1
- package/dist/cli/help/content.d.ts.map +1 -1
- package/dist/cli/help/content.js +86 -71
- package/dist/cli/help/content.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +131 -19
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/introspection.d.ts +6 -2
- package/dist/cli/introspection.d.ts.map +1 -1
- package/dist/cli/introspection.js +11 -8
- package/dist/cli/introspection.js.map +1 -1
- package/dist/cli/output.d.ts +64 -4
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +235 -85
- package/dist/cli/output.js.map +1 -1
- package/dist/cli/parse-utils.d.ts +21 -0
- package/dist/cli/parse-utils.d.ts.map +1 -0
- package/dist/cli/parse-utils.js +32 -0
- package/dist/cli/parse-utils.js.map +1 -0
- package/dist/cli/pid-utils.d.ts +72 -0
- package/dist/cli/pid-utils.d.ts.map +1 -0
- package/dist/cli/pid-utils.js +174 -0
- package/dist/cli/pid-utils.js.map +1 -0
- package/dist/cli/suggest.d.ts.map +1 -1
- package/dist/cli/suggest.js +1 -2
- package/dist/cli/suggest.js.map +1 -1
- package/dist/cli/validators.d.ts +43 -0
- package/dist/cli/validators.d.ts.map +1 -0
- package/dist/cli/validators.js +84 -0
- package/dist/cli/validators.js.map +1 -0
- package/dist/daemon/index.ts +52 -0
- package/dist/daemon/middleware/project-context.ts +126 -0
- package/dist/daemon/pid.ts +179 -0
- package/dist/daemon/project-context.ts +343 -0
- package/dist/daemon/routes/inbox.ts +164 -0
- package/dist/daemon/routes/items.ts +322 -0
- package/dist/daemon/routes/meta.ts +118 -0
- package/dist/daemon/routes/projects.ts +162 -0
- package/dist/daemon/routes/tasks.ts +327 -0
- package/dist/daemon/routes/triage.ts +468 -0
- package/dist/daemon/routes/validation.ts +248 -0
- package/dist/daemon/server.ts +408 -0
- package/dist/daemon/watcher.ts +195 -0
- package/dist/daemon/websocket/handler.ts +138 -0
- package/dist/daemon/websocket/heartbeat.ts +71 -0
- package/dist/daemon/websocket/pubsub.ts +125 -0
- package/dist/daemon/websocket/types.ts +66 -0
- package/dist/export/html.d.ts +19 -0
- package/dist/export/html.d.ts.map +1 -0
- package/dist/export/html.js +239 -0
- package/dist/export/html.js.map +1 -0
- package/dist/export/index.d.ts +10 -0
- package/dist/export/index.d.ts.map +1 -0
- package/dist/export/index.js +10 -0
- package/dist/export/index.js.map +1 -0
- package/dist/export/json.d.ts +24 -0
- package/dist/export/json.d.ts.map +1 -0
- package/dist/export/json.js +198 -0
- package/dist/export/json.js.map +1 -0
- package/dist/export/triage.d.ts +51 -0
- package/dist/export/triage.d.ts.map +1 -0
- package/dist/export/triage.js +83 -0
- package/dist/export/triage.js.map +1 -0
- package/dist/export/types.d.ts +122 -0
- package/dist/export/types.d.ts.map +1 -0
- package/dist/export/types.js +9 -0
- package/dist/export/types.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/lib/claude-plugin-registry.d.ts +66 -0
- package/dist/lib/claude-plugin-registry.d.ts.map +1 -0
- package/dist/lib/claude-plugin-registry.js +318 -0
- package/dist/lib/claude-plugin-registry.js.map +1 -0
- package/dist/merge/arrays.d.ts +87 -0
- package/dist/merge/arrays.d.ts.map +1 -0
- package/dist/merge/arrays.js +164 -0
- package/dist/merge/arrays.js.map +1 -0
- package/dist/merge/file-type.d.ts +32 -0
- package/dist/merge/file-type.d.ts.map +1 -0
- package/dist/merge/file-type.js +70 -0
- package/dist/merge/file-type.js.map +1 -0
- package/dist/merge/index.d.ts +14 -0
- package/dist/merge/index.d.ts.map +1 -0
- package/dist/merge/index.js +11 -0
- package/dist/merge/index.js.map +1 -0
- package/dist/merge/objects.d.ts +46 -0
- package/dist/merge/objects.d.ts.map +1 -0
- package/dist/merge/objects.js +193 -0
- package/dist/merge/objects.js.map +1 -0
- package/dist/merge/parse.d.ts +23 -0
- package/dist/merge/parse.d.ts.map +1 -0
- package/dist/merge/parse.js +78 -0
- package/dist/merge/parse.js.map +1 -0
- package/dist/merge/resolve.d.ts +66 -0
- package/dist/merge/resolve.d.ts.map +1 -0
- package/dist/merge/resolve.js +189 -0
- package/dist/merge/resolve.js.map +1 -0
- package/dist/merge/types.d.ts +82 -0
- package/dist/merge/types.d.ts.map +1 -0
- package/dist/merge/types.js +8 -0
- package/dist/merge/types.js.map +1 -0
- package/dist/parser/agent-data-sections.d.ts +53 -0
- package/dist/parser/agent-data-sections.d.ts.map +1 -0
- package/dist/parser/agent-data-sections.js +118 -0
- package/dist/parser/agent-data-sections.js.map +1 -0
- package/dist/parser/alignment.d.ts +4 -4
- package/dist/parser/alignment.d.ts.map +1 -1
- package/dist/parser/alignment.js +27 -22
- package/dist/parser/alignment.js.map +1 -1
- package/dist/parser/assess.d.ts +5 -5
- package/dist/parser/assess.d.ts.map +1 -1
- package/dist/parser/assess.js +36 -32
- package/dist/parser/assess.js.map +1 -1
- package/dist/parser/config.d.ts +351 -0
- package/dist/parser/config.d.ts.map +1 -0
- package/dist/parser/config.js +326 -0
- package/dist/parser/config.js.map +1 -0
- package/dist/parser/convention-validation.d.ts +1 -1
- package/dist/parser/convention-validation.d.ts.map +1 -1
- package/dist/parser/convention-validation.js +21 -16
- package/dist/parser/convention-validation.js.map +1 -1
- package/dist/parser/coverage-cache.d.ts +49 -0
- package/dist/parser/coverage-cache.d.ts.map +1 -0
- package/dist/parser/coverage-cache.js +123 -0
- package/dist/parser/coverage-cache.js.map +1 -0
- package/dist/parser/daemon-status.d.ts +37 -0
- package/dist/parser/daemon-status.d.ts.map +1 -0
- package/dist/parser/daemon-status.js +67 -0
- package/dist/parser/daemon-status.js.map +1 -0
- package/dist/parser/doctor.d.ts +107 -0
- package/dist/parser/doctor.d.ts.map +1 -0
- package/dist/parser/doctor.js +366 -0
- package/dist/parser/doctor.js.map +1 -0
- package/dist/parser/fix.d.ts +1 -1
- package/dist/parser/fix.d.ts.map +1 -1
- package/dist/parser/fix.js +31 -27
- package/dist/parser/fix.js.map +1 -1
- package/dist/parser/index.d.ts +16 -11
- package/dist/parser/index.d.ts.map +1 -1
- package/dist/parser/index.js +16 -11
- package/dist/parser/index.js.map +1 -1
- package/dist/parser/items.d.ts +8 -2
- package/dist/parser/items.d.ts.map +1 -1
- package/dist/parser/items.js +71 -35
- package/dist/parser/items.js.map +1 -1
- package/dist/parser/meta.d.ts +167 -9
- package/dist/parser/meta.d.ts.map +1 -1
- package/dist/parser/meta.js +379 -46
- package/dist/parser/meta.js.map +1 -1
- package/dist/parser/plan-document.d.ts +189 -0
- package/dist/parser/plan-document.d.ts.map +1 -0
- package/dist/parser/plan-document.js +340 -0
- package/dist/parser/plan-document.js.map +1 -0
- package/dist/parser/plans.d.ts +59 -0
- package/dist/parser/plans.d.ts.map +1 -0
- package/dist/parser/plans.js +239 -0
- package/dist/parser/plans.js.map +1 -0
- package/dist/parser/refs.d.ts +22 -9
- package/dist/parser/refs.d.ts.map +1 -1
- package/dist/parser/refs.js +102 -50
- package/dist/parser/refs.js.map +1 -1
- package/dist/parser/setup-status.d.ts +71 -0
- package/dist/parser/setup-status.d.ts.map +1 -0
- package/dist/parser/setup-status.js +269 -0
- package/dist/parser/setup-status.js.map +1 -0
- package/dist/parser/shadow.d.ts +150 -19
- package/dist/parser/shadow.d.ts.map +1 -1
- package/dist/parser/shadow.js +548 -187
- package/dist/parser/shadow.js.map +1 -1
- package/dist/parser/skill-render.d.ts +317 -0
- package/dist/parser/skill-render.d.ts.map +1 -0
- package/dist/parser/skill-render.js +943 -0
- package/dist/parser/skill-render.js.map +1 -0
- package/dist/parser/traits.d.ts +3 -3
- package/dist/parser/traits.d.ts.map +1 -1
- package/dist/parser/traits.js +2 -2
- package/dist/parser/traits.js.map +1 -1
- package/dist/parser/validate-skills.d.ts +32 -0
- package/dist/parser/validate-skills.d.ts.map +1 -0
- package/dist/parser/validate-skills.js +202 -0
- package/dist/parser/validate-skills.js.map +1 -0
- package/dist/parser/validate.d.ts +45 -3
- package/dist/parser/validate.d.ts.map +1 -1
- package/dist/parser/validate.js +622 -105
- package/dist/parser/validate.js.map +1 -1
- package/dist/parser/yaml.d.ts +83 -19
- package/dist/parser/yaml.d.ts.map +1 -1
- package/dist/parser/yaml.js +478 -173
- package/dist/parser/yaml.js.map +1 -1
- package/dist/ralph/cli-renderer.d.ts +8 -1
- package/dist/ralph/cli-renderer.d.ts.map +1 -1
- package/dist/ralph/cli-renderer.js +105 -34
- package/dist/ralph/cli-renderer.js.map +1 -1
- package/dist/ralph/events.d.ts +10 -10
- package/dist/ralph/events.d.ts.map +1 -1
- package/dist/ralph/events.js +277 -98
- package/dist/ralph/events.js.map +1 -1
- package/dist/ralph/index.d.ts +5 -2
- package/dist/ralph/index.d.ts.map +1 -1
- package/dist/ralph/index.js +9 -3
- package/dist/ralph/index.js.map +1 -1
- package/dist/ralph/loop-errors.d.ts +83 -0
- package/dist/ralph/loop-errors.d.ts.map +1 -0
- package/dist/ralph/loop-errors.js +150 -0
- package/dist/ralph/loop-errors.js.map +1 -0
- package/dist/ralph/subagent.d.ts +83 -0
- package/dist/ralph/subagent.d.ts.map +1 -0
- package/dist/ralph/subagent.js +174 -0
- package/dist/ralph/subagent.js.map +1 -0
- package/dist/ralph/wrap-up.d.ts +125 -0
- package/dist/ralph/wrap-up.d.ts.map +1 -0
- package/dist/ralph/wrap-up.js +270 -0
- package/dist/ralph/wrap-up.js.map +1 -0
- package/dist/schema/batch.d.ts +95 -0
- package/dist/schema/batch.d.ts.map +1 -0
- package/dist/schema/batch.js +24 -0
- package/dist/schema/batch.js.map +1 -0
- package/dist/schema/common.d.ts +2 -2
- package/dist/schema/common.d.ts.map +1 -1
- package/dist/schema/common.js +34 -31
- package/dist/schema/common.js.map +1 -1
- package/dist/schema/inbox.d.ts +12 -12
- package/dist/schema/inbox.js +4 -4
- package/dist/schema/inbox.js.map +1 -1
- package/dist/schema/index.d.ts +8 -5
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +8 -5
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/meta.d.ts +1454 -27
- package/dist/schema/meta.d.ts.map +1 -1
- package/dist/schema/meta.js +198 -21
- package/dist/schema/meta.js.map +1 -1
- package/dist/schema/plan.d.ts +285 -0
- package/dist/schema/plan.d.ts.map +1 -0
- package/dist/schema/plan.js +81 -0
- package/dist/schema/plan.js.map +1 -0
- package/dist/schema/spec.d.ts +72 -33
- package/dist/schema/spec.d.ts.map +1 -1
- package/dist/schema/spec.js +22 -9
- package/dist/schema/spec.js.map +1 -1
- package/dist/schema/task.d.ts +172 -161
- package/dist/schema/task.d.ts.map +1 -1
- package/dist/schema/task.js +21 -12
- package/dist/schema/task.js.map +1 -1
- package/dist/schema/triage.d.ts +266 -0
- package/dist/schema/triage.d.ts.map +1 -0
- package/dist/schema/triage.js +134 -0
- package/dist/schema/triage.js.map +1 -0
- package/dist/sessions/index.d.ts +2 -2
- package/dist/sessions/index.d.ts.map +1 -1
- package/dist/sessions/index.js +3 -3
- package/dist/sessions/index.js.map +1 -1
- package/dist/sessions/store.d.ts +233 -1
- package/dist/sessions/store.d.ts.map +1 -1
- package/dist/sessions/store.js +628 -31
- package/dist/sessions/store.js.map +1 -1
- package/dist/sessions/types.d.ts +10 -10
- package/dist/sessions/types.d.ts.map +1 -1
- package/dist/sessions/types.js +10 -9
- package/dist/sessions/types.js.map +1 -1
- package/dist/strings/errors.d.ts +51 -0
- package/dist/strings/errors.d.ts.map +1 -1
- package/dist/strings/errors.js +136 -106
- package/dist/strings/errors.js.map +1 -1
- package/dist/strings/guidance.d.ts.map +1 -1
- package/dist/strings/guidance.js +16 -16
- package/dist/strings/guidance.js.map +1 -1
- package/dist/strings/index.d.ts +4 -4
- package/dist/strings/index.d.ts.map +1 -1
- package/dist/strings/index.js +4 -4
- package/dist/strings/index.js.map +1 -1
- package/dist/strings/labels.d.ts +4 -0
- package/dist/strings/labels.d.ts.map +1 -1
- package/dist/strings/labels.js +45 -41
- package/dist/strings/labels.js.map +1 -1
- package/dist/strings/validation.d.ts.map +1 -1
- package/dist/strings/validation.js +71 -71
- package/dist/strings/validation.js.map +1 -1
- package/dist/utils/commit.d.ts +1 -1
- package/dist/utils/commit.d.ts.map +1 -1
- package/dist/utils/commit.js +28 -26
- package/dist/utils/commit.js.map +1 -1
- package/dist/utils/git.d.ts +1 -1
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +40 -38
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/grep.js +11 -11
- package/dist/utils/grep.js.map +1 -1
- package/dist/utils/index.d.ts +7 -7
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +4 -4
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/time.d.ts.map +1 -1
- package/dist/utils/time.js +10 -10
- package/dist/utils/time.js.map +1 -1
- package/package.json +28 -5
- package/plugin/.claude-plugin/marketplace.json +17 -0
- package/plugin/.claude-plugin/plugin.json +5 -0
- package/plugin/plugins/kspec/skills/help/SKILL.md +42 -0
- package/plugin/plugins/kspec/skills/triage/SKILL.md +206 -0
- package/plugin/plugins/kspec/skills/triage/docs/automation.md +120 -0
- package/plugin/plugins/kspec/skills/triage/docs/inbox.md +144 -0
- package/plugin/plugins/kspec/skills/triage/docs/observations.md +85 -0
- package/templates/agents-sections/01-quick-start.md +22 -0
- package/templates/agents-sections/02-shadow-branch.md +34 -0
- package/templates/agents-sections/03-task-lifecycle.md +48 -0
- package/templates/agents-sections/04-pr-workflow.md +17 -0
- package/templates/agents-sections/05-commit-convention.md +27 -0
- package/templates/agents-sections/06-ralph-loop.md +45 -0
- package/templates/hooks/pre-commit +34 -0
- package/templates/skills/help/SKILL.md +37 -0
- package/templates/skills/manifest.yaml +15 -0
- package/templates/skills/triage/SKILL.md +199 -0
- package/templates/skills/triage/docs/automation.md +120 -0
- package/templates/skills/triage/docs/inbox.md +144 -0
- package/templates/skills/triage/docs/observations.md +85 -0
package/dist/parser/meta.js
CHANGED
|
@@ -7,34 +7,80 @@
|
|
|
7
7
|
* - Conventions: project rules and standards
|
|
8
8
|
* - Observations: feedback about processes
|
|
9
9
|
*/
|
|
10
|
-
import * as fs from
|
|
11
|
-
import * as path from
|
|
12
|
-
import { ulid } from
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
10
|
+
import * as fs from "node:fs/promises";
|
|
11
|
+
import * as path from "node:path";
|
|
12
|
+
import { ulid } from "ulid";
|
|
13
|
+
import { AgentSchema, ConventionSchema, getMetaItemType, isSkill, MetaManifestSchema, ObservationSchema, SessionContextSchema, SkillSchema, WorkflowRunsFileSchema, WorkflowSchema, } from "../schema/index.js";
|
|
14
|
+
import { expandIncludePattern, getAuthor, readYamlFile, writeYamlFilePreserveFormat, } from "./yaml.js";
|
|
15
15
|
/**
|
|
16
|
-
* Find the meta manifest file
|
|
16
|
+
* Find the meta manifest file.
|
|
17
|
+
*
|
|
18
|
+
* Discovery algorithm:
|
|
19
|
+
* 1. Check for explicit name: kynetic.meta.yaml (backward compat)
|
|
20
|
+
* 2. If not found, scan directory for *.meta.yaml files
|
|
21
|
+
* 3. For each candidate, validate it contains a 'kynetic_meta:' version field
|
|
22
|
+
* 4. Return first valid match (alphabetically after explicit name)
|
|
23
|
+
*
|
|
24
|
+
* AC: @meta-manifest-discovery ac-1, ac-2, ac-3
|
|
17
25
|
*/
|
|
18
26
|
export async function findMetaManifest(specDir) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
// AC: @meta-manifest-discovery ac-1, ac-3 - explicit name has priority
|
|
28
|
+
const priorityPath = path.join(specDir, "kynetic.meta.yaml");
|
|
29
|
+
try {
|
|
30
|
+
await fs.access(priorityPath);
|
|
31
|
+
return priorityPath;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// Continue to glob fallback
|
|
35
|
+
}
|
|
36
|
+
// AC: @meta-manifest-discovery ac-2, ac-3 - glob fallback with validation
|
|
37
|
+
try {
|
|
38
|
+
const entries = await fs.readdir(specDir);
|
|
39
|
+
// AC: @meta-manifest-discovery ac-3 - alphabetical order
|
|
40
|
+
const candidates = entries
|
|
41
|
+
.filter((f) => f.endsWith(".meta.yaml"))
|
|
42
|
+
.sort();
|
|
43
|
+
for (const candidate of candidates) {
|
|
44
|
+
const filePath = path.join(specDir, candidate);
|
|
45
|
+
try {
|
|
46
|
+
const raw = await readYamlFile(filePath);
|
|
47
|
+
// AC: @meta-manifest-discovery ac-2 - validate kynetic_meta version field
|
|
48
|
+
if (raw && typeof raw === "object" && "kynetic_meta" in raw) {
|
|
49
|
+
return filePath;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// Skip invalid files
|
|
54
|
+
}
|
|
28
55
|
}
|
|
29
56
|
}
|
|
57
|
+
catch {
|
|
58
|
+
// Directory read failed
|
|
59
|
+
}
|
|
30
60
|
return null;
|
|
31
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Get the base name (slug) from a manifest path.
|
|
64
|
+
* E.g., "kynetic.yaml" -> "kynetic", "myproject.spec.yaml" -> "myproject"
|
|
65
|
+
*/
|
|
66
|
+
function getManifestBaseName(manifestPath) {
|
|
67
|
+
if (!manifestPath)
|
|
68
|
+
return "kynetic";
|
|
69
|
+
const fileName = path.basename(manifestPath);
|
|
70
|
+
// Remove .yaml extension
|
|
71
|
+
let baseName = fileName.replace(/\.yaml$/, "");
|
|
72
|
+
// Remove .spec suffix if present
|
|
73
|
+
baseName = baseName.replace(/\.spec$/, "");
|
|
74
|
+
return baseName || "kynetic";
|
|
75
|
+
}
|
|
32
76
|
/**
|
|
33
77
|
* Get the meta manifest file path.
|
|
78
|
+
* Derives from main manifest name (e.g., myproject.yaml -> myproject.meta.yaml)
|
|
34
79
|
* Returns path even if file doesn't exist yet.
|
|
35
80
|
*/
|
|
36
81
|
export function getMetaManifestPath(ctx) {
|
|
37
|
-
|
|
82
|
+
const baseName = getManifestBaseName(ctx.manifestPath);
|
|
83
|
+
return path.join(ctx.specDir, `${baseName}.meta.yaml`);
|
|
38
84
|
}
|
|
39
85
|
/**
|
|
40
86
|
* Load meta items from a single file.
|
|
@@ -45,10 +91,11 @@ async function loadMetaFile(filePath) {
|
|
|
45
91
|
workflows: [],
|
|
46
92
|
conventions: [],
|
|
47
93
|
observations: [],
|
|
94
|
+
skills: [],
|
|
48
95
|
};
|
|
49
96
|
try {
|
|
50
97
|
const raw = await readYamlFile(filePath);
|
|
51
|
-
if (!raw || typeof raw !==
|
|
98
|
+
if (!raw || typeof raw !== "object") {
|
|
52
99
|
return result;
|
|
53
100
|
}
|
|
54
101
|
const obj = raw;
|
|
@@ -88,6 +135,16 @@ async function loadMetaFile(filePath) {
|
|
|
88
135
|
}
|
|
89
136
|
}
|
|
90
137
|
}
|
|
138
|
+
// Parse skills
|
|
139
|
+
// AC: @skill-meta-type ac-4 - skills loaded with _sourceFile set
|
|
140
|
+
if (Array.isArray(obj.skills)) {
|
|
141
|
+
for (const skill of obj.skills) {
|
|
142
|
+
const parsed = SkillSchema.safeParse(skill);
|
|
143
|
+
if (parsed.success) {
|
|
144
|
+
result.skills.push({ ...parsed.data, _sourceFile: filePath });
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
91
148
|
}
|
|
92
149
|
catch {
|
|
93
150
|
// File doesn't exist or parse error
|
|
@@ -97,6 +154,7 @@ async function loadMetaFile(filePath) {
|
|
|
97
154
|
/**
|
|
98
155
|
* Load the meta context from a kspec context.
|
|
99
156
|
* Loads meta manifest and follows includes.
|
|
157
|
+
* AC: @skill-meta-type ac-4 - MetaContext.skills contains LoadedSkill objects with _sourceFile set
|
|
100
158
|
*/
|
|
101
159
|
export async function loadMetaContext(ctx) {
|
|
102
160
|
const result = {
|
|
@@ -106,6 +164,7 @@ export async function loadMetaContext(ctx) {
|
|
|
106
164
|
workflows: [],
|
|
107
165
|
conventions: [],
|
|
108
166
|
observations: [],
|
|
167
|
+
skills: [],
|
|
109
168
|
};
|
|
110
169
|
const manifestPath = await findMetaManifest(ctx.specDir);
|
|
111
170
|
if (!manifestPath) {
|
|
@@ -122,6 +181,7 @@ export async function loadMetaContext(ctx) {
|
|
|
122
181
|
result.workflows.push(...items.workflows);
|
|
123
182
|
result.conventions.push(...items.conventions);
|
|
124
183
|
result.observations.push(...items.observations);
|
|
184
|
+
result.skills.push(...items.skills);
|
|
125
185
|
return result;
|
|
126
186
|
}
|
|
127
187
|
result.manifest = parsed.data;
|
|
@@ -131,6 +191,7 @@ export async function loadMetaContext(ctx) {
|
|
|
131
191
|
result.workflows.push(...manifestItems.workflows);
|
|
132
192
|
result.conventions.push(...manifestItems.conventions);
|
|
133
193
|
result.observations.push(...manifestItems.observations);
|
|
194
|
+
result.skills.push(...manifestItems.skills);
|
|
134
195
|
// Process includes
|
|
135
196
|
const includes = parsed.data.includes || [];
|
|
136
197
|
const manifestDir = path.dirname(manifestPath);
|
|
@@ -142,6 +203,7 @@ export async function loadMetaContext(ctx) {
|
|
|
142
203
|
result.workflows.push(...items.workflows);
|
|
143
204
|
result.conventions.push(...items.conventions);
|
|
144
205
|
result.observations.push(...items.observations);
|
|
206
|
+
result.skills.push(...items.skills);
|
|
145
207
|
}
|
|
146
208
|
}
|
|
147
209
|
}
|
|
@@ -160,41 +222,68 @@ export function getMetaStats(meta) {
|
|
|
160
222
|
conventions: meta.conventions.length,
|
|
161
223
|
observations: meta.observations.length,
|
|
162
224
|
unresolvedObservations: meta.observations.filter((o) => !o.resolved).length,
|
|
225
|
+
skills: meta.skills.length,
|
|
163
226
|
};
|
|
164
227
|
}
|
|
165
228
|
/**
|
|
166
|
-
*
|
|
229
|
+
* Resolve a meta reference to its item, type, and ULID.
|
|
230
|
+
*
|
|
231
|
+
* This is the unified resolver for meta items that consolidates various
|
|
232
|
+
* ref-to-item resolution patterns. Handles ULID prefixes, full ULIDs,
|
|
233
|
+
* semantic IDs (id field for agents/workflows/skills), and domains (conventions).
|
|
234
|
+
*
|
|
235
|
+
* AC: @skill-meta-type ac-5 - skills returned by semantic id lookup
|
|
236
|
+
* AC: @skill-meta-type ac-6 - skills returned by ULID prefix lookup
|
|
237
|
+
* AC: @skill-meta-integration ac-4 - skills included in resolution
|
|
167
238
|
*/
|
|
168
|
-
export function
|
|
169
|
-
const cleanRef = ref.startsWith(
|
|
239
|
+
export function resolveMetaRef(meta, ref) {
|
|
240
|
+
const cleanRef = ref.startsWith("@") ? ref.slice(1) : ref;
|
|
170
241
|
// Search all item types
|
|
171
242
|
const allItems = [
|
|
172
243
|
...meta.agents,
|
|
173
244
|
...meta.workflows,
|
|
174
245
|
...meta.conventions,
|
|
175
246
|
...meta.observations,
|
|
247
|
+
...meta.skills,
|
|
176
248
|
];
|
|
177
249
|
for (const item of allItems) {
|
|
178
250
|
// Match full ULID
|
|
179
|
-
if (item._ulid === cleanRef)
|
|
180
|
-
return item;
|
|
251
|
+
if (item._ulid === cleanRef) {
|
|
252
|
+
return { item, type: getMetaItemType(item), ulid: item._ulid };
|
|
253
|
+
}
|
|
181
254
|
// Match short ULID (prefix)
|
|
182
|
-
if (item._ulid.toLowerCase().startsWith(cleanRef.toLowerCase()))
|
|
183
|
-
return item;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
255
|
+
if (item._ulid.toLowerCase().startsWith(cleanRef.toLowerCase())) {
|
|
256
|
+
return { item, type: getMetaItemType(item), ulid: item._ulid };
|
|
257
|
+
}
|
|
258
|
+
// Match by id (for agents, workflows, and skills)
|
|
259
|
+
if ("id" in item && item.id === cleanRef) {
|
|
260
|
+
return { item, type: getMetaItemType(item), ulid: item._ulid };
|
|
261
|
+
}
|
|
187
262
|
// Match by domain (for conventions)
|
|
188
|
-
if (
|
|
189
|
-
return item;
|
|
263
|
+
if ("domain" in item && item.domain === cleanRef) {
|
|
264
|
+
return { item, type: getMetaItemType(item), ulid: item._ulid };
|
|
265
|
+
}
|
|
190
266
|
}
|
|
191
|
-
return
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Find a meta item by reference (ULID, short ULID, or id)
|
|
271
|
+
*
|
|
272
|
+
* This is a convenience wrapper around resolveMetaRef that returns just the item.
|
|
273
|
+
* Use resolveMetaRef when you also need the type and ULID.
|
|
274
|
+
*
|
|
275
|
+
* AC: @skill-meta-type ac-5 - skills returned by semantic id lookup
|
|
276
|
+
* AC: @skill-meta-type ac-6 - skills returned by ULID prefix lookup
|
|
277
|
+
*/
|
|
278
|
+
export function findMetaItemByRef(meta, ref) {
|
|
279
|
+
const result = resolveMetaRef(meta, ref);
|
|
280
|
+
return result?.item;
|
|
192
281
|
}
|
|
193
282
|
/**
|
|
194
283
|
* Determine if an item is a meta item type
|
|
195
284
|
*/
|
|
196
285
|
export function isMetaItemType(type) {
|
|
197
|
-
return [
|
|
286
|
+
return ["agent", "workflow", "convention", "observation", "skill"].includes(type);
|
|
198
287
|
}
|
|
199
288
|
// ============================================================
|
|
200
289
|
// META ITEM CRUD
|
|
@@ -222,7 +311,7 @@ export function createObservation(type, content, options = {}) {
|
|
|
222
311
|
content,
|
|
223
312
|
workflow_ref: options.workflow_ref,
|
|
224
313
|
created_at: new Date().toISOString(),
|
|
225
|
-
author: options.author ?? getAuthor(),
|
|
314
|
+
author: options.author ?? getAuthor(options.configAuthor),
|
|
226
315
|
resolved: false,
|
|
227
316
|
resolution: null,
|
|
228
317
|
};
|
|
@@ -237,11 +326,12 @@ export async function saveObservation(ctx, observation) {
|
|
|
237
326
|
await fs.mkdir(dir, { recursive: true });
|
|
238
327
|
// Load existing manifest
|
|
239
328
|
let manifest = {
|
|
240
|
-
kynetic_meta:
|
|
329
|
+
kynetic_meta: "1.0",
|
|
241
330
|
agents: [],
|
|
242
331
|
workflows: [],
|
|
243
332
|
conventions: [],
|
|
244
333
|
observations: [],
|
|
334
|
+
skills: [],
|
|
245
335
|
includes: [],
|
|
246
336
|
};
|
|
247
337
|
try {
|
|
@@ -290,13 +380,142 @@ export async function deleteObservation(ctx, ulid) {
|
|
|
290
380
|
return false;
|
|
291
381
|
}
|
|
292
382
|
}
|
|
293
|
-
|
|
294
|
-
|
|
383
|
+
/**
|
|
384
|
+
* Get the path for skill content file.
|
|
385
|
+
* Skills are stored in .kspec/skills/<id>/SKILL.md
|
|
386
|
+
*/
|
|
387
|
+
export function getSkillContentPath(ctx, skillId) {
|
|
388
|
+
return path.join(ctx.specDir, "skills", skillId, "SKILL.md");
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Load skill content from the SKILL.md file.
|
|
392
|
+
* AC: @skill-meta-type ac-3 - loadSkillContent returns full markdown content
|
|
393
|
+
* AC: @skill-content-model ac-1 - loadSkillContent returns markdown content as a string
|
|
394
|
+
*/
|
|
395
|
+
export async function loadSkillContent(ctx, skill) {
|
|
396
|
+
const contentPath = getSkillContentPath(ctx, skill.id);
|
|
397
|
+
try {
|
|
398
|
+
const content = await fs.readFile(contentPath, "utf-8");
|
|
399
|
+
return content;
|
|
400
|
+
}
|
|
401
|
+
catch {
|
|
402
|
+
return null;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Get the docs directory path for a skill.
|
|
407
|
+
* Skills can have supporting docs at .kspec/skills/<id>/docs/
|
|
408
|
+
*/
|
|
409
|
+
export function getSkillDocsPath(ctx, skillId) {
|
|
410
|
+
return path.join(ctx.specDir, "skills", skillId, "docs");
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Load skill documentation files from the docs/ subdirectory.
|
|
414
|
+
* AC: @skill-content-model ac-2 - loadSkillDocs returns array of doc objects
|
|
415
|
+
*/
|
|
416
|
+
export async function loadSkillDocs(ctx, skill) {
|
|
417
|
+
const docsPath = getSkillDocsPath(ctx, skill.id);
|
|
418
|
+
const docs = [];
|
|
419
|
+
try {
|
|
420
|
+
const entries = await fs.readdir(docsPath, { withFileTypes: true });
|
|
421
|
+
for (const entry of entries) {
|
|
422
|
+
if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
423
|
+
const filePath = path.join(docsPath, entry.name);
|
|
424
|
+
try {
|
|
425
|
+
const content = await fs.readFile(filePath, "utf-8");
|
|
426
|
+
docs.push({
|
|
427
|
+
name: entry.name,
|
|
428
|
+
path: filePath,
|
|
429
|
+
content,
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
catch {
|
|
433
|
+
// Skip files that can't be read
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
catch {
|
|
439
|
+
// docs directory doesn't exist or can't be read
|
|
440
|
+
}
|
|
441
|
+
return docs;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Get the path to a supporting directory for a skill.
|
|
445
|
+
* AC: @supporting-files-convention ac-1
|
|
446
|
+
*/
|
|
447
|
+
export function getSkillSupportingDirPath(ctx, skillId, dirType) {
|
|
448
|
+
return path.join(ctx.specDir, "skills", skillId, dirType);
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Load files from a skill's supporting directory.
|
|
452
|
+
* AC: @supporting-files-convention ac-1 - references files are accessible
|
|
453
|
+
*
|
|
454
|
+
* @param ctx - Kspec context
|
|
455
|
+
* @param skill - The skill to load files from
|
|
456
|
+
* @param dirType - The supporting directory type (references, scripts, assets, docs)
|
|
457
|
+
* @returns Array of files found in the directory
|
|
458
|
+
*/
|
|
459
|
+
export async function loadSkillSupportingFiles(ctx, skill, dirType) {
|
|
460
|
+
const dirPath = getSkillSupportingDirPath(ctx, skill.id, dirType);
|
|
461
|
+
const files = [];
|
|
462
|
+
try {
|
|
463
|
+
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
464
|
+
for (const entry of entries) {
|
|
465
|
+
if (entry.isFile()) {
|
|
466
|
+
const filePath = path.join(dirPath, entry.name);
|
|
467
|
+
try {
|
|
468
|
+
const content = await fs.readFile(filePath, "utf-8");
|
|
469
|
+
files.push({
|
|
470
|
+
name: entry.name,
|
|
471
|
+
path: filePath,
|
|
472
|
+
content,
|
|
473
|
+
dirType,
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
catch {
|
|
477
|
+
// Skip files that can't be read (e.g., binary files)
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
catch {
|
|
483
|
+
// Directory doesn't exist or can't be read - return empty array
|
|
484
|
+
}
|
|
485
|
+
return files;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* List which supporting directories exist for a skill.
|
|
489
|
+
* AC: @supporting-files-convention ac-1
|
|
490
|
+
*
|
|
491
|
+
* @returns Array of directory types that exist for the skill
|
|
492
|
+
*/
|
|
493
|
+
export async function listSkillSupportingDirs(ctx, skillId) {
|
|
494
|
+
const dirs = [];
|
|
495
|
+
const allDirs = ["references", "scripts", "assets", "docs"];
|
|
496
|
+
for (const dirType of allDirs) {
|
|
497
|
+
const dirPath = getSkillSupportingDirPath(ctx, skillId, dirType);
|
|
498
|
+
try {
|
|
499
|
+
const stat = await fs.stat(dirPath);
|
|
500
|
+
if (stat.isDirectory()) {
|
|
501
|
+
dirs.push(dirType);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
catch {
|
|
505
|
+
// Directory doesn't exist
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
return dirs;
|
|
509
|
+
}
|
|
510
|
+
// Re-export the getMetaItemType and isSkill functions
|
|
511
|
+
export { getMetaItemType, isSkill };
|
|
295
512
|
// ============================================================
|
|
296
513
|
// GENERIC META ITEM CRUD
|
|
297
514
|
// ============================================================
|
|
298
515
|
/**
|
|
299
|
-
* Save any meta item (agent, workflow, convention) to the manifest
|
|
516
|
+
* Save any meta item (agent, workflow, convention, skill) to the manifest
|
|
517
|
+
* AC: @skill-parser ac-1 - skill is appended to manifest.skills and written to disk
|
|
518
|
+
* AC: @skill-parser ac-2 - .kspec/skills/<id>/ directory is created for skills
|
|
300
519
|
*/
|
|
301
520
|
export async function saveMetaItem(ctx, item, itemType) {
|
|
302
521
|
const manifestPath = getMetaManifestPath(ctx);
|
|
@@ -305,11 +524,12 @@ export async function saveMetaItem(ctx, item, itemType) {
|
|
|
305
524
|
await fs.mkdir(dir, { recursive: true });
|
|
306
525
|
// Load existing manifest
|
|
307
526
|
let manifest = {
|
|
308
|
-
kynetic_meta:
|
|
527
|
+
kynetic_meta: "1.0",
|
|
309
528
|
agents: [],
|
|
310
529
|
workflows: [],
|
|
311
530
|
conventions: [],
|
|
312
531
|
observations: [],
|
|
532
|
+
skills: [],
|
|
313
533
|
includes: [],
|
|
314
534
|
};
|
|
315
535
|
try {
|
|
@@ -327,12 +547,14 @@ export async function saveMetaItem(ctx, item, itemType) {
|
|
|
327
547
|
// Get the appropriate array
|
|
328
548
|
const getArray = () => {
|
|
329
549
|
switch (itemType) {
|
|
330
|
-
case
|
|
550
|
+
case "agent":
|
|
331
551
|
return manifest.agents;
|
|
332
|
-
case
|
|
552
|
+
case "workflow":
|
|
333
553
|
return manifest.workflows;
|
|
334
|
-
case
|
|
554
|
+
case "convention":
|
|
335
555
|
return manifest.conventions;
|
|
556
|
+
case "skill":
|
|
557
|
+
return manifest.skills;
|
|
336
558
|
}
|
|
337
559
|
};
|
|
338
560
|
const array = getArray();
|
|
@@ -345,9 +567,16 @@ export async function saveMetaItem(ctx, item, itemType) {
|
|
|
345
567
|
array.push(cleanItem);
|
|
346
568
|
}
|
|
347
569
|
await saveMetaManifest(manifestPath, manifest);
|
|
570
|
+
// AC: @skill-parser ac-2 - Create skill content directory
|
|
571
|
+
if (itemType === "skill" && "id" in item) {
|
|
572
|
+
const skillDir = path.join(ctx.specDir, "skills", item.id);
|
|
573
|
+
await fs.mkdir(skillDir, { recursive: true });
|
|
574
|
+
}
|
|
348
575
|
}
|
|
349
576
|
/**
|
|
350
577
|
* Delete any meta item from the manifest
|
|
578
|
+
* AC: @skill-parser ac-3 - skill is removed from manifest.skills
|
|
579
|
+
* AC: @skill-parser ac-4 - .kspec/skills/<id>/ directory is deleted for skills
|
|
351
580
|
*/
|
|
352
581
|
export async function deleteMetaItem(ctx, itemUlid, itemType) {
|
|
353
582
|
const manifestPath = getMetaManifestPath(ctx);
|
|
@@ -360,14 +589,16 @@ export async function deleteMetaItem(ctx, itemUlid, itemType) {
|
|
|
360
589
|
const manifest = parsed.data;
|
|
361
590
|
const getArray = () => {
|
|
362
591
|
switch (itemType) {
|
|
363
|
-
case
|
|
592
|
+
case "agent":
|
|
364
593
|
return manifest.agents;
|
|
365
|
-
case
|
|
594
|
+
case "workflow":
|
|
366
595
|
return manifest.workflows;
|
|
367
|
-
case
|
|
596
|
+
case "convention":
|
|
368
597
|
return manifest.conventions;
|
|
369
|
-
case
|
|
598
|
+
case "observation":
|
|
370
599
|
return manifest.observations;
|
|
600
|
+
case "skill":
|
|
601
|
+
return manifest.skills;
|
|
371
602
|
}
|
|
372
603
|
};
|
|
373
604
|
const array = getArray();
|
|
@@ -375,6 +606,19 @@ export async function deleteMetaItem(ctx, itemUlid, itemType) {
|
|
|
375
606
|
if (index < 0) {
|
|
376
607
|
return false;
|
|
377
608
|
}
|
|
609
|
+
// AC: @skill-parser ac-4 - Delete skill directory before removing from manifest
|
|
610
|
+
if (itemType === "skill") {
|
|
611
|
+
const skill = array[index];
|
|
612
|
+
if (skill.id) {
|
|
613
|
+
const skillDir = path.join(ctx.specDir, "skills", skill.id);
|
|
614
|
+
try {
|
|
615
|
+
await fs.rm(skillDir, { recursive: true, force: true });
|
|
616
|
+
}
|
|
617
|
+
catch {
|
|
618
|
+
// Directory might not exist, that's fine
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
378
622
|
array.splice(index, 1);
|
|
379
623
|
await saveMetaManifest(manifestPath, manifest);
|
|
380
624
|
return true;
|
|
@@ -390,7 +634,7 @@ export async function deleteMetaItem(ctx, itemUlid, itemType) {
|
|
|
390
634
|
* Get the session context file path
|
|
391
635
|
*/
|
|
392
636
|
export function getSessionContextPath(ctx) {
|
|
393
|
-
return path.join(ctx.specDir,
|
|
637
|
+
return path.join(ctx.specDir, ".kspec-session");
|
|
394
638
|
}
|
|
395
639
|
/**
|
|
396
640
|
* Load session context (or return empty context if not exists)
|
|
@@ -399,7 +643,7 @@ export async function loadSessionContext(ctx) {
|
|
|
399
643
|
const contextPath = getSessionContextPath(ctx);
|
|
400
644
|
try {
|
|
401
645
|
const raw = await readYamlFile(contextPath);
|
|
402
|
-
if (!raw || typeof raw !==
|
|
646
|
+
if (!raw || typeof raw !== "object") {
|
|
403
647
|
return {
|
|
404
648
|
focus: null,
|
|
405
649
|
threads: [],
|
|
@@ -438,4 +682,93 @@ export async function saveSessionContext(ctx, context) {
|
|
|
438
682
|
context.updated_at = new Date().toISOString();
|
|
439
683
|
await writeYamlFilePreserveFormat(contextPath, context);
|
|
440
684
|
}
|
|
685
|
+
// ============================================================
|
|
686
|
+
// WORKFLOW RUNS
|
|
687
|
+
// ============================================================
|
|
688
|
+
/**
|
|
689
|
+
* Get the workflow runs file path.
|
|
690
|
+
* Derives from main manifest name (e.g., myproject.yaml -> myproject.runs.yaml)
|
|
691
|
+
*/
|
|
692
|
+
export function getWorkflowRunsPath(ctx) {
|
|
693
|
+
const baseName = getManifestBaseName(ctx.manifestPath);
|
|
694
|
+
return path.join(ctx.specDir, `${baseName}.runs.yaml`);
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Load workflow runs from file
|
|
698
|
+
*/
|
|
699
|
+
export async function loadWorkflowRuns(ctx) {
|
|
700
|
+
const runsPath = getWorkflowRunsPath(ctx);
|
|
701
|
+
try {
|
|
702
|
+
const raw = await readYamlFile(runsPath);
|
|
703
|
+
const parsed = WorkflowRunsFileSchema.safeParse(raw);
|
|
704
|
+
if (!parsed.success) {
|
|
705
|
+
return [];
|
|
706
|
+
}
|
|
707
|
+
return parsed.data.runs;
|
|
708
|
+
}
|
|
709
|
+
catch {
|
|
710
|
+
// File doesn't exist
|
|
711
|
+
return [];
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* Save a workflow run (create or update)
|
|
716
|
+
*/
|
|
717
|
+
export async function saveWorkflowRun(ctx, run) {
|
|
718
|
+
const runsPath = getWorkflowRunsPath(ctx);
|
|
719
|
+
// Load existing runs
|
|
720
|
+
const runs = await loadWorkflowRuns(ctx);
|
|
721
|
+
// Update or add
|
|
722
|
+
const existingIndex = runs.findIndex((r) => r._ulid === run._ulid);
|
|
723
|
+
if (existingIndex >= 0) {
|
|
724
|
+
runs[existingIndex] = run;
|
|
725
|
+
}
|
|
726
|
+
else {
|
|
727
|
+
runs.push(run);
|
|
728
|
+
}
|
|
729
|
+
// Save back
|
|
730
|
+
const runsFile = {
|
|
731
|
+
kynetic_runs: "1.0",
|
|
732
|
+
runs,
|
|
733
|
+
};
|
|
734
|
+
await writeYamlFilePreserveFormat(runsPath, runsFile);
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Update an existing workflow run
|
|
738
|
+
*/
|
|
739
|
+
export async function updateWorkflowRun(ctx, run) {
|
|
740
|
+
await saveWorkflowRun(ctx, run);
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Find a workflow run by reference (ULID or ULID prefix)
|
|
744
|
+
*/
|
|
745
|
+
export async function findWorkflowRunByRef(ctx, ref) {
|
|
746
|
+
const runs = await loadWorkflowRuns(ctx);
|
|
747
|
+
const cleanRef = ref.startsWith("@") ? ref.slice(1) : ref;
|
|
748
|
+
return runs.find((r) => r._ulid === cleanRef ||
|
|
749
|
+
r._ulid.toLowerCase().startsWith(cleanRef.toLowerCase()));
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Find active workflow runs
|
|
753
|
+
*/
|
|
754
|
+
export async function findActiveRuns(ctx) {
|
|
755
|
+
const runs = await loadWorkflowRuns(ctx);
|
|
756
|
+
return runs.filter((r) => r.status === "active");
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Delete workflow runs by ULIDs
|
|
760
|
+
* AC: @workflow-prune ac-1, ac-2, ac-3, ac-4
|
|
761
|
+
*/
|
|
762
|
+
export async function deleteWorkflowRuns(ctx, ulidsToDelete) {
|
|
763
|
+
const runsPath = getWorkflowRunsPath(ctx);
|
|
764
|
+
const runs = await loadWorkflowRuns(ctx);
|
|
765
|
+
// Filter out runs to delete
|
|
766
|
+
const remainingRuns = runs.filter((r) => !ulidsToDelete.includes(r._ulid));
|
|
767
|
+
// Save back
|
|
768
|
+
const runsFile = {
|
|
769
|
+
kynetic_runs: "1.0",
|
|
770
|
+
runs: remainingRuns,
|
|
771
|
+
};
|
|
772
|
+
await writeYamlFilePreserveFormat(runsPath, runsFile);
|
|
773
|
+
}
|
|
441
774
|
//# sourceMappingURL=meta.js.map
|