@duvoai/cli 0.1.0 → 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/README.md +71 -11
- package/dist/bin/duvo.js +11726 -6
- package/dist/bin/duvo.js.map +7 -0
- package/package.json +10 -8
- package/dist/api/agent-schemas.d.ts +0 -521
- package/dist/api/agent-schemas.js +0 -36
- package/dist/api/parse-fields.d.ts +0 -25
- package/dist/api/parse-fields.js +0 -86
- package/dist/api/read-input.d.ts +0 -6
- package/dist/api/read-input.js +0 -28
- package/dist/api/run-schemas.d.ts +0 -621
- package/dist/api/run-schemas.js +0 -91
- package/dist/bin/create-program.d.ts +0 -7
- package/dist/bin/create-program.js +0 -34
- package/dist/bin/duvo.d.ts +0 -2
- package/dist/client/client.d.ts +0 -23
- package/dist/client/client.js +0 -96
- package/dist/commands/agents/create.d.ts +0 -2
- package/dist/commands/agents/create.js +0 -182
- package/dist/commands/agents/get.d.ts +0 -2
- package/dist/commands/agents/get.js +0 -36
- package/dist/commands/agents/index.d.ts +0 -2
- package/dist/commands/agents/index.js +0 -11
- package/dist/commands/agents/list.d.ts +0 -2
- package/dist/commands/agents/list.js +0 -61
- package/dist/commands/api-render.d.ts +0 -8
- package/dist/commands/api-render.js +0 -72
- package/dist/commands/api.d.ts +0 -2
- package/dist/commands/api.js +0 -90
- package/dist/commands/login.d.ts +0 -2
- package/dist/commands/login.js +0 -80
- package/dist/commands/logout.d.ts +0 -2
- package/dist/commands/logout.js +0 -38
- package/dist/commands/profiles/index.d.ts +0 -2
- package/dist/commands/profiles/index.js +0 -13
- package/dist/commands/profiles/list.d.ts +0 -2
- package/dist/commands/profiles/list.js +0 -22
- package/dist/commands/profiles/remove.d.ts +0 -2
- package/dist/commands/profiles/remove.js +0 -30
- package/dist/commands/profiles/rename.d.ts +0 -2
- package/dist/commands/profiles/rename.js +0 -20
- package/dist/commands/profiles/render-list.d.ts +0 -12
- package/dist/commands/profiles/render-list.js +0 -37
- package/dist/commands/profiles/use.d.ts +0 -2
- package/dist/commands/profiles/use.js +0 -17
- package/dist/commands/runs/get.d.ts +0 -2
- package/dist/commands/runs/get.js +0 -59
- package/dist/commands/runs/index.d.ts +0 -2
- package/dist/commands/runs/index.js +0 -17
- package/dist/commands/runs/messages.d.ts +0 -2
- package/dist/commands/runs/messages.js +0 -80
- package/dist/commands/runs/respond.d.ts +0 -2
- package/dist/commands/runs/respond.js +0 -105
- package/dist/commands/runs/send-message.d.ts +0 -2
- package/dist/commands/runs/send-message.js +0 -41
- package/dist/commands/runs/start.d.ts +0 -2
- package/dist/commands/runs/start.js +0 -54
- package/dist/commands/runs/stop.d.ts +0 -2
- package/dist/commands/runs/stop.js +0 -41
- package/dist/commands/shared/confirm.d.ts +0 -19
- package/dist/commands/shared/confirm.js +0 -28
- package/dist/commands/shared/pagination.d.ts +0 -8
- package/dist/commands/shared/pagination.js +0 -24
- package/dist/commands/shared/profile-flag.d.ts +0 -8
- package/dist/commands/shared/profile-flag.js +0 -17
- package/dist/commands/shared/require-auth.d.ts +0 -12
- package/dist/commands/shared/require-auth.js +0 -18
- package/dist/commands/whoami.d.ts +0 -2
- package/dist/commands/whoami.js +0 -14
- package/dist/config/defaults.d.ts +0 -3
- package/dist/config/defaults.js +0 -4
- package/dist/config/env.d.ts +0 -17
- package/dist/config/env.js +0 -13
- package/dist/config/paths.d.ts +0 -2
- package/dist/config/paths.js +0 -14
- package/dist/config/profiles.d.ts +0 -24
- package/dist/config/profiles.js +0 -78
- package/dist/config/resolve.d.ts +0 -29
- package/dist/config/resolve.js +0 -46
- package/dist/config/store.d.ts +0 -4
- package/dist/config/store.js +0 -94
- package/dist/config/types.d.ts +0 -8
- package/dist/config/types.js +0 -1
- package/dist/errors.d.ts +0 -22
- package/dist/errors.js +0 -42
- package/dist/output/format.d.ts +0 -11
- package/dist/output/format.js +0 -26
- package/dist/output/green.d.ts +0 -5
- package/dist/output/green.js +0 -18
- package/dist/output/json.d.ts +0 -6
- package/dist/output/json.js +0 -8
- package/dist/output/table.d.ts +0 -16
- package/dist/output/table.js +0 -35
- package/dist/output/text.d.ts +0 -9
- package/dist/output/text.js +0 -13
package/dist/errors.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export const EXIT_CODE = {
|
|
2
|
-
SUCCESS: 0,
|
|
3
|
-
GENERIC: 1,
|
|
4
|
-
AUTH: 2,
|
|
5
|
-
NOT_FOUND: 3,
|
|
6
|
-
};
|
|
7
|
-
export class CliError extends Error {
|
|
8
|
-
exitCode;
|
|
9
|
-
constructor(message, exitCode = EXIT_CODE.GENERIC) {
|
|
10
|
-
super(message);
|
|
11
|
-
this.name = "CliError";
|
|
12
|
-
this.exitCode = exitCode;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export class AuthCliError extends CliError {
|
|
16
|
-
constructor(message) {
|
|
17
|
-
super(message, EXIT_CODE.AUTH);
|
|
18
|
-
this.name = "AuthCliError";
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export class NotFoundCliError extends CliError {
|
|
22
|
-
constructor(message) {
|
|
23
|
-
super(message, EXIT_CODE.NOT_FOUND);
|
|
24
|
-
this.name = "NotFoundCliError";
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/** Signals a cooperative user-driven cancel (Ctrl-C, answering "no"). */
|
|
28
|
-
export class CancelCliError extends CliError {
|
|
29
|
-
constructor(message = "Cancelled.") {
|
|
30
|
-
super(message, EXIT_CODE.GENERIC);
|
|
31
|
-
this.name = "CancelCliError";
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
export function handleCliError(error) {
|
|
35
|
-
if (error instanceof CliError) {
|
|
36
|
-
process.stderr.write(`${error.message}\n`);
|
|
37
|
-
process.exit(error.exitCode);
|
|
38
|
-
}
|
|
39
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
40
|
-
process.stderr.write(`error: ${message}\n`);
|
|
41
|
-
process.exit(EXIT_CODE.GENERIC);
|
|
42
|
-
}
|
package/dist/output/format.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mask the secret portion of an API key, leaving the non-secret prefix
|
|
3
|
-
* visible so users can distinguish keys in listings.
|
|
4
|
-
*
|
|
5
|
-
* Keys have the shape `dv_<prefix>-<secret>`. Everything up to and
|
|
6
|
-
* including the first `-` is the public id; everything after is masked.
|
|
7
|
-
* Keys without a dash (shouldn't happen in practice) fall back to a
|
|
8
|
-
* fixed-length prefix so we never leak the tail regardless of format.
|
|
9
|
-
*/
|
|
10
|
-
export declare function truncateApiKey(key: string): string;
|
|
11
|
-
export declare function padRight(value: string, width: number): string;
|
package/dist/output/format.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const FALLBACK_PREFIX_LEN = 11;
|
|
2
|
-
/**
|
|
3
|
-
* Mask the secret portion of an API key, leaving the non-secret prefix
|
|
4
|
-
* visible so users can distinguish keys in listings.
|
|
5
|
-
*
|
|
6
|
-
* Keys have the shape `dv_<prefix>-<secret>`. Everything up to and
|
|
7
|
-
* including the first `-` is the public id; everything after is masked.
|
|
8
|
-
* Keys without a dash (shouldn't happen in practice) fall back to a
|
|
9
|
-
* fixed-length prefix so we never leak the tail regardless of format.
|
|
10
|
-
*/
|
|
11
|
-
export function truncateApiKey(key) {
|
|
12
|
-
const dashIdx = key.indexOf("-");
|
|
13
|
-
const visibleLen = dashIdx >= 0 ? dashIdx + 1 : FALLBACK_PREFIX_LEN;
|
|
14
|
-
if (key.length <= visibleLen) {
|
|
15
|
-
return key;
|
|
16
|
-
}
|
|
17
|
-
const visible = key.slice(0, visibleLen);
|
|
18
|
-
const masked = "*".repeat(key.length - visibleLen);
|
|
19
|
-
return `${visible}${masked}`;
|
|
20
|
-
}
|
|
21
|
-
export function padRight(value, width) {
|
|
22
|
-
if (value.length >= width) {
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
return value + " ".repeat(width - value.length);
|
|
26
|
-
}
|
package/dist/output/green.d.ts
DELETED
package/dist/output/green.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const GREEN = "\x1b[32m";
|
|
2
|
-
const RESET = "\x1b[0m";
|
|
3
|
-
/**
|
|
4
|
-
* Wrap text in ANSI green. Honors `NO_COLOR` and skips styling when
|
|
5
|
-
* stdout is not a TTY so piped output stays clean.
|
|
6
|
-
*/
|
|
7
|
-
export function green(text) {
|
|
8
|
-
if (!shouldColor()) {
|
|
9
|
-
return text;
|
|
10
|
-
}
|
|
11
|
-
return `${GREEN}${text}${RESET}`;
|
|
12
|
-
}
|
|
13
|
-
function shouldColor() {
|
|
14
|
-
if (process.env.NO_COLOR !== undefined && process.env.NO_COLOR !== "") {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
return Boolean(process.stdout.isTTY);
|
|
18
|
-
}
|
package/dist/output/json.d.ts
DELETED
package/dist/output/json.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prints a value as pretty JSON (2-space indent) to stdout. This is the
|
|
3
|
-
* stable output contract — scripts should always be able to `| jq` the
|
|
4
|
-
* result. No colour, no truncation.
|
|
5
|
-
*/
|
|
6
|
-
export function printJson(data) {
|
|
7
|
-
console.log(JSON.stringify(data, null, 2));
|
|
8
|
-
}
|
package/dist/output/table.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export type Column<T> = {
|
|
2
|
-
header: string;
|
|
3
|
-
cell: (row: T) => string;
|
|
4
|
-
/**
|
|
5
|
-
* Optional cap on the rendered width of the column. Cells wider than
|
|
6
|
-
* this are truncated with a trailing `…` to keep each row on one line.
|
|
7
|
-
* The header is truncated too so the column never exceeds the cap.
|
|
8
|
-
*/
|
|
9
|
-
maxWidth?: number;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Renders a fixed-width ASCII table. Columns auto-size to the widest
|
|
13
|
-
* cell (including the header) but never exceed `maxWidth` when set.
|
|
14
|
-
* No colour — non-TTY safe by default.
|
|
15
|
-
*/
|
|
16
|
-
export declare function renderTable<T>(columns: readonly Column<T>[], rows: readonly T[]): string;
|
package/dist/output/table.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Renders a fixed-width ASCII table. Columns auto-size to the widest
|
|
3
|
-
* cell (including the header) but never exceed `maxWidth` when set.
|
|
4
|
-
* No colour — non-TTY safe by default.
|
|
5
|
-
*/
|
|
6
|
-
export function renderTable(columns, rows) {
|
|
7
|
-
if (columns.length === 0) {
|
|
8
|
-
return "";
|
|
9
|
-
}
|
|
10
|
-
const cells = rows.map((row) => columns.map((col) => col.cell(row)));
|
|
11
|
-
const widths = columns.map((col, i) => {
|
|
12
|
-
const contentWidth = Math.max(col.header.length, ...cells.map((row) => row[i].length));
|
|
13
|
-
return col.maxWidth ? Math.min(col.maxWidth, contentWidth) : contentWidth;
|
|
14
|
-
});
|
|
15
|
-
const headerLine = columns
|
|
16
|
-
.map((col, i) => pad(truncate(col.header, widths[i]), widths[i]))
|
|
17
|
-
.join(" ");
|
|
18
|
-
const bodyLines = cells.map((row) => row.map((cell, i) => pad(truncate(cell, widths[i]), widths[i])).join(" "));
|
|
19
|
-
return [headerLine, ...bodyLines].join("\n");
|
|
20
|
-
}
|
|
21
|
-
function pad(value, width) {
|
|
22
|
-
if (value.length >= width) {
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
return value + " ".repeat(width - value.length);
|
|
26
|
-
}
|
|
27
|
-
function truncate(value, width) {
|
|
28
|
-
if (value.length <= width) {
|
|
29
|
-
return value;
|
|
30
|
-
}
|
|
31
|
-
if (width <= 1) {
|
|
32
|
-
return "…".slice(0, width);
|
|
33
|
-
}
|
|
34
|
-
return `${value.slice(0, width - 1)}…`;
|
|
35
|
-
}
|
package/dist/output/text.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export type KeyValueEntry = {
|
|
2
|
-
label: string;
|
|
3
|
-
value: string;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Renders a labelled key/value block for single-resource views.
|
|
7
|
-
* Labels are left-padded to the widest label so values line up.
|
|
8
|
-
*/
|
|
9
|
-
export declare function renderKeyValue(entries: readonly KeyValueEntry[]): string;
|
package/dist/output/text.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Renders a labelled key/value block for single-resource views.
|
|
3
|
-
* Labels are left-padded to the widest label so values line up.
|
|
4
|
-
*/
|
|
5
|
-
export function renderKeyValue(entries) {
|
|
6
|
-
if (entries.length === 0) {
|
|
7
|
-
return "";
|
|
8
|
-
}
|
|
9
|
-
const labelWidth = Math.max(...entries.map((e) => e.label.length));
|
|
10
|
-
return entries
|
|
11
|
-
.map((entry) => `${entry.label.padEnd(labelWidth)} ${entry.value}`)
|
|
12
|
-
.join("\n");
|
|
13
|
-
}
|