@getmonoceros/workbench 1.31.0 → 1.31.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/bin.js CHANGED
@@ -8347,7 +8347,7 @@ var CLI_VERSION;
8347
8347
  var init_version = __esm({
8348
8348
  "src/version.ts"() {
8349
8349
  "use strict";
8350
- CLI_VERSION = true ? "1.31.0" : "dev";
8350
+ CLI_VERSION = true ? "1.31.1" : "dev";
8351
8351
  }
8352
8352
  });
8353
8353
 
@@ -8705,6 +8705,50 @@ async function listContainerNames(ctx) {
8705
8705
  const entries = await fs14.readdir(dir);
8706
8706
  return entries.filter((e) => e.endsWith(".yml")).map((e) => e.slice(0, -".yml".length)).sort();
8707
8707
  }
8708
+ function containerNameFromCtx(ctx) {
8709
+ for (let i = 2; i < ctx.prev.length; i++) {
8710
+ const t = ctx.prev[i];
8711
+ if (t === "--") break;
8712
+ if (t.startsWith("-")) continue;
8713
+ return t;
8714
+ }
8715
+ return void 0;
8716
+ }
8717
+ async function collectDirs(dir, maxDepth) {
8718
+ const out = [];
8719
+ async function walk(at, rel, depth) {
8720
+ let entries;
8721
+ try {
8722
+ entries = await fs14.readdir(at, { withFileTypes: true });
8723
+ } catch {
8724
+ return;
8725
+ }
8726
+ for (const e of entries) {
8727
+ if (!e.isDirectory()) continue;
8728
+ if (e.name.startsWith(".")) continue;
8729
+ if (WORKSPACE_DIR_SKIP.has(e.name)) continue;
8730
+ const childRel = rel ? `${rel}/${e.name}` : e.name;
8731
+ out.push(childRel);
8732
+ if (depth + 1 < maxDepth) {
8733
+ await walk(path23.join(at, e.name), childRel, depth + 1);
8734
+ }
8735
+ }
8736
+ }
8737
+ await walk(dir, "", 0);
8738
+ return out;
8739
+ }
8740
+ async function listContainerWorkspaceDirs(home, name) {
8741
+ const root = path23.join(home, "container", name);
8742
+ const top = await collectDirs(root, 1);
8743
+ const projects = (await collectDirs(path23.join(root, "projects"), PROJECTS_DIR_MAX_DEPTH)).map((p) => `projects/${p}`);
8744
+ return [.../* @__PURE__ */ new Set([...top, ...projects])].sort();
8745
+ }
8746
+ async function listRunInDirs(ctx) {
8747
+ const name = containerNameFromCtx(ctx);
8748
+ if (!name) return [];
8749
+ const home = ctx.opts.monocerosHome ?? monocerosHome();
8750
+ return listContainerWorkspaceDirs(home, name);
8751
+ }
8708
8752
  async function listFeatureComponents() {
8709
8753
  const catalog = await loadComponentCatalog();
8710
8754
  return [...catalog.values()].filter((c) => c.file.category === "feature").map((c) => c.name).sort();
@@ -8767,7 +8811,7 @@ async function resolveFeatureRefForCompletion(token) {
8767
8811
  const f = c.file.contributes.features?.[0];
8768
8812
  return f?.ref;
8769
8813
  }
8770
- var ALL_COMMANDS, containerName, COMMAND_SPECS, COMPLETION_COMMAND_SPEC_KEYS;
8814
+ var WORKSPACE_DIR_SKIP, PROJECTS_DIR_MAX_DEPTH, ALL_COMMANDS, containerName, COMMAND_SPECS, COMPLETION_COMMAND_SPEC_KEYS;
8771
8815
  var init_resolve = __esm({
8772
8816
  "src/completion/resolve.ts"() {
8773
8817
  "use strict";
@@ -8777,6 +8821,8 @@ var init_resolve = __esm({
8777
8821
  init_catalog();
8778
8822
  init_schema();
8779
8823
  init_open();
8824
+ WORKSPACE_DIR_SKIP = /* @__PURE__ */ new Set(["node_modules"]);
8825
+ PROJECTS_DIR_MAX_DEPTH = 4;
8780
8826
  ALL_COMMANDS = [
8781
8827
  "init",
8782
8828
  "list-components",
@@ -8853,7 +8899,7 @@ var init_resolve = __esm({
8853
8899
  open: { positionals: [containerName, () => [...OPEN_TOOLS]] },
8854
8900
  run: {
8855
8901
  positionals: [containerName],
8856
- flags: { "--in": { type: "value" } }
8902
+ flags: { "--in": { type: "value", values: (ctx) => listRunInDirs(ctx) } }
8857
8903
  },
8858
8904
  logs: { positionals: [containerName] },
8859
8905
  start: {