@oneie/cli 0.5.3 → 0.5.5
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/README.md +18 -3
- package/dist/package.json +6 -4
- package/dist/src/chat.d.ts +2 -0
- package/dist/src/chat.js +98 -0
- package/dist/src/compiler.d.ts +18 -0
- package/dist/src/compiler.js +61 -0
- package/dist/src/index.js +2 -0
- package/dist/src/push.js +65 -8
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -24,13 +24,15 @@ A ONE node (agency or client) is three folders the CLI compiles to the substrate
|
|
|
24
24
|
```bash
|
|
25
25
|
one setup # stand up your agency workspace (idempotent)
|
|
26
26
|
one client add <slug> # provision a managed client (workspace + credits + brand + agents)
|
|
27
|
-
one push [clients/<slug>] # compile ai/ + data/ → agents, skills, context, lifecycles, types
|
|
27
|
+
one push [clients/<slug>] # compile ai/ + data/ → agents, skills, context, lifecycles, types, workflows
|
|
28
28
|
one status # P&L — funded · burned · margin · balance
|
|
29
29
|
one deploy # wrangler deploy the node's site/
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
`one push` understands TOML array-of-tables (`[[stages]]`, `[[fields]]`)
|
|
33
|
-
`data/lifecycles/*.toml` and `data/types/*.toml` into the shapes the substrate expects
|
|
32
|
+
`one push` understands TOML array-of-tables (`[[stages]]`, `[[fields]]`), compiles
|
|
33
|
+
`data/lifecycles/*.toml` and `data/types/*.toml` into the shapes the substrate expects, and
|
|
34
|
+
deploys `ai/workflows/*.md` as runnable workflows — the step graph rides in a fenced
|
|
35
|
+
` ```graph ` block (`{ "steps": [...], "edges": [...] }`), prose above it is human docs.
|
|
34
36
|
|
|
35
37
|
## Reach the whole surface
|
|
36
38
|
|
|
@@ -63,6 +65,19 @@ one login --key <key> # stored at ~/.config/oneie/key (0600)
|
|
|
63
65
|
|
|
64
66
|
Workspace operations use a Bearer token `<slug>:<key>`. Override the API base per command with `--api` (default `https://one.ie`).
|
|
65
67
|
|
|
68
|
+
## Chat — fan in · fan out
|
|
69
|
+
|
|
70
|
+
Send to a space, broadcast to all, or stream incoming messages:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
one chat "deploy shipped" # broadcast to vespio · elitemoversca · world
|
|
74
|
+
one chat send --to vespio "hey donal, PR is ready" # targeted
|
|
75
|
+
one chat broadcast "all green" --spaces vespio,elitemoversca # explicit fan-out
|
|
76
|
+
one chat listen vespio # stream incoming SSE (Ctrl+C to stop)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Every `chat send` routes through `space:post` — authenticated, mirrored to `one.ie/u/<space>/in`, delivered to every connected SSE listener.
|
|
80
|
+
|
|
66
81
|
## Links
|
|
67
82
|
|
|
68
83
|
- Platform: **https://one.ie**
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneie/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "ONE agent CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,17 +15,19 @@
|
|
|
15
15
|
"build": "tsc && cp package.json dist/ && chmod +x dist/src/index.js",
|
|
16
16
|
"dev": "tsx src/index.ts",
|
|
17
17
|
"typecheck": "tsc --noEmit",
|
|
18
|
+
"test": "vitest run",
|
|
18
19
|
"prepublishOnly": "bun run build"
|
|
19
20
|
},
|
|
20
21
|
"dependencies": {
|
|
21
22
|
"commander": "^12.0.0",
|
|
22
|
-
"@oneie/sdk": "
|
|
23
|
-
"@oneie/evals": "
|
|
23
|
+
"@oneie/sdk": "workspace:*",
|
|
24
|
+
"@oneie/evals": "workspace:*"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
27
|
"@types/node": "^25.6.0",
|
|
27
28
|
"tsx": "^4.0.0",
|
|
28
|
-
"typescript": "^5.4.0"
|
|
29
|
+
"typescript": "^5.4.0",
|
|
30
|
+
"vitest": "^4.1.6"
|
|
29
31
|
},
|
|
30
32
|
"license": "SEE LICENSE IN LICENSE",
|
|
31
33
|
"repository": {
|
package/dist/src/chat.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
const DEFAULT_API = process.env.ONEIE_BASE_URL ?? process.env.ONE_BASE_URL ?? 'https://one.ie';
|
|
3
|
+
const DEFAULT_CHANNELS = process.env.CHANNELS_URL ?? 'https://channels.one.ie';
|
|
4
|
+
const DEFAULT_SPACES = ['vespio', 'elitemoversca', 'world'];
|
|
5
|
+
function headers() {
|
|
6
|
+
const h = { 'Content-Type': 'application/json' };
|
|
7
|
+
const k = process.env.ONEIE_API_KEY ?? process.env.ONE_API_KEY ?? '';
|
|
8
|
+
if (k)
|
|
9
|
+
h['Authorization'] = `Bearer ${k}`;
|
|
10
|
+
return h;
|
|
11
|
+
}
|
|
12
|
+
async function spacePost(api, space, content) {
|
|
13
|
+
const res = await fetch(`${api.replace(/\/$/, '')}/api/ask/space:post`, {
|
|
14
|
+
method: 'POST',
|
|
15
|
+
headers: headers(),
|
|
16
|
+
body: JSON.stringify({ data: { space, content } }),
|
|
17
|
+
});
|
|
18
|
+
if (!res.ok)
|
|
19
|
+
return { ok: false, error: `HTTP ${res.status}` };
|
|
20
|
+
const j = await res.json();
|
|
21
|
+
return j.result ?? { ok: j.outcome === 'result', error: j.error };
|
|
22
|
+
}
|
|
23
|
+
export function chatCmd() {
|
|
24
|
+
const cmd = new Command('chat')
|
|
25
|
+
.description('Send messages to Spaces (fan-out) or listen for incoming messages (fan-in)');
|
|
26
|
+
// one chat "text" [--to space] [--broadcast]
|
|
27
|
+
cmd
|
|
28
|
+
.command('send <text>', { isDefault: true })
|
|
29
|
+
.description('Send a message to a Space (default: broadcast to all)')
|
|
30
|
+
.option('--to <space>', 'Target space slug (default: broadcast to vespio + elitemoversca + world)')
|
|
31
|
+
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
32
|
+
.action(async (text, opts) => {
|
|
33
|
+
if (opts.to) {
|
|
34
|
+
const r = await spacePost(opts.api, opts.to, text);
|
|
35
|
+
process.stdout.write(JSON.stringify(r, null, 2) + '\n');
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
const results = await Promise.all(DEFAULT_SPACES.map(s => spacePost(opts.api, s, text)));
|
|
39
|
+
results.forEach((r, i) => process.stdout.write(`→ space:${DEFAULT_SPACES[i]} ${r.ok ? r.id : r.error}\n`));
|
|
40
|
+
process.stdout.write(`ok broadcast to ${DEFAULT_SPACES.length} spaces\n`);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
// one chat broadcast "text"
|
|
44
|
+
cmd
|
|
45
|
+
.command('broadcast <text>')
|
|
46
|
+
.description('Fan-out to all default spaces (vespio + elitemoversca + world)')
|
|
47
|
+
.option('--spaces <list>', 'Comma-separated space slugs', DEFAULT_SPACES.join(','))
|
|
48
|
+
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
49
|
+
.action(async (text, opts) => {
|
|
50
|
+
const spaces = opts.spaces.split(',').map(s => s.trim()).filter(Boolean);
|
|
51
|
+
const results = await Promise.all(spaces.map(s => spacePost(opts.api, s, text)));
|
|
52
|
+
results.forEach((r, i) => process.stdout.write(`→ space:${spaces[i]} ${r.ok ? r.id : r.error}\n`));
|
|
53
|
+
process.stdout.write(`ok broadcast to ${spaces.length} spaces\n`);
|
|
54
|
+
});
|
|
55
|
+
// one chat listen <space>
|
|
56
|
+
cmd
|
|
57
|
+
.command('listen <space>')
|
|
58
|
+
.description('Stream incoming messages from a Space via SSE (Ctrl+C to stop)')
|
|
59
|
+
.option('--channels <url>', 'Channels base URL', DEFAULT_CHANNELS)
|
|
60
|
+
.action(async (space, opts) => {
|
|
61
|
+
const group = space.startsWith('space:') ? space : `space:${space}`;
|
|
62
|
+
const url = `${opts.channels.replace(/\/$/, '')}/stream/${encodeURIComponent(group)}`;
|
|
63
|
+
process.stderr.write(`Listening on ${group} — Ctrl+C to stop\n`);
|
|
64
|
+
const key = process.env.ONEIE_API_KEY ?? process.env.ONE_API_KEY ?? '';
|
|
65
|
+
const h = { Accept: 'text/event-stream' };
|
|
66
|
+
if (key)
|
|
67
|
+
h['Authorization'] = `Bearer ${key}`;
|
|
68
|
+
const res = await fetch(url, { headers: h });
|
|
69
|
+
if (!res.ok || !res.body) {
|
|
70
|
+
process.stderr.write(`stream error: ${res.status}\n`);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
const reader = res.body.getReader();
|
|
74
|
+
const dec = new TextDecoder();
|
|
75
|
+
while (true) {
|
|
76
|
+
const { done, value } = await reader.read();
|
|
77
|
+
if (done)
|
|
78
|
+
break;
|
|
79
|
+
const chunk = dec.decode(value);
|
|
80
|
+
for (const line of chunk.split('\n')) {
|
|
81
|
+
if (!line.startsWith('data:'))
|
|
82
|
+
continue;
|
|
83
|
+
const raw = line.slice(5).trim();
|
|
84
|
+
if (!raw || raw === '[DONE]')
|
|
85
|
+
continue;
|
|
86
|
+
try {
|
|
87
|
+
const msg = JSON.parse(raw);
|
|
88
|
+
const t = msg.ts ? new Date(msg.ts).toISOString().slice(11, 19) : '';
|
|
89
|
+
process.stdout.write(`[${t}] ${msg.sender ?? '?'}: ${msg.content ?? raw}\n`);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
process.stdout.write(raw + '\n');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return cmd;
|
|
98
|
+
}
|
package/dist/src/compiler.d.ts
CHANGED
|
@@ -2,7 +2,25 @@ export interface CompileItem {
|
|
|
2
2
|
path: string;
|
|
3
3
|
receiver: string;
|
|
4
4
|
payload: Record<string, unknown>;
|
|
5
|
+
/** Workflow two-phase: after `workflow:create` returns an id, push applies this diff. */
|
|
6
|
+
applyDiff?: {
|
|
7
|
+
add: Record<string, unknown>[];
|
|
8
|
+
connect: Record<string, unknown>[];
|
|
9
|
+
};
|
|
5
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Parse a workflow `.md` into a WorkflowDiff (`{add, connect}` per @oneie/sdk/schemas).
|
|
13
|
+
* The deterministic step graph rides in a fenced ```graph JSON block:
|
|
14
|
+
* { "steps": [{ "id", "kind", "name", "config": {…} }],
|
|
15
|
+
* "edges": [ ["a","b"], { "from":"a", "to":"b", "condition":"…" } ] }
|
|
16
|
+
* Prose above the block is human docs. `config` objects are JSON-stringified (the receiver
|
|
17
|
+
* wants a string). Frontmatter `trigger:` seeds a trigger step when the graph omits one.
|
|
18
|
+
* No graph block → null (the workflow is created as a shell). Unknown kind → throws.
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseWorkflowGraph(md: string, fm: Record<string, string>): {
|
|
21
|
+
add: Record<string, unknown>[];
|
|
22
|
+
connect: Record<string, unknown>[];
|
|
23
|
+
} | null;
|
|
6
24
|
export interface CompileResult {
|
|
7
25
|
compiled: CompileItem[];
|
|
8
26
|
errors: {
|
package/dist/src/compiler.js
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
import { readdirSync, readFileSync, statSync, existsSync } from 'node:fs';
|
|
2
2
|
import { join, basename } from 'node:path';
|
|
3
|
+
// The 8 LOCKED workflow step kinds (one-ie/CLAUDE.md · @oneie/sdk/schemas StepKind).
|
|
4
|
+
const WORKFLOW_STEP_KINDS = new Set(['trigger', 'tool', 'skill', 'agent', 'condition', 'human', 'delay', 'sell']);
|
|
5
|
+
/**
|
|
6
|
+
* Parse a workflow `.md` into a WorkflowDiff (`{add, connect}` per @oneie/sdk/schemas).
|
|
7
|
+
* The deterministic step graph rides in a fenced ```graph JSON block:
|
|
8
|
+
* { "steps": [{ "id", "kind", "name", "config": {…} }],
|
|
9
|
+
* "edges": [ ["a","b"], { "from":"a", "to":"b", "condition":"…" } ] }
|
|
10
|
+
* Prose above the block is human docs. `config` objects are JSON-stringified (the receiver
|
|
11
|
+
* wants a string). Frontmatter `trigger:` seeds a trigger step when the graph omits one.
|
|
12
|
+
* No graph block → null (the workflow is created as a shell). Unknown kind → throws.
|
|
13
|
+
*/
|
|
14
|
+
export function parseWorkflowGraph(md, fm) {
|
|
15
|
+
const m = md.match(/```graph\s*\n([\s\S]*?)```/);
|
|
16
|
+
if (!m)
|
|
17
|
+
return null;
|
|
18
|
+
let graph;
|
|
19
|
+
try {
|
|
20
|
+
graph = JSON.parse(m[1]);
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
throw new Error(`invalid \`\`\`graph JSON: ${String(e)}`);
|
|
24
|
+
}
|
|
25
|
+
const steps = Array.isArray(graph.steps) ? graph.steps : [];
|
|
26
|
+
const add = steps.map((s) => {
|
|
27
|
+
const kind = String(s.kind ?? '');
|
|
28
|
+
if (!WORKFLOW_STEP_KINDS.has(kind))
|
|
29
|
+
throw new Error(`unknown workflow step kind "${kind}"`);
|
|
30
|
+
const config = typeof s.config === 'string' ? s.config : JSON.stringify(s.config ?? {});
|
|
31
|
+
return { tempId: String(s.id ?? ''), kind, name: String(s.name ?? s.id ?? ''), config };
|
|
32
|
+
});
|
|
33
|
+
const edges = Array.isArray(graph.edges) ? graph.edges : [];
|
|
34
|
+
const connect = edges.map((e) => {
|
|
35
|
+
if (Array.isArray(e))
|
|
36
|
+
return { source: String(e[0]), target: String(e[1]) };
|
|
37
|
+
const o = e;
|
|
38
|
+
return { source: String(o.from), target: String(o.to), ...(o.condition ? { condition: String(o.condition) } : {}) };
|
|
39
|
+
});
|
|
40
|
+
// Seed a trigger from frontmatter when the graph has none, wiring it to the first step.
|
|
41
|
+
if (fm.trigger && !add.some((s) => s.kind === 'trigger')) {
|
|
42
|
+
add.unshift({ tempId: 'trigger', kind: 'trigger', name: String(fm.label ?? 'Trigger'), config: JSON.stringify({ source: fm.trigger }) });
|
|
43
|
+
if (add.length > 1)
|
|
44
|
+
connect.unshift({ source: 'trigger', target: String(add[1].tempId) });
|
|
45
|
+
}
|
|
46
|
+
return { add, connect };
|
|
47
|
+
}
|
|
3
48
|
/** Minimal TOML parser: key="v", key=123, key=true, [section], key=["a","b"] */
|
|
4
49
|
export function parseToml(src) {
|
|
5
50
|
const root = {};
|
|
@@ -230,6 +275,22 @@ export async function compileNode(dir, agencySlug, opts) {
|
|
|
230
275
|
errors.push({ path: f, message: String(e) });
|
|
231
276
|
}
|
|
232
277
|
}
|
|
278
|
+
// ai/workflows/*.md → workflow:create (+ workflow:apply-diff via item.applyDiff, two-phase in push)
|
|
279
|
+
for (const f of walk(join(dir, 'ai', 'workflows'), '.md')) {
|
|
280
|
+
try {
|
|
281
|
+
const md = readFileSync(f, 'utf8');
|
|
282
|
+
const fm = frontmatter(md);
|
|
283
|
+
const name = String(fm.label ?? fm.id ?? basename(f, '.md'));
|
|
284
|
+
const item = { path: f, receiver: 'workflow:create', payload: { name, description: String(fm.description ?? '') } };
|
|
285
|
+
const graph = parseWorkflowGraph(md, fm);
|
|
286
|
+
if (graph && graph.add.length)
|
|
287
|
+
item.applyDiff = graph;
|
|
288
|
+
compiled.push(item);
|
|
289
|
+
}
|
|
290
|
+
catch (e) {
|
|
291
|
+
errors.push({ path: f, message: String(e) });
|
|
292
|
+
}
|
|
293
|
+
}
|
|
233
294
|
// data/content/contacts.csv → people:create (batch)
|
|
234
295
|
const contactsPath = join(dir, 'data', 'content', 'contacts.csv');
|
|
235
296
|
if (existsSync(contactsPath)) {
|
package/dist/src/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { groupCmd } from './group.js';
|
|
|
8
8
|
import { socialCmd } from './social.js';
|
|
9
9
|
import { connectCmd } from './connect.js';
|
|
10
10
|
import { broadcastCmd, newsletterCmd } from './broadcast.js';
|
|
11
|
+
import { chatCmd } from './chat.js';
|
|
11
12
|
import { linksCmd } from './links.js';
|
|
12
13
|
import { staffCmd } from './staff.js';
|
|
13
14
|
import { substrateCommands } from './substrate.js';
|
|
@@ -44,6 +45,7 @@ program.addCommand(groupCmd());
|
|
|
44
45
|
program.addCommand(socialCmd());
|
|
45
46
|
program.addCommand(connectCmd());
|
|
46
47
|
program.addCommand(broadcastCmd());
|
|
48
|
+
program.addCommand(chatCmd());
|
|
47
49
|
program.addCommand(newsletterCmd());
|
|
48
50
|
program.addCommand(linksCmd());
|
|
49
51
|
program.addCommand(staffCmd());
|
package/dist/src/push.js
CHANGED
|
@@ -5,6 +5,27 @@ const DEFAULT_API = process.env.ONEIE_BASE_URL ?? process.env.ONE_API_URL ?? 'ht
|
|
|
5
5
|
function apiKey(env) {
|
|
6
6
|
return env.ONEIE_API_KEY ?? env.ONE_API_KEY ?? process.env.ONEIE_API_KEY ?? process.env.ONE_API_KEY ?? '';
|
|
7
7
|
}
|
|
8
|
+
async function ask(base, headers, receiver, data) {
|
|
9
|
+
try {
|
|
10
|
+
const res = await fetch(`${base}/api/ask/${encodeURIComponent(receiver)}`, {
|
|
11
|
+
method: 'POST', headers, body: JSON.stringify({ data }),
|
|
12
|
+
});
|
|
13
|
+
if (!res.ok)
|
|
14
|
+
return { ok: false, result: {} };
|
|
15
|
+
const json = (await res.json().catch(() => ({})));
|
|
16
|
+
return { ok: true, result: json.result ?? {} };
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return { ok: false, result: {} };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** workflow:create resolves the target from requireSlug(ctx), so child workflows need that
|
|
23
|
+
* workspace's own owner key. The configured (possibly parent) key can mint it via the walk. */
|
|
24
|
+
async function mintOwnerKey(base, headers, slug) {
|
|
25
|
+
const r = await ask(base, headers, 'world:mint-owner-key', { slug, label: 'push' });
|
|
26
|
+
const k = r.result.key ?? r.result.ownerKey ?? r.result.scopedKey;
|
|
27
|
+
return typeof k === 'string' && k ? k : null;
|
|
28
|
+
}
|
|
8
29
|
export function pushCmd() {
|
|
9
30
|
return new Command('push')
|
|
10
31
|
.description('Compile ai/ + data/ folders and push to substrate')
|
|
@@ -29,8 +50,10 @@ export function pushCmd() {
|
|
|
29
50
|
}
|
|
30
51
|
if (opts.dryRun) {
|
|
31
52
|
process.stdout.write(`[dry-run] ${compiled.length} item(s) would push:\n`);
|
|
32
|
-
for (const item of compiled)
|
|
33
|
-
|
|
53
|
+
for (const item of compiled) {
|
|
54
|
+
const steps = item.applyDiff ? ` (+${item.applyDiff.add.length} steps)` : '';
|
|
55
|
+
process.stdout.write(` ${item.receiver} ${item.path}${steps}\n`);
|
|
56
|
+
}
|
|
34
57
|
return;
|
|
35
58
|
}
|
|
36
59
|
const base = (opts.api ?? DEFAULT_API).replace(/\/$/, '');
|
|
@@ -38,17 +61,51 @@ export function pushCmd() {
|
|
|
38
61
|
const authHeaders = { 'Content-Type': 'application/json' };
|
|
39
62
|
if (key)
|
|
40
63
|
authHeaders['Authorization'] = `Bearer ${key}`;
|
|
64
|
+
const isWorkflow = (i) => i.receiver === 'workflow:create';
|
|
41
65
|
let ok = 0;
|
|
42
|
-
|
|
66
|
+
// Standard items (agents, skills, context, lifecycles, types …) — explicit-slug receivers
|
|
67
|
+
// authorize via the ownership walk, so the configured key covers owned child workspaces.
|
|
68
|
+
for (const item of compiled.filter((i) => !isWorkflow(i))) {
|
|
43
69
|
const res = await fetch(`${base}/api/ask/${encodeURIComponent(item.receiver)}`, {
|
|
44
|
-
method: 'POST',
|
|
45
|
-
headers: authHeaders,
|
|
46
|
-
body: JSON.stringify({ data: item.payload }),
|
|
70
|
+
method: 'POST', headers: authHeaders, body: JSON.stringify({ data: item.payload }),
|
|
47
71
|
});
|
|
48
|
-
if (
|
|
72
|
+
if (res.ok)
|
|
73
|
+
ok++;
|
|
74
|
+
else
|
|
49
75
|
process.stderr.write(` failed: ${item.receiver} ${res.status}\n`);
|
|
76
|
+
}
|
|
77
|
+
// Workflows — two-phase (create → apply-diff) under a workspace-owner key, idempotent by name.
|
|
78
|
+
const wfItems = compiled.filter(isWorkflow);
|
|
79
|
+
if (wfItems.length) {
|
|
80
|
+
const wfKey = (await mintOwnerKey(base, authHeaders, agencySlug)) ?? key;
|
|
81
|
+
const wfHeaders = { 'Content-Type': 'application/json', Authorization: `Bearer ${wfKey}` };
|
|
82
|
+
// Existing workflows by name → delete a same-name match before recreating (clean re-push).
|
|
83
|
+
const list = await ask(base, wfHeaders, 'workflow:list', {});
|
|
84
|
+
const rows = (Array.isArray(list.result) ? list.result : (list.result.workflows ?? list.result.items ?? []));
|
|
85
|
+
const byName = new Map();
|
|
86
|
+
for (const w of rows) {
|
|
87
|
+
const n = String(w.name ?? '');
|
|
88
|
+
const id = String(w.id ?? w.workflowId ?? '');
|
|
89
|
+
if (n && id)
|
|
90
|
+
byName.set(n, [...(byName.get(n) ?? []), id]);
|
|
50
91
|
}
|
|
51
|
-
|
|
92
|
+
for (const item of wfItems) {
|
|
93
|
+
const name = String(item.payload.name ?? '');
|
|
94
|
+
for (const id of byName.get(name) ?? [])
|
|
95
|
+
await ask(base, wfHeaders, 'workflow:delete', { workflowId: id });
|
|
96
|
+
const created = await ask(base, wfHeaders, 'workflow:create', item.payload);
|
|
97
|
+
const wid = created.result.workflowId ?? created.result.id;
|
|
98
|
+
if (!created.ok || typeof wid !== 'string') {
|
|
99
|
+
process.stderr.write(` failed: workflow:create ${name}\n`);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (item.applyDiff) {
|
|
103
|
+
const applied = await ask(base, wfHeaders, 'workflow:apply-diff', { workflowId: wid, diff: item.applyDiff });
|
|
104
|
+
if (!applied.ok || applied.result.ok === false) {
|
|
105
|
+
process.stderr.write(` failed: workflow:apply-diff ${name}\n`);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
52
109
|
ok++;
|
|
53
110
|
}
|
|
54
111
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneie/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "ONE agent CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,17 +15,19 @@
|
|
|
15
15
|
"build": "tsc && cp package.json dist/ && chmod +x dist/src/index.js",
|
|
16
16
|
"dev": "tsx src/index.ts",
|
|
17
17
|
"typecheck": "tsc --noEmit",
|
|
18
|
+
"test": "vitest run",
|
|
18
19
|
"prepublishOnly": "bun run build"
|
|
19
20
|
},
|
|
20
21
|
"dependencies": {
|
|
21
22
|
"commander": "^12.0.0",
|
|
22
|
-
"@oneie/sdk": "
|
|
23
|
-
"@oneie/evals": "
|
|
23
|
+
"@oneie/sdk": "workspace:*",
|
|
24
|
+
"@oneie/evals": "workspace:*"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
27
|
"@types/node": "^25.6.0",
|
|
27
28
|
"tsx": "^4.0.0",
|
|
28
|
-
"typescript": "^5.4.0"
|
|
29
|
+
"typescript": "^5.4.0",
|
|
30
|
+
"vitest": "^4.1.6"
|
|
29
31
|
},
|
|
30
32
|
"license": "SEE LICENSE IN LICENSE",
|
|
31
33
|
"repository": {
|