@guanlin4924/devflow-pi 0.1.79 → 0.1.81
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 +1 -1
- package/plugins/devflow-intel/extensions/devflow-intel.ts +52 -3
- package/plugins/devflow-intel/skills/workflow-code-index/SKILL.md +14 -0
- package/plugins/devflow-intel/skills/workflow-code-index/scripts/code_index.py +311 -60
- package/plugins/devflow-intel/skills/workflow-code-index/scripts/core/scanner.py +10 -2
- package/plugins/devflow-intel/skills/workflow-code-index/scripts/domain_registry.py +168 -0
- package/plugins/devflow-intel/skills/workflow-code-index/scripts/hybrid_query.py +367 -0
- package/plugins/devflow-intel/skills/workflow-code-index/scripts/source_content.py +88 -0
- package/plugins/devflow-intel/skills/workflow-code-index/scripts/writers/sqlite_writer.py +5 -2
- package/src/constants.ts +1 -1
- package/src/initialization-store.ts +1 -0
- package/src/project-initializer.ts +8 -3
|
@@ -4,6 +4,7 @@ from pathlib import Path
|
|
|
4
4
|
|
|
5
5
|
from adapters.capabilities import confidence_for_parser
|
|
6
6
|
from core.schema import json_dumps
|
|
7
|
+
from source_content import build_content
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
SCHEMA = """
|
|
@@ -195,7 +196,7 @@ CREATE INDEX IF NOT EXISTS idx_relations_external ON relations(to_external);
|
|
|
195
196
|
|
|
196
197
|
|
|
197
198
|
def write_sqlite(path: Path, files, symbols, relations, diagnostics, snapshot_id="pending",
|
|
198
|
-
workspace_state=None, semantic_entities=None, semantic_flows=None, feature_bindings=None) -> None:
|
|
199
|
+
workspace_state=None, semantic_entities=None, semantic_flows=None, feature_bindings=None, source_root=None) -> None:
|
|
199
200
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
200
201
|
if path.exists():
|
|
201
202
|
path.unlink()
|
|
@@ -210,7 +211,7 @@ def write_sqlite(path: Path, files, symbols, relations, diagnostics, snapshot_id
|
|
|
210
211
|
parsed_count = sum(1 for item in files if item.get("path") not in parse_failed_paths)
|
|
211
212
|
conn.execute(
|
|
212
213
|
"INSERT INTO analysis_snapshots(snapshot_id, schema_version, source_revision, content_manifest_hash, extractor_set_hash, created_at, status) VALUES(?,?,?,?,?,?,?)",
|
|
213
|
-
(snapshot_id, 3, workspace_state.get("repositoryRevision", ""), workspace_state.get("contentManifestHash", ""),
|
|
214
|
+
(snapshot_id, 4 if source_root is not None else 3, workspace_state.get("repositoryRevision", ""), workspace_state.get("contentManifestHash", ""),
|
|
214
215
|
workspace_state.get("extractorSetHash", ""), workspace_state.get("generatedAt", ""), "current"),
|
|
215
216
|
)
|
|
216
217
|
# Structural symbols and files are first-class graph nodes as well.
|
|
@@ -304,6 +305,8 @@ def write_sqlite(path: Path, files, symbols, relations, diagnostics, snapshot_id
|
|
|
304
305
|
""",
|
|
305
306
|
[_symbol_row(record) for record in symbols],
|
|
306
307
|
)
|
|
308
|
+
if source_root is not None:
|
|
309
|
+
workspace_state["contentSearch"] = build_content(conn, source_root, files, snapshot_id, workspace_state.get("scanScope", {}))
|
|
307
310
|
conn.commit()
|
|
308
311
|
finally:
|
|
309
312
|
conn.close()
|
package/src/constants.ts
CHANGED
|
@@ -219,9 +219,14 @@ async function buildCodeIndex(context: ProjectContext, config: ScanConfigInput):
|
|
|
219
219
|
const script = path.resolve(import.meta.dir, "../plugins/devflow-intel/skills/workflow-code-index/scripts/code_index.py");
|
|
220
220
|
const output = `.planning/.code-index-pending-${randomUUID()}`;
|
|
221
221
|
const codebases = config.repositories.flatMap(repository => ["--codebase", `${repository.name}:${path.resolve(context.root, repository.relativePath)}:${repository.role}`]);
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
const scopeArgs = [
|
|
223
|
+
...(config.includes ?? ["**/*"]).flatMap(pattern => ["--include", pattern]),
|
|
224
|
+
...(config.excludes ?? [".git/**", ".planning/**", ".devflow/**"]).flatMap(pattern => ["--exclude", pattern]),
|
|
225
|
+
"--max-file-size", String(config.maxFileSize ?? 2 * 1024 * 1024),
|
|
226
|
+
];
|
|
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");
|
|
225
230
|
const snapshotPath = path.join(context.root, output, "SNAPSHOT.json");
|
|
226
231
|
const bytes = await readFile(snapshotPath); const snapshot = JSON.parse(bytes.toString("utf8")) as Record<string, unknown>;
|
|
227
232
|
if (!snapshot.generation || !snapshot.immutablePath) throw new Error("Code index did not publish an immutable generation");
|