@phren/cli 0.1.14 → 0.1.16
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/README.md +1 -1
- package/dist/capabilities/cli.js +1 -1
- package/dist/capabilities/mcp.js +1 -1
- package/dist/capabilities/vscode.js +1 -1
- package/dist/capabilities/web-ui.js +1 -1
- package/dist/cli/extract.js +2 -1
- package/dist/cli/govern.js +3 -2
- package/dist/cli/namespaces-projects.js +7 -6
- package/dist/cli/ops.js +2 -2
- package/dist/cli/session-start.js +2 -1
- package/dist/cli/team.js +7 -5
- package/dist/cli-hooks-session-handlers.js +2 -1
- package/dist/content/archive.js +2 -1
- package/dist/content/citation.d.ts +4 -0
- package/dist/content/citation.js +14 -5
- package/dist/content/dedup.js +6 -5
- package/dist/content/learning.d.ts +1 -3
- package/dist/content/learning.js +17 -62
- package/dist/content/validate.js +2 -1
- package/dist/core/project.js +2 -1
- package/dist/data/access.d.ts +2 -7
- package/dist/data/access.js +14 -20
- package/dist/finding/journal.js +2 -2
- package/dist/finding/lifecycle.js +2 -1
- package/dist/governance/policy.d.ts +2 -0
- package/dist/governance/policy.js +2 -2
- package/dist/hooks.js +38 -2
- package/dist/init/init-uninstall.js +2 -1
- package/dist/init/setup.js +5 -4
- package/dist/init-uninstall.js +2 -1
- package/dist/link/checksums.js +2 -1
- package/dist/link/context.js +2 -1
- package/dist/link/doctor.js +4 -3
- package/dist/link/link.js +2 -1
- package/dist/phren-paths.js +3 -2
- package/dist/profile-store.d.ts +1 -0
- package/dist/profile-store.js +15 -16
- package/dist/project-topics.js +4 -3
- package/dist/shell/input.js +3 -3
- package/dist/status.js +2 -2
- package/dist/tools/data.js +4 -4
- package/dist/tools/extract.js +3 -2
- package/dist/tools/finding.js +10 -15
- package/dist/tools/search.js +5 -14
- package/dist/tools/session.js +2 -16
- package/dist/ui/data.js +6 -5
- package/dist/ui/server.js +3 -3
- package/package.json +1 -1
package/dist/tools/data.js
CHANGED
|
@@ -3,7 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
import * as fs from "fs";
|
|
4
4
|
import * as path from "path";
|
|
5
5
|
import { isValidProjectName, errorMessage, safeProjectPath } from "../utils.js";
|
|
6
|
-
import { readFindings, readTasks, resolveTaskFilePath, TASKS_FILENAME } from "../data/access.js";
|
|
6
|
+
import { readFindings, readTasks, resolveTaskFilePath, TASKS_FILENAME, FINDINGS_FILENAME } from "../data/access.js";
|
|
7
7
|
import { debugLog, findArchivedProjectNameCaseInsensitive, findProjectNameCaseInsensitive, normalizeProjectNameForCreate } from "../shared.js";
|
|
8
8
|
import { logger } from "../logger.js";
|
|
9
9
|
const importPayloadSchema = z.object({
|
|
@@ -60,7 +60,7 @@ export function register(server, ctx) {
|
|
|
60
60
|
const learningsResult = readFindings(resolvedPhrenPath, project);
|
|
61
61
|
if (learningsResult.ok)
|
|
62
62
|
exported.learnings = learningsResult.data;
|
|
63
|
-
const findingsPath = safeProjectPath(projectDir,
|
|
63
|
+
const findingsPath = safeProjectPath(projectDir, FINDINGS_FILENAME);
|
|
64
64
|
if (findingsPath && fs.existsSync(findingsPath))
|
|
65
65
|
exported.findingsRaw = fs.readFileSync(findingsPath, "utf8");
|
|
66
66
|
const taskResult = readTasks(resolvedPhrenPath, project);
|
|
@@ -187,8 +187,8 @@ export function register(server, ctx) {
|
|
|
187
187
|
}
|
|
188
188
|
const findingsContent = typeof parsed.findingsRaw === "string" ? parsed.findingsRaw : buildFindingsContent();
|
|
189
189
|
if (findingsContent) {
|
|
190
|
-
fs.writeFileSync(path.join(stagedProjectDir,
|
|
191
|
-
imported.push(
|
|
190
|
+
fs.writeFileSync(path.join(stagedProjectDir, FINDINGS_FILENAME), findingsContent);
|
|
191
|
+
imported.push(FINDINGS_FILENAME);
|
|
192
192
|
}
|
|
193
193
|
const taskContent = buildTaskContent();
|
|
194
194
|
if (taskContent) {
|
package/dist/tools/extract.js
CHANGED
|
@@ -4,6 +4,7 @@ import { isValidProjectName, safeProjectPath, errorMessage } from "../utils.js";
|
|
|
4
4
|
import { addFindingsToFile } from "../shared/content.js";
|
|
5
5
|
import { checkOllamaAvailable, checkModelAvailable, generateText, getOllamaUrl, getExtractModel } from "../shared/ollama.js";
|
|
6
6
|
import { debugLog } from "../shared.js";
|
|
7
|
+
import { FINDINGS_FILENAME } from "../data/access.js";
|
|
7
8
|
import { getProactivityLevelForFindings, shouldAutoCaptureFindingsForLevel } from "../proactivity.js";
|
|
8
9
|
import * as path from "path";
|
|
9
10
|
const EXTRACT_PROMPT = `You are extracting non-obvious engineering insights from text.
|
|
@@ -115,7 +116,7 @@ export function register(server, ctx) {
|
|
|
115
116
|
return withWriteQueue(async () => {
|
|
116
117
|
// Use addFindingsToFile so extracted findings go through the full pipeline:
|
|
117
118
|
// secret scan, dedup check, validation, and index update.
|
|
118
|
-
const result = addFindingsToFile(targetPath, project, findings
|
|
119
|
+
const result = addFindingsToFile(targetPath, project, findings);
|
|
119
120
|
if (!result.ok) {
|
|
120
121
|
return mcpResponse({ ok: false, error: result.error });
|
|
121
122
|
}
|
|
@@ -124,7 +125,7 @@ export function register(server, ctx) {
|
|
|
124
125
|
// Update index for the findings file
|
|
125
126
|
const resolvedDir = safeProjectPath(targetPath, project);
|
|
126
127
|
if (resolvedDir) {
|
|
127
|
-
updateFileInIndex(path.join(resolvedDir,
|
|
128
|
+
updateFileInIndex(path.join(resolvedDir, FINDINGS_FILENAME));
|
|
128
129
|
}
|
|
129
130
|
return mcpResponse({
|
|
130
131
|
ok: added.length > 0,
|
package/dist/tools/finding.js
CHANGED
|
@@ -12,16 +12,15 @@ import { runCustomHooks } from "../hooks.js";
|
|
|
12
12
|
import { incrementSessionFindings } from "./session.js";
|
|
13
13
|
import { extractFragmentNames } from "../shared/fragment-graph.js";
|
|
14
14
|
import { extractFactFromFinding } from "./extract-facts.js";
|
|
15
|
-
import { appendChildFinding, editFinding as editFindingCore, readFindings } from "../data/access.js";
|
|
15
|
+
import { appendChildFinding, editFinding as editFindingCore, readFindings, FINDINGS_FILENAME } from "../data/access.js";
|
|
16
16
|
import { getActiveTaskForSession } from "../task/lifecycle.js";
|
|
17
|
-
import { FINDING_PROVENANCE_SOURCES } from "../content/citation.js";
|
|
18
17
|
import { isInactiveFindingLine, supersedeFinding, retractFinding as retractFindingLifecycle, resolveFindingContradiction, } from "../finding/lifecycle.js";
|
|
19
18
|
import { permissionDeniedError } from "../governance/rbac.js";
|
|
20
19
|
const JACCARD_MAYBE_LOW = 0.25;
|
|
21
20
|
const JACCARD_MAYBE_HIGH = 0.40; // above this isDuplicateFinding already catches it
|
|
22
21
|
function findJaccardCandidates(phrenPath, project, finding) {
|
|
23
22
|
try {
|
|
24
|
-
const findingsPath = path.join(phrenPath, project,
|
|
23
|
+
const findingsPath = path.join(phrenPath, project, FINDINGS_FILENAME);
|
|
25
24
|
if (!fs.existsSync(findingsPath))
|
|
26
25
|
return [];
|
|
27
26
|
const content = fs.readFileSync(findingsPath, "utf8");
|
|
@@ -78,14 +77,14 @@ function withLifecycleMutation(phrenPath, project, writeQueue, updateIndex, hand
|
|
|
78
77
|
return mcpResponse({ ok: false, error: result.error });
|
|
79
78
|
const resolvedFindingsDir = safeProjectPath(phrenPath, project);
|
|
80
79
|
if (resolvedFindingsDir)
|
|
81
|
-
updateIndex(path.join(resolvedFindingsDir,
|
|
80
|
+
updateIndex(path.join(resolvedFindingsDir, FINDINGS_FILENAME));
|
|
82
81
|
const mapped = mapResponse(result.data);
|
|
83
82
|
return mcpResponse({ ok: true, message: mapped.message, data: mapped.data });
|
|
84
83
|
});
|
|
85
84
|
}
|
|
86
85
|
// ── Handlers ─────────────────────────────────────────────────────────────────
|
|
87
86
|
async function handleAddFinding(ctx, params) {
|
|
88
|
-
const { finding, citation, sessionId,
|
|
87
|
+
const { finding, citation, sessionId, findingType, scope } = params;
|
|
89
88
|
// Resolve store-qualified project names (e.g., "team/arc" → store path + "arc")
|
|
90
89
|
let phrenPath;
|
|
91
90
|
let project;
|
|
@@ -156,7 +155,7 @@ async function handleAddFinding(ctx, params) {
|
|
|
156
155
|
if (added.length > 0) {
|
|
157
156
|
runCustomHooks(phrenPath, "post-finding", { PHREN_PROJECT: project });
|
|
158
157
|
incrementSessionFindings(phrenPath, added.length, sessionId, project);
|
|
159
|
-
updateFileInIndex(path.join(phrenPath, project,
|
|
158
|
+
updateFileInIndex(path.join(phrenPath, project, FINDINGS_FILENAME));
|
|
160
159
|
}
|
|
161
160
|
const rejectedMsg = rejected.length > 0 ? `, ${rejected.length} rejected` : "";
|
|
162
161
|
return mcpResponse({
|
|
@@ -186,7 +185,6 @@ async function handleAddFinding(ctx, params) {
|
|
|
186
185
|
runCustomHooks(phrenPath, "pre-finding", { PHREN_PROJECT: project });
|
|
187
186
|
const result = addFindingToFile(phrenPath, project, taggedFinding, citation, {
|
|
188
187
|
sessionId,
|
|
189
|
-
source,
|
|
190
188
|
scope: normalizedScope,
|
|
191
189
|
extraAnnotations: semanticConflicts.checked ? semanticConflicts.annotations : undefined,
|
|
192
190
|
});
|
|
@@ -196,7 +194,7 @@ async function handleAddFinding(ctx, params) {
|
|
|
196
194
|
if (result.data.status === "skipped") {
|
|
197
195
|
return mcpResponse({ ok: true, message: result.data.message, data: { project, finding: taggedFinding, status: "skipped" } });
|
|
198
196
|
}
|
|
199
|
-
updateFileInIndex(path.join(phrenPath, project,
|
|
197
|
+
updateFileInIndex(path.join(phrenPath, project, FINDINGS_FILENAME));
|
|
200
198
|
if (result.data.status === "added" || result.data.status === "created") {
|
|
201
199
|
runCustomHooks(phrenPath, "post-finding", { PHREN_PROJECT: project });
|
|
202
200
|
incrementSessionFindings(phrenPath, 1, sessionId, project);
|
|
@@ -208,7 +206,7 @@ async function handleAddFinding(ctx, params) {
|
|
|
208
206
|
const taskMatch = activeTask.stableId ? `bid:${activeTask.stableId}` : activeTask.line;
|
|
209
207
|
// Extract fid from the last written line in FINDINGS.md
|
|
210
208
|
try {
|
|
211
|
-
const findingsPath = path.join(phrenPath, project,
|
|
209
|
+
const findingsPath = path.join(phrenPath, project, FINDINGS_FILENAME);
|
|
212
210
|
const findingsContent = fs.readFileSync(findingsPath, "utf8");
|
|
213
211
|
const lines = findingsContent.split("\n");
|
|
214
212
|
const taggedText = taggedFinding.replace(/^-\s+/, "").trim().slice(0, 60).toLowerCase();
|
|
@@ -400,7 +398,7 @@ async function handleEditFinding(ctx, { project: projectInput, old_text, new_tex
|
|
|
400
398
|
return mcpResponse({ ok: false, error: result.error });
|
|
401
399
|
const resolvedFindingsDir = safeProjectPath(phrenPath, project);
|
|
402
400
|
if (resolvedFindingsDir)
|
|
403
|
-
updateFileInIndex(path.join(resolvedFindingsDir,
|
|
401
|
+
updateFileInIndex(path.join(resolvedFindingsDir, FINDINGS_FILENAME));
|
|
404
402
|
return mcpResponse({
|
|
405
403
|
ok: true,
|
|
406
404
|
message: result.data,
|
|
@@ -432,7 +430,7 @@ async function handleRemoveFinding(ctx, { project: projectInput, finding }) {
|
|
|
432
430
|
return mcpResponse({ ok: false, error: result.message });
|
|
433
431
|
const resolvedFindingsDir = safeProjectPath(phrenPath, project);
|
|
434
432
|
if (resolvedFindingsDir)
|
|
435
|
-
updateFileInIndex(path.join(resolvedFindingsDir,
|
|
433
|
+
updateFileInIndex(path.join(resolvedFindingsDir, FINDINGS_FILENAME));
|
|
436
434
|
return mcpResponse({ ok: true, message: result.message, data: result.data });
|
|
437
435
|
});
|
|
438
436
|
}
|
|
@@ -442,7 +440,7 @@ async function handleRemoveFinding(ctx, { project: projectInput, finding }) {
|
|
|
442
440
|
return mcpResponse({ ok: false, error: result.message });
|
|
443
441
|
const resolvedFindingsDir = safeProjectPath(phrenPath, project);
|
|
444
442
|
if (resolvedFindingsDir)
|
|
445
|
-
updateFileInIndex(path.join(resolvedFindingsDir,
|
|
443
|
+
updateFileInIndex(path.join(resolvedFindingsDir, FINDINGS_FILENAME));
|
|
446
444
|
return mcpResponse({ ok: true, message: result.message, data: result.data });
|
|
447
445
|
});
|
|
448
446
|
}
|
|
@@ -627,9 +625,6 @@ export function register(server, ctx) {
|
|
|
627
625
|
task_item: z.string().optional().describe("Task item stable ID like bid:abcd1234, positional ID like A1, or item text to link this finding to."),
|
|
628
626
|
}).optional().describe("Optional source citation for traceability (only used when finding is a single string)."),
|
|
629
627
|
sessionId: z.string().optional().describe("Optional session ID from session_start. Pass this if you want session metrics to include this write."),
|
|
630
|
-
source: z.enum(FINDING_PROVENANCE_SOURCES)
|
|
631
|
-
.optional()
|
|
632
|
-
.describe("Optional finding provenance source: human, agent, hook, extract, consolidation, or unknown."),
|
|
633
628
|
findingType: z.enum(FINDING_TYPES)
|
|
634
629
|
.optional()
|
|
635
630
|
.describe("Classify this finding: 'decision' (architectural choice with rationale), 'pitfall' (bug or failure mode to avoid), 'pattern' (reusable approach that works well), 'tradeoff' (deliberate compromise), 'architecture' (structural design note), 'bug' (confirmed defect or failure)."),
|
package/dist/tools/search.js
CHANGED
|
@@ -6,7 +6,7 @@ import { createHash } from "crypto";
|
|
|
6
6
|
import { execFileSync } from "child_process";
|
|
7
7
|
import { isValidProjectName, errorMessage } from "../utils.js";
|
|
8
8
|
import { resolveAllStores } from "../store-registry.js";
|
|
9
|
-
import { readFindings } from "../data/access.js";
|
|
9
|
+
import { readFindings, FINDINGS_FILENAME } from "../data/access.js";
|
|
10
10
|
import { debugLog, runtimeFile, DOC_TYPES, FINDING_TAGS, isMemoryScopeVisible, normalizeMemoryScope, } from "../shared.js";
|
|
11
11
|
import { FINDING_LIFECYCLE_STATUSES, parseFindingLifecycle, } from "../shared/content.js";
|
|
12
12
|
import { decodeStringRow, queryRows, queryDocRows, queryFragmentLinks, logFragmentMiss, extractSnippet, queryDocBySourceKey, normalizeMemoryId, } from "../shared/index.js";
|
|
@@ -14,7 +14,7 @@ import { runCustomHooks } from "../hooks.js";
|
|
|
14
14
|
import { entryScoreKey, getQualityMultiplier, getRetentionPolicy } from "../shared/governance.js";
|
|
15
15
|
import { callLlm } from "../content/dedup.js";
|
|
16
16
|
import { rankResults, searchKnowledgeRows, applyTrustFilter, searchFederatedStores } from "../shared/retrieval.js";
|
|
17
|
-
import { parseSourceComment } from "../content/citation.js";
|
|
17
|
+
import { parseScopeComment, parseSourceComment } from "../content/citation.js";
|
|
18
18
|
import { resolveActiveSessionScope } from "./session.js";
|
|
19
19
|
import { logger } from "../logger.js";
|
|
20
20
|
/**
|
|
@@ -79,8 +79,7 @@ function filterFindingsContentByScope(content, activeScope) {
|
|
|
79
79
|
let keepCitation = false;
|
|
80
80
|
for (const line of lines) {
|
|
81
81
|
if (line.startsWith("- ")) {
|
|
82
|
-
const
|
|
83
|
-
const itemScope = normalizeMemoryScope(source?.scope);
|
|
82
|
+
const itemScope = normalizeMemoryScope(parseScopeComment(line) ?? parseSourceComment(line)?.scope);
|
|
84
83
|
keepCitation = isMemoryScopeVisible(itemScope, activeScope);
|
|
85
84
|
if (keepCitation)
|
|
86
85
|
out.push(line);
|
|
@@ -471,7 +470,7 @@ async function handleGetProjectSummary(ctx, { name }) {
|
|
|
471
470
|
if (store && fs.existsSync(path.join(store.path, lookupName))) {
|
|
472
471
|
const projDir = path.join(store.path, lookupName);
|
|
473
472
|
const fsDocs = [];
|
|
474
|
-
for (const [file, type] of [["summary.md", "summary"], ["CLAUDE.md", "claude"], [
|
|
473
|
+
for (const [file, type] of [["summary.md", "summary"], ["CLAUDE.md", "claude"], [FINDINGS_FILENAME, "findings"], ["tasks.md", "task"], ["truths.md", "canonical"]]) {
|
|
475
474
|
const filePath = path.join(projDir, file);
|
|
476
475
|
if (fs.existsSync(filePath)) {
|
|
477
476
|
fsDocs.push({ project: lookupName, filename: file, type, content: fs.readFileSync(filePath, "utf8").slice(0, 8000), path: filePath });
|
|
@@ -587,7 +586,7 @@ async function handleListProjects(ctx, { page, page_size }) {
|
|
|
587
586
|
if (projDir) {
|
|
588
587
|
if (fs.existsSync(path.join(projDir, "CLAUDE.md")))
|
|
589
588
|
badges.push("CLAUDE.md");
|
|
590
|
-
if (fs.existsSync(path.join(projDir,
|
|
589
|
+
if (fs.existsSync(path.join(projDir, FINDINGS_FILENAME)))
|
|
591
590
|
badges.push("FINDINGS");
|
|
592
591
|
if (fs.existsSync(path.join(projDir, "summary.md")))
|
|
593
592
|
badges.push("summary");
|
|
@@ -658,16 +657,8 @@ async function handleGetFindings(ctx, { project, limit, include_superseded, incl
|
|
|
658
657
|
metadata.push(`status=${entry.status}`);
|
|
659
658
|
if (entry.taskItem)
|
|
660
659
|
metadata.push(`task=${entry.taskItem}`);
|
|
661
|
-
if (entry.sessionId)
|
|
662
|
-
metadata.push(`session=${entry.sessionId.slice(0, 8)}`);
|
|
663
660
|
if (entry.scope)
|
|
664
661
|
metadata.push(`scope=${entry.scope}`);
|
|
665
|
-
if (entry.actor)
|
|
666
|
-
metadata.push(`actor=${entry.actor}`);
|
|
667
|
-
if (entry.tool)
|
|
668
|
-
metadata.push(`tool=${entry.tool}`);
|
|
669
|
-
if (entry.model)
|
|
670
|
-
metadata.push(`model=${entry.model}`);
|
|
671
662
|
if (entry.supersedes)
|
|
672
663
|
metadata.push(`supersedes="${entry.supersedes.slice(0, 30)}"`);
|
|
673
664
|
if (entry.supersededBy)
|
package/dist/tools/session.js
CHANGED
|
@@ -11,7 +11,7 @@ import { runCustomHooks } from "../hooks.js";
|
|
|
11
11
|
import { readExtractedFacts } from "./extract-facts.js";
|
|
12
12
|
import { resolveFindingSessionId } from "../finding/context.js";
|
|
13
13
|
import { readTasks } from "../data/tasks.js";
|
|
14
|
-
import { readFindings } from "../data/access.js";
|
|
14
|
+
import { readFindings, FINDINGS_FILENAME } from "../data/access.js";
|
|
15
15
|
import { getActiveTaskForSession } from "../task/lifecycle.js";
|
|
16
16
|
import { listTaskCheckpoints, writeTaskCheckpoint } from "../session/checkpoints.js";
|
|
17
17
|
import { findMostRecentSummaryWithProject as findMostRecentSummaryRecord, writeLastSummary as writeLastSummaryRecord, } from "../session/artifacts.js";
|
|
@@ -270,20 +270,6 @@ export async function getSessionArtifacts(phrenPath, sessionId, project) {
|
|
|
270
270
|
if (seen.has(proj))
|
|
271
271
|
return;
|
|
272
272
|
seen.add(proj);
|
|
273
|
-
// Findings with matching sessionId
|
|
274
|
-
const findingsResult = readFindings(storePath, proj);
|
|
275
|
-
if (findingsResult.ok) {
|
|
276
|
-
for (const f of findingsResult.data) {
|
|
277
|
-
if (f.sessionId && (f.sessionId === sessionId || f.sessionId.startsWith(shortId))) {
|
|
278
|
-
findings.push({
|
|
279
|
-
project: proj,
|
|
280
|
-
id: f.id,
|
|
281
|
-
date: f.date,
|
|
282
|
-
text: f.text,
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
273
|
// Tasks with matching sessionId
|
|
288
274
|
const tasksResult = readTasks(storePath, proj);
|
|
289
275
|
if (tasksResult.ok) {
|
|
@@ -332,7 +318,7 @@ async function hasCompletedTasksInSession(phrenPath, sessionId, project) {
|
|
|
332
318
|
/** Compute what changed since the last session ended. */
|
|
333
319
|
function computeSessionDiff(phrenPath, project, lastSessionEnd) {
|
|
334
320
|
const projectDir = path.join(phrenPath, project);
|
|
335
|
-
const findingsPath = path.join(projectDir,
|
|
321
|
+
const findingsPath = path.join(projectDir, FINDINGS_FILENAME);
|
|
336
322
|
if (!fs.existsSync(findingsPath))
|
|
337
323
|
return { newFindings: 0, superseded: 0, tasksCompleted: 0 };
|
|
338
324
|
const content = fs.readFileSync(findingsPath, "utf8");
|
package/dist/ui/data.js
CHANGED
|
@@ -10,6 +10,7 @@ import { hookConfigPaths, hookConfigRoots } from "../provider-adapters.js";
|
|
|
10
10
|
import { readProjectConfig, isProjectHookEnabled, PROJECT_HOOK_EVENTS } from "../project-config.js";
|
|
11
11
|
import { getAllSkills } from "../skill/registry.js";
|
|
12
12
|
import { resolveTaskFilePath, readTasks, TASKS_FILENAME } from "../data/tasks.js";
|
|
13
|
+
import { FINDINGS_FILENAME } from "../data/access.js";
|
|
13
14
|
import { buildIndex, queryDocBySourceKey, queryRows } from "../shared/index.js";
|
|
14
15
|
import { readProjectTopics, classifyTopicForText } from "../project-topics.js";
|
|
15
16
|
import { entryScoreKey } from "../governance/scores.js";
|
|
@@ -190,7 +191,7 @@ export async function buildGraph(phrenPath, profile, focusProject, existingDb) {
|
|
|
190
191
|
topicMetaMap.set(topic.slug, { slug: topic.slug, label: topic.label });
|
|
191
192
|
}
|
|
192
193
|
}
|
|
193
|
-
const findingsPath = path.join(storePath, project,
|
|
194
|
+
const findingsPath = path.join(storePath, project, FINDINGS_FILENAME);
|
|
194
195
|
const storeName = storePathToName.get(storePath) || "unknown";
|
|
195
196
|
if (!fs.existsSync(findingsPath)) {
|
|
196
197
|
if (!addedProjectNodeIds.has(project)) {
|
|
@@ -260,7 +261,7 @@ export async function buildGraph(phrenPath, profile, focusProject, existingDb) {
|
|
|
260
261
|
if (taggedCount >= MAX_TAGGED)
|
|
261
262
|
continue;
|
|
262
263
|
const topic = classifyTopicForText(`[${currentHeadingTag}] ${text}`, projectTopics);
|
|
263
|
-
const scoreKey = entryScoreKey(project,
|
|
264
|
+
const scoreKey = entryScoreKey(project, FINDINGS_FILENAME, `[${currentHeadingTag}] ${text}`);
|
|
264
265
|
const nodeId = stableId("finding", scoreKey);
|
|
265
266
|
taggedCount++;
|
|
266
267
|
nodes.push({
|
|
@@ -295,7 +296,7 @@ export async function buildGraph(phrenPath, profile, focusProject, existingDb) {
|
|
|
295
296
|
const label = text.length > 55 ? `${text.slice(0, 52)}...` : text;
|
|
296
297
|
// Classify the finding using the project's topic system
|
|
297
298
|
const topic = classifyTopicForText(`[${tag}] ${text}`, projectTopics);
|
|
298
|
-
const scoreKey = entryScoreKey(project,
|
|
299
|
+
const scoreKey = entryScoreKey(project, FINDINGS_FILENAME, `[${tag}] ${text}`);
|
|
299
300
|
const nodeId = stableId("finding", scoreKey);
|
|
300
301
|
taggedCount++;
|
|
301
302
|
nodes.push({
|
|
@@ -330,7 +331,7 @@ export async function buildGraph(phrenPath, profile, focusProject, existingDb) {
|
|
|
330
331
|
const label = text.length > 55 ? `${text.slice(0, 52)}...` : text;
|
|
331
332
|
// Classify using dynamic topics
|
|
332
333
|
const topic = classifyTopicForText(text, projectTopics);
|
|
333
|
-
const scoreKey = entryScoreKey(project,
|
|
334
|
+
const scoreKey = entryScoreKey(project, FINDINGS_FILENAME, text);
|
|
334
335
|
const nodeId = stableId("finding", scoreKey);
|
|
335
336
|
untaggedAdded++;
|
|
336
337
|
nodes.push({
|
|
@@ -566,7 +567,7 @@ export function recentAccepted(phrenPath) {
|
|
|
566
567
|
}
|
|
567
568
|
function buildProjectInfo(basePath, project, store) {
|
|
568
569
|
const dir = path.join(basePath, project);
|
|
569
|
-
const findingsPath = path.join(dir,
|
|
570
|
+
const findingsPath = path.join(dir, FINDINGS_FILENAME);
|
|
570
571
|
const taskPath = resolveTaskFilePath(basePath, project);
|
|
571
572
|
const claudeMdPath = path.join(dir, "CLAUDE.md");
|
|
572
573
|
const summaryPath = path.join(dir, "summary.md");
|
package/dist/ui/server.js
CHANGED
|
@@ -7,7 +7,7 @@ import * as querystring from "querystring";
|
|
|
7
7
|
import { spawn, execFileSync } from "child_process";
|
|
8
8
|
import { computePhrenLiveStateToken, getProjectDirs, } from "../shared.js";
|
|
9
9
|
import { getNonPrimaryStores, subscribeStoreProjects, unsubscribeStoreProjects } from "../store-registry.js";
|
|
10
|
-
import { editFinding, readReviewQueue, removeFinding, readFindings, addFinding as addFindingStore, readTasksAcrossProjects, addTask as addTaskStore, completeTask as completeTaskStore, removeTask as removeTaskStore, updateTask as updateTaskStore, TASKS_FILENAME, } from "../data/access.js";
|
|
10
|
+
import { editFinding, readReviewQueue, removeFinding, readFindings, addFinding as addFindingStore, readTasksAcrossProjects, addTask as addTaskStore, completeTask as completeTaskStore, removeTask as removeTaskStore, updateTask as updateTaskStore, TASKS_FILENAME, FINDINGS_FILENAME, } from "../data/access.js";
|
|
11
11
|
import { isValidProjectName, errorMessage, queueFilePath, safeProjectPath } from "../utils.js";
|
|
12
12
|
import { readInstallPreferences, writeInstallPreferences, writeGovernanceInstallPreferences } from "../init/preferences.js";
|
|
13
13
|
import { buildGraph, collectProjectsForUI, collectSkillsForUI, getHooksData, isAllowedSkillPath, readSyncSnapshot, recentAccepted, recentUsage, } from "./data.js";
|
|
@@ -376,7 +376,7 @@ function handleGetProjectContent(res, url, ctx) {
|
|
|
376
376
|
const file = String(qs.file || "");
|
|
377
377
|
if (!project || !isValidProjectName(project) || !file)
|
|
378
378
|
return jsonErr(res, "Invalid project or file", 400);
|
|
379
|
-
const allowedFiles = [
|
|
379
|
+
const allowedFiles = [FINDINGS_FILENAME, TASKS_FILENAME, "CLAUDE.md", "summary.md"];
|
|
380
380
|
if (!allowedFiles.includes(file))
|
|
381
381
|
return jsonErr(res, `File not allowed: ${file}`, 400);
|
|
382
382
|
const basePath = resolveProjectBasePath(ctx.phrenPath, project);
|
|
@@ -509,7 +509,7 @@ function handleGetSettings(res, url, ctx) {
|
|
|
509
509
|
const projectDir = path.join(ctx.phrenPath, settingsProject);
|
|
510
510
|
const configFile = path.join(projectDir, "phren.project.yaml");
|
|
511
511
|
const projConfig = readProjectConfig(ctx.phrenPath, settingsProject);
|
|
512
|
-
const findingsPath = path.join(projectDir,
|
|
512
|
+
const findingsPath = path.join(projectDir, FINDINGS_FILENAME);
|
|
513
513
|
const taskPath = path.join(projectDir, "tasks.md");
|
|
514
514
|
let findingCount = 0;
|
|
515
515
|
if (fs.existsSync(findingsPath))
|