sim 2.2.20-preview.257.1 → 2.2.21-preview.259.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/embed.d.ts +17 -1
- package/dist/runtime.js +12 -8
- package/package.json +1 -1
package/dist/embed.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type EmbedContext, type EmbeddedCliIdentity } from './embed-context';
|
|
2
|
+
import type { V2OperationName } from './generated/v2-api';
|
|
2
3
|
import { SimClient } from './http/client';
|
|
3
4
|
/**
|
|
4
5
|
* In-process execution of one CLI invocation, for a server that already knows
|
|
@@ -14,7 +15,7 @@ import { SimClient } from './http/client';
|
|
|
14
15
|
*/
|
|
15
16
|
export type { EmbeddedCliIdentity, EmbeddedFileSnapshot } from './embed-context';
|
|
16
17
|
export { STILL_RUNNING_EXIT_CODE } from './exit-codes';
|
|
17
|
-
export type { ExportWorkflowResponse, ListFilesResponse, ListWorkflowsResponse, ReadFileTextResponse, } from './generated/v2-api';
|
|
18
|
+
export type { ExportWorkflowResponse, ListFilesResponse, ListWorkflowsResponse, ReadFileTextResponse, V2OperationName, } from './generated/v2-api';
|
|
18
19
|
export { SimApiError, SimClient } from './http/client';
|
|
19
20
|
export interface EmbeddedCliResult {
|
|
20
21
|
exitCode: number;
|
|
@@ -39,3 +40,18 @@ export declare function runEmbeddedCli(argv: string[], identity: EmbeddedCliIden
|
|
|
39
40
|
openFile?: EmbedContext['openFile'];
|
|
40
41
|
writeFile?: EmbedContext['writeFile'];
|
|
41
42
|
}): Promise<EmbeddedCliResult>;
|
|
43
|
+
interface EmbeddedCliCommand {
|
|
44
|
+
/** The command's canonical path (`['workflows', 'deploy']`), aliases resolved. */
|
|
45
|
+
path: string[];
|
|
46
|
+
/** Every v2 operation it may call: a command reaches only those it declares (`connect`). */
|
|
47
|
+
operations: readonly V2OperationName[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The command `argv` runs under {@link runEmbeddedCli}, resolved by the same command
|
|
51
|
+
* tree and parser and stopped before any action runs.
|
|
52
|
+
*
|
|
53
|
+
* Null when the parse ends without dispatching (help, a usage error), which calls
|
|
54
|
+
* nothing. Undefined when the parse could not be followed to an answer, so a caller
|
|
55
|
+
* deciding whether to stop for consent can fail closed.
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveEmbeddedCliCommand(argv: string[]): EmbeddedCliCommand | null | undefined;
|
package/dist/runtime.js
CHANGED
|
@@ -26447,11 +26447,7 @@ async function runEmbeddedCli(argv, identity, options) {
|
|
|
26447
26447
|
let exitCode = 0;
|
|
26448
26448
|
try {
|
|
26449
26449
|
identity.signal?.throwIfAborted();
|
|
26450
|
-
const program =
|
|
26451
|
-
hostCommands: false,
|
|
26452
|
-
helpText: "The embedding application supplies authentication, endpoint and workspace scope."
|
|
26453
|
-
});
|
|
26454
|
-
configureEmbeddedOutput(program);
|
|
26450
|
+
const program = buildEmbeddedProgram({ writeOut: writeStdout, writeErr: writeStderr });
|
|
26455
26451
|
await program.parseAsync(argv, { from: "user" });
|
|
26456
26452
|
if (ctx.softExitCode !== undefined && ctx.softExitCode !== 0)
|
|
26457
26453
|
exitCode = ctx.softExitCode;
|
|
@@ -26511,11 +26507,19 @@ function renderEmbeddedError(ctx, error) {
|
|
|
26511
26507
|
ctx.stderr.diagnostic(`Error: ${sanitize(getErrorMessage(error))}`);
|
|
26512
26508
|
return 1;
|
|
26513
26509
|
}
|
|
26514
|
-
function
|
|
26515
|
-
|
|
26510
|
+
function buildEmbeddedProgram(output) {
|
|
26511
|
+
const program = buildProgram({
|
|
26512
|
+
hostCommands: false,
|
|
26513
|
+
helpText: "The embedding application supplies authentication, endpoint and workspace scope."
|
|
26514
|
+
});
|
|
26515
|
+
configureEmbeddedOutput(program, output);
|
|
26516
|
+
return program;
|
|
26517
|
+
}
|
|
26518
|
+
function configureEmbeddedOutput(command, output) {
|
|
26519
|
+
command.configureOutput(output);
|
|
26516
26520
|
command.exitOverride();
|
|
26517
26521
|
for (const child of command.commands)
|
|
26518
|
-
configureEmbeddedOutput(child);
|
|
26522
|
+
configureEmbeddedOutput(child, output);
|
|
26519
26523
|
}
|
|
26520
26524
|
// src/terminal.ts
|
|
26521
26525
|
function explainFailure(error, program) {
|