@handsupmin/gc-tree 0.6.0 → 0.6.2
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/src/markdown.js +36 -16
- package/dist/src/onboarding-protocol.js +4 -2
- package/dist/src/paths.js +0 -1
- package/dist/src/store.js +1 -4
- package/package.json +1 -1
- package/skills/onboard/SKILL.md +14 -6
package/dist/src/markdown.js
CHANGED
|
@@ -70,7 +70,8 @@ export function renderIndexMarkdown(input) {
|
|
|
70
70
|
for (const category of categories) {
|
|
71
71
|
lines.push(`## ${displayCategory(category)}`, '');
|
|
72
72
|
for (const doc of grouped.get(category).sort((a, b) => (a.label || a.title).localeCompare(b.label || b.title))) {
|
|
73
|
-
lines.push(`- ${doc.label || doc.title}
|
|
73
|
+
lines.push(`- ${doc.label || doc.title}`);
|
|
74
|
+
lines.push(` - ${doc.path}`);
|
|
74
75
|
}
|
|
75
76
|
lines.push('');
|
|
76
77
|
}
|
|
@@ -107,25 +108,44 @@ export function displayCategory(category) {
|
|
|
107
108
|
}
|
|
108
109
|
export function parseIndexEntries(indexContent) {
|
|
109
110
|
let currentCategory = 'general';
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
let pendingLabel = null;
|
|
112
|
+
const entries = [];
|
|
113
|
+
for (const rawLine of String(indexContent || '').split(/\r?\n/)) {
|
|
114
|
+
const line = rawLine.trimEnd();
|
|
115
|
+
const trimmed = line.trim();
|
|
116
|
+
if (!trimmed) {
|
|
117
|
+
pendingLabel = null;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const heading = trimmed.match(/^##\s+(.+)$/);
|
|
117
121
|
if (heading) {
|
|
118
122
|
currentCategory = normalizeCategory(heading[1] || 'general');
|
|
119
|
-
|
|
123
|
+
pendingLabel = null;
|
|
124
|
+
continue;
|
|
120
125
|
}
|
|
121
|
-
if (
|
|
122
|
-
|
|
126
|
+
if (trimmed.startsWith('- gc-branch:') || trimmed.startsWith('- summary:') || trimmed === '- No source docs yet.') {
|
|
127
|
+
pendingLabel = null;
|
|
128
|
+
continue;
|
|
123
129
|
}
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
const pathMatch = rawLine.match(/^\s{2,}-\s+(docs\/.+)$/);
|
|
131
|
+
if (pathMatch && pendingLabel) {
|
|
132
|
+
const path = pathMatch[1].trim();
|
|
133
|
+
const category = deriveCategoryFromPath(path) || currentCategory;
|
|
134
|
+
entries.push({
|
|
135
|
+
id: docIdFromPath(path),
|
|
136
|
+
title: pendingLabel,
|
|
137
|
+
label: pendingLabel,
|
|
138
|
+
category,
|
|
139
|
+
path,
|
|
140
|
+
});
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
const labelMatch = trimmed.match(/^-\s+(.+)$/);
|
|
144
|
+
if (labelMatch) {
|
|
145
|
+
pendingLabel = labelMatch[1].trim();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return entries;
|
|
129
149
|
}
|
|
130
150
|
export function extractIndexEntries(markdown) {
|
|
131
151
|
const match = String(markdown || '').match(/## Index Entries\s+([\s\S]*?)(?:\n## |$)/);
|
|
@@ -43,9 +43,11 @@ export function onboardingCompletionLines() {
|
|
|
43
43
|
'Do not claim onboarding is complete unless verification returns `status: "complete"`.',
|
|
44
44
|
'After applying the onboarding docs, explicitly list which durable docs were saved.',
|
|
45
45
|
'Then summarize what you now understand from the saved docs instead of stopping at the filenames alone.',
|
|
46
|
-
'
|
|
46
|
+
'For that final summary, do not ask an open-ended validation question first; present the summary and ask the user to choose only one structured confirmation: 1. This matches well enough. 2. Some parts are wrong. I will give the delta. 3. The frame is wrong. I will restate it.',
|
|
47
|
+
'If the user picks 2 or 3 for the final summary, ask only for the correction delta or replacement frame, then update the saved understanding instead of restarting the interview.',
|
|
47
48
|
'Ask whether anything else should be saved while the context is still fresh.',
|
|
48
|
-
'After docs are confirmed correct, ask
|
|
49
|
+
'After docs are confirmed correct, do not ask the user to recall repo-scope mappings from scratch; propose the concrete repository candidates that appear materially tied to this gc-branch, then ask the user to choose only one structured confirmation: 1. Map these candidates. 2. Map these, but with corrections. 3. Skip repo mapping for now.',
|
|
50
|
+
'If the user picks 2 for repo mapping, ask only for the repo delta to add or remove. If the user picks 1 or gives corrected candidates, navigate to each confirmed repository and run `gctree set-repo-scope --branch <current-gc-branch> --include`. Skip mapping only if the user picks 3 or explicitly says mapping is not needed.',
|
|
49
51
|
'Do not finish onboarding while material related repos, workflows, or domain terms remain uninspected when recoverable local evidence is still available.',
|
|
50
52
|
'Only after the related repos, workflows, glossary, default verification commands, and repo-scope mapping are either captured or explicitly skipped should you wrap up, then remind the user that future changes belong in `gctree update-global-context`.',
|
|
51
53
|
];
|
package/dist/src/paths.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { homedir } from 'node:os';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
export const DEFAULT_BRANCH = 'main';
|
|
4
|
-
export const INDEX_WARNING_CHARS = 2000;
|
|
5
4
|
export function resolveHome(explicitHome) {
|
|
6
5
|
return explicitHome || process.env.GCTREE_HOME || join(homedir(), '.gctree');
|
|
7
6
|
}
|
package/dist/src/store.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cp, mkdir, readFile, readdir, rm, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
import { branchDir, branchDocsDir, branchIndexPath, branchMetaPath, branchesRoot, DEFAULT_BRANCH, headPath,
|
|
4
|
+
import { branchDir, branchDocsDir, branchIndexPath, branchMetaPath, branchesRoot, DEFAULT_BRANCH, headPath, } from './paths.js';
|
|
5
5
|
import { extractIndexEntries, renderIndexMarkdown } from './markdown.js';
|
|
6
6
|
async function listDocRelativePaths(dir, prefix = '') {
|
|
7
7
|
const entries = await readdir(dir, { withFileTypes: true }).catch(() => []);
|
|
@@ -150,9 +150,6 @@ export async function statusForBranch(home, branch) {
|
|
|
150
150
|
const indexRaw = await readFile(branchIndexPath(home, branch), 'utf8');
|
|
151
151
|
const docs = await listDocRelativePaths(branchDocsDir(home, branch));
|
|
152
152
|
const warnings = [];
|
|
153
|
-
if (indexRaw.length > INDEX_WARNING_CHARS) {
|
|
154
|
-
warnings.push(`index.md is ${indexRaw.length} chars; keep it closer to an index than a knowledge dump.`);
|
|
155
|
-
}
|
|
156
153
|
for (const doc of docs) {
|
|
157
154
|
const raw = await readFile(join(branchDocsDir(home, branch), doc), 'utf8');
|
|
158
155
|
if (!/^## Summary$/m.test(raw)) {
|
package/package.json
CHANGED
package/skills/onboard/SKILL.md
CHANGED
|
@@ -83,9 +83,17 @@ Use this when a user wants to create global context for a product, company, or w
|
|
|
83
83
|
28. Do not claim onboarding is complete unless verification returns `status: "complete"`.
|
|
84
84
|
29. After the onboarding docs are written, explicitly list which durable docs were saved.
|
|
85
85
|
30. Summarize what you now understand from the saved docs instead of ending at the filenames alone.
|
|
86
|
-
31.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
31. For that final summary, do not ask an open-ended validation question first. Present the summary and ask the user to choose only one:
|
|
87
|
+
- 1. This matches well enough.
|
|
88
|
+
- 2. Some parts are wrong. I will give the delta.
|
|
89
|
+
- 3. The frame is wrong. I will restate it.
|
|
90
|
+
32. If the user picks 2 or 3 for the final summary, ask only for the correction delta or replacement frame, then update the saved understanding instead of restarting the interview.
|
|
91
|
+
33. Ask whether anything else should be saved while the context is still fresh.
|
|
92
|
+
34. After docs are confirmed correct, do not ask the user to recall repo-scope mappings from scratch. Propose the concrete repository candidates that appear materially tied to this gc-branch, then ask the user to choose only one:
|
|
93
|
+
- 1. Map these candidates.
|
|
94
|
+
- 2. Map these, but with corrections.
|
|
95
|
+
- 3. Skip repo mapping for now.
|
|
96
|
+
35. If the user picks 2 for repo mapping, ask only for the repo delta to add or remove. If the user picks 1 or gives corrected candidates, navigate to each confirmed repo and run `gctree set-repo-scope --branch <gc-branch> --include`. Skip mapping only if the user picks 3 or explicitly says mapping is not needed.
|
|
97
|
+
36. Do not finish onboarding while material related repos, workflows, or domain terms remain uninspected when recoverable local evidence is still available.
|
|
98
|
+
37. Only after the related repos, workflows, glossary, default verification commands, and repo-scope mapping are either captured or explicitly skipped should you wrap up, then remind the user that future changes belong in `gctree update-global-context`.
|
|
99
|
+
38. Keep the current gc-branch explicit while gathering context.
|