@mmnto/cli 1.121.0 → 1.123.0
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/artifact-vocabulary.d.ts +23 -0
- package/dist/artifact-vocabulary.d.ts.map +1 -0
- package/dist/artifact-vocabulary.js +23 -0
- package/dist/artifact-vocabulary.js.map +1 -0
- package/dist/commands/config-drift.test.js +89 -1
- package/dist/commands/config-drift.test.js.map +1 -1
- package/dist/commands/init-templates.d.ts +6 -6
- package/dist/commands/init-templates.d.ts.map +1 -1
- package/dist/commands/init-templates.js +8 -7
- package/dist/commands/init-templates.js.map +1 -1
- package/dist/commands/init.test.js +18 -5
- package/dist/commands/init.test.js.map +1 -1
- package/dist/commands/install-hooks.d.ts.map +1 -1
- package/dist/commands/install-hooks.js +241 -17
- package/dist/commands/install-hooks.js.map +1 -1
- package/dist/commands/install-hooks.test.js +1019 -23
- package/dist/commands/install-hooks.test.js.map +1 -1
- package/dist/commands/legs.d.ts +259 -0
- package/dist/commands/legs.d.ts.map +1 -0
- package/dist/commands/legs.js +623 -0
- package/dist/commands/legs.js.map +1 -0
- package/dist/commands/legs.test.d.ts +20 -0
- package/dist/commands/legs.test.d.ts.map +1 -0
- package/dist/commands/legs.test.js +1004 -0
- package/dist/commands/legs.test.js.map +1 -0
- package/dist/commands/pre-push-gate-matrix.test.js +14 -0
- package/dist/commands/pre-push-gate-matrix.test.js.map +1 -1
- package/dist/commands/review-fan.d.ts +40 -1
- package/dist/commands/review-fan.d.ts.map +1 -1
- package/dist/commands/review-fan.js +108 -3
- package/dist/commands/review-fan.js.map +1 -1
- package/dist/commands/review-fan.test.js +444 -6
- package/dist/commands/review-fan.test.js.map +1 -1
- package/dist/commands/shield-covariate.test.js +19 -2
- package/dist/commands/shield-covariate.test.js.map +1 -1
- package/dist/commands/shield-nonreview.test.js +140 -1
- package/dist/commands/shield-nonreview.test.js.map +1 -1
- package/dist/commands/shield.d.ts.map +1 -1
- package/dist/commands/shield.js +53 -1
- package/dist/commands/shield.js.map +1 -1
- package/dist/commands/spec-cli-wiring.test.d.ts +19 -0
- package/dist/commands/spec-cli-wiring.test.d.ts.map +1 -0
- package/dist/commands/spec-cli-wiring.test.js +90 -0
- package/dist/commands/spec-cli-wiring.test.js.map +1 -0
- package/dist/commands/spec-templates.d.ts +18 -0
- package/dist/commands/spec-templates.d.ts.map +1 -1
- package/dist/commands/spec-templates.js +21 -0
- package/dist/commands/spec-templates.js.map +1 -1
- package/dist/commands/spec.d.ts +168 -1
- package/dist/commands/spec.d.ts.map +1 -1
- package/dist/commands/spec.js +448 -7
- package/dist/commands/spec.js.map +1 -1
- package/dist/commands/spec.test.js +903 -20
- package/dist/commands/spec.test.js.map +1 -1
- package/dist/git.d.ts +19 -0
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +13 -4
- package/dist/git.js.map +1 -1
- package/dist/index.js +47 -2
- package/dist/index.js.map +1 -1
- package/dist/services/run-artifacts.d.ts +12 -1
- package/dist/services/run-artifacts.d.ts.map +1 -1
- package/dist/services/run-artifacts.js +48 -3
- package/dist/services/run-artifacts.js.map +1 -1
- package/dist/services/run-artifacts.test.js +97 -1
- package/dist/services/run-artifacts.test.js.map +1 -1
- package/dist/utils.d.ts +22 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +4 -0
- package/dist/utils.js.map +1 -1
- package/dist/utils.test.js +65 -1
- package/dist/utils.test.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
export declare const SYSTEM_PROMPT = "# Spec System Prompt \u2014 Pre-Work Briefing\n\n## Identity & Role\nYou are a Staff-Level Software Architect. You do not write the implementation code yourself; your job is to guide developers. You design system interactions, define data contracts, identify architectural traps, and ensure the proposed plan aligns with existing project patterns.\n\n## Core Mission\nProduce a structured, highly technical pre-work briefing for a task before implementation begins, drawing heavily on provided Totem knowledge to ensure architectural consistency.\n\n## Critical Rules\n- **No Implementation Generation:** Do not write the final code. Provide architectural guidance, sequence logic, and structural plans.\n- **Define Contracts:** Explicitly define data contracts (e.g., Zod schemas, DB migrations, API interfaces) needed for the feature.\n- **Pessimistic Edge Cases:** Actively search for edge cases the issue description failed to mention (e.g., race conditions, missing indexes).\n- **Grounded Reality:** File paths must reference actual files from the context provided. When multiple approaches exist, list trade-offs with a firm recommendation.\n- **Lessons Are Law:** If RELEVANT LESSONS are provided, treat each lesson as a hard architectural constraint. Your plan MUST account for every relevant lesson. Call out which lessons influenced your approach in the Architectural Context section.\n- **Reuse Shared Helpers:** When the SHARED HELPERS section lists a utility that matches the task's needs (e.g., shell execution, JSON parsing, git operations), the plan MUST use it. Do NOT propose reimplementing functionality that already exists in the shared helper library.\n\n## Output Format\nRespond with ONLY the sections below. No preamble, no closing remarks.\n\n### Problem Statement\n[1-2 sentences restating the issue in concrete implementation terms. What exactly needs to change?]\n\n### Architectural Context\n[Relevant sessions, PRs, decisions, or past traps from the provided Totem knowledge. If nothing relevant, say \"None found in provided context.\"]\n\n### Files to Examine\n[Ordered list of files the developer should read before starting. Most critical first. Format: `path/to/file.ts` \u2014 reason to examine]\n\n### Technical Approach & Contracts\n[Recommended implementation approach. Include concrete steps, sequence logic, and required data contract changes (e.g., schemas, types). If multiple valid approaches exist, list trade-offs with a clear recommendation.]\n\n### Edge Cases & Traps\n[Things the issue description missed. Include race conditions, existing patterns that MUST be followed, and potential architectural regressions.]\n\n### Implementation Tasks\n[Break the work into discrete, ordered checkbox tasks. Each task should be completable in 5-15 minutes. Format each as `- [ ] **Task N: Title**` followed by indented steps.\n\nFor each task:\n- Name the files to modify and the test files to update\n- If a retrieved Totem lesson applies to THIS SPECIFIC TASK, inject it inline as:\n > TOTEM INVARIANT ([lesson heading]): [one-line constraint summary]\n Place the invariant directly above the step it constrains, not in a separate section.\n- If the task introduces behavior that could regress, add a TDD directive:\n > TEST DIRECTIVE: Before implementing, write a failing test named `[descriptive test name]` that proves the regression is caught.\n The test name must be specific (e.g., `rejects empty catch blocks`), not generic (e.g., `works correctly`).\n- Each task ends with: write test (or update existing) \u2192 verify fails \u2192 implement \u2192 verify passes \u2192 lint\n\nRED FLAGS \u2014 if any of these occur, STOP and fix before proceeding:\n- Never move to the next task until the current task's tests pass AND lint is clean.\n- Never accept \"close enough\" on a failing test. Fix it or rewrite the approach.\n- Never skip the test step. No untested code advances to the next task.\n- Never write code before writing the failing test (TDD is mandatory, not advisory).]\n\n### Execution Flow (structural constraint)\n```dot\ndigraph workflow {\n spec -> write_test -> verify_fails -> implement -> verify_passes -> lint -> next_task\n verify_fails -> implement [label=\"RED only\"]\n verify_passes -> lint [label=\"GREEN required\"]\n lint -> next_task [label=\"0 violations\"]\n lint -> implement [label=\"violations found \u2014 fix first\"]\n}\n```\n\n### Verification (MANDATORY \u2014 do not skip)\nEvery implementation MUST end with these steps:\n1. `totem lint` \u2014 deterministic rule check (zero LLM, ~2s). Fixes any violations.\n2. `totem review` \u2014 supplementary AI lanes over the diff (~18s, advisory). Address critical findings; your team's review discipline decides the review of record.\n3. If using MCP, call `verify_execution` to confirm compliance before declaring the task done.\n\n### Test Plan\n[Specific test scenarios needed to prove the feature works and edge cases are handled. Reference existing test file patterns when applicable.]\n";
|
|
2
2
|
export { SYSTEM_PROMPT as SPEC_SYSTEM_PROMPT };
|
|
3
|
+
/**
|
|
4
|
+
* The section skeleton `totem spec` PROMISES (mmnto-ai/totem#2700) — the ONE
|
|
5
|
+
* source for that promise, shared by the built-in prompt above and the strict
|
|
6
|
+
* pre-commit evidence reader, which renders these strings into its
|
|
7
|
+
* single-quoted `node -e '…'` body via `JSON.stringify` (the `runsDir`
|
|
8
|
+
* precedent) and checks the draft carries each heading with a non-blank body.
|
|
9
|
+
*
|
|
10
|
+
* Two invariants keep the two halves honest, both unit-tested:
|
|
11
|
+
* 1. every entry is a VERBATIM line of {@link SYSTEM_PROMPT} — the gate can
|
|
12
|
+
* only require what the command actually asks for;
|
|
13
|
+
* 2. every entry is RENDERABLE into the reader (no quote, backslash, dollar,
|
|
14
|
+
* backtick, newline or control character — the mmnto-ai/totem#2692 C4
|
|
15
|
+
* predicate), so a new heading can never break the hook silently.
|
|
16
|
+
*
|
|
17
|
+
* The skeleton is only applied to a draft written under the BUILT-IN prompt;
|
|
18
|
+
* an override prompt is held to the looser DOCUMENT shape instead.
|
|
19
|
+
*/
|
|
20
|
+
export declare const SPEC_REQUIRED_SECTIONS: readonly ["### Problem Statement", "### Implementation Tasks"];
|
|
3
21
|
//# sourceMappingURL=spec-templates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec-templates.d.ts","sourceRoot":"","sources":["../../src/commands/spec-templates.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,g7JAwEzB,CAAC;AAEF,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"spec-templates.d.ts","sourceRoot":"","sources":["../../src/commands/spec-templates.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,g7JAwEzB,CAAC;AAEF,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,CAAC;AAE/C;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sBAAsB,gEAGzB,CAAC"}
|
|
@@ -74,4 +74,25 @@ Every implementation MUST end with these steps:
|
|
|
74
74
|
[Specific test scenarios needed to prove the feature works and edge cases are handled. Reference existing test file patterns when applicable.]
|
|
75
75
|
`;
|
|
76
76
|
export { SYSTEM_PROMPT as SPEC_SYSTEM_PROMPT };
|
|
77
|
+
/**
|
|
78
|
+
* The section skeleton `totem spec` PROMISES (mmnto-ai/totem#2700) — the ONE
|
|
79
|
+
* source for that promise, shared by the built-in prompt above and the strict
|
|
80
|
+
* pre-commit evidence reader, which renders these strings into its
|
|
81
|
+
* single-quoted `node -e '…'` body via `JSON.stringify` (the `runsDir`
|
|
82
|
+
* precedent) and checks the draft carries each heading with a non-blank body.
|
|
83
|
+
*
|
|
84
|
+
* Two invariants keep the two halves honest, both unit-tested:
|
|
85
|
+
* 1. every entry is a VERBATIM line of {@link SYSTEM_PROMPT} — the gate can
|
|
86
|
+
* only require what the command actually asks for;
|
|
87
|
+
* 2. every entry is RENDERABLE into the reader (no quote, backslash, dollar,
|
|
88
|
+
* backtick, newline or control character — the mmnto-ai/totem#2692 C4
|
|
89
|
+
* predicate), so a new heading can never break the hook silently.
|
|
90
|
+
*
|
|
91
|
+
* The skeleton is only applied to a draft written under the BUILT-IN prompt;
|
|
92
|
+
* an override prompt is held to the looser DOCUMENT shape instead.
|
|
93
|
+
*/
|
|
94
|
+
export const SPEC_REQUIRED_SECTIONS = [
|
|
95
|
+
'### Problem Statement',
|
|
96
|
+
'### Implementation Tasks',
|
|
97
|
+
];
|
|
77
98
|
//# sourceMappingURL=spec-templates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec-templates.js","sourceRoot":"","sources":["../../src/commands/spec-templates.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,0EAA0E;AAE1E,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwE5B,CAAC;AAEF,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"spec-templates.js","sourceRoot":"","sources":["../../src/commands/spec-templates.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,0EAA0E;AAE1E,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwE5B,CAAC;AAEF,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,CAAC;AAE/C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,uBAAuB;IACvB,0BAA0B;CAClB,CAAC"}
|
package/dist/commands/spec.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LanceStore, SearchResult, TotemConfigError as TotemConfigErrorClass } from '@mmnto/totem';
|
|
1
|
+
import type { GroundingAnchor, LanceStore, SearchResult, TotemConfigError as TotemConfigErrorClass } from '@mmnto/totem';
|
|
2
2
|
import type { StandardIssue } from '../adapters/issue-adapter.js';
|
|
3
3
|
export declare const MAX_LESSONS = 10;
|
|
4
4
|
export declare const MAX_LESSON_CHARS = 8000;
|
|
@@ -10,15 +10,53 @@ export interface RetrievedContext {
|
|
|
10
10
|
lessons: SearchResult[];
|
|
11
11
|
}
|
|
12
12
|
export declare function retrieveContext(query: string, store: LanceStore, linkedStores?: LanceStore[]): Promise<RetrievedContext>;
|
|
13
|
+
/**
|
|
14
|
+
* Retrieval query for a bound record (mmnto-ai/totem#2700) — the same shape
|
|
15
|
+
* {@link buildSearchQuery} gives an issue: the record's own title (its first
|
|
16
|
+
* markdown heading) plus the head of its body, so a record retrieves the same
|
|
17
|
+
* way an issue does rather than through a hand-picked slug.
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildRecordSearchQuery(record: SpecRecord): string;
|
|
13
20
|
/**
|
|
14
21
|
* Expand a spec search query with test-infrastructure keywords when the
|
|
15
22
|
* original query mentions testing concepts. This helps the vector search
|
|
16
23
|
* surface existing helpers like `rule-tester.ts`.
|
|
17
24
|
*/
|
|
18
25
|
export declare function expandSpecQuery(query: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* A hand-authored design record bound with `--from` (mmnto-ai/totem#2700).
|
|
28
|
+
* Read ONCE as a Buffer at command start: `sha256` and `body` come from that
|
|
29
|
+
* same buffer, so the digest and the bytes rendered into the prompt agree by
|
|
30
|
+
* construction. The record is never written back.
|
|
31
|
+
*/
|
|
32
|
+
export interface SpecRecord {
|
|
33
|
+
/** Repo-relative path (forward slashes) — the anchor's `ref`; the gate reads the file at this path from the worktree top. */
|
|
34
|
+
path: string;
|
|
35
|
+
/** sha256 (hex) of the file's RAW bytes — what the pre-commit reader hashes. */
|
|
36
|
+
sha256: string;
|
|
37
|
+
/**
|
|
38
|
+
* The record's text, decoded utf-8 from the same buffer the digest was taken
|
|
39
|
+
* over, with one leading byte-order mark stripped: the mark is a decoding
|
|
40
|
+
* artifact, never part of the document, and the digest above still names the
|
|
41
|
+
* raw bytes so both sides hash the same thing.
|
|
42
|
+
*/
|
|
43
|
+
body: string;
|
|
44
|
+
}
|
|
19
45
|
export interface ParsedInput {
|
|
20
46
|
issue: StandardIssue | null;
|
|
21
47
|
freeText: string | null;
|
|
48
|
+
/** The bound design record (mmnto-ai/totem#2700) — the third arm; `null` on the issue and topic arms. */
|
|
49
|
+
record: SpecRecord | null;
|
|
50
|
+
/**
|
|
51
|
+
* The ISSUE input exactly as typed — recorded for EVERY issue input, bare
|
|
52
|
+
* numbers included, because a fetched {@link StandardIssue} carries only the
|
|
53
|
+
* number and the anchor's `ref` must round-trip what the operator wrote.
|
|
54
|
+
* {@link issueAnchorRef} decides what reaches the ref: a bare number renders
|
|
55
|
+
* as `#<n>`, while a qualified `owner/repo#N` or a URL is kept as typed
|
|
56
|
+
* (sanitized). Absent on the topic / record arms, whose refs are the topic
|
|
57
|
+
* text and the record path.
|
|
58
|
+
*/
|
|
59
|
+
issueRef?: string;
|
|
22
60
|
}
|
|
23
61
|
export declare function assemblePrompt(inputs: ParsedInput[], context: RetrievedContext, systemPrompt: string): Promise<string>;
|
|
24
62
|
export interface SpecOptions {
|
|
@@ -27,12 +65,141 @@ export interface SpecOptions {
|
|
|
27
65
|
stdout?: boolean;
|
|
28
66
|
model?: string;
|
|
29
67
|
fresh?: boolean;
|
|
68
|
+
/** Path to a hand-authored design record to ground the run on (mmnto-ai/totem#2700). */
|
|
69
|
+
from?: string;
|
|
30
70
|
}
|
|
31
71
|
/**
|
|
32
72
|
* mmnto-ai/totem#1555: validate that --stdout and --out are not used together.
|
|
33
73
|
* Run before any LLM call so a user-error surfaces in <50ms with no API cost.
|
|
34
74
|
*/
|
|
35
75
|
export declare function validateOutputOptions(options: Pick<SpecOptions, 'out' | 'stdout'>, TotemConfigErrorCtor: typeof TotemConfigErrorClass): void;
|
|
76
|
+
/**
|
|
77
|
+
* Refuse the two invocation shapes that carry no single grounded subject:
|
|
78
|
+
* nothing at all (commander no longer refuses it — `spec [inputs...]` is
|
|
79
|
+
* optional so `--from` is reachable, mmnto-ai/totem#2700 B2), and a record
|
|
80
|
+
* bound alongside positional inputs (two subjects, one anchor).
|
|
81
|
+
*/
|
|
82
|
+
export declare function validateSpecInvocation(inputs: string[], options: Pick<SpecOptions, 'from'>, TotemConfigErrorCtor: typeof TotemConfigErrorClass): void;
|
|
83
|
+
export interface SpecRecordDeps {
|
|
84
|
+
resolveGitRoot: (cwd: string) => string | null;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Whether a root-relative record path ESCAPES the repository — the containment
|
|
88
|
+
* gate on `grounding.anchor.ref` (mmnto-ai/totem#2700).
|
|
89
|
+
*
|
|
90
|
+
* The published ref is resolved by the strict pre-commit reader from the
|
|
91
|
+
* WORKTREE TOP, so a path that leaves the root names a file the gate would
|
|
92
|
+
* read from outside the repo: `--from ../sibling/x.md` binds `../sibling/x.md`,
|
|
93
|
+
* and a record on another drive binds an absolute path (`path.relative` returns
|
|
94
|
+
* one when the two paths share no root). The hook carries the same refusal —
|
|
95
|
+
* the artifact is hand-editable, so neither half may trust the other — but a
|
|
96
|
+
* ref that escapes must never be MINTED either.
|
|
97
|
+
*
|
|
98
|
+
* Both `path` flavors are consulted because the caller normalizes to forward
|
|
99
|
+
* slashes before asking: `D:/x.md` is not a repo-relative path on ANY platform,
|
|
100
|
+
* so the answer must not depend on which one is running.
|
|
101
|
+
*
|
|
102
|
+
* Containment is decided by NORMALIZATION, not by inspecting the first segment:
|
|
103
|
+
* `a/../../x.md` escapes the root even though its first segment does not say
|
|
104
|
+
* so, while a mid-path `..` that stays inside (`a/../b.md`) is contained and
|
|
105
|
+
* legal. `path.posix.normalize` is the cwd-free equivalent of the reader's
|
|
106
|
+
* `resolve` + `relative` containment test, so both sides answer the same on the
|
|
107
|
+
* same input — the predicate is compared by path SEGMENT throughout, which is
|
|
108
|
+
* why a file named `..notes.md` inside the root stays legal.
|
|
109
|
+
*
|
|
110
|
+
* {@link loadSpecRecord} asks this TWICE: once on the lexical repo-relative
|
|
111
|
+
* spelling that becomes the ref, and once on the relative path between the two
|
|
112
|
+
* REALPATHS, so an in-repo symlink whose target lives outside the tree is
|
|
113
|
+
* refused as well. Normalization alone cannot see through a link.
|
|
114
|
+
*/
|
|
115
|
+
export declare function isRecordPathOutsideRoot(relativePath: string): boolean;
|
|
116
|
+
export interface LoadedSpecRecord {
|
|
117
|
+
record: SpecRecord;
|
|
118
|
+
/** The record's resolved absolute path — the subject of the `--out` collision check. */
|
|
119
|
+
absolutePath: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Read and bind the `--from` record. ONE `readFileSync` produces both the
|
|
123
|
+
* digest and the prompt bytes, so `grounding.anchor.sha256` provably names
|
|
124
|
+
* what the model was shown. Every rejection names the path.
|
|
125
|
+
*
|
|
126
|
+
* Order is load-bearing. Existence is decided FIRST, so a path that names
|
|
127
|
+
* nothing keeps the "record not found" cure. CONTAINMENT is decided second —
|
|
128
|
+
* before any `statSync` or `readFileSync` — so a record outside the repository
|
|
129
|
+
* is refused as uncontained rather than by whatever the read happens to say
|
|
130
|
+
* about it (a directory outside the root must not surface as "not a file").
|
|
131
|
+
* Containment is judged twice: LEXICALLY on the spelling that becomes the
|
|
132
|
+
* published ref, and again on the REALPATHS of the record and the root, so an
|
|
133
|
+
* in-repo symlink pointing out of the tree cannot bind a file the gate would
|
|
134
|
+
* read from outside the worktree. `record.path` stays the LEXICAL
|
|
135
|
+
* repo-relative path of the file as given — the hook resolves links on its own
|
|
136
|
+
* side, and rewriting the ref to a link's target would publish a path the
|
|
137
|
+
* operator never wrote.
|
|
138
|
+
*/
|
|
139
|
+
export declare function loadSpecRecord(fromPath: string, cwd: string, deps: SpecRecordDeps, TotemConfigErrorCtor: typeof TotemConfigErrorClass): LoadedSpecRecord;
|
|
140
|
+
/**
|
|
141
|
+
* `--out` may never resolve to the bound record: the tool BINDS a hand-authored
|
|
142
|
+
* record, it never drafts over it. Identity is decided by {@link isSameFile},
|
|
143
|
+
* so a symlink or a hardlink pointed at the record is refused with the same
|
|
144
|
+
* words a literal path collision gets — a spelling comparison alone would let
|
|
145
|
+
* either one through and clobber the record.
|
|
146
|
+
*/
|
|
147
|
+
export declare function assertOutDoesNotOverwriteRecord(out: string | undefined, recordAbsolutePath: string, cwd: string, TotemConfigErrorCtor: typeof TotemConfigErrorClass): void;
|
|
148
|
+
/**
|
|
149
|
+
* Classify what the run is ANCHORED on (mmnto-ai/totem#2700). A record wins
|
|
150
|
+
* outright (it is the only kind carrying bytes); otherwise the kind is
|
|
151
|
+
* `issue` when every input resolved to an issue, `free-text` when every input
|
|
152
|
+
* is a topic, and the honest `mixed` when both are present — `mixed` proceeds
|
|
153
|
+
* (an issue IS grounding) but is not gate evidence, because its free-text half
|
|
154
|
+
* is the confabulation surface.
|
|
155
|
+
*
|
|
156
|
+
* The caller guarantees at least one parsed input ({@link
|
|
157
|
+
* validateSpecInvocation}); the schema's non-empty `ref` refine is the
|
|
158
|
+
* backstop if that ever stops holding. Topic text and a typed issue ref both
|
|
159
|
+
* pass through {@link sanitizeRefText} on the way into the ref, so a control
|
|
160
|
+
* character the user typed cannot cost the run its artifact.
|
|
161
|
+
*/
|
|
162
|
+
export declare function resolveGroundingAnchor(parsed: ParsedInput[]): GroundingAnchor;
|
|
163
|
+
/** One below-floor candidate, disclosed as path + relevance only — never content. */
|
|
164
|
+
export interface WithheldCandidate {
|
|
165
|
+
filePath: string;
|
|
166
|
+
sourceRepo?: string;
|
|
167
|
+
relevance: number;
|
|
168
|
+
}
|
|
169
|
+
export interface GroundingFloorVerdict {
|
|
170
|
+
/** True when the run must be refused before any LLM call and before any artifact is minted. */
|
|
171
|
+
refuse: boolean;
|
|
172
|
+
/** Retrieved items across all four partitions. */
|
|
173
|
+
hits: number;
|
|
174
|
+
/** The highest relevance among signal-bearing items; `null` when nothing carried a vector leg. */
|
|
175
|
+
bestRelevance: number | null;
|
|
176
|
+
/** The below-floor signal-bearing candidates the refusal withheld — empty whenever the run proceeds. */
|
|
177
|
+
withheld: WithheldCandidate[];
|
|
178
|
+
/** Items with no relevance at all (FTS-only) — floor-EXEMPT, never withheld for a weak sibling's sake. */
|
|
179
|
+
floorExempt: number;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Judge the retrieval against the relevance floor, over ALL items across the
|
|
183
|
+
* four partitions (mmnto-ai/totem#2700). Mirrors the MCP tool's semantics
|
|
184
|
+
* (`packages/mcp/src/tools/search-knowledge.ts`): the floor fires only when a
|
|
185
|
+
* real relevance signal exists, and judges only the hits that carry one —
|
|
186
|
+
* keyword-only hits have no comparable relevance and are floor-EXEMPT, so a
|
|
187
|
+
* mixed batch is never withheld because its vector-leg siblings scored weak.
|
|
188
|
+
*
|
|
189
|
+
* Zero items is this command's OWN rule, not an MCP mirror: nothing retrieved
|
|
190
|
+
* means nothing grounds the run, so it refuses regardless of any floor.
|
|
191
|
+
*/
|
|
192
|
+
export declare function evaluateGroundingFloor(context: RetrievedContext, floor: number): GroundingFloorVerdict;
|
|
193
|
+
/**
|
|
194
|
+
* The refusal's text: the topic(s) refused, the measurement (`0 hits` or the
|
|
195
|
+
* best relevance), the floor's VALUE and its PLACE, and every withheld
|
|
196
|
+
* candidate as `path — relevance` (linked hits prefixed with their store).
|
|
197
|
+
* Exclusion is disclosed, never silently dropped.
|
|
198
|
+
*/
|
|
199
|
+
export declare function formatGroundingRefusal(topics: string, verdict: GroundingFloorVerdict, floor: number): {
|
|
200
|
+
message: string;
|
|
201
|
+
recoveryHint: string;
|
|
202
|
+
};
|
|
36
203
|
/**
|
|
37
204
|
* Sanitize a free-form topic string for use as a filename stem. Replaces any
|
|
38
205
|
* character outside `[a-zA-Z0-9_-]` with a single dash, collapses runs, and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../src/commands/spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../src/commands/spec.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,eAAe,EACf,UAAU,EACV,YAAY,EACZ,gBAAgB,IAAI,qBAAqB,EAC1C,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AA4BlE,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,gBAAgB,OAAQ,CAAC;AAQtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAMzD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAED,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,UAAU,EACjB,YAAY,CAAC,EAAE,UAAU,EAAE,GAC1B,OAAO,CAAC,gBAAgB,CAAC,CA0C3B;AAiBD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAEjE;AAMD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAErD;AAID;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,6HAA6H;IAC7H,IAAI,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,aAAa,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