@komatikai/trailhead 4.4.2 → 4.4.4

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.
@@ -0,0 +1,119 @@
1
+ // Shared helpers for Gate 1 submission checks (pure, no I/O).
2
+ export function normalizePath(filePath) {
3
+ return filePath.replace(/\\/g, "/").replace(/^\.\//, "");
4
+ }
5
+ export function extensionOf(filename) {
6
+ const base = normalizePath(filename);
7
+ const idx = base.lastIndexOf(".");
8
+ return idx >= 0 ? base.slice(idx).toLowerCase() : "";
9
+ }
10
+ export function addedLines(patch) {
11
+ if (!patch)
12
+ return [];
13
+ return patch
14
+ .split("\n")
15
+ .filter((line) => line.startsWith("+") && !line.startsWith("+++"))
16
+ .map((line) => line.slice(1));
17
+ }
18
+ /** Approximate post-change file body from a unified diff hunk (context + additions). */
19
+ export function effectiveContentFromPatch(patch) {
20
+ if (!patch)
21
+ return "";
22
+ return patch
23
+ .split("\n")
24
+ .filter((line) => !line.startsWith("@@") && !line.startsWith("---") && !line.startsWith("+++"))
25
+ .filter((line) => !line.startsWith("-"))
26
+ .map((line) => (line.startsWith("+") || line.startsWith(" ") ? line.slice(1) : line))
27
+ .join("\n");
28
+ }
29
+ export function fileContent(file) {
30
+ if (typeof file.content === "string")
31
+ return file.content;
32
+ return effectiveContentFromPatch(file.patch);
33
+ }
34
+ export function lineCountFromPatch(patch) {
35
+ const content = effectiveContentFromPatch(patch);
36
+ if (!content)
37
+ return 0;
38
+ return content.split("\n").length;
39
+ }
40
+ export function scanAddedContent(files, predicate) {
41
+ const hits = [];
42
+ for (const file of files) {
43
+ for (const line of addedLines(file.patch)) {
44
+ if (predicate(line, file.filename))
45
+ hits.push(file.filename);
46
+ }
47
+ }
48
+ return [...new Set(hits)];
49
+ }
50
+ export function scanFileContent(files, predicate) {
51
+ const hits = [];
52
+ for (const file of files) {
53
+ const lines = fileContent(file).split("\n");
54
+ lines.forEach((line, index) => {
55
+ if (predicate(line, file.filename, index + 1)) {
56
+ hits.push({ file: file.filename, line: index + 1 });
57
+ }
58
+ });
59
+ }
60
+ return hits;
61
+ }
62
+ export function prPathSet(files) {
63
+ return new Set(files.map((f) => normalizePath(f.filename)));
64
+ }
65
+ export function isTestPath(filename) {
66
+ return /\/__tests__\/|\/test\/|\/fixtures\/|\.test\.|\.spec\./.test(filename);
67
+ }
68
+ /** Default archived/stale path segments skipped by context_freshness. */
69
+ export const DEFAULT_STALE_PATH_IGNORE = ["/_stale/", "/_archive/", "/.archive/"];
70
+ export function isStaleArchivedPath(filename, extraPatterns = []) {
71
+ const path = normalizePath(filename);
72
+ return [...DEFAULT_STALE_PATH_IGNORE, ...extraPatterns].some((segment) => path.includes(segment));
73
+ }
74
+ export function packageJsonPathForFile(filename, prPaths) {
75
+ const parts = normalizePath(filename).split("/");
76
+ for (let i = parts.length - 1; i >= 0; i--) {
77
+ const candidate = [...parts.slice(0, i), "package.json"].filter(Boolean).join("/");
78
+ if (prPaths.has(candidate))
79
+ return candidate;
80
+ }
81
+ return prPaths.has("package.json") ? "package.json" : null;
82
+ }
83
+ const VALID_PACKAGE_SPECIFIER = /^(@[\w.-]+\/[\w.-]+|[\w@][\w.-]*)(?:\/[\w./-]*)?$/;
84
+ export function isValidPackageSpecifier(specifier) {
85
+ if (!specifier || specifier.startsWith(".") || specifier.startsWith("@/"))
86
+ return false;
87
+ if (/^https?:|^node:/.test(specifier))
88
+ return false;
89
+ if (/[:()\\]/.test(specifier))
90
+ return false;
91
+ return VALID_PACKAGE_SPECIFIER.test(specifier);
92
+ }
93
+ /** Extract module specifiers from full file content (legacy agent-gate parity). */
94
+ export function extractAllImports(content) {
95
+ const results = [];
96
+ const patterns = [
97
+ /\bimport\s+(?:type\s+)?(?:[^'"]+\s+from\s+)?['"]([^'"]+)['"]/g,
98
+ /\bexport\s+(?:type\s+)?(?:[^'"]+\s+from\s+)['"]([^'"]+)['"]/g,
99
+ /\brequire\(\s*['"]([^'"]+)['"]\s*\)/g,
100
+ /\bimport\(\s*['"]([^'"]+)['"]\s*\)/g,
101
+ ];
102
+ for (const pattern of patterns) {
103
+ pattern.lastIndex = 0;
104
+ for (const match of content.matchAll(pattern)) {
105
+ const specifier = match[1];
106
+ if (!specifier)
107
+ continue;
108
+ const line = content.slice(0, match.index ?? 0).split("\n").length;
109
+ results.push({ specifier, line });
110
+ }
111
+ }
112
+ return results;
113
+ }
114
+ export function linesForFreshnessScan(file) {
115
+ if (typeof file.content === "string")
116
+ return file.content.split("\n");
117
+ return addedLines(file.patch);
118
+ }
119
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/shared/submission-checks/helpers.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAI9D,MAAM,UAAU,aAAa,CAAC,QAAgB;IAC5C,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,MAAM,IAAI,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;IACrC,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAyB;IAClD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,OAAO,KAAK;SACT,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;SACjE,GAAG,CAAC,CAAC,IAAI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18 @@
1
+ import type { SubmissionCheckResult } from "../types.js";
2
+ import type { SubmissionCheckContext, SubmissionFileInfo } from "./types.js";
3
+ export declare function suggestionMarkdownFiles(ctx: SubmissionCheckContext): SubmissionFileInfo[];
4
+ export declare function detectOutputSizeMin(ctx: SubmissionCheckContext): SubmissionCheckResult | null;
5
+ export declare function detectActionExtractionPresent(ctx: SubmissionCheckContext): SubmissionCheckResult | null;
6
+ export declare function detectDeltaSectionPresent(ctx: SubmissionCheckContext): SubmissionCheckResult | null;
7
+ export declare function detectPreambleAbsent(ctx: SubmissionCheckContext): SubmissionCheckResult | null;
8
+ export declare function detectGraduationSignalsSectionPresent(ctx: SubmissionCheckContext): SubmissionCheckResult | null;
9
+ export declare function detectFabricatedIdCheck(ctx: SubmissionCheckContext): SubmissionCheckResult | null;
10
+ export declare function detectSessionNarrativeDetection(ctx: SubmissionCheckContext): SubmissionCheckResult | null;
11
+ export declare function detectIncompletenessSelfFlag(ctx: SubmissionCheckContext): SubmissionCheckResult | null;
12
+ export declare function detectReferencedFilesExist(ctx: SubmissionCheckContext): SubmissionCheckResult | null;
13
+ export declare function detectPrerequisiteSecretsCheck(ctx: SubmissionCheckContext): SubmissionCheckResult | null;
14
+ export declare function detectDependencyDagValidation(ctx: SubmissionCheckContext): SubmissionCheckResult | null;
15
+ export declare function detectUncommittedFixCheck(ctx: SubmissionCheckContext): SubmissionCheckResult | null;
16
+ export declare function detectVerificationOwnerAssigned(ctx: SubmissionCheckContext): SubmissionCheckResult | null;
17
+ export declare function detectExternalInterfaceValidation(ctx: SubmissionCheckContext): SubmissionCheckResult | null;
18
+ export declare function runPhase0Detectors(ctx: SubmissionCheckContext): SubmissionCheckResult[];
@@ -0,0 +1,374 @@
1
+ // Phase 0 agent suggestion checks (weight=0 / advisory in Trailhead).
2
+ // Ported from komatik-agents agent-gate-checks Phase 0 stubs with real heuristics.
3
+ import { fileContent, normalizePath } from "./helpers.js";
4
+ const SEVERITY = "advisory";
5
+ const OUTPUT_SIZE_MIN_CHARS = 400;
6
+ const NARRATIVE_MATCH_THRESHOLD = 3;
7
+ const PREAMBLE_OPENERS = /^(let me|here is the|here's the|i('| wi)ll|after reviewing|to start|based on my analysis)/i;
8
+ const SESSION_NARRATIVE = /\bI (queried|reviewed|checked|will (build|create|fix|implement|add|update))/gi;
9
+ const PARTIAL_COMPLETION = /\b\d+\s*(?:\/|of)\s*\d+\b/i;
10
+ const INCOMPLETE_MARKER = /\b(INCOMPLETE|PARTIAL)\b/i;
11
+ const FABRICATED_ID = /\b(session|run|task|message)[-_]?[a-f0-9]{6,}\b/gi;
12
+ const FILE_REF = /(?:^|[\s('"`])((?:src|scripts|supabase|app|agents)\/[a-z0-9_/.-]+\.(?:ts|tsx|js|mjs|sql|py|md))/gi;
13
+ const ACTION_SUFFIX = /(?:→\s*@[\w-]+|— No actions surfaced)\s*$/i;
14
+ const UNVERIFIED_MARKER = /\[UNVERIFIED\]|verify after|needs verification/i;
15
+ const OWNER_DUE = /Owner:\s*@[\w-]+[\s\S]{0,120}Due:\s*\d{4}-\d{2}-\d{2}/i;
16
+ const FIX_CLAIM = /\b(fix applied|now working|is live|deployed successfully)\b/i;
17
+ const MULTI_PHASE = /\bphase\s+[ab12]\b/gi;
18
+ const DEP_MATRIX = /\b(depends on:|dependency matrix|blocks:|x blocks y)\b/i;
19
+ const RUNBOOK_HINT = /runbook|deploy(?:ment)? guide/i;
20
+ const SECRETS_PREREQ = /\b(secrets list|prerequisites:|required env|environment variables)\b/i;
21
+ const PROPOSAL_ONLY = /\bPROPOSAL_ONLY\b/i;
22
+ const SCHEMA_LINK = /https?:\/\/[^\s)]+\/(schema|openapi|api-docs)/i;
23
+ function advisory(partial) {
24
+ return { severity: SEVERITY, autofix_eligible: false, ...partial };
25
+ }
26
+ export function suggestionMarkdownFiles(ctx) {
27
+ return ctx.files.filter((file) => {
28
+ const path = normalizePath(file.filename);
29
+ if (!/\.md$/i.test(path))
30
+ return false;
31
+ return /agents\/[^/]+\/suggestions\//.test(path) || /\/suggestions\//.test(path);
32
+ });
33
+ }
34
+ function agentFromPath(filePath) {
35
+ const match = normalizePath(filePath).match(/^agents\/([^/]+)\//);
36
+ return match?.[1] ?? null;
37
+ }
38
+ function paragraphs(text) {
39
+ return text
40
+ .split(/\n\s*\n/)
41
+ .map((p) => p.trim())
42
+ .filter((p) => p.length > 0 && !/^#+\s/.test(p));
43
+ }
44
+ function extractFileRefs(text) {
45
+ const refs = new Set();
46
+ const re = new RegExp(FILE_REF.source, FILE_REF.flags);
47
+ let m;
48
+ while ((m = re.exec(text)) !== null) {
49
+ if (m[1])
50
+ refs.add(normalizePath(m[1]));
51
+ }
52
+ const backtick = /`((?:src|scripts|supabase|app|agents)\/[a-z0-9_/.-]+\.[a-z]+)`/gi;
53
+ while ((m = backtick.exec(text)) !== null) {
54
+ refs.add(normalizePath(m[1]));
55
+ }
56
+ return [...refs];
57
+ }
58
+ function hasToBeCreatedMarker(text, ref) {
59
+ const idx = text.indexOf(ref);
60
+ if (idx < 0)
61
+ return false;
62
+ const window = text.slice(Math.max(0, idx - 80), idx + ref.length + 80);
63
+ return /to-be-created|to be created|TBD path/i.test(window);
64
+ }
65
+ export function detectOutputSizeMin(ctx) {
66
+ const files = suggestionMarkdownFiles(ctx);
67
+ const short = files.filter((f) => fileContent(f).trim().length < OUTPUT_SIZE_MIN_CHARS);
68
+ if (short.length === 0)
69
+ return null;
70
+ return advisory({
71
+ code: "output_size_min",
72
+ title: "Agent output below minimum size",
73
+ detail: `Suggestion markdown under ${OUTPUT_SIZE_MIN_CHARS} chars (possible model bail-out): ${short.map((f) => f.filename).join(", ")}.`,
74
+ files: short.map((f) => f.filename),
75
+ suggested_action: "Expand the proposal with concrete actions and file-level detail.",
76
+ });
77
+ }
78
+ export function detectActionExtractionPresent(ctx) {
79
+ const files = suggestionMarkdownFiles(ctx).filter((f) => agentFromPath(f.filename) === "coordinator");
80
+ const missing = [];
81
+ for (const file of files) {
82
+ const paras = paragraphs(fileContent(file));
83
+ const bad = paras.filter((p) => !ACTION_SUFFIX.test(p));
84
+ if (bad.length > 0)
85
+ missing.push(file.filename);
86
+ }
87
+ if (missing.length === 0)
88
+ return null;
89
+ return advisory({
90
+ code: "action_extraction_present",
91
+ title: "Coordinator paragraph missing action extraction",
92
+ detail: `Paragraphs should end with "→ @owner" or "— No actions surfaced": ${missing.join(", ")}.`,
93
+ files: missing,
94
+ suggested_action: "Add explicit owner routing or a no-actions line per paragraph.",
95
+ });
96
+ }
97
+ export function detectDeltaSectionPresent(ctx) {
98
+ const files = suggestionMarkdownFiles(ctx).filter((f) => {
99
+ const agent = agentFromPath(f.filename);
100
+ const path = normalizePath(f.filename);
101
+ return agent === "knowledge-scout" || /DAILY-INTEL\.md$/i.test(path);
102
+ });
103
+ const missing = [];
104
+ for (const file of files) {
105
+ const text = fileContent(file);
106
+ if (!/## Δ Since Last Sweep/i.test(text) && !/No deltas — quiet sweep/i.test(text)) {
107
+ missing.push(file.filename);
108
+ }
109
+ }
110
+ if (missing.length === 0)
111
+ return null;
112
+ return advisory({
113
+ code: "delta_section_present",
114
+ title: "Missing delta section (knowledge-scout)",
115
+ detail: `Require "## Δ Since Last Sweep" or "No deltas — quiet sweep": ${missing.join(", ")}.`,
116
+ files: missing,
117
+ suggested_action: "Add a delta header or explicit quiet-sweep line.",
118
+ });
119
+ }
120
+ export function detectPreambleAbsent(ctx) {
121
+ const hits = [];
122
+ for (const file of suggestionMarkdownFiles(ctx)) {
123
+ const paras = paragraphs(fileContent(file)).slice(0, 2);
124
+ if (paras.some((p) => PREAMBLE_OPENERS.test(p.split("\n")[0]?.trim() ?? ""))) {
125
+ hits.push(file.filename);
126
+ }
127
+ }
128
+ if (hits.length === 0)
129
+ return null;
130
+ return advisory({
131
+ code: "preamble_absent",
132
+ title: "Conversational preamble detected",
133
+ detail: `Opening paragraphs use session-style preambles: ${hits.join(", ")}.`,
134
+ files: hits,
135
+ suggested_action: "Start with structured content, not meta narration.",
136
+ });
137
+ }
138
+ export function detectGraduationSignalsSectionPresent(ctx) {
139
+ const files = suggestionMarkdownFiles(ctx).filter((f) => agentFromPath(f.filename) === "rd-satellite");
140
+ const missing = files
141
+ .filter((f) => !/## Graduation Signals/i.test(fileContent(f)))
142
+ .map((f) => f.filename);
143
+ if (missing.length === 0)
144
+ return null;
145
+ return advisory({
146
+ code: "graduation_signals_section_present",
147
+ title: "Missing Graduation Signals section",
148
+ detail: `rd-satellite output requires "## Graduation Signals": ${missing.join(", ")}.`,
149
+ files: missing,
150
+ suggested_action: "Add a Graduation Signals section with promotion criteria.",
151
+ });
152
+ }
153
+ export function detectFabricatedIdCheck(ctx) {
154
+ const hits = [];
155
+ const ids = [];
156
+ for (const file of suggestionMarkdownFiles(ctx)) {
157
+ const text = fileContent(file);
158
+ const re = new RegExp(FABRICATED_ID.source, FABRICATED_ID.flags);
159
+ let m;
160
+ while ((m = re.exec(text)) !== null) {
161
+ ids.push(m[0]);
162
+ hits.push(file.filename);
163
+ }
164
+ }
165
+ if (ids.length === 0)
166
+ return null;
167
+ return advisory({
168
+ code: "fabricated_id_check",
169
+ title: "Suspicious session/run identifiers",
170
+ detail: `Verify identifiers against agent_runs/tasks/messages: ${[...new Set(ids)].slice(0, 8).join(", ")}.`,
171
+ files: [...new Set(hits)],
172
+ suggested_action: "Replace fabricated IDs with verified references or remove them.",
173
+ });
174
+ }
175
+ export function detectSessionNarrativeDetection(ctx) {
176
+ const hits = [];
177
+ let total = 0;
178
+ for (const file of suggestionMarkdownFiles(ctx)) {
179
+ const text = fileContent(file);
180
+ const re = new RegExp(SESSION_NARRATIVE.source, SESSION_NARRATIVE.flags);
181
+ const matches = text.match(re);
182
+ // Per-file threshold: flag a single document dense with first-person
183
+ // session narration, not a cumulative count that a large multi-file
184
+ // submission would trip just by volume.
185
+ if (matches && matches.length >= NARRATIVE_MATCH_THRESHOLD) {
186
+ total += matches.length;
187
+ hits.push(file.filename);
188
+ }
189
+ }
190
+ if (hits.length === 0)
191
+ return null;
192
+ return advisory({
193
+ code: "session_narrative_detection",
194
+ title: "Session narrative instead of file content",
195
+ detail: `${total} first-person session phrases in ${hits.join(", ")}.`,
196
+ files: hits,
197
+ suggested_action: "Replace narration with concrete diffs, paths, and commands.",
198
+ });
199
+ }
200
+ export function detectIncompletenessSelfFlag(ctx) {
201
+ const hits = [];
202
+ for (const file of suggestionMarkdownFiles(ctx)) {
203
+ const text = fileContent(file);
204
+ if (PARTIAL_COMPLETION.test(text) && !INCOMPLETE_MARKER.test(text)) {
205
+ hits.push(file.filename);
206
+ }
207
+ }
208
+ if (hits.length === 0)
209
+ return null;
210
+ return advisory({
211
+ code: "incompleteness_self_flag",
212
+ title: "Partial completion without INCOMPLETE marker",
213
+ detail: `Fractional completion hints require INCOMPLETE/PARTIAL flag: ${hits.join(", ")}.`,
214
+ files: hits,
215
+ suggested_action: 'Add an explicit "INCOMPLETE" or "PARTIAL" marker for scoped work.',
216
+ });
217
+ }
218
+ export function detectReferencedFilesExist(ctx) {
219
+ // Needs a repo file listing to tell a fabricated path from a reference to an
220
+ // existing, unchanged file. Without it, stay dormant — flagging every path
221
+ // that merely isn't part of this PR is almost all false positives.
222
+ if (!ctx.repoPaths)
223
+ return null;
224
+ const repoPaths = ctx.repoPaths;
225
+ const missing = [];
226
+ for (const file of suggestionMarkdownFiles(ctx)) {
227
+ const text = fileContent(file);
228
+ for (const ref of extractFileRefs(text)) {
229
+ const known = ctx.prPaths.has(ref) ||
230
+ repoPaths.has(ref) ||
231
+ [...ctx.prPaths].some((p) => p.endsWith(`/${ref}`)) ||
232
+ [...repoPaths].some((p) => p.endsWith(`/${ref}`));
233
+ if (!known && !hasToBeCreatedMarker(text, ref)) {
234
+ missing.push(`${file.filename}: ${ref}`);
235
+ }
236
+ }
237
+ }
238
+ if (missing.length === 0)
239
+ return null;
240
+ return advisory({
241
+ code: "referenced_files_exist",
242
+ title: "Referenced path missing from PR and repo",
243
+ detail: missing.slice(0, 12).join("; "),
244
+ files: missing.map((m) => m.split(": ")[0] ?? m),
245
+ suggested_action: 'Include the file in the PR or mark adjacent "to-be-created".',
246
+ });
247
+ }
248
+ export function detectPrerequisiteSecretsCheck(ctx) {
249
+ const hits = [];
250
+ for (const file of suggestionMarkdownFiles(ctx)) {
251
+ const path = normalizePath(file.filename);
252
+ const text = fileContent(file);
253
+ const titleLine = text.split("\n").find((l) => /^#\s/.test(l)) ?? "";
254
+ if (!RUNBOOK_HINT.test(`${path} ${titleLine}`))
255
+ continue;
256
+ const head = text.split("\n").slice(0, 30).join("\n");
257
+ if (!SECRETS_PREREQ.test(head))
258
+ hits.push(file.filename);
259
+ }
260
+ if (hits.length === 0)
261
+ return null;
262
+ return advisory({
263
+ code: "prerequisite_secrets_check",
264
+ title: "Runbook missing secrets prerequisite step",
265
+ detail: `First 30 lines should include secrets/env prerequisites: ${hits.join(", ")}.`,
266
+ files: hits,
267
+ suggested_action: "Open runbooks with Prerequisites or `secrets list` verification.",
268
+ });
269
+ }
270
+ export function detectDependencyDagValidation(ctx) {
271
+ const hits = [];
272
+ for (const file of suggestionMarkdownFiles(ctx)) {
273
+ const text = fileContent(file);
274
+ const phases = (text.match(MULTI_PHASE) ?? []).length;
275
+ if (phases >= 2 && !DEP_MATRIX.test(text)) {
276
+ hits.push(file.filename);
277
+ }
278
+ }
279
+ if (hits.length === 0)
280
+ return null;
281
+ return advisory({
282
+ code: "dependency_dag_validation",
283
+ title: "Multi-phase plan missing dependency matrix",
284
+ detail: `Multi-phase proposals need Depends on / blocks lines: ${hits.join(", ")}.`,
285
+ files: hits,
286
+ suggested_action: "Add explicit phase dependencies (X blocks Y).",
287
+ });
288
+ }
289
+ export function detectUncommittedFixCheck(ctx) {
290
+ const hits = [];
291
+ for (const file of suggestionMarkdownFiles(ctx)) {
292
+ if (FIX_CLAIM.test(fileContent(file)))
293
+ hits.push(file.filename);
294
+ }
295
+ if (hits.length === 0)
296
+ return null;
297
+ return advisory({
298
+ code: "uncommitted_fix_check",
299
+ title: "Fix claim requires commit verification",
300
+ detail: `Claims like "fix applied" / "now working" need matching git history: ${hits.join(", ")}.`,
301
+ files: hits,
302
+ suggested_action: "Reference the commit SHA or flag changes as on-disk pending commit.",
303
+ });
304
+ }
305
+ export function detectVerificationOwnerAssigned(ctx) {
306
+ const hits = [];
307
+ for (const file of suggestionMarkdownFiles(ctx)) {
308
+ const lines = fileContent(file).split("\n");
309
+ for (let i = 0; i < lines.length; i++) {
310
+ if (!UNVERIFIED_MARKER.test(lines[i] ?? ""))
311
+ continue;
312
+ const window = lines.slice(i, i + 6).join("\n");
313
+ if (!OWNER_DUE.test(window)) {
314
+ hits.push(file.filename);
315
+ break;
316
+ }
317
+ }
318
+ }
319
+ if (hits.length === 0)
320
+ return null;
321
+ return advisory({
322
+ code: "verification_owner_assigned",
323
+ title: "UNVERIFIED item missing owner and due date",
324
+ detail: `Add Owner: @user and Due: YYYY-MM-DD near unverified items: ${[...new Set(hits)].join(", ")}.`,
325
+ files: [...new Set(hits)],
326
+ suggested_action: "Assign verification owner and due date for each UNVERIFIED line.",
327
+ });
328
+ }
329
+ export function detectExternalInterfaceValidation(ctx) {
330
+ const hits = [];
331
+ for (const file of suggestionMarkdownFiles(ctx)) {
332
+ const path = normalizePath(file.filename);
333
+ const crossRepo = /suggestions\/(?!komatik-agents)[^/]+\//.test(path);
334
+ if (!crossRepo)
335
+ continue;
336
+ const text = fileContent(file);
337
+ if (!PROPOSAL_ONLY.test(text) && !SCHEMA_LINK.test(text)) {
338
+ hits.push(file.filename);
339
+ }
340
+ }
341
+ if (hits.length === 0)
342
+ return null;
343
+ return advisory({
344
+ code: "external_interface_validation",
345
+ title: "Cross-repo proposal lacks schema verification",
346
+ detail: `Cross-repo suggestions need PROPOSAL_ONLY or verified schema link: ${hits.join(", ")}.`,
347
+ files: hits,
348
+ suggested_action: "Link verified target schema or mark PROPOSAL_ONLY.",
349
+ });
350
+ }
351
+ export function runPhase0Detectors(ctx) {
352
+ if (suggestionMarkdownFiles(ctx).length === 0)
353
+ return [];
354
+ const checks = [
355
+ detectOutputSizeMin,
356
+ detectActionExtractionPresent,
357
+ detectDeltaSectionPresent,
358
+ detectPreambleAbsent,
359
+ detectGraduationSignalsSectionPresent,
360
+ detectFabricatedIdCheck,
361
+ detectSessionNarrativeDetection,
362
+ detectIncompletenessSelfFlag,
363
+ detectReferencedFilesExist,
364
+ detectPrerequisiteSecretsCheck,
365
+ detectDependencyDagValidation,
366
+ detectUncommittedFixCheck,
367
+ detectVerificationOwnerAssigned,
368
+ detectExternalInterfaceValidation,
369
+ ];
370
+ return checks
371
+ .map((fn) => fn(ctx))
372
+ .filter((check) => check !== null);
373
+ }
374
+ //# sourceMappingURL=phase0-detectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase0-detectors.js","sourceRoot":"","sources":["../../../src/shared/submission-checks/phase0-detectors.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,mFAAmF;AAInF,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE1D,MAAM,QAAQ,GAAG,UAAmB,CAAC;AACrC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAEpC,MAAM,gBAAgB,GACpB,4FAA4F,CAAC;AAC/F,MAAM,iBAAiB,GACrB,+EAA+E,CAAC;AAClF,MAAM,kBAAkB,GAAG,4BAA4B,CAAC;AACxD,MAAM,iBAAiB,GAAG,2BAA2B,CAAC;AACtD,MAAM,aAAa,GAAG,mDAAmD,CAAC;AAC1E,MAAM,QAAQ,GACZ,mGAAmG,CAAC;AACtG,MAAM,aAAa,GAAG,4CAA4C,CAAC;AACnE,MAAM,iBAAiB,GAAG,iDAAiD,CAAC;AAC5E,MAAM,SAAS,GAAG,wDAAwD,CAAC;AAC3E,MAAM,SAAS,GAAG,8DAA8D,CAAC;AACjF,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAC3C,MAAM,UAAU,GAAG,yDAAyD,CAAC;AAC7E,MAAM,YAAY,GAAG,gCAAgC,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,IAAI,CAAC;IACnC,OAAO,QAAQ,CAAC;QACd,IAAI,EAAE,+BAA+B;QACrC,KAAK,EAAE,+CAA+C;QACtD,MAAM,EAAE,sEAAsE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;QAChG,KAAK,EAAE,IAAI;QACX,gBAAgB,EAAE,oDAAoD;KACvE,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,GAA2B;IAC5D,IAAI,uBAAuB,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACzD,MAAM,MAAM,GAAG;QACb,mBAAmB;QACnB,6BAA6B;QAC7B,yBAAyB;QACzB,oBAAoB;QACpB,qCAAqC;QACrC,uBAAuB;QACvB,+BAA+B;QAC/B,4BAA4B;QAC5B,0BAA0B;QAC1B,8BAA8B;QAC9B,6BAA6B;QAC7B,yBAAyB;QACzB,+BAA+B;QAC/B,iCAAiC;KAClC,CAAC;IACF,OAAO,MAAM;SACV,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;SACpB,MAAM,CAAC,CAAC,KAAK,EAAkC,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;AACvE,CAAC"}
@@ -0,0 +1,2 @@
1
+ /** Returns a one-line error message, or null when content parses cleanly. */
2
+ export declare function validateFileSyntax(filename: string, content: string): string | null;
@@ -0,0 +1,44 @@
1
+ // Real parse-based syntax validation for Gate 1 (no bracket-count fallback).
2
+ // Parses full file content only — never a partial diff hunk (see submission-gate.md).
3
+ import { parseSync } from "@swc/core";
4
+ import yaml from "js-yaml";
5
+ import { extensionOf } from "./helpers.js";
6
+ const PARSEABLE = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
7
+ function parserOptionsFor(ext) {
8
+ const isTs = ext === ".ts" || ext === ".tsx";
9
+ return {
10
+ syntax: isTs ? "typescript" : "ecmascript",
11
+ tsx: ext === ".tsx",
12
+ jsx: ext === ".jsx",
13
+ decorators: true,
14
+ dynamicImport: true,
15
+ };
16
+ }
17
+ /** Returns a one-line error message, or null when content parses cleanly. */
18
+ export function validateFileSyntax(filename, content) {
19
+ if (!content.trim())
20
+ return null;
21
+ const ext = extensionOf(filename);
22
+ try {
23
+ if (PARSEABLE.includes(ext)) {
24
+ parseSync(content, parserOptionsFor(ext));
25
+ }
26
+ else if (ext === ".json") {
27
+ JSON.parse(content);
28
+ }
29
+ else if (ext === ".yaml" || ext === ".yml") {
30
+ yaml.load(content);
31
+ }
32
+ else if (ext === ".md" && content.startsWith("---")) {
33
+ const end = content.indexOf("\n---", 3);
34
+ if (end > 0)
35
+ yaml.load(content.slice(3, end));
36
+ }
37
+ }
38
+ catch (error) {
39
+ const message = error instanceof Error ? error.message.split("\n")[0] : String(error);
40
+ return message || "Parse error";
41
+ }
42
+ return null;
43
+ }
44
+ //# sourceMappingURL=syntax-validity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syntax-validity.js","sourceRoot":"","sources":["../../../src/shared/submission-checks/syntax-validity.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,sFAAsF;AAEtF,OAAO,EAAE,SAAS,EAAqB,MAAM,WAAW,CAAC;AACzD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAE1E,SAAS,gBAAgB,CAAC,GAAW;IACnC,MAAM,IAAI,GAAG,GAAG,KAAK,KAAK,IAAI,GAAG,KAAK,MAAM,CAAC;IAC7C,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY;QAC1C,GAAG,EAAE,GAAG,KAAK,MAAM;QACnB,GAAG,EAAE,GAAG,KAAK,MAAM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AC;AACd,CAAC"}
@@ -0,0 +1,33 @@
1
+ export interface SubmissionFileInfo {
2
+ filename: string;
3
+ patch?: string;
4
+ status?: string;
5
+ /** Full file content when fetched by the gate (optional). */
6
+ content?: string;
7
+ additions?: number;
8
+ }
9
+ export interface NamingAllowlistConfig {
10
+ skip_extensions?: string[];
11
+ skip_path_patterns?: string[];
12
+ skip_comment_markers?: string[];
13
+ skip_in_imports?: boolean;
14
+ }
15
+ export interface SubmissionCheckContext {
16
+ files: SubmissionFileInfo[];
17
+ prPaths: Set<string>;
18
+ komatikInstance: boolean;
19
+ staleTerms: string[];
20
+ namingAllowlist: NamingAllowlistConfig;
21
+ authRouteAllowlist: string[];
22
+ maxFileLines: number;
23
+ declaredPackages: Set<string>;
24
+ /** Extra path segments to skip for context_freshness (merged with defaults). */
25
+ pathIgnorePatterns: string[];
26
+ /**
27
+ * Full set of paths that exist in the target repo (e.g. `git ls-files`),
28
+ * used to tell a fabricated reference from a reference to an existing,
29
+ * unchanged file. When absent, existence-dependent checks stay dormant
30
+ * rather than flag every path that simply isn't part of this PR.
31
+ */
32
+ repoPaths?: Set<string>;
33
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/shared/submission-checks/types.ts"],"names":[],"mappings":""}