@towles/tool 0.0.67 → 0.0.68
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/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { rmSync } from "node:fs";
|
|
1
|
+
import { rmSync, writeFileSync, mkdirSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
3
4
|
|
|
4
|
-
import { Flags } from "@oclif/core";
|
|
5
|
+
import { Args, Flags } from "@oclif/core";
|
|
5
6
|
import consola from "consola";
|
|
6
7
|
|
|
7
8
|
import { BaseCommand } from "../base.js";
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
initConfig,
|
|
15
16
|
log,
|
|
16
17
|
logBanner,
|
|
18
|
+
runClaude,
|
|
17
19
|
runPipeline,
|
|
18
20
|
sleep,
|
|
19
21
|
} from "../../lib/auto-claude/index.js";
|
|
@@ -24,7 +26,18 @@ export default class AutoClaude extends BaseCommand {
|
|
|
24
26
|
|
|
25
27
|
static override description = "Automated issue-to-PR pipeline using Claude Code";
|
|
26
28
|
|
|
29
|
+
static override args = {
|
|
30
|
+
prompt: Args.string({
|
|
31
|
+
description: "Run a single prompt (skips issue pipeline)",
|
|
32
|
+
required: false,
|
|
33
|
+
}),
|
|
34
|
+
};
|
|
35
|
+
|
|
27
36
|
static override examples = [
|
|
37
|
+
{
|
|
38
|
+
description: "Run a single prompt",
|
|
39
|
+
command: '<%= config.bin %> auto-claude "Fix the login bug in auth.ts"',
|
|
40
|
+
},
|
|
28
41
|
{
|
|
29
42
|
description: "Process a specific issue",
|
|
30
43
|
command: "<%= config.bin %> auto-claude --issue 42",
|
|
@@ -49,6 +62,10 @@ export default class AutoClaude extends BaseCommand {
|
|
|
49
62
|
|
|
50
63
|
static override flags = {
|
|
51
64
|
...BaseCommand.baseFlags,
|
|
65
|
+
"max-turns": Flags.integer({
|
|
66
|
+
description: "Maximum conversation turns for prompt mode (default: 10)",
|
|
67
|
+
default: 10,
|
|
68
|
+
}),
|
|
52
69
|
issue: Flags.integer({
|
|
53
70
|
char: "i",
|
|
54
71
|
description: "Process a specific issue number",
|
|
@@ -88,8 +105,29 @@ export default class AutoClaude extends BaseCommand {
|
|
|
88
105
|
};
|
|
89
106
|
|
|
90
107
|
async run(): Promise<void> {
|
|
91
|
-
const { flags } = await this.parse(AutoClaude);
|
|
108
|
+
const { args, flags } = await this.parse(AutoClaude);
|
|
109
|
+
|
|
110
|
+
// Prompt mode: run a single prompt with structured output, skip issue pipeline
|
|
111
|
+
if (args.prompt) {
|
|
112
|
+
await initConfig({ model: flags.model });
|
|
113
|
+
|
|
114
|
+
const promptDir = join(tmpdir(), "tt-auto-claude");
|
|
115
|
+
mkdirSync(promptDir, { recursive: true });
|
|
116
|
+
const promptFile = join(promptDir, `prompt-${Date.now()}.md`);
|
|
117
|
+
writeFileSync(promptFile, args.prompt);
|
|
118
|
+
|
|
119
|
+
const result = await runClaude({
|
|
120
|
+
promptFile,
|
|
121
|
+
maxTurns: flags["max-turns"],
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
if (result.is_error) {
|
|
125
|
+
this.error("Claude reported an error", { exit: 1 });
|
|
126
|
+
}
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
92
129
|
|
|
130
|
+
// Issue pipeline mode
|
|
93
131
|
const cfg = await initConfig({
|
|
94
132
|
triggerLabel: flags.label,
|
|
95
133
|
mainBranch: flags["main-branch"],
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { type AutoClaudeConfig, AutoClaudeConfigSchema, getConfig, initConfig } from "./config.js";
|
|
2
|
+
export { type ClaudeResult, runClaude } from "./claude-cli.js";
|
|
2
3
|
export { STEP_NAMES, runPipeline } from "./pipeline.js";
|
|
3
4
|
export type { StepName } from "./prompt-templates/index.js";
|
|
4
5
|
export { git } from "../../utils/git/exec.js";
|