@oneie/cli 0.6.0 → 0.7.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.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneie/cli",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "ONE agent CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,8 +1,7 @@
1
1
  import { Command } from 'commander';
2
- import { mkdirSync, mkdtempSync, readFileSync, writeFileSync, existsSync } from 'node:fs';
2
+ import { mkdirSync, readFileSync, writeFileSync, existsSync } from 'node:fs';
3
3
  import { resolve, join } from 'node:path';
4
4
  import { spawnSync } from 'node:child_process';
5
- import { tmpdir } from 'node:os';
6
5
  const SAFE_REF = /^[A-Za-z0-9._/-]+$/;
7
6
  function downloadTarball(url, targetDir) {
8
7
  mkdirSync(targetDir, { recursive: true });
@@ -20,125 +19,51 @@ function downloadTarball(url, targetDir) {
20
19
  if (tar.status !== 0)
21
20
  throw new Error(`tar failed extracting to ${targetDir}`);
22
21
  }
23
- function downloadSubdir(url, subdir, targetDir) {
24
- downloadSubdirs(url, [{ subdir, targetDir }]);
25
- }
26
- // One tarball fetch, multiple subdirs copied out of it — e.g. a node's own
27
- // content plus the shared apps/web site composed into <dir>/site/. Avoids a
28
- // second GitHub API round-trip per extra subdir.
29
- function downloadSubdirs(url, copies) {
30
- const tmp = mkdtempSync(join(tmpdir(), 'one-create-'));
31
- try {
32
- downloadTarball(url, tmp);
33
- for (const { subdir, targetDir } of copies) {
34
- mkdirSync(targetDir, { recursive: true });
35
- const r = spawnSync('cp', ['-r', join(tmp, subdir, '.'), targetDir], { stdio: 'inherit' });
36
- if (r.status !== 0)
37
- throw new Error(`cp failed for ${subdir}`);
38
- }
39
- }
40
- finally {
41
- spawnSync('rm', ['-rf', tmp]);
42
- }
43
- }
44
22
  export function createCmd() {
45
- const cmd = new Command('create').description('Scaffold a new ONE node or site');
46
- // ── one create agency [name] ──────────────────────────────────────────────
23
+ const cmd = new Command('create').description('Scaffold a new ONE node');
24
+ // ── one create [name] ───────────────────────────────────────────────────
25
+ // github.com/one-ie/one is itself one node — ai/ data/ site/ workspace.toml
26
+ // at its root — so scaffolding is a plain whole-repo download, no subdir
27
+ // composition. .claude/ + .mcp.json come along for free: open the scaffold
28
+ // in Claude Code and it's connected from its first `git init`.
47
29
  cmd
48
- .command('agency [name]')
49
- .description('Scaffold a new agency node from github.com/one-ie/one (apps/agency)')
30
+ .command('node [name]', { isDefault: true })
31
+ .description('Scaffold a ONE business node from github.com/one-ie/one — free plan, no credit card')
50
32
  .option('--ref <ref>', 'Git ref to download', 'main')
51
- .option('--slug <slug>', 'Your agency slug (written into agency.toml)')
52
- .option('--name <name>', 'Your agency display name (written into agency.toml)')
33
+ .option('--slug <slug>', 'Workspace slug (written into workspace.toml)')
34
+ .option('--name <name>', 'Display name (written into workspace.toml)')
53
35
  .action((dirName, opts) => {
54
36
  if (!SAFE_REF.test(opts.ref)) {
55
37
  process.stderr.write(`Invalid ref: ${opts.ref}\n`);
56
38
  process.exit(1);
57
39
  }
58
- const label = dirName ?? opts.slug ?? 'my-agency';
40
+ const label = dirName ?? opts.slug ?? 'my-business';
59
41
  const dir = resolve(process.cwd(), label);
60
42
  if (existsSync(dir)) {
61
43
  process.stderr.write(`Directory already exists: ${dir}\n`);
62
44
  process.exit(1);
63
45
  }
64
- process.stdout.write(`Creating agency node at ${dir}...\n`);
65
- downloadSubdirs(`https://api.github.com/repos/one-ie/one/tarball/${opts.ref}`, [
66
- { subdir: 'apps/agency', targetDir: dir },
67
- { subdir: 'apps/_shared', targetDir: dir },
68
- { subdir: 'apps/web', targetDir: join(dir, 'site') },
69
- ]);
70
- // Patch agency.toml with the user's slug + name so they don't have to
71
- const tomlPath = join(dir, 'agency.toml');
46
+ process.stdout.write(`Creating business node at ${dir}...\n`);
47
+ downloadTarball(`https://api.github.com/repos/one-ie/one/tarball/${opts.ref}`, dir);
48
+ const tomlPath = join(dir, 'workspace.toml');
72
49
  if (existsSync(tomlPath) && (opts.slug ?? opts.name)) {
73
50
  let toml = readFileSync(tomlPath, 'utf8');
74
51
  if (opts.slug)
75
- toml = toml.replace(/^slug\s*=\s*"[^"]*"/m, `slug = "${opts.slug}"`);
52
+ toml = toml.replace(/^slug\s*=\s*"[^"]*"/m, `slug = "${opts.slug}"`);
76
53
  if (opts.name)
77
- toml = toml.replace(/^name\s*=\s*"[^"]*"/m, `name = "${opts.name}"`);
54
+ toml = toml.replace(/^name\s*=\s*"[^"]*"/m, `name = "${opts.name}"`);
78
55
  writeFileSync(tomlPath, toml);
79
56
  }
80
- process.stdout.write(`\nAgency node created.\n\n`);
57
+ process.stdout.write(`\nNode created — free plan, no credit card.\n\n`);
81
58
  process.stdout.write(`Next steps:\n`);
82
59
  process.stdout.write(` cd ${label}\n`);
60
+ process.stdout.write(` bun install\n`);
83
61
  process.stdout.write(` cp .env.example .env.local\n`);
84
- process.stdout.write(` # Edit .env.local — set ONE_API_KEY and AGENCY_OWNER_EMAIL\n`);
62
+ process.stdout.write(` # Edit .env.local — set WORKSPACE_OWNER_EMAIL\n`);
85
63
  if (!opts.slug)
86
- process.stdout.write(` # Edit agency.toml — set slug and name\n`);
64
+ process.stdout.write(` # Edit workspace.toml — set slug and name\n`);
87
65
  process.stdout.write(` one setup\n`);
88
66
  });
89
- // ── one create client <slug> ──────────────────────────────────────────────
90
- cmd
91
- .command('client <slug>')
92
- .description('Scaffold a client node in clients/<slug>/')
93
- .option('--name <name>', 'Display name for the client')
94
- .option('--plan <plan>', 'Plan tier', 'studio')
95
- .action((slug, opts) => {
96
- const base = resolve(process.cwd(), 'clients', slug);
97
- if (existsSync(base)) {
98
- process.stderr.write(`Client already exists: clients/${slug}\n`);
99
- process.exit(1);
100
- }
101
- const displayName = opts.name ?? slug;
102
- mkdirSync(join(base, 'ai'), { recursive: true });
103
- mkdirSync(join(base, 'data', 'lifecycles'), { recursive: true });
104
- mkdirSync(join(base, 'site'), { recursive: true });
105
- writeFileSync(join(base, 'ai', 'context.md'), `# ${displayName}\n\nAdd company context here — agents read this on every turn.\n`);
106
- writeFileSync(join(base, 'site', 'one.config.ts'), [
107
- `import { defineOne } from '@oneie/frontend'`,
108
- ``,
109
- `export default defineOne({`,
110
- ` backend: { baseUrl: 'https://one.ie' },`,
111
- ` brand: {`,
112
- ` tokens: {`,
113
- ` primary: 'hsl(216 55% 25%)',`,
114
- ` secondary: 'hsl(219 14% 28%)',`,
115
- ` tertiary: 'hsl(105 22% 25%)',`,
116
- ` background: 'hsl(0 0% 93%)',`,
117
- ` foreground: 'hsl(0 0% 100%)',`,
118
- ` font: 'hsl(0 0% 13%)',`,
119
- ` },`,
120
- ` },`,
121
- ` plugins: [`,
122
- ` // auth(),`,
123
- ` // track({ ws: '${slug}' }),`,
124
- ` // chat({ agent: 'your-agent' }),`,
125
- ` ],`,
126
- `})`,
127
- ].join('\n') + '\n');
128
- writeFileSync(join(base, 'client.toml'), [
129
- `slug = "${slug}"`,
130
- `name = "${displayName}"`,
131
- `plan = "${opts.plan}"`,
132
- ``,
133
- `# markup_pct = 15 # override agency default`,
134
- `# monthly_cap = 50000`,
135
- ].join('\n') + '\n');
136
- process.stdout.write(`Client node scaffolded: clients/${slug}/\n`);
137
- process.stdout.write(` ai/context.md — add company context\n`);
138
- process.stdout.write(` site/one.config.ts — brand tokens (6 tokens rebrand the site)\n`);
139
- process.stdout.write(` client.toml — plan + economics\n\n`);
140
- process.stdout.write(`Next: one client add ${slug} [--dry-run]\n`);
141
- });
142
67
  // ── one create partner [name] ────────────────────────────────────────────
143
68
  cmd
144
69
  .command('partner [name]')
@@ -177,73 +102,5 @@ export function createCmd() {
177
102
  process.stdout.write(` # Edit partner.toml — set slug and name\n`);
178
103
  process.stdout.write(` one setup\n`);
179
104
  });
180
- // ── one create client-repo [name] ───────────────────────────────────────
181
- cmd
182
- .command('client-repo [name]', { isDefault: true })
183
- .description('Scaffold a single-business workspace from github.com/one-ie/one (apps/client) — the default, free plan')
184
- .option('--ref <ref>', 'Git ref to download', 'main')
185
- .option('--slug <slug>', 'Workspace slug (written into workspace.toml)')
186
- .option('--name <name>', 'Display name (written into workspace.toml)')
187
- .action((dirName, opts) => {
188
- if (!SAFE_REF.test(opts.ref)) {
189
- process.stderr.write(`Invalid ref: ${opts.ref}\n`);
190
- process.exit(1);
191
- }
192
- const label = dirName ?? opts.slug ?? 'my-business';
193
- const dir = resolve(process.cwd(), label);
194
- if (existsSync(dir)) {
195
- process.stderr.write(`Directory already exists: ${dir}\n`);
196
- process.exit(1);
197
- }
198
- process.stdout.write(`Creating business workspace at ${dir}...\n`);
199
- downloadSubdirs(`https://api.github.com/repos/one-ie/one/tarball/${opts.ref}`, [
200
- { subdir: 'apps/client', targetDir: dir },
201
- { subdir: 'apps/_shared', targetDir: dir },
202
- { subdir: 'apps/web', targetDir: join(dir, 'site') },
203
- ]);
204
- const tomlPath = join(dir, 'workspace.toml');
205
- if (existsSync(tomlPath) && (opts.slug ?? opts.name)) {
206
- let toml = readFileSync(tomlPath, 'utf8');
207
- if (opts.slug)
208
- toml = toml.replace(/^slug\s*=\s*"[^"]*"/m, `slug = "${opts.slug}"`);
209
- if (opts.name)
210
- toml = toml.replace(/^name\s*=\s*"[^"]*"/m, `name = "${opts.name}"`);
211
- writeFileSync(tomlPath, toml);
212
- }
213
- process.stdout.write(`\nWorkspace created — free plan, no credit card.\n\n`);
214
- process.stdout.write(`Next steps:\n`);
215
- process.stdout.write(` cd ${label}\n`);
216
- process.stdout.write(` cp .env.example .env.local\n`);
217
- process.stdout.write(` # Edit .env.local — set WORKSPACE_OWNER_EMAIL\n`);
218
- if (!opts.slug)
219
- process.stdout.write(` # Edit workspace.toml — set slug and name\n`);
220
- process.stdout.write(` one setup\n\n`);
221
- process.stdout.write(`Outgrew a single business? \`npx oneie create agency\` unlocks reselling\n`);
222
- process.stdout.write(`to multiple clients (agency plan) — see README.md.\n`);
223
- });
224
- // ── one create site [name] ────────────────────────────────────────────────
225
- cmd
226
- .command('site [name]')
227
- .description('Scaffold a standalone ONE Astro site from github.com/one-ie/one')
228
- .option('--ref <ref>', 'Git ref to download', 'main')
229
- .action((name, opts) => {
230
- if (!SAFE_REF.test(opts.ref)) {
231
- process.stderr.write(`Invalid ref: ${opts.ref}\n`);
232
- process.exit(1);
233
- }
234
- const dir = resolve(process.cwd(), name ?? 'my-site');
235
- if (existsSync(dir)) {
236
- process.stderr.write(`Directory already exists: ${dir}\n`);
237
- process.exit(1);
238
- }
239
- process.stdout.write(`Creating site at ${dir}...\n`);
240
- downloadSubdir(`https://api.github.com/repos/one-ie/one/tarball/${opts.ref}`, 'apps/web', dir);
241
- const label = name ?? 'my-site';
242
- process.stdout.write(`\nSite created.\n\n`);
243
- process.stdout.write(`Next steps:\n`);
244
- process.stdout.write(` cd ${label}\n`);
245
- process.stdout.write(` cp .env.example .env.local\n`);
246
- process.stdout.write(` bun install && bun run dev\n`);
247
- });
248
105
  return cmd;
249
106
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneie/cli",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "ONE agent CLI",
5
5
  "type": "module",
6
6
  "bin": {