@handsupmin/gc-tree 0.7.3 → 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,8 +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"`.',
44
- 'If verification returns anything other than `status: "complete"`, 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.',
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.',
45
46
  'After applying the onboarding docs, explicitly list which durable docs were saved.',
46
47
  'Then summarize what you now understand from the saved docs instead of stopping at the filenames alone.',
47
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.',
@@ -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.3",
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,8 +81,8 @@ 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. If verification returns anything other than `status: "complete"`, 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.
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.
85
86
  30. After the onboarding docs are written, explicitly list which durable docs were saved.
86
87
  31. Summarize what you now understand from the saved docs instead of ending at the filenames alone.
87
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: