create-claude-workspace 1.1.19 → 1.1.20
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/dist/index.js +42 -13
- package/dist/template/.claude/scripts/autonomous.mjs +448 -605
- package/dist/template/.claude/scripts/docker-run.mjs +266 -292
- package/dist/template/.claude/scripts/lib/claude-runner.mjs +402 -0
- package/dist/template/.claude/scripts/lib/errors.mjs +83 -0
- package/dist/template/.claude/scripts/lib/logger.mjs +59 -0
- package/dist/template/.claude/scripts/lib/state.mjs +65 -0
- package/dist/template/.claude/scripts/lib/types.mjs +20 -0
- package/dist/template/.claude/scripts/lib/utils.mjs +279 -0
- package/dist/template/.claude/templates/PLAN.md +76 -0
- package/package.json +6 -3
package/dist/index.js
CHANGED
|
@@ -60,23 +60,34 @@ function printHelp() {
|
|
|
60
60
|
${C.b}create-claude-workspace${C.n} — Scaffold autonomous AI-driven development with Claude Code
|
|
61
61
|
|
|
62
62
|
${C.b}Usage:${C.n}
|
|
63
|
-
npx create-claude-workspace [directory] [options]
|
|
63
|
+
npx create-claude-workspace [directory] [options] # scaffold
|
|
64
|
+
npx create-claude-workspace run [options] # autonomous loop
|
|
65
|
+
npx create-claude-workspace docker [options] # Docker runner
|
|
66
|
+
npx create-claude-workspace validate # check prerequisites
|
|
64
67
|
|
|
65
|
-
${C.b}
|
|
68
|
+
${C.b}Scaffold options:${C.n}
|
|
66
69
|
directory Target directory (default: current directory)
|
|
67
|
-
|
|
68
|
-
${C.b}Options:${C.n}
|
|
69
70
|
--update Overwrite existing agent files with latest version
|
|
70
71
|
--run Start autonomous development after scaffolding
|
|
71
72
|
--docker Use Docker for autonomous run (implies --run)
|
|
72
73
|
-h, --help Show this help
|
|
73
74
|
|
|
75
|
+
${C.b}Run options:${C.n}
|
|
76
|
+
--max-iterations <n> Max iterations (default: 50)
|
|
77
|
+
--max-turns <n> Max turns per invocation (default: 50)
|
|
78
|
+
--process-timeout <ms> Max time per invocation (default: 1800000)
|
|
79
|
+
--activity-timeout <ms> Max silence before kill (default: 300000)
|
|
80
|
+
--notify-command <cmd> Shell command on critical events
|
|
81
|
+
--resume Resume from checkpoint
|
|
82
|
+
--dry-run Validate prerequisites only
|
|
83
|
+
See 'node .claude/scripts/autonomous.mjs --help' for all options.
|
|
84
|
+
|
|
74
85
|
${C.b}Examples:${C.n}
|
|
75
86
|
npx create-claude-workspace # scaffold in current directory
|
|
76
|
-
npx create-claude-workspace
|
|
77
|
-
npx create-claude-workspace --
|
|
78
|
-
npx create-claude-workspace
|
|
79
|
-
npx create-claude-workspace
|
|
87
|
+
npx create-claude-workspace run # start autonomous loop
|
|
88
|
+
npx create-claude-workspace run --resume # resume from checkpoint
|
|
89
|
+
npx create-claude-workspace docker # run in Docker
|
|
90
|
+
npx create-claude-workspace validate # check prerequisites
|
|
80
91
|
|
|
81
92
|
${C.b}What it creates:${C.n}
|
|
82
93
|
.claude/agents/ 10 specialist agents (orchestrator, architects, etc.)
|
|
@@ -90,6 +101,7 @@ ${C.b}What it creates:${C.n}
|
|
|
90
101
|
function ask(question) {
|
|
91
102
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
92
103
|
return new Promise((res) => {
|
|
104
|
+
rl.on('close', () => res(''));
|
|
93
105
|
rl.question(question, (answer) => {
|
|
94
106
|
rl.close();
|
|
95
107
|
res(answer.trim());
|
|
@@ -116,12 +128,14 @@ function listFiles(dir, base = dir) {
|
|
|
116
128
|
}
|
|
117
129
|
function ensureGitignore(targetDir) {
|
|
118
130
|
const gitignorePath = join(targetDir, '.gitignore');
|
|
119
|
-
const entries = ['.npmrc', '.docker-compose.auth.yml'];
|
|
131
|
+
const entries = ['.npmrc', '.docker-compose.auth.yml', '.claude/autonomous.log', '.claude/autonomous.lock', '.claude/autonomous-state.json'];
|
|
120
132
|
if (existsSync(gitignorePath)) {
|
|
121
133
|
let content = readFileSync(gitignorePath, 'utf-8');
|
|
122
134
|
const added = [];
|
|
135
|
+
if (!content.endsWith('\n'))
|
|
136
|
+
content += '\n';
|
|
123
137
|
for (const entry of entries) {
|
|
124
|
-
if (!content.
|
|
138
|
+
if (!content.split('\n').some(line => line.trim() === entry)) {
|
|
125
139
|
content += `\n${entry}`;
|
|
126
140
|
added.push(entry);
|
|
127
141
|
}
|
|
@@ -133,9 +147,9 @@ function ensureGitignore(targetDir) {
|
|
|
133
147
|
}
|
|
134
148
|
}
|
|
135
149
|
// ─── Run ───
|
|
136
|
-
function runAutonomous(targetDir, docker) {
|
|
150
|
+
function runAutonomous(targetDir, docker, extraArgs = []) {
|
|
137
151
|
const script = docker ? '.claude/scripts/docker-run.mjs' : '.claude/scripts/autonomous.mjs';
|
|
138
|
-
const args = docker ? [script] : [script, '--skip-permissions'];
|
|
152
|
+
const args = docker ? [script, ...extraArgs] : [script, '--skip-permissions', ...extraArgs];
|
|
139
153
|
if (docker) {
|
|
140
154
|
info('Starting Docker-based autonomous development...');
|
|
141
155
|
}
|
|
@@ -146,12 +160,27 @@ function runAutonomous(targetDir, docker) {
|
|
|
146
160
|
const child = spawn('node', args, {
|
|
147
161
|
cwd: targetDir,
|
|
148
162
|
stdio: 'inherit',
|
|
149
|
-
shell: true,
|
|
150
163
|
});
|
|
151
164
|
child.on('close', (code) => process.exit(code ?? 0));
|
|
152
165
|
}
|
|
153
166
|
// ─── Main ───
|
|
154
167
|
async function main() {
|
|
168
|
+
// Subcommand routing: run, docker, validate, plan
|
|
169
|
+
const firstArg = process.argv[2];
|
|
170
|
+
if (firstArg === 'run') {
|
|
171
|
+
const extraArgs = process.argv.slice(3);
|
|
172
|
+
runAutonomous(process.cwd(), false, extraArgs);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (firstArg === 'docker') {
|
|
176
|
+
const extraArgs = process.argv.slice(3);
|
|
177
|
+
runAutonomous(process.cwd(), true, extraArgs);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (firstArg === 'validate') {
|
|
181
|
+
runAutonomous(process.cwd(), false, ['--dry-run']);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
155
184
|
const opts = parseArgs();
|
|
156
185
|
if (opts.help) {
|
|
157
186
|
printHelp();
|