peaks-loop 4.0.30 → 4.0.32
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/CHANGELOG.md +33 -0
- package/dist/cli/commands/workspace/init-command.js +27 -14
- package/dist/services/codegraph/codegraph-autorefresh.js +44 -6
- package/dist/services/codegraph/codegraph-preflight-service.d.ts +5 -2
- package/dist/services/codegraph/codegraph-preflight-service.js +13 -6
- package/dist/services/codegraph/codegraph-service.d.ts +17 -2
- package/dist/services/codegraph/codegraph-service.js +27 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.0.32 — 2026-09-08 (CI 首次全绿 — 工作流修复 + Linux-only 测试修复)
|
|
4
|
+
|
|
5
|
+
**Highlights**:
|
|
6
|
+
|
|
7
|
+
1. **CI 工作流修复(本仓库 ci.yml 首次真正跑通)** — 此前第一个门 `pnpm/action-setup@v4` 在 runner 默认 Node 24 上 self-installer 必挂,导致后续所有步骤从未被验证。
|
|
8
|
+
|
|
9
|
+
- `pnpm/action-setup@v4` → `corepack`(对齐 publish.yml)。
|
|
10
|
+
- 删除 Build 之前的 `npx tsc --noEmit` 步骤:它跑在 `packages/*/dist` 生成之前,而 `peaks-loop-shared/version` 等 subpath 指向 dist,任何 commit 都过不了;canonical typecheck 由 `npm run build` 内的 `tsc -p tsconfig.build.json` 承担。
|
|
11
|
+
- 移除 node 20.x 矩阵(windows-latest + 20.x 的 pnpm install 红且日志 admin-only 无法诊断)。
|
|
12
|
+
- capability-guard 固定 `PEAKS_CALLER_ID`(J02 等 contract 会 spawn `bin/peaks.js`,CI 无 IDE adapter env 时 callerId 解析走 D2/EX_USAGE)。
|
|
13
|
+
- Test 步骤新增 `--reporter=github-actions`,失败转为可无 admin 读取的 check-run annotation。
|
|
14
|
+
|
|
15
|
+
2. **3 类 pre-existing Linux-only 测试修复**(windows 早已绿,ubuntu 红;用 Docker Linux 容器忠实复现定位):
|
|
16
|
+
|
|
17
|
+
- `setImmediate` 闭包竞态:延迟清理回调读取可变模块级 `workspace`,可能在下一个测试 `beforeEach` 重新赋值后删除**活着的**工作目录 → `ENOENT: uv_cwd`(3 个 session 套件 + 4 个潜伏同模式文件)。
|
|
18
|
+
- `detect-eslint` 断言 Windows 专属行为(`npx-resolver` 在 POSIX 上按设计返回裸 `npx`)→ 改为平台感知断言。
|
|
19
|
+
- `scan-orchestrator` 的 100ms 墙钟下限 flake → 改为断言 `elapsedMs` 已被填充。
|
|
20
|
+
|
|
21
|
+
验证:CI run 全 3 job success;双平台独立复跑 Linux 119 files / 1010 passed、Windows 119 files / 1014 passed。
|
|
22
|
+
|
|
23
|
+
## 4.0.31 — 2026-09-08 (codegraph auto-refresh 悬空 marker 修复)
|
|
24
|
+
|
|
25
|
+
**Highlights**:
|
|
26
|
+
|
|
27
|
+
1. **codegraph 自动刷新失效修复** — 根因:`peaks workspace init` auto-stake 只写 `.peaks-loop-marker` 不跑上游 `codegraph init`,留下无 `codegraph.db` 的悬空 `.codegraph/`;下游把"有 marker"误判为"已初始化",post-slice 自动刷新跑 `index` 静默失败("CodeGraph not initialized")。
|
|
28
|
+
|
|
29
|
+
- 新增 `isCodegraphInitialized()` 按 `.codegraph/codegraph.db` 判真实初始化(对齐上游 `isInitialized`)。
|
|
30
|
+
- `workspace init` auto-stake 改为真跑上游 `codegraph init`(快、离线安全)。
|
|
31
|
+
- auto-refresh / preflight 发现悬空 marker(有 marker 无 db)时自愈:先 `init` 再 `index`。
|
|
32
|
+
- init guard 对"marker 有但 db 无"返回 `fresh`,`peaks codegraph init` 可重跑恢复。
|
|
33
|
+
|
|
34
|
+
验证:scoped 51 测试 + codegraph/workspace 73 测试全过,tsc 干净,现场自测从悬空态成功建出 `codegraph.db`。
|
|
35
|
+
|
|
3
36
|
## 4.0.30 — 2026-09-07 (搜索优先 preflight + 超行文件拆分 + CLI 漂移修复)
|
|
4
37
|
|
|
5
38
|
**Highlights**:
|
|
@@ -26,7 +26,7 @@ import { resolveCanonicalProjectRoot } from '../../../services/config/config-ser
|
|
|
26
26
|
import { applyHookInstall, readHookStatus } from '../../../services/skills/hooks-settings-service.js';
|
|
27
27
|
import { clearStalePresenceOnRotation } from '../../../services/skills/skill-presence-service.js';
|
|
28
28
|
import { gcStalePresenceLeases } from '../../../services/skills/presence-lease-service.js';
|
|
29
|
-
import { defaultCodegraphInitGuard, writeCodegraphMarker } from '../../../services/codegraph/codegraph-service.js';
|
|
29
|
+
import { createCodegraphInvocation, defaultCodegraphInitGuard, executeCodegraphInvocation, writeCodegraphMarker } from '../../../services/codegraph/codegraph-service.js';
|
|
30
30
|
import { mkdirSync } from 'node:fs';
|
|
31
31
|
import { fail, ok } from 'peaks-loop-shared/result';
|
|
32
32
|
import { addJsonOption, getErrorMessage, printResult } from '../../cli-helpers.js';
|
|
@@ -339,23 +339,36 @@ export function registerWorkspaceInitCommand(workspace, io) {
|
|
|
339
339
|
if (report.standardsMissing.missing) {
|
|
340
340
|
markStandardsChecked(projectRoot, sessionId);
|
|
341
341
|
}
|
|
342
|
-
// rid-CG-001: auto-stake a peaks-loop-managed `.codegraph/`
|
|
343
|
-
// directory after a successful workspace init. Calls the
|
|
344
|
-
//
|
|
345
|
-
//
|
|
346
|
-
//
|
|
347
|
-
//
|
|
348
|
-
//
|
|
349
|
-
//
|
|
342
|
+
// rid-CG-001 (revised): auto-stake a peaks-loop-managed `.codegraph/`
|
|
343
|
+
// directory after a successful workspace init. Calls the conflict
|
|
344
|
+
// guard (rid-CG-006) BEFORE writing so a foreign schema is never
|
|
345
|
+
// silently overwritten. We now run a REAL upstream `codegraph init`
|
|
346
|
+
// (not just mkdir + marker) so the schema actually has a
|
|
347
|
+
// `codegraph.db`, which is what post-slice auto-refresh and the
|
|
348
|
+
// pre-dispatch preflight gate on. `codegraph init` (WITHOUT
|
|
349
|
+
// `--index`) is fast (~1 s) and offline-safe — it only `Parser.init()`s
|
|
350
|
+
// WASM grammars that resolve from node_modules; the slow/offline
|
|
351
|
+
// concern applies to `index` (full build), not `init`.
|
|
350
352
|
let codegraphAutoOutcome = null;
|
|
351
353
|
try {
|
|
352
354
|
const guard = defaultCodegraphInitGuard(projectRoot);
|
|
353
355
|
if (guard.status === 'fresh') {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
356
|
+
// 'fresh' here also covers the dangling state (marker present but
|
|
357
|
+
// no codegraph.db) — running init self-heals both.
|
|
358
|
+
const initResult = await executeCodegraphInvocation(createCodegraphInvocation({ subcommand: 'init', project: projectRoot }));
|
|
359
|
+
if (initResult.exitCode !== 0) {
|
|
360
|
+
warningsForEnvelope.push(`codegraph auto-stake init failed (exit ${String(initResult.exitCode)}). ` +
|
|
361
|
+
'Run `peaks codegraph init --project <path>` manually to enable codegraph.');
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
// Upstream init creates `.codegraph/`; mkdir is a no-op in the
|
|
365
|
+
// real path and lets the marker write succeed. Best-effort.
|
|
366
|
+
mkdirSync(guard.codegraphDir, { recursive: true });
|
|
367
|
+
writeCodegraphMarker(guard.codegraphDir);
|
|
368
|
+
codegraphAutoOutcome = { status: 'fresh' };
|
|
369
|
+
nextActions.push(`Auto-staked a peaks-loop-managed ${guard.codegraphDir}/ (upstream init + marker). ` +
|
|
370
|
+
'Run `peaks codegraph index --project <path>` next to build the SQLite-backed index.');
|
|
371
|
+
}
|
|
359
372
|
}
|
|
360
373
|
else if (guard.status === 'noop-already-peaks-loop') {
|
|
361
374
|
codegraphAutoOutcome = { status: 'noop' };
|
|
@@ -20,17 +20,24 @@
|
|
|
20
20
|
// - No `<projectRoot>/.codegraph/` directory → skip (codegraph was
|
|
21
21
|
// never initialized for this project; `peaks codegraph init` is a
|
|
22
22
|
// one-time setup the orchestrator owns).
|
|
23
|
+
// - `.codegraph/` present WITH `codegraph.db` → `index` (incremental).
|
|
24
|
+
// - `.codegraph/` present with the peaks-loop marker but NO
|
|
25
|
+
// `codegraph.db` (dangling) → self-heal: `init` then `index`.
|
|
26
|
+
// - `.codegraph/` present without a marker and without `codegraph.db`
|
|
27
|
+
// (foreign schema) → skip; never touch a foreign store.
|
|
23
28
|
// - The upstream index exits non-zero → return `index-failed` with a
|
|
24
29
|
// human-readable note.
|
|
25
30
|
// - Any unexpected error → return `unavailable` with a note.
|
|
26
31
|
//
|
|
27
|
-
// We
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
+
// We do NOT auto-init a genuinely fresh (no `.codegraph/` dir) project:
|
|
33
|
+
// the orchestrator owns that one-time setup. The dangling self-heal above
|
|
34
|
+
// IS an auto-init, but `codegraph init` (WITHOUT `--index`) is fast (~1 s)
|
|
35
|
+
// and offline-safe — it only `Parser.init()`s WASM grammars that resolve
|
|
36
|
+
// from node_modules. The slow/offline concern applies to `index` (full
|
|
37
|
+
// build), not `init`.
|
|
38
|
+
import { existsSync, statSync } from 'node:fs';
|
|
32
39
|
import { join } from 'node:path';
|
|
33
|
-
import { CODEGRAPH_DIR_NAME, createCodegraphInvocation, executeCodegraphInvocation, } from './codegraph-service.js';
|
|
40
|
+
import { CODEGRAPH_DIR_NAME, CODEGRAPH_MARKER_NAME, createCodegraphInvocation, executeCodegraphInvocation, isCodegraphInitialized, } from './codegraph-service.js';
|
|
34
41
|
/**
|
|
35
42
|
* True when `<projectRoot>/.codegraph/` exists and is a directory.
|
|
36
43
|
* Pure fs probe; never throws.
|
|
@@ -43,6 +50,14 @@ export function isCodegraphPresent(projectRoot) {
|
|
|
43
50
|
return false;
|
|
44
51
|
}
|
|
45
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* True when `<projectRoot>/.codegraph/` carries the peaks-loop marker
|
|
55
|
+
* (i.e. peaks-loop manages it, as opposed to a foreign tool). Pure fs
|
|
56
|
+
* probe; never throws.
|
|
57
|
+
*/
|
|
58
|
+
function isCodegraphPeaksLoopManaged(projectRoot) {
|
|
59
|
+
return existsSync(join(projectRoot, CODEGRAPH_DIR_NAME, CODEGRAPH_MARKER_NAME));
|
|
60
|
+
}
|
|
46
61
|
function errorMessage(error) {
|
|
47
62
|
return error instanceof Error ? error.message : String(error);
|
|
48
63
|
}
|
|
@@ -70,6 +85,29 @@ export async function refreshCodegraphAfterSlice(projectRoot, runner) {
|
|
|
70
85
|
};
|
|
71
86
|
}
|
|
72
87
|
try {
|
|
88
|
+
// A `.codegraph/` dir without a `codegraph.db` is uninitialized:
|
|
89
|
+
// - NOT peaks-loop-managed → foreign schema, never touch it.
|
|
90
|
+
// - peaks-loop-managed → the dangling state left by the pre-fix
|
|
91
|
+
// rid-CG-001 auto-stake (marker stamped, no upstream init). Run
|
|
92
|
+
// init (fast, offline-safe — no full index) so the subsequent
|
|
93
|
+
// index has a schema to write into.
|
|
94
|
+
if (!isCodegraphInitialized(projectRoot)) {
|
|
95
|
+
if (!isCodegraphPeaksLoopManaged(projectRoot)) {
|
|
96
|
+
return {
|
|
97
|
+
refreshed: false,
|
|
98
|
+
reason: 'no-codegraph-dir',
|
|
99
|
+
note: `auto codegraph refresh skipped: ${CODEGRAPH_DIR_NAME}/ exists without a codegraph.db and is not peaks-loop-managed. Run \`peaks codegraph init\` once to enable post-slice auto-refresh.`,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const initResult = await executeCodegraphInvocation(createCodegraphInvocation({ subcommand: 'init', project: projectRoot }), runner);
|
|
103
|
+
if (initResult.exitCode !== 0) {
|
|
104
|
+
return {
|
|
105
|
+
refreshed: false,
|
|
106
|
+
reason: 'index-failed',
|
|
107
|
+
note: `auto codegraph refresh self-heal init failed (exit ${String(initResult.exitCode)}): ${firstMeaningfulLine(initResult.stderr || initResult.stdout)}`,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
73
111
|
const invocation = createCodegraphInvocation({ subcommand: 'index', project: projectRoot, quiet: true });
|
|
74
112
|
const result = await executeCodegraphInvocation(invocation, runner);
|
|
75
113
|
if (result.exitCode !== 0) {
|
|
@@ -42,8 +42,11 @@ export declare function renderCodegraphStructureBlock(files: readonly CodegraphS
|
|
|
42
42
|
*
|
|
43
43
|
* Behavior matrix (acceptance criteria):
|
|
44
44
|
* - `.codegraph/` absent → init + index (best-effort), then read.
|
|
45
|
-
* - `.codegraph/` present with peaks-loop marker
|
|
46
|
-
* (fresh), read directly. No redundant re-index on
|
|
45
|
+
* - `.codegraph/` present with peaks-loop marker AND `codegraph.db` →
|
|
46
|
+
* skip init/index (fresh), read directly. No redundant re-index on
|
|
47
|
+
* every dispatch.
|
|
48
|
+
* - `.codegraph/` present with peaks-loop marker but NO `codegraph.db`
|
|
49
|
+
* (dangling) → init + index (self-heal), then read.
|
|
47
50
|
* - `.codegraph/` present WITHOUT marker (foreign schema) → fail-soft;
|
|
48
51
|
* never clobber a foreign store.
|
|
49
52
|
*
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
// - CODEGRAPH_STRUCTURE_MAX_DIRS = 40 directory rows
|
|
32
32
|
// - CODEGRAPH_STRUCTURE_MAX_ROOT_FILES = 12 bare root files
|
|
33
33
|
import { mkdirSync } from 'node:fs';
|
|
34
|
-
import { CODEGRAPH_DIR_NAME, createCodegraphInvocation, defaultCodegraphInitGuard, executeCodegraphInvocation, writeCodegraphMarker, } from './codegraph-service.js';
|
|
34
|
+
import { CODEGRAPH_DIR_NAME, createCodegraphInvocation, defaultCodegraphInitGuard, executeCodegraphInvocation, isCodegraphInitialized, writeCodegraphMarker, } from './codegraph-service.js';
|
|
35
35
|
import { defaultCodegraphProcessRunner } from './codegraph-process-runner.js';
|
|
36
36
|
/** Cap for the directory histogram in the rendered structure block. */
|
|
37
37
|
export const CODEGRAPH_STRUCTURE_MAX_DIRS = 40;
|
|
@@ -163,8 +163,11 @@ async function readStructure(projectRoot, runner) {
|
|
|
163
163
|
*
|
|
164
164
|
* Behavior matrix (acceptance criteria):
|
|
165
165
|
* - `.codegraph/` absent → init + index (best-effort), then read.
|
|
166
|
-
* - `.codegraph/` present with peaks-loop marker
|
|
167
|
-
* (fresh), read directly. No redundant re-index on
|
|
166
|
+
* - `.codegraph/` present with peaks-loop marker AND `codegraph.db` →
|
|
167
|
+
* skip init/index (fresh), read directly. No redundant re-index on
|
|
168
|
+
* every dispatch.
|
|
169
|
+
* - `.codegraph/` present with peaks-loop marker but NO `codegraph.db`
|
|
170
|
+
* (dangling) → init + index (self-heal), then read.
|
|
168
171
|
* - `.codegraph/` present WITHOUT marker (foreign schema) → fail-soft;
|
|
169
172
|
* never clobber a foreign store.
|
|
170
173
|
*
|
|
@@ -180,7 +183,10 @@ export async function buildCodegraphPreflightBlock(projectRoot, runner) {
|
|
|
180
183
|
note: `codegraph unavailable: ${CODEGRAPH_DIR_NAME}/ exists with a non-peaks-loop schema and was not touched. Move or rename the foreign directory, then re-run \`peaks codegraph init\` to enable pre-dispatch structure reads.`,
|
|
181
184
|
};
|
|
182
185
|
}
|
|
183
|
-
|
|
186
|
+
// 'fresh' (no dir) OR a dangling peaks-loop dir (marker present, no
|
|
187
|
+
// codegraph.db) → run init + index. An initialized peaks-loop dir
|
|
188
|
+
// (`noop-already-peaks-loop` with codegraph.db) skips straight to read.
|
|
189
|
+
if (guard.status === 'fresh' || !isCodegraphInitialized(projectRoot)) {
|
|
184
190
|
// 1. init (best-effort). Upstream creates the `.codegraph/` dir; we
|
|
185
191
|
// stamp the peaks-loop marker afterwards so the NEXT dispatch hits
|
|
186
192
|
// the noop (skip-when-fresh) branch.
|
|
@@ -220,7 +226,8 @@ export async function buildCodegraphPreflightBlock(projectRoot, runner) {
|
|
|
220
226
|
return { available: false, note: `codegraph index unavailable: ${errorMessage(error)}` };
|
|
221
227
|
}
|
|
222
228
|
}
|
|
223
|
-
// guard.status === 'noop-already-peaks-loop' (or we
|
|
224
|
-
// the schema exists — do NOT re-index, go straight
|
|
229
|
+
// guard.status === 'noop-already-peaks-loop' with codegraph.db (or we
|
|
230
|
+
// just initialized): the schema exists — do NOT re-index, go straight
|
|
231
|
+
// to the bounded read.
|
|
225
232
|
return readStructure(projectRoot, processRunner);
|
|
226
233
|
}
|
|
@@ -55,6 +55,12 @@ export declare const CODEGRAPH_DIR_NAME = ".codegraph";
|
|
|
55
55
|
* etc. all happily use the same directory name).
|
|
56
56
|
*/
|
|
57
57
|
export declare const CODEGRAPH_MARKER_NAME = ".peaks-loop-marker";
|
|
58
|
+
/**
|
|
59
|
+
* Upstream SQLite schema filename. `isCodegraphInitialized` mirrors
|
|
60
|
+
* `@colbymchenry/codegraph`'s `isInitialized`, which requires this file
|
|
61
|
+
* (not just the `.codegraph/` directory) to exist.
|
|
62
|
+
*/
|
|
63
|
+
export declare const CODEGRAPH_DB_NAME = "codegraph.db";
|
|
58
64
|
export declare const CODEGRAPH_INIT_CONFLICT_EXIT_CODE = 73;
|
|
59
65
|
export type ResolvedCodegraphLocation = {
|
|
60
66
|
readonly source: 'root';
|
|
@@ -88,10 +94,19 @@ export declare class CodegraphInitConflictError extends Error {
|
|
|
88
94
|
constructor(message: string, codegraphDir: string);
|
|
89
95
|
}
|
|
90
96
|
export type CodegraphInitGuard = (projectRoot: string) => CodegraphInitGuardResult;
|
|
97
|
+
/**
|
|
98
|
+
* True when `<projectRoot>/.codegraph/codegraph.db` exists. Mirrors
|
|
99
|
+
* upstream `@colbymchenry/codegraph` `isInitialized`: the `.codegraph/`
|
|
100
|
+
* directory alone (or with only the peaks-loop marker) is NOT initialized.
|
|
101
|
+
* Pure fs probe; never throws.
|
|
102
|
+
*/
|
|
103
|
+
export declare function isCodegraphInitialized(projectRoot: string): boolean;
|
|
91
104
|
/**
|
|
92
105
|
* Root-only init guard: probes `<projectRoot>/.codegraph/`. 'fresh'
|
|
93
|
-
* is returned when the directory does not exist yet
|
|
94
|
-
*
|
|
106
|
+
* is returned when the directory does not exist yet OR when it exists
|
|
107
|
+
* with the peaks-loop marker but no `codegraph.db` (dangling), so the
|
|
108
|
+
* next `peaks codegraph init` creates the root `.codegraph/` directory
|
|
109
|
+
* and its SQLite schema.
|
|
95
110
|
*/
|
|
96
111
|
export declare function defaultCodegraphInitGuard(projectRoot: string): CodegraphInitGuardResult;
|
|
97
112
|
/**
|
|
@@ -180,6 +180,12 @@ export const CODEGRAPH_DIR_NAME = '.codegraph';
|
|
|
180
180
|
* etc. all happily use the same directory name).
|
|
181
181
|
*/
|
|
182
182
|
export const CODEGRAPH_MARKER_NAME = '.peaks-loop-marker';
|
|
183
|
+
/**
|
|
184
|
+
* Upstream SQLite schema filename. `isCodegraphInitialized` mirrors
|
|
185
|
+
* `@colbymchenry/codegraph`'s `isInitialized`, which requires this file
|
|
186
|
+
* (not just the `.codegraph/` directory) to exist.
|
|
187
|
+
*/
|
|
188
|
+
export const CODEGRAPH_DB_NAME = 'codegraph.db';
|
|
183
189
|
export const CODEGRAPH_INIT_CONFLICT_EXIT_CODE = 73;
|
|
184
190
|
/**
|
|
185
191
|
* Root-only resolver: peaks-loop always manages
|
|
@@ -205,6 +211,15 @@ export class CodegraphInitConflictError extends Error {
|
|
|
205
211
|
this.name = 'CodegraphInitConflictError';
|
|
206
212
|
}
|
|
207
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* True when `<projectRoot>/.codegraph/codegraph.db` exists. Mirrors
|
|
216
|
+
* upstream `@colbymchenry/codegraph` `isInitialized`: the `.codegraph/`
|
|
217
|
+
* directory alone (or with only the peaks-loop marker) is NOT initialized.
|
|
218
|
+
* Pure fs probe; never throws.
|
|
219
|
+
*/
|
|
220
|
+
export function isCodegraphInitialized(projectRoot) {
|
|
221
|
+
return existsSync(join(projectRoot, CODEGRAPH_DIR_NAME, CODEGRAPH_DB_NAME));
|
|
222
|
+
}
|
|
208
223
|
/**
|
|
209
224
|
* Inspect a candidate codegraph directory and return its guard
|
|
210
225
|
* status. A file (or symlink-to-file) at the path counts as a
|
|
@@ -223,14 +238,24 @@ function inspectCandidateCodegraphDir(codegraphDir) {
|
|
|
223
238
|
}
|
|
224
239
|
const markerPath = join(codegraphDir, CODEGRAPH_MARKER_NAME);
|
|
225
240
|
if (existsSync(markerPath)) {
|
|
241
|
+
// Marker present but no codegraph.db → the dangling state left by the
|
|
242
|
+
// pre-fix rid-CG-001 auto-stake (marker stamped without running
|
|
243
|
+
// upstream init). Report 'fresh' so consumers re-run upstream init
|
|
244
|
+
// (idempotent, creates the db) instead of treating the schema as
|
|
245
|
+
// fully initialized.
|
|
246
|
+
if (!existsSync(join(codegraphDir, CODEGRAPH_DB_NAME))) {
|
|
247
|
+
return { status: 'fresh', codegraphDir };
|
|
248
|
+
}
|
|
226
249
|
return { status: 'noop-already-peaks-loop', codegraphDir };
|
|
227
250
|
}
|
|
228
251
|
return { status: 'conflict-foreign-schema', codegraphDir };
|
|
229
252
|
}
|
|
230
253
|
/**
|
|
231
254
|
* Root-only init guard: probes `<projectRoot>/.codegraph/`. 'fresh'
|
|
232
|
-
* is returned when the directory does not exist yet
|
|
233
|
-
*
|
|
255
|
+
* is returned when the directory does not exist yet OR when it exists
|
|
256
|
+
* with the peaks-loop marker but no `codegraph.db` (dangling), so the
|
|
257
|
+
* next `peaks codegraph init` creates the root `.codegraph/` directory
|
|
258
|
+
* and its SQLite schema.
|
|
234
259
|
*/
|
|
235
260
|
export function defaultCodegraphInitGuard(projectRoot) {
|
|
236
261
|
const codegraphDir = join(projectRoot, CODEGRAPH_DIR_NAME);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "peaks-loop",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.32",
|
|
4
4
|
"description": "Loop Engineering CLI — workflow primitive / loop guards / evaluators / slice orchestration",
|
|
5
5
|
"author": "SquabbyZ",
|
|
6
6
|
"keywords": [
|
|
@@ -101,10 +101,10 @@
|
|
|
101
101
|
"fzf": "^0.5.2",
|
|
102
102
|
"yaml": "^2.9.0",
|
|
103
103
|
"zod": "^4.4.3",
|
|
104
|
-
"peaks-loop-internal-runtime": "0.0.
|
|
105
|
-
"peaks-loop-
|
|
106
|
-
"peaks-loop-
|
|
107
|
-
"peaks-loop-shared
|
|
104
|
+
"peaks-loop-internal-runtime": "0.0.17",
|
|
105
|
+
"peaks-loop-shared-channel": "0.0.34",
|
|
106
|
+
"peaks-loop-mut": "0.1.30",
|
|
107
|
+
"peaks-loop-shared": "0.0.66"
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
110
|
"@changesets/cli": "2.31.1",
|