@jini-ai/cli 0.6.15-rc.1 → 0.6.15
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/daemon-command.js +2 -2
- package/dist/flags.js +5 -4
- package/dist/http.js +1 -2
- package/dist/main.js +14 -11
- package/dist/run-command.js +6 -4
- package/dist/version-command.js +1 -2
- package/package.json +7 -7
package/dist/daemon-command.js
CHANGED
|
@@ -88,9 +88,9 @@ export function registerDaemonCommands({ registry, resolveBaseUrl }, optionalArg
|
|
|
88
88
|
case '--help':
|
|
89
89
|
case '-h':
|
|
90
90
|
(deps.write ?? defaultWrite)({ text: `${DAEMON_USAGE}\n` });
|
|
91
|
-
return;
|
|
91
|
+
return undefined;
|
|
92
92
|
default:
|
|
93
|
-
invalidFlag(deps, `unknown "daemon" subcommand: ${sub}`);
|
|
93
|
+
return invalidFlag(deps, `unknown "daemon" subcommand: ${sub}`);
|
|
94
94
|
}
|
|
95
95
|
} }, { usage: DAEMON_USAGE });
|
|
96
96
|
}
|
package/dist/flags.js
CHANGED
|
@@ -83,11 +83,12 @@ export function positionalArgs({ argv }, opts = {}) {
|
|
|
83
83
|
}
|
|
84
84
|
if (!a.startsWith('--')) {
|
|
85
85
|
out.push(a);
|
|
86
|
-
continue;
|
|
87
86
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
else {
|
|
88
|
+
const { key, inlineValue } = splitFlagToken({ token: a });
|
|
89
|
+
if (inlineValue === undefined && stringFlags.has(key))
|
|
90
|
+
i++;
|
|
91
|
+
}
|
|
91
92
|
}
|
|
92
93
|
return out;
|
|
93
94
|
}
|
package/dist/http.js
CHANGED
|
@@ -94,7 +94,7 @@ async function readStreamText(body, maxBytes) {
|
|
|
94
94
|
for (;;) {
|
|
95
95
|
const { done, value } = await reader.read();
|
|
96
96
|
if (done === true)
|
|
97
|
-
|
|
97
|
+
return text + decoder.decode();
|
|
98
98
|
if (value === undefined)
|
|
99
99
|
continue;
|
|
100
100
|
total += value.byteLength;
|
|
@@ -102,7 +102,6 @@ async function readStreamText(body, maxBytes) {
|
|
|
102
102
|
throw new ResponseTooLargeError(maxBytes);
|
|
103
103
|
text += decoder.decode(value, { stream: true });
|
|
104
104
|
}
|
|
105
|
-
return text + decoder.decode();
|
|
106
105
|
}
|
|
107
106
|
finally {
|
|
108
107
|
reader.releaseLock();
|
package/dist/main.js
CHANGED
|
@@ -131,13 +131,14 @@ function partitionGlobalArgv(argv) {
|
|
|
131
131
|
}
|
|
132
132
|
if (match.inlineValue !== undefined) {
|
|
133
133
|
globals[match.key] = match.inlineValue;
|
|
134
|
-
continue;
|
|
135
134
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
135
|
+
else {
|
|
136
|
+
const value = argv[i + 1];
|
|
137
|
+
if (value === undefined)
|
|
138
|
+
throw new Error(`flag --${match.key} requires a value`);
|
|
139
|
+
globals[match.key] = value;
|
|
140
|
+
i++;
|
|
141
|
+
}
|
|
141
142
|
}
|
|
142
143
|
return { globals, rest };
|
|
143
144
|
}
|
|
@@ -155,11 +156,13 @@ function matchGlobalFlag(token) {
|
|
|
155
156
|
/** Builds a `resolveDaemonUrl`-backed `resolveBaseUrl` closure from this binary's own parsed global flags. */
|
|
156
157
|
function buildResolveBaseUrl(globals, env, warn) {
|
|
157
158
|
const { 'daemon-url': daemonUrl, 'data-dir': dataDir, 'registry-path': registryPath } = globals;
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
159
|
+
let discover;
|
|
160
|
+
if (registryPath !== undefined)
|
|
161
|
+
discover = createLocalDaemonDiscovery({ registryPath });
|
|
162
|
+
else if (dataDir !== undefined)
|
|
163
|
+
discover = createLocalDaemonDiscovery({ dataDir });
|
|
164
|
+
else
|
|
165
|
+
discover = undefined;
|
|
163
166
|
return () => resolveDaemonUrl({}, {
|
|
164
167
|
flagUrl: daemonUrl ?? null,
|
|
165
168
|
env,
|
package/dist/run-command.js
CHANGED
|
@@ -190,7 +190,8 @@ export async function watchRunEvents({ baseUrl, runId, args }, deps = {}) {
|
|
|
190
190
|
const write = deps.write ?? defaultWrite;
|
|
191
191
|
const resp = await fetchImpl(`${baseUrl}/api/runs/${encodeURIComponent(runId)}/events`, { headers });
|
|
192
192
|
if (!resp.ok || resp.body === null) {
|
|
193
|
-
|
|
193
|
+
await structuredHttpFailure({ resp }, { fallbackCode: 'daemon-not-running', ...errorOptions(deps) });
|
|
194
|
+
return;
|
|
194
195
|
}
|
|
195
196
|
try {
|
|
196
197
|
await writeEventsUntilEnd({ body: resp.body, write });
|
|
@@ -199,7 +200,8 @@ export async function watchRunEvents({ baseUrl, runId, args }, deps = {}) {
|
|
|
199
200
|
// A broken/hostile stream (e.g. the unbounded-buffer guard above) must exit through the same
|
|
200
201
|
// structured contract as every other failure here, not surface as an unhandled rejection.
|
|
201
202
|
const message = error instanceof Error ? error.message : String(error);
|
|
202
|
-
|
|
203
|
+
exitWithStructuredError({ code: 'daemon-not-running', message: sanitizeUntrustedText({ text: message }) }, errorOptions(deps));
|
|
204
|
+
return;
|
|
203
205
|
}
|
|
204
206
|
}
|
|
205
207
|
/** `last-event-id` from a non-empty `--after-cursor`, so a reconnect resumes after that cursor; no header otherwise. */
|
|
@@ -247,9 +249,9 @@ export function registerRunCommands({ registry, resolveBaseUrl: resolveBaseUrlPo
|
|
|
247
249
|
case '--help':
|
|
248
250
|
case '-h':
|
|
249
251
|
(deps.write ?? defaultWrite)({ text: `${RUN_USAGE}\n` });
|
|
250
|
-
return;
|
|
252
|
+
return undefined;
|
|
251
253
|
default:
|
|
252
|
-
invalidFlag(deps, `unknown "run" subcommand: ${sub}`);
|
|
254
|
+
return invalidFlag(deps, `unknown "run" subcommand: ${sub}`);
|
|
253
255
|
}
|
|
254
256
|
} }, { usage: RUN_USAGE });
|
|
255
257
|
}
|
package/dist/version-command.js
CHANGED
|
@@ -71,7 +71,6 @@ export async function versionCommand({ args, resolveBaseUrl }, optionalArgs = {}
|
|
|
71
71
|
}
|
|
72
72
|
/** Registers `version` against `registry`. */
|
|
73
73
|
export function registerVersionCommand({ registry, resolveBaseUrl }, optionalArgs = {}) {
|
|
74
|
-
|
|
75
|
-
registry.add({ name: 'version', handler: ({ args }) => versionCommand({ args, resolveBaseUrl: resolveBaseUrl }, optionalArgs) }, { usage: VERSION_USAGE });
|
|
74
|
+
registry.add({ name: 'version', handler: ({ args }) => versionCommand({ args, resolveBaseUrl }, optionalArgs) }, { usage: VERSION_USAGE });
|
|
76
75
|
}
|
|
77
76
|
//# sourceMappingURL=version-command.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/cli",
|
|
3
|
-
"version": "0.6.15
|
|
3
|
+
"version": "0.6.15",
|
|
4
4
|
"description": "CLI transport shell for driving a Jini daemon over HTTP: flag parsing, daemon-URL resolution, local daemon discovery, and a pluggable command registry.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -54,16 +54,16 @@
|
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"commander": "^15.0.0",
|
|
57
|
-
"@jini-ai/core": "0.6.15
|
|
58
|
-
"@jini-ai/platform": "0.6.15
|
|
59
|
-
"@jini-ai/sidecar": "0.6.15
|
|
57
|
+
"@jini-ai/core": "0.6.15",
|
|
58
|
+
"@jini-ai/platform": "0.6.15",
|
|
59
|
+
"@jini-ai/sidecar": "0.6.15"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@jini-ai/core": "^0.6.15
|
|
62
|
+
"@jini-ai/core": "^0.6.15"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@jini-ai/platform": "^0.6.
|
|
66
|
-
"@jini-ai/sidecar": "^0.6.
|
|
65
|
+
"@jini-ai/platform": "^0.6.10",
|
|
66
|
+
"@jini-ai/sidecar": "^0.6.10"
|
|
67
67
|
},
|
|
68
68
|
"peerDependenciesMeta": {
|
|
69
69
|
"@jini-ai/platform": {
|