create-claude-workspace 1.1.119 → 1.1.121
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.
|
@@ -199,6 +199,22 @@ function notify(cmd, type, message, iteration) {
|
|
|
199
199
|
}
|
|
200
200
|
catch { /* */ }
|
|
201
201
|
}
|
|
202
|
+
function checkAuth() {
|
|
203
|
+
// Check if Claude Code has credentials (API key or OAuth session)
|
|
204
|
+
if (process.env.ANTHROPIC_API_KEY)
|
|
205
|
+
return true;
|
|
206
|
+
try {
|
|
207
|
+
const home = process.env.HOME || process.env.USERPROFILE || '';
|
|
208
|
+
const creds = resolve(home, '.claude', '.credentials.json');
|
|
209
|
+
if (existsSync(creds)) {
|
|
210
|
+
const data = JSON.parse(readFileSync(creds, 'utf-8'));
|
|
211
|
+
if (data.claudeAiOauth?.accessToken)
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
catch { /* */ }
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
202
218
|
function acquireLock(dir) {
|
|
203
219
|
const lockFile = resolve(dir, '.claude/autonomous.lock');
|
|
204
220
|
if (existsSync(lockFile)) {
|
|
@@ -263,6 +279,14 @@ async function main() {
|
|
|
263
279
|
log('Autonomous development loop starting.');
|
|
264
280
|
log(`Project: ${opts.projectDir}`);
|
|
265
281
|
log(`Iterations: ${opts.maxIterations} | Turns: ${opts.maxTurns}`);
|
|
282
|
+
// Auth check
|
|
283
|
+
if (!checkAuth()) {
|
|
284
|
+
log('ERROR: Not authenticated. Either:');
|
|
285
|
+
log(' 1. Set ANTHROPIC_API_KEY env var (API billing), or');
|
|
286
|
+
log(' 2. Run `claude login` to authenticate with Claude Max plan');
|
|
287
|
+
log(' For Docker: mount ~/.claude/.credentials.json into the container');
|
|
288
|
+
process.exit(1);
|
|
289
|
+
}
|
|
266
290
|
// Lock
|
|
267
291
|
if (!opts.noLock && !acquireLock(opts.projectDir)) {
|
|
268
292
|
process.exit(1);
|
|
@@ -356,10 +380,29 @@ async function main() {
|
|
|
356
380
|
...resumeOpts,
|
|
357
381
|
},
|
|
358
382
|
})) {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
383
|
+
const msg = message;
|
|
384
|
+
switch (message.type) {
|
|
385
|
+
case 'assistant': {
|
|
386
|
+
const content = msg.message?.content;
|
|
387
|
+
if (Array.isArray(content)) {
|
|
388
|
+
for (const block of content) {
|
|
389
|
+
if (block.type === 'text')
|
|
390
|
+
log(`Claude: ${block.text.slice(0, 500)}`);
|
|
391
|
+
if (block.type === 'tool_use')
|
|
392
|
+
log(`Tool: ${block.name} ${JSON.stringify(block.input).slice(0, 200)}`);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
case 'result':
|
|
398
|
+
checkpoint.lastSessionId = msg.session_id ?? null;
|
|
399
|
+
log(`Result: ${JSON.stringify(msg).slice(0, 300)}`);
|
|
400
|
+
break;
|
|
401
|
+
case 'system':
|
|
402
|
+
log(`System: ${msg.message ?? JSON.stringify(msg).slice(0, 200)}`);
|
|
403
|
+
break;
|
|
404
|
+
default:
|
|
405
|
+
log(`[${message.type}] ${JSON.stringify(msg).slice(0, 200)}`);
|
|
363
406
|
}
|
|
364
407
|
}
|
|
365
408
|
checkpoint.stats.iterations++;
|
|
@@ -329,7 +329,9 @@ async function main() {
|
|
|
329
329
|
}
|
|
330
330
|
// 2. Build
|
|
331
331
|
step('2/4 Building container image...');
|
|
332
|
-
|
|
332
|
+
// Always use --pull to pick up base image updates; --no-cache only on explicit --rebuild
|
|
333
|
+
const buildArgs = opts.rebuild ? ['build', '--no-cache', '--pull'] : ['build', '--pull', '-q'];
|
|
334
|
+
const buildResult = compose(buildArgs);
|
|
333
335
|
if (buildResult.status !== 0) {
|
|
334
336
|
error('Docker image build failed. Fix the errors above and re-run.');
|
|
335
337
|
process.exit(1);
|