@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
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export Types
|
|
3
|
+
*
|
|
4
|
+
* Types for the kspec export functionality.
|
|
5
|
+
* These define the structure of exported JSON snapshots and related types.
|
|
6
|
+
* AC: @gh-pages-export ac-2, ac-3, ac-4
|
|
7
|
+
*/
|
|
8
|
+
import type { AcceptanceCriterion, Agent, Convention, InboxItem, Observation, SessionContext, Workflow } from "../schema/index.js";
|
|
9
|
+
import type { LoadedSpecItem, LoadedTask } from "../parser/yaml.js";
|
|
10
|
+
/**
|
|
11
|
+
* Exported task with resolved spec reference title.
|
|
12
|
+
* AC: @gh-pages-export ac-3
|
|
13
|
+
*/
|
|
14
|
+
export interface ExportedTask extends LoadedTask {
|
|
15
|
+
/** Resolved title of the linked spec item (for display) */
|
|
16
|
+
spec_ref_title?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Acceptance criterion with inheritance tracking.
|
|
20
|
+
* AC: @gh-pages-export ac-4
|
|
21
|
+
*/
|
|
22
|
+
export interface InheritedAC extends AcceptanceCriterion {
|
|
23
|
+
/** Reference to the trait this AC was inherited from */
|
|
24
|
+
_inherited_from: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Exported spec item with nested hierarchy and inherited ACs.
|
|
28
|
+
* AC: @gh-pages-export ac-4
|
|
29
|
+
*/
|
|
30
|
+
export interface ExportedItem extends Omit<LoadedSpecItem, 'acceptance_criteria'> {
|
|
31
|
+
/** Own acceptance criteria */
|
|
32
|
+
acceptance_criteria?: AcceptanceCriterion[];
|
|
33
|
+
/** Nested child items */
|
|
34
|
+
children?: ExportedItem[];
|
|
35
|
+
/** Acceptance criteria inherited from traits */
|
|
36
|
+
inherited_acs?: InheritedAC[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Project metadata in the snapshot.
|
|
40
|
+
* AC: @gh-pages-export ac-2
|
|
41
|
+
*/
|
|
42
|
+
export interface ExportedProject {
|
|
43
|
+
name: string;
|
|
44
|
+
version?: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Validation result included in the snapshot.
|
|
49
|
+
* AC: @gh-pages-export ac-5
|
|
50
|
+
*/
|
|
51
|
+
export interface ExportedValidation {
|
|
52
|
+
valid: boolean;
|
|
53
|
+
errorCount: number;
|
|
54
|
+
warningCount: number;
|
|
55
|
+
errors: Array<{
|
|
56
|
+
file: string;
|
|
57
|
+
message: string;
|
|
58
|
+
path?: string;
|
|
59
|
+
}>;
|
|
60
|
+
warnings: Array<{
|
|
61
|
+
file: string;
|
|
62
|
+
message: string;
|
|
63
|
+
}>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Full kspec snapshot structure.
|
|
67
|
+
* AC: @gh-pages-export ac-2
|
|
68
|
+
*/
|
|
69
|
+
export interface KspecSnapshot {
|
|
70
|
+
/** kspec version that generated this snapshot */
|
|
71
|
+
version: string;
|
|
72
|
+
/** ISO timestamp when the snapshot was exported */
|
|
73
|
+
exported_at: string;
|
|
74
|
+
/** Project metadata */
|
|
75
|
+
project: ExportedProject;
|
|
76
|
+
/** All tasks with resolved spec references */
|
|
77
|
+
tasks: ExportedTask[];
|
|
78
|
+
/** All spec items with hierarchy and inherited ACs */
|
|
79
|
+
items: ExportedItem[];
|
|
80
|
+
/** Inbox items */
|
|
81
|
+
inbox: InboxItem[];
|
|
82
|
+
/** Session context */
|
|
83
|
+
session: SessionContext | null;
|
|
84
|
+
/** Observations */
|
|
85
|
+
observations: Observation[];
|
|
86
|
+
/** Agents */
|
|
87
|
+
agents: Agent[];
|
|
88
|
+
/** Workflows */
|
|
89
|
+
workflows: Workflow[];
|
|
90
|
+
/** Conventions */
|
|
91
|
+
conventions: Convention[];
|
|
92
|
+
/** Validation results (optional) */
|
|
93
|
+
validation?: ExportedValidation;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Options for the export command.
|
|
97
|
+
*/
|
|
98
|
+
export interface ExportOptions {
|
|
99
|
+
/** Output format */
|
|
100
|
+
format: 'json' | 'html';
|
|
101
|
+
/** Output path (optional, defaults to stdout for json) */
|
|
102
|
+
output?: string;
|
|
103
|
+
/** Include validation results */
|
|
104
|
+
includeValidation?: boolean;
|
|
105
|
+
/** Dry run - show stats without writing */
|
|
106
|
+
dryRun?: boolean;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Statistics shown during dry-run.
|
|
110
|
+
* AC: @gh-pages-export ac-7
|
|
111
|
+
*/
|
|
112
|
+
export interface ExportStats {
|
|
113
|
+
taskCount: number;
|
|
114
|
+
itemCount: number;
|
|
115
|
+
inboxCount: number;
|
|
116
|
+
observationCount: number;
|
|
117
|
+
agentCount: number;
|
|
118
|
+
workflowCount: number;
|
|
119
|
+
conventionCount: number;
|
|
120
|
+
estimatedSizeBytes: number;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/export/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,KAAK,EACL,UAAU,EACV,SAAS,EACT,WAAW,EACX,cAAc,EACd,QAAQ,EACT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpE;;;GAGG;AACH,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,2DAA2D;IAC3D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,mBAAmB;IACtD,wDAAwD;IACxD,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,cAAc,EAAE,qBAAqB,CAAC;IAC/E,8BAA8B;IAC9B,mBAAmB,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAC5C,yBAAyB;IACzB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAC1B,gDAAgD;IAChD,aAAa,CAAC,EAAE,WAAW,EAAE,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAA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B,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/export/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./parser/index.js";
|
|
2
|
+
export * from "./schema/index.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Kynetic Spec - Main library entry point
|
|
2
2
|
// Re-export everything for library consumers
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
3
|
+
export * from "./parser/index.js";
|
|
4
|
+
export * from "./schema/index.js";
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code plugin marketplace registry library.
|
|
3
|
+
*
|
|
4
|
+
* Shared by setup.ts and skill-install.ts for registering the kspec core
|
|
5
|
+
* skills plugin with Claude Code's global state.
|
|
6
|
+
*
|
|
7
|
+
* AC: @core-skill-install ac-6, ac-7, ac-8
|
|
8
|
+
* AC: @enhanced-setup ac-7, ac-8
|
|
9
|
+
*/
|
|
10
|
+
export interface RegisterResult {
|
|
11
|
+
success: boolean;
|
|
12
|
+
action: "registered" | "updated" | "unchanged" | "skipped" | "error";
|
|
13
|
+
message: string;
|
|
14
|
+
registeredPath?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface EnableResult {
|
|
17
|
+
success: boolean;
|
|
18
|
+
action: "enabled" | "unchanged" | "error";
|
|
19
|
+
message: string;
|
|
20
|
+
}
|
|
21
|
+
export type MarketplaceHealthStatus = "healthy" | "missing" | "path-broken" | "version-mismatch" | "error";
|
|
22
|
+
export interface MarketplaceHealth {
|
|
23
|
+
status: MarketplaceHealthStatus;
|
|
24
|
+
registeredPath?: string;
|
|
25
|
+
pluginVersion?: string;
|
|
26
|
+
packageVersion?: string;
|
|
27
|
+
message: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get the Claude Code plugins directory.
|
|
31
|
+
* Respects KSPEC_CLAUDE_HOME env override for test isolation.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getClaudePluginsDir(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Get the absolute path to the pre-built plugin directory in the npm package.
|
|
36
|
+
* Uses fs.realpath for symlink/pnpm stability.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getPackagePluginDir(): Promise<string>;
|
|
39
|
+
/**
|
|
40
|
+
* Register the kspec core plugin marketplace in Claude Code's global state.
|
|
41
|
+
* Writes kspec-plugins entry to known_marketplaces.json.
|
|
42
|
+
* Only updates lastUpdated when path actually changes (idempotent).
|
|
43
|
+
* Validates plugin/.claude-plugin/plugin.json exists before registering.
|
|
44
|
+
*
|
|
45
|
+
* AC: @core-skill-install ac-6, ac-8
|
|
46
|
+
*/
|
|
47
|
+
export declare function registerCorePluginMarketplace(opts?: {
|
|
48
|
+
dryRun?: boolean;
|
|
49
|
+
}): Promise<RegisterResult>;
|
|
50
|
+
/**
|
|
51
|
+
* Enable the kspec plugin in a project's .claude/settings.json.
|
|
52
|
+
* Uses strict JSON read to avoid silently discarding hooks config.
|
|
53
|
+
*
|
|
54
|
+
* AC: @core-skill-install ac-7
|
|
55
|
+
*/
|
|
56
|
+
export declare function enablePluginInProject(projectDir: string, opts?: {
|
|
57
|
+
dryRun?: boolean;
|
|
58
|
+
}): Promise<EnableResult>;
|
|
59
|
+
/**
|
|
60
|
+
* Check the health of the kspec marketplace registration.
|
|
61
|
+
* Returns status and details for setup --status reporting.
|
|
62
|
+
*
|
|
63
|
+
* AC: @enhanced-setup ac-7, ac-8
|
|
64
|
+
*/
|
|
65
|
+
export declare function checkMarketplaceHealth(): Promise<MarketplaceHealth>;
|
|
66
|
+
//# sourceMappingURL=claude-plugin-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-plugin-registry.d.ts","sourceRoot":"","sources":["../../src/lib/claude-plugin-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC;IACrE,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;IAC1C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,uBAAuB,GAC/B,SAAS,GACT,SAAS,GACT,aAAa,GACb,kBAAkB,GAClB,OAAO,CAAC;AAEZ,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,uBAAuB,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB;AAkBD;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAG5C;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,CAW3D;AA6GD;;;;;;;GAOG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1B,OAAO,CAAC,cAAc,CAAC,CAwEzB;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1B,OAAO,CAAC,YAAY,CAAC,CAoDvB;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAmEzE"}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code plugin marketplace registry library.
|
|
3
|
+
*
|
|
4
|
+
* Shared by setup.ts and skill-install.ts for registering the kspec core
|
|
5
|
+
* skills plugin with Claude Code's global state.
|
|
6
|
+
*
|
|
7
|
+
* AC: @core-skill-install ac-6, ac-7, ac-8
|
|
8
|
+
* AC: @enhanced-setup ac-7, ac-8
|
|
9
|
+
*/
|
|
10
|
+
import * as fs from "node:fs/promises";
|
|
11
|
+
import * as path from "node:path";
|
|
12
|
+
import * as os from "node:os";
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Path Resolution
|
|
15
|
+
// ============================================================================
|
|
16
|
+
/**
|
|
17
|
+
* Get the Claude Code plugins directory.
|
|
18
|
+
* Respects KSPEC_CLAUDE_HOME env override for test isolation.
|
|
19
|
+
*/
|
|
20
|
+
export function getClaudePluginsDir() {
|
|
21
|
+
const home = process.env.KSPEC_CLAUDE_HOME || path.join(os.homedir(), ".claude");
|
|
22
|
+
return path.join(home, "plugins");
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get the absolute path to the pre-built plugin directory in the npm package.
|
|
26
|
+
* Uses fs.realpath for symlink/pnpm stability.
|
|
27
|
+
*/
|
|
28
|
+
export async function getPackagePluginDir() {
|
|
29
|
+
// Resolve relative to this file: src/lib/ -> ../../plugin
|
|
30
|
+
const rawPath = path.resolve(import.meta.dirname || path.dirname(new URL(import.meta.url).pathname), "../../plugin");
|
|
31
|
+
try {
|
|
32
|
+
return await fs.realpath(rawPath);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return rawPath;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// ============================================================================
|
|
39
|
+
// Atomic JSON Operations
|
|
40
|
+
// ============================================================================
|
|
41
|
+
/**
|
|
42
|
+
* Tolerant JSON read — returns default if missing, empty, or corrupt.
|
|
43
|
+
* Only use for files owned by this module (known_marketplaces.json).
|
|
44
|
+
*/
|
|
45
|
+
async function readJsonSafe(filePath, defaultValue) {
|
|
46
|
+
try {
|
|
47
|
+
const content = await fs.readFile(filePath, "utf-8");
|
|
48
|
+
if (!content.trim())
|
|
49
|
+
return defaultValue;
|
|
50
|
+
return JSON.parse(content);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return defaultValue;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Strict JSON read — throws on corrupt JSON.
|
|
58
|
+
* Use for files with critical config (settings.json) to avoid silent data loss.
|
|
59
|
+
*/
|
|
60
|
+
async function readJsonStrict(filePath, defaultValue) {
|
|
61
|
+
try {
|
|
62
|
+
const content = await fs.readFile(filePath, "utf-8");
|
|
63
|
+
if (!content.trim())
|
|
64
|
+
return defaultValue;
|
|
65
|
+
return JSON.parse(content);
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
// ENOENT = file doesn't exist -> return default
|
|
69
|
+
if (err instanceof Error && "code" in err && err.code === "ENOENT") {
|
|
70
|
+
return defaultValue;
|
|
71
|
+
}
|
|
72
|
+
// Parse errors or permission errors -> throw
|
|
73
|
+
throw err;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Atomic JSON write — temp file + rename in same directory.
|
|
78
|
+
* Creates parent directory if needed.
|
|
79
|
+
*/
|
|
80
|
+
async function writeJsonAtomic(filePath, data) {
|
|
81
|
+
const dir = path.dirname(filePath);
|
|
82
|
+
await fs.mkdir(dir, { recursive: true });
|
|
83
|
+
const tmpPath = `${filePath}.${Date.now()}.tmp`;
|
|
84
|
+
const content = JSON.stringify(data, null, 2) + "\n";
|
|
85
|
+
await fs.writeFile(tmpPath, content, "utf-8");
|
|
86
|
+
await fs.rename(tmpPath, filePath);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Read-modify-write with optimistic retry (3 attempts).
|
|
90
|
+
* Best-effort concurrent safety, not lock-based.
|
|
91
|
+
*/
|
|
92
|
+
async function modifyJsonAtomic(filePath, defaultValue, mutator, options) {
|
|
93
|
+
const maxAttempts = 3;
|
|
94
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
95
|
+
const data = options?.strict
|
|
96
|
+
? await readJsonStrict(filePath, defaultValue)
|
|
97
|
+
: await readJsonSafe(filePath, defaultValue);
|
|
98
|
+
const modified = mutator(data);
|
|
99
|
+
await writeJsonAtomic(filePath, modified);
|
|
100
|
+
// Verify write
|
|
101
|
+
try {
|
|
102
|
+
const readBack = options?.strict
|
|
103
|
+
? await readJsonStrict(filePath, defaultValue)
|
|
104
|
+
: await readJsonSafe(filePath, defaultValue);
|
|
105
|
+
const expected = JSON.stringify(modified);
|
|
106
|
+
const actual = JSON.stringify(readBack);
|
|
107
|
+
if (expected === actual) {
|
|
108
|
+
return modified;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
// Read-back failed, retry
|
|
113
|
+
}
|
|
114
|
+
if (attempt < maxAttempts - 1) {
|
|
115
|
+
// Brief delay before retry
|
|
116
|
+
await new Promise((r) => setTimeout(r, 50 * (attempt + 1)));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Final attempt without verification
|
|
120
|
+
const data = options?.strict
|
|
121
|
+
? await readJsonStrict(filePath, defaultValue)
|
|
122
|
+
: await readJsonSafe(filePath, defaultValue);
|
|
123
|
+
const modified = mutator(data);
|
|
124
|
+
await writeJsonAtomic(filePath, modified);
|
|
125
|
+
return modified;
|
|
126
|
+
}
|
|
127
|
+
// ============================================================================
|
|
128
|
+
// Registration Functions
|
|
129
|
+
// ============================================================================
|
|
130
|
+
const MARKETPLACE_KEY = "kspec-plugins";
|
|
131
|
+
/**
|
|
132
|
+
* Register the kspec core plugin marketplace in Claude Code's global state.
|
|
133
|
+
* Writes kspec-plugins entry to known_marketplaces.json.
|
|
134
|
+
* Only updates lastUpdated when path actually changes (idempotent).
|
|
135
|
+
* Validates plugin/.claude-plugin/plugin.json exists before registering.
|
|
136
|
+
*
|
|
137
|
+
* AC: @core-skill-install ac-6, ac-8
|
|
138
|
+
*/
|
|
139
|
+
export async function registerCorePluginMarketplace(opts) {
|
|
140
|
+
const dryRun = opts?.dryRun ?? false;
|
|
141
|
+
try {
|
|
142
|
+
const pluginDir = await getPackagePluginDir();
|
|
143
|
+
// Validate plugin directory has the manifest
|
|
144
|
+
const manifestPath = path.join(pluginDir, ".claude-plugin", "plugin.json");
|
|
145
|
+
try {
|
|
146
|
+
await fs.access(manifestPath);
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
return {
|
|
150
|
+
success: false,
|
|
151
|
+
action: "error",
|
|
152
|
+
message: `Plugin manifest not found at ${manifestPath}. Run 'npm run build' first.`,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
if (dryRun) {
|
|
156
|
+
return {
|
|
157
|
+
success: true,
|
|
158
|
+
action: "skipped",
|
|
159
|
+
message: `Would register marketplace at ${pluginDir}`,
|
|
160
|
+
registeredPath: pluginDir,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
const marketplacesPath = path.join(getClaudePluginsDir(), "known_marketplaces.json");
|
|
164
|
+
const existing = await readJsonSafe(marketplacesPath, {});
|
|
165
|
+
// Check if already registered with same path
|
|
166
|
+
const currentEntry = existing[MARKETPLACE_KEY];
|
|
167
|
+
if (currentEntry && currentEntry.installLocation === pluginDir) {
|
|
168
|
+
return {
|
|
169
|
+
success: true,
|
|
170
|
+
action: "unchanged",
|
|
171
|
+
message: "Marketplace already registered with correct path",
|
|
172
|
+
registeredPath: pluginDir,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
// Register or update
|
|
176
|
+
const action = currentEntry ? "updated" : "registered";
|
|
177
|
+
await modifyJsonAtomic(marketplacesPath, {}, (data) => ({
|
|
178
|
+
...data,
|
|
179
|
+
[MARKETPLACE_KEY]: {
|
|
180
|
+
...data[MARKETPLACE_KEY],
|
|
181
|
+
source: { source: "directory", path: pluginDir },
|
|
182
|
+
installLocation: pluginDir,
|
|
183
|
+
lastUpdated: new Date().toISOString(),
|
|
184
|
+
autoUpdate: false,
|
|
185
|
+
},
|
|
186
|
+
}));
|
|
187
|
+
return {
|
|
188
|
+
success: true,
|
|
189
|
+
action,
|
|
190
|
+
message: `Marketplace ${action} at ${pluginDir}`,
|
|
191
|
+
registeredPath: pluginDir,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
catch (err) {
|
|
195
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
196
|
+
return {
|
|
197
|
+
success: false,
|
|
198
|
+
action: "error",
|
|
199
|
+
message: `Registration failed: ${msg}`,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Enable the kspec plugin in a project's .claude/settings.json.
|
|
205
|
+
* Uses strict JSON read to avoid silently discarding hooks config.
|
|
206
|
+
*
|
|
207
|
+
* AC: @core-skill-install ac-7
|
|
208
|
+
*/
|
|
209
|
+
export async function enablePluginInProject(projectDir, opts) {
|
|
210
|
+
const dryRun = opts?.dryRun ?? false;
|
|
211
|
+
try {
|
|
212
|
+
const settingsPath = path.join(projectDir, ".claude", "settings.json");
|
|
213
|
+
if (dryRun) {
|
|
214
|
+
return {
|
|
215
|
+
success: true,
|
|
216
|
+
action: "unchanged",
|
|
217
|
+
message: "Would enable kspec@kspec-plugins in project settings",
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
const settings = await readJsonStrict(settingsPath, {});
|
|
221
|
+
const enabledPlugins = (settings.enabledPlugins || {});
|
|
222
|
+
if (enabledPlugins["kspec@kspec-plugins"] === true) {
|
|
223
|
+
return {
|
|
224
|
+
success: true,
|
|
225
|
+
action: "unchanged",
|
|
226
|
+
message: "Plugin already enabled in project",
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
await modifyJsonAtomic(settingsPath, {}, (data) => ({
|
|
230
|
+
...data,
|
|
231
|
+
enabledPlugins: {
|
|
232
|
+
...(data.enabledPlugins || {}),
|
|
233
|
+
"kspec@kspec-plugins": true,
|
|
234
|
+
},
|
|
235
|
+
}), { strict: true });
|
|
236
|
+
return {
|
|
237
|
+
success: true,
|
|
238
|
+
action: "enabled",
|
|
239
|
+
message: "Plugin enabled in project settings",
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
catch (err) {
|
|
243
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
244
|
+
return {
|
|
245
|
+
success: false,
|
|
246
|
+
action: "error",
|
|
247
|
+
message: `Enablement failed: ${msg}`,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Check the health of the kspec marketplace registration.
|
|
253
|
+
* Returns status and details for setup --status reporting.
|
|
254
|
+
*
|
|
255
|
+
* AC: @enhanced-setup ac-7, ac-8
|
|
256
|
+
*/
|
|
257
|
+
export async function checkMarketplaceHealth() {
|
|
258
|
+
try {
|
|
259
|
+
const marketplacesPath = path.join(getClaudePluginsDir(), "known_marketplaces.json");
|
|
260
|
+
const marketplaces = await readJsonSafe(marketplacesPath, {});
|
|
261
|
+
const entry = marketplaces[MARKETPLACE_KEY];
|
|
262
|
+
if (!entry) {
|
|
263
|
+
return {
|
|
264
|
+
status: "missing",
|
|
265
|
+
message: "kspec-plugins marketplace not registered. Run 'kspec setup' to register.",
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
const registeredPath = entry.installLocation;
|
|
269
|
+
// Check if the path is valid
|
|
270
|
+
const manifestPath = path.join(registeredPath, ".claude-plugin", "plugin.json");
|
|
271
|
+
try {
|
|
272
|
+
const content = await fs.readFile(manifestPath, "utf-8");
|
|
273
|
+
const manifest = JSON.parse(content);
|
|
274
|
+
// Read current package version for comparison
|
|
275
|
+
let packageVersion;
|
|
276
|
+
try {
|
|
277
|
+
const pkgPath = path.resolve(import.meta.dirname || path.dirname(new URL(import.meta.url).pathname), "../../package.json");
|
|
278
|
+
const pkg = JSON.parse(await fs.readFile(pkgPath, "utf-8"));
|
|
279
|
+
packageVersion = pkg.version;
|
|
280
|
+
}
|
|
281
|
+
catch {
|
|
282
|
+
// Can't determine package version
|
|
283
|
+
}
|
|
284
|
+
const pluginVersion = manifest.version;
|
|
285
|
+
if (packageVersion && pluginVersion && pluginVersion !== packageVersion) {
|
|
286
|
+
return {
|
|
287
|
+
status: "version-mismatch",
|
|
288
|
+
registeredPath,
|
|
289
|
+
pluginVersion,
|
|
290
|
+
packageVersion,
|
|
291
|
+
message: `Plugin version ${pluginVersion} doesn't match package version ${packageVersion}`,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
return {
|
|
295
|
+
status: "healthy",
|
|
296
|
+
registeredPath,
|
|
297
|
+
pluginVersion,
|
|
298
|
+
packageVersion,
|
|
299
|
+
message: "Marketplace registered and healthy",
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
catch {
|
|
303
|
+
return {
|
|
304
|
+
status: "path-broken",
|
|
305
|
+
registeredPath,
|
|
306
|
+
message: `Registered path is invalid: ${registeredPath}. Run 'kspec setup' to re-register.`,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
catch (err) {
|
|
311
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
312
|
+
return {
|
|
313
|
+
status: "error",
|
|
314
|
+
message: `Health check failed: ${msg}`,
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
//# sourceMappingURL=claude-plugin-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC5D,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC;YAC/B,CAAC;YAAC,MAAM,CAAC;gBACP,kCAAkC;YACpC,CAAC;YAED,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC;YAEvC,IAAI,cAAc,IAAI,aAAa,IAAI,aAAa,KAAK,cAAc,EAAE,CAAC;gBACxE,OAAO;oBACL,MAAM,EAAE,kBAAkB;oBAC1B,cAAc;oBACd,aAAa;oBACb,cAAc;oBACd,OAAO,EAAE,kBAAkB,aAAa,kCAAkC,cAAc,EAAE;iBAC3F,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,MAAM,EAAE,SAAS;gBACjB,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,OAAO,EAAE,oCAAoC;aAC9C,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;gBACL,MAAM,EAAE,aAAa;gBACrB,cAAc;gBACd,OAAO,EAAE,+BAA+B,cAAc,qCAAqC;aAC5F,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,OAAO;YACL,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,wBAAwB,GAAG,EAAE;SACvC,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Array merging algorithms for semantic YAML merge.
|
|
3
|
+
*
|
|
4
|
+
* Handles different types of arrays:
|
|
5
|
+
* - ULID-based entity arrays (tasks, notes, inbox items)
|
|
6
|
+
* - Set-like arrays (tags, depends_on)
|
|
7
|
+
* - Append-only arrays (notes, todos)
|
|
8
|
+
*/
|
|
9
|
+
import type { ReferenceIndex } from "../parser/refs.js";
|
|
10
|
+
/**
|
|
11
|
+
* Merge arrays that contain entities with _ulid fields.
|
|
12
|
+
*
|
|
13
|
+
* AC: @yaml-merge-driver ac-2
|
|
14
|
+
* Union merge: both additions included, identified by ULID.
|
|
15
|
+
*
|
|
16
|
+
* AC: @yaml-merge-driver ac-5
|
|
17
|
+
* Append-only arrays (notes, todos) are union merged by ULID.
|
|
18
|
+
*
|
|
19
|
+
* Strategy:
|
|
20
|
+
* 1. Start with all items from base (common ancestor)
|
|
21
|
+
* 2. Add items from ours that aren't in base (new in our branch)
|
|
22
|
+
* 3. Add items from theirs that aren't in base (new in their branch)
|
|
23
|
+
* 4. For items in base that were modified, prefer the modified version
|
|
24
|
+
*
|
|
25
|
+
* @param base Array from common ancestor
|
|
26
|
+
* @param ours Array from current branch
|
|
27
|
+
* @param theirs Array from incoming branch
|
|
28
|
+
* @returns Merged array with all items
|
|
29
|
+
*/
|
|
30
|
+
export declare function mergeUlidArrays<T extends {
|
|
31
|
+
_ulid: string;
|
|
32
|
+
}>(base: T[] | undefined, ours: T[] | undefined, theirs: T[] | undefined): T[];
|
|
33
|
+
/**
|
|
34
|
+
* Normalize a kspec reference to its canonical ULID form if possible.
|
|
35
|
+
* Returns the original value if not a ref or resolution fails.
|
|
36
|
+
*
|
|
37
|
+
* AC: @merge-ref-normalization ac-2
|
|
38
|
+
* Graceful degradation: unresolvable refs kept as-is.
|
|
39
|
+
*
|
|
40
|
+
* @param value The value to potentially normalize
|
|
41
|
+
* @param refIndex Optional reference index for resolution
|
|
42
|
+
* @returns Canonical form (@ULID) or original value
|
|
43
|
+
*/
|
|
44
|
+
export declare function normalizeRef<T extends string | number>(value: T, refIndex?: ReferenceIndex): string | number;
|
|
45
|
+
/**
|
|
46
|
+
* Merge set-like arrays (tags, depends_on, etc).
|
|
47
|
+
*
|
|
48
|
+
* AC: @yaml-merge-driver ac-6
|
|
49
|
+
* Set union: combine both arrays, remove duplicates.
|
|
50
|
+
*
|
|
51
|
+
* AC: @merge-ref-normalization ac-1
|
|
52
|
+
* For arrays containing kspec refs (depends_on, blocked_by, etc),
|
|
53
|
+
* normalizes refs to canonical ULID form before comparison to
|
|
54
|
+
* prevent duplicates when same item is referenced differently.
|
|
55
|
+
*
|
|
56
|
+
* Strategy:
|
|
57
|
+
* 1. Start with items from ours
|
|
58
|
+
* 2. Add items from theirs that aren't in ours
|
|
59
|
+
* 3. Remove duplicates (using normalized form for refs)
|
|
60
|
+
* 4. Preserve original representation (ours takes precedence)
|
|
61
|
+
*
|
|
62
|
+
* @param base Array from common ancestor (not used for set merge)
|
|
63
|
+
* @param ours Array from current branch
|
|
64
|
+
* @param theirs Array from incoming branch
|
|
65
|
+
* @param refIndex Optional reference index for normalizing refs
|
|
66
|
+
* @returns Merged array with unique items
|
|
67
|
+
*/
|
|
68
|
+
export declare function mergeSetArray<T extends string | number>(base: T[] | undefined, ours: T[] | undefined, theirs: T[] | undefined, refIndex?: ReferenceIndex): T[];
|
|
69
|
+
/**
|
|
70
|
+
* Detect if an item was deleted in one branch.
|
|
71
|
+
*
|
|
72
|
+
* Helper for AC: @yaml-merge-driver ac-8
|
|
73
|
+
* Detect when one version deletes an item while other modifies it.
|
|
74
|
+
*
|
|
75
|
+
* @param ulid ULID to check
|
|
76
|
+
* @param base Base version map
|
|
77
|
+
* @param ours Ours version map
|
|
78
|
+
* @param theirs Theirs version map
|
|
79
|
+
* @returns Whether item was deleted in ours or theirs
|
|
80
|
+
*/
|
|
81
|
+
export declare function detectDeletion(ulid: string, base: Map<string, unknown>, ours: Map<string, unknown>, theirs: Map<string, unknown>): {
|
|
82
|
+
deletedInOurs: boolean;
|
|
83
|
+
deletedInTheirs: boolean;
|
|
84
|
+
modifiedInOurs: boolean;
|
|
85
|
+
modifiedInTheirs: boolean;
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=arrays.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrays.d.ts","sourceRoot":"","sources":["../../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