@handsupmin/gc-tree 0.7.2 → 0.7.4

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.
@@ -40,7 +40,9 @@ export function onboardingProtocolLines() {
40
40
  export function onboardingCompletionLines() {
41
41
  return [
42
42
  'Before you claim onboarding is complete, run `gctree verify-onboarding --branch <current-gc-branch>` and inspect the real gc-tree files.',
43
- 'Do not claim onboarding is complete unless verification returns `status: "complete"`.',
43
+ 'Do not claim onboarding is complete unless verification returns `status: "complete"` **and** `quality_issues` is an empty array.',
44
+ 'If `quality_issues` is non-empty, do **not** tell the user onboarding is done. Self-heal immediately without asking the user: (a) identify which docs have `category: "general"`, (b) assign each a correct category from `role | repos | domain | workflows | conventions | infra | verification` based on content, (c) rebuild the full onboarding JSON with every doc having an explicit `category` field set to one of those values, (d) run `gctree __apply-onboarding --input <temp-file>` again, (e) rerun `gctree verify-onboarding` and repeat until `quality_issues` is empty. Never use `"general"` as a category in the JSON — it is a fallback for missing data, not a valid category.',
45
+ 'If verification returns `status: "incomplete"` for reasons other than quality_issues, do not tell the user onboarding is done; inspect the reported failures, heal what can be healed automatically, rerun verification, and repeat until it passes or a real blocker remains.',
44
46
  'After applying the onboarding docs, explicitly list which durable docs were saved.',
45
47
  'Then summarize what you now understand from the saved docs instead of stopping at the filenames alone.',
46
48
  '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.',
@@ -49,6 +51,7 @@ export function onboardingCompletionLines() {
49
51
  '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
52
  '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.',
51
53
  'Do not finish onboarding while material related repos, workflows, or domain terms remain uninspected when recoverable local evidence is still available.',
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`.',
54
+ 'Only after the related repos, workflows, glossary, default verification commands, repo-scope mapping, and verification gate are all complete should you wrap up.',
55
+ 'When you do wrap up, explicitly tell the user three things in plain language: onboarding is finished; future durable changes can be made with `gctree update-global-context`, or directly through the provider command surface as Codex `$gc-update-global-context {prompt}` and Claude Code `/gc-update-global-context {prompt}`; and they can close this session and start fresh in a new one.',
53
56
  ];
54
57
  }
@@ -2,6 +2,7 @@ import { readFile } from 'node:fs/promises';
2
2
  import { parseIndexEntries } from './markdown.js';
3
3
  import { branchIndexPath, DEFAULT_BRANCH } from './paths.js';
4
4
  import { ensureBranchExists, statusForBranch } from './store.js';
5
+ const VALID_CATEGORIES = new Set(['role', 'repos', 'domain', 'workflows', 'conventions', 'infra', 'verification']);
5
6
  export async function verifyOnboarding({ home, branch, }) {
6
7
  const gcBranch = branch || DEFAULT_BRANCH;
7
8
  await ensureBranchExists(home, gcBranch);
@@ -9,7 +10,23 @@ export async function verifyOnboarding({ home, branch, }) {
9
10
  const indexRaw = await readFile(branchIndexPath(home, gcBranch), 'utf8');
10
11
  const docs = parseIndexEntries(indexRaw);
11
12
  const indexedDocCount = docs.length;
12
- const complete = status.doc_count > 0 && indexedDocCount > 0;
13
+ const hasDocs = status.doc_count > 0 && indexedDocCount > 0;
14
+ const qualityIssues = [];
15
+ if (hasDocs && indexedDocCount >= 3) {
16
+ const categoryCounts = new Map();
17
+ for (const doc of docs) {
18
+ categoryCounts.set(doc.category, (categoryCounts.get(doc.category) ?? 0) + 1);
19
+ }
20
+ const generalCount = categoryCounts.get('general') ?? 0;
21
+ if (generalCount === indexedDocCount) {
22
+ qualityIssues.push(`All ${indexedDocCount} docs have category "general". Valid categories are: ${[...VALID_CATEGORIES].join(', ')}. Re-apply onboarding with correct category fields in the JSON.`);
23
+ }
24
+ else if (generalCount > 0) {
25
+ const generalDocLabels = docs.filter((d) => d.category === 'general').map((d) => d.label);
26
+ qualityIssues.push(`${generalCount} doc(s) still have category "general": ${generalDocLabels.join(', ')}. Move them to one of: ${[...VALID_CATEGORIES].join(', ')}.`);
27
+ }
28
+ }
29
+ const complete = hasDocs && qualityIssues.length === 0;
13
30
  return {
14
31
  status: complete ? 'complete' : 'incomplete',
15
32
  gc_branch: gcBranch,
@@ -17,8 +34,11 @@ export async function verifyOnboarding({ home, branch, }) {
17
34
  indexed_doc_count: indexedDocCount,
18
35
  docs,
19
36
  warnings: status.warnings,
37
+ quality_issues: qualityIssues,
20
38
  message: complete
21
39
  ? `Onboarding is complete for gc-branch "${gcBranch}".`
22
- : `Onboarding is incomplete for gc-branch "${gcBranch}". Docs or index entries are missing.`,
40
+ : hasDocs
41
+ ? `Onboarding has quality issues for gc-branch "${gcBranch}". Fix quality_issues before finishing.`
42
+ : `Onboarding is incomplete for gc-branch "${gcBranch}". Docs or index entries are missing.`,
23
43
  };
24
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@handsupmin/gc-tree",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Global Context Tree, a lightweight branch-aware global context orchestrator for AI coding tools",
5
5
  "type": "module",
6
6
  "private": false,
@@ -43,6 +43,7 @@ Use this when a user wants to create global context for a product, company, or w
43
43
  - generate index entries automatically from primary concept names, aliases, repository nicknames, and workflow labels when those are clear
44
44
  - split glossary docs when a concept is likely to be searched directly, needs more than a short definition, or carries workflow/constraint details; keep only low-value leftover terms in a shared glossary
45
45
  - keep `index.md` as a human-readable dictionary-style TOC grouped by category headings and `label -> path` entries
46
+ - every doc in the JSON **must** have an explicit `category` field set to one of: `role`, `repos`, `domain`, `workflows`, `conventions`, `infra`, `verification` — never use `"general"` as a category; it is a fallback for missing data, not a valid category choice
46
47
  - use onboarding only for an empty gc-branch
47
48
 
48
49
  ## Procedure
@@ -80,20 +81,22 @@ Use this when a user wants to create global context for a product, company, or w
80
81
  25. Render `index.md` as a category-grouped dictionary-style table of contents with `label -> path` entries.
81
82
  26. Launch the guided onboarding flow with `gctree onboard [--branch <name>]`.
82
83
  27. Before you claim onboarding is complete, run `gctree verify-onboarding --branch <current-gc-branch>` and inspect the real gc-tree files.
83
- 28. Do not claim onboarding is complete unless verification returns `status: "complete"`.
84
- 29. After the onboarding docs are written, explicitly list which durable docs were saved.
85
- 30. Summarize what you now understand from the saved docs instead of ending at the filenames alone.
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:
84
+ 28. Do not claim onboarding is complete unless verification returns `status: "complete"` **and** `quality_issues` is an empty array.
85
+ 29. If `quality_issues` is non-empty, do **not** tell the user onboarding is done. Self-heal immediately without prompting the user: (a) identify which docs have `category: "general"`, (b) assign each a correct category from `role | repos | domain | workflows | conventions | infra | verification` based on content, (c) rebuild the full onboarding JSON with every doc having an explicit `category` field — never use `"general"` as a category, (d) rerun `gctree __apply-onboarding --input <temp-file>`, (e) rerun `gctree verify-onboarding`, repeat until `quality_issues` is empty. If `status` is `"incomplete"` for other reasons, inspect the failures, heal them autonomously, and repeat.
86
+ 30. After the onboarding docs are written, explicitly list which durable docs were saved.
87
+ 31. Summarize what you now understand from the saved docs instead of ending at the filenames alone.
88
+ 32. 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
89
  - 1. This matches well enough.
88
90
  - 2. Some parts are wrong. I will give the delta.
89
91
  - 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:
92
+ 33. 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.
93
+ 34. Ask whether anything else should be saved while the context is still fresh.
94
+ 35. 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
95
  - 1. Map these candidates.
94
96
  - 2. Map these, but with corrections.
95
97
  - 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.
98
+ 36. 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.
99
+ 37. Do not finish onboarding while material related repos, workflows, or domain terms remain uninspected when recoverable local evidence is still available.
100
+ 38. Only after the related repos, workflows, glossary, default verification commands, repo-scope mapping, and verification gate are all complete should you wrap up.
101
+ 39. When you wrap up, explicitly tell the user three things in plain language: onboarding is finished; future durable changes can be made with `gctree update-global-context`, or directly through the provider command surface as Codex `$gc-update-global-context {prompt}` and Claude Code `/gc-update-global-context {prompt}`; and they can close this session and start fresh in a new one.
102
+ 40. Keep the current gc-branch explicit while gathering context.