@kody-ade/kody-engine 0.2.11 → 0.2.13

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.
Files changed (28) hide show
  1. package/README.md +5 -4
  2. package/dist/bin/kody2.js +309 -243
  3. package/dist/executables/fix/profile.json +93 -0
  4. package/dist/executables/fix-ci/profile.json +93 -0
  5. package/dist/executables/init/profile.json +4 -6
  6. package/dist/executables/orchestrator/profile.json +28 -15
  7. package/dist/executables/plan/profile.json +33 -16
  8. package/dist/executables/plan-verify/profile.json +37 -0
  9. package/dist/executables/plan-verify/prompt.md +53 -0
  10. package/dist/executables/release/profile.json +13 -8
  11. package/dist/executables/resolve/profile.json +80 -0
  12. package/dist/executables/review/profile.json +19 -10
  13. package/dist/executables/run/profile.json +86 -0
  14. package/dist/executables/types.ts +13 -11
  15. package/dist/executables/watch-stale-prs/profile.json +4 -7
  16. package/dist/plugins/commands/kody-live-probe.md +9 -0
  17. package/dist/plugins/hooks/kody-live-trace.json +17 -0
  18. package/dist/plugins/skills/kody-live-marker/SKILL.md +18 -0
  19. package/dist/plugins/test-plugin/.claude-plugin/plugin.json +6 -0
  20. package/dist/plugins/test-plugin/skills/kody-plugin-marker/SKILL.md +16 -0
  21. package/package.json +2 -2
  22. package/dist/executables/build/profile.json +0 -99
  23. package/dist/executables/orchestrator/prompts/orchestrator.md +0 -56
  24. package/dist/executables/plan/prompts/plan.md +0 -42
  25. /package/dist/executables/{build/prompts/fix.md → fix/prompt.md} +0 -0
  26. /package/dist/executables/{build/prompts/fix-ci.md → fix-ci/prompt.md} +0 -0
  27. /package/dist/executables/{build/prompts/resolve.md → resolve/prompt.md} +0 -0
  28. /package/dist/executables/{build/prompts/run.md → run/prompt.md} +0 -0
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "run",
3
+ "describe": "Implement a GitHub issue end-to-end: branch, code, commit, open PR.",
4
+ "inputs": [
5
+ {
6
+ "name": "issue",
7
+ "flag": "--issue",
8
+ "type": "int",
9
+ "required": true,
10
+ "describe": "GitHub issue number to implement."
11
+ }
12
+ ],
13
+ "claudeCode": {
14
+ "model": "inherit",
15
+ "permissionMode": "acceptEdits",
16
+ "maxTurns": null,
17
+ "systemPromptAppend": null,
18
+ "tools": [
19
+ "Read",
20
+ "Write",
21
+ "Edit",
22
+ "Bash",
23
+ "Grep",
24
+ "Glob"
25
+ ],
26
+ "hooks": [],
27
+ "skills": [],
28
+ "commands": [],
29
+ "subagents": [],
30
+ "plugins": [],
31
+ "mcpServers": []
32
+ },
33
+ "cliTools": [],
34
+ "scripts": {
35
+ "preflight": [
36
+ {
37
+ "script": "runFlow"
38
+ },
39
+ {
40
+ "script": "loadTaskState"
41
+ },
42
+ {
43
+ "script": "loadConventions"
44
+ },
45
+ {
46
+ "script": "loadCoverageRules"
47
+ },
48
+ {
49
+ "script": "composePrompt"
50
+ }
51
+ ],
52
+ "postflight": [
53
+ {
54
+ "script": "parseAgentResult"
55
+ },
56
+ {
57
+ "script": "verify"
58
+ },
59
+ {
60
+ "script": "checkCoverageWithRetry"
61
+ },
62
+ {
63
+ "script": "commitAndPush"
64
+ },
65
+ {
66
+ "script": "ensurePr"
67
+ },
68
+ {
69
+ "script": "postIssueComment"
70
+ },
71
+ {
72
+ "script": "writeRunSummary"
73
+ },
74
+ {
75
+ "script": "saveTaskState"
76
+ }
77
+ ]
78
+ },
79
+ "output": {
80
+ "actionTypes": [
81
+ "RUN_COMPLETED",
82
+ "RUN_FAILED",
83
+ "AGENT_NOT_RUN"
84
+ ]
85
+ }
86
+ }
@@ -62,24 +62,26 @@ export interface ClaudeCodeSpec {
62
62
  systemPromptAppend: string | null
63
63
  /** SDK built-in tools this executable is allowed to use (capability pack). */
64
64
  tools: string[]
65
- /** Claude Code hooks. `matcher` is a tool-name glob; `command` is a shell invocation. */
66
- hooks: {
67
- PreToolUse: HookEntry[]
68
- PostToolUse: HookEntry[]
69
- Stop: HookEntry[]
70
- }
65
+ /**
66
+ * Names of bundled hook configs to load (from src/plugins/hooks/<name>.json).
67
+ * Each referenced file is a Claude Code hooks JSON ({ hooks: { PreToolUse: [...] } }).
68
+ * Merged into a synthetic plugin at runtime.
69
+ */
70
+ hooks: string[]
71
+ /** Names of bundled skills to load (from src/plugins/skills/<name>/SKILL.md). */
71
72
  skills: string[]
73
+ /** Names of bundled slash commands to load (from src/plugins/commands/<name>.md). */
72
74
  commands: string[]
75
+ /** Names of bundled subagents to load (from src/plugins/agents/<name>.md). */
73
76
  subagents: string[]
77
+ /**
78
+ * External plugin directory paths (absolute, or relative to the profile dir).
79
+ * Loaded as-is by the SDK via { type: 'local', path }.
80
+ */
74
81
  plugins: string[]
75
82
  mcpServers: McpServerSpec[]
76
83
  }
77
84
 
78
- export interface HookEntry {
79
- matcher: string
80
- command: string
81
- }
82
-
83
85
  export interface McpServerSpec {
84
86
  name: string
85
87
  command: string
@@ -1,31 +1,28 @@
1
1
  {
2
2
  "name": "watch-stale-prs",
3
3
  "describe": "Scheduled: list open PRs untouched for N days and report. No agent invocation.",
4
-
5
4
  "kind": "scheduled",
6
5
  "schedule": "0 8 * * MON",
7
-
8
6
  "inputs": [],
9
-
10
7
  "claudeCode": {
11
8
  "model": "inherit",
12
9
  "permissionMode": "default",
13
10
  "maxTurns": null,
14
11
  "systemPromptAppend": null,
15
12
  "tools": [],
16
- "hooks": { "PreToolUse": [], "PostToolUse": [], "Stop": [] },
13
+ "hooks": [],
17
14
  "skills": [],
18
15
  "commands": [],
19
16
  "subagents": [],
20
17
  "plugins": [],
21
18
  "mcpServers": []
22
19
  },
23
-
24
20
  "cliTools": [],
25
-
26
21
  "scripts": {
27
22
  "preflight": [
28
- { "script": "watchStalePrsFlow" }
23
+ {
24
+ "script": "watchStalePrsFlow"
25
+ }
29
26
  ],
30
27
  "postflight": []
31
28
  }
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Internal Kody2 live-test slash command. Prints a confirmation token proving commands are loaded.
3
+ ---
4
+
5
+ # /kody-live-probe
6
+
7
+ Print the literal token `COMMAND_LOADED_OK` in your next message, followed by the current ISO timestamp on a new line.
8
+
9
+ Do not perform any other action — this command is a no-op confirmation signal for Kody2 infrastructure validation.
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/claude-code-settings.json",
3
+ "hooks": {
4
+ "PreToolUse": [
5
+ {
6
+ "matcher": "tool == \"Read\"",
7
+ "hooks": [
8
+ {
9
+ "type": "command",
10
+ "command": "printf 'HOOK_FIRED_OK\\n' >> /tmp/kody-hook-signal.txt"
11
+ }
12
+ ],
13
+ "description": "Kody2 live-test hook — appends HOOK_FIRED_OK to /tmp/kody-hook-signal.txt on every Read tool use, so the agent can verify the hook fired."
14
+ }
15
+ ]
16
+ }
17
+ }
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: kody-live-marker
3
+ description: Internal Kody2 live-test skill. Activates when a prompt mentions "kody-live-marker" and provides a confirmation token.
4
+ ---
5
+
6
+ # kody-live-marker
7
+
8
+ This skill exists only to verify that Kody2's synthetic plugin wiring actually loads skills into the agent's session.
9
+
10
+ ## When to activate
11
+
12
+ When the user's prompt contains the phrase "kody-live-marker" or explicitly asks whether the skill is loaded.
13
+
14
+ ## What to do
15
+
16
+ Include the literal token `SKILL_LOADED_OK` somewhere in your final message. Include the skill's description verbatim: "Internal Kody2 live-test skill."
17
+
18
+ Do not use this skill for anything else. It is a no-op confirmation signal for infrastructure validation.
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "kody2-test-plugin",
3
+ "version": "1.0.0",
4
+ "description": "Kody2 internal live-test plugin. Ships a single skill that proves external-plugin loading works.",
5
+ "skills": ["./skills/"]
6
+ }
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: kody-plugin-marker
3
+ description: Kody2 external-plugin live-test skill. Activates when prompt mentions "kody-plugin-marker" and outputs a confirmation token.
4
+ ---
5
+
6
+ # kody-plugin-marker
7
+
8
+ This skill is bundled inside a standalone plugin directory (not copied into a synthetic plugin). Its purpose is to verify that Kody2's `plugins: string[]` profile field successfully loads an external plugin as-is.
9
+
10
+ ## When to activate
11
+
12
+ When the user's prompt contains the phrase "kody-plugin-marker".
13
+
14
+ ## What to do
15
+
16
+ Include the literal token `PLUGIN_LOADED_OK` somewhere in your final message.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "description": "kody2 — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -34,7 +34,7 @@
34
34
  "bugs": "https://github.com/aharonyaircohen/kody-engine/issues",
35
35
  "scripts": {
36
36
  "kody2": "tsx bin/kody2.ts",
37
- "build": "tsup && node -e \"require('fs').cpSync('src/executables', 'dist/executables', { recursive: true })\"",
37
+ "build": "tsup && node scripts/copy-assets.cjs",
38
38
  "test": "vitest run tests/unit tests/int --no-coverage",
39
39
  "test:e2e": "vitest run tests/e2e --no-coverage",
40
40
  "test:all": "vitest run tests --no-coverage",
@@ -1,99 +0,0 @@
1
- {
2
- "name": "build",
3
- "describe": "Implement a GitHub issue or apply PR feedback end-to-end.",
4
-
5
- "inputs": [
6
- {
7
- "name": "mode",
8
- "flag": "--mode",
9
- "type": "enum",
10
- "values": ["run", "fix", "fix-ci", "resolve"],
11
- "required": true,
12
- "describe": "Which Build mode to run."
13
- },
14
- {
15
- "name": "issue",
16
- "flag": "--issue",
17
- "type": "int",
18
- "requiredWhen": { "mode": "run" },
19
- "describe": "GitHub issue number to implement."
20
- },
21
- {
22
- "name": "pr",
23
- "flag": "--pr",
24
- "type": "int",
25
- "requiredWhen": { "mode": ["fix", "fix-ci", "resolve"] },
26
- "describe": "GitHub PR number to operate on."
27
- },
28
- {
29
- "name": "feedback",
30
- "flag": "--feedback",
31
- "type": "string",
32
- "required": false,
33
- "describe": "Inline override for fix mode. If absent, the executor reads the latest PR review comment."
34
- },
35
- {
36
- "name": "runId",
37
- "flag": "--run-id",
38
- "type": "string",
39
- "required": false,
40
- "describe": "Specific failed workflow run ID for fix-ci. Defaults to latest failed run on the PR branch."
41
- }
42
- ],
43
-
44
- "claudeCode": {
45
- "model": "inherit",
46
- "permissionMode": "acceptEdits",
47
- "maxTurns": null,
48
- "systemPromptAppend": null,
49
- "tools": ["Read", "Write", "Edit", "Bash", "Grep", "Glob"],
50
- "hooks": {
51
- "PreToolUse": [],
52
- "PostToolUse": [],
53
- "Stop": []
54
- },
55
- "skills": [],
56
- "commands": [],
57
- "subagents": [],
58
- "plugins": [],
59
- "mcpServers": []
60
- },
61
-
62
- "cliTools": [],
63
-
64
- "scripts": {
65
- "preflight": [
66
- { "script": "runFlow", "runWhen": { "args.mode": "run" } },
67
- { "script": "fixFlow", "runWhen": { "args.mode": "fix" } },
68
- { "script": "fixCiFlow", "runWhen": { "args.mode": "fix-ci" } },
69
- { "script": "resolveFlow", "runWhen": { "args.mode": "resolve" } },
70
- { "script": "loadTaskState" },
71
- { "script": "loadConventions" },
72
- { "script": "loadCoverageRules" },
73
- { "script": "composePrompt" }
74
- ],
75
- "postflight": [
76
- { "script": "parseAgentResult" },
77
- { "script": "verify", "runWhen": { "args.mode": ["run", "fix", "fix-ci"] } },
78
- { "script": "checkCoverageWithRetry", "runWhen": { "args.mode": ["run", "fix", "fix-ci"] } },
79
- { "script": "commitAndPush" },
80
- { "script": "ensurePr" },
81
- { "script": "postIssueComment" },
82
- { "script": "writeRunSummary" },
83
- { "script": "saveTaskState" }
84
- ]
85
- },
86
- "output": {
87
- "actionTypes": [
88
- "RUN_COMPLETED",
89
- "RUN_FAILED",
90
- "FIX_COMPLETED",
91
- "FIX_FAILED",
92
- "FIX_CI_COMPLETED",
93
- "FIX_CI_FAILED",
94
- "RESOLVE_COMPLETED",
95
- "RESOLVE_FAILED",
96
- "AGENT_NOT_RUN"
97
- ]
98
- }
99
- }
@@ -1,56 +0,0 @@
1
- You are the **kody2 orchestrator** for issue #{{issue.number}} on {{repoOwner}}/{{repoName}}.
2
-
3
- Your job: drive a 2-step flow **plan → build** by posting `@kody2 <subcommand>` comments on the issue and watching the state-comment for completion signals. You do NOT edit files. You do NOT run git. You use `gh` (via Bash) only to post comments and read the state-comment.
4
-
5
- ---
6
-
7
- # Issue #{{issue.number}}: {{issue.title}}
8
-
9
- {{issue.body}}
10
-
11
- # Required flow (plan-then-build)
12
-
13
- 1. **Kick off plan.** Post an issue comment with EXACTLY this body:
14
- ```
15
- @kody2 plan
16
- ```
17
- Use: `gh issue comment {{issue.number}} --body "@kody2 plan"` (in the cwd).
18
- 2. **Wait for plan to complete.** Poll the issue's state-comment every ~30s. The state-comment is the one whose body starts with `<!-- kody2:state:v1:begin -->`. Fetch it with:
19
- ```
20
- gh api repos/{{repoOwner}}/{{repoName}}/issues/{{issue.number}}/comments --paginate --jq '.[] | select(.body | contains("kody2:state:v1:begin")) | .body'
21
- ```
22
- Parse the JSON block inside the sentinels. Look for `core.lastOutcome.type == "PLAN_COMPLETED"`.
23
- If `core.lastOutcome.type == "PLAN_FAILED"` OR if 10 minutes pass without completion → abort with:
24
- ```
25
- FAILED: plan did not complete (<reason from state or "timeout">)
26
- ```
27
- 3. **Kick off build.** Post:
28
- ```
29
- @kody2 build
30
- ```
31
- Same `gh issue comment` command.
32
- 4. **Wait for build to complete.** Same poll technique. Look for `core.lastOutcome.type == "RUN_COMPLETED"` (build's success marker) or `RUN_FAILED`. If `RUN_FAILED` or 30 minutes pass → abort with `FAILED: build did not complete (...)`.
33
- 5. **Emit final summary.**
34
-
35
- # Required final output
36
-
37
- On success:
38
-
39
- ```
40
- DONE
41
- COMMIT_MSG: chore(orchestrator): plan-then-build for #{{issue.number}}
42
- PR_SUMMARY:
43
- - Posted `@kody2 plan` and observed PLAN_COMPLETED.
44
- - Posted `@kody2 build` and observed RUN_COMPLETED.
45
- - Final PR: <prUrl from state>
46
- ```
47
-
48
- On failure, a single line: `FAILED: <concrete reason>`.
49
-
50
- # Rules
51
-
52
- - NEVER edit files. Read-only flow.
53
- - NEVER run git. Only `gh` via Bash for comment posting and state polling.
54
- - Between polls, sleep ~30 seconds. Do NOT poll faster than once every 30 seconds.
55
- - Hard cap: 40 turns total across the whole flow. If you're approaching the cap, fail early with `FAILED: turn budget exhausted`.
56
- - If you post an `@kody2` comment and the state-comment does NOT update within the poll window, the child executable likely didn't run — check the GitHub Actions runs tab URL via `gh run list --limit 5 --json conclusion,status,url` to diagnose, then fail with a concrete reason.
@@ -1,42 +0,0 @@
1
- You are a senior engineer producing an **implementation plan** for the GitHub issue below. You will NOT write code. You will NOT run git or gh commands. You will NOT modify files. Your only outputs are:
2
-
3
- 1. Use Read / Grep / Glob / Bash (read-only) to study the codebase as much as needed.
4
- 2. Emit a final message with the plan wrapped in the required markers (see "Required output").
5
-
6
- ---
7
-
8
- # Repo
9
- - {{repoOwner}}/{{repoName}}, default branch: {{defaultBranch}}
10
-
11
- # Issue #{{issue.number}}: {{issue.title}}
12
-
13
- {{issue.body}}
14
-
15
- Recent comments (most recent first, truncated):
16
- {{issue.commentsFormatted}}
17
-
18
- {{conventionsBlock}}
19
-
20
- ---
21
-
22
- # Required output
23
-
24
- Your FINAL message must be exactly this shape (no extra text before or after):
25
-
26
- ```
27
- DONE
28
- COMMIT_MSG: plan: <very short title>
29
- PR_SUMMARY:
30
- <A concrete implementation plan in markdown. Include:
31
- - Files to change (with paths), and the change in each.
32
- - New files to create, with their purpose and rough shape.
33
- - Any ambiguities that need the human to resolve first.
34
- - Verification checklist (typecheck / tests / lint expectations).
35
- Keep to ~60 lines or less. No filler. No marketing language.>
36
- ```
37
-
38
- # Rules
39
- - Read-only. Do NOT modify any file.
40
- - Do NOT run git or gh commands.
41
- - No speculative scope — plan only what the issue asks for.
42
- - If the issue is ambiguous and you cannot make progress without input, output `FAILED: <what's unclear>` instead of a plan.