@spexcode/spec-core 0.6.2 → 0.6.3
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/anchors.d.ts +94 -0
- package/dist/anchors.js +730 -0
- package/dist/git.d.ts +166 -0
- package/dist/git.js +2736 -0
- package/dist/graph.d.ts +34 -0
- package/dist/graph.js +237 -0
- package/dist/graphDelta.d.ts +45 -0
- package/dist/graphDelta.js +84 -0
- package/dist/harness-identity.d.ts +31 -0
- package/dist/harness-identity.js +20 -0
- package/dist/identity-presets.d.ts +152 -0
- package/dist/identity-presets.js +132 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +19 -0
- package/dist/layout.d.ts +183 -0
- package/dist/layout.js +548 -0
- package/dist/process-identity.d.ts +37 -0
- package/dist/process-identity.js +214 -0
- package/dist/project-identity.d.ts +12 -0
- package/dist/project-identity.js +71 -0
- package/dist/project-store.d.ts +3 -0
- package/dist/project-store.js +14 -0
- package/dist/resilience.d.ts +2 -0
- package/dist/resilience.js +40 -0
- package/dist/review/index.d.ts +3 -0
- package/{src → dist}/review/index.js +3 -3
- package/dist/review/reviewFilters.d.ts +77 -0
- package/dist/review/reviewFilters.js +308 -0
- package/dist/review/reviewQuery.d.ts +66 -0
- package/dist/review/reviewQuery.js +180 -0
- package/dist/review/session.d.ts +4 -0
- package/dist/review/session.js +8 -0
- package/dist/reviewSnapshot.d.ts +15 -0
- package/dist/reviewSnapshot.js +12 -0
- package/dist/root-lru.d.ts +4 -0
- package/{src/root-lru.ts → dist/root-lru.js} +26 -30
- package/dist/specs.d.ts +117 -0
- package/dist/specs.js +489 -0
- package/package.json +19 -8
- package/src/anchors.ts +0 -728
- package/src/git.ts +0 -2556
- package/src/graph.ts +0 -251
- package/src/harness-identity.ts +0 -26
- package/src/identity-presets.d.ts +0 -13
- package/src/identity-presets.js +0 -138
- package/src/index.ts +0 -20
- package/src/layout.ts +0 -637
- package/src/process-identity.ts +0 -207
- package/src/project-identity.ts +0 -73
- package/src/project-store.ts +0 -17
- package/src/resilience.ts +0 -41
- package/src/review/reviewFilters.js +0 -324
- package/src/review/reviewQuery.js +0 -174
- package/src/review/session.js +0 -13
- package/src/reviewSnapshot.ts +0 -28
- package/src/specs.ts +0 -498
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
// This existed twice, verbatim in logic and even in name — `touchRoot` in git.ts (index/drift) and again in
|
|
13
13
|
// spec-eval's scenariofresh.ts (scenario chains), whose comment said it was "mirroring historyIndex/driftIndex
|
|
14
14
|
// in git.ts". Both authors knew; neither had anywhere to put it. Now they do.
|
|
15
|
-
|
|
16
15
|
// slot bound for one cache family. Every caller names its own env knob and default so operators can tune the
|
|
17
16
|
// families independently, but nobody gets to invent a different FLOOR or a bare literal — a cache whose bound
|
|
18
17
|
// is a magic number cannot be tuned in the field at all (scenariofresh's was a hardcoded 16).
|
|
@@ -20,35 +19,32 @@
|
|
|
20
19
|
// NaN for a mistyped value, and `size > NaN` is always false: one typo in an env var silently turned the
|
|
21
20
|
// bound OFF and let the cache grow without limit. A bound that fails open is worse than no bound, because
|
|
22
21
|
// nothing reports it. Anything that does not parse to a positive number falls back to the caller's default.
|
|
23
|
-
export const rootSlots = (env
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
22
|
+
export const rootSlots = (env, fallback) => {
|
|
23
|
+
const asked = Number(env);
|
|
24
|
+
return Math.max(4, Number.isFinite(asked) && asked > 0 ? asked : fallback);
|
|
25
|
+
};
|
|
28
26
|
// Record that `root` now wants `key`, evicting what no root wants any more and keeping `roots` within `slots`.
|
|
29
27
|
// `cache` is the caller's own keyed store; this owns only the ROOT→key bookkeeping and the eviction decision.
|
|
30
|
-
export function touchRoot(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (oldKey && ![...roots.values()].includes(oldKey)) cache.delete(oldKey)
|
|
53
|
-
}
|
|
28
|
+
export function touchRoot(roots, cache, root, key, slots) {
|
|
29
|
+
const previous = roots.get(root);
|
|
30
|
+
if (previous !== key) {
|
|
31
|
+
roots.set(root, key);
|
|
32
|
+
// the old key survives only while some OTHER root still names it — immutable entries are shared, so
|
|
33
|
+
// dropping one root's view must not throw away a sibling checkout's warm work.
|
|
34
|
+
if (previous && ![...roots.values()].includes(previous))
|
|
35
|
+
cache.delete(previous);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
roots.delete(root);
|
|
39
|
+
roots.set(root, key); // recency bump: reinsertion is what makes the eviction loop below pick the oldest
|
|
40
|
+
}
|
|
41
|
+
while (roots.size > slots) {
|
|
42
|
+
const oldest = roots.keys().next().value;
|
|
43
|
+
if (oldest === undefined)
|
|
44
|
+
break;
|
|
45
|
+
const oldKey = roots.get(oldest);
|
|
46
|
+
roots.delete(oldest);
|
|
47
|
+
if (oldKey && ![...roots.values()].includes(oldKey))
|
|
48
|
+
cache.delete(oldKey);
|
|
49
|
+
}
|
|
54
50
|
}
|
package/dist/specs.d.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { type HistoryIndex, type DriftIndex } from './git.js';
|
|
2
|
+
type FmValue = string | string[];
|
|
3
|
+
export declare function parseFrontmatter(src: string): {
|
|
4
|
+
fm: Record<string, FmValue>;
|
|
5
|
+
body: string;
|
|
6
|
+
};
|
|
7
|
+
export type SpecParts = {
|
|
8
|
+
rawSource: string;
|
|
9
|
+
expandedSpec: string;
|
|
10
|
+
};
|
|
11
|
+
declare function parseParts(body: string): SpecParts | null;
|
|
12
|
+
export type DerivedStatus = 'pending' | 'active' | 'merged' | 'drift';
|
|
13
|
+
export declare function deriveStatus(d: {
|
|
14
|
+
version: number;
|
|
15
|
+
drift: number;
|
|
16
|
+
hasOverlay?: boolean;
|
|
17
|
+
hasCode?: boolean;
|
|
18
|
+
fmStatus?: string;
|
|
19
|
+
}): DerivedStatus;
|
|
20
|
+
export declare function mintIds(segs: string[][]): string[];
|
|
21
|
+
export type SpecTreeSnapshot = {
|
|
22
|
+
tip: string;
|
|
23
|
+
files: ReadonlyMap<string, string>;
|
|
24
|
+
};
|
|
25
|
+
export declare function specOwners(file: string): {
|
|
26
|
+
id: string;
|
|
27
|
+
desc: string;
|
|
28
|
+
scoped: boolean;
|
|
29
|
+
}[];
|
|
30
|
+
export declare function specRelated(file: string): {
|
|
31
|
+
id: string;
|
|
32
|
+
desc: string;
|
|
33
|
+
}[];
|
|
34
|
+
export type SpecLite = {
|
|
35
|
+
id: string;
|
|
36
|
+
title: string;
|
|
37
|
+
path: string;
|
|
38
|
+
desc: string;
|
|
39
|
+
body: string;
|
|
40
|
+
};
|
|
41
|
+
export declare function loadSpecsLite(): SpecLite[];
|
|
42
|
+
export declare function specContent(id: string): {
|
|
43
|
+
body: string;
|
|
44
|
+
parts: ReturnType<typeof parseParts>;
|
|
45
|
+
} | null;
|
|
46
|
+
export type LoadSpecsOptions = {
|
|
47
|
+
tip?: string;
|
|
48
|
+
history?: HistoryIndex | null;
|
|
49
|
+
drift?: DriftIndex | null;
|
|
50
|
+
snapshot?: SpecTreeSnapshot;
|
|
51
|
+
};
|
|
52
|
+
export declare function loadSpecs(root?: string, options?: LoadSpecsOptions): Promise<{
|
|
53
|
+
id: string;
|
|
54
|
+
parent: string | null;
|
|
55
|
+
path: string;
|
|
56
|
+
title: string;
|
|
57
|
+
status: DerivedStatus;
|
|
58
|
+
fmStatus: string | null;
|
|
59
|
+
session: string | null;
|
|
60
|
+
hue: number;
|
|
61
|
+
desc: string;
|
|
62
|
+
code: string[];
|
|
63
|
+
codeEntries: import("./anchors.js").RelationEntry[];
|
|
64
|
+
codeScoped: import("./anchors.js").RelationEntry[];
|
|
65
|
+
related: string[];
|
|
66
|
+
relatedEntries: import("./anchors.js").RelationEntry[];
|
|
67
|
+
relatedScoped: import("./anchors.js").RelationEntry[];
|
|
68
|
+
relationProblems: string[];
|
|
69
|
+
version: number;
|
|
70
|
+
reason: string;
|
|
71
|
+
lastEdited: string | null;
|
|
72
|
+
drift: number;
|
|
73
|
+
driftFiles: {
|
|
74
|
+
file: string;
|
|
75
|
+
behind: number;
|
|
76
|
+
}[];
|
|
77
|
+
relatedDriftFiles: {
|
|
78
|
+
file: string;
|
|
79
|
+
behind: number;
|
|
80
|
+
}[];
|
|
81
|
+
body: string;
|
|
82
|
+
parts: SpecParts | null;
|
|
83
|
+
}[]>;
|
|
84
|
+
export declare function specHistory(id: string): Promise<{
|
|
85
|
+
additions: number;
|
|
86
|
+
deletions: number;
|
|
87
|
+
files: number;
|
|
88
|
+
hash: string;
|
|
89
|
+
date: string;
|
|
90
|
+
reason: string;
|
|
91
|
+
session: string | null;
|
|
92
|
+
}[]>;
|
|
93
|
+
export declare function specDiffAt(id: string, hash: string): Promise<{
|
|
94
|
+
hash: string;
|
|
95
|
+
patch: string;
|
|
96
|
+
} | null>;
|
|
97
|
+
export type ConfigPreset = {
|
|
98
|
+
name: string;
|
|
99
|
+
title: string;
|
|
100
|
+
desc: string;
|
|
101
|
+
kind: string;
|
|
102
|
+
dir: string;
|
|
103
|
+
files: string[];
|
|
104
|
+
body: string;
|
|
105
|
+
events: string[];
|
|
106
|
+
order: number;
|
|
107
|
+
block: boolean;
|
|
108
|
+
tools: string[];
|
|
109
|
+
};
|
|
110
|
+
export declare const PLUGIN_INSTANCE_ROOT = ".plugins";
|
|
111
|
+
export declare function loadConfig(): ConfigPreset[];
|
|
112
|
+
export declare function loadSystemConfig(): ConfigPreset[];
|
|
113
|
+
export declare function loadHookConfig(): ConfigPreset[];
|
|
114
|
+
export declare function loadSkillConfig(): ConfigPreset[];
|
|
115
|
+
export declare function loadAgentConfig(): ConfigPreset[];
|
|
116
|
+
export declare function loadReviewConfig(): ConfigPreset[];
|
|
117
|
+
export {};
|