@dayzehq/cli 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +305 -2
- package/dist/add.d.ts +6 -0
- package/dist/add.js +72 -0
- package/dist/admin.d.ts +110 -0
- package/dist/admin.js +408 -0
- package/dist/agent-bridge.d.ts +50 -0
- package/dist/agent-bridge.js +146 -0
- package/dist/agent-mcp.d.ts +4 -0
- package/dist/agent-mcp.js +36 -0
- package/dist/ai-consent.d.ts +18 -0
- package/dist/ai-consent.js +93 -0
- package/dist/args.d.ts +5 -0
- package/dist/args.js +127 -0
- package/dist/auth.d.ts +20 -0
- package/dist/auth.js +198 -0
- package/dist/channel.d.ts +55 -0
- package/dist/channel.js +250 -0
- package/dist/chat.d.ts +67 -0
- package/dist/chat.js +170 -0
- package/dist/cli-errors.d.ts +13 -0
- package/dist/cli-errors.js +30 -0
- package/dist/coding-context.d.ts +12 -0
- package/dist/coding-context.js +130 -0
- package/dist/coding.d.ts +35 -0
- package/dist/coding.js +283 -0
- package/dist/config.d.ts +36 -0
- package/dist/config.js +149 -0
- package/dist/day.d.ts +22 -0
- package/dist/day.js +54 -0
- package/dist/dayze-cli-runtime +0 -0
- package/dist/dayze-days.d.ts +56 -0
- package/dist/dayze-days.js +276 -0
- package/dist/doctor.d.ts +32 -0
- package/dist/doctor.js +225 -0
- package/dist/focus.d.ts +9 -0
- package/dist/focus.js +163 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +675 -0
- package/dist/inventory.d.ts +73 -0
- package/dist/inventory.js +1272 -0
- package/dist/life.d.ts +48 -0
- package/dist/life.js +146 -0
- package/dist/me.d.ts +94 -0
- package/dist/me.js +789 -0
- package/dist/people.d.ts +232 -0
- package/dist/people.js +2034 -0
- package/dist/projects.d.ts +21 -0
- package/dist/projects.js +132 -0
- package/dist/request-deadline.d.ts +11 -0
- package/dist/request-deadline.js +34 -0
- package/dist/runtime-build.json +1 -0
- package/dist/ui.d.ts +37 -0
- package/dist/ui.js +219 -0
- package/dist/version.d.ts +4 -0
- package/dist/version.js +16 -0
- package/package.json +54 -4
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type DayzeCredentials } from './config.js';
|
|
2
|
+
declare const CREATE_FLAGS: readonly ["name", "slug", "kind", "status", "description", "website", "notes"];
|
|
3
|
+
type CreateFlag = (typeof CREATE_FLAGS)[number];
|
|
4
|
+
type CreateInput = Partial<Record<CreateFlag, string>> & {
|
|
5
|
+
name: string;
|
|
6
|
+
};
|
|
7
|
+
type ProjectsCommand = {
|
|
8
|
+
kind: 'list' | 'help';
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'show';
|
|
11
|
+
slug: string;
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'create';
|
|
14
|
+
input: CreateInput;
|
|
15
|
+
};
|
|
16
|
+
export declare function parseProjectsArgs(args: string[]): ProjectsCommand;
|
|
17
|
+
export declare function printProjectsHelp(): void;
|
|
18
|
+
export declare function runProjectsCommand(creds: DayzeCredentials, args: string[], options?: {
|
|
19
|
+
json?: boolean;
|
|
20
|
+
}): Promise<void>;
|
|
21
|
+
export {};
|
package/dist/projects.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { authHeader } from './config.js';
|
|
2
|
+
import { CliError, printJson } from './cli-errors.js';
|
|
3
|
+
import { fetchJsonWithDeadline } from './request-deadline.js';
|
|
4
|
+
import { CLI_USER_AGENT } from './version.js';
|
|
5
|
+
import * as ui from './ui.js';
|
|
6
|
+
const CREATE_FLAGS = ['name', 'slug', 'kind', 'status', 'description', 'website', 'notes'];
|
|
7
|
+
export function parseProjectsArgs(args) {
|
|
8
|
+
const [head = 'list', ...rest] = args;
|
|
9
|
+
if (['help', '--help', '-h'].includes(head))
|
|
10
|
+
return { kind: 'help' };
|
|
11
|
+
if (head === 'list' && !rest.length)
|
|
12
|
+
return { kind: 'list' };
|
|
13
|
+
if (head === 'show' && rest.length === 1 && rest[0].trim() && !rest[0].startsWith('-')) {
|
|
14
|
+
return { kind: 'show', slug: rest[0].trim() };
|
|
15
|
+
}
|
|
16
|
+
if (head !== 'create')
|
|
17
|
+
throw new CliError('Usage: dayze projects [list | show <slug> | create "Name"]. See dayze projects help.');
|
|
18
|
+
const fields = {};
|
|
19
|
+
let name;
|
|
20
|
+
for (let i = 0; i < rest.length; i++) {
|
|
21
|
+
const arg = rest[i];
|
|
22
|
+
if (!arg.startsWith('-')) {
|
|
23
|
+
if (name !== undefined)
|
|
24
|
+
throw new CliError('Quote project names containing spaces.');
|
|
25
|
+
name = arg;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const match = /^--([^=]+)(?:=(.*))?$/.exec(arg);
|
|
29
|
+
if (!match || !CREATE_FLAGS.includes(match[1]))
|
|
30
|
+
throw new CliError(`Unknown project option: ${arg}`);
|
|
31
|
+
const key = match[1];
|
|
32
|
+
const value = match[2] ?? rest[++i];
|
|
33
|
+
if (value === undefined || value.startsWith('--') || !value.trim())
|
|
34
|
+
throw new CliError(`--${key} requires a nonblank value`);
|
|
35
|
+
if (fields[key] !== undefined)
|
|
36
|
+
throw new CliError(`--${key} may only be supplied once`);
|
|
37
|
+
fields[key] = value.trim();
|
|
38
|
+
}
|
|
39
|
+
if (name !== undefined && fields.name !== undefined)
|
|
40
|
+
throw new CliError('Supply the project name once, as a name or --name.');
|
|
41
|
+
name = (name ?? fields.name ?? '').trim();
|
|
42
|
+
if (!name)
|
|
43
|
+
throw new CliError('Project name is required. Usage: dayze projects create "Name"');
|
|
44
|
+
if (fields.kind && !['own_venture', 'client_work', 'side_project', 'other'].includes(fields.kind)) {
|
|
45
|
+
throw new CliError('--kind must be own_venture, client_work, side_project, or other');
|
|
46
|
+
}
|
|
47
|
+
if (fields.status && !['active', 'paused', 'archived', 'idea'].includes(fields.status)) {
|
|
48
|
+
throw new CliError('--status must be active, paused, archived, or idea');
|
|
49
|
+
}
|
|
50
|
+
return { kind: 'create', input: { ...fields, name } };
|
|
51
|
+
}
|
|
52
|
+
async function requestProjects(creds, path, input) {
|
|
53
|
+
const header = authHeader(creds);
|
|
54
|
+
if (!header)
|
|
55
|
+
throw new CliError('Not logged in. Run: dayze login');
|
|
56
|
+
return fetchJsonWithDeadline(`${creds.apiBase}/api/cli/projects${path}`, {
|
|
57
|
+
method: input ? 'POST' : 'GET',
|
|
58
|
+
headers: {
|
|
59
|
+
Authorization: header,
|
|
60
|
+
Accept: 'application/json',
|
|
61
|
+
'User-Agent': CLI_USER_AGENT,
|
|
62
|
+
'Cache-Control': 'no-store',
|
|
63
|
+
...(input ? { 'Content-Type': 'application/json' } : {}),
|
|
64
|
+
},
|
|
65
|
+
cache: 'no-store',
|
|
66
|
+
...(input ? { body: JSON.stringify(input) } : {}),
|
|
67
|
+
}, {
|
|
68
|
+
timeoutMessage: input
|
|
69
|
+
? 'Creating project timed out after 15 seconds. Check dayze projects before retrying; the project may have been created.'
|
|
70
|
+
: 'Loading projects timed out after 15 seconds. Check your connection and retry.',
|
|
71
|
+
httpErrorMessage: (status, body) => `Failed to ${input ? 'create' : 'load'} project${path ? '' : 's'} (${status}): ${body}`,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function printProject(project) {
|
|
75
|
+
console.log(` ${ui.c.bold(project.name)} ${ui.c.dim(project.slug)} ${ui.c.dim(project.status)}`);
|
|
76
|
+
console.log(` ${ui.c.dim(project.kind)}`);
|
|
77
|
+
for (const value of [project.description, project.website, project.notes]) {
|
|
78
|
+
if (value)
|
|
79
|
+
console.log(` ${value}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export function printProjectsHelp() {
|
|
83
|
+
console.log(`
|
|
84
|
+
dayze projects — your portfolio (no LLM)
|
|
85
|
+
|
|
86
|
+
dayze projects [list] [--json]
|
|
87
|
+
dayze projects show <slug> [--json]
|
|
88
|
+
dayze projects create "Name" [--json]
|
|
89
|
+
|
|
90
|
+
Create options (also accept --option=value):
|
|
91
|
+
--name "Name" Alternative to a positional name
|
|
92
|
+
--slug my-project Defaults to a slug generated from the name
|
|
93
|
+
--kind own_venture own_venture | client_work | side_project | other
|
|
94
|
+
--status active active | paused | archived | idea
|
|
95
|
+
--description "…" Project description
|
|
96
|
+
--website https://… Website
|
|
97
|
+
--notes "…" Project notes
|
|
98
|
+
`.trimEnd());
|
|
99
|
+
}
|
|
100
|
+
export async function runProjectsCommand(creds, args, options = {}) {
|
|
101
|
+
const command = parseProjectsArgs(args);
|
|
102
|
+
if (command.kind === 'help')
|
|
103
|
+
return printProjectsHelp();
|
|
104
|
+
if (command.kind === 'list') {
|
|
105
|
+
const result = await requestProjects(creds, '');
|
|
106
|
+
if (options.json)
|
|
107
|
+
return printJson(result);
|
|
108
|
+
if (!result.projects.length)
|
|
109
|
+
return ui.info('No projects yet. Try: dayze projects create "My project"');
|
|
110
|
+
console.log(ui.c.brandBold(`Projects (${result.projects.length})`));
|
|
111
|
+
for (const project of result.projects)
|
|
112
|
+
printProject(project);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (command.kind === 'show') {
|
|
116
|
+
const result = await requestProjects(creds, `/${encodeURIComponent(command.slug)}`);
|
|
117
|
+
if (options.json)
|
|
118
|
+
return printJson(result);
|
|
119
|
+
printProject(result.project);
|
|
120
|
+
for (const kpi of result.kpis) {
|
|
121
|
+
console.log(` ${kpi.label}: ${kpi.current} ${kpi.unit}${kpi.target == null ? '' : ` / target ${kpi.target}`}`);
|
|
122
|
+
}
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (command.kind === 'create') {
|
|
126
|
+
const result = await requestProjects(creds, '', command.input);
|
|
127
|
+
if (options.json)
|
|
128
|
+
return printJson(result);
|
|
129
|
+
ui.ok(`Created project: ${result.project.name}`);
|
|
130
|
+
printProject(result.project);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared CLI read deadline (same pattern as focus/me):
|
|
3
|
+
* race headers + body against one timer, abort, and clear on settle.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CLI_READ_TIMEOUT_MS = 15000;
|
|
6
|
+
/** Keep the deadline active through body consumption, even if an adapter ignores abort. */
|
|
7
|
+
export declare function fetchJsonWithDeadline<T>(url: string, init: RequestInit, opts: {
|
|
8
|
+
timeoutMessage: string;
|
|
9
|
+
httpErrorMessage: (status: number, bodyPreview: string) => string;
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
}): Promise<T>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared CLI read deadline (same pattern as focus/me):
|
|
3
|
+
* race headers + body against one timer, abort, and clear on settle.
|
|
4
|
+
*/
|
|
5
|
+
export const CLI_READ_TIMEOUT_MS = 15_000;
|
|
6
|
+
/** Keep the deadline active through body consumption, even if an adapter ignores abort. */
|
|
7
|
+
export async function fetchJsonWithDeadline(url, init, opts) {
|
|
8
|
+
const timeoutMs = opts.timeoutMs ?? CLI_READ_TIMEOUT_MS;
|
|
9
|
+
const controller = new AbortController();
|
|
10
|
+
const timeoutError = new Error(opts.timeoutMessage);
|
|
11
|
+
let timer;
|
|
12
|
+
const deadline = new Promise((_, reject) => {
|
|
13
|
+
timer = setTimeout(() => {
|
|
14
|
+
reject(timeoutError);
|
|
15
|
+
controller.abort(timeoutError);
|
|
16
|
+
}, timeoutMs);
|
|
17
|
+
});
|
|
18
|
+
try {
|
|
19
|
+
return await Promise.race([
|
|
20
|
+
(async () => {
|
|
21
|
+
const res = await fetch(url, { ...init, signal: controller.signal });
|
|
22
|
+
if (!res.ok) {
|
|
23
|
+
const text = await res.text().catch(() => '');
|
|
24
|
+
throw new Error(opts.httpErrorMessage(res.status, text.slice(0, 200)));
|
|
25
|
+
}
|
|
26
|
+
return (await res.json());
|
|
27
|
+
})(),
|
|
28
|
+
deadline,
|
|
29
|
+
]);
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
clearTimeout(timer);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"platform":"darwin","arch":"arm64","desktopRevision":"213f1ff19a1bc807a4c8203db0dee1b12b8a24b6"}
|
package/dist/ui.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Minimal ANSI helpers — Cursor-ish terminal chrome. */
|
|
2
|
+
export declare const c: {
|
|
3
|
+
bold: (s: string) => string;
|
|
4
|
+
dim: (s: string) => string;
|
|
5
|
+
italic: (s: string) => string;
|
|
6
|
+
red: (s: string) => string;
|
|
7
|
+
green: (s: string) => string;
|
|
8
|
+
yellow: (s: string) => string;
|
|
9
|
+
magenta: (s: string) => string;
|
|
10
|
+
cyan: (s: string) => string;
|
|
11
|
+
white: (s: string) => string;
|
|
12
|
+
gray: (s: string) => string;
|
|
13
|
+
/** Dayze pink — matches homepage `.gradient-link` pink end (#FF3C9A) */
|
|
14
|
+
brand: (s: string) => string;
|
|
15
|
+
brandBold: (s: string) => string;
|
|
16
|
+
};
|
|
17
|
+
export declare function banner(version: string, apiBase: string, identity: string): void;
|
|
18
|
+
/** Usage rows for `dayze help` — keep `cli/README.md` in sync (readme-help-sync.test.ts). */
|
|
19
|
+
export declare const HELP_USAGE_ROWS: ReadonlyArray<readonly [command: string, description: string]>;
|
|
20
|
+
export declare function printHelp(): void;
|
|
21
|
+
export declare function promptLabel(): string;
|
|
22
|
+
export declare function agentLabel(): string;
|
|
23
|
+
export declare function thinking(step: string): void;
|
|
24
|
+
export declare function toolCall(tool: string, detail: string): void;
|
|
25
|
+
export declare function toolDone(tool: string, detail: string): void;
|
|
26
|
+
export declare function err(message: string): void;
|
|
27
|
+
export declare function ok(message: string): void;
|
|
28
|
+
export declare function info(message: string): void;
|
|
29
|
+
export declare class Spinner {
|
|
30
|
+
private frames;
|
|
31
|
+
private i;
|
|
32
|
+
private timer;
|
|
33
|
+
private label;
|
|
34
|
+
constructor(label?: string);
|
|
35
|
+
start(): void;
|
|
36
|
+
stop(final?: string): void;
|
|
37
|
+
}
|
package/dist/ui.js
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/** Minimal ANSI helpers — Cursor-ish terminal chrome. */
|
|
2
|
+
const createWrap = (enabled) => (open, close = '\x1b[0m') => (s) => enabled ? `${open}${s}${close}` : s;
|
|
3
|
+
// Styling follows the destination stream; interactive stderr must not color piped stdout.
|
|
4
|
+
const colorsAllowed = process.env.NO_COLOR == null;
|
|
5
|
+
const wrap = createWrap(colorsAllowed && Boolean(process.stdout.isTTY));
|
|
6
|
+
const stderrWrap = createWrap(colorsAllowed && Boolean(process.stderr.isTTY));
|
|
7
|
+
const diagnostic = {
|
|
8
|
+
dim: stderrWrap('\x1b[2m'),
|
|
9
|
+
red: stderrWrap('\x1b[31m'),
|
|
10
|
+
green: stderrWrap('\x1b[32m'),
|
|
11
|
+
cyan: stderrWrap('\x1b[36m'),
|
|
12
|
+
brand: stderrWrap('\x1b[38;2;255;60;154m'),
|
|
13
|
+
};
|
|
14
|
+
export const c = {
|
|
15
|
+
bold: wrap('\x1b[1m'),
|
|
16
|
+
dim: wrap('\x1b[2m'),
|
|
17
|
+
italic: wrap('\x1b[3m'),
|
|
18
|
+
red: wrap('\x1b[31m'),
|
|
19
|
+
green: wrap('\x1b[32m'),
|
|
20
|
+
yellow: wrap('\x1b[33m'),
|
|
21
|
+
magenta: wrap('\x1b[35m'),
|
|
22
|
+
cyan: wrap('\x1b[36m'),
|
|
23
|
+
white: wrap('\x1b[37m'),
|
|
24
|
+
gray: wrap('\x1b[90m'),
|
|
25
|
+
/** Dayze pink — matches homepage `.gradient-link` pink end (#FF3C9A) */
|
|
26
|
+
brand: wrap('\x1b[38;2;255;60;154m'),
|
|
27
|
+
brandBold: wrap('\x1b[1m\x1b[38;2;255;60;154m'),
|
|
28
|
+
};
|
|
29
|
+
export function banner(version, apiBase, identity) {
|
|
30
|
+
const line = c.dim('─'.repeat(52));
|
|
31
|
+
console.log('');
|
|
32
|
+
console.log(`${c.brandBold('◆ Dayze')} ${c.dim(`agent v${version}`)}`);
|
|
33
|
+
console.log(line);
|
|
34
|
+
console.log(`${c.dim(' api')} ${apiBase}`);
|
|
35
|
+
console.log(`${c.dim(' auth')} ${identity}`);
|
|
36
|
+
console.log(line);
|
|
37
|
+
console.log(`${c.dim(' Enter to chat · /help for commands · Ctrl+C to exit')}`);
|
|
38
|
+
console.log('');
|
|
39
|
+
}
|
|
40
|
+
/** Usage rows for `dayze help` — keep `cli/README.md` in sync (readme-help-sync.test.ts). */
|
|
41
|
+
export const HELP_USAGE_ROWS = [
|
|
42
|
+
['dayze', 'Interactive agent (default)'],
|
|
43
|
+
['dayze agent', 'Same as default'],
|
|
44
|
+
['dayze code', 'Code in a project with a chosen runtime and model'],
|
|
45
|
+
['dayze runtimes', 'Discover installed runtimes and coding connections'],
|
|
46
|
+
['dayze mcp-agent --client codex', 'MCP conversation bridge for external agents'],
|
|
47
|
+
['dayze ask "…"', 'One-shot question'],
|
|
48
|
+
['dayze people', 'Address book (all contacts · type to filter)'],
|
|
49
|
+
['dayze people list', 'Print full directory'],
|
|
50
|
+
['dayze people add NAME', 'Create contact (non-interactive)'],
|
|
51
|
+
['dayze people show NAME', 'Contact details'],
|
|
52
|
+
['dayze people paid-for NAME', 'What they paid for you'],
|
|
53
|
+
['dayze people log NAME', 'Log interaction'],
|
|
54
|
+
['dayze people alias …', 'Add nickname'],
|
|
55
|
+
['dayze people merge …', 'Merge duplicates'],
|
|
56
|
+
['dayze inventory', 'Life Inventory (↑↓ Enter · Ctrl+S sort · d delete)'],
|
|
57
|
+
['dayze inventory list', 'Print items [--sort=price|name|updated]'],
|
|
58
|
+
['dayze inventory add NAME', 'Create item (non-interactive)'],
|
|
59
|
+
['dayze inventory show NAME', 'Item detail'],
|
|
60
|
+
['dayze inventory delete NAME', 'Remove item'],
|
|
61
|
+
['dayze life show --kind=… --id=…', 'Life Schema entity envelope'],
|
|
62
|
+
['dayze admin users [q]', 'Admin users list/search (superuser session)'],
|
|
63
|
+
['dayze admin cost', 'Admin AI cost summary [--days=7|30|90]'],
|
|
64
|
+
['dayze admin flags', 'Admin config readiness (bot-config)'],
|
|
65
|
+
['dayze admin health', 'Admin dependency health checks'],
|
|
66
|
+
['dayze admin support', 'Support / feedback queue summary'],
|
|
67
|
+
['dayze admin audit', 'Operational audit list (bot_logs)'],
|
|
68
|
+
['dayze me', 'Your dossier (a agent · e edit)'],
|
|
69
|
+
['dayze me --public-ip', 'Same, plus opt-in third-party public-IP lookup'],
|
|
70
|
+
['dayze projects', 'List portfolio (no LLM)'],
|
|
71
|
+
['dayze projects list', 'List portfolio (no LLM)'],
|
|
72
|
+
['dayze projects show SLUG', 'Project details and KPIs'],
|
|
73
|
+
['dayze projects create "Name"', 'Create project (see dayze projects help)'],
|
|
74
|
+
['dayze day', 'Your Day Age (local math · no LLM)'],
|
|
75
|
+
['dayze day --agent', 'Same via Agent (uses quota / consent)'],
|
|
76
|
+
['dayze focus', "Today's 1–3 platform priorities"],
|
|
77
|
+
['dayze focus add "…"', 'Add priority [--bet=1|2|3]'],
|
|
78
|
+
['dayze channel list', 'IRC-style channels (PHI-2102 stub)'],
|
|
79
|
+
['dayze channel join NAME', 'Join a channel (stub)'],
|
|
80
|
+
['dayze channel leave NAME', 'Leave a channel (stub)'],
|
|
81
|
+
['dayze channel send NAME "…"', 'Send a channel message (stub)'],
|
|
82
|
+
['dayze channel read NAME', 'Read channel messages [--limit=N] (stub)'],
|
|
83
|
+
['dayze login [--key …]', 'Sign in'],
|
|
84
|
+
['dayze logout', ''],
|
|
85
|
+
['dayze whoami', 'Auth / credentials only'],
|
|
86
|
+
['dayze consent status', 'AI sharing consent (Settings → Privacy)'],
|
|
87
|
+
['dayze doctor', 'First-run checklist (auth / host / consent)'],
|
|
88
|
+
['dayze status', ''],
|
|
89
|
+
['dayze help', ''],
|
|
90
|
+
];
|
|
91
|
+
const HELP_USAGE_CMD_WIDTH = 24;
|
|
92
|
+
function formatHelpUsageRow(command, description) {
|
|
93
|
+
if (!description)
|
|
94
|
+
return ` ${command}`;
|
|
95
|
+
if (command.length >= HELP_USAGE_CMD_WIDTH)
|
|
96
|
+
return ` ${command} ${description}`;
|
|
97
|
+
return ` ${command.padEnd(HELP_USAGE_CMD_WIDTH)}${description}`;
|
|
98
|
+
}
|
|
99
|
+
export function printHelp() {
|
|
100
|
+
const usageBlock = HELP_USAGE_ROWS.map(([command, description]) => formatHelpUsageRow(command, description)).join('\n');
|
|
101
|
+
console.log(`
|
|
102
|
+
${c.brandBold('Dayze')} ${c.dim('— terminal agent for your life OS')}
|
|
103
|
+
|
|
104
|
+
${c.bold('Usage')}
|
|
105
|
+
${usageBlock}
|
|
106
|
+
|
|
107
|
+
${c.bold('Flags')}
|
|
108
|
+
--key dayze_k_… API key (Actions scope)
|
|
109
|
+
--email / --password Session login
|
|
110
|
+
--api https://dayze.com API host (default; use localhost:3000 only for local Next)
|
|
111
|
+
--quiet Hide thinking / tool traces
|
|
112
|
+
--json Machine-readable JSON (ask · day · people add/list/show/paid-for · life show · admin · projects list/show/create · focus list · me · inventory add/list)
|
|
113
|
+
--agent For dayze day: ask the Agent instead of local math
|
|
114
|
+
--public-ip Opt in to api.ipify.org for live egress IP on dayze me (off by default)
|
|
115
|
+
|
|
116
|
+
${c.bold('In session')}
|
|
117
|
+
/help /new /clear /people /inventory /me /status /api <url> /exit
|
|
118
|
+
Shortcuts work without slash: people · inventory · me · focus
|
|
119
|
+
|
|
120
|
+
${c.bold('Address book')}
|
|
121
|
+
dayze people Interactive (↑↓ Enter · type to filter)
|
|
122
|
+
dayze people list All contacts (pipe: | less)
|
|
123
|
+
dayze people add "Maya" --email maya@example.com
|
|
124
|
+
dayze people show "Leah" One contact
|
|
125
|
+
dayze people paid-for "Leah" What they paid for on your behalf
|
|
126
|
+
dayze people help
|
|
127
|
+
Detail keys: a agent · e edit · n note
|
|
128
|
+
dayze me Your dossier (a agent · e edit)
|
|
129
|
+
|
|
130
|
+
${c.bold('Life Schema')}
|
|
131
|
+
dayze life show --kind=person --id=<uuid>
|
|
132
|
+
dayze life help
|
|
133
|
+
Kinds: person · event · moment · place · inventory_item
|
|
134
|
+
|
|
135
|
+
${c.bold('Admin (superuser session)')}
|
|
136
|
+
dayze admin users [q] List/search users
|
|
137
|
+
dayze admin cost AI cost summary [--days=7|30|90]
|
|
138
|
+
dayze admin flags Config readiness (bot-config)
|
|
139
|
+
dayze admin health Dependency health checks
|
|
140
|
+
dayze admin support Feedback queue summary
|
|
141
|
+
dayze admin audit Operational audit (bot_logs)
|
|
142
|
+
dayze admin help
|
|
143
|
+
Requires dayze login --email … as is_superuser (not an Actions API key).
|
|
144
|
+
|
|
145
|
+
${c.bold('Inventory')}
|
|
146
|
+
dayze inventory Interactive (↑↓ Enter · type to filter · Ctrl+S sort)
|
|
147
|
+
dayze inventory list Table [--sort=price|name|updated|bought]
|
|
148
|
+
dayze inventory add "Bag" --category bags --purchase-price 80
|
|
149
|
+
dayze inventory show "…" One item
|
|
150
|
+
dayze inventory delete "…" Remove item (confirm on TTY)
|
|
151
|
+
dayze inventory help
|
|
152
|
+
Detail keys: a agent · e edit · n note · d delete
|
|
153
|
+
Or: dayze ask "check my inventory"
|
|
154
|
+
|
|
155
|
+
${c.bold('API host')}
|
|
156
|
+
Default is https://dayze.com (no local server needed once /api/cli is deployed).
|
|
157
|
+
Local Next: dayze login --api http://127.0.0.1:3000 --key 'dayze_k_…'
|
|
158
|
+
If localhost is down, CLI auto-switches back to https://dayze.com.
|
|
159
|
+
|
|
160
|
+
${c.bold('Env')}
|
|
161
|
+
DAYZE_API_BASE DAYZE_API_KEY NO_COLOR=1
|
|
162
|
+
`.trimEnd());
|
|
163
|
+
}
|
|
164
|
+
export function promptLabel() {
|
|
165
|
+
return `${c.brandBold('❯')} `;
|
|
166
|
+
}
|
|
167
|
+
export function agentLabel() {
|
|
168
|
+
return `${c.brand('●')} ${c.bold('Dayze')}`;
|
|
169
|
+
}
|
|
170
|
+
export function thinking(step) {
|
|
171
|
+
process.stderr.write(`${diagnostic.dim(` ⋮ ${step}`)}\n`);
|
|
172
|
+
}
|
|
173
|
+
export function toolCall(tool, detail) {
|
|
174
|
+
process.stderr.write(`${diagnostic.cyan(` ⚡ ${tool}`)} ${diagnostic.dim(detail)}\n`);
|
|
175
|
+
}
|
|
176
|
+
export function toolDone(tool, detail) {
|
|
177
|
+
process.stderr.write(`${diagnostic.green(` ✓ ${tool}`)} ${diagnostic.dim(detail)}\n`);
|
|
178
|
+
}
|
|
179
|
+
export function err(message) {
|
|
180
|
+
console.error(`${diagnostic.red('✗')} ${message}`);
|
|
181
|
+
}
|
|
182
|
+
export function ok(message) {
|
|
183
|
+
console.log(`${c.green('✓')} ${message}`);
|
|
184
|
+
}
|
|
185
|
+
export function info(message) {
|
|
186
|
+
console.log(`${c.dim(message)}`);
|
|
187
|
+
}
|
|
188
|
+
export class Spinner {
|
|
189
|
+
frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
190
|
+
i = 0;
|
|
191
|
+
timer = null;
|
|
192
|
+
label;
|
|
193
|
+
constructor(label = 'Thinking') {
|
|
194
|
+
this.label = label;
|
|
195
|
+
}
|
|
196
|
+
start() {
|
|
197
|
+
if (this.timer) {
|
|
198
|
+
clearInterval(this.timer);
|
|
199
|
+
this.timer = null;
|
|
200
|
+
}
|
|
201
|
+
if (!process.stderr.isTTY) {
|
|
202
|
+
process.stderr.write(`${diagnostic.dim(` ${this.label}…`)}\n`);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
this.timer = setInterval(() => {
|
|
206
|
+
const frame = this.frames[this.i++ % this.frames.length];
|
|
207
|
+
process.stderr.write(`\r${diagnostic.brand(frame)} ${diagnostic.dim(this.label)}… `);
|
|
208
|
+
}, 80);
|
|
209
|
+
}
|
|
210
|
+
stop(final) {
|
|
211
|
+
if (this.timer) {
|
|
212
|
+
clearInterval(this.timer);
|
|
213
|
+
this.timer = null;
|
|
214
|
+
process.stderr.write('\r\x1b[K');
|
|
215
|
+
}
|
|
216
|
+
if (final)
|
|
217
|
+
process.stderr.write(`${diagnostic.dim(` ${final}`)}\n`);
|
|
218
|
+
}
|
|
219
|
+
}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
function readPackageVersion() {
|
|
5
|
+
try {
|
|
6
|
+
const pkg = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json'), 'utf8'));
|
|
7
|
+
return pkg.version || '0.0.0';
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return '0.0.0';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** Semver from cli/package.json (also used in the outbound User-Agent). */
|
|
14
|
+
export const CLI_VERSION = readPackageVersion();
|
|
15
|
+
/** Versioned User-Agent for every outbound Dayze CLI HTTP request. */
|
|
16
|
+
export const CLI_USER_AGENT = `dayze-cli/${CLI_VERSION}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dayzehq/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Talk to Dayze Agent from your terminal",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Phi Digital LLC",
|
|
8
|
+
"homepage": "https://dayze.com",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/gohluke/dayze-webapp/issues"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/gohluke/dayze-webapp.git",
|
|
15
|
+
"directory": "cli"
|
|
16
|
+
},
|
|
17
|
+
"bin": {
|
|
18
|
+
"dayze": "dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE"
|
|
25
|
+
],
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc",
|
|
31
|
+
"build:runtime": "node scripts/build-runtime.mjs",
|
|
32
|
+
"build:all": "npm run build && npm run build:runtime",
|
|
33
|
+
"dev": "tsx src/index.ts",
|
|
34
|
+
"start": "node dist/index.js",
|
|
35
|
+
"prepublishOnly": "npm run build:all"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=20"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"dayze",
|
|
42
|
+
"cli",
|
|
43
|
+
"agent",
|
|
44
|
+
"life-os"
|
|
45
|
+
],
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
48
|
+
"@supabase/supabase-js": "^2.49.1",
|
|
49
|
+
"zod": "^4.6.7"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/node": "^22.13.10",
|
|
53
|
+
"tsx": "^4.19.3",
|
|
54
|
+
"typescript": "^5.8.2"
|
|
55
|
+
}
|
|
56
|
+
}
|