@chrisdudek/yg 2.5.0 → 2.5.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
@@ -440,7 +440,7 @@ When code anchors (\`anchors\` in an aspect entry in \`yg-node.yaml\`) are prese
440
440
 
441
441
  - [ ] 1. Read \`schemas/yg-flow.yaml\`
442
442
  - [ ] 2. Create \`flows/<name>/\` directory
443
- - [ ] 3. Write \`yg-flow.yaml\` \u2014 declare participants and flow-level aspects
443
+ - [ ] 3. Write \`yg-flow.yaml\` \u2014 declare nodes (participant list) and flow-level aspects
444
444
  - [ ] 4. Write \`description.md\` with required sections: Business context, Trigger, Goal, Participants, Paths (at least Happy path), Invariants across all paths
445
445
  - [ ] 5. \`yg validate\`
446
446
 
@@ -493,7 +493,7 @@ yg drift-sync --node <path> [--recursive] | --all
493
493
  | Information specific to this node | Local node artifact (check \`yg-config.yaml artifacts\` for types) |
494
494
  | Rule that applies to many nodes | Aspect (content \`.md\` files in \`aspects/<id>/\`) |
495
495
  | Architectural invariant for a node type | Required aspect in \`yg-config.yaml node_types\` |
496
- | Business process participation | Flow (\`yg-flow.yaml participants\`) |
496
+ | Business process participation | Flow (\`yg-flow.yaml nodes\`) |
497
497
  | Process-level requirement | Flow \`aspects\` + aspect directory |
498
498
  | Context shared across a domain | Parent node artifact |
499
499
  | Technology stack | Node artifact at appropriate hierarchy level |
@@ -1509,13 +1509,17 @@ async function parseFlow(flowDir, flowYamlPath) {
1509
1509
  if (!raw.name || typeof raw.name !== "string" || raw.name.trim() === "") {
1510
1510
  throw new Error(`yg-flow.yaml at ${flowYamlPath}: missing or empty 'name'`);
1511
1511
  }
1512
- const nodes = raw.nodes;
1512
+ const nodes = raw.nodes ?? raw.participants;
1513
1513
  if (!Array.isArray(nodes) || nodes.length === 0) {
1514
- throw new Error(`yg-flow.yaml at ${flowYamlPath}: 'nodes' must be a non-empty array`);
1514
+ throw new Error(
1515
+ `yg-flow.yaml at ${flowYamlPath}: 'nodes' (or 'participants') must be a non-empty array`
1516
+ );
1515
1517
  }
1516
1518
  const nodePaths = nodes.filter((n) => typeof n === "string");
1517
1519
  if (nodePaths.length === 0) {
1518
- throw new Error(`yg-flow.yaml at ${flowYamlPath}: 'nodes' must contain string node paths`);
1520
+ throw new Error(
1521
+ `yg-flow.yaml at ${flowYamlPath}: 'nodes' (or 'participants') must contain string node paths`
1522
+ );
1519
1523
  }
1520
1524
  let aspects;
1521
1525
  if (raw.aspects !== void 0) {
@@ -1732,19 +1736,20 @@ async function scanAspectsDirectory(dirPath, aspectsRoot, aspects) {
1732
1736
  }
1733
1737
  }
1734
1738
  async function loadFlows(flowsDir) {
1739
+ let entries;
1735
1740
  try {
1736
- const entries = await readdir4(flowsDir, { withFileTypes: true });
1737
- const flows = [];
1738
- for (const entry of entries) {
1739
- if (!entry.isDirectory()) continue;
1740
- const flowYamlPath = path9.join(flowsDir, entry.name, "yg-flow.yaml");
1741
- const flow = await parseFlow(path9.join(flowsDir, entry.name), flowYamlPath);
1742
- flows.push(flow);
1743
- }
1744
- return flows;
1741
+ entries = await readdir4(flowsDir, { withFileTypes: true });
1745
1742
  } catch {
1746
1743
  return [];
1747
1744
  }
1745
+ const flows = [];
1746
+ for (const entry of entries) {
1747
+ if (!entry.isDirectory()) continue;
1748
+ const flowYamlPath = path9.join(flowsDir, entry.name, "yg-flow.yaml");
1749
+ const flow = await parseFlow(path9.join(flowsDir, entry.name), flowYamlPath);
1750
+ flows.push(flow);
1751
+ }
1752
+ return flows;
1748
1753
  }
1749
1754
  async function loadSchemas(schemasDir) {
1750
1755
  try {