@bretwardjames/ghp-cli 0.2.0-beta.2 → 0.2.0-beta.5
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 +39 -0
- package/dist/ai-feedback.d.ts +43 -0
- package/dist/ai-feedback.d.ts.map +1 -0
- package/dist/ai-feedback.js +154 -0
- package/dist/ai-feedback.js.map +1 -0
- package/dist/claude-runner.d.ts +43 -0
- package/dist/claude-runner.d.ts.map +1 -0
- package/dist/claude-runner.js +239 -0
- package/dist/claude-runner.js.map +1 -0
- package/dist/commands/add-issue.d.ts +10 -0
- package/dist/commands/add-issue.d.ts.map +1 -1
- package/dist/commands/add-issue.js +203 -4
- package/dist/commands/add-issue.js.map +1 -1
- package/dist/commands/agents.d.ts +26 -0
- package/dist/commands/agents.d.ts.map +1 -0
- package/dist/commands/agents.js +291 -0
- package/dist/commands/agents.js.map +1 -0
- package/dist/commands/label.d.ts +6 -0
- package/dist/commands/label.d.ts.map +1 -0
- package/dist/commands/label.js +65 -0
- package/dist/commands/label.js.map +1 -0
- package/dist/commands/mcp.js +1 -1
- package/dist/commands/plan-epic.d.ts +15 -0
- package/dist/commands/plan-epic.d.ts.map +1 -0
- package/dist/commands/plan-epic.js +278 -0
- package/dist/commands/plan-epic.js.map +1 -0
- package/dist/commands/pr.d.ts +1 -0
- package/dist/commands/pr.d.ts.map +1 -1
- package/dist/commands/pr.js +141 -6
- package/dist/commands/pr.js.map +1 -1
- package/dist/commands/progress.d.ts +8 -0
- package/dist/commands/progress.d.ts.map +1 -0
- package/dist/commands/progress.js +158 -0
- package/dist/commands/progress.js.map +1 -0
- package/dist/commands/set-parent.d.ts +7 -0
- package/dist/commands/set-parent.d.ts.map +1 -0
- package/dist/commands/set-parent.js +66 -0
- package/dist/commands/set-parent.js.map +1 -0
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +38 -1
- package/dist/commands/start.js.map +1 -1
- package/dist/config.d.ts +37 -24
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +27 -1
- package/dist/config.js.map +1 -1
- package/dist/conventions.d.ts +14 -0
- package/dist/conventions.d.ts.map +1 -0
- package/dist/conventions.js +49 -0
- package/dist/conventions.js.map +1 -0
- package/dist/editor.d.ts +12 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/editor.js +48 -0
- package/dist/editor.js.map +1 -0
- package/dist/github-api.d.ts +1 -1
- package/dist/github-api.d.ts.map +1 -1
- package/dist/github-api.js.map +1 -1
- package/dist/index.js +64 -0
- package/dist/index.js.map +1 -1
- package/dist/terminal-utils.d.ts +44 -2
- package/dist/terminal-utils.d.ts.map +1 -1
- package/dist/terminal-utils.js +176 -3
- package/dist/terminal-utils.js.map +1 -1
- package/package.json +10 -11
package/README.md
CHANGED
|
@@ -79,6 +79,12 @@ ghp add "Title" --template bug_report # Use specific template
|
|
|
79
79
|
ghp add --list-templates # List available templates
|
|
80
80
|
ghp add "Title" --status "Backlog" # Set initial status
|
|
81
81
|
ghp add "Title" --project "My Project" # Specify project
|
|
82
|
+
ghp add "Title" --labels "bug,urgent" # Apply labels
|
|
83
|
+
ghp add "Title" --assign # Assign yourself
|
|
84
|
+
ghp add "Title" --assign @user1,@user2 # Assign specific users
|
|
85
|
+
ghp add "Title" --field "Priority=High" # Set project field
|
|
86
|
+
ghp add "Title" --parent 42 # Create as sub-issue
|
|
87
|
+
ghp add "Title" --ai # AI-expand brief title
|
|
82
88
|
ghp add "Title" --force-defaults # Non-interactive mode
|
|
83
89
|
```
|
|
84
90
|
|
|
@@ -110,6 +116,19 @@ ghp assign 123 @user1 @user2 # Assign specific users
|
|
|
110
116
|
ghp assign 123 --remove @user # Remove assignee
|
|
111
117
|
```
|
|
112
118
|
|
|
119
|
+
```bash
|
|
120
|
+
ghp label 123 bug urgent # Add labels
|
|
121
|
+
ghp label 123 bug --remove # Remove label
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Parent/Child Relationships (Sub-Issues)
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
ghp set-parent 123 --parent 42 # Set parent issue
|
|
128
|
+
ghp set-parent 123 --remove # Remove parent
|
|
129
|
+
ghp progress 42 # Show epic progress with sub-issues
|
|
130
|
+
```
|
|
131
|
+
|
|
113
132
|
### Workflow
|
|
114
133
|
|
|
115
134
|
```bash
|
|
@@ -179,6 +198,26 @@ ghp worktree remove 123 # Remove worktree for issue
|
|
|
179
198
|
ghp worktree remove 123 --force # Force remove (uncommitted changes)
|
|
180
199
|
```
|
|
181
200
|
|
|
201
|
+
### Agent Management
|
|
202
|
+
|
|
203
|
+
Manage Claude agents running in parallel worktrees:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
ghp agents list # List all running agents
|
|
207
|
+
ghp agents stop 123 # Stop agent for specific issue
|
|
208
|
+
ghp agents stop --all # Stop all agents
|
|
209
|
+
ghp agents watch # Real-time agent dashboard
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### AI-Assisted Features
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
ghp add "Fix login" --ai # Expand brief title into full issue
|
|
216
|
+
ghp plan-epic "Auth system" # Break down epic into sub-issues
|
|
217
|
+
ghp plan-epic "Title" -x # Execute plan (create issues)
|
|
218
|
+
ghp pr --ai-description # Generate PR description from changes
|
|
219
|
+
```
|
|
220
|
+
|
|
182
221
|
### Configuration
|
|
183
222
|
|
|
184
223
|
```bash
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Feedback Loop UI
|
|
3
|
+
*
|
|
4
|
+
* Provides a reusable feedback mechanism for AI-generated content.
|
|
5
|
+
* Users can accept, edit, or regenerate with feedback.
|
|
6
|
+
*/
|
|
7
|
+
/** Error thrown when user cancels the feedback loop */
|
|
8
|
+
export declare class UserCancelledError extends Error {
|
|
9
|
+
constructor();
|
|
10
|
+
}
|
|
11
|
+
export interface FeedbackResult {
|
|
12
|
+
/** The final accepted content */
|
|
13
|
+
content: string;
|
|
14
|
+
/** Whether the user edited the content */
|
|
15
|
+
wasEdited: boolean;
|
|
16
|
+
/** Number of regeneration attempts */
|
|
17
|
+
regenerationCount: number;
|
|
18
|
+
/** Whether the user cancelled */
|
|
19
|
+
cancelled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface FeedbackOptions {
|
|
22
|
+
/** Type of content being generated (for display) */
|
|
23
|
+
contentType: string;
|
|
24
|
+
/** Initial generated content */
|
|
25
|
+
initialContent: string;
|
|
26
|
+
/** Function to regenerate content with feedback */
|
|
27
|
+
regenerate: (feedback: string) => Promise<string>;
|
|
28
|
+
/** File extension for editor (default: .md) */
|
|
29
|
+
fileExtension?: string;
|
|
30
|
+
/** Whether to show a preview (default: true) */
|
|
31
|
+
showPreview?: boolean;
|
|
32
|
+
/** Maximum regeneration attempts (default: 5) */
|
|
33
|
+
maxRegenerations?: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Run the feedback loop for AI-generated content
|
|
37
|
+
*/
|
|
38
|
+
export declare function runFeedbackLoop(options: FeedbackOptions): Promise<FeedbackResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Simple confirmation prompt
|
|
41
|
+
*/
|
|
42
|
+
export declare function confirmContent(content: string, contentType: string): Promise<boolean>;
|
|
43
|
+
//# sourceMappingURL=ai-feedback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-feedback.d.ts","sourceRoot":"","sources":["../src/ai-feedback.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,uDAAuD;AACvD,qBAAa,kBAAmB,SAAQ,KAAK;;CAK5C;AAED,MAAM,WAAW,cAAc;IAC3B,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iCAAiC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC5B,oDAAoD;IACpD,WAAW,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,mDAAmD;IACnD,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAClD,+CAA+C;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gDAAgD;IAChD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAsCD;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CA0GvF;AAED;;GAEG;AACH,wBAAsB,cAAc,CAChC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,OAAO,CAAC,CAUlB"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Feedback Loop UI
|
|
3
|
+
*
|
|
4
|
+
* Provides a reusable feedback mechanism for AI-generated content.
|
|
5
|
+
* Users can accept, edit, or regenerate with feedback.
|
|
6
|
+
*/
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import { createInterface } from 'readline';
|
|
9
|
+
import { isInteractive } from './prompts.js';
|
|
10
|
+
import { openEditor } from './editor.js';
|
|
11
|
+
/** Error thrown when user cancels the feedback loop */
|
|
12
|
+
export class UserCancelledError extends Error {
|
|
13
|
+
constructor() {
|
|
14
|
+
super('User cancelled');
|
|
15
|
+
this.name = 'UserCancelledError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Prompt user for a single line of input
|
|
20
|
+
*/
|
|
21
|
+
function promptLine(question) {
|
|
22
|
+
const rl = createInterface({
|
|
23
|
+
input: process.stdin,
|
|
24
|
+
output: process.stdout,
|
|
25
|
+
});
|
|
26
|
+
return new Promise((resolve) => {
|
|
27
|
+
rl.question(question, (answer) => {
|
|
28
|
+
rl.close();
|
|
29
|
+
resolve(answer.trim());
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Display content preview with line numbers
|
|
35
|
+
*/
|
|
36
|
+
function displayPreview(content, maxLines = 30) {
|
|
37
|
+
const lines = content.split('\n');
|
|
38
|
+
const displayLines = lines.slice(0, maxLines);
|
|
39
|
+
console.log();
|
|
40
|
+
console.log(chalk.dim('─'.repeat(60)));
|
|
41
|
+
for (const line of displayLines) {
|
|
42
|
+
console.log(line);
|
|
43
|
+
}
|
|
44
|
+
if (lines.length > maxLines) {
|
|
45
|
+
console.log(chalk.dim(`... (${lines.length - maxLines} more lines)`));
|
|
46
|
+
}
|
|
47
|
+
console.log(chalk.dim('─'.repeat(60)));
|
|
48
|
+
console.log();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Run the feedback loop for AI-generated content
|
|
52
|
+
*/
|
|
53
|
+
export async function runFeedbackLoop(options) {
|
|
54
|
+
const { contentType, initialContent, regenerate, fileExtension = '.md', showPreview = true, maxRegenerations = 5, } = options;
|
|
55
|
+
let currentContent = initialContent;
|
|
56
|
+
let regenerationCount = 0;
|
|
57
|
+
let wasEdited = false;
|
|
58
|
+
// Non-interactive mode: just return the initial content
|
|
59
|
+
if (!isInteractive()) {
|
|
60
|
+
return {
|
|
61
|
+
content: currentContent,
|
|
62
|
+
wasEdited: false,
|
|
63
|
+
regenerationCount: 0,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
while (true) {
|
|
67
|
+
// Show preview if enabled
|
|
68
|
+
if (showPreview) {
|
|
69
|
+
console.log(chalk.bold(`Generated ${contentType}:`));
|
|
70
|
+
displayPreview(currentContent);
|
|
71
|
+
}
|
|
72
|
+
// Show options
|
|
73
|
+
console.log('Options:');
|
|
74
|
+
console.log(` ${chalk.cyan('a')} - Accept and continue`);
|
|
75
|
+
console.log(` ${chalk.cyan('e')} - Edit in $EDITOR`);
|
|
76
|
+
if (regenerationCount < maxRegenerations) {
|
|
77
|
+
console.log(` ${chalk.cyan('r')} - Regenerate with feedback`);
|
|
78
|
+
}
|
|
79
|
+
console.log(` ${chalk.cyan('q')} - Cancel`);
|
|
80
|
+
console.log();
|
|
81
|
+
const choice = await promptLine('Choice [a/e/r/q]: ');
|
|
82
|
+
switch (choice.toLowerCase()) {
|
|
83
|
+
case 'a':
|
|
84
|
+
case 'accept':
|
|
85
|
+
case '':
|
|
86
|
+
// Accept current content
|
|
87
|
+
return {
|
|
88
|
+
content: currentContent,
|
|
89
|
+
wasEdited,
|
|
90
|
+
regenerationCount,
|
|
91
|
+
};
|
|
92
|
+
case 'e':
|
|
93
|
+
case 'edit':
|
|
94
|
+
// Edit in editor
|
|
95
|
+
try {
|
|
96
|
+
const edited = await openEditor(currentContent, fileExtension);
|
|
97
|
+
if (edited.trim() !== currentContent.trim()) {
|
|
98
|
+
currentContent = edited;
|
|
99
|
+
wasEdited = true;
|
|
100
|
+
console.log(chalk.green('Content updated.'));
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
console.log(chalk.dim('No changes made.'));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
console.error(chalk.red('Error opening editor:'), err);
|
|
108
|
+
}
|
|
109
|
+
break;
|
|
110
|
+
case 'r':
|
|
111
|
+
case 'regenerate':
|
|
112
|
+
if (regenerationCount >= maxRegenerations) {
|
|
113
|
+
console.log(chalk.yellow(`Maximum regenerations (${maxRegenerations}) reached.`));
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
// Get feedback
|
|
117
|
+
console.log();
|
|
118
|
+
console.log(chalk.dim('What would you like to change? (or press Enter to regenerate without feedback)'));
|
|
119
|
+
const feedback = await promptLine('Feedback: ');
|
|
120
|
+
console.log();
|
|
121
|
+
console.log(chalk.dim('Regenerating...'));
|
|
122
|
+
try {
|
|
123
|
+
currentContent = await regenerate(feedback || 'Please try again with a different approach.');
|
|
124
|
+
regenerationCount++;
|
|
125
|
+
console.log(chalk.green('Regenerated.'));
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
console.error(chalk.red('Error regenerating:'), err);
|
|
129
|
+
}
|
|
130
|
+
break;
|
|
131
|
+
case 'q':
|
|
132
|
+
case 'quit':
|
|
133
|
+
case 'cancel':
|
|
134
|
+
console.log(chalk.yellow('Cancelled.'));
|
|
135
|
+
throw new UserCancelledError();
|
|
136
|
+
default:
|
|
137
|
+
console.log(chalk.yellow('Invalid choice. Please enter a, e, r, or q.'));
|
|
138
|
+
}
|
|
139
|
+
console.log();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Simple confirmation prompt
|
|
144
|
+
*/
|
|
145
|
+
export async function confirmContent(content, contentType) {
|
|
146
|
+
if (!isInteractive()) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
console.log(chalk.bold(`Generated ${contentType}:`));
|
|
150
|
+
displayPreview(content);
|
|
151
|
+
const answer = await promptLine('Accept? [Y/n]: ');
|
|
152
|
+
return answer.toLowerCase() !== 'n';
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=ai-feedback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-feedback.js","sourceRoot":"","sources":["../src/ai-feedback.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,uDAAuD;AACvD,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IACzC;QACI,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,oB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AM,MAAM,GAAG,MAAM,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACnD,OAAO,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified Claude Runner
|
|
3
|
+
*
|
|
4
|
+
* Handles authentication flow with graceful fallbacks:
|
|
5
|
+
* 1. Check ANTHROPIC_API_KEY env var
|
|
6
|
+
* 2. Check ghp config for claude.auth setting ('api' | 'cli')
|
|
7
|
+
* 3. If no explicit setting, check for API key in config
|
|
8
|
+
* 4. If API key found, use direct API
|
|
9
|
+
* 5. If no API key, try Claude CLI (non-interactive mode)
|
|
10
|
+
* 6. If all fail, offer manual fallback
|
|
11
|
+
*/
|
|
12
|
+
export type AuthMethod = 'api' | 'cli' | 'none';
|
|
13
|
+
export interface ClaudeRunnerResult {
|
|
14
|
+
/** Whether the operation succeeded */
|
|
15
|
+
success: boolean;
|
|
16
|
+
/** The generated content (if successful) */
|
|
17
|
+
content?: string;
|
|
18
|
+
/** Error message (if failed) */
|
|
19
|
+
error?: string;
|
|
20
|
+
/** Which auth method was used */
|
|
21
|
+
authMethod: AuthMethod;
|
|
22
|
+
}
|
|
23
|
+
export interface ClaudeRunnerOptions {
|
|
24
|
+
/** The prompt/task to send to Claude */
|
|
25
|
+
prompt: string;
|
|
26
|
+
/** System prompt (context) */
|
|
27
|
+
systemPrompt?: string;
|
|
28
|
+
/** Content type for display (e.g., "PR description") */
|
|
29
|
+
contentType: string;
|
|
30
|
+
/** Callback for streaming output (API mode only) */
|
|
31
|
+
onToken?: (token: string) => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Run a prompt through Claude with automatic auth fallback
|
|
35
|
+
*/
|
|
36
|
+
export declare function runClaude(options: ClaudeRunnerOptions): Promise<ClaudeRunnerResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Generate content with Claude, with fallback to manual writing
|
|
39
|
+
*
|
|
40
|
+
* Returns the generated content, or null if user wants to write manually
|
|
41
|
+
*/
|
|
42
|
+
export declare function generateWithClaude(options: ClaudeRunnerOptions): Promise<string | null>;
|
|
43
|
+
//# sourceMappingURL=claude-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-runner.d.ts","sourceRoot":"","sources":["../src/claude-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAYH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;AAEhD,MAAM,WAAW,kBAAkB;IAC/B,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,UAAU,EAAE,UAAU,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAChC,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,WAAW,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAsID;;GAEG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAwDzF;AAgDD;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAc7F"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified Claude Runner
|
|
3
|
+
*
|
|
4
|
+
* Handles authentication flow with graceful fallbacks:
|
|
5
|
+
* 1. Check ANTHROPIC_API_KEY env var
|
|
6
|
+
* 2. Check ghp config for claude.auth setting ('api' | 'cli')
|
|
7
|
+
* 3. If no explicit setting, check for API key in config
|
|
8
|
+
* 4. If API key found, use direct API
|
|
9
|
+
* 5. If no API key, try Claude CLI (non-interactive mode)
|
|
10
|
+
* 6. If all fail, offer manual fallback
|
|
11
|
+
*/
|
|
12
|
+
import chalk from 'chalk';
|
|
13
|
+
import { exec, spawn } from 'child_process';
|
|
14
|
+
import { promisify } from 'util';
|
|
15
|
+
import { getClaudeConfig } from './config.js';
|
|
16
|
+
import { ClaudeClient } from '@bretwardjames/ghp-core';
|
|
17
|
+
import { isInteractive } from './prompts.js';
|
|
18
|
+
import { createInterface } from 'readline';
|
|
19
|
+
const execAsync = promisify(exec);
|
|
20
|
+
/**
|
|
21
|
+
* Check if Claude CLI is available
|
|
22
|
+
*/
|
|
23
|
+
async function isClaudeCliAvailable() {
|
|
24
|
+
try {
|
|
25
|
+
await execAsync('which claude');
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Run prompt via Claude CLI (non-interactive mode)
|
|
34
|
+
*/
|
|
35
|
+
async function runViaCli(prompt, systemPrompt) {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
const args = ['--print', '--output-format', 'text'];
|
|
38
|
+
if (systemPrompt) {
|
|
39
|
+
args.push('--system-prompt', systemPrompt);
|
|
40
|
+
}
|
|
41
|
+
const child = spawn('claude', args, {
|
|
42
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
43
|
+
});
|
|
44
|
+
let stdout = '';
|
|
45
|
+
let stderr = '';
|
|
46
|
+
child.stdout.on('data', (data) => {
|
|
47
|
+
stdout += data.toString();
|
|
48
|
+
});
|
|
49
|
+
child.stderr.on('data', (data) => {
|
|
50
|
+
stderr += data.toString();
|
|
51
|
+
});
|
|
52
|
+
child.stdin.write(prompt);
|
|
53
|
+
child.stdin.end();
|
|
54
|
+
child.on('close', (code) => {
|
|
55
|
+
if (code === 0) {
|
|
56
|
+
resolve(stdout.trim());
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
reject(new Error(stderr || `Claude CLI exited with code ${code}`));
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
child.on('error', (err) => {
|
|
63
|
+
reject(err);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Prompt user for a choice
|
|
69
|
+
*/
|
|
70
|
+
function promptChoice(question) {
|
|
71
|
+
const rl = createInterface({
|
|
72
|
+
input: process.stdin,
|
|
73
|
+
output: process.stdout,
|
|
74
|
+
});
|
|
75
|
+
return new Promise((resolve) => {
|
|
76
|
+
rl.question(question, (answer) => {
|
|
77
|
+
rl.close();
|
|
78
|
+
resolve(answer.trim().toLowerCase());
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Determine which auth method to use based on config and availability
|
|
84
|
+
*/
|
|
85
|
+
async function determineAuthMethod(config) {
|
|
86
|
+
// 1. If explicit auth mode is set, use it
|
|
87
|
+
if (config.authMode === 'api') {
|
|
88
|
+
if (config.apiKey) {
|
|
89
|
+
return {
|
|
90
|
+
method: 'api',
|
|
91
|
+
client: new ClaudeClient({
|
|
92
|
+
apiKey: config.apiKey,
|
|
93
|
+
model: config.model,
|
|
94
|
+
maxTokens: config.maxTokens,
|
|
95
|
+
}),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
method: 'none',
|
|
100
|
+
reason: 'Auth mode set to "api" but no API key found. Set ANTHROPIC_API_KEY or ghp config claude.apiKey',
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
if (config.authMode === 'cli') {
|
|
104
|
+
if (await isClaudeCliAvailable()) {
|
|
105
|
+
return { method: 'cli' };
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
method: 'none',
|
|
109
|
+
reason: 'Auth mode set to "cli" but Claude CLI not found. Install Claude Code first.',
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
// 2. No explicit setting - try API key first
|
|
113
|
+
if (config.apiKey) {
|
|
114
|
+
return {
|
|
115
|
+
method: 'api',
|
|
116
|
+
client: new ClaudeClient({
|
|
117
|
+
apiKey: config.apiKey,
|
|
118
|
+
model: config.model,
|
|
119
|
+
maxTokens: config.maxTokens,
|
|
120
|
+
}),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
// 3. No API key - try Claude CLI
|
|
124
|
+
if (await isClaudeCliAvailable()) {
|
|
125
|
+
return { method: 'cli' };
|
|
126
|
+
}
|
|
127
|
+
// 4. Nothing available
|
|
128
|
+
return {
|
|
129
|
+
method: 'none',
|
|
130
|
+
reason: 'No authentication available',
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Run a prompt through Claude with automatic auth fallback
|
|
135
|
+
*/
|
|
136
|
+
export async function runClaude(options) {
|
|
137
|
+
const config = getClaudeConfig();
|
|
138
|
+
const auth = await determineAuthMethod(config);
|
|
139
|
+
if (auth.method === 'none') {
|
|
140
|
+
// No auth available - offer fallback
|
|
141
|
+
return handleNoAuth(options.contentType, auth.reason);
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
let content;
|
|
145
|
+
if (auth.method === 'api' && auth.client) {
|
|
146
|
+
// Use direct API
|
|
147
|
+
console.log(chalk.dim(`Using Anthropic API (${config.model})...`));
|
|
148
|
+
const result = await auth.client.complete({
|
|
149
|
+
system: options.systemPrompt,
|
|
150
|
+
messages: [{ role: 'user', content: options.prompt }],
|
|
151
|
+
});
|
|
152
|
+
content = result.text;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
// Use Claude CLI
|
|
156
|
+
console.log(chalk.dim('Using Claude Code CLI...'));
|
|
157
|
+
content = await runViaCli(options.prompt, options.systemPrompt);
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
success: true,
|
|
161
|
+
content,
|
|
162
|
+
authMethod: auth.method,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
const errorMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
167
|
+
// If API fails, try CLI as fallback (unless CLI was already tried)
|
|
168
|
+
if (auth.method === 'api' && await isClaudeCliAvailable()) {
|
|
169
|
+
console.log(chalk.yellow('API call failed, trying Claude CLI...'));
|
|
170
|
+
try {
|
|
171
|
+
const content = await runViaCli(options.prompt, options.systemPrompt);
|
|
172
|
+
return {
|
|
173
|
+
success: true,
|
|
174
|
+
content,
|
|
175
|
+
authMethod: 'cli',
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
catch (cliError) {
|
|
179
|
+
// Both failed
|
|
180
|
+
return handleNoAuth(options.contentType, `API error: ${errorMsg}`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return handleNoAuth(options.contentType, errorMsg);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Handle case where no auth is available - offer manual fallback
|
|
188
|
+
*/
|
|
189
|
+
async function handleNoAuth(contentType, reason) {
|
|
190
|
+
console.log();
|
|
191
|
+
console.log(chalk.yellow("Couldn't connect to Claude."));
|
|
192
|
+
if (reason) {
|
|
193
|
+
console.log(chalk.dim(reason));
|
|
194
|
+
}
|
|
195
|
+
console.log();
|
|
196
|
+
console.log('To set up authentication:');
|
|
197
|
+
console.log(` ${chalk.cyan('Option 1:')} Set API key: ${chalk.dim('export ANTHROPIC_API_KEY=sk-ant-...')}`);
|
|
198
|
+
console.log(` ${chalk.cyan('Option 2:')} Configure ghp: ${chalk.dim('ghp config claude.apiKey sk-ant-...')}`);
|
|
199
|
+
console.log(` ${chalk.cyan('Option 3:')} Use Claude CLI: ${chalk.dim('ghp config claude.auth cli')}`);
|
|
200
|
+
console.log();
|
|
201
|
+
if (!isInteractive()) {
|
|
202
|
+
return {
|
|
203
|
+
success: false,
|
|
204
|
+
error: 'No Claude authentication available in non-interactive mode',
|
|
205
|
+
authMethod: 'none',
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
const choice = await promptChoice(`Write ${contentType} manually? [y/N]: `);
|
|
209
|
+
if (choice === 'y' || choice === 'yes') {
|
|
210
|
+
return {
|
|
211
|
+
success: false,
|
|
212
|
+
error: 'User chose to write manually',
|
|
213
|
+
authMethod: 'none',
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
success: false,
|
|
218
|
+
error: 'No authentication available',
|
|
219
|
+
authMethod: 'none',
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Generate content with Claude, with fallback to manual writing
|
|
224
|
+
*
|
|
225
|
+
* Returns the generated content, or null if user wants to write manually
|
|
226
|
+
*/
|
|
227
|
+
export async function generateWithClaude(options) {
|
|
228
|
+
const result = await runClaude(options);
|
|
229
|
+
if (result.success && result.content) {
|
|
230
|
+
return result.content;
|
|
231
|
+
}
|
|
232
|
+
// Check if user chose to write manually
|
|
233
|
+
if (result.error === 'User chose to write manually') {
|
|
234
|
+
return null; // Signal to open editor
|
|
235
|
+
}
|
|
236
|
+
// Other error - already displayed message
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=claude-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-runner.js","sourceRoot":"","sources":["../src/claude-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,eAAe,EAA6B,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,aAA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IAAI,CAAC,aAAa,EAAE,EAAE,CAAC;QACnB,OAAO;YACH,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,4DAA4D;YACnE,UAAU,EAAE,MAAM;SACrB,CAAC;IACN,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,SAAS,WAAW,oBAAoB,CAAC,CAAC;IAE5E,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrC,OAAO;YACH,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,8BAA8B;YACrC,UAAU,EAAE,MAAM;SACrB,CAAC;IACN,CAAC;IAED,OAAO;QACH,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,6BAA6B;QACpC,UAAU,EAAE,MAAM;KACrB,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAA4B;IACjE,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC;IAExC,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnC,OAAO,MAAM,CAAC,OAAO,CAAC;IAC1B,CAAC;IAED,wCAAwC;IACxC,IAAI,MAAM,CAAC,KAAK,KAAK,8BAA8B,EAAE,CAAC;QAClD,OAAO,IAAI,CAAC,CAAC,wBAAwB;IACzC,CAAC;IAED,0CAA0C;IAC1C,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -8,6 +8,16 @@ interface AddIssueOptions {
|
|
|
8
8
|
noTemplate?: boolean;
|
|
9
9
|
/** Use default values for all prompts (non-interactive mode) */
|
|
10
10
|
forceDefaults?: boolean;
|
|
11
|
+
/** Use AI to expand brief description into full issue */
|
|
12
|
+
ai?: boolean;
|
|
13
|
+
/** Parent issue number to link as sub-issue */
|
|
14
|
+
parent?: string;
|
|
15
|
+
/** Labels to apply (comma-separated) */
|
|
16
|
+
labels?: string;
|
|
17
|
+
/** Users to assign (comma-separated, empty for self) */
|
|
18
|
+
assign?: string;
|
|
19
|
+
/** Project fields to set (field=value format, can be multiple) */
|
|
20
|
+
field?: string[];
|
|
11
21
|
}
|
|
12
22
|
export declare function addIssueCommand(title: string, options: AddIssueOptions): Promise<void>;
|
|
13
23
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-issue.d.ts","sourceRoot":"","sources":["../../src/commands/add-issue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-issue.d.ts","sourceRoot":"","sources":["../../src/commands/add-issue.ts"],"names":[],"mappings":"AAgBA,UAAU,eAAe;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gEAAgE;IAChE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,yDAAyD;IACzD,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AA6DD,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA0V5F"}
|