@chrisdudek/yg 0.2.1 → 0.3.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
@@ -133,15 +133,15 @@ You do not need explicit "session" commands. Follow these conversational trigger
133
133
  ### A. Preflight (First message of the conversation)
134
134
  Always execute these commands before doing anything else. *(Exception: If the user's request is clearly read-only, run ONLY step 1).* **Read-only** means the user asks only for explanation, clarification, analysis, or evaluation \u2014 no code or graph modification will occur. Examples: "explain this", "evaluate X", "what does Y do?", "analyze Z". If unsure, run full preflight.
135
135
  1. \`yg journal-read\` -> If entries exist, consolidate them into the graph, then \`yg journal-archive\`.
136
- 2. \`yg drift\` -> If divergence is detected, present states (\`ok\`, \`drift\`, \`missing\`, \`unmaterialized\`). Ask the user: Absorb (update graph) or Reject (re-materialize code from graph)?
136
+ 2. \`yg drift\` -> If **drift** (code changed, graph baseline stale): run \`yg drift-sync\` for each affected node. Do NOT ask the user \u2014 they do not need to know this step. If **missing** or **unmaterialized**: report and ask the user how to proceed.
137
137
  3. \`yg status\` -> Report graph health.
138
138
  4. \`yg validate\` -> If W008 stale-knowledge appears, update the knowledge artifacts to reflect current node state.
139
139
 
140
140
  ### B. Session Verification (Wrap-up)
141
- Triggered by phrases like: "we're done", "wrap up", "that's enough", "done".
141
+ Triggered by phrases like: "we're done", "wrap up", "that's enough", "done", "ok".
142
142
  **Note: The graph should ALREADY be up to date. If the graph requires massive updates at this stage, YOU HAVE FAILED.**
143
143
  1. If iterative journal mode was used: consolidate notes to the graph, then \`yg journal-archive\`.
144
- 2. \`yg drift\` -> Check if files changed manually during the conversation.
144
+ 2. \`yg drift\` -> If drift detected, run \`yg drift-sync\` for each affected node. Do NOT ask \u2014 absorb automatically.
145
145
  3. \`yg validate\` -> Fix any structural errors.
146
146
  4. Report exactly what nodes and files were changed.
147
147
 
@@ -254,6 +254,7 @@ When mapping a file, execute this mental routing:
254
254
  * **Routing:**
255
255
  * If it calls another module: Add an outgoing structural \`relation\` in \`node.yaml\`. (The engine will automatically fetch the target's structural-context artifacts: responsibility, interface, constraints, errors).
256
256
  * If it participates in an end-to-end process: Do not explain the whole process locally. Ensure the node is listed in \`.yggdrasil/flows/<flow_name>/flow.yaml\`. The engine will attach the flow knowledge automatically.
257
+ * **Flows \u2014 writing flow content:** When creating or editing flow artifacts (e.g. \`description.md\` in \`flows/<name>/\`), write business-first: describe the process from user/business perspective. Technical details only as inserts when they clarify the flow. Not technical-first with business inserts.
257
258
 
258
259
  ### Layer 3: Domain Context (Hierarchy)
259
260
  * **What goes here:** Business rules shared by a family of nodes.
@@ -1244,7 +1245,7 @@ async function buildContext(graph, nodePath) {
1244
1245
  }
1245
1246
  }
1246
1247
  }
1247
- for (const flow of collectParticipatingFlows(graph, nodePath)) {
1248
+ for (const flow of collectParticipatingFlows(graph, node)) {
1248
1249
  layers.push(buildFlowLayer(flow));
1249
1250
  for (const kPath of flow.knowledge ?? []) {
1250
1251
  const norm = kPath.replace(/\/$/, "");
@@ -1306,8 +1307,9 @@ function collectKnowledgeItems(graph, nodePath, nodeTags, seenKnowledge) {
1306
1307
  }
1307
1308
  return result;
1308
1309
  }
1309
- function collectParticipatingFlows(graph, nodePath) {
1310
- return graph.flows.filter((f) => f.nodes.includes(nodePath));
1310
+ function collectParticipatingFlows(graph, node) {
1311
+ const paths = /* @__PURE__ */ new Set([node.path, ...collectAncestors(node).map((a) => a.path)]);
1312
+ return graph.flows.filter((f) => f.nodes.some((n) => paths.has(n)));
1311
1313
  }
1312
1314
  function buildGlobalLayer(config) {
1313
1315
  let content = `**Project:** ${config.name}