@zibby/cli 0.1.16 → 0.1.17
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 +3 -5
- package/src/commands/init.js +41 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zibby/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "Zibby CLI - Test automation generator and runner",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,8 +32,9 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@aws-sdk/client-sqs": "^3.1000.0",
|
|
35
|
-
"@zibby/skills": "^0.1.
|
|
35
|
+
"@zibby/skills": "^0.1.3",
|
|
36
36
|
"@zibby/core": "^0.1.13",
|
|
37
|
+
"@zibby/memory": "^0.1.3",
|
|
37
38
|
"chalk": "^5.3.0",
|
|
38
39
|
"commander": "^12.0.0",
|
|
39
40
|
"dotenv": "^17.2.3",
|
|
@@ -55,9 +56,6 @@
|
|
|
55
56
|
"engines": {
|
|
56
57
|
"node": ">=18.0.0"
|
|
57
58
|
},
|
|
58
|
-
"optionalDependencies": {
|
|
59
|
-
"@zibby/memory": "*"
|
|
60
|
-
},
|
|
61
59
|
"devDependencies": {
|
|
62
60
|
"vitest": "^4.0.18"
|
|
63
61
|
}
|
package/src/commands/init.js
CHANGED
|
@@ -188,9 +188,25 @@ export async function initCommand(projectName, options) {
|
|
|
188
188
|
const envContent = generateEnvFile(answers, options);
|
|
189
189
|
await writeFile(join(targetDir, '.env.example'), envContent);
|
|
190
190
|
|
|
191
|
-
// Create/update .env file
|
|
191
|
+
// Create/update .env file
|
|
192
|
+
const envPath = join(targetDir, '.env');
|
|
192
193
|
if (answers.apiKey && answers.apiKey.trim()) {
|
|
193
194
|
await createOrUpdateEnvFile(targetDir, answers.apiKey.trim(), answers, options);
|
|
195
|
+
} else if (!existsSync(envPath)) {
|
|
196
|
+
// Create .env from .env.example if it doesn't exist
|
|
197
|
+
await writeFile(envPath, envContent);
|
|
198
|
+
} else if (options.force) {
|
|
199
|
+
// On force reinit, merge memory vars into existing .env if using --mem
|
|
200
|
+
if (options.mem) {
|
|
201
|
+
let existingEnv = await readFile(envPath, 'utf-8');
|
|
202
|
+
if (!existingEnv.includes('ZIBBY_MEMORY_MAX_RUNS')) {
|
|
203
|
+
existingEnv += `\n# Test Memory (Dolt DB) - Auto-compaction settings\n`;
|
|
204
|
+
existingEnv += `# ZIBBY_MEMORY_MAX_RUNS=3000 # Max test runs to keep per spec\n`;
|
|
205
|
+
existingEnv += `# ZIBBY_MEMORY_MAX_AGE=1095 # Max age in days for stale data (~3 years)\n`;
|
|
206
|
+
existingEnv += `# ZIBBY_MEMORY_COMPACT_EVERY=1500 # Auto-compact every N runs (0 to disable)\n`;
|
|
207
|
+
await writeFile(envPath, existingEnv);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
194
210
|
}
|
|
195
211
|
|
|
196
212
|
|
|
@@ -435,8 +451,8 @@ function generateConfig(answers, _options = {}) {
|
|
|
435
451
|
`;
|
|
436
452
|
}
|
|
437
453
|
|
|
438
|
-
function generateEnvFile(answers,
|
|
439
|
-
|
|
454
|
+
function generateEnvFile(answers, options = {}) {
|
|
455
|
+
let content = `# Zibby Test Automation - Environment Variables
|
|
440
456
|
|
|
441
457
|
# AI Provider Keys
|
|
442
458
|
${answers.agent === 'claude' ? '# Claude (Anthropic) - Direct API\nANTHROPIC_API_KEY=sk-ant-your_key_here\n' : '# ANTHROPIC_API_KEY=sk-ant-your_key_here\n'}
|
|
@@ -450,6 +466,16 @@ ${answers.agent === 'cursor' ? '# Cursor Agent (uses cursor-agent CLI)\n# No API
|
|
|
450
466
|
# SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL
|
|
451
467
|
`;
|
|
452
468
|
|
|
469
|
+
// Add memory configuration if --mem flag is used
|
|
470
|
+
if (options.mem) {
|
|
471
|
+
content += `
|
|
472
|
+
# Test Memory (Dolt DB) - Auto-compaction settings
|
|
473
|
+
# ZIBBY_MEMORY_MAX_RUNS=3000 # Max test runs to keep per spec
|
|
474
|
+
# ZIBBY_MEMORY_MAX_AGE=1095 # Max age in days for stale data (~3 years)
|
|
475
|
+
# ZIBBY_MEMORY_COMPACT_EVERY=1500 # Auto-compact every N runs (0 to disable)
|
|
476
|
+
`;
|
|
477
|
+
}
|
|
478
|
+
|
|
453
479
|
return content;
|
|
454
480
|
}
|
|
455
481
|
|
|
@@ -481,8 +507,8 @@ async function createOrUpdateEnvFile(targetDir, apiKey, answers, options = {}) {
|
|
|
481
507
|
await writeFile(envPath, envContent);
|
|
482
508
|
}
|
|
483
509
|
|
|
484
|
-
function generateEnvFileWithKey(answers, apiKey,
|
|
485
|
-
|
|
510
|
+
function generateEnvFileWithKey(answers, apiKey, options = {}) {
|
|
511
|
+
let content = `# Zibby Test Automation - Environment Variables
|
|
486
512
|
|
|
487
513
|
# AI Provider Keys
|
|
488
514
|
${answers.agent === 'claude' ? 'ANTHROPIC_API_KEY=sk-ant-your_key_here\n' : '# ANTHROPIC_API_KEY=sk-ant-your_key_here\n'}
|
|
@@ -494,6 +520,16 @@ ZIBBY_API_KEY=${apiKey}
|
|
|
494
520
|
# SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL
|
|
495
521
|
`;
|
|
496
522
|
|
|
523
|
+
// Add memory configuration if --mem flag is used
|
|
524
|
+
if (options.mem) {
|
|
525
|
+
content += `
|
|
526
|
+
# Test Memory (Dolt DB) - Auto-compaction settings
|
|
527
|
+
# ZIBBY_MEMORY_MAX_RUNS=3000 # Max test runs to keep per spec
|
|
528
|
+
# ZIBBY_MEMORY_MAX_AGE=1095 # Max age in days for stale data (~3 years)
|
|
529
|
+
# ZIBBY_MEMORY_COMPACT_EVERY=1500 # Auto-compact every N runs (0 to disable)
|
|
530
|
+
`;
|
|
531
|
+
}
|
|
532
|
+
|
|
497
533
|
return content;
|
|
498
534
|
}
|
|
499
535
|
|