@warpmetrics/coder 0.2.1 → 0.2.2
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/bin/cli.js +37 -12
- package/package.json +1 -1
- package/src/claude.js +5 -2
- package/src/reflect.js +1 -0
package/bin/cli.js
CHANGED
|
@@ -58,14 +58,24 @@ async function runInit() {
|
|
|
58
58
|
log(' warp-coder — set up agent config');
|
|
59
59
|
log('');
|
|
60
60
|
|
|
61
|
-
// 1.
|
|
61
|
+
// 1. Ensure gh has the right scopes
|
|
62
|
+
log(' Ensuring GitHub CLI has required scopes (project, repo)...');
|
|
63
|
+
try {
|
|
64
|
+
execSync('gh auth refresh -s project,repo', { stdio: 'inherit' });
|
|
65
|
+
log(' \u2713 GitHub CLI scopes updated');
|
|
66
|
+
} catch {
|
|
67
|
+
log(' \u26a0 Could not refresh gh scopes — run manually: gh auth refresh -s project,repo');
|
|
68
|
+
}
|
|
69
|
+
log('');
|
|
70
|
+
|
|
71
|
+
// 2. WarpMetrics API key
|
|
62
72
|
const wmKey = await ask(' ? WarpMetrics API key (get one at warpmetrics.com/app/api-keys): ');
|
|
63
73
|
if (wmKey && !wmKey.startsWith('wm_')) {
|
|
64
74
|
log(' \u26a0 Warning: key doesn\'t start with wm_ — make sure this is a valid WarpMetrics API key');
|
|
65
75
|
}
|
|
66
76
|
log('');
|
|
67
77
|
|
|
68
|
-
//
|
|
78
|
+
// 3. Repo URL
|
|
69
79
|
let repoDefault = '';
|
|
70
80
|
try {
|
|
71
81
|
repoDefault = execSync('git remote get-url origin', { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
|
|
@@ -79,7 +89,7 @@ async function runInit() {
|
|
|
79
89
|
}
|
|
80
90
|
log('');
|
|
81
91
|
|
|
82
|
-
//
|
|
92
|
+
// 4. Board provider
|
|
83
93
|
log(' Board: GitHub Projects v2');
|
|
84
94
|
const projectNumber = await ask(' ? Project number: ');
|
|
85
95
|
if (!projectNumber) {
|
|
@@ -96,7 +106,7 @@ async function runInit() {
|
|
|
96
106
|
const owner = ownerInput || ownerDefault;
|
|
97
107
|
log('');
|
|
98
108
|
|
|
99
|
-
//
|
|
109
|
+
// 5. Discover field IDs and column names
|
|
100
110
|
let columns = { todo: 'Todo', inProgress: 'In Progress', inReview: 'In Review', done: 'Done', blocked: 'Blocked' };
|
|
101
111
|
try {
|
|
102
112
|
log(' Discovering project fields...');
|
|
@@ -119,7 +129,7 @@ async function runInit() {
|
|
|
119
129
|
log('');
|
|
120
130
|
}
|
|
121
131
|
|
|
122
|
-
//
|
|
132
|
+
// 6. Build config
|
|
123
133
|
const config = {
|
|
124
134
|
board: {
|
|
125
135
|
provider: 'github-projects',
|
|
@@ -141,13 +151,29 @@ async function runInit() {
|
|
|
141
151
|
config.warpmetricsApiKey = wmKey;
|
|
142
152
|
}
|
|
143
153
|
|
|
144
|
-
//
|
|
154
|
+
// 7. Write config
|
|
145
155
|
const configDir = '.warp-coder';
|
|
146
156
|
mkdirSync(configDir, { recursive: true });
|
|
147
157
|
writeFileSync(join(configDir, 'config.json'), JSON.stringify(config, null, 2) + '\n');
|
|
148
158
|
log(` \u2713 ${configDir}/config.json created`);
|
|
149
159
|
|
|
150
|
-
//
|
|
160
|
+
// 8. Add to .gitignore
|
|
161
|
+
const gitignorePath = '.gitignore';
|
|
162
|
+
const entry = '.warp-coder/';
|
|
163
|
+
if (existsSync(gitignorePath)) {
|
|
164
|
+
const content = readFileSync(gitignorePath, 'utf-8');
|
|
165
|
+
if (!content.split('\n').some(line => line.trim() === entry)) {
|
|
166
|
+
writeFileSync(gitignorePath, content.trimEnd() + '\n' + entry + '\n');
|
|
167
|
+
log(` \u2713 Added ${entry} to .gitignore`);
|
|
168
|
+
} else {
|
|
169
|
+
log(` \u2713 ${entry} already in .gitignore`);
|
|
170
|
+
}
|
|
171
|
+
} else {
|
|
172
|
+
writeFileSync(gitignorePath, entry + '\n');
|
|
173
|
+
log(` \u2713 Created .gitignore with ${entry}`);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// 9. Register outcome classifications
|
|
151
177
|
if (wmKey) {
|
|
152
178
|
log(' Registering outcome classifications with WarpMetrics...');
|
|
153
179
|
try {
|
|
@@ -159,13 +185,12 @@ async function runInit() {
|
|
|
159
185
|
}
|
|
160
186
|
}
|
|
161
187
|
|
|
162
|
-
//
|
|
188
|
+
// 10. Next steps
|
|
163
189
|
log('');
|
|
164
190
|
log(' Done! Next steps:');
|
|
165
|
-
log(' 1.
|
|
166
|
-
log(' 2.
|
|
167
|
-
log(' 3.
|
|
168
|
-
log(' 4. View pipeline analytics at https://app.warpmetrics.com');
|
|
191
|
+
log(' 1. Run: warp-coder watch');
|
|
192
|
+
log(' 2. Add issues to the "Ready" column of your project board');
|
|
193
|
+
log(' 3. View pipeline analytics at https://app.warpmetrics.com');
|
|
169
194
|
log('');
|
|
170
195
|
} finally {
|
|
171
196
|
rl.close();
|
package/package.json
CHANGED
package/src/claude.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn } from 'child_process';
|
|
2
2
|
|
|
3
|
-
export function run({ prompt, workdir, allowedTools = 'Bash,Read,Edit,Write,Glob,Grep', maxTurns }) {
|
|
3
|
+
export function run({ prompt, workdir, allowedTools = 'Bash,Read,Edit,Write,Glob,Grep', maxTurns, verbose = true }) {
|
|
4
4
|
return new Promise((resolve, reject) => {
|
|
5
5
|
const args = ['-p', prompt, '--output-format', 'json', '--allowedTools', allowedTools];
|
|
6
6
|
if (maxTurns) args.push('--max-turns', String(maxTurns));
|
|
@@ -13,7 +13,10 @@ export function run({ prompt, workdir, allowedTools = 'Bash,Read,Edit,Write,Glob
|
|
|
13
13
|
let stdout = '';
|
|
14
14
|
let stderr = '';
|
|
15
15
|
proc.stdout.on('data', d => { stdout += d; });
|
|
16
|
-
proc.stderr.on('data', d => {
|
|
16
|
+
proc.stderr.on('data', d => {
|
|
17
|
+
stderr += d;
|
|
18
|
+
if (verbose) process.stderr.write(d);
|
|
19
|
+
});
|
|
17
20
|
|
|
18
21
|
proc.on('close', code => {
|
|
19
22
|
if (code !== 0) {
|
package/src/reflect.js
CHANGED
|
@@ -65,6 +65,7 @@ export async function reflect({ configDir, step, issue, prNumber, success, error
|
|
|
65
65
|
workdir: process.cwd(),
|
|
66
66
|
allowedTools: '',
|
|
67
67
|
maxTurns: 1,
|
|
68
|
+
verbose: false,
|
|
68
69
|
});
|
|
69
70
|
|
|
70
71
|
const content = typeof result.result === 'string' ? result.result : JSON.stringify(result.result);
|