@handsupmin/gc-tree 0.4.0 → 0.4.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/cli.js CHANGED
@@ -11,6 +11,7 @@ import { scaffoldHostIntegration } from './scaffold.js';
11
11
  import { requirePreferredProvider, writeSettings, readSettings } from './settings.js';
12
12
  import { checkoutBranch, initHome, listBranches, readHead, resetBranchContext, statusForBranch, ensureBranchExists, isBranchContextEmpty } from './store.js';
13
13
  import { updateBranchContext } from './update.js';
14
+ import { verifyOnboarding } from './verify-onboarding.js';
14
15
  function readArg(flag) {
15
16
  const index = process.argv.indexOf(flag);
16
17
  return index === -1 ? undefined : process.argv[index + 1];
@@ -28,6 +29,7 @@ function usage() {
28
29
  gctree set-repo-scope --branch NAME [--repo NAME] [--cwd DIR] (--include|--exclude) [--home DIR]
29
30
  gctree status [--home DIR] [--cwd DIR]
30
31
  gctree onboard [--home DIR] [--branch NAME] [--provider <codex|claude-code>] [--target DIR] [--no-launch]
32
+ gctree verify-onboarding [--home DIR] [--branch NAME]
31
33
  gctree reset-gc-branch [--home DIR] [--branch NAME] --yes
32
34
  gctree resolve --query TEXT [--home DIR] [--branch NAME] [--cwd DIR]
33
35
  gctree show-doc --id ID [--home DIR] [--branch NAME]
@@ -246,6 +248,12 @@ async function main() {
246
248
  console.log(JSON.stringify({ mode: 'guided_onboarding', gc_branch: gcBranch, preferred_provider: provider, scaffold, launch }, null, 2));
247
249
  return;
248
250
  }
251
+ case 'verify-onboarding': {
252
+ const gcBranch = readArg('--branch') || (await readHead(home)) || DEFAULT_BRANCH;
253
+ const result = await verifyOnboarding({ home, branch: gcBranch });
254
+ console.log(JSON.stringify(result, null, 2));
255
+ return;
256
+ }
249
257
  case '__apply-onboarding': {
250
258
  const inputPath = readArg('--input');
251
259
  if (!inputPath)
@@ -7,20 +7,19 @@ export function onboardingProtocolLines() {
7
7
  'Do **not** start with a repo scan, a company guess, or a broad hypothesis built from directories like `~/sources`.',
8
8
  'Do **not** ask for a full information dump up front.',
9
9
  'If docs, reference material, or reference paths are provided, read those first, summarize your understanding back, ask whether that summary is correct before continuing, and skip any questions the docs already answered well.',
10
- 'If no docs are available, continue from the user\'s own description first and ask for the most relevant repo, path, or file only when needed.',
11
- 'Only inspect docs, repos, directories, or files after the user has pointed you at them or confirmed they matter.',
12
- 'When you inspect, dig only through the user-provided material and the minimum related files needed for the next question.',
10
+ 'If no docs are available, continue from the user\'s own description first, then after the user\'s first answer, proactively inspect related repos, docs, paths, and workflows that appear materially connected.',
11
+ 'Use bounded local inspection to confirm or challenge the user\'s description instead of waiting for the user to enumerate every related repo manually.',
13
12
  'Do **not** scan broad directories or inspect every source file; prefer docs, READMEs, summaries, and a few pointed paths first.',
14
13
  'Then ask whether anything important is still missing or worth adding before you continue into deeper discovery.',
15
- 'When you do present a hypothesis, offer structured numbered confirmations such as: 1. This is basically correct. 2. Part of it is wrong. I will explain what differs. 3. This is the wrong frame. I will explain what you should inspect or how this gc-branch should be approached.',
16
- 'If the user picks 2 or 3, ask only for the delta, correction, or better pointer instead of restarting from scratch.',
14
+ 'When you do present a hypothesis, offer only these structured numbered confirmations: 1. This is mostly correct. 2. Some parts are wrong. Please explain what differs. 3. Most of this is wrong. Please explain the right frame.',
15
+ 'If the user picks 2 or 3, ask only for the delta, correction, or right frame instead of restarting from scratch.',
17
16
  'Do **not** start by asking what one repository does.',
18
17
  'Only ask the user who they are, what kind of person they are in the organization, and what work they usually own or lead after the provided docs or description still leave real gaps.',
19
18
  'Ask next for one core recurring work type only when the provided docs or description still do not make the work types clear, then ask whether there are more work types to capture.',
20
19
  'For each work type, ask how that work shows up day to day.',
21
20
  'Only after the work types are clear should you ask which repositories are involved in each work type.',
22
21
  'For each repository, ask what role it plays in the work, what directories or files matter most, what the actual workflow is, and what hidden conventions, glossary terms, or boundaries matter.',
23
- 'If a relevant repo, path, or doc is available locally and the user has pointed you to it, inspect it and present a lightweight hypothesis before asking what is correct or wrong about that frame.',
22
+ 'After the user\'s first answer, proactively inspect relevant local repos, docs, paths, and workflows whenever the connection is strong enough to test your current frame.',
24
23
  'Ask whether there are additional repositories for the current work type before moving on.',
25
24
  'After repository coverage, ask for company/domain glossary terms and acronyms that should become durable context.',
26
25
  'Then ask which verification commands should be treated as defaults for this kind of work.',
@@ -29,10 +28,13 @@ export function onboardingProtocolLines() {
29
28
  }
30
29
  export function onboardingCompletionLines() {
31
30
  return [
31
+ 'Before you claim onboarding is complete, run `gctree verify-onboarding --branch <current-gc-branch>` and inspect the real gc-tree files.',
32
+ 'Do not claim onboarding is complete unless verification returns `status: "complete"`.',
32
33
  'After applying the onboarding docs, explicitly list which durable docs were saved.',
33
34
  'Then summarize what you now understand from the saved docs instead of stopping at the filenames alone.',
34
35
  'Ask whether that final summary matches the user\'s reality, and capture any corrections before you wrap up.',
35
36
  'Ask whether anything else should be saved while the context is still fresh.',
36
- 'End with remaining risks, blind spots, or details that still need confirmation, then remind the user that future changes belong in `gctree update-global-context`.',
37
+ 'Do not finish onboarding while material related repos, workflows, or domain terms remain uninspected when recoverable local evidence is still available.',
38
+ 'Only after the related repos, workflows, glossary, and default verification commands are either captured or explicitly unavailable should you wrap up, then remind the user that future changes belong in `gctree update-global-context`.',
37
39
  ];
38
40
  }
@@ -0,0 +1,24 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { parseIndexEntries } from './markdown.js';
3
+ import { branchIndexPath, DEFAULT_BRANCH } from './paths.js';
4
+ import { ensureBranchExists, statusForBranch } from './store.js';
5
+ export async function verifyOnboarding({ home, branch, }) {
6
+ const gcBranch = branch || DEFAULT_BRANCH;
7
+ await ensureBranchExists(home, gcBranch);
8
+ const status = await statusForBranch(home, gcBranch);
9
+ const indexRaw = await readFile(branchIndexPath(home, gcBranch), 'utf8');
10
+ const docs = parseIndexEntries(indexRaw);
11
+ const indexedDocCount = docs.length;
12
+ const complete = status.doc_count > 0 && indexedDocCount > 0;
13
+ return {
14
+ status: complete ? 'complete' : 'incomplete',
15
+ gc_branch: gcBranch,
16
+ doc_count: status.doc_count,
17
+ indexed_doc_count: indexedDocCount,
18
+ docs,
19
+ warnings: status.warnings,
20
+ message: complete
21
+ ? `Onboarding is complete for gc-branch "${gcBranch}".`
22
+ : `Onboarding is incomplete for gc-branch "${gcBranch}". Docs or index entries are missing.`,
23
+ };
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@handsupmin/gc-tree",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
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,
@@ -17,16 +17,15 @@ Use this when a user wants to create global context for a product, company, or w
17
17
  - do not ask for a full information dump up front
18
18
  - if docs, reference material, or reference paths are provided, read them first and summarize your understanding back before asking for more
19
19
  - ask whether that summary is correct before continuing, let the user correct it, and skip questions the docs already answered well
20
- - if no docs are available, continue from the user's own description first and ask for the most relevant repo, path, or file only when needed
21
- - only inspect docs, repos, directories, or files after the user has pointed you at them or confirmed they matter
22
- - dig only through the user-provided material and the minimum related files needed for the next question
20
+ - if no docs are available, continue from the user's own description first, then after the user's first answer, proactively inspect related repos, docs, paths, and workflows that appear materially connected
21
+ - use bounded local inspection to confirm or challenge the user's description instead of waiting for them to enumerate every related repo manually
23
22
  - do not inspect every source file; prefer docs, READMEs, summaries, and a few pointed paths first
24
23
  - when you do present a hypothesis, keep it lightweight and only after the user has narrowed the scope
25
- - use structured numbered confirmations like:
26
- 1. This is basically correct.
27
- 2. Part of it is wrong. I will explain what differs.
28
- 3. This is the wrong frame. I will explain what you should inspect or how this gc-branch should be approached.
29
- - if the user picks 2 or 3, ask only for the delta or better pointer instead of restarting from scratch
24
+ - offer only these structured numbered confirmations:
25
+ 1. This is mostly correct.
26
+ 2. Some parts are wrong. Please explain what differs.
27
+ 3. Most of this is wrong. Please explain the right frame.
28
+ - if the user picks 2 or 3, ask only for the delta or right frame instead of restarting from scratch
30
29
  - ask whether anything important is still missing before continuing deeper
31
30
  - do not start by asking what one repo does
32
31
  - ask who the person is and what work they usually own only after the provided docs or description still leave real gaps
@@ -42,15 +41,14 @@ Use this when a user wants to create global context for a product, company, or w
42
41
  3. Wait for the user's first answer. Start by asking them to paste or share organized docs or reference material if they have any; otherwise ask what kind of work they mainly do.
43
42
  4. Do not scan broad directories like `~/sources`, guess the company/product from unrelated repos, or inspect every source file before the user narrows the scope.
44
43
  5. If docs, reference material, or reference paths are provided, read those first, summarize your understanding back, ask whether that summary is correct, and ask whether anything important is still missing before moving on.
45
- 6. If no docs are available, continue from the user's own description first and ask for the most relevant repo, path, or file only when needed.
46
- 7. Only inspect docs, repos, directories, or files after the user has pointed you at them or confirmed they matter.
47
- 8. When you inspect, dig only through the user-provided material and the minimum related files needed for the next question. Prefer docs, READMEs, summaries, and a few pointed paths first.
48
- 9. Once the scope is narrow enough, present a lightweight hypothesis from the evidence you inspected, then ask the user to choose one:
49
- 1. This is basically correct.
50
- 2. Part of it is wrong. I will explain what differs.
51
- 3. This is the wrong frame. I will explain what you should inspect or how this gc-branch should be approached.
52
- 10. If the user picks 2 or 3, ask only for the delta or the next best pointer to inspect instead of requesting a full rewrite of the context.
53
- 11. When the inspected evidence already covers the basics well, confirm that and skip ahead to the missing parts instead of re-asking everything from scratch.
44
+ 6. If no docs are available, continue from the user's own description first, then after the user's first answer, proactively inspect related repos, docs, paths, and workflows that appear materially connected.
45
+ 7. Use bounded local inspection to confirm or challenge the user's description instead of waiting for them to enumerate every relevant repo manually. Prefer docs, READMEs, summaries, and a few pointed paths first.
46
+ 8. Once the scope is narrow enough, present a lightweight hypothesis from the evidence you inspected, then ask the user to choose one:
47
+ 1. This is mostly correct.
48
+ 2. Some parts are wrong. Please explain what differs.
49
+ 3. Most of this is wrong. Please explain the right frame.
50
+ 9. If the user picks 2 or 3, ask only for the delta or right frame instead of requesting a full rewrite of the context, then continue inspecting.
51
+ 10. When the inspected evidence already covers the basics well, confirm that and skip ahead to the missing parts instead of re-asking everything from scratch.
54
52
  12. Start from the person only when the provided docs or description still do not make that clear:
55
53
  - who they are
56
54
  - what kind of work they usually own or lead
@@ -62,13 +60,16 @@ Use this when a user wants to create global context for a product, company, or w
62
60
  - which paths matter most
63
61
  - what the actual workflow is
64
62
  - what hidden conventions, glossary terms, boundaries, or constraints matter
65
- 17. If a relevant repo, path, or doc is available locally and the user has pointed you to it, inspect it and show a lightweight hypothesis so the user can correct your frame.
63
+ 17. After the user's first answer, proactively inspect relevant local repos, docs, paths, and workflows whenever the connection is strong enough to test your current frame.
66
64
  18. Ask for company/domain glossary terms and acronyms that should become durable context.
67
65
  19. Ask which verification commands should be treated as defaults for this gc-branch.
68
66
  20. Launch the guided onboarding flow with `gctree onboard [--branch <name>]`.
69
- 21. After the onboarding docs are written, explicitly list which durable docs were saved.
70
- 22. Summarize what you now understand from the saved docs instead of ending at the filenames alone.
71
- 23. Ask whether that final summary matches the user's reality, and capture any corrections before you wrap up.
72
- 24. Ask whether anything else should be saved while the context is still fresh.
73
- 25. End with remaining risks, blind spots, or details that still need confirmation, and remind the user that future changes belong in `gctree update-global-context`.
74
- 26. Keep the current gc-branch explicit while gathering context.
67
+ 21. Before you claim onboarding is complete, run `gctree verify-onboarding --branch <current-gc-branch>` and inspect the real gc-tree files.
68
+ 22. Do not claim onboarding is complete unless verification returns `status: "complete"`.
69
+ 23. After the onboarding docs are written, explicitly list which durable docs were saved.
70
+ 24. Summarize what you now understand from the saved docs instead of ending at the filenames alone.
71
+ 25. Ask whether that final summary matches the user's reality, and capture any corrections before you wrap up.
72
+ 26. Ask whether anything else should be saved while the context is still fresh.
73
+ 27. Do not finish onboarding while material related repos, workflows, or domain terms remain uninspected when recoverable local evidence is still available.
74
+ 28. Only after the related repos, workflows, glossary, and default verification commands are either captured or explicitly unavailable should you wrap up, then remind the user that future changes belong in `gctree update-global-context`.
75
+ 29. Keep the current gc-branch explicit while gathering context.