dispatch-ai 0.1.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.
Files changed (91) hide show
  1. package/LICENSE +229 -0
  2. package/README.md +177 -0
  3. package/dist/bin/dispatch.d.ts +3 -0
  4. package/dist/bin/dispatch.d.ts.map +1 -0
  5. package/dist/bin/dispatch.js +42 -0
  6. package/dist/bin/dispatch.js.map +1 -0
  7. package/dist/src/commands/create.d.ts +3 -0
  8. package/dist/src/commands/create.d.ts.map +1 -0
  9. package/dist/src/commands/create.js +154 -0
  10. package/dist/src/commands/create.js.map +1 -0
  11. package/dist/src/commands/init.d.ts +3 -0
  12. package/dist/src/commands/init.d.ts.map +1 -0
  13. package/dist/src/commands/init.js +100 -0
  14. package/dist/src/commands/init.js.map +1 -0
  15. package/dist/src/commands/run.d.ts +3 -0
  16. package/dist/src/commands/run.d.ts.map +1 -0
  17. package/dist/src/commands/run.js +72 -0
  18. package/dist/src/commands/run.js.map +1 -0
  19. package/dist/src/commands/status.d.ts +3 -0
  20. package/dist/src/commands/status.d.ts.map +1 -0
  21. package/dist/src/commands/status.js +34 -0
  22. package/dist/src/commands/status.js.map +1 -0
  23. package/dist/src/engine/base.d.ts +12 -0
  24. package/dist/src/engine/base.d.ts.map +1 -0
  25. package/dist/src/engine/base.js +161 -0
  26. package/dist/src/engine/base.js.map +1 -0
  27. package/dist/src/engine/claude.d.ts +25 -0
  28. package/dist/src/engine/claude.d.ts.map +1 -0
  29. package/dist/src/engine/claude.js +215 -0
  30. package/dist/src/engine/claude.js.map +1 -0
  31. package/dist/src/engine/types.d.ts +88 -0
  32. package/dist/src/engine/types.d.ts.map +1 -0
  33. package/dist/src/engine/types.js +2 -0
  34. package/dist/src/engine/types.js.map +1 -0
  35. package/dist/src/github/client.d.ts +58 -0
  36. package/dist/src/github/client.d.ts.map +1 -0
  37. package/dist/src/github/client.js +189 -0
  38. package/dist/src/github/client.js.map +1 -0
  39. package/dist/src/github/issues.d.ts +13 -0
  40. package/dist/src/github/issues.d.ts.map +1 -0
  41. package/dist/src/github/issues.js +67 -0
  42. package/dist/src/github/issues.js.map +1 -0
  43. package/dist/src/github/pulls.d.ts +15 -0
  44. package/dist/src/github/pulls.d.ts.map +1 -0
  45. package/dist/src/github/pulls.js +65 -0
  46. package/dist/src/github/pulls.js.map +1 -0
  47. package/dist/src/index.d.ts +7 -0
  48. package/dist/src/index.d.ts.map +1 -0
  49. package/dist/src/index.js +5 -0
  50. package/dist/src/index.js.map +1 -0
  51. package/dist/src/orchestrator/classifier.d.ts +4 -0
  52. package/dist/src/orchestrator/classifier.d.ts.map +1 -0
  53. package/dist/src/orchestrator/classifier.js +45 -0
  54. package/dist/src/orchestrator/classifier.js.map +1 -0
  55. package/dist/src/orchestrator/pipeline.d.ts +13 -0
  56. package/dist/src/orchestrator/pipeline.d.ts.map +1 -0
  57. package/dist/src/orchestrator/pipeline.js +246 -0
  58. package/dist/src/orchestrator/pipeline.js.map +1 -0
  59. package/dist/src/orchestrator/planner.d.ts +13 -0
  60. package/dist/src/orchestrator/planner.d.ts.map +1 -0
  61. package/dist/src/orchestrator/planner.js +95 -0
  62. package/dist/src/orchestrator/planner.js.map +1 -0
  63. package/dist/src/orchestrator/scorer.d.ts +8 -0
  64. package/dist/src/orchestrator/scorer.d.ts.map +1 -0
  65. package/dist/src/orchestrator/scorer.js +41 -0
  66. package/dist/src/orchestrator/scorer.js.map +1 -0
  67. package/dist/src/reporter/summary.d.ts +29 -0
  68. package/dist/src/reporter/summary.d.ts.map +1 -0
  69. package/dist/src/reporter/summary.js +77 -0
  70. package/dist/src/reporter/summary.js.map +1 -0
  71. package/dist/src/utils/config.d.ts +37 -0
  72. package/dist/src/utils/config.d.ts.map +1 -0
  73. package/dist/src/utils/config.js +60 -0
  74. package/dist/src/utils/config.js.map +1 -0
  75. package/dist/src/utils/git.d.ts +30 -0
  76. package/dist/src/utils/git.d.ts.map +1 -0
  77. package/dist/src/utils/git.js +95 -0
  78. package/dist/src/utils/git.js.map +1 -0
  79. package/dist/src/utils/logger.d.ts +22 -0
  80. package/dist/src/utils/logger.d.ts.map +1 -0
  81. package/dist/src/utils/logger.js +109 -0
  82. package/dist/src/utils/logger.js.map +1 -0
  83. package/dist/src/utils/semaphore.d.ts +19 -0
  84. package/dist/src/utils/semaphore.d.ts.map +1 -0
  85. package/dist/src/utils/semaphore.js +41 -0
  86. package/dist/src/utils/semaphore.js.map +1 -0
  87. package/dist/src/utils/worktree.d.ts +20 -0
  88. package/dist/src/utils/worktree.d.ts.map +1 -0
  89. package/dist/src/utils/worktree.js +92 -0
  90. package/dist/src/utils/worktree.js.map +1 -0
  91. package/package.json +62 -0
@@ -0,0 +1,100 @@
1
+ import chalk from "chalk";
2
+ import inquirer from "inquirer";
3
+ import { saveConfig, DEFAULT_CONFIG } from "../utils/config.js";
4
+ import { getRepoInfo } from "../utils/git.js";
5
+ import { log } from "../utils/logger.js";
6
+ export function registerInitCommand(program) {
7
+ program
8
+ .command("init")
9
+ .description("Initialize dispatch configuration for this repository")
10
+ .option("-y, --yes", "Use default config without prompting")
11
+ .action(async (options) => {
12
+ try {
13
+ log.header("Dispatch Init");
14
+ // Verify we're in a git repo with a GitHub remote
15
+ try {
16
+ const { owner, repo } = await getRepoInfo();
17
+ log.success(`Detected repository: ${chalk.bold(`${owner}/${repo}`)}`);
18
+ }
19
+ catch {
20
+ log.error("Not in a Git repository with a GitHub remote.");
21
+ log.info("Run this command from the root of your GitHub repository.");
22
+ process.exit(1);
23
+ }
24
+ let config;
25
+ if (options.yes) {
26
+ config = { ...DEFAULT_CONFIG };
27
+ }
28
+ else {
29
+ const answers = await inquirer.prompt([
30
+ {
31
+ type: "list",
32
+ name: "engine",
33
+ message: "AI engine:",
34
+ choices: [
35
+ { name: "Claude Code (recommended)", value: "claude" },
36
+ { name: "Gemini CLI (coming soon)", value: "gemini", disabled: true },
37
+ ],
38
+ default: "claude",
39
+ },
40
+ {
41
+ type: "list",
42
+ name: "model",
43
+ message: "Model to use:",
44
+ choices: ["sonnet", "opus", "haiku"],
45
+ default: "sonnet",
46
+ },
47
+ {
48
+ type: "input",
49
+ name: "labels",
50
+ message: "Issue labels to include (comma-separated, empty = all):",
51
+ default: "",
52
+ filter: (val) => val ? val.split(",").map((s) => s.trim()) : [],
53
+ },
54
+ {
55
+ type: "number",
56
+ name: "maxIssues",
57
+ message: "Max issues per run:",
58
+ default: 10,
59
+ },
60
+ {
61
+ type: "number",
62
+ name: "maxTurnsPerIssue",
63
+ message: "Max AI turns per issue:",
64
+ default: 25,
65
+ },
66
+ {
67
+ type: "input",
68
+ name: "baseBranch",
69
+ message: "Base branch for PRs:",
70
+ default: "main",
71
+ },
72
+ {
73
+ type: "confirm",
74
+ name: "createDraftPRs",
75
+ message: "Create draft PRs by default?",
76
+ default: false,
77
+ },
78
+ ]);
79
+ config = {
80
+ ...DEFAULT_CONFIG,
81
+ ...answers,
82
+ };
83
+ }
84
+ const path = await saveConfig(config);
85
+ console.log();
86
+ log.success(`Config saved to ${chalk.bold(path)}`);
87
+ console.log();
88
+ log.info(`Next steps:`);
89
+ console.log(chalk.gray(` 1. Set your GitHub token: ${chalk.yellow("export GITHUB_TOKEN=ghp_...")}`));
90
+ console.log(chalk.gray(` 2. Ensure Claude Code is installed: ${chalk.yellow("claude --version")}`));
91
+ console.log(chalk.gray(` 3. Run dispatch: ${chalk.yellow("dispatch run")}`));
92
+ console.log();
93
+ }
94
+ catch (err) {
95
+ log.error(`Init failed: ${err instanceof Error ? err.message : err}`);
96
+ process.exit(1);
97
+ }
98
+ });
99
+ }
100
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/init.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAuB,MAAM,oBAAoB,CAAC;AACrF,O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AAC,mBAAmB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACnD,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,gCAAgC,KAAK,CAAC,MAAM,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC,CAAC;YACvG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,0CAA0C,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC;YACtG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,uBAAuB,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC;YAC/E,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,GAAG,CAAC,KAAK,CAAC,gBAAgB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;YACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function registerRunCommand(program: Command): void;
3
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/commands/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,QAoElD"}
@@ -0,0 +1,72 @@
1
+ import chalk from "chalk";
2
+ import { loadConfig, applyCliOverrides } from "../utils/config.js";
3
+ import { getRepoInfo } from "../utils/git.js";
4
+ import { GitHubClient } from "../github/client.js";
5
+ import { ClaudeEngine } from "../engine/claude.js";
6
+ import { runPipeline } from "../orchestrator/pipeline.js";
7
+ import { log } from "../utils/logger.js";
8
+ export function registerRunCommand(program) {
9
+ program
10
+ .command("run")
11
+ .description("Solve open GitHub issues and create pull requests")
12
+ .option("--dry-run", "Preview which issues would be processed without making changes")
13
+ .option("--engine <engine>", "AI engine to use (default: claude)")
14
+ .option("--model <model>", "Model to use (default: sonnet)")
15
+ .option("--label <labels...>", "Only process issues with these labels")
16
+ .option("--exclude <labels...>", "Skip issues with these labels")
17
+ .option("--max-issues <n>", "Max issues to process", parseInt)
18
+ .option("--max-turns <n>", "Max AI turns per issue", parseInt)
19
+ .option("--draft", "Create all PRs as drafts")
20
+ .option("--base-branch <branch>", "Base branch for PRs (default: main)")
21
+ .option("--concurrency <n>", "Number of issues to process in parallel", parseInt)
22
+ .action(async (options) => {
23
+ try {
24
+ const cwd = process.cwd();
25
+ // Load config
26
+ let config = await loadConfig(cwd);
27
+ config = applyCliOverrides(config, options);
28
+ // Detect repo
29
+ const { owner, repo } = await getRepoInfo(cwd);
30
+ log.info(`Repository: ${chalk.bold(`${owner}/${repo}`)}`);
31
+ log.info(`Engine: ${chalk.bold(config.engine)} (${config.model})`);
32
+ log.info(`Max issues: ${config.maxIssues} | Max turns: ${config.maxTurnsPerIssue} | Concurrency: ${config.concurrency}`);
33
+ if (config.labels.length > 0) {
34
+ log.info(`Filtering: ${config.labels.join(", ")}`);
35
+ }
36
+ // Create engine
37
+ let engine;
38
+ if (config.engine === "claude") {
39
+ engine = new ClaudeEngine({
40
+ model: config.model,
41
+ maxTurns: config.maxTurnsPerIssue,
42
+ });
43
+ }
44
+ else {
45
+ log.error(`Engine "${config.engine}" is not yet supported. Use "claude".`);
46
+ process.exit(1);
47
+ }
48
+ // Create GitHub client
49
+ const github = await GitHubClient.create(owner, repo);
50
+ // Run the pipeline
51
+ const summary = await runPipeline({
52
+ config,
53
+ engine,
54
+ github,
55
+ cwd,
56
+ dryRun: options.dryRun,
57
+ });
58
+ // Exit with appropriate code
59
+ if (summary.totalFailed > 0 && summary.totalSolved === 0) {
60
+ process.exit(1);
61
+ }
62
+ }
63
+ catch (err) {
64
+ log.error(`Run failed: ${err instanceof Error ? err.message : err}`);
65
+ if (process.env.DEBUG) {
66
+ console.error(err);
67
+ }
68
+ process.exit(1);
69
+ }
70
+ });
71
+ }
72
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/commands/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAEzC,MAAM,UAAU,kBAAkB,CAAC,OAAgB;IACjD,OAAO;SACJ,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,mDAAmD,CAAC;SAChE,MAAM,CAAC,WAAW,EAAE,gEAAgE,CAAC;SACrF,MAAM,CAAC,mBAAmB,EAAE,oCAAoC,CAAC;SACjE,MAAM,CAAC,iBAAiB,EAAE,gCAAgC,CAAC;SAC3D,MAAM,CAAC,qBAAqB,EAAE,uCAAuC,CAAC;SACtE,MAAM,CAAC,uBAAuB,EAAE,+BAA+B,CAAC;SAChE,MAAM,CAAC,kBAAkB,EAAE,uBAAuB,EAAE,QAAQ,CAAC;SAC7D,MAAM,CAAC,iBAAiB,EAAE,wBAAwB,EAAE,QAAQ,CAAC;SAC7D,MAAM,CAAC,SAAS,EAAE,0BAA0B,CAAC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AC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,KAAK,CAAC,WAAW,MAAM,CAAC,MAAM,uCAAuC,CAAC,CAAC;gBAC3E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YAED,uBAAuB;YACvB,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAEtD,mBAAmB;YACnB,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC;gBAChC,MAAM;gBACN,MAAM;gBACN,MAAM;gBACN,GAAG;gBACH,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB,CAAC,CAAC;YAEH,6BAA6B;YAC7B,IAAI,OAAO,CAAC,WAAW,GAAG,CAAC,IAAI,OAAO,CAAC,WAAW,KAAK,CAAC,EAAE,CAAC;gBACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,GAAG,CAAC,KAAK,CAAC,eAAe,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;YACrE,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;gBACtB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACrB,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function registerStatusCommand(program: Command): void;
3
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,QA+BrD"}
@@ -0,0 +1,34 @@
1
+ import chalk from "chalk";
2
+ import { loadConfig } from "../utils/config.js";
3
+ import { loadLastSummary, formatMorningSummary } from "../reporter/summary.js";
4
+ import { log } from "../utils/logger.js";
5
+ export function registerStatusCommand(program) {
6
+ program
7
+ .command("status")
8
+ .description("View the results of the last dispatch run")
9
+ .option("--json", "Output as JSON")
10
+ .action(async (options) => {
11
+ try {
12
+ const cwd = process.cwd();
13
+ const config = await loadConfig(cwd);
14
+ const summary = await loadLastSummary(cwd, config.stateDir);
15
+ if (!summary) {
16
+ log.info("No previous dispatch run found.");
17
+ log.info(`Run ${chalk.yellow("dispatch run")} to solve some issues first.`);
18
+ return;
19
+ }
20
+ if (options.json) {
21
+ console.log(JSON.stringify(summary, null, 2));
22
+ return;
23
+ }
24
+ // Pretty print the morning summary
25
+ console.log();
26
+ console.log(formatMorningSummary(summary));
27
+ }
28
+ catch (err) {
29
+ log.error(`Status failed: ${err instanceof Error ? err.message : err}`);
30
+ process.exit(1);
31
+ }
32
+ });
33
+ }
34
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/status.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAEzC,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,2CAA2C,CAAC;SACxD,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;YAC1B,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC;YAErC,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;YAE5D,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,GAAG,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;gBAC5C,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,8BAA8B,CAAC,CAAC;gBAC5E,OAAO;YACT,CAAC;YAED,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;gBACjB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;gBAC9C,OAAO;YACT,CAAC;YAED,mCAAmC;YACnC,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;QAC7C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,GAAG,CAAC,KAAK,CAAC,kBAAkB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;YACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Issue, IssueClassification } from "./types.js";
2
+ /** Build a rich context prompt from an issue and its comments */
3
+ export declare function buildIssuePrompt(issue: Issue): string;
4
+ /** System prompts tailored to each issue type */
5
+ export declare const SYSTEM_PROMPTS: Record<IssueClassification, string>;
6
+ /** Prompt for confidence self-assessment */
7
+ export declare const CONFIDENCE_PROMPT = "Now assess your work on this issue. Respond in this exact JSON format:\n\n{\n \"confidence\": <number 1-10>,\n \"summary\": \"<2-3 sentence summary of what you did>\",\n \"uncertainties\": [\"<thing you're unsure about>\", ...],\n \"changedFiles\": [\"<file1>\", \"<file2>\", ...],\n \"commitMessage\": \"<conventional commit message \u2014 short subject line, max 72 chars, e.g. fix: make floating badges visible on mobile>\"\n}\n\nScoring guide:\n- 9-10: Fully solved, tested, confident in correctness\n- 7-8: Solved but minor uncertainty (e.g., edge cases, style choices)\n- 5-6: Partially solved, significant assumptions made\n- 3-4: Best effort, but substantial uncertainty\n- 1-2: Minimal progress, mostly questions remain";
8
+ /** Prompt for issue classification */
9
+ export declare const CLASSIFICATION_PROMPT = "Classify this GitHub issue into exactly ONE category. Respond with just the category name, nothing else.\n\nCategories:\n- code-fix: Bug fix, error correction, broken functionality\n- feature: New functionality, enhancement, improvement\n- investigation: Research question, \"figure out why...\", performance analysis\n- documentation: Write/update docs, README, comments\n- audit: Review codebase for issues (security, accessibility, performance)\n- refactor: Code restructuring without behavior change\n\nIssue title: \"{title}\"\nIssue body: \"{body}\"\n\nCategory:";
10
+ /** Prompt for creating structured issues */
11
+ export declare const ISSUE_CREATION_PROMPT = "You are a technical project manager creating a well-structured GitHub issue from a description.\n\nCreate a GitHub issue with:\n1. A clear, concise title (imperative mood, <70 chars)\n2. A detailed description with:\n - **Problem/Goal**: What needs to happen and why\n - **Acceptance Criteria**: Bullet list of what \"done\" looks like\n - **Technical Notes**: Any relevant technical context\n3. Suggested labels from: bug, enhancement, documentation, investigation, refactor, performance, security, accessibility\n\nRespond in this exact JSON format:\n{\n \"title\": \"...\",\n \"body\": \"...\",\n \"labels\": [\"...\"]\n}\n\nDescription to convert:\n\"{description}\"";
12
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/engine/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE7D,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAqBrD;AAED,iDAAiD;AACjD,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,mBAAmB,EAAE,MAAM,CA6F9D,CAAC;AAEF,4CAA4C;AAC5C,eAAO,MAAM,iBAAiB,kuBAemB,CAAC;AAElD,sCAAsC;AACtC,eAAO,MAAM,qBAAqB,6jBAaxB,CAAC;AAEX,4CAA4C;AAC5C,eAAO,MAAM,qBAAqB,4qBAkBlB,CAAC"}
@@ -0,0 +1,161 @@
1
+ /** Build a rich context prompt from an issue and its comments */
2
+ export function buildIssuePrompt(issue) {
3
+ let prompt = `# GitHub Issue #${issue.number}: ${issue.title}\n\n`;
4
+ if (issue.labels.length > 0) {
5
+ prompt += `**Labels:** ${issue.labels.join(", ")}\n`;
6
+ }
7
+ prompt += `**Author:** ${issue.author}\n`;
8
+ prompt += `**Created:** ${issue.createdAt}\n\n`;
9
+ if (issue.body) {
10
+ prompt += `## Description\n\n${issue.body}\n\n`;
11
+ }
12
+ if (issue.comments.length > 0) {
13
+ prompt += `## Discussion (${issue.comments.length} comments)\n\n`;
14
+ for (const comment of issue.comments) {
15
+ prompt += `**${comment.author}** (${comment.createdAt}):\n${comment.body}\n\n---\n\n`;
16
+ }
17
+ }
18
+ return prompt;
19
+ }
20
+ /** System prompts tailored to each issue type */
21
+ export const SYSTEM_PROMPTS = {
22
+ "code-fix": `You are solving a GitHub issue that requires code changes.
23
+
24
+ Your job:
25
+ 1. Read the issue carefully, understand what needs to be fixed
26
+ 2. Explore the codebase to understand the relevant code
27
+ 3. Make the minimal, targeted changes needed to fix the issue
28
+ 4. If the project has tests, add or update tests for your changes
29
+ 5. Ensure your changes don't break existing functionality
30
+
31
+ Guidelines:
32
+ - Make small, focused changes — don't refactor unrelated code
33
+ - Follow the existing code style and patterns in the project
34
+ - If you're unsure about something, document it clearly
35
+ - Commit your changes with a clear, descriptive message`,
36
+ feature: `You are implementing a new feature based on a GitHub issue.
37
+
38
+ Your job:
39
+ 1. Read the feature request carefully
40
+ 2. Explore the codebase to understand architecture and patterns
41
+ 3. Implement the feature following existing patterns
42
+ 4. Add tests if the project has a test suite
43
+ 5. Update any relevant documentation
44
+
45
+ Guidelines:
46
+ - Follow existing architectural patterns
47
+ - Keep the implementation minimal and focused on the request
48
+ - If the feature is ambiguous, implement the most reasonable interpretation
49
+ - Document any assumptions you made`,
50
+ investigation: `You are investigating a technical question from a GitHub issue.
51
+
52
+ Your job:
53
+ 1. Read the question/investigation request carefully
54
+ 2. Research the codebase thoroughly to find relevant information
55
+ 3. Create a detailed findings document (markdown file)
56
+ 4. Include evidence, code references, and data to support your findings
57
+ 5. Provide actionable recommendations
58
+
59
+ Guidelines:
60
+ - Be thorough — check logs, configs, code paths, dependencies
61
+ - Use concrete evidence (file paths, line numbers, metrics)
62
+ - Structure your report with clear sections
63
+ - End with specific, actionable recommendations
64
+ - Save your report as a markdown file in the repo (e.g., docs/investigations/issue-NNN.md)`,
65
+ documentation: `You are creating or updating documentation based on a GitHub issue.
66
+
67
+ Your job:
68
+ 1. Read what documentation is needed
69
+ 2. Explore the relevant code to understand what to document
70
+ 3. Write clear, accurate documentation
71
+ 4. Follow the project's existing documentation style
72
+
73
+ Guidelines:
74
+ - Write for the intended audience (developers, users, operators)
75
+ - Include code examples where helpful
76
+ - Keep it concise but complete
77
+ - Follow existing doc structure and formatting`,
78
+ audit: `You are performing a codebase audit based on a GitHub issue.
79
+
80
+ Your job:
81
+ 1. Understand what aspects need auditing (security, accessibility, performance, etc.)
82
+ 2. Systematically review the relevant parts of the codebase
83
+ 3. Create a detailed audit report as a markdown file
84
+ 4. Categorize findings by severity (critical, warning, info)
85
+ 5. Provide specific remediation steps for each finding
86
+
87
+ Guidelines:
88
+ - Be systematic — don't skip files or modules
89
+ - Provide file paths and line numbers for each finding
90
+ - Prioritize findings by impact
91
+ - Include both problems found and things done well
92
+ - Save your report as docs/audits/issue-NNN.md`,
93
+ refactor: `You are refactoring code based on a GitHub issue.
94
+
95
+ Your job:
96
+ 1. Understand the refactoring goal
97
+ 2. Explore the code to understand current structure
98
+ 3. Plan the refactoring approach (minimal, incremental changes)
99
+ 4. Execute the refactoring
100
+ 5. Verify nothing is broken
101
+
102
+ Guidelines:
103
+ - Make incremental changes, not a big-bang rewrite
104
+ - Preserve all existing behavior
105
+ - Run tests if available
106
+ - Follow existing code style`,
107
+ unknown: `You are working on a GitHub issue. Read it carefully, understand what's needed, and take the most appropriate action. If it requires code changes, make them. If it requires research, document your findings. If it's unclear, document what you found and what questions remain.`,
108
+ };
109
+ /** Prompt for confidence self-assessment */
110
+ export const CONFIDENCE_PROMPT = `Now assess your work on this issue. Respond in this exact JSON format:
111
+
112
+ {
113
+ "confidence": <number 1-10>,
114
+ "summary": "<2-3 sentence summary of what you did>",
115
+ "uncertainties": ["<thing you're unsure about>", ...],
116
+ "changedFiles": ["<file1>", "<file2>", ...],
117
+ "commitMessage": "<conventional commit message — short subject line, max 72 chars, e.g. fix: make floating badges visible on mobile>"
118
+ }
119
+
120
+ Scoring guide:
121
+ - 9-10: Fully solved, tested, confident in correctness
122
+ - 7-8: Solved but minor uncertainty (e.g., edge cases, style choices)
123
+ - 5-6: Partially solved, significant assumptions made
124
+ - 3-4: Best effort, but substantial uncertainty
125
+ - 1-2: Minimal progress, mostly questions remain`;
126
+ /** Prompt for issue classification */
127
+ export const CLASSIFICATION_PROMPT = `Classify this GitHub issue into exactly ONE category. Respond with just the category name, nothing else.
128
+
129
+ Categories:
130
+ - code-fix: Bug fix, error correction, broken functionality
131
+ - feature: New functionality, enhancement, improvement
132
+ - investigation: Research question, "figure out why...", performance analysis
133
+ - documentation: Write/update docs, README, comments
134
+ - audit: Review codebase for issues (security, accessibility, performance)
135
+ - refactor: Code restructuring without behavior change
136
+
137
+ Issue title: "{title}"
138
+ Issue body: "{body}"
139
+
140
+ Category:`;
141
+ /** Prompt for creating structured issues */
142
+ export const ISSUE_CREATION_PROMPT = `You are a technical project manager creating a well-structured GitHub issue from a description.
143
+
144
+ Create a GitHub issue with:
145
+ 1. A clear, concise title (imperative mood, <70 chars)
146
+ 2. A detailed description with:
147
+ - **Problem/Goal**: What needs to happen and why
148
+ - **Acceptance Criteria**: Bullet list of what "done" looks like
149
+ - **Technical Notes**: Any relevant technical context
150
+ 3. Suggested labels from: bug, enhancement, documentation, investigation, refactor, performance, security, accessibility
151
+
152
+ Respond in this exact JSON format:
153
+ {
154
+ "title": "...",
155
+ "body": "...",
156
+ "labels": ["..."]
157
+ }
158
+
159
+ Description to convert:
160
+ "{description}"`;
161
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/engine/base.ts"],"names":[],"mappings":"AAEA,iEAAiE;AACjE,MAAM,UAAU,gBAAgB,CAAC,KAAY;IAC3C,IAAI,MAAM,GAAG,mBAAmB,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,KAAK,MAAM,CAAC;IAEnE,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,eAAe,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACvD,CAAC;IACD,MAAM,IAAI,eAAe,KAAK,CAAC,MAAM,IAAI,CAAC;IAC1C,MAAM,IAAI,gBAAgB,KAAK,CAAC,SAAS,MAAM,CAAC;IAEhD,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QACf,MAAM,IAAI,qBAAqB,KAAK,CAAC,IAAI,MAAM,CAAC;IAClD,CAAC;IAED,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,kBAAkB,KAAK,CAAC,QAAQ,CAAC,MAAM,gBAAgB,CAAC;QAClE,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,OAAO,CAAC,MAAM,OAAO,OAAO,CAAC,SAAS,OAAO,OAAO,CAAC,IAAI,aAAa,CAAC;QACxF,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,iDAAiD;AACjD,MAAM,CAAC,MAAM,cAAc,GAAwC;IACjE,UAAU,EAAE;;;;;;;;;;;;;wDAa0C;IAEtD,OAAO,EAAE;;;;;;;;;;;;;oCAayB;IAElC,aAAa,EAAE;;;;;;;;;;;;;;2FAc0E;IAEzF,aAAa,EAAE;;;;;;;;;;;;+CAY8B;IAE7C,KAAK,EAAE;;;;;;;;;;;;;;+CAcsC;IAE7C,QAAQ,EAAE;;;;;;;;;;;;;6BAaiB;IAE3B,OAAO,EAAE,oRAAoR;CAC9R,CAAC;AAEF,4CAA4C;AAC5C,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;iDAegB,CAAC;AAElD,sCAAsC;AACtC,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;UAa3B,CAAC;AAEX,4CAA4C;AAC5C,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;gBAkBrB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { AIEngine, Issue, IssueClassification, RepoContext, SolveResult, StructuredIssue } from "./types.js";
2
+ interface ClaudeOptions {
3
+ model: string;
4
+ maxTurns: number;
5
+ }
6
+ export declare class ClaudeEngine implements AIEngine {
7
+ readonly name = "claude";
8
+ private model;
9
+ private maxTurns;
10
+ constructor(options: ClaudeOptions);
11
+ /** Run claude CLI in print mode with streaming stderr output */
12
+ private runClaude;
13
+ /** Parse JSON from claude's response, handling markdown code blocks */
14
+ private parseJSON;
15
+ solve(issue: Issue, context: RepoContext): Promise<SolveResult>;
16
+ investigate(issue: Issue, context: RepoContext): Promise<SolveResult>;
17
+ createIssue(description: string, context: RepoContext): Promise<StructuredIssue>;
18
+ classifyIssue(issue: Issue): Promise<IssueClassification>;
19
+ scoreConfidence(issue: Issue, changedFiles: string[]): Promise<{
20
+ score: number;
21
+ uncertainties: string[];
22
+ }>;
23
+ }
24
+ export {};
25
+ //# sourceMappingURL=claude.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../src/engine/claude.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,QAAQ,EACR,KAAK,EACL,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,eAAe,EAChB,MAAM,YAAY,CAAC;AAUpB,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,YAAa,YAAW,QAAQ;IAC3C,QAAQ,CAAC,IAAI,YAAY;IACzB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,QAAQ,CAAS;gBAEb,OAAO,EAAE,aAAa;IAKlC,gEAAgE;YAClD,SAAS;IAgHvB,uEAAuE;IACvE,OAAO,CAAC,SAAS;IAqBX,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAyD/D,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAMrE,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC;IAYhF,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAgCzD,eAAe,CACnB,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,MAAM,EAAE,GACrB,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAKvD"}