@guanlin4924/devflow-pi 0.1.92 → 0.1.93

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guanlin4924/devflow-pi",
3
- "version": "0.1.92",
3
+ "version": "0.1.93",
4
4
  "type": "module",
5
5
  "description": "Devflow 专项研发 Pi,基于固定版本 OMP Runtime 组装研发状态机、代码智能、设计、实现与质量门禁。",
6
6
  "license": "UNLICENSED",
@@ -149,8 +149,13 @@ def validate_code_index(
149
149
  mode = manifest.get("mode")
150
150
  status = manifest.get("code_index_status")
151
151
  if mode == "full":
152
+ if status == "degraded":
153
+ reason = str(manifest.get("code_index_skip_reason", ""))
154
+ if reason != "code_index_publish_failed":
155
+ errors.append("degraded full mode requires code_index_publish_failed reason")
156
+ return
152
157
  if status != "complete":
153
- errors.append("full mode requires code_index_status=complete")
158
+ errors.append("full mode requires code_index_status=complete or degraded")
154
159
  if manifest.get("code_index_skip_reason") != "none":
155
160
  errors.append("full mode requires code_index_skip_reason=none")
156
161
  for relative_path in CODE_INDEX_FILES:
@@ -16,6 +16,8 @@ Act as a bounded read-only evidence collector, not a planner. Use the code index
16
16
 
17
17
  Before using `read`, `grep`, or `devflow_code_index`, resolve the project root by walking upward from the runtime directory to the nearest `.devflow/project.json`, `.planning/code-index/index.sqlite`, or `.planning/PROJECT.md`. Treat nested directories such as `drama-ad/backend` as codebases, not Devflow project roots; `.planning` must always be resolved from the project root.
18
18
 
19
+ If the index is missing, stale, fails validation, or has no useful hit, continue with a bounded `grep`/`rg` or LSP fallback over the registered codebase roots. Return `degraded_index_coverage` and the exact fallback scope; never present fallback relations as index facts.
20
+
19
21
  If the answer needs architecture tradeoffs, requirements interpretation, a cross-module decision, or evidence remains insufficient after the bounded search, stop and return `STATUS: escalate`. Do not guess or continue exploring.
20
22
 
21
23
  Return exactly:
@@ -19,6 +19,8 @@ All index checks and `devflow_code_index` calls must run with that resolved root
19
19
 
20
20
  The tool returns the resolved `projectRoot` in its details. If the root cannot be resolved, stop and report the exact check command/path instead of probing `<source-dir>/.planning`.
21
21
 
22
+ If the index is missing, stale, fails validation, or returns no useful hit, do not block the source question. Record the machine failure and use a bounded `rg`/`grep` or LSP search within the registered codebase roots. Mark the result `degraded_index_coverage` and include the exact fallback scope; do not claim index-derived relations or complete impact coverage.
23
+
22
24
  ## Required Flow
23
25
 
24
26
  1. Check that `.planning/code-index/index.sqlite` or JSONL sidecars exist.
@@ -136,7 +136,7 @@ seam 标注: "只改 OrderWorkflow.process()"
136
136
 
137
137
  **对每一个目标文件**,按以下流程执行:
138
138
 
139
- 1. **⛔ Gate 前置:先查 code-index** — 在读取任何业务源码之前,必须先用 `code_index outline` 或 `code_index search` 获取目标文件的符号表。code-index 不可用时用 LSP `documentSymbol` 兜底。
139
+ 1. **⛔ Gate 前置:先查 code-index** — 在读取任何业务源码之前,必须先用 `code_index outline` 或 `code_index search` 获取目标文件的符号表。若 code-index 缺失、过期、校验失败或无有效命中,使用有界 `rg/grep` 或 LSP `documentSymbol` 兜底,并在报告中标记 `degraded_index_coverage` 和实际搜索范围;不得把 fallback 结果表述为索引关系事实。
140
140
  2. **用 code-index relations 查引用/调用/导入/测试覆盖** — 确认每个导出方法是否有调用方;code-index 缺失、过期或无命中时再用 Grep / LSP findReferences 兜底
141
141
  3. **回读源码 evidence** — 对用于审查结论的 relation,必须读取 `evidence_path:evidence_line` 附近源码。**此时可声明"基于 code-index 符号 [X] 读取源码"以通过 gate。**
142
142
  4. **逐条对照规范检查清单** — 详见 `references/` 目录下各层级的检查清单:
package/src/constants.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export const PRODUCT_NAME = "Devflow Pi";
2
- export const PRODUCT_VERSION = "0.1.92";
2
+ export const PRODUCT_VERSION = "0.1.93";
3
3
  export const PROJECT_SCHEMA_VERSION = 1;
4
4
  export const OMP_RUNTIME_VERSION = "17.2.7";
5
5
 
@@ -225,8 +225,20 @@ async function buildCodeIndex(context: ProjectContext, config: ScanConfigInput):
225
225
  "--max-file-size", String(config.maxFileSize ?? 2 * 1024 * 1024),
226
226
  ];
227
227
  await runProcess(["python3", script, "scan", "--root", context.root, "--output", output, ...scopeArgs, ...codebases], context.root, "code-index scan");
228
- await runProcess(["python3", script, "validate", "--index", output, "--level", "publish"], context.root, "code-index validate");
229
- await runProcess(["python3", script, "audit", "--root", context.root, "--index", output, "--skill-root", path.resolve(import.meta.dir, "../plugins/devflow-intel/skills"), "--level", "publish"], context.root, "code-index audit");
228
+ try {
229
+ await runProcess(["python3", script, "validate", "--index", output, "--level", "publish"], context.root, "code-index validate");
230
+ await runProcess(["python3", script, "audit", "--root", context.root, "--index", output, "--skill-root", path.resolve(import.meta.dir, "../plugins/devflow-intel/skills"), "--level", "publish"], context.root, "code-index audit");
231
+ } catch (error) {
232
+ const message = error instanceof Error ? error.message : String(error);
233
+ return {
234
+ path: ".planning/code-index",
235
+ stagingPath: output,
236
+ status: "degraded",
237
+ reason: "code_index_publish_failed",
238
+ fallback: "bounded_source_search",
239
+ diagnostics: [message],
240
+ };
241
+ }
230
242
  const snapshotPath = path.join(context.root, output, "SNAPSHOT.json");
231
243
  const bytes = await readFile(snapshotPath); const snapshot = JSON.parse(bytes.toString("utf8")) as Record<string, unknown>;
232
244
  if (!snapshot.generation || !snapshot.immutablePath) throw new Error("Code index did not publish an immutable generation");
@@ -235,6 +247,7 @@ async function buildCodeIndex(context: ProjectContext, config: ScanConfigInput):
235
247
  }
236
248
 
237
249
  async function promoteCodeIndex(context: ProjectContext, indexRef: Record<string, unknown>): Promise<() => Promise<void>> {
250
+ if (indexRef.status !== "complete") return async () => {};
238
251
  const stagingPath = typeof indexRef.stagingPath === "string" ? path.resolve(context.root, indexRef.stagingPath) : null;
239
252
  const target = path.resolve(context.root, ".planning/code-index");
240
253
  if (!stagingPath) return async () => {};