@phren/cli 0.1.41 → 0.1.44
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/dist/capabilities/cli.js +1 -1
- package/dist/capabilities/mcp.js +1 -1
- package/dist/capabilities/vscode.js +3 -3
- package/dist/capabilities/web-ui.js +29 -29
- package/dist/cli/actions.js +1 -13
- package/dist/cli/extract.js +3 -2
- package/dist/cli/hooks-output.js +15 -6
- package/dist/cli/hooks.js +2 -2
- package/dist/cli/namespaces-utils.js +1 -1
- package/dist/content/archive.js +3 -2
- package/dist/content/dedup.js +4 -3
- package/dist/content/learning.js +5 -4
- package/dist/content/secrets.js +4 -1
- package/dist/data/access.js +10 -9
- package/dist/data/tasks.js +46 -6
- package/dist/finding/lifecycle.js +3 -2
- package/dist/governance/policy.js +4 -3
- package/dist/governance/scores.d.ts +9 -1
- package/dist/governance/scores.js +12 -1
- package/dist/init/init-uninstall.js +12 -2
- package/dist/profile-store.d.ts +2 -0
- package/dist/profile-store.js +13 -17
- package/dist/project-config.js +3 -2
- package/dist/project-topics.js +13 -12
- package/dist/shared/data-utils.js +13 -3
- package/dist/shared/fragment-graph.js +7 -2
- package/dist/shared/retrieval.d.ts +10 -0
- package/dist/shared/retrieval.js +17 -4
- package/dist/shell/entry.d.ts +8 -0
- package/dist/shell/entry.js +114 -58
- package/dist/shell/input.d.ts +1 -1
- package/dist/shell/input.js +4 -1
- package/dist/shell/keys.d.ts +36 -0
- package/dist/shell/keys.js +107 -0
- package/dist/shell/render.d.ts +33 -0
- package/dist/shell/render.js +216 -46
- package/dist/shell/shell.js +16 -3
- package/dist/shell/view.js +2 -1
- package/dist/store-registry.d.ts +13 -0
- package/dist/store-registry.js +106 -34
- package/dist/store-routing.d.ts +8 -0
- package/dist/store-routing.js +23 -1
- package/dist/tools/config.js +4 -3
- package/dist/tools/extract-facts.js +3 -2
- package/dist/tools/finding.js +6 -5
- package/dist/tools/memory.js +12 -5
- package/dist/tools/ops.js +1 -1
- package/dist/ui/server.js +2 -6
- package/dist/utils-fts.js +3 -2
- package/dist/utils-paths.d.ts +1 -0
- package/dist/utils-paths.js +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +31 -4
- package/starter/global/skills/phren-consolidate/SKILL.md +152 -0
- package/starter/global/skills/phren-discover/SKILL.md +175 -0
- package/starter/global/skills/phren-init/SKILL.md +216 -0
- package/starter/global/skills/phren-profiles/SKILL.md +121 -0
- package/starter/global/skills/phren-sync/SKILL.md +261 -0
- package/dist/init-uninstall.d.ts +0 -3
- package/dist/init-uninstall.js +0 -514
- package/dist/init-walkthrough.d.ts +0 -55
- package/dist/init-walkthrough.js +0 -524
package/dist/capabilities/cli.js
CHANGED
package/dist/capabilities/mcp.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const vscodeManifest = {
|
|
2
2
|
surface: "vscode",
|
|
3
|
-
version: "0.1.
|
|
3
|
+
version: "0.1.42",
|
|
4
4
|
actions: {
|
|
5
5
|
// Finding management
|
|
6
6
|
"finding.add": { implemented: true, handler: "extension.ts:phren.addFinding" },
|
|
@@ -24,8 +24,8 @@ export const vscodeManifest = {
|
|
|
24
24
|
"hook.errors": { implemented: false, reason: "Hook errors not exposed in VS Code" },
|
|
25
25
|
// Search
|
|
26
26
|
"search.fts": { implemented: true, handler: "searchQuickPick.ts:showSearchQuickPick" },
|
|
27
|
-
"search.fragment": { implemented:
|
|
28
|
-
"search.related_docs": { implemented:
|
|
27
|
+
"search.fragment": { implemented: false, reason: "search_fragments is never called from the extension (no client method exists)" },
|
|
28
|
+
"search.related_docs": { implemented: false, reason: "get_related_docs is never called from the extension (no client method exists)" },
|
|
29
29
|
"search.history": { implemented: true, handler: "searchQuickPick.ts:searchHistory (in-memory)" },
|
|
30
30
|
// Graph
|
|
31
31
|
"graph.read": { implemented: true, handler: "graphWebview.ts:showGraphWebview" },
|
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
export const webUiManifest = {
|
|
2
2
|
surface: "web-ui",
|
|
3
|
-
version: "0.1.
|
|
3
|
+
version: "0.1.42",
|
|
4
4
|
actions: {
|
|
5
5
|
// Finding management
|
|
6
|
-
"finding.add": { implemented:
|
|
7
|
-
"finding.remove": { implemented:
|
|
8
|
-
"finding.list": { implemented: true, handler: "
|
|
6
|
+
"finding.add": { implemented: true, handler: "ui/server.ts:POST /api/findings/<project>" },
|
|
7
|
+
"finding.remove": { implemented: true, handler: "ui/server.ts:DELETE /api/findings/<project>" },
|
|
8
|
+
"finding.list": { implemented: true, handler: "ui/server.ts:/api/findings/<project> + /api/project-content" },
|
|
9
9
|
"finding.filter_by_date": { implemented: false, reason: "No date filter in web UI API" },
|
|
10
|
-
"finding.pin": { implemented: false, reason: "
|
|
10
|
+
"finding.pin": { implemented: false, reason: "Pinning to truths.md is CLI/MCP-only" },
|
|
11
11
|
// Task management
|
|
12
|
-
"task.add": { implemented:
|
|
13
|
-
"task.complete": { implemented:
|
|
14
|
-
"task.remove": { implemented:
|
|
15
|
-
"task.update": { implemented:
|
|
16
|
-
"task.list": { implemented: true, handler: "
|
|
17
|
-
"task.pin": { implemented: false, reason: "No task pinning in web UI" },
|
|
18
|
-
"task.github_link": { implemented: false, reason: "
|
|
12
|
+
"task.add": { implemented: true, handler: "ui/server.ts:POST /api/tasks/add" },
|
|
13
|
+
"task.complete": { implemented: true, handler: "ui/server.ts:POST /api/tasks/complete" },
|
|
14
|
+
"task.remove": { implemented: true, handler: "ui/server.ts:POST /api/tasks/remove" },
|
|
15
|
+
"task.update": { implemented: true, handler: "ui/server.ts:POST /api/tasks/update" },
|
|
16
|
+
"task.list": { implemented: true, handler: "ui/server.ts:/api/tasks" },
|
|
17
|
+
"task.pin": { implemented: false, reason: "No task pinning in web UI (pinned flag is displayed read-only)" },
|
|
18
|
+
"task.github_link": { implemented: false, reason: "Issue links display in the task list; creating them is MCP/VS Code-only" },
|
|
19
19
|
// Hook management
|
|
20
|
-
"hook.list": { implemented: true, handler: "
|
|
21
|
-
"hook.toggle": { implemented: true, handler: "
|
|
20
|
+
"hook.list": { implemented: true, handler: "ui/server.ts:/api/hooks" },
|
|
21
|
+
"hook.toggle": { implemented: true, handler: "ui/server.ts:POST /api/hook-toggle" },
|
|
22
22
|
"hook.toggle_per_project": { implemented: false, reason: "Per-project hook toggle not exposed in web UI" },
|
|
23
23
|
"hook.custom_crud": { implemented: false, reason: "Custom hooks CRUD not exposed in web UI" },
|
|
24
24
|
"hook.errors": { implemented: false, reason: "Hook errors not exposed in web UI" },
|
|
25
25
|
// Search
|
|
26
|
-
"search.fts": { implemented: true, handler: "
|
|
26
|
+
"search.fts": { implemented: true, handler: "ui/server.ts:/api/search" },
|
|
27
27
|
"search.fragment": { implemented: false, reason: "No fragment search in web UI" },
|
|
28
28
|
"search.related_docs": { implemented: false, reason: "No related docs in web UI" },
|
|
29
29
|
"search.history": { implemented: false, reason: "No search history in web UI" },
|
|
30
30
|
// Graph
|
|
31
|
-
"graph.read": { implemented: true, handler: "
|
|
32
|
-
"graph.visualize": { implemented: true, handler: "
|
|
31
|
+
"graph.read": { implemented: true, handler: "ui/server.ts:/api/graph" },
|
|
32
|
+
"graph.visualize": { implemented: true, handler: "ui/graph.ts:graph tab (browser/graph bundle — store>project>finding cages, Three.js / 3d-force-graph, CSS2D labels)" },
|
|
33
33
|
"graph.link_findings": { implemented: false, reason: "No link findings action in web UI" },
|
|
34
34
|
// Config
|
|
35
|
-
"config.get": { implemented: true, handler: "
|
|
36
|
-
"config.set": { implemented: true, handler: "
|
|
35
|
+
"config.get": { implemented: true, handler: "ui/server.ts:/api/settings + /api/config" },
|
|
36
|
+
"config.set": { implemented: true, handler: "ui/server.ts:POST /api/settings/* (workflow policy, task mode, proactivity, finding sensitivity, index policy, auto-capture, mcp-enabled, project overrides, RBAC via /api/settings/access)" },
|
|
37
37
|
// Health / Sync / Session
|
|
38
|
-
"health.check": { implemented: true, handler: "
|
|
38
|
+
"health.check": { implemented: true, handler: "ui/server.ts:/api/runtime-health" },
|
|
39
39
|
"health.doctor_fix": { implemented: false, reason: "Doctor --fix is CLI-only" },
|
|
40
|
-
"health.sync": { implemented: true, handler: "
|
|
40
|
+
"health.sync": { implemented: true, handler: "ui/server.ts:POST /api/sync" },
|
|
41
41
|
"session.start": { implemented: false, reason: "Session lifecycle is not web UI driven" },
|
|
42
42
|
"session.end": { implemented: false, reason: "Session lifecycle is not web UI driven" },
|
|
43
43
|
// Skill management
|
|
44
|
-
"skill.list": { implemented: true, handler: "
|
|
45
|
-
"skill.read": { implemented: true, handler: "
|
|
46
|
-
"skill.enable": { implemented: true, handler: "
|
|
47
|
-
"skill.write": { implemented: true, handler: "
|
|
44
|
+
"skill.list": { implemented: true, handler: "ui/server.ts:/api/skills" },
|
|
45
|
+
"skill.read": { implemented: true, handler: "ui/server.ts:/api/skill-content" },
|
|
46
|
+
"skill.enable": { implemented: true, handler: "ui/server.ts:POST /api/skill-toggle" },
|
|
47
|
+
"skill.write": { implemented: true, handler: "ui/server.ts:POST /api/skill-save" },
|
|
48
48
|
// Project management
|
|
49
|
-
"project.list": { implemented: true, handler: "
|
|
49
|
+
"project.list": { implemented: true, handler: "ui/server.ts:/api/projects" },
|
|
50
50
|
"project.manage": { implemented: false, reason: "No archive/unarchive in web UI" },
|
|
51
|
-
"project.summary": { implemented: true, handler: "
|
|
51
|
+
"project.summary": { implemented: true, handler: "ui/server.ts:/api/project-content" },
|
|
52
52
|
"export.project": { implemented: false, reason: "Export/import not exposed in web UI" },
|
|
53
53
|
"import.project": { implemented: false, reason: "Export/import not exposed in web UI" },
|
|
54
54
|
// Profile / Machine
|
|
55
|
-
"profile.switch": { implemented:
|
|
56
|
-
"profile.list": { implemented:
|
|
55
|
+
"profile.switch": { implemented: true, handler: "ui/server.ts:POST /api/profile" },
|
|
56
|
+
"profile.list": { implemented: true, handler: "ui/server.ts:/api/profiles" },
|
|
57
57
|
},
|
|
58
58
|
};
|
package/dist/cli/actions.js
CHANGED
|
@@ -15,19 +15,7 @@ import { runSearch, runFragmentSearch, parseFragmentSearchArgs, runRelatedDocs,
|
|
|
15
15
|
import { resolveRuntimeProfile } from "../runtime-profile.js";
|
|
16
16
|
import { getProjectConsolidationStatus, CONSOLIDATION_ENTRY_THRESHOLD } from "../content/validate.js";
|
|
17
17
|
import { listAllSessions } from "../tools/session.js";
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
const { getNonPrimaryStores } = require("../store-registry.js");
|
|
21
|
-
if (fs.existsSync(path.join(phrenPath, project)))
|
|
22
|
-
return phrenPath;
|
|
23
|
-
for (const store of getNonPrimaryStores(phrenPath)) {
|
|
24
|
-
if (fs.existsSync(path.join(store.path, project)))
|
|
25
|
-
return store.path;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
catch { /* fall through */ }
|
|
29
|
-
return phrenPath;
|
|
30
|
-
}
|
|
18
|
+
import { resolveProjectStorePath } from "./namespaces-utils.js";
|
|
31
19
|
async function runAndPrint(fn) {
|
|
32
20
|
const result = await fn();
|
|
33
21
|
if (result.lines.length > 0)
|
package/dist/cli/extract.js
CHANGED
|
@@ -2,7 +2,8 @@ import { debugLog, appendAuditLog, atomicWriteText, EXEC_TIMEOUT_MS, getPhrenPat
|
|
|
2
2
|
import { appendReviewQueue, getRetentionPolicy, recordFeedback, flushEntryScores, entryScoreKey, } from "../shared/governance.js";
|
|
3
3
|
import { detectProject } from "../shared/index.js";
|
|
4
4
|
import { commandExists } from "../hooks.js";
|
|
5
|
-
import { runGit as runGitShared, isFeatureEnabled, clampInt, errorMessage, isValidProjectName, resolveExecCommand
|
|
5
|
+
import { runGit as runGitShared, isFeatureEnabled, clampInt, errorMessage, isValidProjectName, resolveExecCommand } from "../utils.js";
|
|
6
|
+
import { storeAwareProjectPath } from "../store-routing.js";
|
|
6
7
|
import { appendFindingJournal, compactFindingJournals } from "../finding/journal.js";
|
|
7
8
|
import { findingQualityReason } from "../content/quality.js";
|
|
8
9
|
import { FINDINGS_FILENAME } from "../data/access.js";
|
|
@@ -310,7 +311,7 @@ function addMarkersFromJournal(file, into) {
|
|
|
310
311
|
*/
|
|
311
312
|
function readProcessedMemory(phrenPath, project) {
|
|
312
313
|
const memory = { commits: new Set(), subjects: new Set() };
|
|
313
|
-
const projectDir =
|
|
314
|
+
const projectDir = storeAwareProjectPath(phrenPath, project);
|
|
314
315
|
if (!projectDir)
|
|
315
316
|
return memory;
|
|
316
317
|
addMarkersFromFile(path.join(projectDir, "review.md"), memory);
|
package/dist/cli/hooks-output.js
CHANGED
|
@@ -3,7 +3,7 @@ import { getDocSourceKey, } from "../shared/index.js";
|
|
|
3
3
|
import { logImpact, extractFindingIdsFromSnippet, } from "../finding/impact.js";
|
|
4
4
|
import { isFeatureEnabled, errorMessage } from "../utils.js";
|
|
5
5
|
import { annotateStale } from "./hooks-citations.js";
|
|
6
|
-
import { approximateTokens, fileRelevanceBoost, branchMatchBoost } from "../shared/retrieval.js";
|
|
6
|
+
import { approximateTokens, fileRelevanceBoost, branchMatchBoost, SNIPPET_OVERHEAD_TOKENS } from "../shared/retrieval.js";
|
|
7
7
|
import { logger } from "../logger.js";
|
|
8
8
|
// ── Progressive disclosure helpers ────────────────────────────────────────────
|
|
9
9
|
function buildOneLiner(snippet) {
|
|
@@ -17,10 +17,13 @@ function buildOneLiner(snippet) {
|
|
|
17
17
|
}
|
|
18
18
|
function buildCompactIndex(selected, phrenPathLocal) {
|
|
19
19
|
const lines = [];
|
|
20
|
-
for (const { doc, snippet } of selected) {
|
|
20
|
+
for (const { doc, snippet, key } of selected) {
|
|
21
21
|
const id = `mem:${getDocSourceKey(doc, phrenPathLocal)}`;
|
|
22
22
|
const summary = buildOneLiner(snippet);
|
|
23
|
-
|
|
23
|
+
// The fb: key rides here too. memory_feedback's description promises it
|
|
24
|
+
// appears in injected headers without qualification, and this path renders
|
|
25
|
+
// instead of the full one whenever progressive disclosure is enabled.
|
|
26
|
+
lines.push(`[${id}] fb:${key} ${doc.type}: ${summary}`);
|
|
24
27
|
}
|
|
25
28
|
return lines;
|
|
26
29
|
}
|
|
@@ -78,14 +81,15 @@ export function buildHookOutput(selected, usedTokens, intent, gitCtx, detectedPr
|
|
|
78
81
|
let totalTokens = 36; // base overhead
|
|
79
82
|
const keep = ordered.map(() => true);
|
|
80
83
|
for (let i = 0; i < ordered.length; i++) {
|
|
81
|
-
|
|
84
|
+
// 24 ≈ header line ([source key] (type) fb:key) + blank separator.
|
|
85
|
+
totalTokens += approximateTokens(ordered[i].snippet) + SNIPPET_OVERHEAD_TOKENS;
|
|
82
86
|
}
|
|
83
87
|
// Trim from the middle (indices 1..N-2) if over budget
|
|
84
88
|
if (totalTokens > tokenBudget) {
|
|
85
89
|
for (let i = ordered.length - 2; i >= 1; i--) {
|
|
86
90
|
if (totalTokens <= tokenBudget)
|
|
87
91
|
break;
|
|
88
|
-
totalTokens -= approximateTokens(ordered[i].snippet) +
|
|
92
|
+
totalTokens -= approximateTokens(ordered[i].snippet) + SNIPPET_OVERHEAD_TOKENS;
|
|
89
93
|
keep[i] = false;
|
|
90
94
|
}
|
|
91
95
|
ordered = ordered.filter((_, i) => keep[i]);
|
|
@@ -109,7 +113,12 @@ export function buildHookOutput(selected, usedTokens, intent, gitCtx, detectedPr
|
|
|
109
113
|
catch (err) {
|
|
110
114
|
logger.debug("hooks-output", `injectContext recordRetrievalOrdered: ${errorMessage(err)}`);
|
|
111
115
|
}
|
|
112
|
-
|
|
116
|
+
// `fb:` is the memory_feedback handle. The tool scores entryScoreKey
|
|
117
|
+
// (project/filename:digest) — NOT the mem: source key and NOT an fid —
|
|
118
|
+
// and this header was the only place the injection pipeline had the
|
|
119
|
+
// key in hand; before it was printed here, the feedback loop was
|
|
120
|
+
// built, wired into ranking, and unreachable.
|
|
121
|
+
parts.push(`[${getDocSourceKey(doc, phrenPathLocal)}] (${doc.type}) fb:${key}`);
|
|
113
122
|
parts.push(annotateStale(snippet));
|
|
114
123
|
parts.push("");
|
|
115
124
|
}
|
package/dist/cli/hooks.js
CHANGED
|
@@ -34,7 +34,7 @@ export { handleHookSessionStart, handleHookStop, handleBackgroundSync, handleHoo
|
|
|
34
34
|
import { searchDocumentsAsync, applyTrustFilter, rankResults, selectSnippets, detectTaskIntent, } from "../shared/retrieval.js";
|
|
35
35
|
import { buildHookOutput } from "./hooks-output.js";
|
|
36
36
|
import { getGitContext, trackSessionMetrics, } from "./hooks-session.js";
|
|
37
|
-
import { approximateTokens } from "../shared/retrieval.js";
|
|
37
|
+
import { approximateTokens, SNIPPET_OVERHEAD_TOKENS } from "../shared/retrieval.js";
|
|
38
38
|
import { resolveRuntimeProfile } from "../runtime-profile.js";
|
|
39
39
|
import { handleTaskPromptLifecycle } from "../task/lifecycle.js";
|
|
40
40
|
// Auto-learn from prompts was removed — it learned conversational noise ("bro", "idk", typos)
|
|
@@ -206,7 +206,7 @@ export async function handleHookPrompt() {
|
|
|
206
206
|
const kept = [];
|
|
207
207
|
let runningTokens = 36;
|
|
208
208
|
for (const s of sorted) {
|
|
209
|
-
const est = approximateTokens(s.snippet) +
|
|
209
|
+
const est = approximateTokens(s.snippet) + SNIPPET_OVERHEAD_TOKENS;
|
|
210
210
|
if (runningTokens + est <= maxInjectTokens) {
|
|
211
211
|
kept.push(s);
|
|
212
212
|
runningTokens += est;
|
|
@@ -3,9 +3,9 @@ import * as path from "path";
|
|
|
3
3
|
import { execFileSync } from "child_process";
|
|
4
4
|
import { errorMessage } from "../utils.js";
|
|
5
5
|
import { logger } from "../logger.js";
|
|
6
|
+
import { getNonPrimaryStores } from "../store-registry.js";
|
|
6
7
|
export function resolveProjectStorePath(phrenPath, project) {
|
|
7
8
|
try {
|
|
8
|
-
const { getNonPrimaryStores } = require("../store-registry.js");
|
|
9
9
|
if (fs.existsSync(path.join(phrenPath, project)))
|
|
10
10
|
return phrenPath;
|
|
11
11
|
for (const store of getNonPrimaryStores(phrenPath)) {
|
package/dist/content/archive.js
CHANGED
|
@@ -2,7 +2,8 @@ import * as fs from "fs";
|
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import * as crypto from "crypto";
|
|
4
4
|
import { debugLog, runtimeFile, phrenOk, phrenErr, PhrenError, appendAuditLog, tryUnlink } from "../shared.js";
|
|
5
|
-
import { isValidProjectName,
|
|
5
|
+
import { isValidProjectName, errorMessage } from "../utils.js";
|
|
6
|
+
import { storeAwareProjectPath } from "../store-routing.js";
|
|
6
7
|
import { withFileLock } from "../shared/governance.js";
|
|
7
8
|
import { walkDirectory } from "../shared/data-utils.js";
|
|
8
9
|
import { appendArchivedEntriesToTopicDoc, classifyTopicForText, readProjectTopics, topicReferencePath } from "../project-topics.js";
|
|
@@ -114,7 +115,7 @@ function isAlreadyArchived(archivedSet, bullet) {
|
|
|
114
115
|
export function autoArchiveToReference(phrenPath, project, keepCount) {
|
|
115
116
|
if (!isValidProjectName(project))
|
|
116
117
|
return phrenErr(`Invalid project name: "${project}".`, PhrenError.INVALID_PROJECT_NAME);
|
|
117
|
-
const resolvedDir =
|
|
118
|
+
const resolvedDir = storeAwareProjectPath(phrenPath, project);
|
|
118
119
|
if (!resolvedDir || !fs.existsSync(resolvedDir))
|
|
119
120
|
return phrenErr(`Project "${project}" not found in phren.`, PhrenError.PROJECT_NOT_FOUND);
|
|
120
121
|
const learningsPath = path.join(resolvedDir, FINDINGS_FILENAME);
|
package/dist/content/dedup.js
CHANGED
|
@@ -2,7 +2,8 @@ import * as fs from "fs";
|
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import * as crypto from "crypto";
|
|
4
4
|
import { debugLog, runtimeFile, KNOWN_OBSERVATION_TAGS } from "../shared.js";
|
|
5
|
-
import { isFeatureEnabled,
|
|
5
|
+
import { isFeatureEnabled, errorMessage } from "../utils.js";
|
|
6
|
+
import { storeAwareProjectPath } from "../store-routing.js";
|
|
6
7
|
import { UNIVERSAL_TECH_TERMS_RE, EXTRA_FRAGMENT_PATTERNS } from "../phren-core.js";
|
|
7
8
|
import { isInactiveFindingLine } from "../finding/lifecycle.js";
|
|
8
9
|
import { logger } from "../logger.js";
|
|
@@ -443,7 +444,7 @@ export function resolveCoref(text, context) {
|
|
|
443
444
|
export async function checkSemanticDedup(phrenPath, project, newLearning, signal) {
|
|
444
445
|
if (!isFeatureEnabled("PHREN_FEATURE_SEMANTIC_DEDUP", false))
|
|
445
446
|
return false;
|
|
446
|
-
const resolvedDir =
|
|
447
|
+
const resolvedDir = storeAwareProjectPath(phrenPath, project);
|
|
447
448
|
if (!resolvedDir)
|
|
448
449
|
return false;
|
|
449
450
|
const findingsPath = path.join(resolvedDir, FINDINGS_FILENAME);
|
|
@@ -495,7 +496,7 @@ const CONFLICT_CHECK_TOTAL_TIMEOUT_MS = 30_000;
|
|
|
495
496
|
export async function checkSemanticConflicts(phrenPath, project, newFinding, signal) {
|
|
496
497
|
if (!isFeatureEnabled("PHREN_FEATURE_SEMANTIC_CONFLICT", false))
|
|
497
498
|
return { annotations: [], checked: false };
|
|
498
|
-
const resolvedDir =
|
|
499
|
+
const resolvedDir = storeAwareProjectPath(phrenPath, project);
|
|
499
500
|
if (!resolvedDir)
|
|
500
501
|
return { annotations: [], checked: false };
|
|
501
502
|
const newEntities = extractProseEntities(newFinding);
|
package/dist/content/learning.js
CHANGED
|
@@ -4,7 +4,8 @@ import * as crypto from "crypto";
|
|
|
4
4
|
import { debugLog, appendAuditLog, phrenOk, phrenErr, PhrenError } from "../shared.js";
|
|
5
5
|
import { normalizeMemoryScope } from "../shared.js";
|
|
6
6
|
import { withFileLock } from "../shared/governance.js";
|
|
7
|
-
import { isValidProjectName
|
|
7
|
+
import { isValidProjectName } from "../utils.js";
|
|
8
|
+
import { storeAwareProjectPath } from "../store-routing.js";
|
|
8
9
|
import { buildCitationComment, buildScopeComment, buildSourceComment, getHeadCommit, getRepoRoot, inferCitationLocation, } from "./citation.js";
|
|
9
10
|
import { isDuplicateFinding, scanForSecrets, normalizeObservationTags, resolveCoref } from "./dedup.js";
|
|
10
11
|
import { validateFindingsFormat, validateFinding } from "./validate.js";
|
|
@@ -199,7 +200,7 @@ function insertFindingIntoContent(content, today, bullet, citationComment) {
|
|
|
199
200
|
export function upsertCanonical(phrenPath, project, memory) {
|
|
200
201
|
if (!isValidProjectName(project))
|
|
201
202
|
return phrenErr(`Invalid project name: "${project}".`, PhrenError.INVALID_PROJECT_NAME);
|
|
202
|
-
const resolvedDir =
|
|
203
|
+
const resolvedDir = storeAwareProjectPath(phrenPath, project);
|
|
203
204
|
if (!resolvedDir || !fs.existsSync(resolvedDir))
|
|
204
205
|
return phrenErr(`Project "${project}" not found in phren.`, PhrenError.PROJECT_NOT_FOUND);
|
|
205
206
|
const canonicalPath = path.join(resolvedDir, "truths.md");
|
|
@@ -232,7 +233,7 @@ export function addFindingToFile(phrenPath, project, learning, citationInput, op
|
|
|
232
233
|
return phrenErr(findingError, PhrenError.EMPTY_INPUT);
|
|
233
234
|
if (!isValidProjectName(project))
|
|
234
235
|
return phrenErr(`Invalid project name: "${project}".`, PhrenError.INVALID_PROJECT_NAME);
|
|
235
|
-
const resolvedDir =
|
|
236
|
+
const resolvedDir = storeAwareProjectPath(phrenPath, project);
|
|
236
237
|
if (!resolvedDir)
|
|
237
238
|
return phrenErr(`Invalid project name: "${project}".`, PhrenError.INVALID_PROJECT_NAME);
|
|
238
239
|
const learningsPath = path.join(resolvedDir, FINDINGS_FILENAME);
|
|
@@ -384,7 +385,7 @@ export function addFindingToFile(phrenPath, project, learning, citationInput, op
|
|
|
384
385
|
export function addFindingsToFile(phrenPath, project, learnings, opts) {
|
|
385
386
|
if (!isValidProjectName(project))
|
|
386
387
|
return phrenErr(`Invalid project name: "${project}".`, PhrenError.INVALID_PROJECT_NAME);
|
|
387
|
-
const resolvedDir =
|
|
388
|
+
const resolvedDir = storeAwareProjectPath(phrenPath, project);
|
|
388
389
|
if (!resolvedDir)
|
|
389
390
|
return phrenErr(`Invalid project name: "${project}".`, PhrenError.INVALID_PROJECT_NAME);
|
|
390
391
|
const learningsPath = path.join(resolvedDir, FINDINGS_FILENAME);
|
package/dist/content/secrets.js
CHANGED
|
@@ -101,7 +101,10 @@ export function scanForSecrets(text) {
|
|
|
101
101
|
return 'Slack webhook URL';
|
|
102
102
|
// Long base64-encoded secret-like blob (requires base64 chars including +/= and must not be
|
|
103
103
|
// a plain hex digest like a git commit SHA — 40-char lowercase hex is explicitly exempt).
|
|
104
|
-
|
|
104
|
+
// Also requires a digit: 40 random base64 chars lack one ~0.1% of the time, while
|
|
105
|
+
// slash-joined camelCase identifier chains ("addFooToBar/addFoosToBar/upsertBaz") never
|
|
106
|
+
// have one — that prose shape was being rejected as a credential.
|
|
107
|
+
if (!/^[0-9a-f]{40}$/.test(text) && /(?=[A-Za-z0-9+/]*[+/])(?=[A-Za-z+/]*[0-9])[A-Za-z0-9+/]{40,}={0,2}/.test(text.replace(/[0-9a-f]{40}/g, "")))
|
|
105
108
|
return 'long base64 secret';
|
|
106
109
|
// Connection string with credentials
|
|
107
110
|
if (/(mongodb|postgres|mysql|redis):\/\/[^@\s]+:[^@\s]+@/i.test(text))
|
package/dist/data/access.js
CHANGED
|
@@ -7,7 +7,7 @@ import * as yaml from "js-yaml";
|
|
|
7
7
|
import { appendAuditLog, phrenErr, PhrenError, phrenOk, forwardErr, getProjectDirs, isRecord, } from "../shared.js";
|
|
8
8
|
import { normalizeQueueEntryText, } from "../shared/governance.js";
|
|
9
9
|
import { addFindingToFile, } from "../shared/content.js";
|
|
10
|
-
import { isValidProjectName,
|
|
10
|
+
import { isValidProjectName, QUEUE_FILENAME, safeProjectPath } from "../utils.js";
|
|
11
11
|
import { parseCitationComment, parseScopeComment, parseSourceComment, } from "../content/citation.js";
|
|
12
12
|
import { parseFindingLifecycle, } from "../finding/lifecycle.js";
|
|
13
13
|
import { METADATA_REGEX, isCitationLine, isArchiveStart, isArchiveEnd, parseFindingId, parseAllContradictions, stripComments, normalizeFindingText, } from "../content/metadata.js";
|
|
@@ -303,7 +303,7 @@ export function removeFinding(phrenPath, project, match) {
|
|
|
303
303
|
if (!ensured.ok)
|
|
304
304
|
return forwardErr(ensured);
|
|
305
305
|
const findingsPath = path.resolve(path.join(ensured.data, FINDINGS_FILENAME));
|
|
306
|
-
if (!findingsPath.startsWith(
|
|
306
|
+
if (!findingsPath.startsWith(path.resolve(ensured.data) + path.sep)) {
|
|
307
307
|
return phrenErr(`${FINDINGS_FILENAME} path escapes phren store`, PhrenError.VALIDATION_ERROR);
|
|
308
308
|
}
|
|
309
309
|
const filePath = findingsPath;
|
|
@@ -340,7 +340,7 @@ export function removeFindings(phrenPath, project, matches) {
|
|
|
340
340
|
if (!ensured.ok)
|
|
341
341
|
return forwardErr(ensured);
|
|
342
342
|
const findingsPath = path.resolve(path.join(ensured.data, FINDINGS_FILENAME));
|
|
343
|
-
if (!findingsPath.startsWith(
|
|
343
|
+
if (!findingsPath.startsWith(path.resolve(ensured.data) + path.sep)) {
|
|
344
344
|
return phrenErr(`${FINDINGS_FILENAME} path escapes phren store`, PhrenError.VALIDATION_ERROR);
|
|
345
345
|
}
|
|
346
346
|
if (!fs.existsSync(findingsPath))
|
|
@@ -394,7 +394,7 @@ export function editFinding(phrenPath, project, oldText, newText) {
|
|
|
394
394
|
if (!newTextTrimmed)
|
|
395
395
|
return phrenErr("New finding text cannot be empty.", PhrenError.EMPTY_INPUT);
|
|
396
396
|
const findingsPath = path.resolve(path.join(ensured.data, FINDINGS_FILENAME));
|
|
397
|
-
if (!findingsPath.startsWith(
|
|
397
|
+
if (!findingsPath.startsWith(path.resolve(ensured.data) + path.sep)) {
|
|
398
398
|
return phrenErr(`${FINDINGS_FILENAME} path escapes phren store`, PhrenError.VALIDATION_ERROR);
|
|
399
399
|
}
|
|
400
400
|
if (!fs.existsSync(findingsPath))
|
|
@@ -432,8 +432,9 @@ export function editFinding(phrenPath, project, oldText, newText) {
|
|
|
432
432
|
return phrenOk(`Updated finding in ${project}`);
|
|
433
433
|
});
|
|
434
434
|
}
|
|
435
|
-
//
|
|
436
|
-
|
|
435
|
+
// Queue paths derive from the store-resolved project dir (ensureProject),
|
|
436
|
+
// so secondary-store projects hit their own store's review.md.
|
|
437
|
+
const queuePath = (projectDir) => path.join(projectDir, QUEUE_FILENAME);
|
|
437
438
|
function parseQueueLine(line) {
|
|
438
439
|
const parsed = line.match(/^- \[(\d{4}-\d{2}-\d{2})\]\s*(.+)$/);
|
|
439
440
|
const rawText = parsed ? parsed[2] : line.replace(/^-\s+/, "").trim();
|
|
@@ -457,7 +458,7 @@ export function readReviewQueue(phrenPath, project) {
|
|
|
457
458
|
const ensured = ensureProject(phrenPath, project);
|
|
458
459
|
if (!ensured.ok)
|
|
459
460
|
return forwardErr(ensured);
|
|
460
|
-
const file = queuePath(
|
|
461
|
+
const file = queuePath(ensured.data);
|
|
461
462
|
if (!fs.existsSync(file))
|
|
462
463
|
return phrenOk([]);
|
|
463
464
|
const lines = fs.readFileSync(file, "utf8").split("\n");
|
|
@@ -506,7 +507,7 @@ function withQueueLineOp(phrenPath, project, lineText, op) {
|
|
|
506
507
|
const ensured = ensureProject(phrenPath, project);
|
|
507
508
|
if (!ensured.ok)
|
|
508
509
|
return forwardErr(ensured);
|
|
509
|
-
const file = queuePath(
|
|
510
|
+
const file = queuePath(ensured.data);
|
|
510
511
|
if (!fs.existsSync(file))
|
|
511
512
|
return phrenErr(`No review queue found for "${project}".`, PhrenError.FILE_NOT_FOUND);
|
|
512
513
|
return withSafeLock(file, () => {
|
|
@@ -535,7 +536,7 @@ function locateQueueLine(phrenPath, project, lineText) {
|
|
|
535
536
|
const ensured = ensureProject(phrenPath, project);
|
|
536
537
|
if (!ensured.ok)
|
|
537
538
|
return forwardErr(ensured);
|
|
538
|
-
const file = queuePath(
|
|
539
|
+
const file = queuePath(ensured.data);
|
|
539
540
|
if (!fs.existsSync(file))
|
|
540
541
|
return phrenErr(`No review queue found for "${project}".`, PhrenError.FILE_NOT_FOUND);
|
|
541
542
|
const lines = fs.readFileSync(file, "utf8").split("\n");
|
package/dist/data/tasks.js
CHANGED
|
@@ -3,9 +3,9 @@ import * as path from "path";
|
|
|
3
3
|
import { randomBytes, randomUUID } from "crypto";
|
|
4
4
|
import { phrenErr, PhrenError, phrenOk, forwardErr, getProjectDirs, } from "../shared.js";
|
|
5
5
|
import { validateTaskFormat } from "../shared/content.js";
|
|
6
|
-
import { safeProjectPath } from "../utils.js";
|
|
7
6
|
import { withSafeLock, ensureProject } from "../shared/data-utils.js";
|
|
8
7
|
import { getNonPrimaryStores, getStoreProjectDirs } from "../store-registry.js";
|
|
8
|
+
import { storeAwareProjectPath } from "../store-routing.js";
|
|
9
9
|
const ACTIVE_HEADINGS = new Set(["active", "in progress", "in-progress", "current", "wip"]);
|
|
10
10
|
const QUEUE_HEADINGS = new Set(["queue", "queued", "task", "todo", "upcoming", "next"]);
|
|
11
11
|
const DONE_HEADINGS = new Set(["done", "completed", "finished", "archived"]);
|
|
@@ -166,10 +166,9 @@ export function applyGravity(items) {
|
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
export function canonicalTaskFilePath(phrenPath, project) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
return path.join(resolved, TASKS_FILENAME);
|
|
169
|
+
// Store-aware: locks and writes must target the owning store's file, not a
|
|
170
|
+
// phantom primary-store path.
|
|
171
|
+
return storeAwareProjectPath(phrenPath, project, TASKS_FILENAME);
|
|
173
172
|
}
|
|
174
173
|
export function isTaskFileName(filename) {
|
|
175
174
|
return filename.toLowerCase() === TASKS_FILENAME;
|
|
@@ -480,6 +479,9 @@ export function completeTasks(phrenPath, project, matches) {
|
|
|
480
479
|
const bPath = canonicalTaskFilePath(phrenPath, project);
|
|
481
480
|
if (!bPath)
|
|
482
481
|
return phrenErr(`Project name "${project}" is not valid.`, PhrenError.INVALID_PROJECT_NAME);
|
|
482
|
+
const preCheck = ensureProject(phrenPath, project);
|
|
483
|
+
if (!preCheck.ok)
|
|
484
|
+
return forwardErr(preCheck);
|
|
483
485
|
return withSafeLock(bPath, () => {
|
|
484
486
|
const parsed = readTasks(phrenPath, project);
|
|
485
487
|
if (!parsed.ok)
|
|
@@ -506,6 +508,9 @@ export function completeTask(phrenPath, project, match) {
|
|
|
506
508
|
const bPath = canonicalTaskFilePath(phrenPath, project);
|
|
507
509
|
if (!bPath)
|
|
508
510
|
return phrenErr(`Project name "${project}" is not valid.`, PhrenError.INVALID_PROJECT_NAME);
|
|
511
|
+
const preCheck = ensureProject(phrenPath, project);
|
|
512
|
+
if (!preCheck.ok)
|
|
513
|
+
return forwardErr(preCheck);
|
|
509
514
|
return withSafeLock(bPath, () => {
|
|
510
515
|
const parsed = readTasks(phrenPath, project);
|
|
511
516
|
if (!parsed.ok)
|
|
@@ -527,6 +532,9 @@ export function removeTask(phrenPath, project, match) {
|
|
|
527
532
|
const bPath = canonicalTaskFilePath(phrenPath, project);
|
|
528
533
|
if (!bPath)
|
|
529
534
|
return phrenErr(`Project name "${project}" is not valid.`, PhrenError.INVALID_PROJECT_NAME);
|
|
535
|
+
const preCheck = ensureProject(phrenPath, project);
|
|
536
|
+
if (!preCheck.ok)
|
|
537
|
+
return forwardErr(preCheck);
|
|
530
538
|
return withSafeLock(bPath, () => {
|
|
531
539
|
const parsed = readTasks(phrenPath, project);
|
|
532
540
|
if (!parsed.ok)
|
|
@@ -545,6 +553,9 @@ export function removeTasks(phrenPath, project, matches) {
|
|
|
545
553
|
const bPath = canonicalTaskFilePath(phrenPath, project);
|
|
546
554
|
if (!bPath)
|
|
547
555
|
return phrenErr(`Project name "${project}" is not valid.`, PhrenError.INVALID_PROJECT_NAME);
|
|
556
|
+
const preCheck = ensureProject(phrenPath, project);
|
|
557
|
+
if (!preCheck.ok)
|
|
558
|
+
return forwardErr(preCheck);
|
|
548
559
|
return withSafeLock(bPath, () => {
|
|
549
560
|
const parsed = readTasks(phrenPath, project);
|
|
550
561
|
if (!parsed.ok)
|
|
@@ -568,6 +579,9 @@ export function updateTask(phrenPath, project, match, updates) {
|
|
|
568
579
|
const bPath = canonicalTaskFilePath(phrenPath, project);
|
|
569
580
|
if (!bPath)
|
|
570
581
|
return phrenErr(`Project name "${project}" is not valid.`, PhrenError.INVALID_PROJECT_NAME);
|
|
582
|
+
const preCheck = ensureProject(phrenPath, project);
|
|
583
|
+
if (!preCheck.ok)
|
|
584
|
+
return forwardErr(preCheck);
|
|
571
585
|
return withSafeLock(bPath, () => {
|
|
572
586
|
const parsed = readTasks(phrenPath, project);
|
|
573
587
|
if (!parsed.ok)
|
|
@@ -648,6 +662,9 @@ export function pinTask(phrenPath, project, match) {
|
|
|
648
662
|
const bPath = canonicalTaskFilePath(phrenPath, project);
|
|
649
663
|
if (!bPath)
|
|
650
664
|
return phrenErr(`Project name "${project}" is not valid.`, PhrenError.INVALID_PROJECT_NAME);
|
|
665
|
+
const preCheck = ensureProject(phrenPath, project);
|
|
666
|
+
if (!preCheck.ok)
|
|
667
|
+
return forwardErr(preCheck);
|
|
651
668
|
return withSafeLock(bPath, () => {
|
|
652
669
|
const parsed = readTasks(phrenPath, project);
|
|
653
670
|
if (!parsed.ok)
|
|
@@ -673,6 +690,9 @@ export function unpinTask(phrenPath, project, match) {
|
|
|
673
690
|
const bPath = canonicalTaskFilePath(phrenPath, project);
|
|
674
691
|
if (!bPath)
|
|
675
692
|
return phrenErr(`Project name "${project}" is not valid.`, PhrenError.INVALID_PROJECT_NAME);
|
|
693
|
+
const preCheck = ensureProject(phrenPath, project);
|
|
694
|
+
if (!preCheck.ok)
|
|
695
|
+
return forwardErr(preCheck);
|
|
676
696
|
return withSafeLock(bPath, () => {
|
|
677
697
|
const parsed = readTasks(phrenPath, project);
|
|
678
698
|
if (!parsed.ok)
|
|
@@ -695,6 +715,9 @@ export function reorderTask(phrenPath, project, match, targetRank) {
|
|
|
695
715
|
const bPath = canonicalTaskFilePath(phrenPath, project);
|
|
696
716
|
if (!bPath)
|
|
697
717
|
return phrenErr(`Project name "${project}" is not valid.`, PhrenError.INVALID_PROJECT_NAME);
|
|
718
|
+
const preCheck = ensureProject(phrenPath, project);
|
|
719
|
+
if (!preCheck.ok)
|
|
720
|
+
return forwardErr(preCheck);
|
|
698
721
|
return withSafeLock(bPath, () => {
|
|
699
722
|
const parsed = readTasks(phrenPath, project);
|
|
700
723
|
if (!parsed.ok)
|
|
@@ -732,6 +755,9 @@ export function appendChildFinding(phrenPath, project, match, findingId) {
|
|
|
732
755
|
const bPath = canonicalTaskFilePath(phrenPath, project);
|
|
733
756
|
if (!bPath)
|
|
734
757
|
return phrenErr(`Project name "${project}" is not valid.`, PhrenError.INVALID_PROJECT_NAME);
|
|
758
|
+
const preCheck = ensureProject(phrenPath, project);
|
|
759
|
+
if (!preCheck.ok)
|
|
760
|
+
return forwardErr(preCheck);
|
|
735
761
|
return withSafeLock(bPath, () => {
|
|
736
762
|
const parsed = readTasks(phrenPath, project);
|
|
737
763
|
if (!parsed.ok)
|
|
@@ -752,6 +778,9 @@ export function promoteTask(phrenPath, project, match, moveToActive) {
|
|
|
752
778
|
const bPath = canonicalTaskFilePath(phrenPath, project);
|
|
753
779
|
if (!bPath)
|
|
754
780
|
return phrenErr(`Project name "${project}" is not valid.`, PhrenError.INVALID_PROJECT_NAME);
|
|
781
|
+
const preCheck = ensureProject(phrenPath, project);
|
|
782
|
+
if (!preCheck.ok)
|
|
783
|
+
return forwardErr(preCheck);
|
|
755
784
|
return withSafeLock(bPath, () => {
|
|
756
785
|
const parsed = readTasks(phrenPath, project);
|
|
757
786
|
if (!parsed.ok)
|
|
@@ -777,6 +806,9 @@ export function workNextTask(phrenPath, project) {
|
|
|
777
806
|
const bPath = canonicalTaskFilePath(phrenPath, project);
|
|
778
807
|
if (!bPath)
|
|
779
808
|
return phrenErr(`Project name "${project}" is not valid.`, PhrenError.INVALID_PROJECT_NAME);
|
|
809
|
+
const preCheck = ensureProject(phrenPath, project);
|
|
810
|
+
if (!preCheck.ok)
|
|
811
|
+
return forwardErr(preCheck);
|
|
780
812
|
return withSafeLock(bPath, () => {
|
|
781
813
|
const parsed = readTasks(phrenPath, project);
|
|
782
814
|
if (!parsed.ok)
|
|
@@ -802,6 +834,9 @@ export function tidyDoneTasks(phrenPath, project, keep = 30, dryRun) {
|
|
|
802
834
|
const bPath = canonicalTaskFilePath(phrenPath, project);
|
|
803
835
|
if (!bPath)
|
|
804
836
|
return phrenErr(`Project name "${project}" is not valid.`, PhrenError.INVALID_PROJECT_NAME);
|
|
837
|
+
const preCheck = ensureProject(phrenPath, project);
|
|
838
|
+
if (!preCheck.ok)
|
|
839
|
+
return forwardErr(preCheck);
|
|
805
840
|
return withSafeLock(bPath, () => {
|
|
806
841
|
const parsed = readTasks(phrenPath, project);
|
|
807
842
|
if (!parsed.ok)
|
|
@@ -815,7 +850,9 @@ export function tidyDoneTasks(phrenPath, project, keep = 30, dryRun) {
|
|
|
815
850
|
return phrenOk(`[dry-run] Would archive ${archived.length} done item(s) for ${project}, keeping ${safeKeep}.`);
|
|
816
851
|
}
|
|
817
852
|
parsed.data.items.Done = parsed.data.items.Done.slice(0, safeKeep);
|
|
818
|
-
|
|
853
|
+
// Archive into the store that owns the tasks file (bPath = <store>/<project>/tasks.md),
|
|
854
|
+
// so secondary-store task history never lands in the primary store's .config.
|
|
855
|
+
const archiveFile = taskArchivePath(path.dirname(path.dirname(bPath)), project);
|
|
819
856
|
fs.mkdirSync(path.dirname(archiveFile), { recursive: true });
|
|
820
857
|
const stamp = new Date().toISOString();
|
|
821
858
|
const lines = archived.map((item) => `- [x] ${item.line}${item.context ? `\n Context: ${item.context}` : ""}`);
|
|
@@ -835,6 +872,9 @@ export function linkTaskIssue(phrenPath, project, match, link) {
|
|
|
835
872
|
const bPath = canonicalTaskFilePath(phrenPath, project);
|
|
836
873
|
if (!bPath)
|
|
837
874
|
return phrenErr(`Project name "${project}" is not valid.`, PhrenError.INVALID_PROJECT_NAME);
|
|
875
|
+
const preCheck = ensureProject(phrenPath, project);
|
|
876
|
+
if (!preCheck.ok)
|
|
877
|
+
return forwardErr(preCheck);
|
|
838
878
|
return withSafeLock(bPath, () => {
|
|
839
879
|
const parsed = readTasks(phrenPath, project);
|
|
840
880
|
if (!parsed.ok)
|
|
@@ -4,7 +4,8 @@ import { PhrenError, phrenErr, phrenOk } from "../phren-core.js";
|
|
|
4
4
|
// Phren lifecycle comment prefix. No backward compat.
|
|
5
5
|
const LIFECYCLE_PREFIX = "phren";
|
|
6
6
|
import { withFileLock } from "../shared/governance.js";
|
|
7
|
-
import { isValidProjectName
|
|
7
|
+
import { isValidProjectName } from "../utils.js";
|
|
8
|
+
import { storeAwareProjectPath } from "../store-routing.js";
|
|
8
9
|
import { isArchiveEnd, isArchiveStart, parseCreatedDate as parseCreatedDateMeta, parseStatusField, parseStatus, parseSupersession, parseContradiction, parseFindingId as parseFindingIdMeta, stripLifecycleMetadata, stripRelationMetadata, normalizeFindingText, } from "../content/metadata.js";
|
|
9
10
|
import { FINDINGS_FILENAME } from "../data/access.js";
|
|
10
11
|
/**
|
|
@@ -206,7 +207,7 @@ function matchFinding(lines, match) {
|
|
|
206
207
|
function findingsPathForProject(phrenPath, project) {
|
|
207
208
|
if (!isValidProjectName(project))
|
|
208
209
|
return phrenErr(`Invalid project name: "${project}"`, PhrenError.INVALID_PROJECT_NAME);
|
|
209
|
-
const projectDir =
|
|
210
|
+
const projectDir = storeAwareProjectPath(phrenPath, project);
|
|
210
211
|
if (!projectDir)
|
|
211
212
|
return phrenErr(`Invalid project name: "${project}"`, PhrenError.INVALID_PROJECT_NAME);
|
|
212
213
|
if (!fs.existsSync(projectDir))
|