@dogsbay/commands 0.2.0-beta.177 → 0.2.0-beta.179

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.
@@ -56,12 +56,25 @@ export function readConfigVariables(file, text) {
56
56
  const site = attrsOf(get(root, "attributes"), { scope: "site" });
57
57
  const sources = get(get(root, "content"), "sources");
58
58
  if (isSeq(sources) && sources.items.length) {
59
+ // A source is named by `name:`, as `site build` and dogsbay-ssg read it (item 31a: this read
60
+ // `namespace:`, a key neither build knows, so the shared fixture's two sources collided). A name
61
+ // is not unique (a product's versions share it), so the id is the name when it is, else
62
+ // `name/version`, else the name and the source's place: ids key every definition's variants.
63
+ const scalar = (item, key) => {
64
+ const v = get(item, key);
65
+ return isScalar(v) && v.value != null ? String(v.value) : undefined;
66
+ };
67
+ const names = sources.items.map((item) => scalar(item, "name"));
68
+ const versioned = sources.items.map((item, i) => (names[i] !== undefined && scalar(item, "version") !== undefined ? `${names[i]}/${scalar(item, "version")}` : names[i]));
69
+ const count = (list, v) => list.filter((x) => x === v).length;
59
70
  sources.items.forEach((item, i) => {
60
- const ns = get(item, "namespace");
61
- const namespace = isScalar(ns) && ns.value != null ? String(ns.value) : undefined;
71
+ const namespace = names[i];
62
72
  const p = get(item, "path");
63
73
  const path = isScalar(p) && typeof p.value === "string" ? clean(p.value) : "";
64
- const id = namespace ?? `source-${i}`;
74
+ const id = namespace === undefined ? `source-${i}`
75
+ : count(names, namespace) === 1 ? namespace
76
+ : count(versioned, versioned[i]) === 1 ? versioned[i]
77
+ : `${namespace}/source-${i}`;
65
78
  const own = attrsOf(get(item, "attributes"), { scope: "source", source: id });
66
79
  const t = get(item, "templates");
67
80
  if (isScalar(t) && t.value === "jinja")
@@ -62,8 +62,13 @@ export interface SymbolEntry {
62
62
  }
63
63
  /** One build of the content: a `content.sources` entry, with the site's attributes under its own. */
64
64
  export interface Variant {
65
- /** The source's `namespace`, else `source-<i>`; `default` when the config lists no sources. */
65
+ /**
66
+ * Unique: the source's `name:` when no other source has it, else `name/version` when that is
67
+ * unique, else `name/source-<i>`; `source-<i>` for an unnamed source; `default` when the config
68
+ * lists no sources.
69
+ */
66
70
  id: string;
71
+ /** The source's `name:` (its namespace: a URL segment once two or more sources are named differently), when it has one. */
67
72
  namespace?: string;
68
73
  /** The source's folder, workspace-relative (`""`: the root). */
69
74
  path: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dogsbay/commands",
3
- "version": "0.2.0-beta.177",
3
+ "version": "0.2.0-beta.179",
4
4
  "description": "Typed, headless-first command engine for the Dogsbay platform — one zod-defined command yields CLI, JSON-RPC, and MCP surfaces",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -31,11 +31,11 @@
31
31
  "js-yaml": "^5.2.1",
32
32
  "yaml": "^2.9.0",
33
33
  "zod": "^4.4.3",
34
- "@dogsbay/format-dogsbay-md": "0.2.0-beta.177",
35
- "@dogsbay/minja": "0.2.0-beta.177",
36
- "@dogsbay/render": "0.2.0-beta.177",
37
- "@dogsbay/format-topicmap": "0.2.0-beta.177",
38
- "@dogsbay/types": "0.2.0-beta.177"
34
+ "@dogsbay/format-dogsbay-md": "0.2.0-beta.179",
35
+ "@dogsbay/format-topicmap": "0.2.0-beta.179",
36
+ "@dogsbay/minja": "0.2.0-beta.179",
37
+ "@dogsbay/render": "0.2.0-beta.179",
38
+ "@dogsbay/types": "0.2.0-beta.179"
39
39
  },
40
40
  "license": "MIT",
41
41
  "repository": {