@enactprotocol/cli 1.2.4 → 1.2.5

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/index.js CHANGED
@@ -226388,6 +226388,49 @@ class DaggerExecutionProvider extends ExecutionProvider {
226388
226388
  });
226389
226389
  });
226390
226390
  }
226391
+ async setupDirectoryMount(client, container, mountSpec) {
226392
+ try {
226393
+ let localPath2;
226394
+ let containerPath;
226395
+ const colonIndex = mountSpec.indexOf(":");
226396
+ if (colonIndex > 0) {
226397
+ const potentialDriveLetter = mountSpec.substring(0, colonIndex);
226398
+ const isWindowsDrive = potentialDriveLetter.length === 1 && /[A-Za-z]/.test(potentialDriveLetter);
226399
+ if (isWindowsDrive) {
226400
+ const nextColonIndex = mountSpec.indexOf(":", colonIndex + 1);
226401
+ if (nextColonIndex > 0) {
226402
+ localPath2 = mountSpec.substring(0, nextColonIndex);
226403
+ containerPath = mountSpec.substring(nextColonIndex + 1);
226404
+ } else {
226405
+ localPath2 = mountSpec;
226406
+ containerPath = "/workspace/src";
226407
+ }
226408
+ } else {
226409
+ localPath2 = mountSpec.substring(0, colonIndex);
226410
+ containerPath = mountSpec.substring(colonIndex + 1);
226411
+ }
226412
+ } else if (colonIndex === 0) {
226413
+ localPath2 = "";
226414
+ containerPath = mountSpec.substring(1);
226415
+ } else {
226416
+ localPath2 = mountSpec;
226417
+ containerPath = "/workspace/src";
226418
+ }
226419
+ const path8 = __require("path");
226420
+ const resolvedLocalPath = path8.resolve(localPath2);
226421
+ const fs5 = __require("fs");
226422
+ if (!fs5.existsSync(resolvedLocalPath)) {
226423
+ throw new Error(`Mount source directory does not exist: ${resolvedLocalPath}`);
226424
+ }
226425
+ const hostDirectory = client.host().directory(resolvedLocalPath);
226426
+ container = container.withMountedDirectory(containerPath, hostDirectory);
226427
+ logger_default.debug(`\uD83D\uDCC2 Mounted ${resolvedLocalPath} -> ${containerPath}`);
226428
+ return container;
226429
+ } catch (error2) {
226430
+ logger_default.error(`Failed to setup directory mount: ${error2}`);
226431
+ throw error2;
226432
+ }
226433
+ }
226391
226434
  async setupContainer(client, environment, inputs, tool) {
226392
226435
  const containerImage = tool?.from || this.options.baseImage;
226393
226436
  logger_default.debug(`\uD83D\uDE80 Setting up container with image: ${containerImage}${tool?.from ? " (from tool.from)" : " (default baseImage)"}`);
@@ -226395,6 +226438,9 @@ class DaggerExecutionProvider extends ExecutionProvider {
226395
226438
  logger_default.debug("\uD83D\uDCE6 Base container created");
226396
226439
  container = container.withWorkdir(this.options.workdir);
226397
226440
  logger_default.debug(`\uD83D\uDCC1 Working directory set to: ${this.options.workdir}`);
226441
+ if (environment.mount) {
226442
+ container = await this.setupDirectoryMount(client, container, environment.mount);
226443
+ }
226398
226444
  for (const [key, value] of Object.entries(environment.vars)) {
226399
226445
  container = container.withEnvVariable(key, String(value));
226400
226446
  }
@@ -229683,7 +229729,6 @@ class EnactCore {
229683
229729
  const messageHash = CryptoUtils.hash(docString);
229684
229730
  const directVerify = CryptoUtils.verify(referenceSignature.publicKey, messageHash, referenceSignature.signature);
229685
229731
  const isValid = SigningService.verifyDocument(documentForVerification, referenceSignature, { includeFields: ["command"] });
229686
- console.log("Final verification result:", isValid);
229687
229732
  if (!isValid) {
229688
229733
  throw new Error(`Tool ${tool.name} has invalid signatures`);
229689
229734
  }
@@ -229713,7 +229758,8 @@ class EnactCore {
229713
229758
  vars: { ...envVars, ...validatedInputs },
229714
229759
  resources: {
229715
229760
  timeout: options.timeout || tool.timeout || this.options.defaultTimeout
229716
- }
229761
+ },
229762
+ mount: options.mount
229717
229763
  });
229718
229764
  } catch (error2) {
229719
229765
  return {
@@ -230237,6 +230283,7 @@ Options:
230237
230283
  --timeout <time> Override tool timeout (Go duration format: 30s, 5m, 1h)
230238
230284
  --dry Show command that would be executed without running it
230239
230285
  --verbose, -v Show detailed execution information
230286
+ --mount <path> Mount local directory to container (format: "local:container")
230240
230287
  --dangerously-skip-verification Skip all signature verification (DANGEROUS - not recommended for production)
230241
230288
  --verify-policy Verification policy: permissive, enterprise, paranoid (default: permissive)
230242
230289
 
@@ -230249,6 +230296,7 @@ Examples:
230249
230296
  enact exec enact/text/slugify --input "Hello World"
230250
230297
  enact exec org/ai/review --params '{"file": "README.md"}' --verify-policy enterprise
230251
230298
  enact exec ./my-tool.yaml --input "test data"
230299
+ enact exec kgroves/tools/prettier --mount ./src:/workspace/src
230252
230300
  enact exec untrusted/tool --dangerously-skip-verification # DANGEROUS, not recommended
230253
230301
  `);
230254
230302
  return;
@@ -230443,7 +230491,8 @@ Environment variables:`));
230443
230491
  timeout: options.timeout,
230444
230492
  dryRun: options.dry,
230445
230493
  verbose: options.verbose,
230446
- isLocalFile
230494
+ isLocalFile,
230495
+ mount: options.mount
230447
230496
  };
230448
230497
  try {
230449
230498
  console.error(import_picocolors13.default.cyan(`
@@ -231099,6 +231148,9 @@ var { values, positionals } = parseArgs({
231099
231148
  },
231100
231149
  client: {
231101
231150
  type: "string"
231151
+ },
231152
+ mount: {
231153
+ type: "string"
231102
231154
  }
231103
231155
  },
231104
231156
  allowPositionals: true,
@@ -231169,7 +231221,8 @@ async function main() {
231169
231221
  timeout: values.timeout,
231170
231222
  dry: values.dry,
231171
231223
  verbose: values.verbose,
231172
- dangerouslySkipVerification: values["dangerously-skip-verification"]
231224
+ dangerouslySkipVerification: values["dangerously-skip-verification"],
231225
+ mount: values.mount
231173
231226
  });
231174
231227
  break;
231175
231228
  case "get":
package/dist/index.js.bak CHANGED
@@ -226387,6 +226387,49 @@ class DaggerExecutionProvider extends ExecutionProvider {
226387
226387
  });
226388
226388
  });
226389
226389
  }
226390
+ async setupDirectoryMount(client, container, mountSpec) {
226391
+ try {
226392
+ let localPath2;
226393
+ let containerPath;
226394
+ const colonIndex = mountSpec.indexOf(":");
226395
+ if (colonIndex > 0) {
226396
+ const potentialDriveLetter = mountSpec.substring(0, colonIndex);
226397
+ const isWindowsDrive = potentialDriveLetter.length === 1 && /[A-Za-z]/.test(potentialDriveLetter);
226398
+ if (isWindowsDrive) {
226399
+ const nextColonIndex = mountSpec.indexOf(":", colonIndex + 1);
226400
+ if (nextColonIndex > 0) {
226401
+ localPath2 = mountSpec.substring(0, nextColonIndex);
226402
+ containerPath = mountSpec.substring(nextColonIndex + 1);
226403
+ } else {
226404
+ localPath2 = mountSpec;
226405
+ containerPath = "/workspace/src";
226406
+ }
226407
+ } else {
226408
+ localPath2 = mountSpec.substring(0, colonIndex);
226409
+ containerPath = mountSpec.substring(colonIndex + 1);
226410
+ }
226411
+ } else if (colonIndex === 0) {
226412
+ localPath2 = "";
226413
+ containerPath = mountSpec.substring(1);
226414
+ } else {
226415
+ localPath2 = mountSpec;
226416
+ containerPath = "/workspace/src";
226417
+ }
226418
+ const path8 = __require("path");
226419
+ const resolvedLocalPath = path8.resolve(localPath2);
226420
+ const fs5 = __require("fs");
226421
+ if (!fs5.existsSync(resolvedLocalPath)) {
226422
+ throw new Error(`Mount source directory does not exist: ${resolvedLocalPath}`);
226423
+ }
226424
+ const hostDirectory = client.host().directory(resolvedLocalPath);
226425
+ container = container.withMountedDirectory(containerPath, hostDirectory);
226426
+ logger_default.debug(`\uD83D\uDCC2 Mounted ${resolvedLocalPath} -> ${containerPath}`);
226427
+ return container;
226428
+ } catch (error2) {
226429
+ logger_default.error(`Failed to setup directory mount: ${error2}`);
226430
+ throw error2;
226431
+ }
226432
+ }
226390
226433
  async setupContainer(client, environment, inputs, tool) {
226391
226434
  const containerImage = tool?.from || this.options.baseImage;
226392
226435
  logger_default.debug(`\uD83D\uDE80 Setting up container with image: ${containerImage}${tool?.from ? " (from tool.from)" : " (default baseImage)"}`);
@@ -226394,6 +226437,9 @@ class DaggerExecutionProvider extends ExecutionProvider {
226394
226437
  logger_default.debug("\uD83D\uDCE6 Base container created");
226395
226438
  container = container.withWorkdir(this.options.workdir);
226396
226439
  logger_default.debug(`\uD83D\uDCC1 Working directory set to: ${this.options.workdir}`);
226440
+ if (environment.mount) {
226441
+ container = await this.setupDirectoryMount(client, container, environment.mount);
226442
+ }
226397
226443
  for (const [key, value] of Object.entries(environment.vars)) {
226398
226444
  container = container.withEnvVariable(key, String(value));
226399
226445
  }
@@ -229682,7 +229728,6 @@ class EnactCore {
229682
229728
  const messageHash = CryptoUtils.hash(docString);
229683
229729
  const directVerify = CryptoUtils.verify(referenceSignature.publicKey, messageHash, referenceSignature.signature);
229684
229730
  const isValid = SigningService.verifyDocument(documentForVerification, referenceSignature, { includeFields: ["command"] });
229685
- console.log("Final verification result:", isValid);
229686
229731
  if (!isValid) {
229687
229732
  throw new Error(`Tool ${tool.name} has invalid signatures`);
229688
229733
  }
@@ -229712,7 +229757,8 @@ class EnactCore {
229712
229757
  vars: { ...envVars, ...validatedInputs },
229713
229758
  resources: {
229714
229759
  timeout: options.timeout || tool.timeout || this.options.defaultTimeout
229715
- }
229760
+ },
229761
+ mount: options.mount
229716
229762
  });
229717
229763
  } catch (error2) {
229718
229764
  return {
@@ -230236,6 +230282,7 @@ Options:
230236
230282
  --timeout <time> Override tool timeout (Go duration format: 30s, 5m, 1h)
230237
230283
  --dry Show command that would be executed without running it
230238
230284
  --verbose, -v Show detailed execution information
230285
+ --mount <path> Mount local directory to container (format: "local:container")
230239
230286
  --dangerously-skip-verification Skip all signature verification (DANGEROUS - not recommended for production)
230240
230287
  --verify-policy Verification policy: permissive, enterprise, paranoid (default: permissive)
230241
230288
 
@@ -230248,6 +230295,7 @@ Examples:
230248
230295
  enact exec enact/text/slugify --input "Hello World"
230249
230296
  enact exec org/ai/review --params '{"file": "README.md"}' --verify-policy enterprise
230250
230297
  enact exec ./my-tool.yaml --input "test data"
230298
+ enact exec kgroves/tools/prettier --mount ./src:/workspace/src
230251
230299
  enact exec untrusted/tool --dangerously-skip-verification # DANGEROUS, not recommended
230252
230300
  `);
230253
230301
  return;
@@ -230442,7 +230490,8 @@ Environment variables:`));
230442
230490
  timeout: options.timeout,
230443
230491
  dryRun: options.dry,
230444
230492
  verbose: options.verbose,
230445
- isLocalFile
230493
+ isLocalFile,
230494
+ mount: options.mount
230446
230495
  };
230447
230496
  try {
230448
230497
  console.error(import_picocolors13.default.cyan(`
@@ -231098,6 +231147,9 @@ var { values, positionals } = parseArgs({
231098
231147
  },
231099
231148
  client: {
231100
231149
  type: "string"
231150
+ },
231151
+ mount: {
231152
+ type: "string"
231101
231153
  }
231102
231154
  },
231103
231155
  allowPositionals: true,
@@ -231168,7 +231220,8 @@ async function main() {
231168
231220
  timeout: values.timeout,
231169
231221
  dry: values.dry,
231170
231222
  verbose: values.verbose,
231171
- dangerouslySkipVerification: values["dangerously-skip-verification"]
231223
+ dangerouslySkipVerification: values["dangerously-skip-verification"],
231224
+ mount: values.mount
231172
231225
  });
231173
231226
  break;
231174
231227
  case "get":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enactprotocol/cli",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "Official CLI for the Enact Protocol - package, secure, and discover AI tools",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -42,7 +42,7 @@
42
42
  "node": ">=18.0.0"
43
43
  },
44
44
  "dependencies": {
45
- "@enactprotocol/shared": "1.2.4",
45
+ "@enactprotocol/shared": "1.2.5",
46
46
  "@clack/core": "^0.4.2",
47
47
  "@clack/prompts": "^0.10.1",
48
48
  "picocolors": "^1.1.1"