oneie 4.0.0 → 4.0.1
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 +1 -1
- package/dist/src/banner.d.ts +1 -0
- package/dist/src/banner.js +16 -0
- package/dist/src/create.js +8 -1
- package/dist/src/index.js +3 -2
- package/dist/src/lib/launch-claude.d.ts +5 -0
- package/dist/src/lib/launch-claude.js +45 -0
- package/dist/src/render.d.ts +1 -0
- package/dist/src/render.js +1 -1
- package/dist/src/setup.js +9 -1
- package/dist/src/status.js +13 -5
- package/dist/src/templates/_node/site/one.config.d.ts +2 -0
- package/dist/src/templates/_node/site/one.config.js +22 -0
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function displayBanner(): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// The ONE wordmark — ported from legacy 3.8.3's banner.js, plain stdout
|
|
2
|
+
// (no chalk: the current CLI stays dependency-lean). Shown only on the
|
|
3
|
+
// human-TTY paths (bare invocation, `create`) — never for an agent shell,
|
|
4
|
+
// which wants signal, not decoration.
|
|
5
|
+
export function displayBanner() {
|
|
6
|
+
process.stdout.write(`
|
|
7
|
+
██████╗ ███╗ ██╗███████╗
|
|
8
|
+
██╔═══██╗████╗ ██║██╔════╝
|
|
9
|
+
██║ ██║██╔██╗ ██║█████╗
|
|
10
|
+
██║ ██║██║╚██╗██║██╔══╝
|
|
11
|
+
╚██████╔╝██║ ╚████║███████╗
|
|
12
|
+
╚═════╝ ╚═╝ ╚═══╝╚══════╝
|
|
13
|
+
Turn ideas into reality — https://one.ie
|
|
14
|
+
|
|
15
|
+
`);
|
|
16
|
+
}
|
package/dist/src/create.js
CHANGED
|
@@ -2,6 +2,9 @@ import { Command } from 'commander';
|
|
|
2
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 { displayBanner } from './banner.js';
|
|
6
|
+
import { maybeLaunchClaude } from './lib/launch-claude.js';
|
|
7
|
+
import { isAgentEnvironment } from './lib/agent-env.js';
|
|
5
8
|
const SAFE_REF = /^[A-Za-z0-9._/-]+$/;
|
|
6
9
|
function downloadTarball(url, targetDir) {
|
|
7
10
|
mkdirSync(targetDir, { recursive: true });
|
|
@@ -32,11 +35,14 @@ export function createCmd() {
|
|
|
32
35
|
.option('--ref <ref>', 'Git ref to download', 'main')
|
|
33
36
|
.option('--slug <slug>', 'Workspace slug (written into workspace.toml)')
|
|
34
37
|
.option('--name <name>', 'Display name (written into workspace.toml)')
|
|
35
|
-
.action((dirName, opts) => {
|
|
38
|
+
.action(async (dirName, opts) => {
|
|
36
39
|
if (!SAFE_REF.test(opts.ref)) {
|
|
37
40
|
process.stderr.write(`Invalid ref: ${opts.ref}\n`);
|
|
38
41
|
process.exit(1);
|
|
39
42
|
}
|
|
43
|
+
const humanTTY = !isAgentEnvironment();
|
|
44
|
+
if (humanTTY)
|
|
45
|
+
displayBanner();
|
|
40
46
|
const label = dirName ?? opts.slug ?? 'my-business';
|
|
41
47
|
const dir = resolve(process.cwd(), label);
|
|
42
48
|
if (existsSync(dir)) {
|
|
@@ -63,6 +69,7 @@ export function createCmd() {
|
|
|
63
69
|
if (!opts.slug)
|
|
64
70
|
process.stdout.write(` # Edit workspace.toml — set slug and name\n`);
|
|
65
71
|
process.stdout.write(` one setup\n`);
|
|
72
|
+
await maybeLaunchClaude(dir);
|
|
66
73
|
});
|
|
67
74
|
// ── one create partner [name] ────────────────────────────────────────────
|
|
68
75
|
cmd
|
package/dist/src/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { skillCmd } from './skill.js';
|
|
|
5
5
|
import { authCmd, buildLoginCommand } from './auth.js';
|
|
6
6
|
import { doctorCmd, whoamiCmd } from './doctor.js';
|
|
7
7
|
import { isAgentEnvironment } from './lib/agent-env.js';
|
|
8
|
+
import { displayBanner } from './banner.js';
|
|
8
9
|
import { devCmd } from './dev.js';
|
|
9
10
|
import { groupCmd } from './group.js';
|
|
10
11
|
import { socialCmd } from './social.js';
|
|
@@ -85,8 +86,8 @@ if (process.argv.length === 2) {
|
|
|
85
86
|
' oneie --help # full command reference\n');
|
|
86
87
|
}
|
|
87
88
|
else {
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
displayBanner();
|
|
90
|
+
process.stdout.write(' npx oneie create <name> # scaffold a new workspace\n' +
|
|
90
91
|
' oneie --help # full command reference\n');
|
|
91
92
|
}
|
|
92
93
|
process.exit(0);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Offer to launch Claude Code in a freshly scaffolded node — port of legacy
|
|
2
|
+
* 3.8.3's launch-claude.js, zero new deps (no chalk/prompts: readline is a
|
|
3
|
+
* node builtin). Only ever prompts a real human TTY; an agent shell or
|
|
4
|
+
* non-interactive run gets the manual instructions and nothing hangs. */
|
|
5
|
+
export declare function maybeLaunchClaude(dir: string): Promise<void>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
2
|
+
import { createInterface } from 'node:readline/promises';
|
|
3
|
+
import { isAgentEnvironment } from './agent-env.js';
|
|
4
|
+
function isClaudeInstalled() {
|
|
5
|
+
return spawnSync('which', ['claude'], { stdio: 'ignore' }).status === 0;
|
|
6
|
+
}
|
|
7
|
+
async function confirm(question) {
|
|
8
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
9
|
+
try {
|
|
10
|
+
const answer = (await rl.question(`${question} [Y/n] `)).trim().toLowerCase();
|
|
11
|
+
return answer === '' || answer === 'y' || answer === 'yes';
|
|
12
|
+
}
|
|
13
|
+
finally {
|
|
14
|
+
rl.close();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** Offer to launch Claude Code in a freshly scaffolded node — port of legacy
|
|
18
|
+
* 3.8.3's launch-claude.js, zero new deps (no chalk/prompts: readline is a
|
|
19
|
+
* node builtin). Only ever prompts a real human TTY; an agent shell or
|
|
20
|
+
* non-interactive run gets the manual instructions and nothing hangs. */
|
|
21
|
+
export async function maybeLaunchClaude(dir) {
|
|
22
|
+
const claudeInstalled = isClaudeInstalled();
|
|
23
|
+
const canPrompt = claudeInstalled && process.stdin.isTTY === true && !isAgentEnvironment();
|
|
24
|
+
if (canPrompt) {
|
|
25
|
+
const launch = await confirm('\nLaunch Claude Code now?');
|
|
26
|
+
if (launch) {
|
|
27
|
+
process.stdout.write('\nLaunching Claude Code — type /do to start building.\n\n');
|
|
28
|
+
await new Promise((done) => {
|
|
29
|
+
const claude = spawn('claude', [], { stdio: 'inherit', cwd: dir });
|
|
30
|
+
claude.on('exit', () => done());
|
|
31
|
+
claude.on('error', (err) => {
|
|
32
|
+
process.stderr.write(`Failed to launch Claude Code: ${err.message}\n`);
|
|
33
|
+
done();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
process.stdout.write('\nOpen it:\n');
|
|
40
|
+
process.stdout.write(` cd ${dir}\n`);
|
|
41
|
+
if (!claudeInstalled) {
|
|
42
|
+
process.stdout.write(' # Install Claude Code: https://claude.com/product/claude-code\n');
|
|
43
|
+
}
|
|
44
|
+
process.stdout.write(' claude # then type /do to start building\n');
|
|
45
|
+
}
|
package/dist/src/render.d.ts
CHANGED
package/dist/src/render.js
CHANGED
|
@@ -25,7 +25,7 @@ export function renderClientTable(clients, markupPct) {
|
|
|
25
25
|
}
|
|
26
26
|
export function renderStatus(agency, clients) {
|
|
27
27
|
const out = [];
|
|
28
|
-
out.push(`Agency: ${agency.name ?? agency.slug} (${agency.slug}) plan
|
|
28
|
+
out.push(`Agency: ${agency.name ?? agency.slug} (${agency.slug}) plan=${agency.plan} markup=${agency.markup_pct}% pool=${fmt(agency.pool)} cr`);
|
|
29
29
|
out.push('');
|
|
30
30
|
out.push(renderClientTable(clients, agency.markup_pct));
|
|
31
31
|
return out.join('\n');
|
package/dist/src/setup.js
CHANGED
|
@@ -14,7 +14,15 @@ async function ask(base, key, receiver, data) {
|
|
|
14
14
|
const body = await res.text().catch(() => '');
|
|
15
15
|
throw new Error(`${receiver} → ${res.status}\n${body}`);
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
const json = await res.json();
|
|
18
|
+
if (json.outcome === 'failure') {
|
|
19
|
+
const result = (json.result ?? {});
|
|
20
|
+
const details = Object.entries(result)
|
|
21
|
+
.map(([k, v]) => `${k}=${typeof v === 'string' ? v : JSON.stringify(v)}`)
|
|
22
|
+
.join(' ');
|
|
23
|
+
throw new Error(`${receiver} → forbidden: ${details}`);
|
|
24
|
+
}
|
|
25
|
+
return json;
|
|
18
26
|
}
|
|
19
27
|
function findConfigPath(dir) {
|
|
20
28
|
for (const name of ['_node.toml', 'agency.toml', 'partner.toml', 'workspace.toml']) {
|
package/dist/src/status.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { mergeEnv } from './env.js';
|
|
3
3
|
import { renderStatus } from './render.js';
|
|
4
|
-
const DEFAULT_API = process.env.ONEIE_BASE_URL ?? process.env.ONE_API_URL ?? 'https://
|
|
4
|
+
const DEFAULT_API = process.env.ONEIE_BASE_URL ?? process.env.ONE_API_URL ?? 'https://one.ie';
|
|
5
5
|
export function statusCmd() {
|
|
6
6
|
return new Command('status')
|
|
7
7
|
.description('Agency P&L dashboard (pool, margin, per-client burns)')
|
|
@@ -26,13 +26,21 @@ export function statusCmd() {
|
|
|
26
26
|
process.stderr.write(`billing:clients → ${res.status}\n`);
|
|
27
27
|
process.exit(1);
|
|
28
28
|
}
|
|
29
|
-
const
|
|
29
|
+
const json = await res.json();
|
|
30
|
+
if (json.outcome === 'failure') {
|
|
31
|
+
const result = (json.result ?? {});
|
|
32
|
+
const details = Object.entries(result)
|
|
33
|
+
.map(([k, v]) => `${k}=${typeof v === 'string' ? v : JSON.stringify(v)}`)
|
|
34
|
+
.join(' ');
|
|
35
|
+
process.stderr.write(`billing:clients → forbidden: ${details}\n`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
30
38
|
if (opts.json) {
|
|
31
|
-
process.stdout.write(JSON.stringify(
|
|
39
|
+
process.stdout.write(JSON.stringify(json, null, 2) + '\n');
|
|
32
40
|
return;
|
|
33
41
|
}
|
|
34
|
-
const agency = (
|
|
35
|
-
const clients = (
|
|
42
|
+
const agency = (json.agency ?? { slug: env.AGENCY_SLUG, name: env.AGENCY_NAME ?? null, markup_pct: 0, pool: 0, plan: 'free' });
|
|
43
|
+
const clients = (json.clients ?? []);
|
|
36
44
|
process.stdout.write(renderStatus(agency, clients) + '\n');
|
|
37
45
|
});
|
|
38
46
|
}
|
|
@@ -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
|
+
});
|