sentinelayer-cli 0.6.2 → 0.8.1
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/README.md +1009 -996
- package/bin/create-sentinelayer.js +5 -5
- package/bin/sentinelayer-cli.js +4 -4
- package/bin/sl.js +5 -5
- package/package.json +64 -63
- package/src/agents/ai-governance/index.js +12 -0
- package/src/agents/ai-governance/tools/base.js +171 -0
- package/src/agents/ai-governance/tools/eval-regression.js +47 -0
- package/src/agents/ai-governance/tools/hitl-audit.js +81 -0
- package/src/agents/ai-governance/tools/index.js +52 -0
- package/src/agents/ai-governance/tools/prompt-drift.js +42 -0
- package/src/agents/ai-governance/tools/provenance-check.js +69 -0
- package/src/agents/backend/index.js +12 -0
- package/src/agents/backend/tools/base.js +189 -0
- package/src/agents/backend/tools/circuit-breaker-check.js +123 -0
- package/src/agents/backend/tools/idempotency-audit.js +105 -0
- package/src/agents/backend/tools/index.js +87 -0
- package/src/agents/backend/tools/retry-audit.js +132 -0
- package/src/agents/backend/tools/timeout-audit.js +144 -0
- package/src/agents/code-quality/index.js +12 -0
- package/src/agents/code-quality/tools/base.js +159 -0
- package/src/agents/code-quality/tools/complexity-measure.js +197 -0
- package/src/agents/code-quality/tools/coupling-analysis.js +81 -0
- package/src/agents/code-quality/tools/cycle-detect.js +49 -0
- package/src/agents/code-quality/tools/dep-graph.js +196 -0
- package/src/agents/code-quality/tools/index.js +89 -0
- package/src/agents/data-layer/index.js +12 -0
- package/src/agents/data-layer/tools/base.js +181 -0
- package/src/agents/data-layer/tools/index-audit.js +165 -0
- package/src/agents/data-layer/tools/index.js +83 -0
- package/src/agents/data-layer/tools/migration-scan.js +135 -0
- package/src/agents/data-layer/tools/query-explain.js +120 -0
- package/src/agents/data-layer/tools/tenancy-scan.js +166 -0
- package/src/agents/documentation/index.js +12 -0
- package/src/agents/documentation/tools/api-diff.js +91 -0
- package/src/agents/documentation/tools/base.js +151 -0
- package/src/agents/documentation/tools/dead-link-check.js +58 -0
- package/src/agents/documentation/tools/docstring-coverage.js +78 -0
- package/src/agents/documentation/tools/index.js +52 -0
- package/src/agents/documentation/tools/readme-freshness.js +61 -0
- package/src/agents/envelope/fix-cycle.js +45 -0
- package/src/agents/envelope/index.js +31 -0
- package/src/agents/envelope/loop.js +150 -0
- package/src/agents/envelope/pulse.js +18 -0
- package/src/agents/envelope/stream.js +40 -0
- package/src/agents/infrastructure/index.js +12 -0
- package/src/agents/infrastructure/tools/base.js +171 -0
- package/src/agents/infrastructure/tools/checkov-run.js +32 -0
- package/src/agents/infrastructure/tools/drift-detect.js +59 -0
- package/src/agents/infrastructure/tools/iam-least-priv-check.js +78 -0
- package/src/agents/infrastructure/tools/index.js +52 -0
- package/src/agents/infrastructure/tools/tflint-run.js +31 -0
- package/src/agents/jules/config/definition.js +160 -160
- package/src/agents/jules/config/system-prompt.js +182 -182
- package/src/agents/jules/error-intake.js +51 -51
- package/src/agents/jules/fix-cycle.js +17 -17
- package/src/agents/jules/loop.js +460 -450
- package/src/agents/jules/pulse.js +10 -10
- package/src/agents/jules/stream.js +187 -186
- package/src/agents/jules/swarm/file-scanner.js +74 -74
- package/src/agents/jules/swarm/index.js +11 -11
- package/src/agents/jules/swarm/orchestrator.js +362 -362
- package/src/agents/jules/swarm/pattern-hunter.js +123 -123
- package/src/agents/jules/swarm/sub-agent.js +315 -309
- package/src/agents/jules/tools/aidenid-email.js +189 -189
- package/src/agents/jules/tools/auth-audit.js +1708 -1691
- package/src/agents/jules/tools/dispatch.js +340 -335
- package/src/agents/jules/tools/file-edit.js +2 -2
- package/src/agents/jules/tools/file-read.js +2 -2
- package/src/agents/jules/tools/frontend-analyze.js +570 -570
- package/src/agents/jules/tools/glob.js +2 -2
- package/src/agents/jules/tools/grep.js +2 -2
- package/src/agents/jules/tools/index.js +29 -29
- package/src/agents/jules/tools/path-guards.js +2 -2
- package/src/agents/jules/tools/runtime-audit.js +507 -507
- package/src/agents/jules/tools/shell.js +2 -2
- package/src/agents/jules/tools/url-policy.js +100 -100
- package/src/agents/mode.js +113 -0
- package/src/agents/observability/index.js +12 -0
- package/src/agents/observability/tools/alert-audit.js +39 -0
- package/src/agents/observability/tools/base.js +181 -0
- package/src/agents/observability/tools/dashboard-gap.js +42 -0
- package/src/agents/observability/tools/index.js +54 -0
- package/src/agents/observability/tools/log-schema-check.js +74 -0
- package/src/agents/observability/tools/span-coverage.js +74 -0
- package/src/agents/persona-visuals.js +102 -61
- package/src/agents/release/index.js +12 -0
- package/src/agents/release/tools/base.js +181 -0
- package/src/agents/release/tools/changelog-diff.js +86 -0
- package/src/agents/release/tools/feature-flag-audit.js +126 -0
- package/src/agents/release/tools/index.js +61 -0
- package/src/agents/release/tools/rollback-verify.js +129 -0
- package/src/agents/release/tools/semver-check.js +109 -0
- package/src/agents/reliability/index.js +12 -0
- package/src/agents/reliability/tools/backpressure-check.js +129 -0
- package/src/agents/reliability/tools/base.js +181 -0
- package/src/agents/reliability/tools/chaos-probe.js +109 -0
- package/src/agents/reliability/tools/graceful-degradation-check.js +114 -0
- package/src/agents/reliability/tools/health-check-audit.js +111 -0
- package/src/agents/reliability/tools/index.js +87 -0
- package/src/agents/run-persona.js +109 -0
- package/src/agents/security/index.js +12 -0
- package/src/agents/security/tools/authz-audit.js +134 -0
- package/src/agents/security/tools/base.js +190 -0
- package/src/agents/security/tools/crypto-review.js +175 -0
- package/src/agents/security/tools/index.js +97 -0
- package/src/agents/security/tools/sast-scan.js +175 -0
- package/src/agents/security/tools/secrets-scan.js +216 -0
- package/src/agents/shared-tools/dispatch-core.js +320 -315
- package/src/agents/shared-tools/file-edit.js +180 -180
- package/src/agents/shared-tools/file-read.js +100 -100
- package/src/agents/shared-tools/glob.js +168 -168
- package/src/agents/shared-tools/grep.js +228 -228
- package/src/agents/shared-tools/index.js +46 -46
- package/src/agents/shared-tools/path-guards.js +161 -161
- package/src/agents/shared-tools/shell.js +383 -383
- package/src/agents/supply-chain/index.js +12 -0
- package/src/agents/supply-chain/tools/attestation-check.js +42 -0
- package/src/agents/supply-chain/tools/base.js +151 -0
- package/src/agents/supply-chain/tools/index.js +52 -0
- package/src/agents/supply-chain/tools/lockfile-integrity.js +73 -0
- package/src/agents/supply-chain/tools/package-verify.js +56 -0
- package/src/agents/supply-chain/tools/sbom-diff.js +34 -0
- package/src/agents/testing/index.js +12 -0
- package/src/agents/testing/tools/base.js +202 -0
- package/src/agents/testing/tools/coverage-gap.js +144 -0
- package/src/agents/testing/tools/flake-detect.js +125 -0
- package/src/agents/testing/tools/index.js +85 -0
- package/src/agents/testing/tools/mutation-test.js +143 -0
- package/src/agents/testing/tools/snapshot-diff.js +103 -0
- package/src/ai/aidenid.js +1021 -1009
- package/src/ai/client.js +553 -553
- package/src/ai/domain-target-store.js +268 -268
- package/src/ai/identity-store.js +270 -270
- package/src/ai/proxy.js +137 -137
- package/src/ai/site-store.js +145 -145
- package/src/audit/agents/architecture.js +180 -180
- package/src/audit/agents/compliance.js +179 -179
- package/src/audit/agents/documentation.js +165 -165
- package/src/audit/agents/performance.js +145 -145
- package/src/audit/agents/security.js +215 -215
- package/src/audit/agents/testing.js +172 -172
- package/src/audit/orchestrator.js +557 -557
- package/src/audit/package.js +204 -204
- package/src/audit/registry.js +284 -284
- package/src/audit/replay.js +103 -103
- package/src/auth/gate.js +428 -371
- package/src/auth/http.js +681 -611
- package/src/auth/service.js +1106 -1106
- package/src/auth/session-store.js +813 -813
- package/src/cli.js +257 -252
- package/src/commands/ai/identity-lifecycle.js +1338 -1338
- package/src/commands/ai/provision-governance.js +1272 -1272
- package/src/commands/ai/shared.js +147 -147
- package/src/commands/ai.js +11 -11
- package/src/commands/apply.js +12 -12
- package/src/commands/audit.js +1171 -1166
- package/src/commands/auth.js +419 -419
- package/src/commands/chat.js +184 -191
- package/src/commands/config.js +184 -184
- package/src/commands/cost.js +311 -311
- package/src/commands/daemon/core.js +850 -850
- package/src/commands/daemon/extended.js +1048 -1048
- package/src/commands/daemon/shared.js +213 -213
- package/src/commands/daemon.js +11 -11
- package/src/commands/guide.js +174 -174
- package/src/commands/ingest.js +58 -58
- package/src/commands/init.js +55 -55
- package/src/commands/legacy-args.js +20 -10
- package/src/commands/mcp.js +461 -461
- package/src/commands/omargate.js +63 -29
- package/src/commands/persona.js +65 -20
- package/src/commands/plugin.js +260 -260
- package/src/commands/policy.js +132 -132
- package/src/commands/prompt.js +238 -238
- package/src/commands/review.js +704 -704
- package/src/commands/scan.js +865 -872
- package/src/commands/session.js +1238 -0
- package/src/commands/spec.js +771 -716
- package/src/commands/swarm.js +651 -651
- package/src/commands/telemetry.js +202 -202
- package/src/commands/watch.js +511 -511
- package/src/config/agent-dictionary.js +182 -182
- package/src/config/io.js +56 -56
- package/src/config/paths.js +18 -18
- package/src/config/schema.js +55 -55
- package/src/config/service.js +184 -184
- package/src/coord/events-log.js +141 -0
- package/src/coord/handshake.js +719 -0
- package/src/coord/index.js +35 -0
- package/src/coord/paths.js +84 -0
- package/src/coord/priority.js +62 -0
- package/src/coord/tarjan.js +157 -0
- package/src/cost/budget.js +235 -235
- package/src/cost/history.js +188 -188
- package/src/cost/tokenizer.js +160 -0
- package/src/cost/tracker.js +232 -171
- package/src/daemon/artifact-lineage.js +896 -534
- package/src/daemon/assignment-ledger.js +1083 -770
- package/src/daemon/ast-drift.js +496 -0
- package/src/daemon/ast-parser-layer.js +258 -258
- package/src/daemon/budget-governor.js +633 -633
- package/src/daemon/callgraph-overlay.js +646 -646
- package/src/daemon/error-worker.js +1209 -626
- package/src/daemon/fix-cycle.js +384 -377
- package/src/daemon/hybrid-mapper.js +929 -929
- package/src/daemon/ingest-refresh.js +79 -11
- package/src/daemon/jira-lifecycle.js +767 -632
- package/src/daemon/operator-control.js +657 -657
- package/src/daemon/pulse.js +327 -327
- package/src/daemon/reliability-lane.js +471 -471
- package/src/daemon/scope-engine.js +1068 -0
- package/src/daemon/watchdog.js +971 -971
- package/src/events/schema.js +190 -0
- package/src/guide/generator.js +316 -316
- package/src/ingest/engine.js +933 -918
- package/src/ingest/ownership.js +380 -0
- package/src/interactive/index.js +97 -97
- package/src/legacy-cli.js +3228 -2994
- package/src/mcp/registry.js +695 -695
- package/src/memory/blackboard.js +301 -301
- package/src/memory/retrieval.js +581 -581
- package/src/orchestrator/kai-chen.js +126 -0
- package/src/plugin/manifest.js +553 -553
- package/src/policy/packs.js +144 -144
- package/src/prompt/generator.js +136 -118
- package/src/review/ai-review.js +672 -679
- package/src/review/compliance-pack.js +389 -0
- package/src/review/investor-dd-config.js +54 -0
- package/src/review/investor-dd-file-loop.js +303 -0
- package/src/review/investor-dd-file-router.js +406 -0
- package/src/review/investor-dd-html-report.js +233 -0
- package/src/review/investor-dd-notification.js +120 -0
- package/src/review/investor-dd-orchestrator.js +405 -0
- package/src/review/investor-dd-persona-runner.js +275 -0
- package/src/review/live-validator.js +253 -0
- package/src/review/local-review.js +1351 -1305
- package/src/review/omargate-interactive.js +68 -68
- package/src/review/omargate-orchestrator.js +492 -300
- package/src/review/persona-prompts.js +484 -296
- package/src/review/reconciliation-rules.js +329 -0
- package/src/review/replay.js +235 -235
- package/src/review/report.js +664 -664
- package/src/review/reproducibility-chain.js +136 -0
- package/src/review/scan-modes.js +147 -42
- package/src/review/spec-binding.js +487 -487
- package/src/scaffold/generator.js +67 -67
- package/src/scaffold/templates.js +150 -150
- package/src/scan/generator.js +418 -418
- package/src/scan/gh-secrets.js +107 -107
- package/src/session/agent-registry.js +359 -0
- package/src/session/analytics.js +479 -0
- package/src/session/daemon.js +1396 -0
- package/src/session/file-locks.js +666 -0
- package/src/session/paths.js +37 -0
- package/src/session/recap.js +567 -0
- package/src/session/redact.js +82 -0
- package/src/session/runtime-bridge.js +762 -0
- package/src/session/scoring.js +406 -0
- package/src/session/setup-guides.js +304 -0
- package/src/session/store.js +704 -0
- package/src/session/stream.js +333 -0
- package/src/session/sync.js +753 -0
- package/src/session/tasks.js +1054 -0
- package/src/session/templates.js +188 -0
- package/src/spec/generator.js +619 -519
- package/src/spec/regenerate.js +237 -237
- package/src/spec/templates.js +91 -91
- package/src/swarm/dashboard.js +247 -247
- package/src/swarm/factory.js +363 -363
- package/src/swarm/pentest.js +934 -934
- package/src/swarm/registry.js +419 -419
- package/src/swarm/report.js +158 -158
- package/src/swarm/runtime.js +569 -576
- package/src/swarm/scenario-dsl.js +272 -272
- package/src/telemetry/ledger.js +302 -302
- package/src/telemetry/session-tracker.js +234 -234
- package/src/telemetry/sync.js +203 -203
- package/src/ui/command-hints.js +13 -13
- package/src/ui/markdown.js +220 -220
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// log-schema-check — flag console.log in production code paths (#A20).
|
|
2
|
+
|
|
3
|
+
import fsp from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
import { createFinding, findLineMatches, getLineContent, toPosix, walkRepoFiles } from "./base.js";
|
|
7
|
+
|
|
8
|
+
const CODE_EXTENSIONS = new Set([".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs", ".py"]);
|
|
9
|
+
|
|
10
|
+
function isProductionSource(relPath) {
|
|
11
|
+
const p = toPosix(relPath);
|
|
12
|
+
if (/(^|\/)(tests?|__tests__|specs?)\//.test(p)) return false;
|
|
13
|
+
if (/\.(test|spec)\.(js|jsx|ts|tsx|mjs|cjs|py)$/.test(p)) return false;
|
|
14
|
+
if (/(^|\/)scripts\//.test(p)) return false;
|
|
15
|
+
if (/(^|\/)bin\//.test(p)) return false;
|
|
16
|
+
if (/(^|\/)docs?\//.test(p)) return false;
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const UNSTRUCTURED_LOG_PATTERNS_JS = /\bconsole\.(log|info|warn|error|debug)\s*\(/;
|
|
21
|
+
const UNSTRUCTURED_LOG_PATTERNS_PY = /\bprint\s*\(/;
|
|
22
|
+
|
|
23
|
+
export async function runLogSchemaCheck({ rootPath, files = null } = {}) {
|
|
24
|
+
const resolvedRoot = path.resolve(String(rootPath || "."));
|
|
25
|
+
const iterator =
|
|
26
|
+
Array.isArray(files) && files.length > 0
|
|
27
|
+
? iterateExplicitFiles(resolvedRoot, files)
|
|
28
|
+
: walkRepoFiles({ rootPath: resolvedRoot, extensions: CODE_EXTENSIONS });
|
|
29
|
+
|
|
30
|
+
const findings = [];
|
|
31
|
+
const reported = new Set();
|
|
32
|
+
for await (const { fullPath, relativePath } of iterator) {
|
|
33
|
+
if (!isProductionSource(relativePath)) continue;
|
|
34
|
+
let content;
|
|
35
|
+
try {
|
|
36
|
+
content = await fsp.readFile(fullPath, "utf-8");
|
|
37
|
+
} catch {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const ext = path.extname(fullPath).toLowerCase();
|
|
41
|
+
const pattern = ext === ".py" ? UNSTRUCTURED_LOG_PATTERNS_PY : UNSTRUCTURED_LOG_PATTERNS_JS;
|
|
42
|
+
const matches = findLineMatches(content, pattern);
|
|
43
|
+
if (matches.length === 0) continue;
|
|
44
|
+
const rel = toPosix(relativePath);
|
|
45
|
+
if (reported.has(rel)) continue;
|
|
46
|
+
reported.add(rel);
|
|
47
|
+
findings.push(
|
|
48
|
+
createFinding({
|
|
49
|
+
tool: "log-schema-check",
|
|
50
|
+
kind: "observability.unstructured-log",
|
|
51
|
+
severity: "P3",
|
|
52
|
+
file: rel,
|
|
53
|
+
line: matches[0].line,
|
|
54
|
+
evidence: getLineContent(content, matches[0].line),
|
|
55
|
+
rootCause: "Production code uses console.log / print() — unindexed output that can't be queried, correlated, or redacted at collection time.",
|
|
56
|
+
recommendedFix: "Route through a structured logger (pino, winston, structlog) with a shared schema. Configure PII fields to be automatically redacted.",
|
|
57
|
+
confidence: 0.55,
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
return findings;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async function* iterateExplicitFiles(resolvedRoot, files) {
|
|
65
|
+
for (const file of files) {
|
|
66
|
+
const trimmed = String(file || "").trim();
|
|
67
|
+
if (!trimmed) continue;
|
|
68
|
+
const fullPath = path.isAbsolute(trimmed) ? trimmed : path.join(resolvedRoot, trimmed);
|
|
69
|
+
const relativePath = path.relative(resolvedRoot, fullPath).replace(/\\/g, "/");
|
|
70
|
+
yield { fullPath, relativePath };
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { isProductionSource };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// span-coverage — flag route handlers without a tracing span (#A20).
|
|
2
|
+
|
|
3
|
+
import fsp from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
import { createFinding, findLineMatches, getLineContent, toPosix, walkRepoFiles } from "./base.js";
|
|
7
|
+
|
|
8
|
+
const CODE_EXTENSIONS = new Set([".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs", ".py", ".go"]);
|
|
9
|
+
|
|
10
|
+
const HANDLER_PATTERNS = [
|
|
11
|
+
/\b(?:app|router|server|fastify|hono)\.(get|post|put|patch|delete)\s*\(/,
|
|
12
|
+
/^export\s+async\s+function\s+(GET|POST|PUT|PATCH|DELETE)\s*\(/m,
|
|
13
|
+
/@(?:app|router|api_router)\.(?:get|post|put|patch|delete)\s*\(/,
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const SPAN_SIGNALS = [
|
|
17
|
+
/tracer\.startSpan|tracer\.startActiveSpan|otel\.|opentelemetry|@tracing|withSpan|withActiveSpan/i,
|
|
18
|
+
/sentry\.(?:startTransaction|startSpan)/i,
|
|
19
|
+
/datadog|dd-trace|ddtrace/i,
|
|
20
|
+
/Sentry\.startTransaction/,
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
export async function runSpanCoverage({ rootPath, files = null } = {}) {
|
|
24
|
+
const resolvedRoot = path.resolve(String(rootPath || "."));
|
|
25
|
+
const iterator =
|
|
26
|
+
Array.isArray(files) && files.length > 0
|
|
27
|
+
? iterateExplicitFiles(resolvedRoot, files)
|
|
28
|
+
: walkRepoFiles({ rootPath: resolvedRoot, extensions: CODE_EXTENSIONS });
|
|
29
|
+
|
|
30
|
+
const findings = [];
|
|
31
|
+
for await (const { fullPath, relativePath } of iterator) {
|
|
32
|
+
let content;
|
|
33
|
+
try {
|
|
34
|
+
content = await fsp.readFile(fullPath, "utf-8");
|
|
35
|
+
} catch {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const hasHandler = HANDLER_PATTERNS.some((p) => p.test(content));
|
|
39
|
+
if (!hasHandler) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const hasSpan = SPAN_SIGNALS.some((p) => p.test(content));
|
|
43
|
+
if (hasSpan) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const match = findLineMatches(content, HANDLER_PATTERNS[0])[0] ||
|
|
47
|
+
findLineMatches(content, HANDLER_PATTERNS[1])[0] ||
|
|
48
|
+
findLineMatches(content, HANDLER_PATTERNS[2])[0];
|
|
49
|
+
findings.push(
|
|
50
|
+
createFinding({
|
|
51
|
+
tool: "span-coverage",
|
|
52
|
+
kind: "observability.no-span",
|
|
53
|
+
severity: "P2",
|
|
54
|
+
file: toPosix(relativePath),
|
|
55
|
+
line: match?.line || 1,
|
|
56
|
+
evidence: getLineContent(content, match?.line || 1),
|
|
57
|
+
rootCause: "Route handler declared without any tracing-span signal (OpenTelemetry, Sentry, Datadog). Request latency / error breakdowns will be opaque.",
|
|
58
|
+
recommendedFix: "Wrap the handler body in tracer.startActiveSpan('<name>', …) or use framework middleware that auto-instruments handlers.",
|
|
59
|
+
confidence: 0.55,
|
|
60
|
+
})
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return findings;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function* iterateExplicitFiles(resolvedRoot, files) {
|
|
67
|
+
for (const file of files) {
|
|
68
|
+
const trimmed = String(file || "").trim();
|
|
69
|
+
if (!trimmed) continue;
|
|
70
|
+
const fullPath = path.isAbsolute(trimmed) ? trimmed : path.join(resolvedRoot, trimmed);
|
|
71
|
+
const relativePath = path.relative(resolvedRoot, fullPath).replace(/\\/g, "/");
|
|
72
|
+
yield { fullPath, relativePath };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -1,61 +1,102 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SentinelLayer Persona Visual Identity Registry
|
|
3
|
-
*
|
|
4
|
-
* All 13 personas — visual identity, domain specialty, and bias.
|
|
5
|
-
* Shared across all persona packages, daemon services, and orchestrators.
|
|
6
|
-
* NOT Jules-specific — this is platform infrastructure.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export const PERSONA_VISUALS = Object.freeze({
|
|
10
|
-
frontend: { color: "cyan", avatar: "\u{1F3AF}", shortName: "Jules", fullName: "Jules Tanaka", domain: "frontend_runtime", specialty: "React/Next.js/Vue production specialist — hydration safety, render cost, accessibility, bundle weight, mobile responsiveness", bias: "user-perceived performance over vanity optimization" },
|
|
11
|
-
security: { color: "red", avatar: "\u{1F6E1}\uFE0F", shortName: "Nina", fullName: "Nina Patel", domain: "security_overlay", specialty: "AuthZ breaks, secret exposure, injection paths, policy bypass, externally reachable abuse conditions", bias: "assume hostile inputs until proven safe" },
|
|
12
|
-
backend: { color: "blue", avatar: "\u2699\uFE0F", shortName: "Maya", fullName: "Maya Volkov", domain: "backend_runtime", specialty: "Unsafe request handling, runtime crashes, unbounded work, validation gaps, server-side trust boundary failures", bias: "every request is potentially adversarial" },
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* SentinelLayer Persona Visual Identity Registry
|
|
3
|
+
*
|
|
4
|
+
* All 13 personas — visual identity, domain specialty, and bias.
|
|
5
|
+
* Shared across all persona packages, daemon services, and orchestrators.
|
|
6
|
+
* NOT Jules-specific — this is platform infrastructure.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const PERSONA_VISUALS = Object.freeze({
|
|
10
|
+
frontend: { color: "cyan", avatar: "\u{1F3AF}", shortName: "Jules", fullName: "Jules Tanaka", domain: "frontend_runtime", specialty: "React/Next.js/Vue production specialist — hydration safety, render cost, accessibility, bundle weight, mobile responsiveness", bias: "user-perceived performance over vanity optimization" },
|
|
11
|
+
security: { color: "red", avatar: "\u{1F6E1}\uFE0F", shortName: "Nina", fullName: "Nina Patel", domain: "security_overlay", specialty: "AuthZ breaks, secret exposure, injection paths, policy bypass, externally reachable abuse conditions", bias: "assume hostile inputs until proven safe" },
|
|
12
|
+
backend: { color: "blue", avatar: "\u2699\uFE0F", shortName: "Maya", fullName: "Maya Volkov", domain: "backend_runtime", specialty: "Unsafe request handling, runtime crashes, unbounded work, validation gaps, server-side trust boundary failures", bias: "every request is potentially adversarial" },
|
|
13
|
+
architecture: { color: "blue", avatar: "\u{1F3DB}\uFE0F", shortName: "Maya", fullName: "Maya Volkov", domain: "backend_architecture", specialty: "Module boundaries, coupling, state sprawl, god components, circular dependencies, dead code", bias: "boundaries and contracts before cleverness" },
|
|
14
|
+
performance: { color: "yellow", avatar: "\u26A1", shortName: "Arjun", fullName: "Arjun Mehta", domain: "performance_efficiency", specialty: "N+1 queries, blocking I/O, unbounded fetches, memory leaks, bundle bloat, missing caches", bias: "measure before optimizing, then measure again" },
|
|
15
|
+
compliance: { color: "magenta", avatar: "\u{1F4CB}", shortName: "Leila", fullName: "Leila Farouk", domain: "compliance_controls", specialty: "PII handling, audit logging, GDPR/SOC2/HIPAA gaps, consent tracking, data classification", bias: "evidence, not assertions, per regulatory requirement" },
|
|
16
|
+
testing: { color: "green", avatar: "\u{1F9EA}", shortName: "Priya", fullName: "Priya Raman", domain: "testing_correctness", specialty: "Missing regression coverage, false confidence from shallow tests, broken invariants with no executable proof", bias: "tests that pass but miss real bugs are worse than no tests" },
|
|
17
|
+
release: { color: "yellow", avatar: "\u{1F680}", shortName: "Omar", fullName: "Omar Singh", domain: "release_engineering", specialty: "CI/CD integrity, workflow trust, artifact provenance, bypassable gates, unsafe deployment automation", bias: "every deployment is a security boundary" },
|
|
18
|
+
"code-quality": { color: "purple", avatar: "\u{1F48E}", shortName: "Ethan", fullName: "Ethan Park", domain: "code_quality", specialty: "Complexity hotspots, unsafe shortcuts, brittle structure, maintenance risks that hide future defects", bias: "simplicity is a security feature" },
|
|
19
|
+
infrastructure: { color: "orange", avatar: "\u{1F3D7}\uFE0F", shortName: "Kat", fullName: "Kat Hughes", domain: "infrastructure", specialty: "IAM blast radius, public exposure, network posture, secrets placement, infrastructure policy drift", bias: "least privilege by default, explicit escalation required" },
|
|
20
|
+
data: { color: "pink", avatar: "\u{1F5C4}\uFE0F", shortName: "Linh", fullName: "Linh Tran", domain: "data_layer", specialty: "Query safety, migration drift, integrity failures, tenancy leaks, schema/application mismatches", bias: "data integrity is non-negotiable" },
|
|
21
|
+
observability: { color: "magenta", avatar: "\u{1F4CA}", shortName: "Sofia", fullName: "Sofia Alvarez", domain: "observability", specialty: "Missing telemetry, broken alerting, weak auditability, blind spots that hide failures or attacks", bias: "if you can't observe it, you can't secure it" },
|
|
22
|
+
reliability: { color: "white", avatar: "\u{1F504}", shortName: "Noah", fullName: "Noah Ben-David", domain: "reliability_sre", specialty: "Timeout safety, retry storms, backlog growth, partial failure handling, operational blast radius", bias: "graceful degradation over silent failure" },
|
|
23
|
+
documentation: { color: "gray", avatar: "\u{1F4DD}", shortName: "Samir", fullName: "Samir Okafor", domain: "docs_knowledge", specialty: "Operational drift between docs and code, missing runbook steps, misleading instructions that break operators", bias: "documentation is a contract, not decoration" },
|
|
24
|
+
"supply-chain": { color: "brown", avatar: "\u{1F4E6}", shortName: "Nora", fullName: "Nora Kline", domain: "supply_chain", specialty: "Dependency risk, provenance gaps, pinning drift, artifact trust, compromised build inputs", bias: "every dependency is a trust decision" },
|
|
25
|
+
"ai-governance": { color: "violet", avatar: "\u{1F916}", shortName: "Amina", fullName: "Amina Chen", domain: "ai_pipeline", specialty: "Prompt injection, tool abuse, eval regressions, unsafe model routing, guardrail bypass, policy drift in agentic flows", bias: "AI autonomy requires proportional governance" },
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Visual identity for the orchestrator tier (Dr. Kai Chen / Senti).
|
|
30
|
+
*
|
|
31
|
+
* Kept SEPARATE from PERSONA_VISUALS so the dispatch-invariant test
|
|
32
|
+
* (FULL_DEPTH_PERSONAS ⊆ PERSONA_VISUALS keys) isn't polluted by
|
|
33
|
+
* non-review entries. Consumers that need the orchestrator visual
|
|
34
|
+
* import ORCHESTRATOR_VISUALS or call resolveOrchestratorVisual().
|
|
35
|
+
*/
|
|
36
|
+
export const ORCHESTRATOR_VISUALS = Object.freeze({
|
|
37
|
+
"kai-chen": {
|
|
38
|
+
color: "gold",
|
|
39
|
+
avatar: "\u{1F3AD}",
|
|
40
|
+
shortName: "Kai",
|
|
41
|
+
fullName: "Dr. Kai Chen",
|
|
42
|
+
domain: "orchestration",
|
|
43
|
+
specialty: "Global orchestrator — picks personas, deduplicates across domains, ranks by severity × confidence × blast radius, demands reproduction steps",
|
|
44
|
+
bias: "performance budgets; operational simplicity; correctness over cleverness",
|
|
45
|
+
role: "Global Orchestrator / Senti",
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export function resolveOrchestratorVisual(idOrName) {
|
|
50
|
+
if (!idOrName) return null;
|
|
51
|
+
const lower = String(idOrName).toLowerCase();
|
|
52
|
+
if (ORCHESTRATOR_VISUALS[lower]) {
|
|
53
|
+
return { id: lower, ...ORCHESTRATOR_VISUALS[lower] };
|
|
54
|
+
}
|
|
55
|
+
for (const [id, visual] of Object.entries(ORCHESTRATOR_VISUALS)) {
|
|
56
|
+
if (
|
|
57
|
+
visual.shortName.toLowerCase() === lower
|
|
58
|
+
|| visual.fullName.toLowerCase() === lower
|
|
59
|
+
) {
|
|
60
|
+
return { id, ...visual };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Resolve persona visual identity by agent ID or persona name.
|
|
68
|
+
*/
|
|
69
|
+
export function resolvePersonaVisual(idOrName) {
|
|
70
|
+
if (!idOrName) return null;
|
|
71
|
+
const lower = String(idOrName).toLowerCase();
|
|
72
|
+
|
|
73
|
+
// Direct ID match
|
|
74
|
+
if (PERSONA_VISUALS[lower]) return { id: lower, ...PERSONA_VISUALS[lower] };
|
|
75
|
+
|
|
76
|
+
// Name match (first name or full name)
|
|
77
|
+
for (const [id, visual] of Object.entries(PERSONA_VISUALS)) {
|
|
78
|
+
if (visual.shortName.toLowerCase() === lower || visual.fullName.toLowerCase() === lower) {
|
|
79
|
+
return { id, ...visual };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* List all persona IDs for autocomplete.
|
|
88
|
+
*/
|
|
89
|
+
export function listPersonaIds() {
|
|
90
|
+
return Object.keys(PERSONA_VISUALS);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* List all persona names (short + full) for autocomplete.
|
|
95
|
+
*/
|
|
96
|
+
export function listPersonaNames() {
|
|
97
|
+
const names = [];
|
|
98
|
+
for (const [id, visual] of Object.entries(PERSONA_VISUALS)) {
|
|
99
|
+
names.push(id, visual.shortName.toLowerCase(), visual.fullName.toLowerCase());
|
|
100
|
+
}
|
|
101
|
+
return names;
|
|
102
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Omar (release persona) — barrel export (#A19).
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
RELEASE_TOOLS,
|
|
5
|
+
RELEASE_TOOL_IDS,
|
|
6
|
+
dispatchReleaseTool,
|
|
7
|
+
runAllReleaseTools,
|
|
8
|
+
runChangelogDiff,
|
|
9
|
+
runFeatureFlagAudit,
|
|
10
|
+
runRollbackVerify,
|
|
11
|
+
runSemverCheck,
|
|
12
|
+
} from "./tools/index.js";
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// Shared helpers for Omar's (release) domain tools (#A19).
|
|
2
|
+
|
|
3
|
+
import fsp from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import process from "node:process";
|
|
6
|
+
|
|
7
|
+
import ignore from "ignore";
|
|
8
|
+
|
|
9
|
+
const DEFAULT_IGNORED_DIRS = new Set([
|
|
10
|
+
".git",
|
|
11
|
+
"node_modules",
|
|
12
|
+
".venv",
|
|
13
|
+
".next",
|
|
14
|
+
"dist",
|
|
15
|
+
"build",
|
|
16
|
+
"coverage",
|
|
17
|
+
".sentinelayer",
|
|
18
|
+
".sentinel",
|
|
19
|
+
".turbo",
|
|
20
|
+
".idea",
|
|
21
|
+
".vscode",
|
|
22
|
+
"__pycache__",
|
|
23
|
+
".cache",
|
|
24
|
+
]);
|
|
25
|
+
const MAX_FILE_SIZE_BYTES = 1024 * 1024;
|
|
26
|
+
const SEVERITIES = Object.freeze(["P0", "P1", "P2", "P3"]);
|
|
27
|
+
|
|
28
|
+
export function toPosix(value) {
|
|
29
|
+
return String(value || "").replace(/\\/g, "/");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function normalizeSeverity(value) {
|
|
33
|
+
const normalized = String(value || "").trim().toUpperCase();
|
|
34
|
+
if (SEVERITIES.includes(normalized)) {
|
|
35
|
+
return normalized;
|
|
36
|
+
}
|
|
37
|
+
return "P2";
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function createFinding({
|
|
41
|
+
severity,
|
|
42
|
+
kind,
|
|
43
|
+
file,
|
|
44
|
+
line = 0,
|
|
45
|
+
evidence = "",
|
|
46
|
+
rootCause = "",
|
|
47
|
+
recommendedFix = "",
|
|
48
|
+
confidence = null,
|
|
49
|
+
tool = "",
|
|
50
|
+
persona = "release",
|
|
51
|
+
} = {}) {
|
|
52
|
+
return {
|
|
53
|
+
persona,
|
|
54
|
+
tool: String(tool || "").trim(),
|
|
55
|
+
kind: String(kind || "").trim() || "release",
|
|
56
|
+
severity: normalizeSeverity(severity),
|
|
57
|
+
file: toPosix(file || ""),
|
|
58
|
+
line: Number.isFinite(Number(line)) ? Math.max(0, Math.floor(Number(line))) : 0,
|
|
59
|
+
evidence: String(evidence || "").trim().slice(0, 400),
|
|
60
|
+
rootCause: String(rootCause || "").trim(),
|
|
61
|
+
recommendedFix: String(recommendedFix || "").trim(),
|
|
62
|
+
confidence:
|
|
63
|
+
confidence === null || confidence === undefined
|
|
64
|
+
? null
|
|
65
|
+
: Math.max(0, Math.min(1, Number(confidence) || 0)),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function readIgnorePatterns(filePath) {
|
|
70
|
+
try {
|
|
71
|
+
const raw = await fsp.readFile(filePath, "utf-8");
|
|
72
|
+
return String(raw || "")
|
|
73
|
+
.split(/\r?\n/)
|
|
74
|
+
.map((line) => line.trim())
|
|
75
|
+
.filter((line) => line && !line.startsWith("#"));
|
|
76
|
+
} catch (err) {
|
|
77
|
+
if (err && typeof err === "object" && err.code === "ENOENT") {
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
throw err;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function createIgnoreMatcher(rootPath) {
|
|
85
|
+
const matcher = ignore();
|
|
86
|
+
const gitignore = await readIgnorePatterns(path.join(rootPath, ".gitignore"));
|
|
87
|
+
const sentinel = await readIgnorePatterns(
|
|
88
|
+
path.join(rootPath, ".sentinelayerignore")
|
|
89
|
+
);
|
|
90
|
+
matcher.add([...gitignore, ...sentinel]);
|
|
91
|
+
return (relativePath, isDirectory) => {
|
|
92
|
+
const normalized = toPosix(relativePath);
|
|
93
|
+
if (!normalized) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
const candidate = isDirectory ? `${normalized}/` : normalized;
|
|
97
|
+
return matcher.ignores(candidate);
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export async function* walkRepoFiles({
|
|
102
|
+
rootPath = process.cwd(),
|
|
103
|
+
extensions = new Set(),
|
|
104
|
+
maxFileSize = MAX_FILE_SIZE_BYTES,
|
|
105
|
+
} = {}) {
|
|
106
|
+
const resolvedRoot = path.resolve(rootPath);
|
|
107
|
+
const ignoreMatcher = await createIgnoreMatcher(resolvedRoot);
|
|
108
|
+
const wantedExtensions =
|
|
109
|
+
extensions instanceof Set
|
|
110
|
+
? extensions
|
|
111
|
+
: new Set(Array.isArray(extensions) ? extensions : []);
|
|
112
|
+
const stack = [resolvedRoot];
|
|
113
|
+
while (stack.length > 0) {
|
|
114
|
+
const current = stack.pop();
|
|
115
|
+
let entries = [];
|
|
116
|
+
try {
|
|
117
|
+
entries = await fsp.readdir(current, { withFileTypes: true });
|
|
118
|
+
} catch {
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
for (const entry of entries) {
|
|
122
|
+
const fullPath = path.join(current, entry.name);
|
|
123
|
+
const relativePath = toPosix(path.relative(resolvedRoot, fullPath));
|
|
124
|
+
if (entry.isDirectory()) {
|
|
125
|
+
if (!relativePath || DEFAULT_IGNORED_DIRS.has(entry.name)) {
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (ignoreMatcher(relativePath, true)) {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
stack.push(fullPath);
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (!entry.isFile()) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (ignoreMatcher(relativePath, false)) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
const ext = path.extname(entry.name).toLowerCase();
|
|
141
|
+
if (wantedExtensions.size > 0 && !wantedExtensions.has(ext) && !wantedExtensions.has("")) {
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
let stat = null;
|
|
145
|
+
try {
|
|
146
|
+
stat = await fsp.stat(fullPath);
|
|
147
|
+
} catch {
|
|
148
|
+
stat = null;
|
|
149
|
+
}
|
|
150
|
+
if (!stat || stat.size > maxFileSize) {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
yield { fullPath, relativePath, stat };
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function findLineMatches(content, pattern) {
|
|
159
|
+
const text = String(content || "");
|
|
160
|
+
if (!pattern) {
|
|
161
|
+
return [];
|
|
162
|
+
}
|
|
163
|
+
const global = new RegExp(
|
|
164
|
+
pattern.source,
|
|
165
|
+
pattern.flags.includes("g") ? pattern.flags : `${pattern.flags}g`
|
|
166
|
+
);
|
|
167
|
+
const matches = [];
|
|
168
|
+
let match;
|
|
169
|
+
while ((match = global.exec(text)) !== null) {
|
|
170
|
+
const lineIndex = text.slice(0, match.index).split(/\r?\n/).length;
|
|
171
|
+
matches.push({ index: match.index, line: lineIndex, match: match[0] });
|
|
172
|
+
}
|
|
173
|
+
return matches;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function getLineContent(content, line) {
|
|
177
|
+
const lines = String(content || "").split(/\r?\n/);
|
|
178
|
+
return (lines[Math.max(0, (Number(line) || 1) - 1)] || "").trim();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export { DEFAULT_IGNORED_DIRS, MAX_FILE_SIZE_BYTES, SEVERITIES };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// changelog-diff — verify the changelog has an entry for the current version (#A19).
|
|
2
|
+
|
|
3
|
+
import fsp from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
import { createFinding, toPosix, walkRepoFiles } from "./base.js";
|
|
7
|
+
|
|
8
|
+
export async function runChangelogDiff({ rootPath, files = null } = {}) {
|
|
9
|
+
const resolvedRoot = path.resolve(String(rootPath || "."));
|
|
10
|
+
const iterator =
|
|
11
|
+
Array.isArray(files) && files.length > 0
|
|
12
|
+
? iterateExplicitFiles(resolvedRoot, files)
|
|
13
|
+
: walkRepoFiles({ rootPath: resolvedRoot, extensions: new Set([".json"]) });
|
|
14
|
+
|
|
15
|
+
const findings = [];
|
|
16
|
+
for await (const { fullPath, relativePath } of iterator) {
|
|
17
|
+
if (!/(^|\/)package\.json$/.test(toPosix(relativePath))) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
let raw;
|
|
21
|
+
try {
|
|
22
|
+
raw = await fsp.readFile(fullPath, "utf-8");
|
|
23
|
+
} catch {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
let parsed;
|
|
27
|
+
try {
|
|
28
|
+
parsed = JSON.parse(raw);
|
|
29
|
+
} catch {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (!parsed?.version || parsed.private === true) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const dir = path.dirname(fullPath);
|
|
36
|
+
let changelog = "";
|
|
37
|
+
for (const candidate of ["CHANGELOG.md", "CHANGES.md"]) {
|
|
38
|
+
try {
|
|
39
|
+
changelog = await fsp.readFile(path.join(dir, candidate), "utf-8");
|
|
40
|
+
break;
|
|
41
|
+
} catch {
|
|
42
|
+
/* try next */
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (!changelog) {
|
|
46
|
+
continue; // semver-check already advises on missing changelog
|
|
47
|
+
}
|
|
48
|
+
const versionPattern = new RegExp(
|
|
49
|
+
`##\\s*(?:\\[|v)?\\s*${String(parsed.version).replace(/\./g, "\\.")}\\b`
|
|
50
|
+
);
|
|
51
|
+
if (!versionPattern.test(changelog)) {
|
|
52
|
+
findings.push(
|
|
53
|
+
createFinding({
|
|
54
|
+
tool: "changelog-diff",
|
|
55
|
+
kind: "release.version-not-in-changelog",
|
|
56
|
+
severity: "P2",
|
|
57
|
+
file: toPosix(relativePath),
|
|
58
|
+
line: 0,
|
|
59
|
+
evidence: `package.json version "${parsed.version}" not found as a heading in the colocated changelog`,
|
|
60
|
+
rootCause:
|
|
61
|
+
"Changelog is out of sync with the manifest. Releases shipped without a changelog entry are invisible to consumers tracking what's new.",
|
|
62
|
+
recommendedFix:
|
|
63
|
+
"Add a `## [${version}] - YYYY-MM-DD` heading to the changelog before publishing. Wire release-please / changesets to keep them in sync automatically.",
|
|
64
|
+
confidence: 0.8,
|
|
65
|
+
})
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return findings;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function* iterateExplicitFiles(resolvedRoot, files) {
|
|
73
|
+
for (const file of files) {
|
|
74
|
+
const trimmed = String(file || "").trim();
|
|
75
|
+
if (!trimmed) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
const fullPath = path.isAbsolute(trimmed)
|
|
79
|
+
? trimmed
|
|
80
|
+
: path.join(resolvedRoot, trimmed);
|
|
81
|
+
const relativePath = path
|
|
82
|
+
.relative(resolvedRoot, fullPath)
|
|
83
|
+
.replace(/\\/g, "/");
|
|
84
|
+
yield { fullPath, relativePath };
|
|
85
|
+
}
|
|
86
|
+
}
|