@zibby/cli 0.1.14 ā 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/bin/zibby.js +2 -7
- package/package.json +4 -6
- package/src/commands/init.js +32 -28
- 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.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.
|
|
36
|
-
"@zibby/core": "^0.1.
|
|
35
|
+
"@zibby/skills": "^0.1.3",
|
|
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
|
@@ -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
|
|
|
@@ -171,10 +163,10 @@ export async function initCommand(projectName, options) {
|
|
|
171
163
|
for (const file of nodeFiles) {
|
|
172
164
|
let content = await readFile(join(nodesPath, file), 'utf-8');
|
|
173
165
|
|
|
174
|
-
// If --mem flag NOT used, remove
|
|
166
|
+
// If --mem flag NOT used, remove SKILLS.MEMORY from execute-live.mjs
|
|
175
167
|
if (!options.mem && file === 'execute-live.mjs') {
|
|
176
168
|
content = content.replace(
|
|
177
|
-
|
|
169
|
+
'skills: [SKILLS.BROWSER, SKILLS.MEMORY],',
|
|
178
170
|
'skills: [SKILLS.BROWSER],'
|
|
179
171
|
);
|
|
180
172
|
}
|
|
@@ -196,24 +188,28 @@ export async function initCommand(projectName, options) {
|
|
|
196
188
|
const envContent = generateEnvFile(answers, options);
|
|
197
189
|
await writeFile(join(targetDir, '.env.example'), envContent);
|
|
198
190
|
|
|
199
|
-
// Create/update .env file
|
|
191
|
+
// Create/update .env file
|
|
192
|
+
const envPath = join(targetDir, '.env');
|
|
200
193
|
if (answers.apiKey && answers.apiKey.trim()) {
|
|
201
194
|
await createOrUpdateEnvFile(targetDir, answers.apiKey.trim(), answers, options);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
if (options.
|
|
206
|
-
|
|
207
|
-
if (
|
|
208
|
-
|
|
209
|
-
if (!existingEnv.includes('
|
|
210
|
-
|
|
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);
|
|
211
208
|
}
|
|
212
|
-
} else {
|
|
213
|
-
await writeFile(envPath, generateEnvFile(answers, options));
|
|
214
209
|
}
|
|
215
210
|
}
|
|
216
211
|
|
|
212
|
+
|
|
217
213
|
// Create package.json for new projects only (don't modify existing ones)
|
|
218
214
|
if (isNewProject) {
|
|
219
215
|
const packageJsonContent = generatePackageJson(projectNameActual, answers);
|
|
@@ -470,8 +466,14 @@ ${answers.agent === 'cursor' ? '# Cursor Agent (uses cursor-agent CLI)\n# No API
|
|
|
470
466
|
# SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL
|
|
471
467
|
`;
|
|
472
468
|
|
|
469
|
+
// Add memory configuration if --mem flag is used
|
|
473
470
|
if (options.mem) {
|
|
474
|
-
content +=
|
|
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
|
+
`;
|
|
475
477
|
}
|
|
476
478
|
|
|
477
479
|
return content;
|
|
@@ -495,10 +497,6 @@ async function createOrUpdateEnvFile(targetDir, apiKey, answers, options = {}) {
|
|
|
495
497
|
} else {
|
|
496
498
|
envContent += `\n# Zibby Cloud Sync\nZIBBY_API_KEY=${apiKey}\n`;
|
|
497
499
|
}
|
|
498
|
-
|
|
499
|
-
if (options.mem && !envContent.includes('ZIBBY_MEMORY=')) {
|
|
500
|
-
envContent += MEMORY_ENV_BLOCK;
|
|
501
|
-
}
|
|
502
500
|
} catch (_error) {
|
|
503
501
|
envContent = generateEnvFileWithKey(answers, apiKey, options);
|
|
504
502
|
}
|
|
@@ -522,8 +520,14 @@ ZIBBY_API_KEY=${apiKey}
|
|
|
522
520
|
# SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL
|
|
523
521
|
`;
|
|
524
522
|
|
|
523
|
+
// Add memory configuration if --mem flag is used
|
|
525
524
|
if (options.mem) {
|
|
526
|
-
content +=
|
|
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
|
+
`;
|
|
527
531
|
}
|
|
528
532
|
|
|
529
533
|
return content;
|
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
|
|