@phren/cli 0.3.64 → 0.3.66
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/bridge/changes.d.ts +22 -0
- package/dist/bridge/changes.js +323 -82
- package/dist/bridge/usage.d.ts +7 -0
- package/dist/bridge/usage.js +18 -1
- package/dist/bridge-hook.mjs +346 -132
- package/dist/governance/policy.js +4 -3
- package/dist/governance/scores.js +2 -1
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ import { storeAwareProjectPath } from "../store-routing.js";
|
|
|
8
8
|
import { readProjectConfig } from "../project-config.js";
|
|
9
9
|
import { getActiveProfileDefaults } from "../profile-store.js";
|
|
10
10
|
import { runCustomHooks } from "../hooks.js";
|
|
11
|
+
import { renameOverSync } from "../phren-paths.js";
|
|
11
12
|
import { METADATA_REGEX, isCitationLine, isArchiveStart as isArchiveStartMeta, isArchiveEnd as isArchiveEndMeta, stripLifecycleMetadata as stripLifecycleMetadataMeta, } from "../content/metadata.js";
|
|
12
13
|
import { findingAgeLimitDays } from "../content/citation.js";
|
|
13
14
|
import { VALID_FINDING_SENSITIVITY, VALID_PROACTIVITY_LEVELS, VALID_TASK_MODES, VALID_RISKY_SECTIONS, } from "./policy-constants.js";
|
|
@@ -504,7 +505,7 @@ function writeJsonFileUnlocked(filePath, data) {
|
|
|
504
505
|
fs.mkdirSync(dir, { recursive: true });
|
|
505
506
|
const tmpPath = path.join(dir, `.tmp-${crypto.randomUUID()}`);
|
|
506
507
|
fs.writeFileSync(tmpPath, JSON.stringify(data, null, 2) + "\n");
|
|
507
|
-
|
|
508
|
+
renameOverSync(tmpPath, filePath);
|
|
508
509
|
}
|
|
509
510
|
function getRetentionPolicyGlobal(phrenPath) {
|
|
510
511
|
const parsed = readJsonFile(govFile(phrenPath, "retention-policy"), {});
|
|
@@ -904,7 +905,7 @@ export function pruneDeadMemories(phrenPath, project, dryRun) {
|
|
|
904
905
|
if (!dryRun) {
|
|
905
906
|
const tmpFile = file + `.tmp-${crypto.randomUUID()}`;
|
|
906
907
|
fs.writeFileSync(tmpFile, next.join("\n").replace(/\n{3,}/g, "\n\n").trimEnd() + "\n");
|
|
907
|
-
|
|
908
|
+
renameOverSync(tmpFile, file);
|
|
908
909
|
}
|
|
909
910
|
});
|
|
910
911
|
}
|
|
@@ -1066,7 +1067,7 @@ export function consolidateProjectFindings(phrenPath, project, dryRun) {
|
|
|
1066
1067
|
fs.copyFileSync(file, file + ".bak");
|
|
1067
1068
|
const tmpFile = file + `.tmp-${crypto.randomUUID()}`;
|
|
1068
1069
|
fs.writeFileSync(tmpFile, out.join("\n").trimEnd() + "\n");
|
|
1069
|
-
|
|
1070
|
+
renameOverSync(tmpFile, file);
|
|
1070
1071
|
appendAuditLog(phrenPath, "consolidate_project", `project=${project} dates=${dates.length}`);
|
|
1071
1072
|
return phrenOk(`Consolidated findings for ${project}.`);
|
|
1072
1073
|
});
|
|
@@ -5,6 +5,7 @@ import { appendAuditLog, debugLog, isRecord, memoryScoresFile, memoryUsageLogFil
|
|
|
5
5
|
import { withFileLock, isFiniteNumber, hasValidSchemaVersion } from "../shared/governance.js";
|
|
6
6
|
import { errorMessage } from "../utils.js";
|
|
7
7
|
import { logger } from "../logger.js";
|
|
8
|
+
import { renameOverSync } from "../phren-paths.js";
|
|
8
9
|
const MAX_LOG_LINES = 1000;
|
|
9
10
|
const GOVERNANCE_SCHEMA_VERSION = 1;
|
|
10
11
|
const DEFAULT_MEMORY_SCORES_FILE = {
|
|
@@ -80,7 +81,7 @@ function writeScoresFile(phrenPath, scores) {
|
|
|
80
81
|
schemaVersion: GOVERNANCE_SCHEMA_VERSION,
|
|
81
82
|
entries: scores,
|
|
82
83
|
}, null, 2) + "\n");
|
|
83
|
-
|
|
84
|
+
renameOverSync(tmpPath, file);
|
|
84
85
|
});
|
|
85
86
|
}
|
|
86
87
|
let scoresCache = null;
|