@kirill.konshin/lint 0.6.2 → 0.6.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.
package/package.json
CHANGED
|
@@ -57,7 +57,7 @@ Decided once, printed as dotenv lines (`AUDIT_RUN`, `AUDIT_SCOPE`, `AUDIT_GATING
|
|
|
57
57
|
| merge-request | a merge request touching none | affected | cheap | gating |
|
|
58
58
|
| default-branch | anything else | affected | expensive | gating |
|
|
59
59
|
|
|
60
|
-
Every run reads on the cheap model. `AUDIT_MODEL_CHEAP`, `AUDIT_EFFORT_CHEAP`, `AUDIT_MODEL_EXPENSIVE` and `AUDIT_EFFORT_EXPENSIVE` override the defaults. `AUDIT_SLOTS` is how many workers a reading job runs at once: as many as `AUDIT_JOB_MEMORY` (default 2 GiB) holds at
|
|
60
|
+
Every run reads on the cheap model. `AUDIT_MODEL_CHEAP`, `AUDIT_EFFORT_CHEAP`, `AUDIT_MODEL_EXPENSIVE` and `AUDIT_EFFORT_EXPENSIVE` override the defaults. `AUDIT_SLOTS` is how many workers a reading job runs at once: as many as `AUDIT_JOB_MEMORY` (default 2 GiB) holds at 300 MB a worker, never more than `AUDIT_WORKERS` (default 2). A merge request whose open changes cannot be classified fails the command rather than reading as one that touches nothing.
|
|
61
61
|
|
|
62
62
|
### Scope — `spec-tools scope`
|
|
63
63
|
|
|
@@ -70,7 +70,7 @@ Cases:
|
|
|
70
70
|
|
|
71
71
|
### Workers — `spec-tools workers [--complete|--verify]`
|
|
72
72
|
|
|
73
|
-
One headless `claude --print` worker per part loads the `spec-verify` skill and writes its own findings file. In a parallel job (`CI_NODE_INDEX` of `CI_NODE_TOTAL`) it reads only its share: part p goes to job ((p − 1) mod total) + 1. `--complete` judges, as each part's next reader, exactly what the merge listed short; `--verify` puts every standing ERROR to one verifier that confirms it only when the divergence is real and critical. How many run at once follows the container's memory (
|
|
73
|
+
One headless `claude --print` worker per part loads the `spec-verify` skill and writes its own findings file. In a parallel job (`CI_NODE_INDEX` of `CI_NODE_TOTAL`) it reads only its share: part p goes to job ((p − 1) mod total) + 1. `--complete` judges, as each part's next reader, exactly what the merge listed short; `--verify` puts every standing ERROR to one verifier that confirms it only when the divergence is real and critical. How many run at once follows the container's memory (300 MB a worker), never more than `AUDIT_WORKERS` (default 2), and each pass logs the job's memory peak against its limit; a worker past `AUDIT_WORKER_TIMEOUT` (20m) is killed and its part judged by the completion pass. A pass that changed any file outside the audit's outputs exits 1, naming the paths; a missing input exits 2.
|
|
74
74
|
|
|
75
75
|
### Merge — `spec-tools report [--gate] [--worktree]`
|
|
76
76
|
|
|
@@ -17,7 +17,24 @@ The jobs a GitLab repository runs around `spec-steward` and `spec-tools`. Names
|
|
|
17
17
|
|
|
18
18
|
## Getting the tools into an AI job
|
|
19
19
|
|
|
20
|
-
An AI job
|
|
20
|
+
An AI job needs Node and the Claude CLI, no workspace install. Pin the CLI rather than taking whatever an image carries: a model needs a CLI that knows it (its context window and its effort levels), and an older CLI fails a long worker with "Prompt is too long". Download Anthropic's release binary for the runner's platform, check it against the release manifest, and cache it per version:
|
|
21
|
+
|
|
22
|
+
```yaml
|
|
23
|
+
.claude-code: &claude-code
|
|
24
|
+
- |
|
|
25
|
+
set -e
|
|
26
|
+
platform="linux-$(uname -m | sed 's/x86_64/x64/; s/aarch64/arm64/')"
|
|
27
|
+
dir=".claude-code/$CLAUDE_CODE_VERSION/$platform"
|
|
28
|
+
if [ ! -x "$dir/claude" ]; then
|
|
29
|
+
base="https://downloads.claude.ai/claude-code-releases/$CLAUDE_CODE_VERSION"
|
|
30
|
+
sum=$(curl -fsSL "$base/manifest.json" | node -e "let s='';process.stdin.on('data',(d)=>(s+=d)).on('end',()=>console.log(JSON.parse(s).platforms[process.argv[1]].checksum))" "$platform")
|
|
31
|
+
mkdir -p "$dir" && curl -fsSL "$base/$platform/claude" -o "$dir/claude.download"
|
|
32
|
+
echo "$sum $dir/claude.download" | sha256sum -c - && mv "$dir/claude.download" "$dir/claude" && chmod +x "$dir/claude"
|
|
33
|
+
fi
|
|
34
|
+
export PATH="$CI_PROJECT_DIR/$dir:$PATH"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Cache `.claude-code/` keyed on `CLAUDE_CODE_VERSION`, and gitignore it. The job that computes the scope runs with the workspace installed and hands the package's `skills/` on as an artifact: the self-contained CLI, `skills/spec-tools/scripts/cli.js`, and the skills its workers read. The AI jobs `needs:` that job and call the file with `node`.
|
|
21
38
|
|
|
22
39
|
`spec-tools scope` and `changed` load `typescript`, so they run in a job with the workspace installed.
|
|
23
40
|
|
|
@@ -70,11 +87,12 @@ spec-coverage:
|
|
|
70
87
|
# reading left short, verify every ERROR, gate.
|
|
71
88
|
spec-verify:
|
|
72
89
|
stage: review
|
|
73
|
-
image: <an image with
|
|
90
|
+
image: <an image with node>
|
|
74
91
|
needs: [spec-coverage]
|
|
75
92
|
variables: { KUBERNETES_MEMORY_LIMIT: 8Gi, KUBERNETES_CPU_LIMIT: '4' } # AUDIT_JOB_MEMORY says the same
|
|
76
93
|
allow_failure: { exit_codes: [3, 77] }
|
|
77
94
|
script:
|
|
95
|
+
- *claude-code
|
|
78
96
|
- node node_modules/@kirill.konshin/lint/skills/spec-tools/scripts/cli.js workers || echo "the completion pass reads what the reading left short"
|
|
79
97
|
- node node_modules/@kirill.konshin/lint/skills/spec-tools/scripts/cli.js report
|
|
80
98
|
- node node_modules/@kirill.konshin/lint/skills/spec-tools/scripts/cli.js workers --complete
|
|
@@ -87,10 +105,11 @@ spec-verify:
|
|
|
87
105
|
# Any other skill-driven review: headless, then its verdict.
|
|
88
106
|
some-review:
|
|
89
107
|
stage: review
|
|
90
|
-
image: <an image with
|
|
108
|
+
image: <an image with node>
|
|
91
109
|
needs: [spec-coverage]
|
|
92
110
|
allow_failure: { exit_codes: [3, 77] }
|
|
93
111
|
script:
|
|
112
|
+
- *claude-code
|
|
94
113
|
- node node_modules/@kirill.konshin/lint/skills/spec-tools/scripts/cli.js run some-review --verdict some-review.md --advisory
|
|
95
114
|
artifacts: { when: always, paths: [some-review.md, claude.jsonl, 'job-log-*.md'] }
|
|
96
115
|
|
|
@@ -3924,7 +3924,7 @@ var init_tier = __esmMin((() => {
|
|
|
3924
3924
|
CHEAP_EFFORT = "high";
|
|
3925
3925
|
EXPENSIVE_MODEL = "claude-sonnet-5-5";
|
|
3926
3926
|
EXPENSIVE_EFFORT = "medium";
|
|
3927
|
-
WORKER_BYTES =
|
|
3927
|
+
WORKER_BYTES = 300 * 1024 ** 2;
|
|
3928
3928
|
DEFAULT_JOB_MEMORY = 2 * 1024 ** 3;
|
|
3929
3929
|
workersFor = (env, memory) => Math.max(1, Math.min(Number(env.AUDIT_WORKERS) || 2, Math.floor(memory / WORKER_BYTES)));
|
|
3930
3930
|
dotenv = (t) => Object.entries(t).map(([key, value]) => `${key}=${value}`).join("\n") + "\n";
|
|
@@ -5508,6 +5508,7 @@ var auditReport_exports = /* @__PURE__ */ __exportAll({
|
|
|
5508
5508
|
coverageEntry: () => coverageEntry,
|
|
5509
5509
|
dedupe: () => dedupe,
|
|
5510
5510
|
exitCodeFor: () => exitCodeFor,
|
|
5511
|
+
findingsProblem: () => findingsProblem,
|
|
5511
5512
|
gitReader: () => gitReader,
|
|
5512
5513
|
grade: () => grade,
|
|
5513
5514
|
isGenerated: () => isGenerated,
|
|
@@ -5538,6 +5539,16 @@ function coverageEntry(value) {
|
|
|
5538
5539
|
};
|
|
5539
5540
|
}
|
|
5540
5541
|
/**
|
|
5542
|
+
* What makes a reader's findings unusable: a finding without one of the fields the report reads. The reader then
|
|
5543
|
+
* counts as not run, so the completion pass re-reads its part, rather than the report guessing at a field.
|
|
5544
|
+
*/
|
|
5545
|
+
function findingsProblem(findings) {
|
|
5546
|
+
for (const [index, finding] of findings.entries()) {
|
|
5547
|
+
const absent = FINDING_FIELDS.filter((field) => typeof finding?.[field] !== "string");
|
|
5548
|
+
if (absent.length) return `finding ${index + 1} lacks ${absent.map((field) => `\`${field}\``).join(", ")}`;
|
|
5549
|
+
}
|
|
5550
|
+
}
|
|
5551
|
+
/**
|
|
5541
5552
|
* Whether the quote is really at its line: the normalized quote appears in the normalized text of the
|
|
5542
5553
|
* lines starting at the cited line or one above and running one line past what the quote spans — so a
|
|
5543
5554
|
* fragment may run onto the next line and a worker copying from a numbered excerpt may be one line
|
|
@@ -5836,6 +5847,8 @@ function main$1(read = commitReader) {
|
|
|
5836
5847
|
problems.push(`\`${rel}\` needed a syntax repair (${error.message}); its content was kept as written.`);
|
|
5837
5848
|
}
|
|
5838
5849
|
if (!Array.isArray(parsed.findings) || typeof parsed.coverage !== "object") throw new Error("missing `findings` or `coverage`");
|
|
5850
|
+
const problem = findingsProblem(parsed.findings);
|
|
5851
|
+
if (problem) throw new Error(problem);
|
|
5839
5852
|
return {
|
|
5840
5853
|
...parsed,
|
|
5841
5854
|
part: n,
|
|
@@ -5879,7 +5892,7 @@ function cli(argv) {
|
|
|
5879
5892
|
process.stdout.write(line + "\n");
|
|
5880
5893
|
return argv.includes("--gate") ? exitCodeFor(line.split(" ")[0]) : 0;
|
|
5881
5894
|
}
|
|
5882
|
-
var MERGE_FILE, VERDICT_FILE, ERROR_CLASS, INFO_CLASS, CHECKS, normalize, isGenerated, gitReader, commitReader, worktreeReader, rank, tierRank, exitCodeFor, unitOf, firstSentence, findingLine;
|
|
5895
|
+
var MERGE_FILE, VERDICT_FILE, ERROR_CLASS, INFO_CLASS, CHECKS, FINDING_FIELDS, normalize, isGenerated, gitReader, commitReader, worktreeReader, rank, tierRank, exitCodeFor, unitOf, firstSentence, findingLine;
|
|
5883
5896
|
var init_auditReport = __esmMin((() => {
|
|
5884
5897
|
init_esm();
|
|
5885
5898
|
init_files();
|
|
@@ -5899,6 +5912,11 @@ var init_auditReport = __esmMin((() => {
|
|
|
5899
5912
|
"4": "A rule that no longer matches the implementation or architecture",
|
|
5900
5913
|
"5": "A rule whose tests satisfy the wording while failing to protect the intent"
|
|
5901
5914
|
};
|
|
5915
|
+
FINDING_FIELDS = [
|
|
5916
|
+
"kind",
|
|
5917
|
+
"where",
|
|
5918
|
+
"detail"
|
|
5919
|
+
];
|
|
5902
5920
|
normalize = (s) => s.replace(/\s+/g, " ").trim();
|
|
5903
5921
|
isGenerated = (file) => file.startsWith(`audit-parts/`) || /^(spec-verify|spec-review|spec-coverage|audit-scope)\.(md|json)$/.test(file);
|
|
5904
5922
|
gitReader = (ref, cwd = root()) => (file) => {
|