@zibby/cli 0.1.79 → 0.1.80
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/commands/init.js +1 -1
- package/dist/commands/workflows/generate.js +101 -18
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -1,5 +1,88 @@
|
|
|
1
|
-
import{mkdir as
|
|
2
|
-
|
|
1
|
+
import{mkdir as f,writeFile as d}from"fs/promises";import{existsSync as y}from"fs";import{join as a}from"path";import t from"chalk";import E from"ora";import{existsSync as x}from"fs";import{join as v}from"path";import{pathToFileURL as I}from"url";async function g(o){let e=v(o,".zibby.config.mjs");if(!x(e))throw new Error(".zibby.config.mjs not found");try{let s=await import(I(e).href);return s.default||s}catch(s){throw new Error(`Failed to load .zibby.config.mjs: ${s.message}`,{cause:s})}}import{mkdir as ee,writeFile as te,readFile as oe}from"fs/promises";import{existsSync as se,readdirSync as ie}from"fs";import{join as re,resolve as le,dirname as A}from"path";import{homedir as de}from"os";import me from"inquirer";import ue from"chalk";import ye from"ora";import{spawn as be,execSync as we}from"child_process";import{fileURLToPath as C}from"url";import{createRequire as k}from"module";import{existsSync as L,readFileSync as D,writeFileSync as Z,mkdirSync as G}from"fs";import{join as W}from"path";import{homedir as F}from"os";var P=C(import.meta.url),Ae=A(P),Ce=k(import.meta.url);function u(o,e={},s={}){let i=["dolt","mem0"].includes(String(s.memoryBackend||"").toLowerCase())?String(s.memoryBackend).toLowerCase():"dolt",r={claude:`
|
|
2
|
+
claude: {
|
|
3
|
+
model: 'auto', // Options: 'auto', 'sonnet-4.6', 'opus-4.6', 'sonnet-4.5', 'opus-4.5'
|
|
4
|
+
maxTokens: 4096,
|
|
5
|
+
},`,cursor:`
|
|
6
|
+
cursor: {
|
|
7
|
+
model: 'auto', // Options: 'auto', 'opus-4.5', 'opus-4.5-thinking', 'sonnet-4.5', 'sonnet-4.5-thinking', 'composer-1', 'gpt-5.2-codex', 'gpt-5.2', 'gpt-5.3', 'gpt-5.4', 'gemini-3-pro', 'gemini-3-flash'
|
|
8
|
+
},`,codex:`
|
|
9
|
+
codex: {
|
|
10
|
+
model: 'gpt-5.2-codex', // Options: 'auto', 'o4-mini', 'o3', 'codex-mini', 'gpt-4o', 'gpt-5.2-codex', 'gpt-5.2', 'gpt-5.3', 'gpt-5.4'
|
|
11
|
+
},`,gemini:`
|
|
12
|
+
gemini: {
|
|
13
|
+
model: 'gemini-2.5-pro', // Options: 'auto', 'gemini-2.5-pro', 'gemini-2.5-flash'
|
|
14
|
+
},`},l=o.agent,p=Object.entries(r).filter(([c])=>c!==l).map(([,c])=>c.split(`
|
|
15
|
+
`).map(n=>n.trim()?` // ${n.trimStart()}`:n).join(`
|
|
16
|
+
`)).join(`
|
|
17
|
+
`);return`export default {
|
|
18
|
+
// AI agent settings
|
|
19
|
+
agent: {${r[l]}
|
|
20
|
+
${p}
|
|
21
|
+
strictMode: false,
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
// Browser for Zibby MCP (execute_live). Wizard headed/headless is stored here for \`zibby run\` logs
|
|
25
|
+
// and workflow config. Runtime strategies attach MCP per run (no global Gemini settings mutation).
|
|
26
|
+
browser: {
|
|
27
|
+
mcp: 'playwright',
|
|
28
|
+
headless: ${o.browserMode==="headless"},
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
// Chat memory backend adapter (dolt | mem0)
|
|
32
|
+
memory: {
|
|
33
|
+
backend: '${i}',
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
// Advanced: Override models per node (optional)
|
|
37
|
+
// models: {
|
|
38
|
+
// default: 'auto', // Fallback for all nodes
|
|
39
|
+
// execute_live: 'claude-opus-4', // Override specific node
|
|
40
|
+
// },
|
|
41
|
+
|
|
42
|
+
// Folder paths
|
|
43
|
+
paths: {
|
|
44
|
+
specs: 'test-specs', // Where your .txt test specs are
|
|
45
|
+
generated: 'tests', // Where generated .spec.js files go
|
|
46
|
+
output: '.zibby/output', // Where workflow execution results are saved (default: .zibby/output)
|
|
47
|
+
workflows: '.zibby/workflows', // Where custom workflows are stored
|
|
48
|
+
// sessionPrefix: 'run', // Optional: prefix for session folders (e.g., run_1772788458045)
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
// Context discovery - auto-discovers CONTEXT.md & AGENTS.md files (cascades from root \u2192 spec directory)
|
|
52
|
+
// Override filenames to search for different files
|
|
53
|
+
context: {
|
|
54
|
+
filenames: ['CONTEXT.md', 'AGENTS.md'], // Auto-discover these files (walks up from spec directory)
|
|
55
|
+
discovery: {
|
|
56
|
+
env: \`env-\${process.env.ENV || 'local'}.js\`, // Additional explicit files
|
|
57
|
+
// fixtures: 'fixtures.js', // Add more as needed
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
// Video recording (affects playwright.config.js generation)
|
|
62
|
+
video: 'on', // Options: 'off', 'on', 'retain-on-failure', 'on-first-retry'
|
|
63
|
+
|
|
64
|
+
// Browser viewport size for test execution
|
|
65
|
+
// Default: 1280x720 (works well on most screens)
|
|
66
|
+
// For larger displays: { width: 1920, height: 1080 }
|
|
67
|
+
// For mobile testing: { width: 375, height: 667 } (iPhone SE)
|
|
68
|
+
viewport: { width: 1280, height: 720 },
|
|
69
|
+
|
|
70
|
+
// Playwright artifacts (screenshots, traces, videos)
|
|
71
|
+
// Traces contain EXACT selectors for 100% accurate script generation
|
|
72
|
+
// Default: true (stored in test-results/playwright, separate from workflow output)
|
|
73
|
+
playwrightArtifacts: true,
|
|
74
|
+
|
|
75
|
+
// Parallel runs: max concurrent \`zibby run\` processes from the chat agent (run_test) and
|
|
76
|
+
// the number of lanes on Studio Mission Control (when it can read this project\u2019s config).
|
|
77
|
+
parallel: {
|
|
78
|
+
maxConcurrentRuns: 8,
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
// Cloud sync - auto-upload test results & videos (requires ZIBBY_API_KEY in .env)
|
|
82
|
+
cloudSync: ${o.cloudSync||!1}
|
|
83
|
+
};
|
|
84
|
+
`}var _=/^[a-z][a-z0-9-]{0,62}[a-z0-9]$/,h=["stellar","quantum","cosmic","nova","nebula","solar","lunar","atomic","plasma","fusion","pulse","flux","spark","blaze","ember","radiant","luminous","electric","magnetic","kinetic","neon","cyber","pixel","matrix","vector","synth","neural","prism","zenith","phoenix","catalyst","nexus","echo","wave","crystal","jade","ruby","emerald","onyx","amber","silver","turbo","lightning","thunder","storm","arcane","mystic","ethereal","celestial","swift","crimson","iron","cobalt"],b=["flow","runner","pipeline","stream","circuit","engine","beacon","forge","relay","shuttle","conduit","gateway","sentinel","scout","pilot","voyager","ranger","dispatch","signal","pulse","agent","daemon","spark","orbit","vector","nexus","matrix","grid","mesh","bridge","link","node","craft","bolt","ray","arc","wave","hook","probe","shard"];function $(){let o=h[Math.floor(Math.random()*h.length)],e=b[Math.floor(Math.random()*b.length)];return`${o}-${e}`}function S(o){return`${o.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join("")}Workflow`}function z(o,e){return`/**
|
|
85
|
+
* ${o}
|
|
3
86
|
*
|
|
4
87
|
* buildGraph() \u2014 define nodes, edges, conditional routing
|
|
5
88
|
* onComplete(result) \u2014 post-processing after the graph finishes
|
|
@@ -8,7 +91,7 @@ import{mkdir as d,writeFile as i}from"fs/promises";import{existsSync as b}from"f
|
|
|
8
91
|
import { WorkflowAgent, WorkflowGraph } from '@zibby/core';
|
|
9
92
|
import { exampleNode } from './nodes/index.mjs';
|
|
10
93
|
|
|
11
|
-
export class ${
|
|
94
|
+
export class ${o} extends WorkflowAgent {
|
|
12
95
|
buildGraph() {
|
|
13
96
|
const graph = new WorkflowGraph();
|
|
14
97
|
|
|
@@ -24,8 +107,8 @@ export class ${r} extends WorkflowAgent {
|
|
|
24
107
|
console.log(\`[${e}] workflow complete \u2014 success: \${result.success !== false}\`);
|
|
25
108
|
}
|
|
26
109
|
}
|
|
27
|
-
`}function
|
|
28
|
-
`}function
|
|
110
|
+
`}function K(){return`export { exampleNode } from './example.mjs';
|
|
111
|
+
`}function M(){return`import { z } from '@zibby/core';
|
|
29
112
|
|
|
30
113
|
const ExampleOutputSchema = z.object({
|
|
31
114
|
summary: z.string().describe('A short summary of the result'),
|
|
@@ -44,16 +127,16 @@ Analyze the input and return a summary with a status.\`,
|
|
|
44
127
|
|
|
45
128
|
outputSchema: ExampleOutputSchema,
|
|
46
129
|
};
|
|
47
|
-
`}function
|
|
48
|
-
`}function
|
|
49
|
-
`}async function
|
|
50
|
-
No name provided \u2014 generated: ${
|
|
51
|
-
Invalid workflow name: "${
|
|
52
|
-
`)),process.exit(1));let
|
|
53
|
-
Workflow already exists: ${
|
|
54
|
-
`)),process.exit(1));let
|
|
55
|
-
Created:`)),console.log(
|
|
56
|
-
Next steps:`)),console.log(
|
|
57
|
-
`))}catch(
|
|
58
|
-
${
|
|
59
|
-
`)),process.exit(1)}}export{
|
|
130
|
+
`}function j(o,e){return`${JSON.stringify({name:o,description:`${e} workflow`,entryClass:e,triggers:{api:!0}},null,2)}
|
|
131
|
+
`}function B(){return`${JSON.stringify({type:"module",dependencies:{"@zibby/core":"^0.1.33"}},null,2)}
|
|
132
|
+
`}async function Me(o){let e;o?e=o.toLowerCase():(e=$(),console.log(t.gray(`
|
|
133
|
+
No name provided \u2014 generated: ${t.white(e)}`))),_.test(e)||(console.log(t.red(`
|
|
134
|
+
Invalid workflow name: "${o}"`)),console.log(t.gray(" Must be lowercase, start with a letter, use only a-z, 0-9, hyphens")),console.log(t.gray(" Length: 2\u201364 characters")),console.log(t.gray(` Example: ticket-triage, pr-review, deploy-checker
|
|
135
|
+
`)),process.exit(1));let s=process.cwd(),i=".zibby/workflows";try{let n=await g(s);n?.paths?.workflows&&(i=n.paths.workflows)}catch(n){n?.message?.includes("not found")||(console.log(t.yellow(` \u26A0\uFE0F Could not load .zibby.config.mjs: ${n.message}`)),console.log(t.gray(` Using default path: ${i}`)))}let r=a(s,i,e),l=a(r,"nodes");y(r)&&(console.log(t.red(`
|
|
136
|
+
Workflow already exists: ${i}/${e}/`)),console.log(t.gray(` Choose a different name or delete the existing folder.
|
|
137
|
+
`)),process.exit(1));let p=S(e),c=E(` Scaffolding workflow "${e}"...`).start();try{await f(a(s,i),{recursive:!0}),await f(l,{recursive:!0}),await Promise.all([d(a(r,"graph.mjs"),z(p,e)),d(a(l,"index.mjs"),K()),d(a(l,"example.mjs"),M()),d(a(r,"workflow.json"),j(e,p)),d(a(r,"package.json"),B())]);let n=a(s,".zibby.config.mjs"),m=!1;if(!y(n)){let w=u({agent:"claude",browserMode:"headless"},{},{memoryBackend:"dolt"});await d(n,w),m=!0}c.succeed(` Scaffolded ${t.bold(e)}`),console.log(t.green(`
|
|
138
|
+
Created:`)),console.log(t.white(` ${i}/${e}/`)),console.log(t.gray(` graph.mjs ${p} (entry)`)),console.log(t.gray(" nodes/index.mjs barrel export")),console.log(t.gray(" nodes/example.mjs starter node (prompt + schema)")),console.log(t.gray(" workflow.json manifest")),console.log(t.gray(" package.json dependencies (@zibby/core)")),m&&console.log(t.white(" .zibby.config.mjs project config (agent: claude \u2014 edit to switch)")),console.log(t.white(`
|
|
139
|
+
Next steps:`)),console.log(t.cyan(` 1. Edit nodes in ${i}/${e}/nodes/`)),console.log(t.cyan(" 2. Wire them in graph.mjs")),console.log(t.cyan(" 3. Test locally:")),console.log(t.cyan(` zibby start ${e}`)),console.log(t.cyan(" 4. Deploy to cloud:")),console.log(t.cyan(` zibby deploy ${e}
|
|
140
|
+
`))}catch(n){c.fail(" Scaffold failed"),console.log(t.red(`
|
|
141
|
+
${n.message}
|
|
142
|
+
`)),process.exit(1)}}export{Me as generateWorkflowCommand};
|
package/dist/package.json
CHANGED