@zibby/cli 0.1.12 → 0.1.14
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 +1 -1
- package/package.json +2 -2
- package/src/commands/init.js +21 -23
- package/src/commands/run.js +1 -16
package/bin/zibby.js
CHANGED
|
@@ -57,7 +57,7 @@ program
|
|
|
57
57
|
.option('--folder <path>', 'Folder path within collection (optional, requires --collection)')
|
|
58
58
|
.option('--sync', 'Force upload to cloud (overrides cloudSync: false)')
|
|
59
59
|
.option('--no-sync', 'Skip upload to cloud (overrides cloudSync: true)')
|
|
60
|
-
.option('--config <path>', 'Path to config file', '.zibby.config.
|
|
60
|
+
.option('--config <path>', 'Path to config file', '.zibby.config.mjs')
|
|
61
61
|
.option('--auto-approve', 'Auto-approve MCP tools (for CI/CD)')
|
|
62
62
|
.option('-o, --open', 'Open test results in browser after completion')
|
|
63
63
|
.option('--verbose', 'Show info level logs')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zibby/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "Zibby CLI - Test automation generator and runner",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@aws-sdk/client-sqs": "^3.1000.0",
|
|
35
35
|
"@zibby/skills": "^0.1.0",
|
|
36
|
-
"@zibby/core": "^0.1.
|
|
36
|
+
"@zibby/core": "^0.1.11",
|
|
37
37
|
"chalk": "^5.3.0",
|
|
38
38
|
"commander": "^12.0.0",
|
|
39
39
|
"dotenv": "^17.2.3",
|
package/src/commands/init.js
CHANGED
|
@@ -32,9 +32,9 @@ export async function initCommand(projectName, options) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// If in existing directory, check if already initialized (unless --force)
|
|
35
|
-
if (!isNewProject && existsSync(join(targetDir, '.zibby.config.
|
|
35
|
+
if (!isNewProject && existsSync(join(targetDir, '.zibby.config.mjs')) && !options.force) {
|
|
36
36
|
console.log(chalk.yellow('\n⚠️ Zibby is already initialized in this directory!\n'));
|
|
37
|
-
console.log(chalk.white('Config file found: .zibby.config.
|
|
37
|
+
console.log(chalk.white('Config file found: .zibby.config.mjs'));
|
|
38
38
|
console.log(chalk.gray('Use --force or -f to reinitialize\n'));
|
|
39
39
|
process.exit(0);
|
|
40
40
|
}
|
|
@@ -150,14 +150,14 @@ export async function initCommand(projectName, options) {
|
|
|
150
150
|
const { graphPath, nodesPath, readmePath, resultHandlerPath } = TemplateFactory.getTemplateFiles(templateName);
|
|
151
151
|
const targetZibbyDir = join(targetDir, '.zibby');
|
|
152
152
|
|
|
153
|
-
// Copy graph.
|
|
153
|
+
// Copy graph.mjs
|
|
154
154
|
const graphTemplate = await readFile(graphPath, 'utf-8');
|
|
155
|
-
await writeFile(join(targetZibbyDir, 'graph.
|
|
155
|
+
await writeFile(join(targetZibbyDir, 'graph.mjs'), graphTemplate);
|
|
156
156
|
|
|
157
|
-
// Copy result-handler.
|
|
157
|
+
// Copy result-handler.mjs (workflow-specific post-processing)
|
|
158
158
|
if (resultHandlerPath) {
|
|
159
159
|
const rhTemplate = await readFile(resultHandlerPath, 'utf-8');
|
|
160
|
-
await writeFile(join(targetZibbyDir, 'result-handler.
|
|
160
|
+
await writeFile(join(targetZibbyDir, 'result-handler.mjs'), rhTemplate);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
// Copy README
|
|
@@ -169,7 +169,16 @@ export async function initCommand(projectName, options) {
|
|
|
169
169
|
const { readdirSync } = await import('fs');
|
|
170
170
|
const nodeFiles = readdirSync(nodesPath);
|
|
171
171
|
for (const file of nodeFiles) {
|
|
172
|
-
|
|
172
|
+
let content = await readFile(join(nodesPath, file), 'utf-8');
|
|
173
|
+
|
|
174
|
+
// If --mem flag NOT used, remove memory skill from execute-live.mjs
|
|
175
|
+
if (!options.mem && file === 'execute-live.mjs') {
|
|
176
|
+
content = content.replace(
|
|
177
|
+
/skills: \[SKILLS\.BROWSER, \.\.\.\(process\.env\.ZIBBY_MEMORY \? \[SKILLS\.MEMORY\] : \[\]\)\],/,
|
|
178
|
+
'skills: [SKILLS.BROWSER],'
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
173
182
|
await writeFile(join(targetZibbyDir, 'nodes', file), content);
|
|
174
183
|
}
|
|
175
184
|
} catch (error) {
|
|
@@ -181,7 +190,7 @@ export async function initCommand(projectName, options) {
|
|
|
181
190
|
|
|
182
191
|
// Always create Zibby config
|
|
183
192
|
const configContent = generateConfig(answers, options);
|
|
184
|
-
await writeFile(join(targetDir, '.zibby.config.
|
|
193
|
+
await writeFile(join(targetDir, '.zibby.config.mjs'), configContent);
|
|
185
194
|
|
|
186
195
|
// Always create .env.example
|
|
187
196
|
const envContent = generateEnvFile(answers, options);
|
|
@@ -205,21 +214,10 @@ export async function initCommand(projectName, options) {
|
|
|
205
214
|
}
|
|
206
215
|
}
|
|
207
216
|
|
|
208
|
-
// Create package.json for new projects
|
|
217
|
+
// Create package.json for new projects only (don't modify existing ones)
|
|
209
218
|
if (isNewProject) {
|
|
210
219
|
const packageJsonContent = generatePackageJson(projectNameActual, answers);
|
|
211
220
|
await writeFile(join(targetDir, 'package.json'), packageJsonContent);
|
|
212
|
-
} else if (!existsSync(join(targetDir, 'package.json'))) {
|
|
213
|
-
const minimalPkg = JSON.stringify({ type: 'module', private: true }, null, 2);
|
|
214
|
-
await writeFile(join(targetDir, 'package.json'), minimalPkg);
|
|
215
|
-
} else {
|
|
216
|
-
try {
|
|
217
|
-
const existingPkg = JSON.parse(await readFile(join(targetDir, 'package.json'), 'utf-8'));
|
|
218
|
-
if (!existingPkg.type) {
|
|
219
|
-
existingPkg.type = 'module';
|
|
220
|
-
await writeFile(join(targetDir, 'package.json'), JSON.stringify(existingPkg, null, 2));
|
|
221
|
-
}
|
|
222
|
-
} catch { /* leave existing package.json alone if unparseable */ }
|
|
223
221
|
}
|
|
224
222
|
|
|
225
223
|
// Create .gitignore if doesn't exist
|
|
@@ -715,7 +713,7 @@ npx playwright test --ui
|
|
|
715
713
|
|
|
716
714
|
## Configuration
|
|
717
715
|
|
|
718
|
-
Edit \`.zibby.config.
|
|
716
|
+
Edit \`.zibby.config.mjs\` to customize:
|
|
719
717
|
- Agent settings (model, temperature)
|
|
720
718
|
- Browser settings (headless, viewport)
|
|
721
719
|
- Cloud sync${answers.cloudSync ? ' (enabled)' : ' (disabled)'}
|
|
@@ -726,11 +724,11 @@ Edit \`.zibby.config.js\` to customize:
|
|
|
726
724
|
\`\`\`
|
|
727
725
|
${projectName}/
|
|
728
726
|
├── .zibby/
|
|
729
|
-
│ ├── graph.
|
|
727
|
+
│ ├── graph.mjs # Workflow definition
|
|
730
728
|
│ ├── nodes/ # Custom nodes
|
|
731
729
|
│ └── output/ # Workflow execution results (gitignored)
|
|
732
730
|
│ └── sessions/ # Session artifacts & recordings
|
|
733
|
-
├── .zibby.config.
|
|
731
|
+
├── .zibby.config.mjs # Configuration
|
|
734
732
|
├── .env # API keys (gitignored)
|
|
735
733
|
├── test-specs/ # Test specifications (committed)
|
|
736
734
|
│ └── examples/
|
package/src/commands/run.js
CHANGED
|
@@ -24,20 +24,6 @@ envFiles.forEach(envFile => {
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
function ensureEsmPackageJson(dir) {
|
|
28
|
-
const pkgPath = resolve(dir, 'package.json');
|
|
29
|
-
try {
|
|
30
|
-
if (existsSync(pkgPath)) {
|
|
31
|
-
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
32
|
-
if (!pkg.type) {
|
|
33
|
-
pkg.type = 'module';
|
|
34
|
-
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
35
|
-
}
|
|
36
|
-
} else {
|
|
37
|
-
writeFileSync(pkgPath, JSON.stringify({ type: 'module', private: true }, null, 2) + '\n');
|
|
38
|
-
}
|
|
39
|
-
} catch { /* leave it alone */ }
|
|
40
|
-
}
|
|
41
27
|
|
|
42
28
|
function getGeneratedTestPath(specPath, config) {
|
|
43
29
|
const specsDir = config?.paths?.specs || 'test-specs';
|
|
@@ -590,7 +576,6 @@ export async function runCommand(specPath, options) {
|
|
|
590
576
|
playwrightArtifacts: true, // Enable trace.zip generation for exact selectors
|
|
591
577
|
};
|
|
592
578
|
|
|
593
|
-
ensureEsmPackageJson(process.cwd());
|
|
594
579
|
const configPath = resolve(process.cwd(), options.config);
|
|
595
580
|
if (existsSync(configPath)) {
|
|
596
581
|
try {
|
|
@@ -813,7 +798,7 @@ export async function runCommand(specPath, options) {
|
|
|
813
798
|
// Stop spinner before test execution to allow clean streaming output
|
|
814
799
|
spinner.stop();
|
|
815
800
|
|
|
816
|
-
const fallbackAgentModule = await import('@zibby/core/templates/browser-test-automation/graph.
|
|
801
|
+
const fallbackAgentModule = await import('@zibby/core/templates/browser-test-automation/graph.mjs').catch(() => null);
|
|
817
802
|
|
|
818
803
|
const result = await runTest(fullSpecPath, {
|
|
819
804
|
...config,
|