@oneie/cli 0.3.5 → 0.4.0

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.
@@ -0,0 +1,30 @@
1
+ /** Helpers for .env.local — merge secrets the compiler resolves from the environment. */
2
+ import { readFileSync, writeFileSync, existsSync } from 'node:fs';
3
+ import { resolve } from 'node:path';
4
+ /** Read existing .env.local (or return empty map). */
5
+ export function readEnvLocal(cwd = process.cwd()) {
6
+ const path = resolve(cwd, '.env.local');
7
+ const map = new Map();
8
+ if (!existsSync(path))
9
+ return map;
10
+ for (const line of readFileSync(path, 'utf8').split('\n')) {
11
+ const eq = line.indexOf('=');
12
+ if (eq < 1 || line.trim().startsWith('#'))
13
+ continue;
14
+ map.set(line.slice(0, eq).trim(), line.slice(eq + 1).trim());
15
+ }
16
+ return map;
17
+ }
18
+ /** Upsert key=value pairs into .env.local, preserving existing entries. */
19
+ export function mergeEnvLocal(pairs, cwd = process.cwd()) {
20
+ const path = resolve(cwd, '.env.local');
21
+ const map = readEnvLocal(cwd);
22
+ for (const [k, v] of Object.entries(pairs))
23
+ map.set(k, v);
24
+ const lines = Array.from(map.entries()).map(([k, v]) => `${k}=${v}`);
25
+ writeFileSync(path, lines.join('\n') + '\n', 'utf8');
26
+ }
27
+ /** Read a single key from .env.local, then fallback to process.env. */
28
+ export function readSecret(key, cwd = process.cwd()) {
29
+ return readEnvLocal(cwd).get(key) ?? process.env[key] ?? '';
30
+ }
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function evalCmd(): Command;
@@ -0,0 +1,32 @@
1
+ import { Command } from 'commander';
2
+ import { existsSync } from 'node:fs';
3
+ export function evalCmd() {
4
+ const cmd = new Command('eval')
5
+ .description('Run agent-behavior evals from *.eval.ts files (tool + signal receipts)')
6
+ .argument('[path]', 'File or directory of *.eval.ts', 'evals')
7
+ .option('--channels <url>', 'Channels base URL', process.env.ONEIE_CHANNELS_URL ?? 'https://channels.one.ie')
8
+ .option('--events <url>', 'Events base URL', process.env.ONEIE_BASE_URL ?? 'https://one.ie')
9
+ .action(async (path, opts) => {
10
+ const out = (data) => process.stdout.write(JSON.stringify(data) + '\n');
11
+ if (!existsSync(path)) {
12
+ out({ ok: false, error: `not found: ${path}` });
13
+ return;
14
+ }
15
+ try {
16
+ const { runEvals } = await import('@oneie/evals');
17
+ const results = await runEvals(path, {
18
+ channelsUrl: opts.channels.replace(/\/$/, ''),
19
+ eventsUrl: opts.events.replace(/\/$/, ''),
20
+ groqApiKey: process.env.GROQ_API_KEY,
21
+ });
22
+ const failed = results.filter((r) => r.failed > 0).length;
23
+ out({ ok: failed === 0, total: results.length, passed: results.length - failed, results });
24
+ if (failed > 0)
25
+ process.exitCode = 1;
26
+ }
27
+ catch (err) {
28
+ out({ ok: false, error: err.message });
29
+ }
30
+ });
31
+ return cmd;
32
+ }
package/dist/src/index.js CHANGED
@@ -10,6 +10,16 @@ import { connectCmd } from './connect.js';
10
10
  import { broadcastCmd, newsletterCmd } from './broadcast.js';
11
11
  import { staffCmd } from './staff.js';
12
12
  import { substrateCommands } from './substrate.js';
13
+ import { evalCmd } from './eval.js';
14
+ import { setupCmd } from './setup.js';
15
+ import { clientCmd } from './client.js';
16
+ import { pushCmd } from './push.js';
17
+ import { deployCmd } from './deploy.js';
18
+ import { statusCmd } from './status.js';
19
+ import { shipCmd } from './ship.js';
20
+ import { catalogCmd } from './catalog.js';
21
+ import { tradeCmd } from './trade.js';
22
+ import { coordinateCmd } from './coordinate.js';
13
23
  import { readFileSync } from 'node:fs';
14
24
  import { fileURLToPath } from 'node:url';
15
25
  import { resolve, dirname } from 'node:path';
@@ -30,7 +40,17 @@ program.addCommand(connectCmd());
30
40
  program.addCommand(broadcastCmd());
31
41
  program.addCommand(newsletterCmd());
32
42
  program.addCommand(staffCmd());
43
+ program.addCommand(evalCmd());
33
44
  substrateCommands(program);
45
+ program.addCommand(setupCmd());
46
+ program.addCommand(clientCmd());
47
+ program.addCommand(pushCmd());
48
+ program.addCommand(deployCmd());
49
+ program.addCommand(statusCmd());
50
+ program.addCommand(shipCmd());
51
+ program.addCommand(catalogCmd());
52
+ program.addCommand(tradeCmd());
53
+ program.addCommand(coordinateCmd());
34
54
  program.parseAsync(process.argv).catch((err) => {
35
55
  const isJson = process.argv.includes('--json');
36
56
  if (isJson)
@@ -0,0 +1,3 @@
1
+ /** `one push [clients/<slug>]` — compile a fractal node to the substrate. */
2
+ import { Command } from 'commander';
3
+ export declare function pushCmd(): Command;
@@ -0,0 +1,112 @@
1
+ /** `one push [clients/<slug>]` — compile a fractal node to the substrate. */
2
+ import { Command } from 'commander';
3
+ import { resolve, join } from 'node:path';
4
+ import { existsSync, readdirSync } from 'node:fs';
5
+ import { validateNodeDir } from './validate.js';
6
+ import { compileNode, readNodeConfig } from './compiler.js';
7
+ const DEFAULT_API = process.env.ONEIE_BASE_URL ?? process.env.ONE_BASE_URL ?? 'https://api.one.ie';
8
+ function apiKey() {
9
+ return process.env.ONEIE_API_KEY ?? process.env.ONE_API_KEY ?? '';
10
+ }
11
+ function out(cmd, data) {
12
+ const isJson = cmd.parent?.opts()?.json;
13
+ if (isJson)
14
+ process.stdout.write(JSON.stringify(data, null, 2) + '\n');
15
+ else {
16
+ const d = data;
17
+ if (d['pushed'] && Array.isArray(d['pushed'])) {
18
+ for (const s of d['pushed'])
19
+ process.stdout.write(` ✓ ${s}\n`);
20
+ }
21
+ if (d['skipped'] && Array.isArray(d['skipped'])) {
22
+ for (const s of d['skipped'])
23
+ process.stdout.write(` ~ ${s}\n`);
24
+ }
25
+ if (d['errors'] && Array.isArray(d['errors'])) {
26
+ for (const s of d['errors'])
27
+ process.stderr.write(` ✗ ${s}\n`);
28
+ }
29
+ const ok = d['errors']?.length === 0;
30
+ process.stdout.write(ok ? `\n✓ push complete\n` : `\n✗ push finished with errors\n`);
31
+ }
32
+ }
33
+ export function pushCmd() {
34
+ const cmd = new Command('push')
35
+ .description('Compile ai/ and data/ folders to the ONE substrate')
36
+ .argument('[target]', 'Optional: "clients/<slug>" to push a specific client, or "--all" flag')
37
+ .option('--all', 'Push all clients in the clients/ directory')
38
+ .option('--dry-run', 'Simulate without making API calls')
39
+ .option('--api <url>', 'API base URL', DEFAULT_API)
40
+ .action(async (target, opts) => {
41
+ const cwd = process.cwd();
42
+ const rootDir = cwd;
43
+ const cfg = readNodeConfig(rootDir);
44
+ const agencySlug = String(cfg['slug'] ?? '');
45
+ const key = apiKey();
46
+ if (!key) {
47
+ process.stderr.write('error: ONEIE_API_KEY not set — run `one auth login` first\n');
48
+ process.exit(1);
49
+ }
50
+ const validation = validateNodeDir(rootDir);
51
+ if (!validation.ok) {
52
+ for (const e of validation.errors)
53
+ process.stderr.write(`error: ${e}\n`);
54
+ process.exit(1);
55
+ }
56
+ for (const w of validation.warnings)
57
+ process.stderr.write(`warning: ${w}\n`);
58
+ // Determine targets
59
+ const targets = [];
60
+ if (opts.all) {
61
+ const clientsDir = resolve(rootDir, 'clients');
62
+ if (existsSync(clientsDir)) {
63
+ for (const entry of readdirSync(clientsDir, { withFileTypes: true })) {
64
+ if (entry.isDirectory()) {
65
+ const clientDir = join(clientsDir, entry.name);
66
+ const clientCfg = readNodeConfig(clientDir);
67
+ targets.push({ clientDir, slug: String(clientCfg['slug'] ?? entry.name) });
68
+ }
69
+ }
70
+ }
71
+ }
72
+ else if (target && target.startsWith('clients/')) {
73
+ const clientSlug = target.split('/')[1];
74
+ const clientDir = resolve(rootDir, target);
75
+ const clientCfg = readNodeConfig(clientDir);
76
+ targets.push({ clientDir, slug: String(clientCfg['slug'] ?? clientSlug) });
77
+ }
78
+ else {
79
+ // Push root node (the agency itself)
80
+ targets.push({ slug: agencySlug });
81
+ }
82
+ let totalPushed = 0;
83
+ let totalErrors = 0;
84
+ for (const t of targets) {
85
+ if (!agencySlug && !t.slug) {
86
+ process.stderr.write('error: could not resolve workspace slug — check _node.toml\n');
87
+ process.exit(1);
88
+ }
89
+ const result = await compileNode({
90
+ rootDir,
91
+ clientDir: t.clientDir,
92
+ apiBase: opts.api,
93
+ apiKey: key,
94
+ agencySlug: agencySlug || t.slug,
95
+ targetSlug: t.slug || agencySlug,
96
+ dry: opts.dryRun ?? false,
97
+ });
98
+ if (targets.length > 1) {
99
+ process.stdout.write(`\n─── ${t.slug} ───\n`);
100
+ }
101
+ out(cmd, result);
102
+ totalPushed += result.pushed.length;
103
+ totalErrors += result.errors.length;
104
+ }
105
+ if (targets.length > 1) {
106
+ process.stdout.write(`\nTotal: ${totalPushed} pushed, ${totalErrors} errors across ${targets.length} nodes\n`);
107
+ }
108
+ if (totalErrors > 0)
109
+ process.exit(1);
110
+ });
111
+ return cmd;
112
+ }
@@ -0,0 +1,3 @@
1
+ /** `one setup` — provision this agency workspace from agency.toml / _node.toml. */
2
+ import { Command } from 'commander';
3
+ export declare function setupCmd(): Command;
@@ -0,0 +1,147 @@
1
+ /** `one setup` — provision this agency workspace from agency.toml / _node.toml. */
2
+ import { Command } from 'commander';
3
+ import { readFileSync, existsSync } from 'node:fs';
4
+ import { resolve } from 'node:path';
5
+ const DEFAULT_API = process.env.ONEIE_BASE_URL ?? process.env.ONE_BASE_URL ?? 'https://api.one.ie';
6
+ function apiKey() {
7
+ return process.env.ONEIE_API_KEY ?? process.env.ONE_API_KEY ?? '';
8
+ }
9
+ function headers() {
10
+ return { 'Content-Type': 'application/json', Authorization: `Bearer ${apiKey()}` };
11
+ }
12
+ async function ask(base, receiver, data) {
13
+ const res = await fetch(`${base}/api/ask/${encodeURIComponent(receiver)}`, {
14
+ method: 'POST', headers: headers(), body: JSON.stringify({ data }),
15
+ });
16
+ return res.json();
17
+ }
18
+ function parseToml(text) {
19
+ const result = {};
20
+ let currentSection = null;
21
+ for (const rawLine of text.split('\n')) {
22
+ const line = rawLine.split('#')[0].trim();
23
+ if (!line)
24
+ continue;
25
+ if (line.startsWith('[[') && line.endsWith(']]')) {
26
+ currentSection = line.slice(2, -2).trim();
27
+ if (!Array.isArray(result[currentSection]))
28
+ result[currentSection] = [];
29
+ result[currentSection].push({});
30
+ continue;
31
+ }
32
+ if (line.startsWith('[') && line.endsWith(']')) {
33
+ currentSection = null;
34
+ continue;
35
+ }
36
+ const eq = line.indexOf('=');
37
+ if (eq < 1)
38
+ continue;
39
+ const key = line.slice(0, eq).trim();
40
+ const raw = line.slice(eq + 1).trim();
41
+ let val;
42
+ if (raw === 'true')
43
+ val = true;
44
+ else if (raw === 'false')
45
+ val = false;
46
+ else if (!isNaN(Number(raw)) && raw !== '')
47
+ val = Number(raw);
48
+ else if (raw.startsWith('"') || raw.startsWith("'"))
49
+ val = raw.slice(1, -1);
50
+ else if (raw.startsWith('[') && raw.endsWith(']')) {
51
+ val = raw.slice(1, -1).split(',').map(v => v.trim().replace(/^["']|["']$/g, '')).filter(Boolean);
52
+ }
53
+ else
54
+ val = raw;
55
+ if (currentSection) {
56
+ const arr = result[currentSection];
57
+ if (arr.length > 0)
58
+ arr[arr.length - 1][key] = val;
59
+ }
60
+ else
61
+ result[key] = val;
62
+ }
63
+ return result;
64
+ }
65
+ function readConfig(cwd) {
66
+ for (const name of ['agency.toml', '_node.toml']) {
67
+ const p = resolve(cwd, name);
68
+ if (existsSync(p))
69
+ return parseToml(readFileSync(p, 'utf8'));
70
+ }
71
+ return {};
72
+ }
73
+ function out(cmd, data) {
74
+ const isJson = cmd.parent?.opts()?.json;
75
+ if (isJson)
76
+ process.stdout.write(JSON.stringify(data, null, 2) + '\n');
77
+ else {
78
+ const d = data;
79
+ for (const [k, v] of Object.entries(d)) {
80
+ if (typeof v !== 'object')
81
+ process.stdout.write(` ${k}=${v}\n`);
82
+ }
83
+ }
84
+ }
85
+ export function setupCmd() {
86
+ const cmd = new Command('setup')
87
+ .description('Provision this agency workspace from agency.toml / _node.toml')
88
+ .option('--api <url>', 'API base URL', DEFAULT_API)
89
+ .option('--dry-run', 'Simulate without making API calls')
90
+ .action(async (opts) => {
91
+ const cwd = process.cwd();
92
+ const cfg = readConfig(cwd);
93
+ const name = String(cfg['name'] ?? '');
94
+ const slug = String(cfg['slug'] ?? '');
95
+ const plan = String(cfg['plan'] ?? 'pro');
96
+ if (!name || !slug) {
97
+ process.stderr.write('error: agency.toml / _node.toml must have name and slug\n');
98
+ process.exit(1);
99
+ }
100
+ const key = apiKey();
101
+ if (!key) {
102
+ process.stderr.write('error: ONEIE_API_KEY not set — run `one auth login` first\n');
103
+ process.exit(1);
104
+ }
105
+ if (opts.dryRun) {
106
+ process.stdout.write(`[dry-run] would bootstrap workspace: ${slug} (${plan})\n`);
107
+ out(cmd, { ok: true, slug, plan, dry: true });
108
+ return;
109
+ }
110
+ const base = opts.api.replace(/\/$/, '');
111
+ // 1. Bootstrap actor (creates or returns existing)
112
+ const boot = (await ask(base, 'agent:bootstrap', {}));
113
+ const uid = boot?.result?.uid ?? '';
114
+ process.stdout.write(` ✓ actor: ${uid || 'existing'}\n`);
115
+ // 2. Create workspace
116
+ const workspace = (await ask(base, 'world:create-workspace', {
117
+ name, slug, plan,
118
+ pool: cfg['pool'],
119
+ markup_pct: cfg['markup_pct'],
120
+ }));
121
+ if (workspace?.kind === 'failure') {
122
+ process.stderr.write(` ✗ workspace: ${workspace?.error ?? 'failed'}\n`);
123
+ process.exit(1);
124
+ }
125
+ process.stdout.write(` ✓ workspace: ${slug}\n`);
126
+ // 3. Mint a scoped key for this workspace
127
+ const keyResult = (await ask(base, 'world:create-key', { slug }));
128
+ const scopedKey = keyResult?.result?.key ?? '';
129
+ if (scopedKey) {
130
+ process.stdout.write(` ✓ API key: ${scopedKey.slice(0, 8)}…\n`);
131
+ process.stdout.write(`\n Add to .env.local:\n ONE_API_KEY=${scopedKey}\n\n`);
132
+ }
133
+ // 4. Invite staff from [[staff]] entries in toml
134
+ const staff = (cfg['staff'] ?? []);
135
+ for (const member of staff) {
136
+ const email = String(member['email'] ?? '');
137
+ const role = String(member['role'] ?? 'member');
138
+ if (!email)
139
+ continue;
140
+ await ask(base, 'world:invite-member', { slug, email, role });
141
+ process.stdout.write(` ✓ invited: ${email} (${role})\n`);
142
+ }
143
+ out(cmd, { ok: true, slug, plan, uid, scopedKey: scopedKey ? scopedKey.slice(0, 8) + '…' : '' });
144
+ process.stdout.write(`\n✓ Agency "${name}" provisioned. Next: one push\n`);
145
+ });
146
+ return cmd;
147
+ }
@@ -0,0 +1,3 @@
1
+ /** `one ship [message]` — git add + commit + push shortcut. */
2
+ import { Command } from 'commander';
3
+ export declare function shipCmd(): Command;
@@ -0,0 +1,41 @@
1
+ /** `one ship [message]` — git add + commit + push shortcut. */
2
+ import { Command } from 'commander';
3
+ import { spawnSync } from 'node:child_process';
4
+ function run(args) {
5
+ const r = spawnSync(args[0], args.slice(1), { stdio: 'inherit', encoding: 'utf8' });
6
+ return r.status ?? 1;
7
+ }
8
+ function out(cmd, data) {
9
+ const isJson = cmd.parent?.opts()?.json;
10
+ if (isJson)
11
+ process.stdout.write(JSON.stringify(data, null, 2) + '\n');
12
+ else {
13
+ const d = data;
14
+ if (d['ok'])
15
+ process.stdout.write(`✓ shipped: ${d['message']}\n`);
16
+ else
17
+ process.stderr.write(`✗ ship failed at: ${d['step']}\n`);
18
+ }
19
+ }
20
+ export function shipCmd() {
21
+ const cmd = new Command('ship')
22
+ .description('git add -A + commit + push in one step')
23
+ .argument('<message>', 'Commit message')
24
+ .option('--no-push', 'Commit but do not push')
25
+ .action((message, opts) => {
26
+ if (run(['git', 'add', '-A']) !== 0) {
27
+ out(cmd, { ok: false, step: 'git add' });
28
+ process.exit(1);
29
+ }
30
+ if (run(['git', 'commit', '-m', message]) !== 0) {
31
+ out(cmd, { ok: false, step: 'git commit' });
32
+ process.exit(1);
33
+ }
34
+ if (opts.push !== false && run(['git', 'push']) !== 0) {
35
+ out(cmd, { ok: false, step: 'git push' });
36
+ process.exit(1);
37
+ }
38
+ out(cmd, { ok: true, message });
39
+ });
40
+ return cmd;
41
+ }
package/dist/src/skill.js CHANGED
@@ -95,12 +95,15 @@ export function skillCmd() {
95
95
  out(cmd, { ok: false, status: res.status, ...data });
96
96
  return;
97
97
  }
98
+ const sealed = data?.skill?.sealed === true;
98
99
  out(cmd, {
99
100
  ok: true,
100
101
  ref,
101
102
  slug: opts.slug,
102
103
  name: data?.skill?.name,
103
104
  price: data?.skill?.price,
105
+ tier: sealed ? 'sealed (run-only)' : 'open',
106
+ sealed,
104
107
  key: data?.key,
105
108
  diagnostics: data?.diagnostics ?? [],
106
109
  });
@@ -109,6 +112,42 @@ export function skillCmd() {
109
112
  out(cmd, { ok: false, error: err.message, hint: 'try `oneie skill validate <path>` for offline validation' });
110
113
  }
111
114
  });
115
+ cmd.command('fork <name>')
116
+ .description('Copy an open skill into a workspace (refuses sealed — invoke-only)')
117
+ .requiredOption('--slug <slug>', 'Workspace slug')
118
+ .option('--api <url>', 'API base URL', 'https://one.ie')
119
+ .action(async (name, opts) => {
120
+ const keyFile = resolve(homedir(), '.config', 'oneie', 'key');
121
+ const key = process.env.ONEIE_API_KEY ?? (existsSync(keyFile) ? readFileSync(keyFile, 'utf8').trim() : '');
122
+ if (!key) {
123
+ out(cmd, { ok: false, error: 'no API key — run `oneie auth login`' });
124
+ return;
125
+ }
126
+ const token = `${opts.slug}:${key}`;
127
+ try {
128
+ const res = await fetch(`${opts.api.replace(/\/$/, '')}/api/skills/workspace?slug=${encodeURIComponent(opts.slug)}`, {
129
+ headers: { Authorization: `Bearer ${token}` },
130
+ });
131
+ const data = await res.json();
132
+ if (!res.ok) {
133
+ out(cmd, { ok: false, status: res.status, error: data.error ?? 'fork failed' });
134
+ return;
135
+ }
136
+ const skill = (data.skills ?? []).find((s) => s.name === name);
137
+ if (!skill) {
138
+ out(cmd, { ok: false, error: `not found: ${name}` });
139
+ return;
140
+ }
141
+ if (skill.sealed) {
142
+ out(cmd, { ok: false, error: 'sealed skills are invoke-only' });
143
+ return;
144
+ }
145
+ out(cmd, { ok: true, forked: name, slug: opts.slug, tier: 'open' });
146
+ }
147
+ catch (err) {
148
+ out(cmd, { ok: false, error: err.message });
149
+ }
150
+ });
112
151
  cmd.command('list')
113
152
  .description('List skills imported into a workspace')
114
153
  .requiredOption('--slug <slug>', 'Workspace slug')
@@ -0,0 +1,5 @@
1
+ /** Utility helpers for slug normalisation. */
2
+ /** Ensure only lowercase letters, digits, hyphens (replaces everything else with `-`). */
3
+ export declare function safeSlug(raw: string): string;
4
+ /** Namespace a skill/agent name: `<agencySlug>--<name>` (double dash — namespace separator). */
5
+ export declare function namespaced(agencySlug: string, name: string): string;
@@ -0,0 +1,9 @@
1
+ /** Utility helpers for slug normalisation. */
2
+ /** Ensure only lowercase letters, digits, hyphens (replaces everything else with `-`). */
3
+ export function safeSlug(raw) {
4
+ return raw.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
5
+ }
6
+ /** Namespace a skill/agent name: `<agencySlug>--<name>` (double dash — namespace separator). */
7
+ export function namespaced(agencySlug, name) {
8
+ return `${safeSlug(agencySlug)}--${safeSlug(name)}`;
9
+ }
@@ -0,0 +1,3 @@
1
+ /** `one status` — agency P&L dashboard from the substrate. */
2
+ import { Command } from 'commander';
3
+ export declare function statusCmd(): Command;
@@ -0,0 +1,51 @@
1
+ /** `one status` — agency P&L dashboard from the substrate. */
2
+ import { Command } from 'commander';
3
+ const DEFAULT_API = process.env.ONEIE_BASE_URL ?? process.env.ONE_BASE_URL ?? 'https://api.one.ie';
4
+ function apiKey() {
5
+ return process.env.ONEIE_API_KEY ?? process.env.ONE_API_KEY ?? '';
6
+ }
7
+ function headers() {
8
+ return { 'Content-Type': 'application/json', Authorization: `Bearer ${apiKey()}` };
9
+ }
10
+ async function ask(base, receiver, data) {
11
+ const res = await fetch(`${base}/api/ask/${encodeURIComponent(receiver)}`, {
12
+ method: 'POST', headers: headers(), body: JSON.stringify({ data }),
13
+ });
14
+ return res.json();
15
+ }
16
+ function out(cmd, data) {
17
+ const isJson = cmd.parent?.opts()?.json;
18
+ if (isJson)
19
+ process.stdout.write(JSON.stringify(data, null, 2) + '\n');
20
+ else {
21
+ const d = data;
22
+ if (d['kind'] === 'result') {
23
+ const r = d['result'];
24
+ for (const [k, v] of Object.entries(r ?? {})) {
25
+ if (typeof v !== 'object')
26
+ process.stdout.write(` ${k}: ${v}\n`);
27
+ }
28
+ }
29
+ else {
30
+ process.stdout.write(JSON.stringify(data, null, 2) + '\n');
31
+ }
32
+ }
33
+ }
34
+ export function statusCmd() {
35
+ const cmd = new Command('status')
36
+ .description('Agency P&L dashboard — credits, burns, markup earned')
37
+ .option('--slug <slug>', 'Workspace slug (defaults to ONEIE_SLUG env or config)')
38
+ .option('--api <url>', 'API base URL', DEFAULT_API)
39
+ .action(async (opts) => {
40
+ const key = apiKey();
41
+ if (!key) {
42
+ process.stderr.write('error: ONEIE_API_KEY not set\n');
43
+ process.exit(1);
44
+ }
45
+ const slug = opts.slug ?? process.env.ONEIE_SLUG ?? process.env.ONE_SLUG ?? '';
46
+ const base = opts.api.replace(/\/$/, '');
47
+ const result = await ask(base, 'dashboard:usage', { slug });
48
+ out(cmd, result);
49
+ });
50
+ return cmd;
51
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,22 @@
1
+ // @ts-nocheck — template file; typechecked in the target Astro project, not the CLI
2
+ // Install: bun add @oneie/frontend
3
+ // After setup: copy ONE_API_KEY from .env.local into backend.apiKey
4
+ import { defineOne } from '@oneie/frontend';
5
+ // The only per-node configuration:
6
+ // - backend.apiKey: your workspace's scoped API key (from one setup)
7
+ // - brand.tokens: 6 color tokens to match your brand
8
+ export default defineOne({
9
+ backend: {
10
+ apiKey: process.env.ONE_API_KEY ?? '',
11
+ },
12
+ brand: {
13
+ tokens: {
14
+ primary: 'hsl(216 55% 25%)', // your brand primary
15
+ secondary: 'hsl(160 40% 45%)', // secondary / accent
16
+ tertiary: 'hsl(38 90% 55%)', // highlight / CTA
17
+ background: 'hsl(0 0% 100%)', // page background
18
+ foreground: 'hsl(220 20% 15%)', // body text
19
+ font: 'Inter, system-ui, sans-serif',
20
+ },
21
+ },
22
+ });
@@ -0,0 +1,3 @@
1
+ /** `one market|hire|bounty|earn|usage` — trade layer commands. */
2
+ import { Command } from 'commander';
3
+ export declare function tradeCmd(): Command;