@intentius/chant 0.124.76 → 0.124.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__fixtures__/agent-guard/plywood.d.ts +8 -0
- package/dist/__fixtures__/agent-guard/plywood.d.ts.map +1 -0
- package/dist/__fixtures__/agent-guard/plywood.js +19 -0
- package/dist/__fixtures__/agent-guard/terragucci.d.ts +8 -0
- package/dist/__fixtures__/agent-guard/terragucci.d.ts.map +1 -0
- package/dist/__fixtures__/agent-guard/terragucci.js +30 -0
- package/dist/__fixtures__/gated-ledger.d.ts +10 -0
- package/dist/__fixtures__/gated-ledger.d.ts.map +1 -0
- package/dist/__fixtures__/gated-ledger.js +51 -0
- package/dist/__fixtures__/notify-messages/events.d.ts +9 -0
- package/dist/__fixtures__/notify-messages/events.d.ts.map +1 -0
- package/dist/__fixtures__/notify-messages/events.js +21 -0
- package/dist/__fixtures__/product-words.d.ts +14 -0
- package/dist/__fixtures__/product-words.d.ts.map +1 -1
- package/dist/__fixtures__/product-words.js +11 -0
- package/dist/__fixtures__/terragucci-notify.d.ts +66 -0
- package/dist/__fixtures__/terragucci-notify.d.ts.map +1 -0
- package/dist/__fixtures__/terragucci-notify.js +133 -0
- package/dist/action-pins.d.ts +8 -0
- package/dist/action-pins.d.ts.map +1 -1
- package/dist/action-pins.js +9 -0
- package/dist/agent-guard.d.ts +143 -0
- package/dist/agent-guard.d.ts.map +1 -0
- package/dist/agent-guard.js +455 -0
- package/dist/ci-commit.d.ts +120 -5
- package/dist/ci-commit.d.ts.map +1 -1
- package/dist/ci-commit.js +214 -23
- package/dist/ci-own-jobs.d.ts +81 -0
- package/dist/ci-own-jobs.d.ts.map +1 -0
- package/dist/ci-own-jobs.js +233 -0
- package/dist/ci-product-words.d.ts +18 -4
- package/dist/ci-product-words.d.ts.map +1 -1
- package/dist/ci-product-words.js +26 -6
- package/dist/ci-product.d.ts +40 -1
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +40 -1
- package/dist/cli/handlers/approve.d.ts +5 -1
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +17 -11
- package/dist/cli/handlers/build.d.ts +1 -1
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +88 -2
- package/dist/cli/handlers/commit.d.ts.map +1 -1
- package/dist/cli/handlers/commit.js +3 -1
- package/dist/cli/handlers/notify-relay.d.ts +18 -1
- package/dist/cli/handlers/notify-relay.d.ts.map +1 -1
- package/dist/cli/handlers/notify-relay.js +90 -14
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +3 -1
- package/dist/cli/handlers/release.d.ts +5 -1
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +21 -9
- package/dist/cli/handlers/run-generate.d.ts.map +1 -1
- package/dist/cli/handlers/run-generate.js +2 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +21 -1
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +60 -4
- package/dist/cli/registry.d.ts +16 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/pr-env-components.d.ts +65 -0
- package/dist/components/pr-env-components.d.ts.map +1 -0
- package/dist/components/pr-env-components.js +162 -0
- package/dist/components/pr-policy.d.ts +15 -0
- package/dist/components/pr-policy.d.ts.map +1 -1
- package/dist/components/pr-policy.js +24 -1
- package/dist/components/release-compile.d.ts +15 -3
- package/dist/components/release-compile.d.ts.map +1 -1
- package/dist/components/release-compile.js +66 -15
- package/dist/config.d.ts +14 -8
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +16 -1
- package/dist/gate-policy.d.ts +14 -1
- package/dist/gate-policy.d.ts.map +1 -1
- package/dist/gate-policy.js +16 -6
- package/dist/lexicon.d.ts +25 -1
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lexicon.js +10 -0
- package/dist/lifecycle/gated-op.d.ts +95 -0
- package/dist/lifecycle/gated-op.d.ts.map +1 -0
- package/dist/lifecycle/gated-op.js +96 -0
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +83 -2
- package/dist/lifecycle/release-images.d.ts +77 -3
- package/dist/lifecycle/release-images.d.ts.map +1 -1
- package/dist/lifecycle/release-images.js +132 -6
- package/dist/notify-product.d.ts +11 -2
- package/dist/notify-product.d.ts.map +1 -1
- package/dist/notify-product.js +16 -4
- package/dist/notify-relay-repo.d.ts +131 -0
- package/dist/notify-relay-repo.d.ts.map +1 -0
- package/dist/notify-relay-repo.js +202 -0
- package/dist/notify-relay.d.ts +25 -1
- package/dist/notify-relay.d.ts.map +1 -1
- package/dist/notify-relay.js +27 -2
- package/dist/notify.d.ts +36 -4
- package/dist/notify.d.ts.map +1 -1
- package/dist/notify.js +31 -21
- package/dist/notify.schema.json +1 -0
- package/dist/op/activities/review-product.d.ts +111 -0
- package/dist/op/activities/review-product.d.ts.map +1 -0
- package/dist/op/activities/review-product.js +116 -0
- package/dist/op/op-waves-capability.js +2 -2
- package/dist/policy-engine.d.ts +95 -0
- package/dist/policy-engine.d.ts.map +1 -0
- package/dist/policy-engine.js +157 -0
- package/dist/pr-forge-reads.d.ts +124 -0
- package/dist/pr-forge-reads.d.ts.map +1 -0
- package/dist/pr-forge-reads.js +322 -0
- package/dist/pr-forge.d.ts +14 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +21 -13
- package/dist/pr-plan-note.d.ts +293 -0
- package/dist/pr-plan-note.d.ts.map +1 -0
- package/dist/pr-plan-note.js +362 -0
- package/dist/release-floors.d.ts +9 -1
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +9 -1
- package/dist/state-export.d.ts +126 -0
- package/dist/state-export.d.ts.map +1 -0
- package/dist/state-export.js +156 -0
- package/dist/state-migration.d.ts +148 -0
- package/dist/state-migration.d.ts.map +1 -0
- package/dist/state-migration.js +146 -0
- package/dist/state-unlock.d.ts +167 -0
- package/dist/state-unlock.d.ts.map +1 -0
- package/dist/state-unlock.js +196 -0
- package/dist/wave-runtime.mjs +332 -332
- package/dist/workspace/declaration.schema.json +1 -1
- package/dist/workspace/release-workflow.d.ts +10 -0
- package/dist/workspace/release-workflow.d.ts.map +1 -1
- package/dist/workspace/release-workflow.js +10 -4
- package/package.json +1 -1
- package/src/__fixtures__/agent-guard/plywood.ts +27 -0
- package/src/__fixtures__/agent-guard/terragucci.ts +39 -0
- package/src/__fixtures__/gated-ledger.ts +58 -0
- package/src/__fixtures__/notify-messages/events.ts +23 -0
- package/src/__fixtures__/notify-messages/messages.json +50 -0
- package/src/__fixtures__/pr-loop/terragucci-plan.note.golden.md +53 -0
- package/src/__fixtures__/pr-loop/terragucci-plan.note.json +83 -0
- package/src/__fixtures__/product-words.ts +12 -0
- package/src/__fixtures__/review-agent/terragucci-review.json +94 -0
- package/src/__fixtures__/terragucci-notify.ts +170 -0
- package/src/action-pins.test.ts +12 -1
- package/src/action-pins.ts +11 -0
- package/src/agent-guard.test.ts +319 -0
- package/src/agent-guard.ts +547 -0
- package/src/ci-commit.test.ts +213 -2
- package/src/ci-commit.ts +258 -27
- package/src/ci-own-jobs.test.ts +108 -0
- package/src/ci-own-jobs.ts +252 -0
- package/src/ci-product-words.ts +35 -7
- package/src/ci-product.ts +81 -1
- package/src/cli/handlers/approve-cwd.test.ts +112 -0
- package/src/cli/handlers/approve.ts +22 -11
- package/src/cli/handlers/build-own-jobs.test.ts +80 -0
- package/src/cli/handlers/build-pr-loop-control.test.ts +87 -0
- package/src/cli/handlers/build-run-group.test.ts +59 -0
- package/src/cli/handlers/build.ts +83 -3
- package/src/cli/handlers/commit.ts +3 -0
- package/src/cli/handlers/notify-relay.ts +99 -17
- package/src/cli/handlers/pr.ts +3 -1
- package/src/cli/handlers/release.ts +20 -10
- package/src/cli/handlers/run-generate.ts +2 -1
- package/src/cli/main.ts +21 -1
- package/src/cli/parse-args.ts +45 -3
- package/src/cli/registry.ts +16 -0
- package/src/components/pr-env-components.test.ts +137 -0
- package/src/components/pr-env-components.ts +213 -0
- package/src/components/pr-policy.test.ts +41 -1
- package/src/components/pr-policy.ts +25 -1
- package/src/components/release-compile.test.ts +47 -0
- package/src/components/release-compile.ts +70 -13
- package/src/config.ts +23 -3
- package/src/gate-policy-bundle.test.ts +14 -0
- package/src/gate-policy.test.ts +7 -0
- package/src/gate-policy.ts +22 -7
- package/src/lexicon.ts +28 -1
- package/src/lifecycle/gated-op.ts +158 -0
- package/src/lifecycle/git.test.ts +92 -0
- package/src/lifecycle/git.ts +71 -2
- package/src/lifecycle/release-images-dockerfile.test.ts +221 -0
- package/src/lifecycle/release-images.ts +167 -8
- package/src/notify-message-words.test.ts +186 -0
- package/src/notify-product.ts +17 -4
- package/src/notify-relay-repo.test.ts +284 -0
- package/src/notify-relay-repo.ts +234 -0
- package/src/notify-relay.test.ts +12 -0
- package/src/notify-relay.ts +29 -3
- package/src/notify.schema.json +1 -0
- package/src/notify.ts +59 -19
- package/src/op/activities/review-product.test.ts +116 -0
- package/src/op/activities/review-product.ts +200 -0
- package/src/op/op-waves-capability.ts +2 -2
- package/src/op/schedule-overdue.test.ts +26 -0
- package/src/policy-engine.test.ts +162 -0
- package/src/policy-engine.ts +200 -0
- package/src/pr-forge-reads.test.ts +285 -0
- package/src/pr-forge-reads.ts +424 -0
- package/src/pr-forge.ts +30 -16
- package/src/pr-plan-note.test.ts +105 -0
- package/src/pr-plan-note.ts +521 -0
- package/src/release-floors.ts +13 -1
- package/src/state-export.test.ts +124 -0
- package/src/state-export.ts +227 -0
- package/src/state-migration.test.ts +133 -0
- package/src/state-migration.ts +236 -0
- package/src/state-unlock.test.ts +165 -0
- package/src/state-unlock.ts +293 -0
- package/src/workspace/declaration.schema.json +1 -1
- package/src/workspace/release-workflow.test.ts +34 -0
- package/src/workspace/release-workflow.ts +19 -4
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A repository's own jobs in a pipeline file chant generates (#4769).
|
|
3
|
+
*
|
|
4
|
+
* chant's generators write the whole file, so a job a repository adds by
|
|
5
|
+
* hand is gone at the next `chant build`. Two ways keep it:
|
|
6
|
+
*
|
|
7
|
+
* - a jobs file, or a map of jobs, merged after chant's jobs
|
|
8
|
+
* ({@link mergeOwnJobs}, `chant build --own-jobs <file>`). The file is in
|
|
9
|
+
* the forge's own syntax: a map of job name to job. A name chant's file
|
|
10
|
+
* already gives a job is refused, and on GitLab a top-level keyword too.
|
|
11
|
+
* terragucci's `own_jobs` works this way.
|
|
12
|
+
* - the jobs of the old file that the new one lacks, put back as they were
|
|
13
|
+
* written, comments and all ({@link keepOwnJobs}, `chant build
|
|
14
|
+
* --keep-own-jobs`). A job that runs `chant` or the product's bin counts as
|
|
15
|
+
* generated and is not kept. plywood's `init` and `ci` work this way.
|
|
16
|
+
*
|
|
17
|
+
* Either way the jobs go after chant's, under one comment line: inside
|
|
18
|
+
* `jobs:` at two spaces on GitHub and Forgejo, and at the top level on
|
|
19
|
+
* GitLab. The blocks are read as text by their indentation, so a kept job
|
|
20
|
+
* keeps its formatting. A file with no own jobs is returned unchanged.
|
|
21
|
+
*/
|
|
22
|
+
import { readFileSync } from "node:fs";
|
|
23
|
+
import { emitYAMLEntry, parseYAMLDocument } from "./yaml.js";
|
|
24
|
+
/** The first chant with `mergeOwnJobs`, `keepOwnJobs` and `chant build --own-jobs` / `--keep-own-jobs` (#4769). Products feature-detect on it. */
|
|
25
|
+
export const OWN_JOBS_FLOOR = "0.124.77";
|
|
26
|
+
export const OWN_JOBS_FORGES = ["github", "gitlab", "forgejo"];
|
|
27
|
+
/** The default line above the own jobs. A product passes its own as `line`. */
|
|
28
|
+
export const OWN_JOBS_LINE = "# Your own jobs, kept as they are when chant writes this file again.";
|
|
29
|
+
/** GitLab's top-level keys that are not jobs: never read as a job, never kept. */
|
|
30
|
+
export const GITLAB_TOP_KEYWORDS = ["default", "include", "stages", "variables", "workflow", "image", "services", "cache", "before_script", "after_script", "spec"];
|
|
31
|
+
/** The names an own job may not take on GitLab: the keywords, and `pages`, which GitLab reads as its Pages job. */
|
|
32
|
+
export const GITLAB_RESERVED_JOB_NAMES = [...GITLAB_TOP_KEYWORDS, "pages"];
|
|
33
|
+
/** A job name every forge's YAML reads as a plain key. */
|
|
34
|
+
export const OWN_JOB_NAME = /^[A-Za-z_][A-Za-z0-9_-]*$/;
|
|
35
|
+
/** An own job refused: a collision, a reserved name, or a file that is not a map of jobs. */
|
|
36
|
+
export class OwnJobsError extends Error {
|
|
37
|
+
constructor(message) {
|
|
38
|
+
super(message);
|
|
39
|
+
this.name = "OwnJobsError";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const KEY = /^([A-Za-z0-9_.-]+|"[^"]+"|'[^']+'):(\s|$)/;
|
|
43
|
+
const JOBS_LINE = /^jobs:\s*(#.*)?$/;
|
|
44
|
+
function indentOf(line) {
|
|
45
|
+
return line.length - line.trimStart().length;
|
|
46
|
+
}
|
|
47
|
+
function isContent(line) {
|
|
48
|
+
const t = line.trim();
|
|
49
|
+
return t !== "" && !t.startsWith("#");
|
|
50
|
+
}
|
|
51
|
+
function escapeRegExp(s) {
|
|
52
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
53
|
+
}
|
|
54
|
+
/** Each job's block of lines in `text`, by name, in file order. */
|
|
55
|
+
export function jobBlocks(text, forge) {
|
|
56
|
+
const lines = text.split("\n");
|
|
57
|
+
const out = new Map();
|
|
58
|
+
let start = 0;
|
|
59
|
+
let end = lines.length;
|
|
60
|
+
let depth = 0;
|
|
61
|
+
if (forge !== "gitlab") {
|
|
62
|
+
const at = lines.findIndex((l) => JOBS_LINE.test(l));
|
|
63
|
+
if (at < 0)
|
|
64
|
+
return out;
|
|
65
|
+
start = at + 1;
|
|
66
|
+
const next = lines.findIndex((l, i) => i > at && indentOf(l) === 0 && isContent(l));
|
|
67
|
+
end = next < 0 ? lines.length : next;
|
|
68
|
+
depth = 2;
|
|
69
|
+
}
|
|
70
|
+
let name;
|
|
71
|
+
let body = [];
|
|
72
|
+
const flush = () => {
|
|
73
|
+
if (name !== undefined) {
|
|
74
|
+
while (body.length > 0 && body[body.length - 1].trim() === "")
|
|
75
|
+
body.pop();
|
|
76
|
+
out.set(name, body.join("\n"));
|
|
77
|
+
}
|
|
78
|
+
name = undefined;
|
|
79
|
+
body = [];
|
|
80
|
+
};
|
|
81
|
+
for (let i = start; i < end; i++) {
|
|
82
|
+
const line = lines[i];
|
|
83
|
+
if (isContent(line) && indentOf(line) === depth) {
|
|
84
|
+
const m = KEY.exec(line.slice(depth));
|
|
85
|
+
flush();
|
|
86
|
+
if (m) {
|
|
87
|
+
name = m[1].replace(/^["']|["']$/g, "");
|
|
88
|
+
body = [line];
|
|
89
|
+
}
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (isContent(line) && indentOf(line) < depth) {
|
|
93
|
+
flush();
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (name !== undefined)
|
|
97
|
+
body.push(line);
|
|
98
|
+
}
|
|
99
|
+
flush();
|
|
100
|
+
if (forge === "gitlab")
|
|
101
|
+
for (const k of [...out.keys()])
|
|
102
|
+
if (GITLAB_TOP_KEYWORDS.includes(k))
|
|
103
|
+
out.delete(k);
|
|
104
|
+
return out;
|
|
105
|
+
}
|
|
106
|
+
/** The job names of a pipeline file. */
|
|
107
|
+
export function jobNames(text, forge) {
|
|
108
|
+
return [...jobBlocks(text, forge).keys()];
|
|
109
|
+
}
|
|
110
|
+
/** `generated` with `blocks` after chant's jobs, under `line`. */
|
|
111
|
+
function withBlocks(generated, blocks, forge, line) {
|
|
112
|
+
if (blocks.length === 0)
|
|
113
|
+
return generated;
|
|
114
|
+
const indent = forge === "gitlab" ? "" : " ";
|
|
115
|
+
const block = [`${indent}${line}`, ...blocks].join("\n");
|
|
116
|
+
const lines = generated.replace(/\n+$/, "").split("\n");
|
|
117
|
+
if (forge !== "gitlab") {
|
|
118
|
+
const at = lines.findIndex((l) => JOBS_LINE.test(l));
|
|
119
|
+
if (at >= 0) {
|
|
120
|
+
const next = lines.findIndex((l, i) => i > at && indentOf(l) === 0 && isContent(l));
|
|
121
|
+
if (next >= 0) {
|
|
122
|
+
let cut = next;
|
|
123
|
+
while (cut > at + 1 && lines[cut - 1].trim() === "")
|
|
124
|
+
cut--;
|
|
125
|
+
return [...lines.slice(0, cut), block, ...lines.slice(cut)].join("\n") + "\n";
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return [...lines, block].join("\n") + "\n";
|
|
130
|
+
}
|
|
131
|
+
/** The problems with `own` as a map of job name to job; `where` names it in each. */
|
|
132
|
+
export function ownJobsProblems(own, where) {
|
|
133
|
+
if (own === null || typeof own !== "object" || Array.isArray(own))
|
|
134
|
+
return [`${where} must be a map of job name to job`];
|
|
135
|
+
const problems = [];
|
|
136
|
+
for (const [name, job] of Object.entries(own)) {
|
|
137
|
+
if (!OWN_JOB_NAME.test(name))
|
|
138
|
+
problems.push(`${where}: ${JSON.stringify(name)} is not a job name; use letters, digits, "_" and "-"`);
|
|
139
|
+
else if (job === null || typeof job !== "object" || Array.isArray(job) || Object.keys(job).length === 0)
|
|
140
|
+
problems.push(`${where}.${name} must be a job: a map of its keys, in the forge's own syntax`);
|
|
141
|
+
}
|
|
142
|
+
return problems;
|
|
143
|
+
}
|
|
144
|
+
/** The map of jobs a YAML file holds. Throws {@link OwnJobsError} when it is missing, not YAML, or not a map of jobs. */
|
|
145
|
+
export function readOwnJobsFile(path, where = path) {
|
|
146
|
+
let text;
|
|
147
|
+
try {
|
|
148
|
+
text = readFileSync(path, "utf-8");
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
throw new OwnJobsError(`${where}: no such file`);
|
|
152
|
+
}
|
|
153
|
+
let doc;
|
|
154
|
+
try {
|
|
155
|
+
doc = parseYAMLDocument(text);
|
|
156
|
+
}
|
|
157
|
+
catch (e) {
|
|
158
|
+
throw new OwnJobsError(`${where} is not YAML (${e.message})`);
|
|
159
|
+
}
|
|
160
|
+
const problems = ownJobsProblems(doc, where);
|
|
161
|
+
if (problems.length > 0)
|
|
162
|
+
throw new OwnJobsError(problems.join("; "));
|
|
163
|
+
return doc;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* The YAML of `own`, as it goes after chant's jobs: {@link OWN_JOBS_LINE} (or
|
|
167
|
+
* `line`), then each job as it is. Empty for no jobs. Throws
|
|
168
|
+
* {@link OwnJobsError} on a name in `ours` or, on GitLab, a reserved one.
|
|
169
|
+
*/
|
|
170
|
+
export function ownJobsYAML(own, ours, forge, options = {}) {
|
|
171
|
+
if (!own || Object.keys(own).length === 0)
|
|
172
|
+
return "";
|
|
173
|
+
const where = options.where ?? "own jobs";
|
|
174
|
+
const problems = ownJobsProblems(own, where);
|
|
175
|
+
if (problems.length > 0)
|
|
176
|
+
throw new OwnJobsError(problems.join("; "));
|
|
177
|
+
for (const name of Object.keys(own)) {
|
|
178
|
+
if (ours.includes(name))
|
|
179
|
+
throw new OwnJobsError(`${where}.${name}: chant's file has a job of that name; give yours another`);
|
|
180
|
+
if (forge === "gitlab" && GITLAB_RESERVED_JOB_NAMES.includes(name))
|
|
181
|
+
throw new OwnJobsError(`${where}.${name}: GitLab reads ${name} as a keyword, not a job; give yours another name`);
|
|
182
|
+
}
|
|
183
|
+
const indent = forge === "gitlab" ? 0 : 1;
|
|
184
|
+
return [`${forge === "gitlab" ? "" : " "}${options.line ?? OWN_JOBS_LINE}`, ...Object.entries(own).map(([name, job]) => emitYAMLEntry(name, job, indent))].join("\n") + "\n";
|
|
185
|
+
}
|
|
186
|
+
/** `generated` with `own` after chant's jobs (terragucci's `own_jobs` model). Unchanged for no jobs. */
|
|
187
|
+
export function mergeOwnJobs(generated, forge, own, options = {}) {
|
|
188
|
+
if (!own || Object.keys(own).length === 0)
|
|
189
|
+
return generated;
|
|
190
|
+
const ours = options.generatedJobs ?? jobNames(generated, forge);
|
|
191
|
+
const rendered = ownJobsYAML(own, ours, forge, options).replace(/\n$/, "");
|
|
192
|
+
const [line, ...rest] = rendered.split("\n");
|
|
193
|
+
// The rendered text starts with the indented line; withBlocks adds the indent itself.
|
|
194
|
+
return withBlocks(generated, [rest.join("\n")], forge, line.trimStart());
|
|
195
|
+
}
|
|
196
|
+
/** The bins whose lines mark a job as generated: `chant`, and each of `bins` with its last word (`npx --no-install plywood` and `plywood`). */
|
|
197
|
+
function generatedLine(bins) {
|
|
198
|
+
const names = new Set(["chant"]);
|
|
199
|
+
for (const bin of bins) {
|
|
200
|
+
const b = bin.trim();
|
|
201
|
+
if (b === "")
|
|
202
|
+
continue;
|
|
203
|
+
names.add(b);
|
|
204
|
+
names.add(b.split(/\s+/).pop().split("/").pop());
|
|
205
|
+
}
|
|
206
|
+
const alt = [...names].sort((a, b) => b.length - a.length).map(escapeRegExp).join("|");
|
|
207
|
+
return new RegExp(`(^|[\\s"'(]|\\$\\()(?:${alt}) (?=[a-z])`, "m");
|
|
208
|
+
}
|
|
209
|
+
/** Whether a job's block runs `chant` or one of `bins`: a job chant's generator wrote. */
|
|
210
|
+
export function isGeneratedJob(block, bins = []) {
|
|
211
|
+
return generatedLine(bins).test(block);
|
|
212
|
+
}
|
|
213
|
+
/** The jobs of `previous` that `generated` lacks and that run neither `chant` nor a bin of `bins`. */
|
|
214
|
+
export function ownJobsOf(previous, generated, forge, bins = []) {
|
|
215
|
+
const ours = jobBlocks(generated, forge);
|
|
216
|
+
const out = new Map();
|
|
217
|
+
for (const [name, block] of jobBlocks(previous, forge)) {
|
|
218
|
+
if (ours.has(name) || isGeneratedJob(block, bins))
|
|
219
|
+
continue;
|
|
220
|
+
out.set(name, block);
|
|
221
|
+
}
|
|
222
|
+
return out;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* The old file's own jobs carried into the new one (plywood's model):
|
|
226
|
+
* `previous` undefined means there was no file. `kept` names them.
|
|
227
|
+
*/
|
|
228
|
+
export function keepOwnJobs(previous, generated, forge, options = {}) {
|
|
229
|
+
if (previous === undefined)
|
|
230
|
+
return { text: generated, kept: [] };
|
|
231
|
+
const own = ownJobsOf(previous, generated, forge, options.bins ?? []);
|
|
232
|
+
return { text: withBlocks(generated, [...own.values()], forge, options.line ?? OWN_JOBS_LINE), kept: [...own.keys()] };
|
|
233
|
+
}
|
|
@@ -19,9 +19,10 @@
|
|
|
19
19
|
* command's lifetime. Every renderer here reads {@link activeProductWords}
|
|
20
20
|
* when it is given none.
|
|
21
21
|
*
|
|
22
|
-
* This module imports nothing
|
|
23
|
-
* pr-loop-bundle.test.ts) carries it.
|
|
22
|
+
* This module imports nothing at run time (the one import is a type): the
|
|
23
|
+
* pull request loop bundle (pr-loop.ts, pr-loop-bundle.test.ts) carries it.
|
|
24
24
|
*/
|
|
25
|
+
import type { NotifyMessageWords } from "./notify.js";
|
|
25
26
|
/** The stages a product names: the status context after the prefix, and the word in the note. */
|
|
26
27
|
export type CiProductStage = "plan" | "apply" | "record" | "check" | "drift" | "lock" | "approval" | "control";
|
|
27
28
|
/** Every stage slot, in the order {@link assertProductWords} reports them. */
|
|
@@ -132,12 +133,15 @@ export interface CiProductNotifyWordsInput {
|
|
|
132
133
|
wave?: string;
|
|
133
134
|
/** The signed webhook's header prefix. Default `x-<product>`, so chant's stays `x-chant`. */
|
|
134
135
|
headers?: string;
|
|
136
|
+
/** The labels, re-run button and other words of chant's Slack and Teams messages (#4818). Default: chant's. */
|
|
137
|
+
message?: NotifyMessageWords;
|
|
135
138
|
}
|
|
136
139
|
/** The notify slots, filled. */
|
|
137
140
|
export interface CiProductNotifyWords {
|
|
138
141
|
source: string;
|
|
139
142
|
wave: string;
|
|
140
143
|
headers: string;
|
|
144
|
+
message?: NotifyMessageWords;
|
|
141
145
|
}
|
|
142
146
|
/** chant's own wave label in a notify summary. */
|
|
143
147
|
export declare const CHANT_NOTIFY_WAVE_TEMPLATE = "wave {k} ({name}) of {spec}";
|
|
@@ -295,10 +299,17 @@ export type ParsedProductComment =
|
|
|
295
299
|
| {
|
|
296
300
|
kind: "commit";
|
|
297
301
|
word: string;
|
|
302
|
+
arg?: string;
|
|
298
303
|
} | {
|
|
299
304
|
kind: "refused";
|
|
300
305
|
reason: string;
|
|
301
306
|
};
|
|
307
|
+
/**
|
|
308
|
+
* The one argument a commit word may take after it (#4820), on top of the
|
|
309
|
+
* product's own pattern: a plain name, no leading dash, no path or shell
|
|
310
|
+
* syntax, at most 100 characters.
|
|
311
|
+
*/
|
|
312
|
+
export declare const COMMIT_COMMENT_ARG: RegExp;
|
|
302
313
|
/** The longest ask an agent comment may carry. */
|
|
303
314
|
export declare const PRODUCT_COMMENT_ASK_MAX = 2000;
|
|
304
315
|
/**
|
|
@@ -309,9 +320,12 @@ export declare const PRODUCT_COMMENT_ASK_MAX = 2000;
|
|
|
309
320
|
* comment is untrusted input: only a member path checked against a pattern
|
|
310
321
|
* with no shell syntax, and a wave number, leave this function.
|
|
311
322
|
*
|
|
312
|
-
* `env` turns on an alias whose `when` variable is `1` there.
|
|
323
|
+
* `env` turns on an alias whose `when` variable is `1` there. `commitArgs`
|
|
324
|
+
* names the commit words that take one argument after them (#4820), each
|
|
325
|
+
* with the pattern it must match; it must also match
|
|
326
|
+
* {@link COMMIT_COMMENT_ARG}. Any other commit word takes nothing.
|
|
313
327
|
*/
|
|
314
|
-
export declare function parseProductComment(words: CiProductWords, body: unknown, env?: Record<string, string | undefined
|
|
328
|
+
export declare function parseProductComment(words: CiProductWords, body: unknown, env?: Record<string, string | undefined>, commitArgs?: Readonly<Record<string, RegExp>>): ParsedProductComment | undefined;
|
|
315
329
|
/**
|
|
316
330
|
* The variables the generated action job (#4654) hands the product's action
|
|
317
331
|
* verb: the comment that started it, on a comment, and the dispatch's two
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-product-words.d.ts","sourceRoot":"","sources":["../src/ci-product-words.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GA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AM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,GAAG,UAAU,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3J;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,oBAAoB,CAiBzH"}
|
package/dist/ci-product-words.js
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
* command's lifetime. Every renderer here reads {@link activeProductWords}
|
|
20
20
|
* when it is given none.
|
|
21
21
|
*
|
|
22
|
-
* This module imports nothing
|
|
23
|
-
* pr-loop-bundle.test.ts) carries it.
|
|
22
|
+
* This module imports nothing at run time (the one import is a type): the
|
|
23
|
+
* pull request loop bundle (pr-loop.ts, pr-loop-bundle.test.ts) carries it.
|
|
24
24
|
*/
|
|
25
25
|
/** Every stage slot, in the order {@link assertProductWords} reports them. */
|
|
26
26
|
export const CI_PRODUCT_STAGES = ["plan", "apply", "record", "check", "drift", "lock", "approval", "control"];
|
|
@@ -74,6 +74,7 @@ export function resolveProductWords(input = {}) {
|
|
|
74
74
|
source: input.notify?.source ?? product,
|
|
75
75
|
wave: input.notify?.wave ?? CHANT_NOTIFY_WAVE_TEMPLATE,
|
|
76
76
|
headers: input.notify?.headers ?? `x-${product}`,
|
|
77
|
+
...(input.notify?.message ? { message: input.notify.message } : {}),
|
|
77
78
|
},
|
|
78
79
|
};
|
|
79
80
|
}
|
|
@@ -286,6 +287,12 @@ const TARGET = /^[A-Za-z0-9_][A-Za-z0-9_.:\/\[\]"*@=+$,-]{0,499}$/;
|
|
|
286
287
|
* No leading dash, no spaces, no shell or glob syntax.
|
|
287
288
|
*/
|
|
288
289
|
const ACTION = /^[A-Za-z_][A-Za-z0-9_.\[\]"-]{0,299}$/;
|
|
290
|
+
/**
|
|
291
|
+
* The one argument a commit word may take after it (#4820), on top of the
|
|
292
|
+
* product's own pattern: a plain name, no leading dash, no path or shell
|
|
293
|
+
* syntax, at most 100 characters.
|
|
294
|
+
*/
|
|
295
|
+
export const COMMIT_COMMENT_ARG = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,99}$/;
|
|
289
296
|
/** The longest ask an agent comment may carry. */
|
|
290
297
|
export const PRODUCT_COMMENT_ASK_MAX = 2000;
|
|
291
298
|
/** Commands a comment never runs, named in the reply so nobody waits on them. */
|
|
@@ -298,9 +305,12 @@ const NEVER = new Set(["approve", "override", "force-unlock", "unlock-state", "i
|
|
|
298
305
|
* comment is untrusted input: only a member path checked against a pattern
|
|
299
306
|
* with no shell syntax, and a wave number, leave this function.
|
|
300
307
|
*
|
|
301
|
-
* `env` turns on an alias whose `when` variable is `1` there.
|
|
308
|
+
* `env` turns on an alias whose `when` variable is `1` there. `commitArgs`
|
|
309
|
+
* names the commit words that take one argument after them (#4820), each
|
|
310
|
+
* with the pattern it must match; it must also match
|
|
311
|
+
* {@link COMMIT_COMMENT_ARG}. Any other commit word takes nothing.
|
|
302
312
|
*/
|
|
303
|
-
export function parseProductComment(words, body, env = {}) {
|
|
313
|
+
export function parseProductComment(words, body, env = {}, commitArgs = {}) {
|
|
304
314
|
if (typeof body !== "string")
|
|
305
315
|
return undefined;
|
|
306
316
|
let text = body.trim();
|
|
@@ -356,8 +366,18 @@ export function parseProductComment(words, body, env = {}) {
|
|
|
356
366
|
case "lock":
|
|
357
367
|
case "unlock":
|
|
358
368
|
return parts.length === 2 ? { kind: command } : { kind: "refused", reason: `${line} takes nothing after it` };
|
|
359
|
-
case "commit":
|
|
360
|
-
|
|
369
|
+
case "commit": {
|
|
370
|
+
if (parts.length === 2)
|
|
371
|
+
return { kind: "commit", word: typed };
|
|
372
|
+
const pattern = Object.prototype.hasOwnProperty.call(commitArgs, typed) ? commitArgs[typed] : undefined;
|
|
373
|
+
if (pattern === undefined)
|
|
374
|
+
return { kind: "refused", reason: `${line} takes nothing after it` };
|
|
375
|
+
const arg = parts[2];
|
|
376
|
+
if (parts.length !== 3 || !COMMIT_COMMENT_ARG.test(arg) || !pattern.test(arg)) {
|
|
377
|
+
return { kind: "refused", reason: `${line} takes nothing, or one name after it matching \`${pattern.source}\`` };
|
|
378
|
+
}
|
|
379
|
+
return { kind: "commit", word: typed, arg };
|
|
380
|
+
}
|
|
361
381
|
case "agent": {
|
|
362
382
|
const ask = text.slice(`${prefix} ${typed}`.length).trim();
|
|
363
383
|
if (ask === "")
|
package/dist/ci-product.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ import type { ProductWaveHook } from "./op/op-waves-after-plan.js";
|
|
|
19
19
|
*/
|
|
20
20
|
export declare const CI_PRODUCT_FLOOR = "0.124.55";
|
|
21
21
|
export { activeProductWords, approveLine, assertProductWords, CHANT_APPROVE_TEMPLATE, CHANT_NOTIFY_WAVE_TEMPLATE, CHANT_OVERRIDE_TEMPLATE, CHANT_WORDS, CI_PRODUCT_APPLY_MODES, CI_PRODUCT_COMMANDS, CI_PRODUCT_STAGES, CiProductWordsError, commandWord, commentLine, isChantWords, notifyWaveLabel, overrideLine, parseProductComment, productActionFromEnv, PRODUCT_ACTION_ENV, PRODUCT_ACTION_EVENT_FLAG, productContext, productStatusContext, productWaveGate, productWordsProblems, resolveProductWords, setActiveProductWords, withProductWords, type ApproveLineInput, type CiProductAlias, type CiProductApplyMode, type CiProductApproval, type CiProductCommand, type CiProductNotifyWords, type CiProductNotifyWordsInput, type CiProductStage, type CiProductWords, type CiProductWordsInput, type OverrideLineInput, type ParsedProductComment, type ProductActionRequest, } from "./ci-product-words.js";
|
|
22
|
-
export { driftNotifyFields, productNotifySource, productNotifyWords, productSendOptions, type DriftNotifyInput } from "./notify-product.js";
|
|
22
|
+
export { driftNotifyFields, NOTIFY_MESSAGE_WORDS_FLOOR, productNotifySource, productNotifyWords, productSendOptions, type DriftNotifyInput } from "./notify-product.js";
|
|
23
23
|
/** The first chant with `chant notify relay` and the notify relay buttons (#4611). */
|
|
24
24
|
export declare const NOTIFY_RELAY_FLOOR = "0.124.55";
|
|
25
25
|
/**
|
|
@@ -79,6 +79,36 @@ export declare const CI_RESPOND_FLOOR = "0.124.56";
|
|
|
79
79
|
* its pull request jobs with the build feature-detects on this floor.
|
|
80
80
|
*/
|
|
81
81
|
export declare const PR_LOOP_BUILD_FLAGS_FLOOR = "0.124.56";
|
|
82
|
+
/**
|
|
83
|
+
* A repository's own jobs in the generated pipeline file (#4769):
|
|
84
|
+
* `mergeOwnJobs` adds a map of jobs (or `readOwnJobsFile`'s) after chant's
|
|
85
|
+
* and refuses a name chant's file has or a GitLab keyword; `keepOwnJobs`
|
|
86
|
+
* carries over the old file's jobs that run neither `chant` nor the
|
|
87
|
+
* product's bin. `chant build --components --generate <forge> --own-jobs
|
|
88
|
+
* <file>` and `--keep-own-jobs` do the same on the build line. A product
|
|
89
|
+
* feature-detects on `OWN_JOBS_FLOOR`.
|
|
90
|
+
*/
|
|
91
|
+
export { GITLAB_RESERVED_JOB_NAMES, GITLAB_TOP_KEYWORDS, isGeneratedJob, jobBlocks, jobNames, keepOwnJobs, mergeOwnJobs, OWN_JOB_NAME, OWN_JOBS_FLOOR, OWN_JOBS_FORGES, OWN_JOBS_LINE, OwnJobsError, ownJobsOf, ownJobsProblems, ownJobsYAML, readOwnJobsFile, type KeepOwnJobsOptions, type MergeOwnJobsOptions, type OwnJobsForge, } from "./ci-own-jobs.js";
|
|
92
|
+
/**
|
|
93
|
+
* The Forgejo generators write a workflow-level run group a product asks for
|
|
94
|
+
* (#4771): `runGroup: "pull-request"` on the components pipeline (`chant
|
|
95
|
+
* build --components --generate forgejo --run-group pull-request`) and
|
|
96
|
+
* `runGroup: "commit"` on an op waves spec (its `options`, or `chant run
|
|
97
|
+
* --generate forgejo --spec <file> --run-group commit`). A workflow with a
|
|
98
|
+
* group of its own keeps it, and GitHub and GitLab files are unchanged. A
|
|
99
|
+
* product feature-detects on this floor.
|
|
100
|
+
*/
|
|
101
|
+
export declare const FORGEJO_RUN_GROUP_FLOOR = "0.124.77";
|
|
102
|
+
export { RUN_GROUP_KEYS, type RunGroupKey } from "./lexicon.js";
|
|
103
|
+
/**
|
|
104
|
+
* `chant build --pr-loop` takes the control repo (#4772): `--control <repo>`
|
|
105
|
+
* and `--control-setting <key>=<value>` (op, member, readTokenSecret, and
|
|
106
|
+
* the rest of the control settings) are the pull request loop's `control`,
|
|
107
|
+
* so the note job the build writes reads the control repo's records itself,
|
|
108
|
+
* the step `productPipelineJobs(...).post.control` returns. A product that
|
|
109
|
+
* writes its pipeline with the build feature-detects on this floor.
|
|
110
|
+
*/
|
|
111
|
+
export declare const PR_LOOP_CONTROL_FLOOR = "0.124.77";
|
|
82
112
|
export { CI_RESPOND_DEFAULTS, CI_RESPOND_ENV, CI_RESPONSES, parseRespondList, renderRefusedDiff, renderTriage, respondList, resolveResponses, type CiRespondEvent, type CiResponses, type DescriptionFinding, type FailedApply, type RefusedDiff, } from "./ci-respond.js";
|
|
83
113
|
export { respondDescription, respondOpWave, respondPrApply, triageOfOpWave, triageOfPrReport, refusedOfOpWave, refusedOfPrReport } from "./ci-respond-run.js";
|
|
84
114
|
/**
|
|
@@ -98,6 +128,15 @@ export declare function runChantInProcess(argv: string[], words: CiProductWordsI
|
|
|
98
128
|
* `CI_AGENT_FLOOR`.
|
|
99
129
|
*/
|
|
100
130
|
export { CI_AGENT_FLOOR, agentForbiddenPaths, type AgentSettings, type OpAgentSpec } from "./ci-agent.js";
|
|
131
|
+
/**
|
|
132
|
+
* The agent guard (#4770): a Claude Code PreToolUse hook on Bash and a
|
|
133
|
+
* wrapper per engine binary that refuse an agent's apply, approve or
|
|
134
|
+
* override. A product passes its words (its name, the refusal) and rules
|
|
135
|
+
* (engines, their refused subcommands and flags, its own refused commands)
|
|
136
|
+
* to `installAgentGuard`, and `agentGuard` checks a command line in process
|
|
137
|
+
* with the same rule. Feature-detect on `AGENT_GUARD_FLOOR`.
|
|
138
|
+
*/
|
|
139
|
+
export { AGENT_GUARD_FLOOR, agentGuard, agentGuardScript, agentGuardWrapper, CLAUDE_SETTINGS_LOCAL, CLAUDE_SETTINGS_SHARED, installAgentGuard, withAgentGuardHook, type AgentGuard, type AgentGuardEngine, type AgentGuardInstall, type AgentGuardInstallOptions, type AgentGuardRules, type AgentGuardSpec, type AgentGuardVerdict, type AgentGuardWords, } from "./agent-guard.js";
|
|
101
140
|
/**
|
|
102
141
|
* After-plan hooks in a wave job's process (#4614): `runChantInProcess(["run",
|
|
103
142
|
* "wave", ...], words, { wave: { afterPlan, capabilities } })`, or
|
package/dist/ci-product.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-product.d.ts","sourceRoot":"","sources":["../src/ci-product.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGhE;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAE3C,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,WAAW,EACX,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,yBAAyB,EACzB,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,iBAAi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E,eAAe,EAAE,qBAAqB,EAAE,KAAK,iBAAiB,EAAE,KAAK,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AACtK,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAE1F;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,aAAsB,CAAC;AAC1D,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEjF;;;;;;;;;;GAUG;AACH,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAChG,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EACL,UAAU,EACV,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,YAAY,GAClB,MAAM,QAAQ,CAAC"}
|
package/dist/ci-product.js
CHANGED
|
@@ -17,7 +17,7 @@ import { OTLP_EXPORTER_FLOOR } from "./otlp.js";
|
|
|
17
17
|
*/
|
|
18
18
|
export const CI_PRODUCT_FLOOR = "0.124.55";
|
|
19
19
|
export { activeProductWords, approveLine, assertProductWords, CHANT_APPROVE_TEMPLATE, CHANT_NOTIFY_WAVE_TEMPLATE, CHANT_OVERRIDE_TEMPLATE, CHANT_WORDS, CI_PRODUCT_APPLY_MODES, CI_PRODUCT_COMMANDS, CI_PRODUCT_STAGES, CiProductWordsError, commandWord, commentLine, isChantWords, notifyWaveLabel, overrideLine, parseProductComment, productActionFromEnv, PRODUCT_ACTION_ENV, PRODUCT_ACTION_EVENT_FLAG, productContext, productStatusContext, productWaveGate, productWordsProblems, resolveProductWords, setActiveProductWords, withProductWords, } from "./ci-product-words.js";
|
|
20
|
-
export { driftNotifyFields, productNotifySource, productNotifyWords, productSendOptions } from "./notify-product.js";
|
|
20
|
+
export { driftNotifyFields, NOTIFY_MESSAGE_WORDS_FLOOR, productNotifySource, productNotifyWords, productSendOptions } from "./notify-product.js";
|
|
21
21
|
/** The first chant with `chant notify relay` and the notify relay buttons (#4611). */
|
|
22
22
|
export const NOTIFY_RELAY_FLOOR = "0.124.55";
|
|
23
23
|
/**
|
|
@@ -77,6 +77,36 @@ export const CI_RESPOND_FLOOR = "0.124.56";
|
|
|
77
77
|
* its pull request jobs with the build feature-detects on this floor.
|
|
78
78
|
*/
|
|
79
79
|
export const PR_LOOP_BUILD_FLAGS_FLOOR = "0.124.56";
|
|
80
|
+
/**
|
|
81
|
+
* A repository's own jobs in the generated pipeline file (#4769):
|
|
82
|
+
* `mergeOwnJobs` adds a map of jobs (or `readOwnJobsFile`'s) after chant's
|
|
83
|
+
* and refuses a name chant's file has or a GitLab keyword; `keepOwnJobs`
|
|
84
|
+
* carries over the old file's jobs that run neither `chant` nor the
|
|
85
|
+
* product's bin. `chant build --components --generate <forge> --own-jobs
|
|
86
|
+
* <file>` and `--keep-own-jobs` do the same on the build line. A product
|
|
87
|
+
* feature-detects on `OWN_JOBS_FLOOR`.
|
|
88
|
+
*/
|
|
89
|
+
export { GITLAB_RESERVED_JOB_NAMES, GITLAB_TOP_KEYWORDS, isGeneratedJob, jobBlocks, jobNames, keepOwnJobs, mergeOwnJobs, OWN_JOB_NAME, OWN_JOBS_FLOOR, OWN_JOBS_FORGES, OWN_JOBS_LINE, OwnJobsError, ownJobsOf, ownJobsProblems, ownJobsYAML, readOwnJobsFile, } from "./ci-own-jobs.js";
|
|
90
|
+
/**
|
|
91
|
+
* The Forgejo generators write a workflow-level run group a product asks for
|
|
92
|
+
* (#4771): `runGroup: "pull-request"` on the components pipeline (`chant
|
|
93
|
+
* build --components --generate forgejo --run-group pull-request`) and
|
|
94
|
+
* `runGroup: "commit"` on an op waves spec (its `options`, or `chant run
|
|
95
|
+
* --generate forgejo --spec <file> --run-group commit`). A workflow with a
|
|
96
|
+
* group of its own keeps it, and GitHub and GitLab files are unchanged. A
|
|
97
|
+
* product feature-detects on this floor.
|
|
98
|
+
*/
|
|
99
|
+
export const FORGEJO_RUN_GROUP_FLOOR = "0.124.77";
|
|
100
|
+
export { RUN_GROUP_KEYS } from "./lexicon.js";
|
|
101
|
+
/**
|
|
102
|
+
* `chant build --pr-loop` takes the control repo (#4772): `--control <repo>`
|
|
103
|
+
* and `--control-setting <key>=<value>` (op, member, readTokenSecret, and
|
|
104
|
+
* the rest of the control settings) are the pull request loop's `control`,
|
|
105
|
+
* so the note job the build writes reads the control repo's records itself,
|
|
106
|
+
* the step `productPipelineJobs(...).post.control` returns. A product that
|
|
107
|
+
* writes its pipeline with the build feature-detects on this floor.
|
|
108
|
+
*/
|
|
109
|
+
export const PR_LOOP_CONTROL_FLOOR = "0.124.77";
|
|
80
110
|
export { CI_RESPOND_DEFAULTS, CI_RESPOND_ENV, CI_RESPONSES, parseRespondList, renderRefusedDiff, renderTriage, respondList, resolveResponses, } from "./ci-respond.js";
|
|
81
111
|
export { respondDescription, respondOpWave, respondPrApply, triageOfOpWave, triageOfPrReport, refusedOfOpWave, refusedOfPrReport } from "./ci-respond-run.js";
|
|
82
112
|
/**
|
|
@@ -96,6 +126,15 @@ export async function runChantInProcess(argv, words, options = {}) {
|
|
|
96
126
|
* `CI_AGENT_FLOOR`.
|
|
97
127
|
*/
|
|
98
128
|
export { CI_AGENT_FLOOR, agentForbiddenPaths } from "./ci-agent.js";
|
|
129
|
+
/**
|
|
130
|
+
* The agent guard (#4770): a Claude Code PreToolUse hook on Bash and a
|
|
131
|
+
* wrapper per engine binary that refuse an agent's apply, approve or
|
|
132
|
+
* override. A product passes its words (its name, the refusal) and rules
|
|
133
|
+
* (engines, their refused subcommands and flags, its own refused commands)
|
|
134
|
+
* to `installAgentGuard`, and `agentGuard` checks a command line in process
|
|
135
|
+
* with the same rule. Feature-detect on `AGENT_GUARD_FLOOR`.
|
|
136
|
+
*/
|
|
137
|
+
export { AGENT_GUARD_FLOOR, agentGuard, agentGuardScript, agentGuardWrapper, CLAUDE_SETTINGS_LOCAL, CLAUDE_SETTINGS_SHARED, installAgentGuard, withAgentGuardHook, } from "./agent-guard.js";
|
|
99
138
|
/**
|
|
100
139
|
* After-plan hooks in a wave job's process (#4614): `runChantInProcess(["run",
|
|
101
140
|
* "wave", ...], words, { wave: { afterPlan, capabilities } })`, or
|
|
@@ -79,7 +79,11 @@ export interface GateApprovalOptions {
|
|
|
79
79
|
* `--statement` and `--signature`.
|
|
80
80
|
*/
|
|
81
81
|
binding?: string;
|
|
82
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* The repository the approval is for: its ops, its workspace and key file,
|
|
84
|
+
* and its `chant/lifecycle`, which is read, appended to and pushed (#4760).
|
|
85
|
+
* Defaults to the process's directory.
|
|
86
|
+
*/
|
|
83
87
|
cwd?: string;
|
|
84
88
|
/** Replaces the lexicon evaluator a gate policy is loaded from. For tests. */
|
|
85
89
|
evaluator?: GatePolicyEvaluator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approve.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/approve.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3F,OAAO,EACuE,KAAK,UAAU,EAC5F,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAEuC,KAAK,mBAAmB,EAAE,KAAK,oBAAoB,EAChG,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAiE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAO3H,OAAO,EAA4D,KAAK,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAM9H,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"approve.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/approve.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3F,OAAO,EACuE,KAAK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