@getmonoceros/workbench 1.16.1 → 1.17.0

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/bin.js CHANGED
@@ -2191,6 +2191,12 @@ function normalizeOptions(opts) {
2191
2191
  function needsCompose(opts) {
2192
2192
  return opts.services.length > 0;
2193
2193
  }
2194
+ function featuresSourceRoot() {
2195
+ const override2 = process.env.MONOCEROS_FEATURES_DIR_OVERRIDE?.trim();
2196
+ if (override2 && override2.length > 0) return override2;
2197
+ const checkout = workbenchCheckoutRoot();
2198
+ return checkout ? path8.join(checkout, "images", "features") : null;
2199
+ }
2194
2200
  function resolveFeatures(opts) {
2195
2201
  const resolved = [];
2196
2202
  for (const langSpec of opts.languages) {
@@ -2223,20 +2229,28 @@ function resolveFeatures(opts) {
2223
2229
  const match = matchMonocerosFeature(rawRef);
2224
2230
  if (match) {
2225
2231
  const name = match.name;
2226
- const checkout = workbenchCheckoutRoot();
2227
- const localSourceDir = checkout ? path8.join(checkout, "images", "features", name) : null;
2232
+ const sourceRoot = featuresSourceRoot();
2233
+ const localSourceDir = sourceRoot ? path8.join(sourceRoot, name) : null;
2228
2234
  if (localSourceDir && existsSync5(localSourceDir)) {
2229
- const { paths, files } = readPersistentHomeEntries(localSourceDir);
2235
+ const { paths: paths2, files: files2 } = readPersistentHomeEntries(localSourceDir);
2230
2236
  resolved.push({
2231
2237
  devcontainerKey: `./features/${name}`,
2232
2238
  options,
2233
2239
  localSourceDir,
2234
2240
  localName: name,
2235
- persistentHomePaths: paths,
2236
- persistentHomeFiles: files
2241
+ persistentHomePaths: paths2,
2242
+ persistentHomeFiles: files2
2237
2243
  });
2238
2244
  continue;
2239
2245
  }
2246
+ const { paths, files } = readBundledPersistentHomeEntries(name);
2247
+ resolved.push({
2248
+ devcontainerKey: rawRef,
2249
+ options,
2250
+ persistentHomePaths: paths,
2251
+ persistentHomeFiles: files
2252
+ });
2253
+ continue;
2240
2254
  }
2241
2255
  resolved.push({
2242
2256
  devcontainerKey: rawRef,
@@ -2261,6 +2275,13 @@ function readPersistentHomeEntries(localSourceDir) {
2261
2275
  return { paths: [], files: [] };
2262
2276
  }
2263
2277
  }
2278
+ function readBundledPersistentHomeEntries(name) {
2279
+ try {
2280
+ return readPersistentHomeEntries(path8.join(bundledFeaturesDir(), name));
2281
+ } catch {
2282
+ return { paths: [], files: [] };
2283
+ }
2284
+ }
2264
2285
  function filterSubpaths(raw) {
2265
2286
  if (!Array.isArray(raw)) return [];
2266
2287
  return raw.filter(
@@ -6272,7 +6293,7 @@ var CLI_VERSION;
6272
6293
  var init_version = __esm({
6273
6294
  "src/version.ts"() {
6274
6295
  "use strict";
6275
- CLI_VERSION = true ? "1.16.1" : "dev";
6296
+ CLI_VERSION = true ? "1.17.0" : "dev";
6276
6297
  }
6277
6298
  });
6278
6299
 
@@ -8590,13 +8611,21 @@ async function runInContainer(opts) {
8590
8611
  { quiet: true }
8591
8612
  );
8592
8613
  if (upCode !== 0) return upCode;
8614
+ const innerExec = opts.cwd ? [
8615
+ "bash",
8616
+ "-lc",
8617
+ 'cd -- "$1" && shift && exec "$@"',
8618
+ "bash",
8619
+ opts.cwd,
8620
+ ...opts.command
8621
+ ] : opts.command;
8593
8622
  return spawnFn(
8594
8623
  [
8595
8624
  "exec",
8596
8625
  "--workspace-folder",
8597
8626
  opts.root,
8598
8627
  "--mount-workspace-git-root=false",
8599
- ...opts.command
8628
+ ...innerExec
8600
8629
  ],
8601
8630
  opts.root,
8602
8631
  { interactive: true }
@@ -8631,6 +8660,10 @@ var init_run2 = __esm({
8631
8660
  type: "positional",
8632
8661
  description: "Container name (yml in $MONOCEROS_HOME/container-configs/).",
8633
8662
  required: true
8663
+ },
8664
+ in: {
8665
+ type: "string",
8666
+ description: "Run the inner command in this directory inside the container (relative to the workspace folder, or absolute). The directory must already exist."
8634
8667
  }
8635
8668
  },
8636
8669
  async run({ args }) {
@@ -8644,7 +8677,8 @@ var init_run2 = __esm({
8644
8677
  try {
8645
8678
  const exitCode = await runInContainer({
8646
8679
  root: containerDir(args.name),
8647
- command
8680
+ command,
8681
+ ...args.in ? { cwd: args.in } : {}
8648
8682
  });
8649
8683
  process.exit(exitCode);
8650
8684
  } catch (err) {