@handsupmin/gc-tree 0.6.0 → 0.6.1

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.
@@ -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} -> ${doc.path}`);
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
- return String(indexContent || '')
111
- .split(/\r?\n/)
112
- .map((line) => line.trim())
113
- .flatMap((line) => {
114
- if (!line)
115
- return [];
116
- const heading = line.match(/^##\s+(.+)$/);
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
- return [];
123
+ pendingLabel = null;
124
+ continue;
120
125
  }
121
- if (!/^-\s+.+\s+->\s+.+$/.test(line) || line.startsWith('- gc-branch:') || line.startsWith('- summary:')) {
122
- return [];
126
+ if (trimmed.startsWith('- gc-branch:') || trimmed.startsWith('- summary:') || trimmed === '- No source docs yet.') {
127
+ pendingLabel = null;
128
+ continue;
123
129
  }
124
- const body = line.slice(2);
125
- const [label, path] = body.split('->').map((part) => part.trim());
126
- const category = deriveCategoryFromPath(path) || currentCategory;
127
- return [{ id: docIdFromPath(path), title: label, label, category, path }];
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## |$)/);
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, INDEX_WARNING_CHARS, } from './paths.js';
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@handsupmin/gc-tree",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
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,