@zibby/cli 0.1.13 ā 0.1.16
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/zibby.js +2 -7
- package/package.json +3 -3
- package/src/commands/init.js +14 -37
- package/src/commands/run.js +0 -33
package/bin/zibby.js
CHANGED
|
@@ -38,7 +38,7 @@ program
|
|
|
38
38
|
.option('--headless', 'Run MCP browser in headless mode (hidden browser)')
|
|
39
39
|
.option('--api-key <key>', 'Zibby API key for cloud sync')
|
|
40
40
|
.option('--cloud-sync', 'Enable cloud sync and install Zibby MCP')
|
|
41
|
-
.option('-m, --mem', 'Enable test memory (initializes Dolt DB
|
|
41
|
+
.option('-m, --mem', 'Enable test memory (initializes Dolt DB and includes memory skill)')
|
|
42
42
|
.action(initCommand);
|
|
43
43
|
|
|
44
44
|
program
|
|
@@ -69,12 +69,7 @@ program
|
|
|
69
69
|
} else if (options.verbose) {
|
|
70
70
|
process.env.ZIBBY_VERBOSE = 'true';
|
|
71
71
|
}
|
|
72
|
-
|
|
73
|
-
process.env.ZIBBY_MEMORY = '1';
|
|
74
|
-
process.env.ZIBBY_EXTRA_SKILLS = process.env.ZIBBY_EXTRA_SKILLS
|
|
75
|
-
? `${process.env.ZIBBY_EXTRA_SKILLS},memory`
|
|
76
|
-
: 'memory';
|
|
77
|
-
}
|
|
72
|
+
// --mem flag is handled by init command when generating files
|
|
78
73
|
return runCommand(specPath, options);
|
|
79
74
|
});
|
|
80
75
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zibby/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "Zibby CLI - Test automation generator and runner",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@aws-sdk/client-sqs": "^3.1000.0",
|
|
35
|
-
"@zibby/skills": "^0.1.
|
|
36
|
-
"@zibby/core": "^0.1.
|
|
35
|
+
"@zibby/skills": "^0.1.2",
|
|
36
|
+
"@zibby/core": "^0.1.13",
|
|
37
37
|
"chalk": "^5.3.0",
|
|
38
38
|
"commander": "^12.0.0",
|
|
39
39
|
"dotenv": "^17.2.3",
|
package/src/commands/init.js
CHANGED
|
@@ -10,14 +10,6 @@ import { fileURLToPath } from 'url';
|
|
|
10
10
|
const __filename = fileURLToPath(import.meta.url);
|
|
11
11
|
const __dirname = dirname(__filename);
|
|
12
12
|
|
|
13
|
-
const MEMORY_ENV_BLOCK = `
|
|
14
|
-
# Test Memory (Dolt-backed ā learns from every run)
|
|
15
|
-
ZIBBY_MEMORY=1
|
|
16
|
-
# ZIBBY_MEMORY_COMPACT_EVERY=1500 # Auto-compact every N runs (0 to disable)
|
|
17
|
-
# ZIBBY_MEMORY_MAX_RUNS=3000 # Max runs per spec to keep
|
|
18
|
-
# ZIBBY_MEMORY_MAX_AGE=1095 # Max age in days for stale data (~3 years)
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
13
|
export async function initCommand(projectName, options) {
|
|
22
14
|
console.log(chalk.bold.cyan('\nš Welcome to Zibby Test Automation!\n'));
|
|
23
15
|
|
|
@@ -169,7 +161,16 @@ export async function initCommand(projectName, options) {
|
|
|
169
161
|
const { readdirSync } = await import('fs');
|
|
170
162
|
const nodeFiles = readdirSync(nodesPath);
|
|
171
163
|
for (const file of nodeFiles) {
|
|
172
|
-
|
|
164
|
+
let content = await readFile(join(nodesPath, file), 'utf-8');
|
|
165
|
+
|
|
166
|
+
// If --mem flag NOT used, remove SKILLS.MEMORY from execute-live.mjs
|
|
167
|
+
if (!options.mem && file === 'execute-live.mjs') {
|
|
168
|
+
content = content.replace(
|
|
169
|
+
'skills: [SKILLS.BROWSER, SKILLS.MEMORY],',
|
|
170
|
+
'skills: [SKILLS.BROWSER],'
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
173
174
|
await writeFile(join(targetZibbyDir, 'nodes', file), content);
|
|
174
175
|
}
|
|
175
176
|
} catch (error) {
|
|
@@ -192,18 +193,6 @@ export async function initCommand(projectName, options) {
|
|
|
192
193
|
await createOrUpdateEnvFile(targetDir, answers.apiKey.trim(), answers, options);
|
|
193
194
|
}
|
|
194
195
|
|
|
195
|
-
// Ensure ZIBBY_MEMORY=1 is in .env when --mem is used (even without API key)
|
|
196
|
-
if (options.mem) {
|
|
197
|
-
const envPath = join(targetDir, '.env');
|
|
198
|
-
if (existsSync(envPath)) {
|
|
199
|
-
const existingEnv = await readFile(envPath, 'utf-8');
|
|
200
|
-
if (!existingEnv.includes('ZIBBY_MEMORY=')) {
|
|
201
|
-
await writeFile(envPath, existingEnv + MEMORY_ENV_BLOCK);
|
|
202
|
-
}
|
|
203
|
-
} else {
|
|
204
|
-
await writeFile(envPath, generateEnvFile(answers, options));
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
196
|
|
|
208
197
|
// Create package.json for new projects only (don't modify existing ones)
|
|
209
198
|
if (isNewProject) {
|
|
@@ -446,8 +435,8 @@ function generateConfig(answers, _options = {}) {
|
|
|
446
435
|
`;
|
|
447
436
|
}
|
|
448
437
|
|
|
449
|
-
function generateEnvFile(answers,
|
|
450
|
-
|
|
438
|
+
function generateEnvFile(answers, _options = {}) {
|
|
439
|
+
const content = `# Zibby Test Automation - Environment Variables
|
|
451
440
|
|
|
452
441
|
# AI Provider Keys
|
|
453
442
|
${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'}
|
|
@@ -461,10 +450,6 @@ ${answers.agent === 'cursor' ? '# Cursor Agent (uses cursor-agent CLI)\n# No API
|
|
|
461
450
|
# SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL
|
|
462
451
|
`;
|
|
463
452
|
|
|
464
|
-
if (options.mem) {
|
|
465
|
-
content += MEMORY_ENV_BLOCK;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
453
|
return content;
|
|
469
454
|
}
|
|
470
455
|
|
|
@@ -486,10 +471,6 @@ async function createOrUpdateEnvFile(targetDir, apiKey, answers, options = {}) {
|
|
|
486
471
|
} else {
|
|
487
472
|
envContent += `\n# Zibby Cloud Sync\nZIBBY_API_KEY=${apiKey}\n`;
|
|
488
473
|
}
|
|
489
|
-
|
|
490
|
-
if (options.mem && !envContent.includes('ZIBBY_MEMORY=')) {
|
|
491
|
-
envContent += MEMORY_ENV_BLOCK;
|
|
492
|
-
}
|
|
493
474
|
} catch (_error) {
|
|
494
475
|
envContent = generateEnvFileWithKey(answers, apiKey, options);
|
|
495
476
|
}
|
|
@@ -500,8 +481,8 @@ async function createOrUpdateEnvFile(targetDir, apiKey, answers, options = {}) {
|
|
|
500
481
|
await writeFile(envPath, envContent);
|
|
501
482
|
}
|
|
502
483
|
|
|
503
|
-
function generateEnvFileWithKey(answers, apiKey,
|
|
504
|
-
|
|
484
|
+
function generateEnvFileWithKey(answers, apiKey, _options = {}) {
|
|
485
|
+
const content = `# Zibby Test Automation - Environment Variables
|
|
505
486
|
|
|
506
487
|
# AI Provider Keys
|
|
507
488
|
${answers.agent === 'claude' ? 'ANTHROPIC_API_KEY=sk-ant-your_key_here\n' : '# ANTHROPIC_API_KEY=sk-ant-your_key_here\n'}
|
|
@@ -513,10 +494,6 @@ ZIBBY_API_KEY=${apiKey}
|
|
|
513
494
|
# SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL
|
|
514
495
|
`;
|
|
515
496
|
|
|
516
|
-
if (options.mem) {
|
|
517
|
-
content += MEMORY_ENV_BLOCK;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
497
|
return content;
|
|
521
498
|
}
|
|
522
499
|
|
package/src/commands/run.js
CHANGED
|
@@ -762,33 +762,6 @@ export async function runCommand(specPath, options) {
|
|
|
762
762
|
console.log(chalk.gray(`Mode: Orphan execution (History tab)`));
|
|
763
763
|
}
|
|
764
764
|
|
|
765
|
-
if (process.env.ZIBBY_MEMORY) {
|
|
766
|
-
try {
|
|
767
|
-
const { DoltDB } = await import('@zibby/memory');
|
|
768
|
-
const doltAvailable = DoltDB.isAvailable();
|
|
769
|
-
const dbExists = existsSync(join(process.cwd(), '.zibby', 'memory', '.dolt'));
|
|
770
|
-
|
|
771
|
-
if (!doltAvailable) {
|
|
772
|
-
console.log(chalk.red(`\nā Memory requires Dolt but it's not installed\n`));
|
|
773
|
-
console.log(chalk.white(` Install:`));
|
|
774
|
-
console.log(chalk.gray(` brew install dolt # macOS`));
|
|
775
|
-
console.log(chalk.gray(` curl -L https://github.com/dolthub/dolt/releases/latest/download/install.sh | sudo bash # Linux\n`));
|
|
776
|
-
console.log(chalk.white(` Then initialize:`));
|
|
777
|
-
console.log(chalk.gray(` zibby init --mem\n`));
|
|
778
|
-
process.exit(1);
|
|
779
|
-
} else if (!dbExists) {
|
|
780
|
-
console.log(chalk.red(`\nā Memory database not initialized\n`));
|
|
781
|
-
console.log(chalk.white(` Run:`));
|
|
782
|
-
console.log(chalk.gray(` zibby init --mem\n`));
|
|
783
|
-
process.exit(1);
|
|
784
|
-
} else {
|
|
785
|
-
console.log(chalk.white(`Memory: ${chalk.green('enabled')}`));
|
|
786
|
-
}
|
|
787
|
-
} catch {
|
|
788
|
-
console.log(chalk.red(`\nā Memory requested but @zibby/memory package is not available\n`));
|
|
789
|
-
process.exit(1);
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
765
|
|
|
793
766
|
console.log(chalk.gray('ā'.repeat(50)));
|
|
794
767
|
|
|
@@ -912,12 +885,6 @@ export async function runCommand(specPath, options) {
|
|
|
912
885
|
spinner.stop();
|
|
913
886
|
}
|
|
914
887
|
|
|
915
|
-
if (process.env.ZIBBY_MEMORY) {
|
|
916
|
-
try {
|
|
917
|
-
const { memoryEndRun } = await import('@zibby/memory');
|
|
918
|
-
memoryEndRun(process.cwd(), { passed: false });
|
|
919
|
-
} catch { /* @zibby/memory not available */ }
|
|
920
|
-
}
|
|
921
888
|
|
|
922
889
|
console.log(chalk.red('\nā Test failed\n'));
|
|
923
890
|
|