@unbrained/pm-cli 2026.5.18 → 2026.5.24
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/CHANGELOG.md +60 -0
- package/README.md +2 -1
- package/dist/cli/commander-usage.js +16 -2
- package/dist/cli/commander-usage.js.map +1 -1
- package/dist/cli/commands/annotation-command.d.ts +49 -0
- package/dist/cli/commands/annotation-command.js +135 -0
- package/dist/cli/commands/annotation-command.js.map +1 -0
- package/dist/cli/commands/append.js +3 -7
- package/dist/cli/commands/append.js.map +1 -1
- package/dist/cli/commands/calendar.js +3 -6
- package/dist/cli/commands/calendar.js.map +1 -1
- package/dist/cli/commands/claim.js +12 -22
- package/dist/cli/commands/claim.js.map +1 -1
- package/dist/cli/commands/close.js +61 -9
- package/dist/cli/commands/close.js.map +1 -1
- package/dist/cli/commands/comments.d.ts +5 -0
- package/dist/cli/commands/comments.js +27 -117
- package/dist/cli/commands/comments.js.map +1 -1
- package/dist/cli/commands/completion.js +102 -15
- package/dist/cli/commands/completion.js.map +1 -1
- package/dist/cli/commands/context.js +4 -10
- package/dist/cli/commands/context.js.map +1 -1
- package/dist/cli/commands/contracts.js +168 -36
- package/dist/cli/commands/contracts.js.map +1 -1
- package/dist/cli/commands/create.js +49 -44
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/dedupe-audit.js +7 -4
- package/dist/cli/commands/dedupe-audit.js.map +1 -1
- package/dist/cli/commands/delete.d.ts +3 -0
- package/dist/cli/commands/delete.js +9 -8
- package/dist/cli/commands/delete.js.map +1 -1
- package/dist/cli/commands/docs.d.ts +1 -0
- package/dist/cli/commands/docs.js +4 -8
- package/dist/cli/commands/docs.js.map +1 -1
- package/dist/cli/commands/event-validation-messages.d.ts +3 -0
- package/dist/cli/commands/event-validation-messages.js +44 -0
- package/dist/cli/commands/event-validation-messages.js.map +1 -0
- package/dist/cli/commands/extension.d.ts +1 -0
- package/dist/cli/commands/extension.js +138 -21
- package/dist/cli/commands/extension.js.map +1 -1
- package/dist/cli/commands/files.js +6 -13
- package/dist/cli/commands/files.js.map +1 -1
- package/dist/cli/commands/gc.js +17 -4
- package/dist/cli/commands/gc.js.map +1 -1
- package/dist/cli/commands/get.d.ts +3 -2
- package/dist/cli/commands/get.js +50 -8
- package/dist/cli/commands/get.js.map +1 -1
- package/dist/cli/commands/health.d.ts +10 -0
- package/dist/cli/commands/health.js +254 -75
- package/dist/cli/commands/health.js.map +1 -1
- package/dist/cli/commands/history-redact.d.ts +8 -0
- package/dist/cli/commands/history-redact.js +14 -97
- package/dist/cli/commands/history-redact.js.map +1 -1
- package/dist/cli/commands/history-repair.d.ts +33 -0
- package/dist/cli/commands/history-repair.js +166 -0
- package/dist/cli/commands/history-repair.js.map +1 -0
- package/dist/cli/commands/history.d.ts +4 -4
- package/dist/cli/commands/history.js +10 -88
- package/dist/cli/commands/history.js.map +1 -1
- package/dist/cli/commands/index.d.ts +3 -1
- package/dist/cli/commands/index.js +5 -3
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/init.d.ts +28 -0
- package/dist/cli/commands/init.js +23 -2
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/learnings.js +20 -119
- package/dist/cli/commands/learnings.js.map +1 -1
- package/dist/cli/commands/linked-test-entry.d.ts +3 -0
- package/dist/cli/commands/linked-test-entry.js +62 -0
- package/dist/cli/commands/linked-test-entry.js.map +1 -0
- package/dist/cli/commands/list.js +32 -22
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/notes.js +20 -119
- package/dist/cli/commands/notes.js.map +1 -1
- package/dist/cli/commands/plan.d.ts +3 -0
- package/dist/cli/commands/plan.js +184 -22
- package/dist/cli/commands/plan.js.map +1 -1
- package/dist/cli/commands/restore.js +7 -50
- package/dist/cli/commands/restore.js.map +1 -1
- package/dist/cli/commands/schema.d.ts +31 -0
- package/dist/cli/commands/schema.js +98 -0
- package/dist/cli/commands/schema.js.map +1 -0
- package/dist/cli/commands/search.js +151 -40
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/templates.d.ts +4 -0
- package/dist/cli/commands/templates.js +89 -17
- package/dist/cli/commands/templates.js.map +1 -1
- package/dist/cli/commands/test-all.js +4 -8
- package/dist/cli/commands/test-all.js.map +1 -1
- package/dist/cli/commands/test.d.ts +1 -0
- package/dist/cli/commands/test.js +7 -10
- package/dist/cli/commands/test.js.map +1 -1
- package/dist/cli/commands/update-many.js +4 -8
- package/dist/cli/commands/update-many.js.map +1 -1
- package/dist/cli/commands/update.js +109 -51
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/commands/validate.d.ts +3 -1
- package/dist/cli/commands/validate.js +23 -71
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/error-guidance.js +96 -6
- package/dist/cli/error-guidance.js.map +1 -1
- package/dist/cli/extension-command-help.d.ts +0 -1
- package/dist/cli/extension-command-help.js +2 -13
- package/dist/cli/extension-command-help.js.map +1 -1
- package/dist/cli/extension-command-options.d.ts +1 -0
- package/dist/cli/extension-command-options.js +106 -7
- package/dist/cli/extension-command-options.js.map +1 -1
- package/dist/cli/help-content.d.ts +0 -1
- package/dist/cli/help-content.js +13 -9
- package/dist/cli/help-content.js.map +1 -1
- package/dist/cli/help-json-payload.d.ts +1 -0
- package/dist/cli/help-json-payload.js +33 -3
- package/dist/cli/help-json-payload.js.map +1 -1
- package/dist/cli/main.js +35 -29
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/register-list-query.d.ts +1 -1
- package/dist/cli/register-list-query.js +40 -17
- package/dist/cli/register-list-query.js.map +1 -1
- package/dist/cli/register-mutation.d.ts +1 -1
- package/dist/cli/register-mutation.js +232 -64
- package/dist/cli/register-mutation.js.map +1 -1
- package/dist/cli/register-operations.js +16 -11
- package/dist/cli/register-operations.js.map +1 -1
- package/dist/cli/register-setup.js +26 -14
- package/dist/cli/register-setup.js.map +1 -1
- package/dist/cli/registration-helpers.d.ts +0 -2
- package/dist/cli/registration-helpers.js +13 -40
- package/dist/cli/registration-helpers.js.map +1 -1
- package/dist/cli.js +23 -3
- package/dist/cli.js.map +1 -1
- package/dist/core/extensions/index.d.ts +0 -1
- package/dist/core/extensions/index.js +2 -14
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.js +3 -9
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/fs/path-utils.d.ts +1 -0
- package/dist/core/fs/path-utils.js +12 -0
- package/dist/core/fs/path-utils.js.map +1 -0
- package/dist/core/history/drift-scan.d.ts +11 -0
- package/dist/core/history/drift-scan.js +67 -0
- package/dist/core/history/drift-scan.js.map +1 -0
- package/dist/core/history/replay.d.ts +82 -0
- package/dist/core/history/replay.js +249 -0
- package/dist/core/history/replay.js.map +1 -0
- package/dist/core/item/item-format.js +11 -8
- package/dist/core/item/item-format.js.map +1 -1
- package/dist/core/item/item-type-definition.d.ts +52 -0
- package/dist/core/item/item-type-definition.js +123 -0
- package/dist/core/item/item-type-definition.js.map +1 -0
- package/dist/core/item/parse.js +3 -2
- package/dist/core/item/parse.js.map +1 -1
- package/dist/core/item/priority.d.ts +23 -0
- package/dist/core/item/priority.js +55 -0
- package/dist/core/item/priority.js.map +1 -0
- package/dist/core/item/status.d.ts +14 -1
- package/dist/core/item/status.js +22 -2
- package/dist/core/item/status.js.map +1 -1
- package/dist/core/item/toon-decode.d.ts +19 -0
- package/dist/core/item/toon-decode.js +69 -0
- package/dist/core/item/toon-decode.js.map +1 -0
- package/dist/core/item/type-registry.js +13 -84
- package/dist/core/item/type-registry.js.map +1 -1
- package/dist/core/packages/manifest.js +3 -9
- package/dist/core/packages/manifest.js.map +1 -1
- package/dist/core/schema/item-types-file.d.ts +85 -0
- package/dist/core/schema/item-types-file.js +243 -0
- package/dist/core/schema/item-types-file.js.map +1 -0
- package/dist/core/schema/runtime-schema.d.ts +2 -1
- package/dist/core/schema/runtime-schema.js +11 -9
- package/dist/core/schema/runtime-schema.js.map +1 -1
- package/dist/core/search/semantic-defaults.js +3 -3
- package/dist/core/search/semantic-defaults.js.map +1 -1
- package/dist/core/shared/author.d.ts +1 -0
- package/dist/core/shared/author.js +9 -0
- package/dist/core/shared/author.js.map +1 -0
- package/dist/core/shared/lazy-module.d.ts +1 -0
- package/dist/core/shared/lazy-module.js +11 -0
- package/dist/core/shared/lazy-module.js.map +1 -0
- package/dist/core/shared/option-alias-visibility.d.ts +44 -0
- package/dist/core/shared/option-alias-visibility.js +76 -0
- package/dist/core/shared/option-alias-visibility.js.map +1 -0
- package/dist/core/shared/text-normalization.d.ts +0 -1
- package/dist/core/shared/text-normalization.js +2 -5
- package/dist/core/shared/text-normalization.js.map +1 -1
- package/dist/core/store/item-store.d.ts +2 -0
- package/dist/core/store/item-store.js +70 -39
- package/dist/core/store/item-store.js.map +1 -1
- package/dist/core/store/settings-validator.d.ts +106 -0
- package/dist/core/store/settings-validator.js +279 -0
- package/dist/core/store/settings-validator.js.map +1 -0
- package/dist/core/store/settings.js +6 -343
- package/dist/core/store/settings.js.map +1 -1
- package/dist/core/telemetry/runtime.js +5 -3
- package/dist/core/telemetry/runtime.js.map +1 -1
- package/dist/mcp/server.js +64 -13
- package/dist/mcp/server.js.map +1 -1
- package/dist/sdk/cli-contracts.d.ts +9 -2
- package/dist/sdk/cli-contracts.js +204 -13
- package/dist/sdk/cli-contracts.js.map +1 -1
- package/dist/sdk/runtime.d.ts +25 -1
- package/dist/sdk/runtime.js +46 -3
- package/dist/sdk/runtime.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.js +10 -2
- package/dist/types.js.map +1 -1
- package/docs/AGENT_GUIDE.md +7 -1
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/COMMANDS.md +39 -6
- package/docs/CONFIGURATION.md +1 -1
- package/docs/RELEASING.md +11 -7
- package/docs/SDK.md +11 -2
- package/package.json +12 -11
- package/packages/pm-calendar/README.md +3 -1
- package/packages/pm-calendar/extensions/calendar/index.js +21 -2
- package/packages/pm-calendar/extensions/calendar/index.ts +21 -2
- package/packages/pm-search-advanced/README.md +8 -0
- package/packages/pm-search-advanced/extensions/search-advanced/index.js +74 -0
- package/packages/pm-search-advanced/extensions/search-advanced/index.ts +74 -0
- package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +67 -9
- package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +67 -9
- package/packages/pm-templates/extensions/templates/runtime.js +11 -202
- package/packages/pm-templates/extensions/templates/runtime.ts +38 -230
- package/dist/core/output/command-aware.d.ts +0 -1
- package/dist/core/output/command-aware.js +0 -397
- package/dist/core/output/command-aware.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GlobalOptions } from "../../core/shared/command-types.js";
|
|
2
2
|
type ValidateCheckName = "metadata" | "resolution" | "lifecycle" | "files" | "command_references" | "history_drift";
|
|
3
|
-
type ValidateStatus = "ok" | "warn";
|
|
3
|
+
type ValidateStatus = "ok" | "warn" | "error";
|
|
4
4
|
export interface ValidateCommandOptions {
|
|
5
5
|
checkMetadata?: boolean;
|
|
6
6
|
checkResolution?: boolean;
|
|
@@ -10,6 +10,7 @@ export interface ValidateCommandOptions {
|
|
|
10
10
|
checkFiles?: boolean;
|
|
11
11
|
includePmInternals?: boolean;
|
|
12
12
|
verboseFileLists?: boolean;
|
|
13
|
+
verboseDiagnostics?: boolean;
|
|
13
14
|
checkHistoryDrift?: boolean;
|
|
14
15
|
checkCommandReferences?: boolean;
|
|
15
16
|
scanMode?: string;
|
|
@@ -22,6 +23,7 @@ export interface ValidateCheck {
|
|
|
22
23
|
}
|
|
23
24
|
export interface ValidateResult {
|
|
24
25
|
ok: boolean;
|
|
26
|
+
has_warnings: boolean;
|
|
25
27
|
checks: ValidateCheck[];
|
|
26
28
|
warnings: string[];
|
|
27
29
|
generated_at: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9884a203-9cc7-581e-a8e1-fd43052be74d")}catch(e){}}();
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import { realpathSync } from "node:fs";
|
|
5
5
|
import { execFile } from "node:child_process";
|
|
@@ -7,7 +7,7 @@ import path from "node:path";
|
|
|
7
7
|
import { promisify } from "node:util";
|
|
8
8
|
import { getActiveExtensionRegistrations } from "../../core/extensions/index.js";
|
|
9
9
|
import { pathExists } from "../../core/fs/fs-utils.js";
|
|
10
|
-
import {
|
|
10
|
+
import { scanHistoryDrift } from "../../core/history/drift-scan.js";
|
|
11
11
|
import { normalizeStatusInput } from "../../core/item/status.js";
|
|
12
12
|
import { resolveItemTypeRegistry } from "../../core/item/type-registry.js";
|
|
13
13
|
import { resolveRuntimeStatusRegistry } from "../../core/schema/runtime-schema.js";
|
|
@@ -16,9 +16,8 @@ import { PmCliError } from "../../core/shared/errors.js";
|
|
|
16
16
|
import { toNonEmptyStringOrUndefined } from "../../core/shared/primitives.js";
|
|
17
17
|
import { nowIso } from "../../core/shared/time.js";
|
|
18
18
|
import { listAllFrontMatterWithBody } from "../../core/store/item-store.js";
|
|
19
|
-
import {
|
|
19
|
+
import { getSettingsPath, resolvePmRoot } from "../../core/store/paths.js";
|
|
20
20
|
import { readSettings } from "../../core/store/settings.js";
|
|
21
|
-
import { verifyHistoryChain } from "./history.js";
|
|
22
21
|
import { extractReferencedPmItemIdsFromCommand } from "./test.js";
|
|
23
22
|
const FILE_SCAN_DIRECTORIES = ["src", "tests", "docs"];
|
|
24
23
|
const FILE_SCAN_ROOT_FILES = [
|
|
@@ -110,6 +109,7 @@ const METADATA_TRUNCATED_KEY_BY_FIELD = {
|
|
|
110
109
|
};
|
|
111
110
|
const GIT_LS_FILES_MAX_BUFFER = 32 * 1024 * 1024;
|
|
112
111
|
const FILE_LIST_SUMMARY_LIMIT = 40;
|
|
112
|
+
const DIAGNOSTIC_LIST_SUMMARY_LIMIT = 40;
|
|
113
113
|
const execFileAsync = promisify(execFile);
|
|
114
114
|
function normalizeRelativePath(value) {
|
|
115
115
|
return value.replaceAll("\\", "/").replace(/^\.\/+/, "").replace(/^\/+/, "");
|
|
@@ -446,7 +446,7 @@ async function collectProjectFileCandidates(workspaceRoot, scanMode) {
|
|
|
446
446
|
candidateScanned: defaultCandidates.length,
|
|
447
447
|
};
|
|
448
448
|
}
|
|
449
|
-
function summarizeList(values, limit =
|
|
449
|
+
function summarizeList(values, limit = DIAGNOSTIC_LIST_SUMMARY_LIMIT) {
|
|
450
450
|
/* c8 ignore start -- truncation behavior only surfaces with very large synthetic datasets. */
|
|
451
451
|
if (values.length <= limit) {
|
|
452
452
|
return { values, truncated: false };
|
|
@@ -518,7 +518,7 @@ function resolveRequestedChecks(options) {
|
|
|
518
518
|
}
|
|
519
519
|
return requested;
|
|
520
520
|
}
|
|
521
|
-
function buildMetadataCheck(items, metadataPolicy, statusRegistry) {
|
|
521
|
+
function buildMetadataCheck(items, metadataPolicy, statusRegistry, verboseDiagnostics) {
|
|
522
522
|
const missingByField = Object.fromEntries(SUPPORTED_METADATA_REQUIRED_FIELDS.map((field) => [field, []]));
|
|
523
523
|
for (const item of items) {
|
|
524
524
|
for (const field of SUPPORTED_METADATA_REQUIRED_FIELDS) {
|
|
@@ -561,7 +561,7 @@ function buildMetadataCheck(items, metadataPolicy, statusRegistry) {
|
|
|
561
561
|
if (missingByField[field].length === 0) {
|
|
562
562
|
continue;
|
|
563
563
|
}
|
|
564
|
-
const summarized = summarizeList(missingByField[field]);
|
|
564
|
+
const summarized = summarizeList(missingByField[field], verboseDiagnostics ? missingByField[field].length : DIAGNOSTIC_LIST_SUMMARY_LIMIT);
|
|
565
565
|
details[METADATA_ITEM_IDS_KEY_BY_FIELD[field]] = summarized.values;
|
|
566
566
|
details[METADATA_TRUNCATED_KEY_BY_FIELD[field]] = summarized.truncated;
|
|
567
567
|
}
|
|
@@ -574,7 +574,7 @@ function buildMetadataCheck(items, metadataPolicy, statusRegistry) {
|
|
|
574
574
|
warnings: warningTokens,
|
|
575
575
|
};
|
|
576
576
|
}
|
|
577
|
-
function buildResolutionCheck(items, statusRegistry) {
|
|
577
|
+
function buildResolutionCheck(items, statusRegistry, verboseDiagnostics) {
|
|
578
578
|
const terminalDoneStatuses = new Set(statusRegistry.terminal_done_statuses);
|
|
579
579
|
terminalDoneStatuses.add(statusRegistry.close_status);
|
|
580
580
|
const closedItems = items.filter((item) => terminalDoneStatuses.has(normalizeStatusForRegistry(item.status, statusRegistry)));
|
|
@@ -590,9 +590,10 @@ function buildResolutionCheck(items, statusRegistry) {
|
|
|
590
590
|
});
|
|
591
591
|
}
|
|
592
592
|
const warnings = missingResolutionRows.length > 0 ? [`validate_resolution_missing_fields:${missingResolutionRows.length}`] : [];
|
|
593
|
-
const
|
|
593
|
+
const diagnosticLimit = verboseDiagnostics ? Number.POSITIVE_INFINITY : DIAGNOSTIC_LIST_SUMMARY_LIMIT;
|
|
594
|
+
const summarizedRows = summarizeList(missingResolutionRows.map((row) => `${row.id}:${row.missing_fields.join(",")}`), diagnosticLimit);
|
|
594
595
|
const remediationHints = missingResolutionRows.map((row) => buildResolutionRemediationCommand(row));
|
|
595
|
-
const summarizedHints = summarizeList(remediationHints);
|
|
596
|
+
const summarizedHints = summarizeList(remediationHints, diagnosticLimit);
|
|
596
597
|
return {
|
|
597
598
|
check: {
|
|
598
599
|
name: "resolution",
|
|
@@ -822,7 +823,11 @@ function buildLifecycleCheck(items, includeStaleBlockers, dependencyCycleSeverit
|
|
|
822
823
|
return {
|
|
823
824
|
check: {
|
|
824
825
|
name: "lifecycle",
|
|
825
|
-
status:
|
|
826
|
+
status: dependencyCycleDiagnostics.cycle_count > 0 && dependencyCycleSeverity === "error"
|
|
827
|
+
? "error"
|
|
828
|
+
: warnings.length === 0
|
|
829
|
+
? "ok"
|
|
830
|
+
: "warn",
|
|
826
831
|
details: {
|
|
827
832
|
checked_active_items: activeItems.length,
|
|
828
833
|
active_closure_like_metadata_items: closureLikeRows.length,
|
|
@@ -961,62 +966,7 @@ async function buildFilesCheck(items, workspaceRoot, pmRoot, fileScanMode, inclu
|
|
|
961
966
|
};
|
|
962
967
|
}
|
|
963
968
|
async function buildHistoryDriftCheck(pmRoot, items) {
|
|
964
|
-
const missingStreams =
|
|
965
|
-
const unreadableStreams = [];
|
|
966
|
-
const hashMismatches = [];
|
|
967
|
-
const chainMismatches = [];
|
|
968
|
-
for (const item of items) {
|
|
969
|
-
const historyPath = getHistoryPath(pmRoot, item.id);
|
|
970
|
-
let latestAfterHash = null;
|
|
971
|
-
try {
|
|
972
|
-
const raw = await fs.readFile(historyPath, "utf8");
|
|
973
|
-
if (raw.trim().length === 0) {
|
|
974
|
-
missingStreams.push(item.id);
|
|
975
|
-
continue;
|
|
976
|
-
}
|
|
977
|
-
const entries = [];
|
|
978
|
-
for (const line of raw.split(/\r?\n/)) {
|
|
979
|
-
const trimmed = line.trim();
|
|
980
|
-
if (trimmed.length === 0) {
|
|
981
|
-
continue;
|
|
982
|
-
}
|
|
983
|
-
const parsed = JSON.parse(trimmed);
|
|
984
|
-
if (typeof parsed.after_hash !== "string" || parsed.after_hash.trim().length === 0) {
|
|
985
|
-
throw new Error("missing after_hash");
|
|
986
|
-
}
|
|
987
|
-
entries.push(parsed);
|
|
988
|
-
latestAfterHash = parsed.after_hash;
|
|
989
|
-
}
|
|
990
|
-
const chainVerification = verifyHistoryChain(entries);
|
|
991
|
-
if (!chainVerification.ok) {
|
|
992
|
-
chainMismatches.push(item.id);
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
catch (error) {
|
|
996
|
-
if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
|
|
997
|
-
missingStreams.push(item.id);
|
|
998
|
-
}
|
|
999
|
-
else {
|
|
1000
|
-
unreadableStreams.push(item.id);
|
|
1001
|
-
}
|
|
1002
|
-
continue;
|
|
1003
|
-
}
|
|
1004
|
-
/* c8 ignore start -- defensive guard for future history schema changes. */
|
|
1005
|
-
if (!latestAfterHash) {
|
|
1006
|
-
missingStreams.push(item.id);
|
|
1007
|
-
continue;
|
|
1008
|
-
}
|
|
1009
|
-
/* c8 ignore stop */
|
|
1010
|
-
const { body, ...frontMatter } = item;
|
|
1011
|
-
const currentHash = hashDocument({
|
|
1012
|
-
metadata: frontMatter,
|
|
1013
|
-
body,
|
|
1014
|
-
});
|
|
1015
|
-
if (currentHash !== latestAfterHash) {
|
|
1016
|
-
hashMismatches.push(item.id);
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
const driftedItems = [...new Set([...missingStreams, ...unreadableStreams, ...hashMismatches, ...chainMismatches])].sort((a, b) => a.localeCompare(b));
|
|
969
|
+
const { missingStreams, unreadableStreams, hashMismatches, chainMismatches, driftedItems } = await scanHistoryDrift(pmRoot, items);
|
|
1020
970
|
const warnings = [];
|
|
1021
971
|
if (missingStreams.length > 0) {
|
|
1022
972
|
warnings.push(`validate_history_drift_missing_streams:${missingStreams.length}`);
|
|
@@ -1132,12 +1082,12 @@ export async function runValidate(options, global) {
|
|
|
1132
1082
|
const checks = [];
|
|
1133
1083
|
const warnings = [...new Set(itemReadWarnings)];
|
|
1134
1084
|
if (requestedChecks.has("metadata")) {
|
|
1135
|
-
const metadataCheck = buildMetadataCheck(items, metadataPolicy, statusRegistry);
|
|
1085
|
+
const metadataCheck = buildMetadataCheck(items, metadataPolicy, statusRegistry, Boolean(options.verboseDiagnostics));
|
|
1136
1086
|
checks.push(metadataCheck.check);
|
|
1137
1087
|
warnings.push(...metadataCheck.warnings);
|
|
1138
1088
|
}
|
|
1139
1089
|
if (requestedChecks.has("resolution")) {
|
|
1140
|
-
const resolutionCheck = buildResolutionCheck(items, statusRegistry);
|
|
1090
|
+
const resolutionCheck = buildResolutionCheck(items, statusRegistry, Boolean(options.verboseDiagnostics));
|
|
1141
1091
|
checks.push(resolutionCheck.check);
|
|
1142
1092
|
warnings.push(...resolutionCheck.warnings);
|
|
1143
1093
|
}
|
|
@@ -1162,12 +1112,14 @@ export async function runValidate(options, global) {
|
|
|
1162
1112
|
warnings.push(...historyDriftCheck.warnings);
|
|
1163
1113
|
}
|
|
1164
1114
|
const normalizedWarnings = [...new Set(warnings)].sort((left, right) => left.localeCompare(right));
|
|
1115
|
+
const hasErrors = checks.some((check) => check.status === "error");
|
|
1165
1116
|
return {
|
|
1166
|
-
ok:
|
|
1117
|
+
ok: !hasErrors,
|
|
1118
|
+
has_warnings: normalizedWarnings.length > 0,
|
|
1167
1119
|
checks,
|
|
1168
1120
|
warnings: normalizedWarnings,
|
|
1169
1121
|
generated_at: nowIso(),
|
|
1170
1122
|
};
|
|
1171
1123
|
}
|
|
1172
1124
|
//# sourceMappingURL=validate.js.map
|
|
1173
|
-
//# debugId=
|
|
1125
|
+
//# debugId=9884a203-9cc7-581e-a8e1-fd43052be74d
|