@enhance-eng/enhance 0.1.6 → 0.1.7

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/main.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { B as canvasAgentActivityPhaseSchema, C as completeRecordingOutputSchema, G as getCanvasDocumentOutputSchema, I as cliAuthConfigurationSchema, K as saveCanvasDocumentOutputSchema, L as createAgentTokenOutputSchema, P as getMeOutputSchema, R as createOrganisationOutputSchema, S as appendRecordingChunkOutputSchema, U as canvasOperationSchema, V as MAX_CANVAS_OPERATIONS, W as canvasNodeStylePatchSchema, X as canvasWorldBoundsSchema, Y as RENDER_MIN_SCALE, _ as CliError, a as createRouterShapeAdapter, b as completeScreenOutputSchema, c as PROCEDURE_DESCRIPTIONS, g as PartialBatchError, i as createCapabilityCatalogAdapter, n as toFailurePayload, nt as canvasSchema, o as createCapabilityPolicyAdapter, r as ProcessExitError, s as OPTION_DESCRIPTIONS, t as toExitCode, tt as canvasSceneDocumentSchema, w as startRecordingOutputSchema, x as createScreenOutputSchema, y as appErrorSchema, z as beginCanvasActivityOutputSchema } from "./failure.mapper-CNRVSTrf.mjs";
3
- import { a as createCapabilityInvocationAdapter, c as createApplyCanvasComposite, l as createCanvasActivityComposite, n as createHttpRemoteAdapter, o as createRenderFileAdapter, r as CLI_CONFIG, s as createWriteHtmlCanvasComposite, t as createMutationKeyAdapter, u as createRenderCanvasComposite } from "./mutation-key.adapter-B7Ss_464.mjs";
4
- import { t as toCapabilityInventory } from "./capability-inventory.mapper-DN3TEDbU.mjs";
5
- import { t as createFileCredentialAdapter } from "./file-credential.adapter-WNl4GM58.mjs";
2
+ import { A as startRecordingOutputSchema, C as CliError, D as createScreenOutputSchema, E as completeScreenOutputSchema, G as beginCanvasActivityOutputSchema, K as canvasAgentActivityPhaseSchema, O as appendRecordingChunkOutputSchema, Q as saveCanvasDocumentOutputSchema, S as PartialBatchError, T as appErrorSchema, W as createOrganisationOutputSchema, X as canvasNodeStylePatchSchema, Y as canvasOperationSchema, Z as getCanvasDocumentOutputSchema, c as ProcessExitError, ct as canvasSchema, d as createCapabilityPolicyAdapter, i as toFailurePayload, k as completeRecordingOutputSchema, l as createCapabilityCatalogAdapter, m as PROCEDURE_DESCRIPTIONS, n as withCommandName, nt as canvasWorldBoundsSchema, o as toSharedCapabilities, p as OPTION_DESCRIPTIONS, q as MAX_CANVAS_OPERATIONS, r as toExitCode, s as createMcpCapabilityDiscoveryAdapter, st as canvasSceneDocumentSchema, t as withCommandInFailure, tt as RENDER_MIN_SCALE, u as createRouterShapeAdapter } from "./cli-output-identity.lib-BSUBcRJm.mjs";
3
+ import { a as createOauthLoopbackAdapter, c as createWriteHtmlCanvasComposite, d as createRenderCanvasComposite, f as createAuthUseCase, l as createApplyCanvasComposite, n as createHttpRemoteAdapter, o as createCapabilityInvocationAdapter, r as CLI_CONFIG, s as createRenderFileAdapter, t as createMutationKeyAdapter, u as createCanvasActivityComposite } from "./mutation-key.adapter-EvvklGSw.mjs";
4
+ import { t as toCapabilityInventory } from "./capability-inventory.mapper-DyYXyVBJ.mjs";
5
+ import { t as createFileCredentialAdapter } from "./file-credential.adapter-rI5HpMEo.mjs";
6
6
  import { Command } from "commander";
7
7
  import { createCli, parseRouter } from "trpc-cli";
8
8
  import { z } from "zod";
@@ -11,11 +11,10 @@ import process from "node:process";
11
11
  import { createInterface } from "node:readline";
12
12
  import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, statSync, unlinkSync, writeFileSync } from "node:fs";
13
13
  import path from "node:path";
14
- import { createHash, randomBytes, randomUUID } from "node:crypto";
14
+ import { createHash, randomUUID } from "node:crypto";
15
15
  import { readFile } from "node:fs/promises";
16
- import { spawn } from "node:child_process";
17
- import { createServer } from "node:http";
18
16
  import { proxify } from "trpc-cli/dist/proxify.js";
17
+
19
18
  //#region ../../packages/contract/src/canvas/canvas-presentation-defaults.lib.ts
20
19
  const emptyCanvasNodeLayout = () => ({
21
20
  rotation: 0,
@@ -32,6 +31,7 @@ const emptyCanvasNodeLayout = () => ({
32
31
  position: "absolute",
33
32
  clipContent: false
34
33
  });
34
+
35
35
  //#endregion
36
36
  //#region ../../packages/contract/src/fixture/canvas-fixture.lib.ts
37
37
  const ROOT_FIXTURE_NODE_ID = "root";
@@ -76,6 +76,7 @@ const withFixtureScreen = (document, input) => withFixtureNode(document, {
76
76
  ...input.viewport
77
77
  }
78
78
  });
79
+
79
80
  //#endregion
80
81
  //#region ../../packages/contract/src/recording/event-stream.lib.ts
81
82
  /**
@@ -146,52 +147,7 @@ const cutStream = (entries, limit) => {
146
147
  const writer = streamWriter(limit);
147
148
  return [...entries.flatMap((entry) => writer.add(entry)), ...writer.drain()];
148
149
  };
149
- //#endregion
150
- //#region src/application/auth.use-case.ts
151
- const TOKEN = /^enh_[\w-]{43}$/;
152
- const authenticated = (value) => {
153
- const parsed = getMeOutputSchema.parse(value);
154
- if (parsed.authentication.kind !== "agent" || parsed.person === null) throw new CliError("UNAUTHORIZED", "The credential is missing, expired, revoked, or invalid.", "Run 'enhance auth login' and complete authentication in the browser.");
155
- return {
156
- authenticated: true,
157
- personId: parsed.person.id,
158
- displayName: parsed.person.displayName,
159
- tokenId: parsed.authentication.tokenId,
160
- tokenLabel: parsed.authentication.tokenLabel,
161
- expiresAt: parsed.authentication.expiresAt
162
- };
163
- };
164
- const createAuthUseCase = (credentials, remote, browser) => ({
165
- loginWithToken: async (token) => {
166
- if (!TOKEN.test(token)) throw new CliError("BAD_REQUEST", "Agent tokens begin with enh_ and contain 32 base64url bytes.", "Pass a manual token from Settings to 'enhance auth login' through stdin.");
167
- const status = authenticated(await remote.queryWithToken("person.me", {}, token));
168
- await credentials.write(token);
169
- return status;
170
- },
171
- loginWithBrowser: async (input) => {
172
- const configuration = cliAuthConfigurationSchema.parse(await remote.authenticationConfig());
173
- if (configuration.method === "token") throw new CliError("BAD_REQUEST", "Browser authentication is not configured for this Enhance environment.", "Ask an administrator to configure CLI OAuth, or pass an agent token to 'enhance auth login --token'.");
174
- const accessToken = await browser.authorize({
175
- issuer: configuration.issuer,
176
- clientId: configuration.clientId,
177
- scope: configuration.scope,
178
- openBrowser: input.openBrowser,
179
- onReady: input.onReady
180
- });
181
- const created = createAgentTokenOutputSchema.parse(await remote.mutateWithToken("person.createAgentToken", {
182
- label: input.label,
183
- expiresAt: null
184
- }, accessToken));
185
- const status = authenticated(await remote.queryWithToken("person.me", {}, created.token));
186
- await credentials.write(created.token);
187
- return status;
188
- },
189
- status: async () => {
190
- if (await credentials.read() === null) throw new CliError("UNAUTHORIZED", `No credential exists at ${credentials.path}.`, "A human must run 'enhance auth login'.");
191
- return authenticated(await remote.query("person.me", {}));
192
- },
193
- logout: async () => ({ loggedOut: await credentials.remove() })
194
- });
150
+
195
151
  //#endregion
196
152
  //#region src/application/recording-fixture.composite.ts
197
153
  const CHUNK_LIMIT = 8 * 1048576;
@@ -243,6 +199,7 @@ const createRecordingFixtureComposite = (remote) => async (input) => {
243
199
  throw new PartialBatchError(`Recording ${started.recordingId} began, but not every chunk was committed.`, `Run 'enhance recording discard --recording-id ${started.recordingId}' to remove the incomplete attempt before retrying the fixture.`);
244
200
  }
245
201
  };
202
+
246
203
  //#endregion
247
204
  //#region src/application/screen-fixture.composite.ts
248
205
  const SCREEN_FIXTURE_PROCEDURES = ["screen.create", "screen.complete"];
@@ -280,6 +237,7 @@ const createScreenFixtureComposite = (remote) => async (input) => {
280
237
  throw new PartialBatchError(`Screen ${created.screenId} was reserved, but its upload did not complete.`, `Retry 'enhance fixture screen' with the same --client-token ${input.clientToken}.`);
281
238
  }
282
239
  };
240
+
283
241
  //#endregion
284
242
  //#region src/application/world-fixture.composite.ts
285
243
  const WORLD_FIXTURE_PROCEDURES = [
@@ -334,6 +292,7 @@ const createWorldFixtureComposite = (remote, createScreen) => async (input) => {
334
292
  throw new PartialBatchError(`Organisation ${organisation.id} and canvas ${canvas.id} exist, but the world is incomplete.`, `Inspect 'enhance canvas get --canvas-id ${canvas.id}' before retrying any missing steps.`);
335
293
  }
336
294
  };
295
+
337
296
  //#endregion
338
297
  //#region src/infrastructure/stdin-token.lib.ts
339
298
  const readToken = async (offered, command) => {
@@ -365,6 +324,7 @@ const readOptionalToken = async (offered) => {
365
324
  }
366
325
  return null;
367
326
  };
327
+
368
328
  //#endregion
369
329
  //#region src/infrastructure/auth.program.ts
370
330
  const MAX_TOKEN_LABEL_CHARACTERS = 120;
@@ -394,6 +354,216 @@ const registerAuthProgram = (program, auth, output) => {
394
354
  output.result(await auth.logout());
395
355
  });
396
356
  };
357
+
358
+ //#endregion
359
+ //#region src/infrastructure/canvas-authoring-input.schema.ts
360
+ const NODE_ID_LENGTH = 200;
361
+ const NODE_NAME_LENGTH = 500;
362
+ const TEXT_LENGTH = 1e5;
363
+ const MAX_NODE_IDS = 1e3;
364
+ const MAX_BATCHES = 100;
365
+ const MAX_DEPTH = 20;
366
+ const MIN_RENDER_SCALE = .1;
367
+ const MAX_RENDER_SCALE = 4;
368
+ const positiveIntegerSchema = z.coerce.number().int().positive();
369
+ const renderScaleSchema = z.coerce.number().min(MIN_RENDER_SCALE).max(MAX_RENDER_SCALE);
370
+ const authoringUuidSchema = z.uuid();
371
+ const styleValueSchema = z.union([
372
+ z.string(),
373
+ z.number(),
374
+ z.null()
375
+ ]);
376
+ const styleObjectSchema = z.record(z.string(), styleValueSchema);
377
+ const textUpdatesSchema = z.array(z.object({
378
+ nodeId: z.string().min(1).max(NODE_ID_LENGTH),
379
+ textContent: z.string().max(TEXT_LENGTH)
380
+ })).min(1).max(MAX_NODE_IDS);
381
+ const renameUpdatesSchema = z.array(z.object({
382
+ nodeId: z.string().min(1).max(NODE_ID_LENGTH),
383
+ name: z.string().max(NODE_NAME_LENGTH)
384
+ })).min(1).max(MAX_NODE_IDS);
385
+ const styleUpdatesSchema = z.array(z.object({
386
+ nodeIds: z.array(z.string().min(1).max(NODE_ID_LENGTH)).min(1).max(MAX_BATCHES),
387
+ styles: styleObjectSchema
388
+ })).min(1).max(MAX_BATCHES);
389
+ const duplicateInputsSchema = z.array(z.object({
390
+ id: z.string().min(1).max(NODE_ID_LENGTH),
391
+ parentId: z.string().min(1).max(NODE_ID_LENGTH).optional()
392
+ })).min(1).max(MAX_BATCHES);
393
+ const moveInputsSchema = z.array(z.union([
394
+ z.object({
395
+ nodeId: z.string().min(1).max(NODE_ID_LENGTH),
396
+ before: z.string().min(1).max(NODE_ID_LENGTH)
397
+ }),
398
+ z.object({
399
+ nodeId: z.string().min(1).max(NODE_ID_LENGTH),
400
+ after: z.string().min(1).max(NODE_ID_LENGTH)
401
+ }),
402
+ z.object({
403
+ nodeId: z.string().min(1).max(NODE_ID_LENGTH),
404
+ parentId: z.string().min(1).max(NODE_ID_LENGTH),
405
+ index: z.number().int().nonnegative().optional()
406
+ })
407
+ ])).min(1).max(MAX_BATCHES);
408
+ const nodeIdsSchema = z.array(z.string().min(1).max(NODE_ID_LENGTH)).min(1).max(MAX_NODE_IDS);
409
+ const sourceDepthSchema = z.coerce.number().int().min(0).max(MAX_DEPTH);
410
+
411
+ //#endregion
412
+ //#region src/infrastructure/canvas-reference.lib.ts
413
+ const canvasIdSchema = z.uuid();
414
+ const selectedIdsSchema = z.array(z.string().min(1).max(200)).min(1);
415
+ const CANVAS_PATH = /^\/c\/([^/]+)\/?$/u;
416
+ const urlFrom = (candidate) => {
417
+ try {
418
+ return new URL(candidate);
419
+ } catch {
420
+ return null;
421
+ }
422
+ };
423
+ const parseCanvasReference = (reference) => {
424
+ const candidate = reference.trim();
425
+ const direct = canvasIdSchema.safeParse(candidate);
426
+ if (direct.success) return {
427
+ canvasId: direct.data,
428
+ nodeIds: []
429
+ };
430
+ const url = urlFrom(candidate);
431
+ if (url !== null && (url.protocol === "http:" || url.protocol === "https:")) {
432
+ const id = canvasIdSchema.safeParse(CANVAS_PATH.exec(url.pathname.toLowerCase())?.[1]);
433
+ if (id.success) {
434
+ const selection = new URLSearchParams(url.hash.slice(1)).getAll("selection");
435
+ if (selection.length === 0) return {
436
+ canvasId: id.data,
437
+ nodeIds: []
438
+ };
439
+ const parsed = selectedIdsSchema.safeParse(selection);
440
+ if (!parsed.success) throw new CliError("BAD_REQUEST", "The link contains an invalid selection.", "Copy the selection link again from the canvas.");
441
+ return {
442
+ canvasId: id.data,
443
+ nodeIds: [...new Set(parsed.data)]
444
+ };
445
+ }
446
+ }
447
+ throw new CliError("BAD_REQUEST", "The canvas reference is neither a canvas URL nor a UUID.", "Paste an HTTP(S) URL shaped https://app.example/c/<UUID>, or pass the bare canvas UUID.");
448
+ };
449
+ const fromCanvasReference = (reference) => {
450
+ const parsed = parseCanvasReference(reference);
451
+ if (parsed.nodeIds.length > 0) throw new CliError("BAD_REQUEST", `This command cannot discard the link selection: ${parsed.nodeIds.join(", ")}.`, "Inspect the selection with canvas tree and use a targeted edit. Use a canvas URL without a selection only when the request covers the whole canvas.");
452
+ return parsed.canvasId;
453
+ };
454
+ const canvasReferenceNodeIds = (reference, document) => {
455
+ const missing = reference.nodeIds.filter((id) => document.nodes[id] === void 0);
456
+ if (missing.length > 0) throw new CliError("NOT_FOUND", `The link selection no longer exists: ${missing.join(", ")}.`, "Copy a current selection link; do not substitute other canvas content.");
457
+ const selected = new Set(reference.nodeIds);
458
+ const descendants = (parentId) => {
459
+ for (const [id, relationship] of Object.entries(document.relationships)) {
460
+ if (relationship.parentId !== parentId || selected.has(id)) continue;
461
+ selected.add(id);
462
+ descendants(id);
463
+ }
464
+ };
465
+ for (const id of reference.nodeIds) descendants(id);
466
+ return selected;
467
+ };
468
+ const assertCanvasReferenceNodes = (reference, document, nodeIds) => {
469
+ if (reference.nodeIds.length === 0) return;
470
+ const scope = canvasReferenceNodeIds(reference, document);
471
+ assertNodesInScope(scope, nodeIds);
472
+ };
473
+ const assertNodesInScope = (scope, nodeIds) => {
474
+ const outside = nodeIds.filter((id) => !scope.has(id));
475
+ if (outside.length > 0) throw new CliError("BAD_REQUEST", `These nodes are outside the link selection: ${outside.join(", ")}.`, "Limit the edit to the selected nodes and their descendants. Request a wider selection only when the person wants a wider change.");
476
+ };
477
+ const operationScope = (operation, document) => {
478
+ switch (operation.op) {
479
+ case "insertNode": return {
480
+ required: [operation.parentage.parentId],
481
+ inserted: [operation.node.id]
482
+ };
483
+ case "insertText":
484
+ case "insertPrototype": return {
485
+ required: [operation.parentId, ...operation.afterId === void 0 ? [] : [operation.afterId]],
486
+ inserted: [operation.nodeId]
487
+ };
488
+ case "insertConvertedSubtree":
489
+ if (operation.destination.kind === "adjacent") throw new CliError("BAD_REQUEST", "Adjacent conversion would insert outside the link selection.", "Use insert-children or replace with a selected target.");
490
+ return {
491
+ required: [operation.destination.targetNodeId],
492
+ inserted: Object.keys(operation.nodes)
493
+ };
494
+ case "move":
495
+ case "setParentage": {
496
+ const parentId = operation.op === "move" ? operation.parentId : operation.parentage.parentId;
497
+ return {
498
+ required: [operation.nodeId, ...parentId === document.relationships[operation.nodeId]?.parentId ? [] : [parentId]],
499
+ inserted: []
500
+ };
501
+ }
502
+ case "setPrototypeDeployment":
503
+ case "setText":
504
+ case "setBox":
505
+ case "setLabel":
506
+ case "setVisibility":
507
+ case "setLocked":
508
+ case "setConstraints":
509
+ case "setStyles":
510
+ case "setAppearance":
511
+ case "setLayout":
512
+ case "setTypography":
513
+ case "setAdditionalStyles":
514
+ case "setProps":
515
+ case "remove": return {
516
+ required: [operation.nodeId],
517
+ inserted: []
518
+ };
519
+ }
520
+ };
521
+ const assertCanvasReferenceOperations = (reference, document, operations) => {
522
+ if (reference.nodeIds.length === 0) return;
523
+ const scope = new Set(canvasReferenceNodeIds(reference, document));
524
+ for (const operation of operations) {
525
+ const { required, inserted } = operationScope(operation, document);
526
+ assertNodesInScope(scope, [...required, ...inserted.filter((id) => document.nodes[id] !== void 0)]);
527
+ for (const id of inserted) scope.add(id);
528
+ }
529
+ };
530
+
531
+ //#endregion
532
+ //#region src/infrastructure/canvas-authoring-command.lib.ts
533
+ const uuidNullableSchema = z.uuid().nullable();
534
+ const authoringNumberFrom = (schema, value, option) => {
535
+ const parsed = schema.safeParse(value);
536
+ if (parsed.success) return parsed.data;
537
+ throw new CliError("BAD_REQUEST", `${option} is invalid.`, "Run the command with --help.");
538
+ };
539
+ const authoringBaseVersion = (value) => authoringNumberFrom(positiveIntegerSchema, value, "--base-version");
540
+ const selectAuthoringToken = (input, value, isComposite) => {
541
+ const parsed = uuidNullableSchema.safeParse(value ?? null);
542
+ if (!parsed.success) throw new CliError("BAD_REQUEST", "--client-token must be a UUID.", "Mint one UUID and reuse it only when retrying the exact same command.");
543
+ input.mutationKey.select(parsed.data, isComposite);
544
+ };
545
+ const authoringMutationId = (input, purpose) => input.mutationKey.current("canvas.applyOperations", { purpose });
546
+ const sceneAtVersion = async (input, canvasId, expectedVersion) => {
547
+ const held = getCanvasDocumentOutputSchema.safeParse(await input.remote.query("canvas.document.get", { canvasId }));
548
+ if (!held.success) throw new CliError("INTERNAL", "The API returned an invalid canvas document.", "Run `enhance doctor` and report incompatible API and CLI versions.");
549
+ if (held.data.version !== expectedVersion) throw new CliError("CONFLICT", `Canvas version ${String(held.data.version)} no longer matches --base-version ${String(expectedVersion)}.`, `Run 'enhance canvas tree --canvas ${canvasId}' and recompute against version ${String(held.data.version)}.`);
550
+ const scene = canvasSceneDocumentSchema.safeParse(held.data.document);
551
+ if (scene.success) return scene.data;
552
+ throw new CliError("INTERNAL", "The stored canvas is not an editable scene.", "Open the canvas in the editor and repair or recreate the invalid document.");
553
+ };
554
+ const applyAuthoringOperations = async (input, options, purpose, operations) => {
555
+ selectAuthoringToken(input, options.clientToken, false);
556
+ const reference = parseCanvasReference(options.canvas);
557
+ const baseVersion = authoringBaseVersion(options.baseVersion);
558
+ if (reference.nodeIds.length > 0) assertCanvasReferenceOperations(reference, await sceneAtVersion(input, reference.canvasId, baseVersion), operations);
559
+ return createApplyCanvasComposite(input.remote).execute({
560
+ canvasId: reference.canvasId,
561
+ mutationId: authoringMutationId(input, purpose),
562
+ baseVersion,
563
+ operations: [...operations]
564
+ });
565
+ };
566
+
397
567
  //#endregion
398
568
  //#region src/infrastructure/canvas-operation-input.adapter.ts
399
569
  const MAX_OPERATION_FILE_BYTES = 1048576;
@@ -428,29 +598,7 @@ const createCanvasOperationInputAdapter = (value) => {
428
598
  }
429
599
  return parsed.data;
430
600
  };
431
- //#endregion
432
- //#region src/infrastructure/canvas-reference.mapper.ts
433
- const canvasIdSchema = z.uuid();
434
- const CANVAS_PATH = /^\/c\/([^/]+)\/?$/u;
435
- const fromCanvasUrl = (candidate) => {
436
- try {
437
- const url = new URL(candidate);
438
- if (url.protocol !== "https:" && url.protocol !== "http:") return null;
439
- const match = CANVAS_PATH.exec(url.pathname.toLowerCase());
440
- const fromPath = canvasIdSchema.safeParse(match?.[1]);
441
- return fromPath.success ? fromPath.data : null;
442
- } catch {
443
- return null;
444
- }
445
- };
446
- const fromCanvasReference = (reference) => {
447
- const candidate = reference.trim();
448
- const direct = canvasIdSchema.safeParse(candidate);
449
- if (direct.success) return direct.data;
450
- const fromUrl = fromCanvasUrl(candidate);
451
- if (fromUrl !== null) return fromUrl;
452
- throw new CliError("BAD_REQUEST", "The canvas reference is neither a canvas URL nor a UUID.", "Paste an HTTP(S) URL shaped https://app.example/c/<UUID>, or pass the bare canvas UUID.");
453
- };
601
+
454
602
  //#endregion
455
603
  //#region src/infrastructure/capability-reference.mapper.ts
456
604
  const fromCapabilityReference = (catalog, id) => {
@@ -458,6 +606,7 @@ const fromCapabilityReference = (catalog, id) => {
458
606
  if (capability === void 0) throw new TypeError(`${id} is missing from the capability catalogue`);
459
607
  return capability;
460
608
  };
609
+
461
610
  //#endregion
462
611
  //#region src/infrastructure/canvas-apply.program.ts
463
612
  const positiveInteger$3 = z.coerce.number().int().positive();
@@ -480,70 +629,23 @@ const configureCanvasApply = (canvas, input) => {
480
629
  ` enhance canvas apply --canvas <url-or-id> --base-version 3 --operations '[{"op":"insertText","nodeId":"txt_summary","parentId":"root","text":"Checkout needs an address.","box":{"x":120,"y":594,"width":720,"height":80},"styles":{"font-size":24}}]'`
481
630
  ].join("\n")).action(async (options) => {
482
631
  selectMutationToken(input, options.clientToken);
632
+ const reference = parseCanvasReference(options.canvas);
633
+ const baseVersion = baseVersionFrom(options.baseVersion);
634
+ const operations = createCanvasOperationInputAdapter(options.operations);
635
+ if (reference.nodeIds.length > 0) assertCanvasReferenceOperations(reference, await sceneAtVersion(input, reference.canvasId, baseVersion), operations);
483
636
  const result = await input.invocation.invoke({
484
637
  capability: fromCapabilityReference(input.catalog(), "canvas.apply"),
485
638
  arguments: {
486
- canvasId: fromCanvasReference(options.canvas),
487
- baseVersion: baseVersionFrom(options.baseVersion),
488
- operations: [...createCanvasOperationInputAdapter(options.operations)]
639
+ canvasId: reference.canvasId,
640
+ baseVersion,
641
+ operations: [...operations]
489
642
  },
490
643
  clientToken: options.clientToken ?? null
491
644
  });
492
645
  input.output.result(result);
493
646
  });
494
647
  };
495
- //#endregion
496
- //#region src/infrastructure/canvas-authoring-input.schema.ts
497
- const NODE_ID_LENGTH = 200;
498
- const NODE_NAME_LENGTH = 500;
499
- const TEXT_LENGTH = 1e5;
500
- const MAX_NODE_IDS = 1e3;
501
- const MAX_BATCHES = 100;
502
- const MAX_DEPTH = 20;
503
- const MIN_RENDER_SCALE = .1;
504
- const MAX_RENDER_SCALE = 4;
505
- const positiveIntegerSchema = z.coerce.number().int().positive();
506
- const renderScaleSchema = z.coerce.number().min(MIN_RENDER_SCALE).max(MAX_RENDER_SCALE);
507
- const authoringUuidSchema = z.uuid();
508
- const styleValueSchema = z.union([
509
- z.string(),
510
- z.number(),
511
- z.null()
512
- ]);
513
- const styleObjectSchema = z.record(z.string(), styleValueSchema);
514
- const textUpdatesSchema = z.array(z.object({
515
- nodeId: z.string().min(1).max(NODE_ID_LENGTH),
516
- textContent: z.string().max(TEXT_LENGTH)
517
- })).min(1).max(MAX_NODE_IDS);
518
- const renameUpdatesSchema = z.array(z.object({
519
- nodeId: z.string().min(1).max(NODE_ID_LENGTH),
520
- name: z.string().max(NODE_NAME_LENGTH)
521
- })).min(1).max(MAX_NODE_IDS);
522
- const styleUpdatesSchema = z.array(z.object({
523
- nodeIds: z.array(z.string().min(1).max(NODE_ID_LENGTH)).min(1).max(MAX_BATCHES),
524
- styles: styleObjectSchema
525
- })).min(1).max(MAX_BATCHES);
526
- const duplicateInputsSchema = z.array(z.object({
527
- id: z.string().min(1).max(NODE_ID_LENGTH),
528
- parentId: z.string().min(1).max(NODE_ID_LENGTH).optional()
529
- })).min(1).max(MAX_BATCHES);
530
- const moveInputsSchema = z.array(z.union([
531
- z.object({
532
- nodeId: z.string().min(1).max(NODE_ID_LENGTH),
533
- before: z.string().min(1).max(NODE_ID_LENGTH)
534
- }),
535
- z.object({
536
- nodeId: z.string().min(1).max(NODE_ID_LENGTH),
537
- after: z.string().min(1).max(NODE_ID_LENGTH)
538
- }),
539
- z.object({
540
- nodeId: z.string().min(1).max(NODE_ID_LENGTH),
541
- parentId: z.string().min(1).max(NODE_ID_LENGTH),
542
- index: z.number().int().nonnegative().optional()
543
- })
544
- ])).min(1).max(MAX_BATCHES);
545
- const nodeIdsSchema = z.array(z.string().min(1).max(NODE_ID_LENGTH)).min(1).max(MAX_NODE_IDS);
546
- const sourceDepthSchema = z.coerce.number().int().min(0).max(MAX_DEPTH);
648
+
547
649
  //#endregion
548
650
  //#region src/infrastructure/canvas-authoring-activity.program.ts
549
651
  const MAX_ACTIVITY_NODE_IDS = 100;
@@ -604,6 +706,7 @@ const configureCanvasAuthoringActivity = (canvas, input) => {
604
706
  configureUpdate(work, input);
605
707
  configureFinish(canvas, input);
606
708
  };
709
+
607
710
  //#endregion
608
711
  //#region src/application/canvas-style-layout.use-case.ts
609
712
  const LAYOUT_PROPERTY$1 = /^(?:align|bottom|column-gap|display|flex|gap|height|justify|left|order|overflow|padding|position|right|row-gap|top|transform|width)/u;
@@ -759,6 +862,7 @@ const canvasBoxOperation = (node, styles) => {
759
862
  }
760
863
  };
761
864
  };
865
+
762
866
  //#endregion
763
867
  //#region src/application/canvas-style-operations.use-case.ts
764
868
  const ADDITIONAL_STYLE_ID_LENGTH = 200;
@@ -833,38 +937,7 @@ const canvasStyleOperations = (nodes, updates) => {
833
937
  if (operations.length === 0) throw new CliError("BAD_REQUEST", "No style changes were provided.", "Pass at least one changed CSS property.");
834
938
  return operations;
835
939
  };
836
- //#endregion
837
- //#region src/infrastructure/canvas-authoring-command.lib.ts
838
- const uuidNullableSchema = z.uuid().nullable();
839
- const authoringNumberFrom = (schema, value, option) => {
840
- const parsed = schema.safeParse(value);
841
- if (parsed.success) return parsed.data;
842
- throw new CliError("BAD_REQUEST", `${option} is invalid.`, "Run the command with --help.");
843
- };
844
- const authoringBaseVersion = (value) => authoringNumberFrom(positiveIntegerSchema, value, "--base-version");
845
- const selectAuthoringToken = (input, value, isComposite) => {
846
- const parsed = uuidNullableSchema.safeParse(value ?? null);
847
- if (!parsed.success) throw new CliError("BAD_REQUEST", "--client-token must be a UUID.", "Mint one UUID and reuse it only when retrying the exact same command.");
848
- input.mutationKey.select(parsed.data, isComposite);
849
- };
850
- const authoringMutationId = (input, purpose) => input.mutationKey.current("canvas.applyOperations", { purpose });
851
- const sceneAtVersion = async (input, canvasId, expectedVersion) => {
852
- const held = getCanvasDocumentOutputSchema.safeParse(await input.remote.query("canvas.document.get", { canvasId }));
853
- if (!held.success) throw new CliError("INTERNAL", "The API returned an invalid canvas document.", "Run `enhance doctor` and report incompatible API and CLI versions.");
854
- if (held.data.version !== expectedVersion) throw new CliError("CONFLICT", `Canvas version ${String(held.data.version)} no longer matches --base-version ${String(expectedVersion)}.`, `Run 'enhance canvas tree --canvas ${canvasId}' and recompute against version ${String(held.data.version)}.`);
855
- const scene = canvasSceneDocumentSchema.safeParse(held.data.document);
856
- if (scene.success) return scene.data;
857
- throw new CliError("INTERNAL", "The stored canvas is not an editable scene.", "Open the canvas in the editor and repair or recreate the invalid document.");
858
- };
859
- const applyAuthoringOperations = async (input, options, purpose, operations) => {
860
- selectAuthoringToken(input, options.clientToken, false);
861
- return createApplyCanvasComposite(input.remote).execute({
862
- canvasId: fromCanvasReference(options.canvas),
863
- mutationId: authoringMutationId(input, purpose),
864
- baseVersion: authoringBaseVersion(options.baseVersion),
865
- operations: [...operations]
866
- });
867
- };
940
+
868
941
  //#endregion
869
942
  //#region src/infrastructure/canvas-authoring-bounded-input.lib.ts
870
943
  const boundedCanvasAuthoringInput = (value, bytes, option) => {
@@ -880,6 +953,7 @@ const boundedCanvasAuthoringInput = (value, bytes, option) => {
880
953
  throw new CliError("BAD_REQUEST", `Could not read a bounded file at ${filePath}.`, `Use a regular UTF-8 file no larger than ${String(bytes)} bytes.`);
881
954
  }
882
955
  };
956
+
883
957
  //#endregion
884
958
  //#region src/infrastructure/canvas-json-input.adapter.ts
885
959
  const MAX_JSON_BYTES = 1048576;
@@ -897,6 +971,7 @@ const createCanvasJsonInputAdapter = (value, schema, option) => {
897
971
  const issue = parsed.error.issues[0];
898
972
  throw new CliError("BAD_REQUEST", `${option} is invalid${issue === void 0 || issue.path.length === 0 ? "" : ` at ${issue.path.join(".")}`}.`, issue?.message ?? "Correct the JSON shape and retry.");
899
973
  };
974
+
900
975
  //#endregion
901
976
  //#region src/infrastructure/canvas-authoring-edit.program.ts
902
977
  const configureText = (canvas, input) => {
@@ -931,7 +1006,8 @@ const configureDelete = (canvas, input) => {
931
1006
  };
932
1007
  const configureStyles = (canvas, input) => {
933
1008
  canvas.command("update-styles").description("Update visual and layout styles.").requiredOption("--canvas <url-or-id>", "Canvas URL or UUID to edit.").requiredOption("--base-version <integer>", "Exact current canvas version.").requiredOption("--updates <json-or-@path>", "Array of {nodeIds,styles} updates.").option("--client-token <uuid>", "Stable UUID for retrying this exact batch.").action(async (options) => {
934
- const scene = await sceneAtVersion(input, fromCanvasReference(options.canvas), authoringBaseVersion(options.baseVersion));
1009
+ const canvasId = parseCanvasReference(options.canvas).canvasId;
1010
+ const scene = await sceneAtVersion(input, canvasId, authoringBaseVersion(options.baseVersion));
935
1011
  const updates = createCanvasJsonInputAdapter(options.updates, styleUpdatesSchema, "--updates");
936
1012
  input.output.result(await applyAuthoringOperations(input, options, "update-styles", canvasStyleOperations(scene.nodes, updates)));
937
1013
  });
@@ -942,6 +1018,7 @@ const configureCanvasAuthoringEdits = (canvas, input) => {
942
1018
  configureDelete(canvas, input);
943
1019
  configureStyles(canvas, input);
944
1020
  };
1021
+
945
1022
  //#endregion
946
1023
  //#region src/application/canvas-css-projection.use-case.ts
947
1024
  const RGB_CHANNEL_MAX = 255;
@@ -1109,6 +1186,7 @@ const computedCanvasNodeCss = (node) => {
1109
1186
  ...node.visible === false && { display: "none" }
1110
1187
  };
1111
1188
  };
1189
+
1112
1190
  //#endregion
1113
1191
  //#region src/application/canvas-source-projection.use-case.ts
1114
1192
  const childrenOf = (document, parentId) => Object.entries(document.relationships).filter(([, relationship]) => relationship.parentId === parentId).toSorted(([leftId, left], [rightId, right]) => left.sortKey === right.sortKey ? leftId.localeCompare(rightId) : left.sortKey.localeCompare(right.sortKey)).map(([nodeId]) => nodeId);
@@ -1158,12 +1236,13 @@ const canvasComputedStyleRecords = (document, nodeIds) => nodeIds.map((nodeId) =
1158
1236
  typography: node.typography
1159
1237
  };
1160
1238
  });
1239
+
1161
1240
  //#endregion
1162
1241
  //#region src/infrastructure/canvas-authoring-source.program.ts
1163
1242
  const GUIDE = {
1164
1243
  topic: "canvas-agent-authoring",
1165
1244
  workflow: [
1166
- "Run canvas inspect, then canvas tree, before editing.",
1245
+ "Run canvas inspect, then canvas tree, before editing. Keep a pasted selection link intact as --canvas on every read and edit; it limits the request to those nodes and their descendants.",
1167
1246
  "Render the target before changing it and inspect the PNG.",
1168
1247
  "Write small visual groups incrementally with write-html.",
1169
1248
  "Use duplicate-nodes, set-text-content, update-styles, and move-nodes instead of rewriting existing structure.",
@@ -1201,8 +1280,10 @@ const configureCanvasAuthoringSource = (canvas, input) => {
1201
1280
  input.output.result(GUIDE);
1202
1281
  });
1203
1282
  canvas.command("get-jsx").description("Read concise subtree JSX.").requiredOption("--canvas <url-or-id>", "Canvas URL or UUID to inspect.").requiredOption("--node-id <id>", "Stable subtree root id.").option("--depth <integer>", "Maximum descendant depth from 0 to 20.", "8").action(async (options) => {
1204
- const canvasId = fromCanvasReference(options.canvas);
1283
+ const reference = parseCanvasReference(options.canvas);
1284
+ const canvasId = reference.canvasId;
1205
1285
  const { held, document } = await canvasScene(input, canvasId);
1286
+ assertCanvasReferenceNodes(reference, document, [options.nodeId]);
1206
1287
  input.output.result({
1207
1288
  canvasId,
1208
1289
  version: held.version,
@@ -1212,9 +1293,11 @@ const configureCanvasAuthoringSource = (canvas, input) => {
1212
1293
  });
1213
1294
  });
1214
1295
  canvas.command("get-computed-styles").description("Read effective node CSS.").requiredOption("--canvas <url-or-id>", "Canvas URL or UUID to inspect.").requiredOption("--node-ids <json-or-@path>", "JSON array of stable node ids.").action(async (options) => {
1215
- const canvasId = fromCanvasReference(options.canvas);
1296
+ const reference = parseCanvasReference(options.canvas);
1297
+ const canvasId = reference.canvasId;
1216
1298
  const { held, document } = await canvasScene(input, canvasId);
1217
1299
  const nodeIds = createCanvasJsonInputAdapter(options.nodeIds, nodeIdsSchema, "--node-ids");
1300
+ assertCanvasReferenceNodes(reference, document, nodeIds);
1218
1301
  input.output.result({
1219
1302
  canvasId,
1220
1303
  version: held.version,
@@ -1222,6 +1305,10 @@ const configureCanvasAuthoringSource = (canvas, input) => {
1222
1305
  });
1223
1306
  });
1224
1307
  };
1308
+
1309
+ //#endregion
1310
+ //#region src/application/canvas-structure-document.use-case.ts
1311
+ const ROOT_CANVAS_NODE_ID = "root";
1225
1312
  const canvasChildIds = (document, parentId) => Object.entries(document.relationships).filter(([, relationship]) => relationship.parentId === parentId).toSorted(([leftId, left], [rightId, right]) => left.sortKey === right.sortKey ? leftId.localeCompare(rightId) : left.sortKey.localeCompare(right.sortKey)).map(([nodeId]) => nodeId);
1226
1313
  const canCanvasNodeContainChildren = (node) => node !== void 0 && [
1227
1314
  "root",
@@ -1244,6 +1331,7 @@ const canvasDescendantIds = (document, nodeId) => {
1244
1331
  visit(nodeId);
1245
1332
  return found;
1246
1333
  };
1334
+
1247
1335
  //#endregion
1248
1336
  //#region src/application/canvas-duplicate-operations.use-case.ts
1249
1337
  const SLUG_LENGTH = 60;
@@ -1339,6 +1427,7 @@ const duplicateCanvasNodeOperations = (document, inputs, idPrefix) => {
1339
1427
  duplicatedNodes: duplicates.map((duplicate) => duplicate.summary)
1340
1428
  };
1341
1429
  };
1430
+
1342
1431
  //#endregion
1343
1432
  //#region src/application/canvas-move-operations.use-case.ts
1344
1433
  const moveState = (document) => ({
@@ -1410,16 +1499,20 @@ const moveCanvasNodeOperations = (document, inputs) => {
1410
1499
  }))
1411
1500
  };
1412
1501
  };
1502
+
1413
1503
  //#endregion
1414
1504
  //#region src/infrastructure/canvas-authoring-structure.program.ts
1415
1505
  const configureDuplicate = (canvas, input) => {
1416
1506
  canvas.command("duplicate-nodes").description("Deep-clone node subtrees.").requiredOption("--canvas <url-or-id>", "Canvas URL or UUID to edit.").requiredOption("--base-version <integer>", "Exact current canvas version.").requiredOption("--nodes <json-or-@path>", "Array of {id,parentId?} requests.").option("--id-prefix <prefix>", "Stable namespace for cloned ids.").option("--client-token <uuid>", "Stable UUID for retrying this exact batch.").action(async (options) => {
1417
1507
  selectAuthoringToken(input, options.clientToken, false);
1418
- const canvasId = fromCanvasReference(options.canvas);
1508
+ const reference = parseCanvasReference(options.canvas);
1509
+ const canvasId = reference.canvasId;
1419
1510
  const baseVersion = authoringBaseVersion(options.baseVersion);
1420
1511
  const scene = await sceneAtVersion(input, canvasId, baseVersion);
1421
1512
  const mutationId = authoringMutationId(input, "duplicate-nodes");
1422
- const plan = duplicateCanvasNodeOperations(scene, createCanvasJsonInputAdapter(options.nodes, duplicateInputsSchema, "--nodes"), options.idPrefix ?? `copy_${mutationId.replaceAll("-", "")}`);
1513
+ const nodes = createCanvasJsonInputAdapter(options.nodes, duplicateInputsSchema, "--nodes");
1514
+ assertCanvasReferenceNodes(reference, scene, nodes.flatMap((node) => [node.id, ...node.parentId === void 0 || node.parentId === scene.relationships[node.id]?.parentId ? [] : [node.parentId]]));
1515
+ const plan = duplicateCanvasNodeOperations(scene, nodes, options.idPrefix ?? `copy_${mutationId.replaceAll("-", "")}`);
1423
1516
  const apply = await createApplyCanvasComposite(input.remote).execute({
1424
1517
  canvasId,
1425
1518
  mutationId,
@@ -1435,9 +1528,12 @@ const configureDuplicate = (canvas, input) => {
1435
1528
  const configureMove = (canvas, input) => {
1436
1529
  canvas.command("move-nodes").description("Reorder or reparent nodes.").requiredOption("--canvas <url-or-id>", "Canvas URL or UUID to edit.").requiredOption("--base-version <integer>", "Exact current canvas version.").requiredOption("--moves <json-or-@path>", "Sequential before, after, or parent/index moves.").option("--client-token <uuid>", "Stable UUID for retrying this exact batch.").action(async (options) => {
1437
1530
  selectAuthoringToken(input, options.clientToken, false);
1438
- const canvasId = fromCanvasReference(options.canvas);
1531
+ const reference = parseCanvasReference(options.canvas);
1532
+ const canvasId = reference.canvasId;
1439
1533
  const baseVersion = authoringBaseVersion(options.baseVersion);
1440
- const plan = moveCanvasNodeOperations(await sceneAtVersion(input, canvasId, baseVersion), createCanvasJsonInputAdapter(options.moves, moveInputsSchema, "--moves"));
1534
+ const scene = await sceneAtVersion(input, canvasId, baseVersion);
1535
+ const plan = moveCanvasNodeOperations(scene, createCanvasJsonInputAdapter(options.moves, moveInputsSchema, "--moves"));
1536
+ assertCanvasReferenceOperations(reference, scene, plan.operations);
1441
1537
  const apply = await createApplyCanvasComposite(input.remote).execute({
1442
1538
  canvasId,
1443
1539
  mutationId: authoringMutationId(input, "move-nodes"),
@@ -1455,6 +1551,7 @@ const configureCanvasAuthoringStructure = (canvas, input) => {
1455
1551
  configureDuplicate(canvas, input);
1456
1552
  configureMove(canvas, input);
1457
1553
  };
1554
+
1458
1555
  //#endregion
1459
1556
  //#region src/infrastructure/canvas-html-input.adapter.ts
1460
1557
  const MAX_HTML_BYTES = 262144;
@@ -1463,6 +1560,7 @@ const createCanvasHtmlInputAdapter = (value) => {
1463
1560
  if (Buffer.byteLength(html, "utf8") > MAX_HTML_BYTES) throw new CliError("BAD_REQUEST", `--html exceeds ${String(MAX_HTML_BYTES)} bytes.`, "Write one visual group at a time, as taught by canvas guide.");
1464
1561
  return html;
1465
1562
  };
1563
+
1466
1564
  //#endregion
1467
1565
  //#region src/infrastructure/canvas-authoring-write.program.ts
1468
1566
  const ARTBOARD_GAP = 80;
@@ -1480,15 +1578,18 @@ const configureWriteHtml = (canvas, input) => {
1480
1578
  if (!["insert-children", "replace"].includes(options.mode)) throw new CliError("BAD_REQUEST", "--mode must be insert-children or replace.", "Choose one of the two documented modes.");
1481
1579
  selectAuthoringToken(input, options.clientToken, true);
1482
1580
  const mode = options.mode === "replace" ? "replace" : "insert-children";
1581
+ const reference = parseCanvasReference(options.canvas);
1582
+ const baseVersion = authoringBaseVersion(options.baseVersion);
1583
+ if (reference.nodeIds.length > 0) assertCanvasReferenceNodes(reference, await sceneAtVersion(input, reference.canvasId, baseVersion), [options.targetNodeId]);
1483
1584
  input.output.result(await input.invocation.invoke({
1484
1585
  capability: fromCapabilityReference(input.catalog(), "canvas.writeHtml"),
1485
1586
  arguments: {
1486
- canvasId: fromCanvasReference(options.canvas),
1587
+ canvasId: reference.canvasId,
1487
1588
  targetNodeId: options.targetNodeId,
1488
1589
  mode,
1489
1590
  html: createCanvasHtmlInputAdapter(options.html),
1490
1591
  ...options.idPrefix !== void 0 && { idPrefix: options.idPrefix },
1491
- baseVersion: authoringBaseVersion(options.baseVersion),
1592
+ baseVersion,
1492
1593
  renderOutputPath: options.output ?? null,
1493
1594
  overwriteRender: options.force === true,
1494
1595
  renderScale: authoringNumberFrom(renderScaleSchema, options.scale, "--scale"),
@@ -1545,6 +1646,7 @@ const configureCanvasAuthoringWrites = (canvas, input) => {
1545
1646
  configureWriteHtml(canvas, input);
1546
1647
  configureCreateArtboard(canvas, input);
1547
1648
  };
1649
+
1548
1650
  //#endregion
1549
1651
  //#region src/infrastructure/canvas-authoring.program.ts
1550
1652
  const configureCanvasAuthoring = (canvas, input) => {
@@ -1554,6 +1656,79 @@ const configureCanvasAuthoring = (canvas, input) => {
1554
1656
  configureCanvasAuthoringStructure(canvas, input);
1555
1657
  configureCanvasAuthoringActivity(canvas, input);
1556
1658
  };
1659
+
1660
+ //#endregion
1661
+ //#region src/infrastructure/canvas-inspection.program.ts
1662
+ const referenceFor = (command) => {
1663
+ const reference = command.getOptionValue("canvas");
1664
+ const legacy = command.getOptionValue("canvasId");
1665
+ if (reference !== void 0 && legacy !== void 0) throw new CliError("BAD_REQUEST", "--canvas and --canvas-id cannot be combined.", "Pass the pasted URL or UUID through --canvas.");
1666
+ const selected = reference ?? legacy;
1667
+ if (typeof selected !== "string") throw new CliError("BAD_REQUEST", "--canvas is required.", "Pass a pasted Enhance canvas URL or bare UUID through --canvas.");
1668
+ return {
1669
+ reference: parseCanvasReference(selected),
1670
+ url: selected
1671
+ };
1672
+ };
1673
+ const nodeIdFor = (command, reference) => {
1674
+ const nodeId = command.getOptionValue("nodeId") ?? (reference.nodeIds.length === 1 ? reference.nodeIds[0] : void 0);
1675
+ if (typeof nodeId !== "string" || nodeId === "") throw new CliError("BAD_REQUEST", "--node-id or a single-node selection link is required.", "Choose one node, or use canvas tree to inspect the linked selection.");
1676
+ return nodeId;
1677
+ };
1678
+ const readLinkedSelection = async (command, input, reference, url) => {
1679
+ const held = getCanvasDocumentOutputSchema.parse(await input.remote.query("canvas.document.get", { canvasId: reference.canvasId }));
1680
+ const document = canvasSceneDocumentSchema.parse(held.document);
1681
+ const scope = canvasReferenceNodeIds(reference, document);
1682
+ const nodes = Object.values(document.nodes).filter((node) => scope.has(node.id)).map((node) => ({
1683
+ ...node,
1684
+ kind: node.component,
1685
+ parentId: document.relationships[node.id]?.parentId ?? null,
1686
+ children: Object.entries(document.relationships).filter(([, relation]) => relation.parentId === node.id).map(([id]) => id)
1687
+ }));
1688
+ const context = {
1689
+ canvasId: reference.canvasId,
1690
+ version: held.version,
1691
+ source: "selection-link",
1692
+ selectedNodeIds: reference.nodeIds,
1693
+ next: [`Keep this selection link as --canvas for every edit: ${url}`, "Edit only these nodes or their descendants; other canvas content is outside the request."]
1694
+ };
1695
+ if (command.name() === "node") {
1696
+ const nodeId = nodeIdFor(command, reference);
1697
+ assertCanvasReferenceNodes(reference, document, [nodeId]);
1698
+ return {
1699
+ ...context,
1700
+ node: nodes.find((node) => node.id === nodeId)
1701
+ };
1702
+ }
1703
+ return {
1704
+ ...context,
1705
+ nodes
1706
+ };
1707
+ };
1708
+ const configureCanvasInspection = (canvas, input) => {
1709
+ for (const name of [
1710
+ "inspect",
1711
+ "tree",
1712
+ "node",
1713
+ "selection"
1714
+ ]) {
1715
+ const command = canvas.commands.find((candidate) => candidate.name() === name);
1716
+ const canvasId = command?.options.find((option) => option.long === "--canvas-id");
1717
+ if (command === void 0 || canvasId === void 0) continue;
1718
+ canvasId.makeOptionMandatory(false);
1719
+ command.options.find((option) => option.long === "--node-id")?.makeOptionMandatory(false);
1720
+ command.option("--canvas <url-or-id>", "Pasted canvas URL or UUID. Selection links limit reads and edits to the linked subtree.");
1721
+ command.action(async () => {
1722
+ const { reference, url } = referenceFor(command);
1723
+ const result = reference.nodeIds.length > 0 ? await readLinkedSelection(command, input, reference, url) : await input.remote.query(`canvas.${name}`, {
1724
+ canvasId: reference.canvasId,
1725
+ ...name === "node" && { nodeId: nodeIdFor(command, reference) }
1726
+ });
1727
+ input.output.result(result);
1728
+ });
1729
+ }
1730
+ };
1731
+
1557
1732
  //#endregion
1558
1733
  //#region src/infrastructure/canvas.program.ts
1559
1734
  const positiveInteger$2 = z.coerce.number().int().positive();
@@ -1594,19 +1769,29 @@ const selectClientToken = (input, value) => {
1594
1769
  input.mutationKey.select(clientToken.data, false);
1595
1770
  return input.mutationKey.current("canvas.render.create", {});
1596
1771
  };
1772
+ const selectedRenderNode = async (options, input) => {
1773
+ const reference = parseCanvasReference(options.canvas ?? "");
1774
+ if (reference.nodeIds.length === 0) return options.nodeId;
1775
+ const nodeId = options.nodeId ?? (reference.nodeIds.length === 1 ? reference.nodeIds[0] : void 0);
1776
+ if (nodeId === void 0 || options.bounds !== void 0) throw new CliError("BAD_REQUEST", "A selection link requires one selected node to render.", "Pass --node-id for one node in the selection; bounds and whole-canvas renders would include unrelated content.");
1777
+ const held = getCanvasDocumentOutputSchema.parse(await input.remote.query("canvas.document.get", { canvasId: reference.canvasId }));
1778
+ assertCanvasReferenceNodes(reference, canvasSceneDocumentSchema.parse(held.document), [nodeId]);
1779
+ return nodeId;
1780
+ };
1597
1781
  const executeRender = async (options, input) => {
1598
1782
  if (options.canvas === void 0) throw new CliError("BAD_REQUEST", "--canvas is required.", "Pass a pasted Enhance canvas URL or bare UUID through --canvas.");
1599
1783
  if (options.nodeId !== void 0 && options.bounds !== void 0) throw new CliError("BAD_REQUEST", "--node-id and --bounds cannot be combined.", "Choose one focused target, or omit both to render all authored content.");
1600
- if (options.atMs !== void 0 && options.nodeId === void 0) throw new CliError("BAD_REQUEST", "--at-ms requires --node-id.", "Render the stable recording node returned by `enhance canvas tree`.");
1601
- const recordingId = options.atMs === void 0 ? null : recordingIdFrom(options.nodeId);
1784
+ const nodeId = await selectedRenderNode(options, input);
1785
+ if (nodeId === void 0 && options.atMs !== void 0) throw new CliError("BAD_REQUEST", "--at-ms requires --node-id.", "Render the stable recording node returned by `enhance canvas tree`.");
1786
+ const recordingId = options.atMs === void 0 ? null : recordingIdFrom(nodeId);
1602
1787
  if (recordingId === void 0 && options.atMs !== void 0) throw new CliError("BAD_REQUEST", "--at-ms requires a stable recording node id such as rec_<recording-uuid>.", "Run `enhance canvas tree --canvas <url-or-id>` and choose a recording node.");
1603
1788
  selectClientToken(input, options.clientToken);
1604
1789
  const result = await input.invocation.invoke({
1605
1790
  capability: fromCapabilityReference(input.catalog(), "canvas.render"),
1606
1791
  arguments: {
1607
- canvasId: fromCanvasReference(options.canvas),
1792
+ canvasId: parseCanvasReference(options.canvas).canvasId,
1608
1793
  expectedVersion: options.expectedVersion === void 0 ? null : numberFrom(positiveInteger$2, options.expectedVersion, "--expected-version"),
1609
- target: targetFrom(options.nodeId, boundsFrom(options.bounds)),
1794
+ target: targetFrom(nodeId, boundsFrom(options.bounds)),
1610
1795
  sourceState: recordingId === null || recordingId === void 0 ? null : {
1611
1796
  kind: "recording",
1612
1797
  recordingId,
@@ -1621,20 +1806,6 @@ const executeRender = async (options, input) => {
1621
1806
  });
1622
1807
  input.output.result(result);
1623
1808
  };
1624
- const configureCanvasReference = (command) => {
1625
- const canvasId = command.options.find((option) => option.long === "--canvas-id");
1626
- if (canvasId === void 0) return;
1627
- canvasId.makeOptionMandatory(false);
1628
- command.option("--canvas <url-or-id>", "Pasted Enhance canvas URL or bare canvas UUID.");
1629
- command.hook("preAction", (actionCommand) => {
1630
- const reference = actionCommand.getOptionValue("canvas");
1631
- const legacy = actionCommand.getOptionValue("canvasId");
1632
- if (reference !== void 0 && legacy !== void 0) throw new CliError("BAD_REQUEST", "--canvas and --canvas-id cannot be combined.", "Pass the pasted URL or UUID through --canvas.");
1633
- const selected = reference ?? legacy;
1634
- if (typeof selected !== "string") throw new CliError("BAD_REQUEST", "--canvas is required.", "Pass a pasted Enhance canvas URL or bare UUID through --canvas.");
1635
- actionCommand.setOptionValueWithSource("canvasId", fromCanvasReference(selected), "cli");
1636
- });
1637
- };
1638
1809
  const configureRender = (render, input) => {
1639
1810
  render.option("--canvas <url-or-id>", "Canvas URL or UUID to render.").option("--node-id <id>", "Render one stable canvas node instead of all authored content.").option("--bounds <json>", "Render an explicit rectangle in canvas world coordinates.").option("--expected-version <integer>", "Refuse pixels from any other document version.").option("--at-ms <integer>", "Pause a recording node at this millisecond; inspect the PNG before snapshotting it.").option("--scale <number>", "Output pixels per canvas unit, from 0.1 to 4.", "1").option("--output <path>", "Write the PNG to this path instead of a protected temporary file.").option("--force", "Replace an existing --output file deliberately.", false).option("--timeout-ms <integer>", "Local polling deadline in milliseconds.", "120000").option("--client-token <uuid>", "Stable UUID to reuse only when retrying this render request.").addHelpText("after", "\nFor transcript-led selection, inspect nearby --at-ms renders and reject transitions or duplicate states before running recording snapshot.\n").action(async (options) => executeRender(options, input));
1640
1811
  };
@@ -1649,17 +1820,10 @@ const registerCanvasProgram = (program, input) => {
1649
1820
  ...input,
1650
1821
  render: composite
1651
1822
  });
1652
- for (const name of [
1653
- "inspect",
1654
- "tree",
1655
- "node",
1656
- "selection"
1657
- ]) {
1658
- const command = canvas.commands.find((candidate) => candidate.name() === name);
1659
- if (command !== void 0) configureCanvasReference(command);
1660
- }
1823
+ configureCanvasInspection(canvas, input);
1661
1824
  configureRender(render, input);
1662
1825
  };
1826
+
1663
1827
  //#endregion
1664
1828
  //#region src/infrastructure/command-summaries.consts.ts
1665
1829
  const COMMAND_SUMMARIES = {
@@ -1682,10 +1846,12 @@ const COMMAND_SUMMARIES = {
1682
1846
  "canvas.selection": "Read the person’s current live browser selection.",
1683
1847
  "canvas realtime": "Canvas presence and activity.",
1684
1848
  "canvas document": "Read or replace a canvas document.",
1849
+ "canvas version": "Retained canvas history.",
1685
1850
  "canvas render": "Create and inspect faithful canvas renders.",
1686
1851
  "canvas participants": "List and change canvas participants.",
1687
1852
  "canvas invites": "Invite people to a canvas."
1688
1853
  };
1854
+
1689
1855
  //#endregion
1690
1856
  //#region src/infrastructure/option-string.mapper.ts
1691
1857
  const toBareStringOption = (option, canAcceptNull = false) => {
@@ -1706,16 +1872,19 @@ const toBareStringOption = (option, canAcceptNull = false) => {
1706
1872
  });
1707
1873
  return (value) => value === nullMarker;
1708
1874
  };
1875
+
1709
1876
  //#endregion
1710
1877
  //#region src/infrastructure/process.adapter.ts
1711
1878
  const createProcessAdapter = () => ({ exit: (code) => {
1712
1879
  throw new ProcessExitError(code);
1713
1880
  } });
1881
+
1714
1882
  //#endregion
1715
1883
  //#region src/infrastructure/cli-polish.lib.ts
1716
1884
  const NAMESPACES = {
1717
1885
  canvas: "Canvases: create, find, share, and manage review surfaces.",
1718
1886
  "canvas render": "Render production-faithful canvas pixels after inspecting exact structure and geometry.",
1887
+ "canvas version": "Inspect and name retained canvas history.",
1719
1888
  "canvas document": "Read or replace the opaque document stored on a canvas.",
1720
1889
  "canvas invites": "Invite people to a canvas and manage pending invitations.",
1721
1890
  "canvas participants": "List and change the people who can reach a canvas.",
@@ -1844,6 +2013,7 @@ const polishCli = (command, input, path = []) => {
1844
2013
  polishCli(child, input, commandPath);
1845
2014
  }
1846
2015
  };
2016
+
1847
2017
  //#endregion
1848
2018
  //#region src/infrastructure/cli-surface.lib.ts
1849
2019
  const CLI_EXCLUDED_PROCEDURES = createCapabilityPolicyAdapter().excludedProcedures;
@@ -1863,6 +2033,7 @@ const removeExcludedProcedures = (command, path = []) => {
1863
2033
  Reflect.set(command, "commands", visible);
1864
2034
  for (const child of visible) removeExcludedProcedures(child, [...path, child.name()]);
1865
2035
  };
2036
+
1866
2037
  //#endregion
1867
2038
  //#region src/infrastructure/commands.program.ts
1868
2039
  const procedurePathOf = (command) => {
@@ -1883,7 +2054,16 @@ const recordsFrom = (command, path = []) => command.commands.filter((child) => c
1883
2054
  }, ...recordsFrom(child, childPath)];
1884
2055
  });
1885
2056
  const registerCommandsProgram = (program, output, catalog) => {
1886
- program.command("commands").description("Emit the command inventory as NDJSON without walking the help tree.").option("--namespace <path>", "Keep commands at or below this space-separated path.").option("--capabilities", "Emit the transport-neutral capability inventory.", false).action((options) => {
2057
+ program.command("commands").description("Emit the command inventory as NDJSON without walking the help tree.").option("--namespace <path>", "Keep commands at or below this space-separated path.").option("--capabilities", "Emit the transport-neutral capability inventory.", false).option("--reference", "Emit complete shared capability contracts for documentation.", false).action((options) => {
2058
+ if (options.reference) {
2059
+ const shared = toSharedCapabilities(catalog());
2060
+ const discovery = createMcpCapabilityDiscoveryAdapter(shared);
2061
+ output.result({
2062
+ items: shared.map((capability) => discovery.describe(capability.id)),
2063
+ truncated: false
2064
+ });
2065
+ return;
2066
+ }
1887
2067
  if (options.capabilities) {
1888
2068
  output.result({
1889
2069
  items: toCapabilityInventory(catalog()),
@@ -1899,6 +2079,7 @@ const registerCommandsProgram = (program, output, catalog) => {
1899
2079
  });
1900
2080
  });
1901
2081
  };
2082
+
1902
2083
  //#endregion
1903
2084
  //#region src/infrastructure/comment.program.ts
1904
2085
  const registerCommentProgram = (program, invocation, catalog, output) => {
@@ -1912,6 +2093,7 @@ const registerCommentProgram = (program, invocation, catalog, output) => {
1912
2093
  }));
1913
2094
  });
1914
2095
  };
2096
+
1915
2097
  //#endregion
1916
2098
  //#region src/infrastructure/doctor.program.ts
1917
2099
  const registerDoctorProgram = (program, dependencies) => {
@@ -1930,6 +2112,7 @@ const registerDoctorProgram = (program, dependencies) => {
1930
2112
  });
1931
2113
  });
1932
2114
  };
2115
+
1933
2116
  //#endregion
1934
2117
  //#region src/infrastructure/fixture.program.ts
1935
2118
  const positiveInteger$1 = (value) => z.coerce.number().int().positive().parse(value);
@@ -2005,129 +2188,7 @@ const registerFixtureProgram = (program, composites, output) => {
2005
2188
  registerRecordingFixture(fixture, composites.recording, output);
2006
2189
  registerWorldFixture(fixture, composites.world, output);
2007
2190
  };
2008
- //#endregion
2009
- //#region src/infrastructure/oauth-loopback.adapter.ts
2010
- const CALLBACK_PATH = "/callback";
2011
- const AUTHORIZATION_TIMEOUT_MS = 12e4;
2012
- const ENTROPY_BYTES = 32;
2013
- const HTTP_OK = 200;
2014
- const HTTP_BAD_REQUEST = 400;
2015
- const HTTP_NOT_FOUND = 404;
2016
- const SUCCESS_PAGE = "<!doctype html><meta charset=\"utf-8\"><title>Enhance authenticated</title><p>Enhance is authenticated. You can close this window.</p>";
2017
- const endpoint = (issuer, path) => new URL(path, issuer.endsWith("/") ? issuer : `${issuer}/`);
2018
- const launchBrowser = (url) => {
2019
- const command = process.platform === "darwin" ? {
2020
- executable: "open",
2021
- arguments: [url]
2022
- } : process.platform === "win32" ? {
2023
- executable: "rundll32.exe",
2024
- arguments: ["url.dll,FileProtocolHandler", url]
2025
- } : {
2026
- executable: "xdg-open",
2027
- arguments: [url]
2028
- };
2029
- const child = spawn(command.executable, command.arguments, {
2030
- detached: true,
2031
- stdio: "ignore"
2032
- });
2033
- child.once("error", () => false);
2034
- child.unref();
2035
- };
2036
- const handleCallback = (input, request, response) => {
2037
- const url = new URL(request.url ?? "/", "http://127.0.0.1");
2038
- if (request.method !== "GET" || url.pathname !== CALLBACK_PATH) {
2039
- response.writeHead(HTTP_NOT_FOUND).end();
2040
- return;
2041
- }
2042
- if (url.searchParams.get("state") !== input.state) {
2043
- response.writeHead(HTTP_BAD_REQUEST).end("The OAuth state did not match. Return to the terminal and retry.");
2044
- return;
2045
- }
2046
- const error = url.searchParams.get("error");
2047
- const received = url.searchParams.get("code");
2048
- if (error !== null || received === null || received === "") {
2049
- response.writeHead(HTTP_BAD_REQUEST).end("Enhance authentication was not approved.");
2050
- input.completion.reject(new Error(error ?? "the authorization response carried no code"));
2051
- return;
2052
- }
2053
- response.writeHead(HTTP_OK, { "content-type": "text/html; charset=utf-8" }).end(SUCCESS_PAGE);
2054
- input.completion.resolve(received);
2055
- };
2056
- const authorizeUrl = (input) => {
2057
- const authorize = endpoint(input.issuer, "oauth/authorize");
2058
- authorize.search = new URLSearchParams({
2059
- response_type: "code",
2060
- client_id: input.clientId,
2061
- redirect_uri: input.redirectUri,
2062
- scope: input.scope,
2063
- state: input.state,
2064
- code_challenge: input.challenge,
2065
- code_challenge_method: "S256"
2066
- }).toString();
2067
- return authorize.href;
2068
- };
2069
- const authorizationCode = async (input) => {
2070
- const completion = Promise.withResolvers();
2071
- const server = createServer((request, response) => {
2072
- handleCallback({
2073
- state: input.state,
2074
- completion
2075
- }, request, response);
2076
- });
2077
- await new Promise((resolve, reject) => {
2078
- server.once("error", reject);
2079
- server.listen(0, "127.0.0.1", resolve);
2080
- });
2081
- const address = server.address();
2082
- if (address === null || typeof address === "string") {
2083
- server.close();
2084
- throw new Error("the OAuth callback listener has no TCP port");
2085
- }
2086
- const redirectUri = `http://127.0.0.1:${String(address.port)}${CALLBACK_PATH}`;
2087
- const url = authorizeUrl({
2088
- ...input,
2089
- redirectUri
2090
- });
2091
- input.onReady(url);
2092
- if (input.openBrowser) launchBrowser(url);
2093
- const timeout = setTimeout(() => {
2094
- completion.reject(/* @__PURE__ */ new Error("browser authorization timed out"));
2095
- }, AUTHORIZATION_TIMEOUT_MS);
2096
- try {
2097
- return {
2098
- code: await completion.promise,
2099
- redirectUri
2100
- };
2101
- } finally {
2102
- clearTimeout(timeout);
2103
- await new Promise((resolve) => {
2104
- server.close(() => {
2105
- resolve();
2106
- });
2107
- });
2108
- }
2109
- };
2110
- const createOauthLoopbackAdapter = (remote) => ({ authorize: async (input) => {
2111
- try {
2112
- const verifier = randomBytes(ENTROPY_BYTES).toString("base64url");
2113
- const challenge = createHash("sha256").update(verifier).digest("base64url");
2114
- const state = randomBytes(ENTROPY_BYTES).toString("base64url");
2115
- const authorized = await authorizationCode({
2116
- ...input,
2117
- challenge,
2118
- state
2119
- });
2120
- return await remote.exchangeOauthCode({
2121
- issuer: input.issuer,
2122
- clientId: input.clientId,
2123
- code: authorized.code,
2124
- redirectUri: authorized.redirectUri,
2125
- verifier
2126
- });
2127
- } catch (error) {
2128
- throw new CliError("UNAUTHORIZED", error instanceof Error ? `Browser authentication failed: ${error.message}.` : "Browser authentication failed.", "Run 'enhance auth login' again, complete the browser consent, and keep the terminal open.");
2129
- }
2130
- } });
2191
+
2131
2192
  //#endregion
2132
2193
  //#region src/infrastructure/prototype.program.ts
2133
2194
  const finiteNumber = (value) => z.coerce.number().parse(value);
@@ -2160,6 +2221,7 @@ const registerPrototypeProgram = (program, invocation, catalog, output) => {
2160
2221
  }));
2161
2222
  });
2162
2223
  };
2224
+
2163
2225
  //#endregion
2164
2226
  //#region src/infrastructure/recording.program.ts
2165
2227
  const integer = (value, name, isPositive) => {
@@ -2186,6 +2248,7 @@ const registerRecordingProgram = (program, input) => {
2186
2248
  }));
2187
2249
  });
2188
2250
  };
2251
+
2189
2252
  //#endregion
2190
2253
  //#region src/infrastructure/remote-router.adapter.ts
2191
2254
  const refuseDocumentConflict = (path, input, result) => {
@@ -2196,6 +2259,7 @@ const createRemoteRouterAdapter = (source, remote) => proxify(source, (path) =>
2196
2259
  query: async (input) => remote.query(path, input),
2197
2260
  mutate: async (input) => refuseDocumentConflict(path, input, await remote.mutate(path, input))
2198
2261
  } }));
2262
+
2199
2263
  //#endregion
2200
2264
  //#region src/infrastructure/transcript.program.ts
2201
2265
  const registerTranscriptProgram = (program, input) => {
@@ -2214,6 +2278,7 @@ const registerTranscriptProgram = (program, input) => {
2214
2278
  }));
2215
2279
  });
2216
2280
  };
2281
+
2217
2282
  //#endregion
2218
2283
  //#region src/infrastructure/cli.program.ts
2219
2284
  const CLI_ASSEMBLY = {
@@ -2309,7 +2374,7 @@ const createCliProgram = (input) => {
2309
2374
  const { descriptions, mutationPaths } = cliMetadataFrom(source);
2310
2375
  const cli = createCli({
2311
2376
  router: createRemoteRouterAdapter(source, input.remote),
2312
- name: "enhance",
2377
+ name: input.commandName,
2313
2378
  version: input.version,
2314
2379
  description: "Operate Enhance as the authenticated person.",
2315
2380
  jsonInput: CLI_ASSEMBLY.jsonInput
@@ -2345,9 +2410,11 @@ const createCliProgram = (input) => {
2345
2410
  }
2346
2411
  };
2347
2412
  };
2413
+
2348
2414
  //#endregion
2349
2415
  //#region src/infrastructure/exit-process.lib.ts
2350
2416
  const exitProcess = (code) => process.exit(code);
2417
+
2351
2418
  //#endregion
2352
2419
  //#region src/infrastructure/ndjson.logger.ts
2353
2420
  const MAX_INLINE_CHARACTERS = 25e3;
@@ -2513,21 +2580,23 @@ const writeResult = (value, sensitiveDirectory) => {
2513
2580
  const writeFailure = (value) => {
2514
2581
  process.stderr.write(`${JSON.stringify(value)}\n`);
2515
2582
  };
2516
- const createNdjsonLoggerAdapter = (state, configDirectory) => {
2583
+ const createNdjsonLoggerAdapter = (state, configDirectory, commandName = "enhance") => {
2517
2584
  const failureState = state;
2518
2585
  const sensitiveDirectory = path.join(configDirectory, "sensitive");
2519
2586
  sweepExpiredSensitiveFiles(sensitiveDirectory);
2520
2587
  return {
2521
2588
  result: (value) => {
2522
- writeResult(value, sensitiveDirectory);
2589
+ writeResult(withCommandName(value, commandName), sensitiveDirectory);
2590
+ },
2591
+ failure: (value) => {
2592
+ writeFailure(withCommandInFailure(value, commandName));
2523
2593
  },
2524
- failure: writeFailure,
2525
2594
  logger: {
2526
2595
  info: (...args) => {
2527
- writeResult(args.length === 1 ? args[0] : args, sensitiveDirectory);
2596
+ writeResult(withCommandName(args.length === 1 ? args[0] : args, commandName), sensitiveDirectory);
2528
2597
  },
2529
2598
  error: (...args) => {
2530
- const message = args.map(String).join("");
2599
+ const message = String(withCommandName(args.map(String).join(""), commandName));
2531
2600
  const parsed = parsedFailure(message);
2532
2601
  if (parsed === null) failureState.pendingParserMessage = message;
2533
2602
  else writeFailure(parsed);
@@ -2535,6 +2604,7 @@ const createNdjsonLoggerAdapter = (state, configDirectory) => {
2535
2604
  }
2536
2605
  };
2537
2606
  };
2607
+
2538
2608
  //#endregion
2539
2609
  //#region src/main.ts
2540
2610
  const main = async () => {
@@ -2542,17 +2612,18 @@ const main = async () => {
2542
2612
  exitCode: 1,
2543
2613
  pendingParserMessage: null
2544
2614
  };
2545
- const output = createNdjsonLoggerAdapter(state, CLI_CONFIG.configDirectory);
2615
+ const output = createNdjsonLoggerAdapter(state, CLI_CONFIG.configDirectory, CLI_CONFIG.commandName);
2546
2616
  const credentials = createFileCredentialAdapter(CLI_CONFIG.configDirectory);
2547
2617
  const mutationKey = createMutationKeyAdapter();
2548
2618
  const cli = createCliProgram({
2549
- version: "0.1.6",
2619
+ version: "0.1.7",
2550
2620
  credentials,
2551
2621
  remote: createHttpRemoteAdapter(CLI_CONFIG.apiUrl, credentials, mutationKey),
2552
2622
  mutationKey,
2553
2623
  output,
2554
2624
  state,
2555
- configDirectory: CLI_CONFIG.configDirectory
2625
+ configDirectory: CLI_CONFIG.configDirectory,
2626
+ commandName: CLI_CONFIG.commandName
2556
2627
  });
2557
2628
  try {
2558
2629
  await cli.run();
@@ -2563,5 +2634,6 @@ const main = async () => {
2563
2634
  }
2564
2635
  };
2565
2636
  main();
2637
+
2566
2638
  //#endregion
2567
- export {};
2639
+ export { };