@nodetool-ai/cli-workflow 0.0.0-stage → 0.8.9-beta.2
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 +14 -2
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/api-client.d.ts +580 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +34 -0
- package/dist/api-client.js.map +1 -0
- package/dist/commands/collections.d.ts +10 -0
- package/dist/commands/collections.d.ts.map +1 -0
- package/dist/commands/collections.js +257 -0
- package/dist/commands/collections.js.map +1 -0
- package/dist/commands/costs.d.ts +15 -0
- package/dist/commands/costs.d.ts.map +1 -0
- package/dist/commands/costs.js +201 -0
- package/dist/commands/costs.js.map +1 -0
- package/dist/commands/debug.d.ts +13 -0
- package/dist/commands/debug.d.ts.map +1 -0
- package/dist/commands/debug.js +149 -0
- package/dist/commands/debug.js.map +1 -0
- package/dist/commands/errors.d.ts +11 -0
- package/dist/commands/errors.d.ts.map +1 -0
- package/dist/commands/errors.js +177 -0
- package/dist/commands/errors.js.map +1 -0
- package/dist/commands/generate.d.ts +17 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +326 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/generations.d.ts +17 -0
- package/dist/commands/generations.d.ts.map +1 -0
- package/dist/commands/generations.js +408 -0
- package/dist/commands/generations.js.map +1 -0
- package/dist/commands/install-missing-packs.d.ts +21 -0
- package/dist/commands/install-missing-packs.d.ts.map +1 -0
- package/dist/commands/install-missing-packs.js +48 -0
- package/dist/commands/install-missing-packs.js.map +1 -0
- package/dist/commands/node.d.ts +10 -0
- package/dist/commands/node.d.ts.map +1 -0
- package/dist/commands/node.js +130 -0
- package/dist/commands/node.js.map +1 -0
- package/dist/commands/projects.d.ts +11 -0
- package/dist/commands/projects.d.ts.map +1 -0
- package/dist/commands/projects.js +145 -0
- package/dist/commands/projects.js.map +1 -0
- package/dist/commands/resource-read.d.ts +28 -0
- package/dist/commands/resource-read.d.ts.map +1 -0
- package/dist/commands/resource-read.js +314 -0
- package/dist/commands/resource-read.js.map +1 -0
- package/dist/commands/runs.d.ts +7 -0
- package/dist/commands/runs.d.ts.map +1 -0
- package/dist/commands/runs.js +302 -0
- package/dist/commands/runs.js.map +1 -0
- package/dist/commands/validate.d.ts +24 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +132 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1034 -0
- package/dist/index.js.map +1 -0
- package/dist/nodetool.d.ts +3 -0
- package/dist/nodetool.d.ts.map +1 -0
- package/dist/nodetool.js +4 -0
- package/dist/nodetool.js.map +1 -0
- package/dist/packs/command-service.d.ts +3 -0
- package/dist/packs/command-service.d.ts.map +1 -0
- package/dist/packs/command-service.js +9 -0
- package/dist/packs/command-service.js.map +1 -0
- package/dist/workflow-packs.d.ts +7 -0
- package/dist/workflow-packs.d.ts.map +1 -0
- package/dist/workflow-packs.js +31 -0
- package/dist/workflow-packs.js.map +1 -0
- package/package.json +73 -4
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { trimHyphens } from "@nodetool-ai/cli-common/trimHyphens";
|
|
2
|
+
import { formatInterventionLine, formatSupervisedSummary, summarizeInterventions } from "@nodetool-ai/execution/debug";
|
|
3
|
+
import { addSupervisorOptions, parseSupervisorFlags } from "@nodetool-ai/cli-execution/supervisor";
|
|
4
|
+
import { numericOptionParser } from "@nodetool-ai/cli-common/numeric-options";
|
|
5
|
+
import { printCommandError, commandMissingRuntime, commandMissingPack } from "@nodetool-ai/pack-manager/command-errors";
|
|
6
|
+
import { installMissingPacksAndReexec } from "./install-missing-packs.js";
|
|
7
|
+
export function registerDebugCommands(program) {
|
|
8
|
+
addSupervisorOptions(program
|
|
9
|
+
.command("debug <workflow_id_or_file>")
|
|
10
|
+
.description("Run a workflow end-to-end (server and/or browser) and collect a full debug bundle")
|
|
11
|
+
.option("--no-server", "Skip the headless server surface")
|
|
12
|
+
.option("--install-missing", "Authorize missing node pack installation, then re-execute once")
|
|
13
|
+
.option("--browser", "Also run the workflow in a real browser (Playwright) — expensive")
|
|
14
|
+
.option("--trace", "Capture an OpenTelemetry trace of the server run (timing/tokens/cost) — expensive")
|
|
15
|
+
.option("--stages", "Capture a canvas screenshot at every browser run stage (implies --browser) — expensive")
|
|
16
|
+
.option("--params <json>", "JSON params string keyed by input-node name")
|
|
17
|
+
.option("--out <dir>", "Bundle output directory (default: nodetool-debug/<id>-<timestamp>)")
|
|
18
|
+
.option("--timeout <ms>", "Per-surface run timeout in milliseconds", numericOptionParser("--timeout", { integer: true, min: 0 }))
|
|
19
|
+
.option("--json", "Print the full DebugReport as JSON to stdout")
|
|
20
|
+
.option("--watch", "Re-run on file change and print a diff of the verdict (file targets only)")).action(async (ref, opts) => {
|
|
21
|
+
try {
|
|
22
|
+
const { initDb, Workflow } = await import("@nodetool-ai/models");
|
|
23
|
+
const { initMasterKey } = await import("@nodetool-ai/security");
|
|
24
|
+
const { getDefaultDbPath } = await import("@nodetool-ai/config");
|
|
25
|
+
const { runDebug, runWatchLoop, snapshotDebugReport } = await import("@nodetool-ai/cli-execution/debug/index");
|
|
26
|
+
initDb(getDefaultDbPath());
|
|
27
|
+
try {
|
|
28
|
+
await initMasterKey();
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// Secret decryption is best-effort for debug runs; a missing master
|
|
32
|
+
// key only affects nodes that need secrets.
|
|
33
|
+
}
|
|
34
|
+
const params = opts.params
|
|
35
|
+
? JSON.parse(opts.params)
|
|
36
|
+
: {};
|
|
37
|
+
const loadFromDb = (id) => Workflow.get(id);
|
|
38
|
+
// In watch mode keep a stable bundle dir so each re-run overwrites
|
|
39
|
+
// rather than littering timestamped directories.
|
|
40
|
+
const supervisor = parseSupervisorFlags(opts);
|
|
41
|
+
const runOptions = {
|
|
42
|
+
server: opts.server,
|
|
43
|
+
browser: opts.browser ?? false,
|
|
44
|
+
trace: opts.trace ?? false,
|
|
45
|
+
stages: opts.stages ?? false,
|
|
46
|
+
params
|
|
47
|
+
};
|
|
48
|
+
if (supervisor) {
|
|
49
|
+
runOptions.supervisor = supervisor;
|
|
50
|
+
}
|
|
51
|
+
if (opts.out) {
|
|
52
|
+
runOptions.outDir = opts.out;
|
|
53
|
+
}
|
|
54
|
+
else if (opts.watch) {
|
|
55
|
+
runOptions.outDir = `nodetool-debug/${watchSlug(ref)}-watch`;
|
|
56
|
+
}
|
|
57
|
+
if (opts.timeout) {
|
|
58
|
+
runOptions.timeoutMs = opts.timeout;
|
|
59
|
+
}
|
|
60
|
+
const runOnce = () => runDebug(ref, runOptions, {
|
|
61
|
+
loadFromDb,
|
|
62
|
+
onLog: (line) => console.error(line.trimEnd())
|
|
63
|
+
});
|
|
64
|
+
const report = await runOnce();
|
|
65
|
+
if (!report.verdict.ok && (commandMissingRuntime(report) || commandMissingPack(report))) {
|
|
66
|
+
const exit = await installMissingPacksAndReexec(report, { command: "debug", installMissing: opts.installMissing });
|
|
67
|
+
if (exit !== null) {
|
|
68
|
+
process.exit(exit);
|
|
69
|
+
}
|
|
70
|
+
process.exit(printCommandError(report, opts.json));
|
|
71
|
+
}
|
|
72
|
+
if (opts.json) {
|
|
73
|
+
console.log(JSON.stringify(report, null, 2));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
printSummary(report);
|
|
77
|
+
}
|
|
78
|
+
if (!opts.watch) {
|
|
79
|
+
process.exit(report.verdict.ok ? 0 : 1);
|
|
80
|
+
}
|
|
81
|
+
// ── Watch mode ────────────────────────────────────────────────────
|
|
82
|
+
const { existsSync } = await import("node:fs");
|
|
83
|
+
const { resolve } = await import("node:path");
|
|
84
|
+
const watchPath = resolve(ref);
|
|
85
|
+
if (!existsSync(watchPath)) {
|
|
86
|
+
console.error(`\n--watch needs a file target to watch; "${ref}" is not a file on disk.`);
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
await runWatchLoop({
|
|
90
|
+
file: watchPath,
|
|
91
|
+
first: report,
|
|
92
|
+
run: runOnce,
|
|
93
|
+
snapshot: snapshotDebugReport,
|
|
94
|
+
log: (line) => console.error(line)
|
|
95
|
+
});
|
|
96
|
+
process.exit(0);
|
|
97
|
+
}
|
|
98
|
+
catch (e) {
|
|
99
|
+
const exit = await installMissingPacksAndReexec(e, { command: "debug", installMissing: opts.installMissing });
|
|
100
|
+
if (exit !== null) {
|
|
101
|
+
process.exit(exit);
|
|
102
|
+
}
|
|
103
|
+
process.exit(printCommandError(e, opts.json));
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function watchSlug(ref) {
|
|
108
|
+
return (trimHyphens(ref.replace(/[^a-zA-Z0-9_-]+/g, "-"))
|
|
109
|
+
.slice(0, 40) || "workflow");
|
|
110
|
+
}
|
|
111
|
+
function printSummary(report) {
|
|
112
|
+
const mark = report.verdict.ok ? "✅" : "❌";
|
|
113
|
+
console.log(`\n${mark} ${report.verdict.headline}`);
|
|
114
|
+
if (report.server) {
|
|
115
|
+
console.log(` server: ${report.server.status} (${report.server.summary.counts.errored} node error(s))`);
|
|
116
|
+
const interventions = report.server.summary.interventions;
|
|
117
|
+
if (report.server.supervised && interventions.length > 0) {
|
|
118
|
+
for (const intervention of interventions) {
|
|
119
|
+
console.log(` ${formatInterventionLine(intervention)}`);
|
|
120
|
+
}
|
|
121
|
+
console.log(` ${formatSupervisedSummary(summarizeInterventions(interventions))}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (report.browser) {
|
|
125
|
+
console.log(report.browser.unavailableReason
|
|
126
|
+
? ` browser: skipped — ${report.browser.unavailableReason}`
|
|
127
|
+
: ` browser: ${report.browser.status} (${report.browser.consoleErrors.length} console error(s))`);
|
|
128
|
+
}
|
|
129
|
+
if (report.verdict.issues.length > 0) {
|
|
130
|
+
console.log("\nIssues:");
|
|
131
|
+
for (const issue of report.verdict.issues)
|
|
132
|
+
console.log(` - ${issue}`);
|
|
133
|
+
}
|
|
134
|
+
if (report.verdict.warnings && report.verdict.warnings.length > 0) {
|
|
135
|
+
console.log("\nWarnings:");
|
|
136
|
+
for (const warning of report.verdict.warnings)
|
|
137
|
+
console.log(` - ${warning}`);
|
|
138
|
+
}
|
|
139
|
+
if (report.bundleDir) {
|
|
140
|
+
const parts = ["report.md / report.json", "workflow.json"];
|
|
141
|
+
if (report.server)
|
|
142
|
+
parts.push("server/");
|
|
143
|
+
if (report.browser && !report.browser.unavailableReason)
|
|
144
|
+
parts.push("browser/");
|
|
145
|
+
console.log(`\nDebug bundle: ${report.bundleDir}`);
|
|
146
|
+
console.log(` ${parts.join(" · ")}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=debug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/commands/debug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,qCAAqC,CAAC;AAYhE,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EAErB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AACxH,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAe1E,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,oBAAoB,CAClB,OAAO;SACJ,OAAO,CAAC,6BAA6B,CAAC;SACtC,WAAW,CACV,mFAAmF,CACpF;SACA,MAAM,CAAC,aAAa,EAAE,kCAAkC,CAAC;SACzD,MAAM,CAAC,mBAAmB,EAAE,gEAAgE,CAAC;S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AC,CAAC;IAClC,CAAC;IACD,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAAC;QAC3D,IAAI,MAAM,CAAC,MAAM;YAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,iBAAiB;YACrD,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,mBAAmB,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QACnD,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `nodetool errors` — inspect, export and sync the redacted error traces in
|
|
3
|
+
* the local database.
|
|
4
|
+
*
|
|
5
|
+
* Reads `nodetool_error_traces` in-process, so it works without a running
|
|
6
|
+
* server. Every row was redacted before it was stored; `export` prints
|
|
7
|
+
* Markdown that can go straight into a bug report.
|
|
8
|
+
*/
|
|
9
|
+
import type { Command } from "commander";
|
|
10
|
+
export declare function registerErrorsCommands(program: Command): void;
|
|
11
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/commands/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuCzC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuK7D"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `nodetool errors` — inspect, export and sync the redacted error traces in
|
|
3
|
+
* the local database.
|
|
4
|
+
*
|
|
5
|
+
* Reads `nodetool_error_traces` in-process, so it works without a running
|
|
6
|
+
* server. Every row was redacted before it was stored; `export` prints
|
|
7
|
+
* Markdown that can go straight into a bug report.
|
|
8
|
+
*/
|
|
9
|
+
import { writeFile } from "node:fs/promises";
|
|
10
|
+
import { formatErrorReport, getErrorTrace, listErrorTraces, pruneErrorTraces, summarizeErrorTraces, DEFAULT_ERROR_TRACE_RETENTION_DAYS } from "@nodetool-ai/models";
|
|
11
|
+
import { asJson, printKv, printTable } from "@nodetool-ai/cli-common/commands/output";
|
|
12
|
+
import { setupLocalDb, LOCAL_USER_ID } from "@nodetool-ai/cli-local/local-db";
|
|
13
|
+
function fail(e) {
|
|
14
|
+
console.error(String(e instanceof Error ? e.message : e));
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
function parseLimit(raw, fallback) {
|
|
18
|
+
const n = Number(raw ?? fallback);
|
|
19
|
+
return Number.isFinite(n) && n > 0 ? Math.floor(n) : fallback;
|
|
20
|
+
}
|
|
21
|
+
function firstLine(text, max = 80) {
|
|
22
|
+
const line = text.split("\n")[0] ?? "";
|
|
23
|
+
return line.length > max ? `${line.slice(0, max - 1)}…` : line;
|
|
24
|
+
}
|
|
25
|
+
async function findOrFail(id) {
|
|
26
|
+
const result = await getErrorTrace(LOCAL_USER_ID, id);
|
|
27
|
+
if (result.ok)
|
|
28
|
+
return result.trace;
|
|
29
|
+
return fail(result.reason === "ambiguous"
|
|
30
|
+
? `Trace id ${id} matches more than one trace; use the full id.`
|
|
31
|
+
: `Error trace ${id} was not found.`);
|
|
32
|
+
}
|
|
33
|
+
export function registerErrorsCommands(program) {
|
|
34
|
+
const errors = program
|
|
35
|
+
.command("errors")
|
|
36
|
+
.description("Inspect, export and sync redacted error traces");
|
|
37
|
+
errors
|
|
38
|
+
.command("list")
|
|
39
|
+
.description("Recent errors, grouped by fingerprint unless --all")
|
|
40
|
+
.option("--all", "List individual traces instead of groups")
|
|
41
|
+
.option("--since <iso>", "Only traces at or after this time")
|
|
42
|
+
.option("--fingerprint <fp>", "Only occurrences of one error group")
|
|
43
|
+
.option("--limit <n>", "Maximum rows", "20")
|
|
44
|
+
.option("--json", "Output as JSON")
|
|
45
|
+
.action(async (opts) => {
|
|
46
|
+
try {
|
|
47
|
+
await setupLocalDb();
|
|
48
|
+
const limit = parseLimit(opts.limit, 20);
|
|
49
|
+
if (!opts.all && !opts.fingerprint) {
|
|
50
|
+
const groups = await summarizeErrorTraces(LOCAL_USER_ID, {
|
|
51
|
+
since: opts.since,
|
|
52
|
+
limit
|
|
53
|
+
});
|
|
54
|
+
if (opts.json)
|
|
55
|
+
return asJson(groups);
|
|
56
|
+
printTable(groups.map((g) => ({
|
|
57
|
+
fingerprint: g.fingerprint,
|
|
58
|
+
count: g.count,
|
|
59
|
+
source: g.source,
|
|
60
|
+
last_seen: g.last_seen,
|
|
61
|
+
latest_id: g.latest_id,
|
|
62
|
+
error: firstLine(`${g.error_type ?? "Error"}: ${g.message}`)
|
|
63
|
+
})));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const traces = await listErrorTraces(LOCAL_USER_ID, {
|
|
67
|
+
since: opts.since,
|
|
68
|
+
fingerprint: opts.fingerprint,
|
|
69
|
+
limit
|
|
70
|
+
});
|
|
71
|
+
if (opts.json)
|
|
72
|
+
return asJson(traces);
|
|
73
|
+
printTable(traces.map((t) => ({
|
|
74
|
+
id: t.id,
|
|
75
|
+
created_at: t.created_at,
|
|
76
|
+
source: t.source,
|
|
77
|
+
error: firstLine(`${t.error_type ?? "Error"}: ${t.message}`)
|
|
78
|
+
})));
|
|
79
|
+
}
|
|
80
|
+
catch (e) {
|
|
81
|
+
fail(e);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
errors
|
|
85
|
+
.command("show <id>")
|
|
86
|
+
.description("One trace with its stack (full id or 12-character prefix)")
|
|
87
|
+
.option("--json", "Output as JSON")
|
|
88
|
+
.action(async (id, opts) => {
|
|
89
|
+
try {
|
|
90
|
+
await setupLocalDb();
|
|
91
|
+
const trace = await findOrFail(id);
|
|
92
|
+
if (opts.json)
|
|
93
|
+
return asJson(trace);
|
|
94
|
+
printKv({
|
|
95
|
+
id: trace.id,
|
|
96
|
+
created_at: trace.created_at,
|
|
97
|
+
source: trace.source,
|
|
98
|
+
severity: trace.severity,
|
|
99
|
+
fingerprint: trace.fingerprint,
|
|
100
|
+
error_type: trace.error_type ?? "",
|
|
101
|
+
message: trace.message,
|
|
102
|
+
...(trace.context ?? {})
|
|
103
|
+
});
|
|
104
|
+
if (trace.stack)
|
|
105
|
+
console.log(`\n${trace.stack}`);
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
fail(e);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
errors
|
|
112
|
+
.command("export [ids...]")
|
|
113
|
+
.description("Markdown bug-report section for traces, a group, or recent errors")
|
|
114
|
+
.option("--fingerprint <fp>", "Every recent occurrence of one error group")
|
|
115
|
+
.option("--since <iso>", "Only traces at or after this time")
|
|
116
|
+
.option("--limit <n>", "Maximum traces", "10")
|
|
117
|
+
.option("-o, --out <file>", "Write the report to a file")
|
|
118
|
+
.action(async (ids, opts) => {
|
|
119
|
+
try {
|
|
120
|
+
await setupLocalDb();
|
|
121
|
+
const traces = ids.length > 0
|
|
122
|
+
? await Promise.all(ids.map(findOrFail))
|
|
123
|
+
: await listErrorTraces(LOCAL_USER_ID, {
|
|
124
|
+
fingerprint: opts.fingerprint,
|
|
125
|
+
since: opts.since,
|
|
126
|
+
limit: parseLimit(opts.limit, 10)
|
|
127
|
+
});
|
|
128
|
+
const markdown = formatErrorReport(traces);
|
|
129
|
+
if (opts.out) {
|
|
130
|
+
await writeFile(opts.out, markdown, "utf8");
|
|
131
|
+
console.error(`Wrote ${traces.length} trace(s) to ${opts.out}`);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
console.log(markdown);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
catch (e) {
|
|
138
|
+
fail(e);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
errors
|
|
142
|
+
.command("sync")
|
|
143
|
+
.description("Push unsynced traces to NODETOOL_ERROR_TRACE_SYNC_URL with NODETOOL_ERROR_TRACE_SYNC_TOKEN")
|
|
144
|
+
.action(async () => {
|
|
145
|
+
try {
|
|
146
|
+
const { errorTraceSyncConfig, syncErrorTraces } = await import("@nodetool-ai/error-trace-services");
|
|
147
|
+
const config = errorTraceSyncConfig();
|
|
148
|
+
if (!config) {
|
|
149
|
+
fail("Error trace sync is off. Set NODETOOL_ERROR_TRACE_SYNC_URL (https) " +
|
|
150
|
+
"and NODETOOL_ERROR_TRACE_SYNC_TOKEN to an access token.");
|
|
151
|
+
}
|
|
152
|
+
await setupLocalDb();
|
|
153
|
+
const result = await syncErrorTraces(config);
|
|
154
|
+
if (result.error)
|
|
155
|
+
fail(`Pushed ${result.pushed}, then: ${result.error}`);
|
|
156
|
+
console.log(`Pushed ${result.pushed} trace(s) to ${config.url}`);
|
|
157
|
+
}
|
|
158
|
+
catch (e) {
|
|
159
|
+
fail(e);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
errors
|
|
163
|
+
.command("prune")
|
|
164
|
+
.description("Delete traces older than the retention window")
|
|
165
|
+
.option("--days <n>", "Retention in days", String(DEFAULT_ERROR_TRACE_RETENTION_DAYS))
|
|
166
|
+
.action(async (opts) => {
|
|
167
|
+
try {
|
|
168
|
+
await setupLocalDb();
|
|
169
|
+
const removed = await pruneErrorTraces(parseLimit(opts.days, DEFAULT_ERROR_TRACE_RETENTION_DAYS));
|
|
170
|
+
console.log(`Removed ${removed} trace(s)`);
|
|
171
|
+
}
|
|
172
|
+
catch (e) {
|
|
173
|
+
fail(e);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js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AK;gBAAE,IAAI,CAAC,UAAU,MAAM,CAAC,MAAM,WAAW,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;YACzE,OAAO,CAAC,GAAG,CAAC,UAAU,MAAM,CAAC,MAAM,gBAAgB,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QACnE,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,CAAC,CAAC,CAAC;QACV,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,MAAM;SACH,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,+CAA+C,CAAC;SAC5D,MAAM,CACL,YAAY,EACZ,mBAAmB,EACnB,MAAM,CAAC,kCAAkC,CAAC,CAC3C;SACA,MAAM,CAAC,KAAK,EAAE,IAAuB,EAAE,EAAE;QACxC,IAAI,CAAC;YACH,MAAM,YAAY,EAAE,CAAC;YACrB,MAAM,OAAO,GAAG,MAAM,gBAAgB,CACpC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,kCAAkC,CAAC,CAC1D,CAAC;YACF,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,WAAW,CAAC,CAAC;QAC7C,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,CAAC,CAAC,CAAC;QACV,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `nodetool generate` — generate media from any provider, from the terminal.
|
|
3
|
+
*
|
|
4
|
+
* nodetool generate fal-ai flux-schnell "a red fox in snow" -o fox.png
|
|
5
|
+
* nodetool generate openai gpt-image-1 "a logo" --aspect-ratio 1:1
|
|
6
|
+
* nodetool generate fal-ai --list-models # discover model ids
|
|
7
|
+
*
|
|
8
|
+
* Built to be agent-friendly: positional `<provider> <model> <prompt>`, lenient
|
|
9
|
+
* model/provider name matching, `--json` machine output, and a `--list-models`
|
|
10
|
+
* discovery mode. Today it covers text-to-image (and image-to-image with
|
|
11
|
+
* `--image`); the surface is shaped to grow to other modalities.
|
|
12
|
+
*
|
|
13
|
+
* Heavy deps (runtime providers, DB) load lazily inside the action.
|
|
14
|
+
*/
|
|
15
|
+
import type { Command } from "commander";
|
|
16
|
+
export declare function registerGenerateCommand(program: Command): void;
|
|
17
|
+
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwIzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA2C9D"}
|