@chrisdudek/yg 2.10.0 → 2.12.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 +36 -2
- package/dist/bin.js.map +1 -1
- package/dist/templates/rules.ts +33 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -59,11 +59,16 @@ var PROTOCOL = `## PROTOCOL
|
|
|
59
59
|
This is your operating manual for working in a Yggdrasil-managed repository.
|
|
60
60
|
|
|
61
61
|
<critical_protocol>
|
|
62
|
+
BEFORE starting any task \u2014 brainstorming, design, planning, OR implementation:
|
|
63
|
+
\`yg select --task "<goal>"\` \u2192 \`yg build-context\` on each result \u2192 read ALL artifact files
|
|
64
|
+
This is how you learn WHAT the system already knows before proposing anything.
|
|
65
|
+
|
|
62
66
|
BEFORE reading, analyzing, or modifying ANY source file:
|
|
63
67
|
\`yg build-context --file <path>\`
|
|
64
68
|
One command. No exceptions. No "I'll do it later." No "this is just analysis."
|
|
65
69
|
|
|
66
|
-
|
|
70
|
+
Both triggers apply regardless of what instructed the task \u2014 skills, plans, workflows, user requests.
|
|
71
|
+
The graph captures intent and relations that source files cannot \u2014 without it, you will make wrong decisions and the user will have to re-explain what the graph already knows.
|
|
67
72
|
</critical_protocol>
|
|
68
73
|
|
|
69
74
|
Every rule below is mandatory \u2014 no skill, plan, workflow, or instruction overrides these requirements.
|
|
@@ -76,6 +81,10 @@ Yggdrasil is persistent semantic memory stored in \`.yggdrasil/\`. It maps the r
|
|
|
76
81
|
\`\`\`
|
|
77
82
|
EVERY conversation: yg preflight \u2014 no exceptions.
|
|
78
83
|
|
|
84
|
+
BEFORE any task (brainstorming, design, planning, implementation):
|
|
85
|
+
yg select --task "<goal>" \u2192 yg build-context on results \u2192 read ALL artifacts
|
|
86
|
+
The graph is your primary knowledge source. Raw file reads supplement it, never replace it.
|
|
87
|
+
|
|
79
88
|
BEFORE any source file interaction:
|
|
80
89
|
1. yg build-context --file <path>
|
|
81
90
|
One command: resolves owner, assembles context.
|
|
@@ -209,6 +218,29 @@ Result: graph mirrors code but misses WHY. Next agent reads graph, understands H
|
|
|
209
218
|
|
|
210
219
|
</example_wrong>
|
|
211
220
|
|
|
221
|
+
<example_correct>
|
|
222
|
+
|
|
223
|
+
User: "Let's design a soft delete feature for blog posts"
|
|
224
|
+
|
|
225
|
+
1. yg select --task "blog soft delete" \u2192 find relevant nodes
|
|
226
|
+
2. yg build-context on each result \u2192 read ALL artifacts (aspects, flows, conventions)
|
|
227
|
+
3. Now read source files WITH graph context
|
|
228
|
+
4. Propose design informed by admin-ux-rules, existing flows, database conventions
|
|
229
|
+
|
|
230
|
+
</example_correct>
|
|
231
|
+
|
|
232
|
+
<example_wrong>
|
|
233
|
+
|
|
234
|
+
User: "Let's design a soft delete feature for blog posts"
|
|
235
|
+
|
|
236
|
+
1. Read BlogEditor.tsx to understand current behavior \u2190 WRONG: no graph context
|
|
237
|
+
2. Read database schema \u2190 WRONG: graph has conventions, aspects, flows
|
|
238
|
+
3. Propose design based on raw code \u2190 WRONG: missed admin-ux-rules aspect, existing flows
|
|
239
|
+
|
|
240
|
+
Result: design misses cross-cutting requirements the graph already captured.
|
|
241
|
+
|
|
242
|
+
</example_wrong>
|
|
243
|
+
|
|
212
244
|
### Conversation Lifecycle
|
|
213
245
|
|
|
214
246
|
\`\`\`
|
|
@@ -3955,6 +3987,7 @@ async function detectDrift(graph, filterNodePath) {
|
|
|
3955
3987
|
const entries = [];
|
|
3956
3988
|
for (const [nodePath, node] of graph.nodes) {
|
|
3957
3989
|
if (filterNodePath && nodePath !== filterNodePath && !nodePath.startsWith(filterNodePath + "/")) continue;
|
|
3990
|
+
if (node.meta.blackbox) continue;
|
|
3958
3991
|
const mapping = node.meta.mapping;
|
|
3959
3992
|
if (!mapping) continue;
|
|
3960
3993
|
const mappingPaths = normalizeMappingPaths(mapping);
|
|
@@ -4053,6 +4086,7 @@ async function syncDriftState(graph, nodePath) {
|
|
|
4053
4086
|
const node = graph.nodes.get(nodePath);
|
|
4054
4087
|
if (!node) throw new Error(`Node not found: ${nodePath}`);
|
|
4055
4088
|
if (!node.meta.mapping) throw new Error(`Node has no mapping: ${nodePath}`);
|
|
4089
|
+
if (node.meta.blackbox) throw new Error(`Cannot sync blackbox node: ${nodePath}`);
|
|
4056
4090
|
const trackedFiles = collectTrackedFiles(node, graph);
|
|
4057
4091
|
const excludePrefixes = getChildMappingExclusions(graph, nodePath);
|
|
4058
4092
|
const existingEntry = await readNodeDriftState(graph.rootPath, nodePath);
|
|
@@ -4238,7 +4272,7 @@ function registerDriftSyncCommand(program2) {
|
|
|
4238
4272
|
const graph = await loadGraph(process.cwd());
|
|
4239
4273
|
let nodesToSync;
|
|
4240
4274
|
if (options.all) {
|
|
4241
|
-
nodesToSync = [...graph.nodes.entries()].filter(([, n]) => normalizeMappingPaths(n.meta.mapping).length > 0).map(([p]) => p).sort();
|
|
4275
|
+
nodesToSync = [...graph.nodes.entries()].filter(([, n]) => !n.meta.blackbox && normalizeMappingPaths(n.meta.mapping).length > 0).map(([p]) => p).sort();
|
|
4242
4276
|
} else {
|
|
4243
4277
|
const nodePath = options.node.trim().replace(/^\.\//, "").replace(/\/+$/, "");
|
|
4244
4278
|
if (!graph.nodes.has(nodePath)) {
|