sneakoscope 5.7.0 → 5.9.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.
Files changed (88) hide show
  1. package/README.md +1 -1
  2. package/config/competitor-scorecard-baseline.json +97 -0
  3. package/config/perf-budgets.v1.json +10 -0
  4. package/crates/sks-core/Cargo.lock +1 -1
  5. package/crates/sks-core/Cargo.toml +1 -1
  6. package/crates/sks-core/src/main.rs +1 -1
  7. package/dist/bin/sks.js +61 -1
  8. package/dist/cli/command-registry.js +2 -3
  9. package/dist/cli/commands-fast.js +20 -0
  10. package/dist/cli/root-fast.js +48 -0
  11. package/dist/cli/router.js +3 -0
  12. package/dist/cli/super-search-command.js +221 -0
  13. package/dist/cli/xai-command.js +7 -7
  14. package/dist/commands/doctor.js +56 -24
  15. package/dist/config/skills-manifest.json +63 -70
  16. package/dist/core/agents/agent-codex-cockpit.js +3 -3
  17. package/dist/core/agents/agent-orchestrator.js +20 -2
  18. package/dist/core/agents/agent-wrongness.js +1 -1
  19. package/dist/core/agents/native-cli-session-swarm.js +14 -1
  20. package/dist/core/agents/parallel-runtime-proof.js +82 -8
  21. package/dist/core/agents/parallel-write-fixture.js +301 -0
  22. package/dist/core/commands/gc-command.js +12 -6
  23. package/dist/core/commands/run-command.js +20 -18
  24. package/dist/core/doctor/doctor-idempotence.js +93 -0
  25. package/dist/core/errors/blocker-humanizer.js +13 -0
  26. package/dist/core/errors/next-action-map.js +56 -0
  27. package/dist/core/feature-fixtures.js +15 -8
  28. package/dist/core/fsx.js +1 -1
  29. package/dist/core/init/skills.js +1 -2
  30. package/dist/core/install/installed-package-smoke.js +121 -0
  31. package/dist/core/mission.js +41 -15
  32. package/dist/core/naruto/naruto-active-pool.js +6 -2
  33. package/dist/core/perf/perf-budget.js +145 -0
  34. package/dist/core/quality/competitor-scorecard.js +116 -0
  35. package/dist/core/release/gate-timing.js +103 -0
  36. package/dist/core/release-parallel-full-coverage.js +1 -1
  37. package/dist/core/retention/retention-budget.js +62 -0
  38. package/dist/core/retention.js +1 -1
  39. package/dist/core/routes/constants.js +2 -2
  40. package/dist/core/routes.js +155 -53
  41. package/dist/core/source-intelligence/source-intelligence-policy.js +5 -5
  42. package/dist/core/source-intelligence/source-intelligence-proof.js +8 -8
  43. package/dist/core/source-intelligence/source-intelligence-runner.js +16 -16
  44. package/dist/core/strategy/strategy-gate.js +2 -1
  45. package/dist/core/super-search/doctor.js +63 -0
  46. package/dist/core/super-search/runtime-helpers.js +289 -0
  47. package/dist/core/super-search/runtime.js +270 -0
  48. package/dist/core/super-search/source-records.js +96 -0
  49. package/dist/core/super-search/types.js +3 -0
  50. package/dist/core/trust-kernel/trust-report.js +3 -3
  51. package/dist/core/verification/real-evidence-policy.js +55 -0
  52. package/dist/core/version.js +1 -1
  53. package/dist/scripts/agent-fast-mode-default-check.js +10 -1
  54. package/dist/scripts/agent-visual-consistency-check.js +1 -1
  55. package/dist/scripts/check-architecture.js +0 -1
  56. package/dist/scripts/competitor-scorecard-check.js +25 -0
  57. package/dist/scripts/doctor-idempotence-check.js +8 -0
  58. package/dist/scripts/gate-timing-check.js +8 -0
  59. package/dist/scripts/hook-latency-quantum-check.js +122 -0
  60. package/dist/scripts/installed-package-smoke-check.js +12 -0
  61. package/dist/scripts/lib/native-cli-session-swarm-check-lib.js +2 -0
  62. package/dist/scripts/mutation-callsite-coverage-check.js +7 -0
  63. package/dist/scripts/package-published-contract-check.js +7 -0
  64. package/dist/scripts/packlist-performance-check.js +31 -3
  65. package/dist/scripts/parallel-production-smoke-check.js +21 -0
  66. package/dist/scripts/perf-budget-check.js +14 -0
  67. package/dist/scripts/quantum-baseline-report.js +38 -0
  68. package/dist/scripts/release-check-stamp.js +117 -16
  69. package/dist/scripts/release-metadata-1-19-check.js +2 -2
  70. package/dist/scripts/release-parallel-check.js +2 -2
  71. package/dist/scripts/release-parallel-full-coverage-check.js +1 -1
  72. package/dist/scripts/retention-budget-check.js +8 -0
  73. package/dist/scripts/route-intent-regression-check.js +44 -0
  74. package/dist/scripts/sks-1-18-gate-lib.js +2 -2
  75. package/dist/scripts/source-intelligence-all-modes-check.js +2 -2
  76. package/dist/scripts/source-intelligence-policy-check.js +1 -1
  77. package/dist/scripts/super-search-live-smoke-check.js +70 -0
  78. package/dist/scripts/super-search-name-guard-check.js +98 -0
  79. package/dist/scripts/super-search-offline-contract-check.js +45 -0
  80. package/dist/scripts/{ultra-search-provider-interface-check.js → super-search-provider-interface-check.js} +9 -9
  81. package/dist/scripts/trust-fixture-check.js +19 -6
  82. package/package.json +26 -8
  83. package/schemas/agents/parallel-runtime-proof.schema.json +17 -1
  84. package/dist/cli/insane-search-command.js +0 -195
  85. package/dist/core/ultra-search/runtime.js +0 -502
  86. package/dist/core/ultra-search/types.js +0 -3
  87. package/dist/scripts/release-readiness-report.js +0 -1262
  88. /package/dist/core/{ultra-search → super-search}/index.js +0 -0
@@ -149,8 +149,8 @@ function sourceIntelligenceTrust(proof = {}) {
149
149
  const issues = [...proofBlockers];
150
150
  if (evidence.policy?.context7?.required === true && evidence.context7?.ok !== true)
151
151
  issues.push('context7_missing');
152
- if (evidence.policy?.codex_web_search?.required === true && evidence.ultra_search?.proof?.provider_independent !== true)
153
- issues.push('ultra_search_provider_independent_proof_missing');
152
+ if (evidence.policy?.codex_web_search?.required === true && evidence.super_search?.proof?.provider_independent !== true)
153
+ issues.push('super_search_provider_independent_proof_missing');
154
154
  return {
155
155
  issues: [...new Set(issues.map(String))],
156
156
  summary: {
@@ -160,7 +160,7 @@ function sourceIntelligenceTrust(proof = {}) {
160
160
  mode: evidence.mode || evidence.policy?.mode || 'unknown',
161
161
  context7_status: evidence.context7?.status || 'unknown',
162
162
  codex_web_status: evidence.codex_web_search?.status || 'not_required',
163
- ultra_search_status: evidence.ultra_search?.proof?.ok === true ? 'verified' : evidence.ultra_search ? 'partial' : 'not_required',
163
+ super_search_status: evidence.super_search?.proof?.ok === true ? 'verified' : evidence.super_search ? 'partial' : 'not_required',
164
164
  providers_completed: evidence.parallel?.providers_completed || [],
165
165
  blockers: proofBlockers
166
166
  }
@@ -0,0 +1,55 @@
1
+ export function evaluateRealEvidencePolicy(input) {
2
+ const productionMode = input.productionMode !== false;
3
+ const sources = Array.isArray(input.sources) ? input.sources : [];
4
+ const claims = Array.isArray(input.claims) ? input.claims : [];
5
+ const blockers = [];
6
+ const warnings = [];
7
+ const verifiedSources = sources.filter((source) => source?.acquisition_verdict === 'verified_content');
8
+ const sourceIds = new Set(sources.map((source) => String(source?.source_id || '')).filter(Boolean));
9
+ if (!sources.length)
10
+ blockers.push('source_acquisition_unavailable');
11
+ if (productionMode && sources.some((source) => sourceLooksMockOrFixture(source)))
12
+ blockers.push('production_source_fixture_or_mock');
13
+ if (productionMode && input.proof?.mock_only === true)
14
+ blockers.push('production_proof_mock_only');
15
+ if (Number(input.proof?.verified_source_count || 0) > 0 && verifiedSources.length === 0)
16
+ blockers.push('verified_source_count_without_verified_sources');
17
+ if (input.mode === 'url_acquisition' && !sources.some((source) => source?.canonical_url || source?.original_url))
18
+ blockers.push('missing_url_for_super_search_fetch');
19
+ if (sources.length && verifiedSources.length === 0)
20
+ blockers.push('verified_source_evidence_missing');
21
+ for (const claim of claims) {
22
+ const status = String(claim?.status || '');
23
+ if (status !== 'supported' && status !== 'verified')
24
+ continue;
25
+ const claimSourceIds = Array.isArray(claim?.source_ids) ? claim.source_ids.map(String).filter(Boolean) : [];
26
+ if (!claimSourceIds.length) {
27
+ blockers.push('supported_claim_without_sources');
28
+ continue;
29
+ }
30
+ if (claimSourceIds.some((id) => !sourceIds.has(id)))
31
+ blockers.push('supported_claim_missing_source_artifact');
32
+ const verifiedClaimSources = sources.filter((source) => claimSourceIds.includes(String(source?.source_id || '')) && source?.acquisition_verdict === 'verified_content');
33
+ if (!verifiedClaimSources.length)
34
+ blockers.push('supported_claim_without_verified_source');
35
+ }
36
+ return {
37
+ schema: 'sks.real-evidence-policy.v1',
38
+ ok: blockers.length === 0,
39
+ blockers: [...new Set(blockers)],
40
+ warnings: [...new Set(warnings)]
41
+ };
42
+ }
43
+ function sourceLooksMockOrFixture(source) {
44
+ const text = [
45
+ source?.provider_id,
46
+ source?.source_family,
47
+ source?.source_type,
48
+ source?.title,
49
+ source?.content_artifact,
50
+ ...(Array.isArray(source?.acquisition_path) ? source.acquisition_path : []),
51
+ ...(Array.isArray(source?.warnings) ? source.warnings : [])
52
+ ].join(' ');
53
+ return source?.local_only_raw === true || /\b(mock|fixture|fake|stub|synthetic)\b/i.test(text);
54
+ }
55
+ //# sourceMappingURL=real-evidence-policy.js.map
@@ -1,2 +1,2 @@
1
- export const PACKAGE_VERSION = '5.7.0';
1
+ export const PACKAGE_VERSION = '5.9.0';
2
2
  //# sourceMappingURL=version.js.map
@@ -22,7 +22,16 @@ function run(extra = []) {
22
22
  '2',
23
23
  '--json',
24
24
  ...extra
25
- ], { cwd: root, encoding: 'utf8', maxBuffer: 32 * 1024 * 1024 }));
25
+ ], {
26
+ cwd: root,
27
+ encoding: 'utf8',
28
+ env: {
29
+ ...process.env,
30
+ SKS_TEST_ISOLATION: '1',
31
+ SKS_RELEASE_FIXTURE_ACTIVE_ROUTE_BYPASS: '1'
32
+ },
33
+ maxBuffer: 32 * 1024 * 1024
34
+ }));
26
35
  }
27
36
  const defaultRun = run();
28
37
  const fastRun = run(['--fast']);
@@ -2,7 +2,7 @@
2
2
  // @ts-nocheck
3
3
  import { assertGate, emitGate, readText } from './sks-1-18-gate-lib.js';
4
4
  const cockpit = readText('src/core/agents/agent-codex-cockpit.ts');
5
- for (const token of ['source_intelligence_status', 'ultra_search_status', 'codex_web_search_status', 'goal_mode_status', 'terminal_session_status', 'zellij_attach_command']) {
5
+ for (const token of ['source_intelligence_status', 'super_search_status', 'codex_web_search_status', 'goal_mode_status', 'terminal_session_status', 'zellij_attach_command']) {
6
6
  assertGate(cockpit.includes(token), `Codex App cockpit missing ${token}`);
7
7
  }
8
8
  emitGate('agent:visual-consistency', { dashboard_fields: 6 });
@@ -8,7 +8,6 @@ const waivers = loadWaivers();
8
8
  const changedFiles = changedFileSet();
9
9
  runGate('pipeline-budget:check');
10
10
  runGate('pipeline-runtime:check');
11
- checkFacade('src/core/pipeline-runtime.ts', 300);
12
11
  checkLargeFiles();
13
12
  checkTsImports();
14
13
  checkDistRuntime();
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { generateCompetitorScorecard } from '../core/quality/competitor-scorecard.js';
5
+ import { readJson, writeJsonAtomic } from '../core/fsx.js';
6
+ const root = process.env.SKS_REPO_ROOT
7
+ ? path.resolve(process.env.SKS_REPO_ROOT)
8
+ : path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
9
+ const baselinePath = process.env.SKS_COMPETITOR_SCORECARD_BASELINE
10
+ ? path.resolve(process.env.SKS_COMPETITOR_SCORECARD_BASELINE)
11
+ : path.join(root, 'config', 'competitor-scorecard-baseline.json');
12
+ const reportPath = process.env.SKS_COMPETITOR_SCORECARD_REPORT
13
+ ? path.resolve(process.env.SKS_COMPETITOR_SCORECARD_REPORT)
14
+ : path.join(root, '.sneakoscope', 'reports', 'competitor-scorecard.json');
15
+ const baseline = await readJson(baselinePath);
16
+ const result = await generateCompetitorScorecard(root, baseline);
17
+ await writeJsonAtomic(reportPath, {
18
+ ...result.scorecard,
19
+ evidence: result.evidence,
20
+ ok: result.ok
21
+ });
22
+ console.log(JSON.stringify(result.scorecard, null, 2));
23
+ if (!result.ok)
24
+ process.exit(1);
25
+ //# sourceMappingURL=competitor-scorecard-check.js.map
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ // @ts-nocheck
3
+ import { assertGate, emitGate, importDist, root } from './sks-1-18-gate-lib.js';
4
+ const { runDoctorIdempotence } = await importDist('core/doctor/doctor-idempotence.js');
5
+ const report = await runDoctorIdempotence(root);
6
+ assertGate(report.ok, 'doctor_idempotence_failed', report);
7
+ emitGate('doctor:idempotence', { rollback_manifest_exists: report.rollback_manifest_exists });
8
+ //# sourceMappingURL=doctor-idempotence-check.js.map
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ // @ts-nocheck
3
+ import { assertGate, emitGate, importDist, root } from './sks-1-18-gate-lib.js';
4
+ const { writeGateTiming } = await importDist('core/release/gate-timing.js');
5
+ const report = await writeGateTiming(root);
6
+ assertGate(report.ok, 'release_gate_timing_failed', report);
7
+ emitGate('release:gate-timing', { total_ms: report.total_ms, slowest_gates: report.slowest_gates.slice(0, 3) });
8
+ //# sourceMappingURL=gate-timing-check.js.map
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/env node
2
+ // @ts-nocheck
3
+ import fs from 'node:fs';
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+ import { performance } from 'node:perf_hooks';
7
+ import { assertGate, emitGate, importDist, root } from './sks-1-18-gate-lib.js';
8
+ const { runProcess } = await importDist('core/fsx.js');
9
+ const scenarios = [
10
+ { name: 'no-state', prompt: 'hello', budget_p95_ms: 230 },
11
+ { name: 'active-route', prompt: 'continue current route', budget_p95_ms: 230, state: { mission_id: 'M-active', mode: 'TEAM', route: 'Team', route_command: '$Team', phase: 'EXECUTE', implementation_allowed: true } },
12
+ { name: 'stale-code-pack-note', prompt: 'status?', budget_p95_ms: 230, files: { '.sneakoscope/wiki/code-pack.json': JSON.stringify({ generated_at: '2000-01-01T00:00:00.000Z' }) } },
13
+ { name: 'no-question-queue', prompt: 'can I interrupt?', budget_p95_ms: 230, state: { mission_id: 'M-noq', mode: 'RESEARCH', phase: 'RESEARCH_RUNNING_NO_QUESTIONS' } },
14
+ { name: 'clarification-awaiting', prompt: 'here is the answer', budget_p95_ms: 230, state: { mission_id: 'M-clarify', mode: 'TEAM', phase: 'CLARIFICATION_AWAITING_ANSWERS', stop_gate: 'clarification-gate', ambiguity_gate_required: true, clarification_required: true, implementation_allowed: false } },
15
+ { name: 'super-search-prompt', prompt: '$Super-Search run "npm release notes"', budget_p95_ms: 420 },
16
+ { name: 'question-shaped-work-request', prompt: 'Can you fix the failing tests?', budget_p95_ms: 420 }
17
+ ];
18
+ const warmups = Number(process.env.SKS_HOOK_LATENCY_WARMUPS || 2);
19
+ const runs = Number(process.env.SKS_HOOK_LATENCY_RUNS || 15);
20
+ const report = await runHookScenarios();
21
+ const out = path.join(root, '.sneakoscope', 'reports', 'hook-latency-quantum.json');
22
+ fs.mkdirSync(path.dirname(out), { recursive: true });
23
+ fs.writeFileSync(out, `${JSON.stringify(report, null, 2)}\n`);
24
+ assertGate(report.ok, 'hook_latency_quantum_failed', report);
25
+ emitGate('hook:latency-quantum', { scenarios: report.scenarios.length, report: '.sneakoscope/reports/hook-latency-quantum.json' });
26
+ async function runHookScenarios() {
27
+ const scenarioResults = [];
28
+ const blockers = [];
29
+ for (const scenario of scenarios) {
30
+ const result = await runOne(scenario);
31
+ scenarioResults.push(result);
32
+ if (result.failures.length)
33
+ blockers.push(`${scenario.name}:process_failed`);
34
+ if (result.p95_ms > result.budget_p95_ms)
35
+ blockers.push(`${scenario.name}:p95_budget_exceeded`);
36
+ }
37
+ return {
38
+ schema: 'sks.hook-latency-quantum.v1',
39
+ ok: blockers.length === 0,
40
+ generated_at: new Date().toISOString(),
41
+ warmup_runs: warmups,
42
+ measure_runs: runs,
43
+ scenarios: scenarioResults,
44
+ blockers
45
+ };
46
+ }
47
+ async function runOne(scenario) {
48
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), `sks-hook-${scenario.name}-`));
49
+ try {
50
+ seedRoot(tmp, scenario);
51
+ const durations = [];
52
+ const failures = [];
53
+ for (let i = 0; i < warmups + runs; i++) {
54
+ const phase = i < warmups ? 'warmup' : 'measure';
55
+ const measured = await timed(tmp, scenario, phase === 'measure' ? i - warmups + 1 : i + 1, phase);
56
+ if (phase === 'measure')
57
+ durations.push(measured.duration_ms);
58
+ if (measured.code !== 0)
59
+ failures.push(measured);
60
+ }
61
+ durations.sort((a, b) => a - b);
62
+ const p95 = percentile(durations, 0.95);
63
+ const p50 = percentile(durations, 0.5);
64
+ return {
65
+ name: scenario.name,
66
+ runs,
67
+ p50_ms: p50,
68
+ p95_ms: p95,
69
+ budget_p95_ms: scenario.budget_p95_ms,
70
+ ok: failures.length === 0 && p95 <= scenario.budget_p95_ms,
71
+ failures
72
+ };
73
+ }
74
+ finally {
75
+ fs.rmSync(tmp, { recursive: true, force: true });
76
+ }
77
+ }
78
+ async function timed(tmp, scenario, run, phase) {
79
+ const started = performance.now();
80
+ const payload = JSON.stringify({ prompt: scenario.prompt, cwd: tmp, conversation_id: `quantum-${scenario.name}` });
81
+ const res = await runProcess(process.execPath, [path.join(root, 'dist', 'bin', 'sks.js'), 'hook', 'user-prompt-submit'], {
82
+ cwd: tmp,
83
+ input: payload,
84
+ timeoutMs: 10000,
85
+ maxOutputBytes: 64 * 1024,
86
+ env: { SKS_DISABLE_NETWORK: '1', SKS_PERF_MEASURE: '1', SKS_DISABLE_UPDATE_CHECK: '1' }
87
+ });
88
+ return {
89
+ run,
90
+ phase,
91
+ code: res.code,
92
+ duration_ms: Math.round(performance.now() - started),
93
+ stderr_tail: String(res.stderr || '').slice(-4000)
94
+ };
95
+ }
96
+ function seedRoot(tmp, scenario) {
97
+ fs.mkdirSync(path.join(tmp, '.sneakoscope', 'state', 'sessions'), { recursive: true });
98
+ fs.mkdirSync(path.join(tmp, '.sneakoscope', 'missions'), { recursive: true });
99
+ fs.writeFileSync(path.join(tmp, 'package.json'), '{"name":"hook-latency-fixture","type":"module"}\n');
100
+ if (scenario.state) {
101
+ const state = { ...scenario.state, _session_key: 'quantum', updated_at: new Date().toISOString() };
102
+ fs.writeFileSync(path.join(tmp, '.sneakoscope', 'state', 'current.json'), `${JSON.stringify(state, null, 2)}\n`);
103
+ const missionId = String(scenario.state.mission_id || '');
104
+ if (missionId) {
105
+ const dir = path.join(tmp, '.sneakoscope', 'missions', missionId);
106
+ fs.mkdirSync(dir, { recursive: true });
107
+ fs.writeFileSync(path.join(dir, 'mission.json'), `${JSON.stringify({ id: missionId, mode: scenario.state.mode || 'TEAM', created_at: new Date().toISOString() }, null, 2)}\n`);
108
+ }
109
+ }
110
+ for (const [rel, text] of Object.entries(scenario.files || {})) {
111
+ const file = path.join(tmp, rel);
112
+ fs.mkdirSync(path.dirname(file), { recursive: true });
113
+ fs.writeFileSync(file, `${text}\n`);
114
+ }
115
+ }
116
+ function percentile(values, pct) {
117
+ if (!values.length)
118
+ return 0;
119
+ const index = Math.min(values.length - 1, Math.max(0, Math.ceil(values.length * pct) - 1));
120
+ return values[index] || 0;
121
+ }
122
+ //# sourceMappingURL=hook-latency-quantum-check.js.map
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ // @ts-nocheck
3
+ import { assertGate, emitGate, importDist, root } from './sks-1-18-gate-lib.js';
4
+ const { runInstalledPackageSmoke } = await importDist('core/install/installed-package-smoke.js');
5
+ const report = await runInstalledPackageSmoke(root);
6
+ assertGate(report.ok, 'installed_package_smoke_failed', report);
7
+ emitGate('runtime:installed-smoke', {
8
+ installed_version: report.installed_version,
9
+ commands: report.commands.length,
10
+ tarball: report.tarball
11
+ });
12
+ //# sourceMappingURL=installed-package-smoke-check.js.map
@@ -30,6 +30,8 @@ export function runNativeCliSwarmCheck({ agents, workItems = agents, reportName,
30
30
  encoding: 'utf8',
31
31
  env: {
32
32
  ...process.env,
33
+ SKS_TEST_ISOLATION: '1',
34
+ SKS_RELEASE_FIXTURE_ACTIVE_ROUTE_BYPASS: '1',
33
35
  ...(backend === 'codex-sdk' ? { SKS_CODEX_SDK_FAKE: '1', NODE_ENV: 'test' } : {})
34
36
  },
35
37
  maxBuffer: 96 * 1024 * 1024
@@ -115,6 +115,8 @@ function listScanFiles() {
115
115
  const files = [];
116
116
  walk(path.join(root, 'src'), (file) => {
117
117
  const relative = rel(file);
118
+ if (isTestSource(relative))
119
+ return;
118
120
  if (relative.startsWith('src/scripts/'))
119
121
  return;
120
122
  if (file.endsWith('.ts'))
@@ -123,12 +125,17 @@ function listScanFiles() {
123
125
  walk(path.join(root, 'src', 'scripts'), (file) => {
124
126
  if (!file.endsWith('.ts'))
125
127
  return;
128
+ if (isTestSource(rel(file)))
129
+ return;
126
130
  const base = path.basename(file);
127
131
  if (/(install|publish|release|doctor|codex|zellij|migration)/i.test(base))
128
132
  files.push(rel(file));
129
133
  });
130
134
  return files.sort();
131
135
  }
136
+ function isTestSource(relative) {
137
+ return /(^|\/)__tests__\//.test(relative) || /\.test\.ts$/.test(relative);
138
+ }
132
139
  function walk(dir, visit) {
133
140
  let entries = [];
134
141
  try {
@@ -1,12 +1,19 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawnSync } from 'node:child_process';
3
+ import fs from 'node:fs';
4
+ import os from 'node:os';
3
5
  import path from 'node:path';
4
6
  import { assertGate, emitGate, readJson, root } from './sks-1-18-gate-lib.js';
5
7
  const pkg = readJson('package.json');
6
8
  const scripts = pkg.scripts || {};
9
+ const cacheRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'sks-package-published-contract-'));
7
10
  const dry = spawnSync('npm', ['pack', '--dry-run', '--json', '--ignore-scripts'], {
8
11
  cwd: root,
9
12
  encoding: 'utf8',
13
+ env: {
14
+ ...process.env,
15
+ npm_config_cache: path.join(cacheRoot, 'npm-cache')
16
+ },
10
17
  maxBuffer: 16 * 1024 * 1024
11
18
  });
12
19
  assertGate(dry.status === 0, 'npm pack --dry-run must succeed for package contract check', {
@@ -13,9 +13,14 @@ const MAX_UNPACKED = Number(process.env.SKS_MAX_UNPACKED_BYTES || 10 * 1024 * 10
13
13
  // research-command.ts, image-ux-review-command.ts, mad-sks-command.ts,
14
14
  // sks-menubar.ts) with genuine new production logic, pushing the packed size
15
15
  // to ~2306 KiB. 5.7.0 adds doctor/update migration repair coverage and publish
16
- // contract checks, pushing the packed tarball to ~2345 KiB. Keep a narrow cap
17
- // rather than giving the package a broad size budget.
18
- const MAX_PACKED = Number(process.env.SKS_MAX_PACK_BYTES || 2350 * 1024);
16
+ // contract checks, pushing the packed tarball to ~2345 KiB. 5.9.0 adds quantum
17
+ // release evidence scripts (installed package smoke, perf budgets, scorecard,
18
+ // Super-Search contracts, and parallel smoke), pushing the packed tarball to
19
+ // ~2354 KiB. Keep a narrow cap rather than giving the package a broad size
20
+ // budget.
21
+ const MAX_PACKED = Number(process.env.SKS_MAX_PACK_BYTES || 2365 * 1024);
22
+ const SURFACE_MAX_PACKED = Number(process.env.SKS_PACKAGE_SURFACE_MAX_PACK_BYTES || 25_000_000);
23
+ const SURFACE_MAX_FILES = Number(process.env.SKS_PACKAGE_SURFACE_MAX_FILES || 2500);
19
24
  function runNpmPack() {
20
25
  const npmCli = process.env.npm_execpath; // set when invoked via `npm run`
21
26
  const npmCache = process.env.SKS_RELEASE_NPM_CACHE || path.join(os.tmpdir(), 'sneakoscope-npm-cache');
@@ -62,6 +67,8 @@ assertGate(files.includes('LICENSE'), 'packlist_missing_runtime_entry', { missin
62
67
  assertGate(files.some((f) => f.startsWith('schemas/')), 'packlist_missing_runtime_entry', { missing: 'schemas/' });
63
68
  const forbidden = files.filter((f) => f.startsWith('test/') ||
64
69
  f.startsWith('src/') ||
70
+ f.includes('/__tests__/') ||
71
+ f.endsWith('.test.js') ||
65
72
  f.startsWith('docs/internal/') ||
66
73
  f.endsWith('.map') ||
67
74
  f.startsWith('.sneakoscope/') ||
@@ -69,6 +76,8 @@ const forbidden = files.filter((f) => f.startsWith('test/') ||
69
76
  f.startsWith('coverage/') ||
70
77
  /(^|\/)\.env/.test(f));
71
78
  assertGate(forbidden.length === 0, 'packlist_forbidden_files', { forbidden });
79
+ assertGate(info.entryCount <= SURFACE_MAX_FILES, 'package_surface_file_count_over_limit', { entryCount: info.entryCount, max_file_count: SURFACE_MAX_FILES });
80
+ assertGate(info.size <= SURFACE_MAX_PACKED, 'package_surface_tarball_over_limit', { size: info.size, max_tarball_bytes: SURFACE_MAX_PACKED });
72
81
  const report = {
73
82
  entryCount: info.entryCount,
74
83
  size: info.size,
@@ -83,6 +92,25 @@ const report = {
83
92
  const out = path.join(root, '.sneakoscope', 'reports', 'packlist-performance.json');
84
93
  fs.mkdirSync(path.dirname(out), { recursive: true });
85
94
  fs.writeFileSync(out, `${JSON.stringify(report, null, 2)}\n`);
95
+ const surfaceReport = {
96
+ schema: 'sks.package-surface-budget.v1',
97
+ ok: true,
98
+ generated_at: new Date().toISOString(),
99
+ max_tarball_bytes: SURFACE_MAX_PACKED,
100
+ max_file_count: SURFACE_MAX_FILES,
101
+ actual_tarball_bytes: info.size,
102
+ actual_file_count: info.entryCount,
103
+ forbidden_globs: [
104
+ 'dist/**/__tests__/**',
105
+ 'dist/**/*.test.js',
106
+ '.sneakoscope/**',
107
+ 'src/**',
108
+ 'test/**'
109
+ ],
110
+ forbidden_findings: forbidden,
111
+ blockers: []
112
+ };
113
+ fs.writeFileSync(path.join(root, '.sneakoscope', 'reports', 'package-surface-budget.json'), `${JSON.stringify(surfaceReport, null, 2)}\n`);
86
114
  emitGate('publish:packlist-performance', {
87
115
  files: info.entryCount,
88
116
  packed_kib: Math.round(info.size / 1024),
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+ import fsp from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { runParallelProductionSmoke } from '../core/agents/parallel-write-fixture.js';
5
+ const report = await runParallelProductionSmoke({ injectFailure: true });
6
+ const reportPath = path.join(process.cwd(), '.sneakoscope', 'reports', 'parallel-production-smoke.json');
7
+ await fsp.mkdir(path.dirname(reportPath), { recursive: true });
8
+ await fsp.writeFile(reportPath, `${JSON.stringify(report, null, 2)}\n`);
9
+ if (!report.ok) {
10
+ console.error(JSON.stringify({ ok: false, blockers: report.blockers, reportPath }, null, 2));
11
+ process.exit(1);
12
+ }
13
+ console.log(JSON.stringify({
14
+ ok: true,
15
+ reportPath,
16
+ worker_count: report.worker_count,
17
+ changed_files: report.changed_files,
18
+ patch_envelope_count: report.patch_envelope_count,
19
+ failure_injection: report.failure_injection
20
+ }, null, 2));
21
+ //# sourceMappingURL=parallel-production-smoke-check.js.map
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ // @ts-nocheck
3
+ import fs from 'node:fs';
4
+ import path from 'node:path';
5
+ import { assertGate, emitGate, importDist, root } from './sks-1-18-gate-lib.js';
6
+ const config = JSON.parse(fs.readFileSync(path.join(root, 'config/perf-budgets.v1.json'), 'utf8'));
7
+ const { writePerfBudgetReport } = await importDist('core/perf/perf-budget.js');
8
+ const report = await writePerfBudgetReport(root, config.commands || []);
9
+ assertGate(report.ok, 'perf_budget_failed', report);
10
+ emitGate('perf:budgets', {
11
+ commands: report.commands.length,
12
+ slowest_p95_ms: Math.max(...report.commands.map((row) => row.p95_ms), 0)
13
+ });
14
+ //# sourceMappingURL=perf-budget-check.js.map
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env node
2
+ import os from 'node:os';
3
+ import path from 'node:path';
4
+ import { spawnSync } from 'node:child_process';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { readJson, writeJsonAtomic } from '../core/fsx.js';
7
+ const root = process.env.SKS_REPO_ROOT
8
+ ? path.resolve(process.env.SKS_REPO_ROOT)
9
+ : path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
10
+ const pkg = await readJson(path.join(root, 'package.json'), {});
11
+ const gitHead = spawnSync('git', ['rev-parse', 'HEAD'], { cwd: root, encoding: 'utf8' });
12
+ const version = pkg.version || 'unknown';
13
+ const reportPath = path.join(root, '.sneakoscope', 'reports', `quantum-baseline-${version}.json`);
14
+ const report = {
15
+ schema: 'sks.quantum-baseline.v1',
16
+ package_version: version,
17
+ git_head: gitHead.status === 0 ? gitHead.stdout.trim() : null,
18
+ node_version: process.version,
19
+ platform: `${process.platform}-${process.arch}-${os.release()}`,
20
+ package_scripts: {
21
+ test: hasScript('test'),
22
+ release_check_full: hasScript('release:check:full'),
23
+ publish_dry: hasScript('publish:dry'),
24
+ super_search_name_guard: hasScript('super-search:name-guard')
25
+ },
26
+ known_competitor_gaps: [
27
+ 'installed_package_smoke_weaker_than_oh_my_codex',
28
+ 'super_search_provider_default_not_guaranteed',
29
+ 'gate_surface_large_without_speed_score',
30
+ 'fresh_parallel_proof_needs_production_smoke'
31
+ ]
32
+ };
33
+ await writeJsonAtomic(reportPath, report);
34
+ console.log(JSON.stringify(report, null, 2));
35
+ function hasScript(name) {
36
+ return Boolean(pkg.scripts?.[name]);
37
+ }
38
+ //# sourceMappingURL=quantum-baseline-report.js.map