@intentius/sql-yodeler 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chant/gated-request.d.ts +31 -1
- package/dist/chant/gated-request.js +57 -1
- package/dist/chant/gated-request.js.map +1 -1
- package/dist/chant-floor-version.d.ts +1 -1
- package/dist/chant-floor-version.js +1 -1
- package/dist/chant-floor.d.ts +14 -12
- package/dist/chant-floor.js +33 -19
- package/dist/chant-floor.js.map +1 -1
- package/dist/ci/login.d.ts +22 -47
- package/dist/ci/login.js +35 -82
- package/dist/ci/login.js.map +1 -1
- package/dist/ci/render.d.ts +42 -73
- package/dist/ci/render.js +69 -133
- package/dist/ci/render.js.map +1 -1
- package/dist/ci-words.d.ts +3 -3
- package/dist/ci-words.js +3 -3
- package/dist/commands/apply.d.ts +6 -0
- package/dist/commands/apply.js +34 -12
- package/dist/commands/apply.js.map +1 -1
- package/dist/commands/mcp.js +15 -20
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/plan.js +52 -8
- package/dist/commands/plan.js.map +1 -1
- package/dist/commands/revert.js +5 -1
- package/dist/commands/revert.js.map +1 -1
- package/dist/config/define.d.ts +1 -1
- package/dist/config/settings.d.ts +23 -3
- package/dist/config/settings.js +32 -9
- package/dist/config/settings.js.map +1 -1
- package/dist/exit.d.ts +5 -2
- package/dist/exit.js +9 -4
- package/dist/exit.js.map +1 -1
- package/dist/mcp/chant-hook.d.ts +7 -5
- package/dist/mcp/chant-hook.js +19 -22
- package/dist/mcp/chant-hook.js.map +1 -1
- package/dist/pr/note.d.ts +26 -23
- package/dist/pr/note.js +59 -49
- package/dist/pr/note.js.map +1 -1
- package/dist/pr/part.d.ts +11 -0
- package/dist/pr/part.js +35 -1
- package/dist/pr/part.js.map +1 -1
- package/dist/pr/render.d.ts +0 -4
- package/dist/pr/render.js +5 -62
- package/dist/pr/render.js.map +1 -1
- package/dist/pr/tenants.d.ts +7 -0
- package/dist/pr/tenants.js +25 -0
- package/dist/pr/tenants.js.map +1 -1
- package/dist/versioned/engine.d.ts +1 -1
- package/package.json +8 -7
- package/dist/mcp/server.d.ts +0 -40
- package/dist/mcp/server.js +0 -106
- package/dist/mcp/server.js.map +0 -1
- package/dist/versioned/stand-down.d.ts +0 -44
- package/dist/versioned/stand-down.js +0 -84
- package/dist/versioned/stand-down.js.map +0 -1
|
@@ -7,10 +7,14 @@
|
|
|
7
7
|
* | topology | `environments.<env>.topology` | `sql.profiles.<env>.topology` | `YODEL_TOPOLOGY` | `single` |
|
|
8
8
|
* | history database | `environments.<env>.history.database` | | `YODEL_HISTORY_DATABASE`| `yodeler`|
|
|
9
9
|
* | lock TTL | `environments.<env>.lockTtl` (seconds) | | `YODEL_LOCK_TTL` | 900 |
|
|
10
|
-
* | lock wait | `environments.<env>.lockWait` (seconds)| |
|
|
10
|
+
* | lock wait | `environments.<env>.lockWait` (seconds)| | | 0 |
|
|
11
11
|
* | access | `environments.<env>.access` | `sql.profiles.<env>.access` | | off |
|
|
12
12
|
*
|
|
13
|
-
* `yodel apply --lock-wait <duration>` sets the lock wait over
|
|
13
|
+
* `yodel apply --lock-wait <duration>` sets the lock wait over the config.
|
|
14
|
+
* `YODEL_LOCK_WAIT` is no longer a setting (#303): it carries `--lock-wait`
|
|
15
|
+
* from `yodel apply` and `yodel revert` to their Op's Apply step only
|
|
16
|
+
* ({@link LOCK_WAIT_ENV}), and anywhere else it is refused by name
|
|
17
|
+
* ({@link retiredVariableRefusal}).
|
|
14
18
|
*
|
|
15
19
|
* A tenant (`<env>/<tenant>`, #56) has its environment's settings, its
|
|
16
20
|
* history database suffixed with `_<tenant>`.
|
|
@@ -34,8 +38,24 @@ export interface EnvironmentSettings {
|
|
|
34
38
|
/** How long an apply waits for a lock another apply holds; 0 gives up at once (exit 5). */
|
|
35
39
|
lockWaitMs: number;
|
|
36
40
|
}
|
|
37
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* The hand-off of `--lock-wait` to the Op's Apply step (`yodel apply
|
|
43
|
+
* --execute`), a duration as {@link parseDuration} reads it. Only that step
|
|
44
|
+
* reads it.
|
|
45
|
+
*/
|
|
38
46
|
export declare const LOCK_WAIT_ENV = "YODEL_LOCK_WAIT";
|
|
47
|
+
/** The hand-off of `--stand-down` to the Op's Apply step. Only that step reads it. */
|
|
48
|
+
export declare const STAND_DOWN_ENV = "YODEL_STAND_DOWN";
|
|
49
|
+
/**
|
|
50
|
+
* The refusal of a variable a pipeline rendered by yodel 0.10 sets on its
|
|
51
|
+
* apply jobs (`YODEL_LOCK_WAIT: '10m'`, `YODEL_STAND_DOWN: '1'`), which
|
|
52
|
+
* yodel no longer reads (#303): chant's waves hold a lease on the
|
|
53
|
+
* environment (exit 5) and stand down for a newer commit (exit 6) once the
|
|
54
|
+
* pipelines are upgraded. Named, so such a pipeline stops with the way
|
|
55
|
+
* forward instead of applying without what it asked for. Undefined when
|
|
56
|
+
* neither is set.
|
|
57
|
+
*/
|
|
58
|
+
export declare function retiredVariableRefusal(env: NodeJS.ProcessEnv, command: string): YodelError | undefined;
|
|
39
59
|
/**
|
|
40
60
|
* A duration in milliseconds: `90` (seconds), `500ms`, `30s`, `10m`, `1h`,
|
|
41
61
|
* or a sum of them (`1m30s`). `what` names it in the error.
|
package/dist/config/settings.js
CHANGED
|
@@ -7,10 +7,14 @@
|
|
|
7
7
|
* | topology | `environments.<env>.topology` | `sql.profiles.<env>.topology` | `YODEL_TOPOLOGY` | `single` |
|
|
8
8
|
* | history database | `environments.<env>.history.database` | | `YODEL_HISTORY_DATABASE`| `yodeler`|
|
|
9
9
|
* | lock TTL | `environments.<env>.lockTtl` (seconds) | | `YODEL_LOCK_TTL` | 900 |
|
|
10
|
-
* | lock wait | `environments.<env>.lockWait` (seconds)| |
|
|
10
|
+
* | lock wait | `environments.<env>.lockWait` (seconds)| | | 0 |
|
|
11
11
|
* | access | `environments.<env>.access` | `sql.profiles.<env>.access` | | off |
|
|
12
12
|
*
|
|
13
|
-
* `yodel apply --lock-wait <duration>` sets the lock wait over
|
|
13
|
+
* `yodel apply --lock-wait <duration>` sets the lock wait over the config.
|
|
14
|
+
* `YODEL_LOCK_WAIT` is no longer a setting (#303): it carries `--lock-wait`
|
|
15
|
+
* from `yodel apply` and `yodel revert` to their Op's Apply step only
|
|
16
|
+
* ({@link LOCK_WAIT_ENV}), and anywhere else it is refused by name
|
|
17
|
+
* ({@link retiredVariableRefusal}).
|
|
14
18
|
*
|
|
15
19
|
* A tenant (`<env>/<tenant>`, #56) has its environment's settings, its
|
|
16
20
|
* history database suffixed with `_<tenant>`.
|
|
@@ -18,11 +22,34 @@
|
|
|
18
22
|
import { toTopology, topologyLabel } from "@intentius/chant-lexicon-sql/clickhouse/topology";
|
|
19
23
|
import { DEFAULT_HISTORY_DATABASE } from "../history/ddl.js";
|
|
20
24
|
import { DEFAULT_LOCK_TTL_MS } from "../history/lock.js";
|
|
21
|
-
import { YodelError } from "../project.js";
|
|
25
|
+
import { YodelError, yodelRefusal } from "../project.js";
|
|
22
26
|
import { CONFIG_FILE } from "./load.js";
|
|
23
27
|
import { splitTarget } from "../tenants/target.js";
|
|
24
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* The hand-off of `--lock-wait` to the Op's Apply step (`yodel apply
|
|
30
|
+
* --execute`), a duration as {@link parseDuration} reads it. Only that step
|
|
31
|
+
* reads it.
|
|
32
|
+
*/
|
|
25
33
|
export const LOCK_WAIT_ENV = "YODEL_LOCK_WAIT";
|
|
34
|
+
/** The hand-off of `--stand-down` to the Op's Apply step. Only that step reads it. */
|
|
35
|
+
export const STAND_DOWN_ENV = "YODEL_STAND_DOWN";
|
|
36
|
+
/**
|
|
37
|
+
* The refusal of a variable a pipeline rendered by yodel 0.10 sets on its
|
|
38
|
+
* apply jobs (`YODEL_LOCK_WAIT: '10m'`, `YODEL_STAND_DOWN: '1'`), which
|
|
39
|
+
* yodel no longer reads (#303): chant's waves hold a lease on the
|
|
40
|
+
* environment (exit 5) and stand down for a newer commit (exit 6) once the
|
|
41
|
+
* pipelines are upgraded. Named, so such a pipeline stops with the way
|
|
42
|
+
* forward instead of applying without what it asked for. Undefined when
|
|
43
|
+
* neither is set.
|
|
44
|
+
*/
|
|
45
|
+
export function retiredVariableRefusal(env, command) {
|
|
46
|
+
const set = [LOCK_WAIT_ENV, STAND_DOWN_ENV].filter((k) => env[k] !== undefined && env[k] !== "");
|
|
47
|
+
if (set.length === 0)
|
|
48
|
+
return undefined;
|
|
49
|
+
return yodelRefusal(`refused: ${set.join(" and ")} ${set.length > 1 ? "are" : "is"} set, as a pipeline rendered by yodel 0.10 sets ${set.length > 1 ? "them" : "it"} on its apply jobs, and ${command} no longer reads ${set.length > 1 ? "them" : "it"}; nothing ran. ` +
|
|
50
|
+
"Run npx yodel upgrade and commit what it writes: the upgraded wave jobs have chant hold a lease on the environment (exit 5 when it is held) and stand down for a newer commit (exit 6). " +
|
|
51
|
+
"At a terminal, pass --lock-wait <duration> (or set environments.<env>.lockWait in yodel.config.ts) and --stand-down instead.");
|
|
52
|
+
}
|
|
26
53
|
const UNITS = { ms: 1, s: 1000, m: 60_000, h: 3_600_000 };
|
|
27
54
|
/**
|
|
28
55
|
* A duration in milliseconds: `90` (seconds), `500ms`, `30s`, `10m`, `1h`,
|
|
@@ -83,11 +110,7 @@ export function environmentSettings(project, target, env = process.env) {
|
|
|
83
110
|
throw new YodelError(`YODEL_LOCK_TTL must be a number of seconds, got ${JSON.stringify(env.YODEL_LOCK_TTL)}`);
|
|
84
111
|
lockTtlMs = ttl * 1000;
|
|
85
112
|
}
|
|
86
|
-
|
|
87
|
-
if (own?.lockWait !== undefined)
|
|
88
|
-
lockWaitMs = own.lockWait * 1000;
|
|
89
|
-
else if (env[LOCK_WAIT_ENV])
|
|
90
|
-
lockWaitMs = parseDuration(env[LOCK_WAIT_ENV], LOCK_WAIT_ENV);
|
|
113
|
+
const lockWaitMs = own?.lockWait !== undefined ? own.lockWait * 1000 : 0;
|
|
91
114
|
return {
|
|
92
115
|
topology,
|
|
93
116
|
topologySource,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/config/settings.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/config/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAiB,MAAM,kDAAkD,CAAC;AAC5G,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAgB,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAmBnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAiB,CAAC;AAE/C,sFAAsF;AACtF,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAEjD;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAsB,EAAE,OAAe;IAC5E,MAAM,GAAG,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IACjG,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACvC,OAAO,YAAY,CACjB,YAAY,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,mDAAmD,GAAG,CAAC,MAAM,GAAG,CAAC,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IAAwI;AACxI,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAuF,EAAE,IAAY,EAA0B,EAAE,CAClK,CAAC,OAAO,CAAC,OAAO,KAAK,YAAY,CAAC,CAAC,CAAC,0BAA0B,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,wBAAwB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAExI,MAAM,MAAM,GAAG,CAAC,CAAW,EAAuB,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/exit.d.ts
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* test/exit-codes.test.ts keeps them in agreement.
|
|
7
7
|
*
|
|
8
8
|
* The table is chant's `CHANT_EXIT`, read from `@intentius/chant/exit-codes`
|
|
9
|
-
* by {@link useChantExitTable} when the installed chant has it. A chant
|
|
9
|
+
* by {@link useChantExitTable} when the installed chant has it. Code 9 (`misplaced`, chant#4624) is read the same way. A chant
|
|
10
10
|
* released before that subpath has no table to read, so yodel keeps
|
|
11
11
|
* {@link FALLBACK_EXIT}, the same numbers.
|
|
12
12
|
*/
|
|
13
|
-
/** chant's table, as chant#4553 set it: the fallback for a chant that does not export it. */
|
|
13
|
+
/** chant's table, as chant#4553 set it and chant#4624 extended it with 9: the fallback for a chant that does not export it. */
|
|
14
14
|
export declare const FALLBACK_EXIT: {
|
|
15
15
|
readonly done: 0;
|
|
16
16
|
readonly failed: 1;
|
|
@@ -21,6 +21,7 @@ export declare const FALLBACK_EXIT: {
|
|
|
21
21
|
readonly superseded: 6;
|
|
22
22
|
readonly denied: 7;
|
|
23
23
|
readonly declined: 8;
|
|
24
|
+
readonly misplaced: 9;
|
|
24
25
|
};
|
|
25
26
|
/** A name in chant's table. */
|
|
26
27
|
export type ExitName = keyof typeof FALLBACK_EXIT;
|
|
@@ -42,6 +43,8 @@ export declare let EXIT_SUPERSEDED: number;
|
|
|
42
43
|
export declare let EXIT_DENIED: number;
|
|
43
44
|
/** An answer at a confirmation that does not approve. */
|
|
44
45
|
export declare let EXIT_DECLINED: number;
|
|
46
|
+
/** A job guard refused: the job runs where it is not set to run (`chant ci check-job`). yodel itself does not return it: the guard in a generated job exits 9 before yodel starts. */
|
|
47
|
+
export declare let EXIT_MISPLACED: number;
|
|
45
48
|
/** Each code yodel returns and what it means, one line each. */
|
|
46
49
|
export declare let EXIT_CODES: ReadonlyArray<readonly [number, string]>;
|
|
47
50
|
/**
|
package/dist/exit.js
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* test/exit-codes.test.ts keeps them in agreement.
|
|
7
7
|
*
|
|
8
8
|
* The table is chant's `CHANT_EXIT`, read from `@intentius/chant/exit-codes`
|
|
9
|
-
* by {@link useChantExitTable} when the installed chant has it. A chant
|
|
9
|
+
* by {@link useChantExitTable} when the installed chant has it. Code 9 (`misplaced`, chant#4624) is read the same way. A chant
|
|
10
10
|
* released before that subpath has no table to read, so yodel keeps
|
|
11
11
|
* {@link FALLBACK_EXIT}, the same numbers.
|
|
12
12
|
*/
|
|
13
|
-
/** chant's table, as chant#4553 set it: the fallback for a chant that does not export it. */
|
|
13
|
+
/** chant's table, as chant#4553 set it and chant#4624 extended it with 9: the fallback for a chant that does not export it. */
|
|
14
14
|
export const FALLBACK_EXIT = {
|
|
15
15
|
done: 0,
|
|
16
16
|
failed: 1,
|
|
@@ -21,7 +21,10 @@ export const FALLBACK_EXIT = {
|
|
|
21
21
|
superseded: 6,
|
|
22
22
|
denied: 7,
|
|
23
23
|
declined: 8,
|
|
24
|
+
misplaced: 9,
|
|
24
25
|
};
|
|
26
|
+
/** The names a chant table must carry for yodel to read it. */
|
|
27
|
+
const REQUIRED = ["done", "failed", "drift", "waiting", "moved", "held", "superseded", "denied", "declined", "misplaced"];
|
|
25
28
|
/* The codes are live bindings: each starts at the fallback's number, and useChantExitTable() sets them from chant's table. */
|
|
26
29
|
/** Done, or nothing to do. */
|
|
27
30
|
export let EXIT_OK = FALLBACK_EXIT.done;
|
|
@@ -41,6 +44,8 @@ export let EXIT_SUPERSEDED = FALLBACK_EXIT.superseded;
|
|
|
41
44
|
export let EXIT_DENIED = FALLBACK_EXIT.denied;
|
|
42
45
|
/** An answer at a confirmation that does not approve. */
|
|
43
46
|
export let EXIT_DECLINED = FALLBACK_EXIT.declined;
|
|
47
|
+
/** A job guard refused: the job runs where it is not set to run (`chant ci check-job`). yodel itself does not return it: the guard in a generated job exits 9 before yodel starts. */
|
|
48
|
+
export let EXIT_MISPLACED = FALLBACK_EXIT.misplaced;
|
|
44
49
|
/** Each code yodel returns and what it means, one line each. */
|
|
45
50
|
export let EXIT_CODES = exitCodes();
|
|
46
51
|
function exitCodes() {
|
|
@@ -73,8 +78,7 @@ export function useChantExitTable() {
|
|
|
73
78
|
catch {
|
|
74
79
|
return "fallback";
|
|
75
80
|
}
|
|
76
|
-
|
|
77
|
-
if (!table || !names.every((name) => typeof table[name] === "number"))
|
|
81
|
+
if (!table || !REQUIRED.every((name) => typeof table[name] === "number"))
|
|
78
82
|
return "fallback";
|
|
79
83
|
const code = (name) => table[name];
|
|
80
84
|
EXIT_OK = code("done");
|
|
@@ -86,6 +90,7 @@ export function useChantExitTable() {
|
|
|
86
90
|
EXIT_SUPERSEDED = code("superseded");
|
|
87
91
|
EXIT_DENIED = code("denied");
|
|
88
92
|
EXIT_DECLINED = code("declined");
|
|
93
|
+
EXIT_MISPLACED = code("misplaced");
|
|
89
94
|
EXIT_CODES = exitCodes();
|
|
90
95
|
return "chant";
|
|
91
96
|
})();
|
package/dist/exit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit.js","sourceRoot":"","sources":["../src/exit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;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CAAC,CAAC;QAC7B,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3B,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/B,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3B,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QACzB,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;QACrC,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,aAAa,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;QACjC,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;QACnC,UAAU,GAAG,SAAS,EAAE,CAAC;QACzB,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC,EAAE,CAAC;IACL,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,sFAAsF;AACtF,MAAM,CAAC,MAAM,iBAAiB,GAC5B,4NAA4N,CAAC"}
|
package/dist/mcp/chant-hook.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type YodelTool } from "./tools.js";
|
|
2
|
+
/** What the server tells an agent it serves, and what is a person's to do. */
|
|
3
|
+
export declare const INSTRUCTIONS: string;
|
|
2
4
|
/** chant's `McpToolContribution`, the parts yodel fills. */
|
|
3
5
|
export interface ChantMcpTool {
|
|
4
6
|
name: string;
|
|
@@ -28,13 +30,13 @@ export interface ChantHooks {
|
|
|
28
30
|
}) => unknown;
|
|
29
31
|
PRODUCT_MCP_HOOK_FLOOR: string;
|
|
30
32
|
}
|
|
31
|
-
/** chant's product tool hook and OTLP exporter, once,
|
|
32
|
-
export declare function chantHooks(): Promise<ChantHooks
|
|
33
|
+
/** chant's product tool hook and OTLP exporter (chant#4555), once; refused, naming the install line, on a chant without them. */
|
|
34
|
+
export declare function chantHooks(): Promise<ChantHooks>;
|
|
33
35
|
/** One of yodel's tools as chant's contribution: the same handler, read-only. */
|
|
34
36
|
export declare function asChantTool(t: YodelTool): ChantMcpTool;
|
|
35
37
|
/** yodel's tools for chant's server, checked read-only before chant sees them. */
|
|
36
38
|
export declare function yodelMcpHook(dir: string, tools?: readonly YodelTool[]): YodelMcpHook;
|
|
37
|
-
/** Serve yodel's tools on chant's read-only server, from `dir`.
|
|
38
|
-
export declare function serveOnChant(dir: string, chant?: ChantHooks): Promise<number
|
|
39
|
-
/** Configure chant's OTLP exporter with yodel's prefix, once, when an endpoint is set
|
|
39
|
+
/** Serve yodel's tools on chant's read-only server, from `dir`. */
|
|
40
|
+
export declare function serveOnChant(dir: string, chant?: ChantHooks): Promise<number>;
|
|
41
|
+
/** Configure chant's OTLP exporter with yodel's prefix, once, when an endpoint is set. */
|
|
40
42
|
export declare function useChantTraces(env?: NodeJS.ProcessEnv): Promise<boolean>;
|
package/dist/mcp/chant-hook.js
CHANGED
|
@@ -2,40 +2,41 @@
|
|
|
2
2
|
* yodel's MCP tools on chant's server, and its traces through chant's OTLP
|
|
3
3
|
* exporter (#297, chant#4555, chant#4543).
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* `yodel mcp` runs `chant serve mcp --read-only` in this process through
|
|
6
|
+
* `runChantInProcess` with
|
|
7
7
|
* yodel's words and {@link yodelMcpHook}: chant serves its own read-only
|
|
8
8
|
* tools over the ledger and graph, and yodel's tools beside them as
|
|
9
9
|
* `yodel:status`, `yodel:plan`, `yodel:lint`, `yodel:drift`,
|
|
10
10
|
* `yodel:history` and `yodel:explain`. Each declares `readOnly: true`; chant
|
|
11
11
|
* refuses to start a read-only server with a product tool named as a write,
|
|
12
|
-
* and yodel's own {@link assertReadOnly} refuses the list first
|
|
13
|
-
*
|
|
14
|
-
* before.
|
|
12
|
+
* and yodel's own {@link assertReadOnly} refuses the list first. yodel's
|
|
13
|
+
* own stdio server, for a chant without the hook, left in 0.12 (#303).
|
|
15
14
|
*
|
|
16
15
|
* Traces: with `OTEL_EXPORTER_OTLP_ENDPOINT` set, {@link useChantTraces}
|
|
17
16
|
* configures chant's exporter with the `yodel` prefix once, so a wave job
|
|
18
17
|
* that `yodel chant run wave` runs sends its trace with `yodel.*`
|
|
19
18
|
* attributes. Without the exporter nothing is sent, as before.
|
|
20
19
|
*
|
|
21
|
-
* Both are imported lazily, with the
|
|
22
|
-
*
|
|
20
|
+
* Both are imported lazily, with the specifier in a variable, so a yodel
|
|
21
|
+
* command that serves nothing does not load chant's server.
|
|
23
22
|
*/
|
|
24
23
|
import { YODEL_WORDS } from "../ci-words.js";
|
|
24
|
+
import { CHANT_CI_FLOOR, installLine } from "../chant-floor-version.js";
|
|
25
|
+
import { YodelError } from "../project.js";
|
|
25
26
|
import { assertReadOnly, yodelTools } from "./tools.js";
|
|
26
|
-
|
|
27
|
+
/** What the server tells an agent it serves, and what is a person's to do. */
|
|
28
|
+
export const INSTRUCTIONS = "Read-only tools over a SQL Yodeler project: status, plan, lint, drift, history and explain. Each result is an envelope whose results follow the JSON Schema named in resultsSchema. " +
|
|
29
|
+
"Nothing here applies, approves, overrides a policy rule, repairs, rebases or writes a migration. A plan carries the commands that are a person's (approve, override) in forPerson: show them to the person, and never run them. " +
|
|
30
|
+
"Never run `yodel apply` against a shared environment, never run `chant approve`, `yodel approve` or `yodel override`, never edit the `chant/lifecycle` branch or `.chant/allowed_signers`, never merge; approvals and applies belong to people.";
|
|
27
31
|
let hooks;
|
|
28
|
-
/** chant's product tool hook and OTLP exporter, once,
|
|
32
|
+
/** chant's product tool hook and OTLP exporter (chant#4555), once; refused, naming the install line, on a chant without them. */
|
|
29
33
|
export function chantHooks() {
|
|
30
34
|
hooks ??= (async () => {
|
|
31
35
|
const specifier = "@intentius/chant/ci-product";
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
36
|
+
const m = (await import(specifier).catch(() => ({})));
|
|
37
|
+
if (typeof m.runChantInProcess === "function" && typeof m.configureOtlp === "function" && typeof m.PRODUCT_MCP_HOOK_FLOOR === "string")
|
|
38
|
+
return m;
|
|
39
|
+
throw new YodelError(`the installed chant has no product tool hook (chant serve mcp with yodel's tools), which yodel mcp serves on from chant ${CHANT_CI_FLOOR}. Install it:\n ${installLine()}`);
|
|
39
40
|
})();
|
|
40
41
|
return hooks;
|
|
41
42
|
}
|
|
@@ -49,25 +50,21 @@ export function yodelMcpHook(dir, tools = yodelTools(dir)) {
|
|
|
49
50
|
assertReadOnly(tools);
|
|
50
51
|
return { product: YODEL_WORDS.product, tools: () => tools.map(asChantTool), readOnly: true, instructions: INSTRUCTIONS };
|
|
51
52
|
}
|
|
52
|
-
/** Serve yodel's tools on chant's read-only server, from `dir`.
|
|
53
|
+
/** Serve yodel's tools on chant's read-only server, from `dir`. */
|
|
53
54
|
export async function serveOnChant(dir, chant) {
|
|
54
55
|
const c = chant ?? (await chantHooks());
|
|
55
|
-
if (!c)
|
|
56
|
-
return undefined;
|
|
57
56
|
const hook = yodelMcpHook(dir);
|
|
58
57
|
process.chdir(dir);
|
|
59
58
|
return c.runChantInProcess(["serve", "mcp", "--read-only"], YODEL_WORDS, { mcp: hook });
|
|
60
59
|
}
|
|
61
60
|
let traced = false;
|
|
62
|
-
/** Configure chant's OTLP exporter with yodel's prefix, once, when an endpoint is set
|
|
61
|
+
/** Configure chant's OTLP exporter with yodel's prefix, once, when an endpoint is set. */
|
|
63
62
|
export async function useChantTraces(env = process.env) {
|
|
64
63
|
if (traced)
|
|
65
64
|
return true;
|
|
66
65
|
if (!env.OTEL_EXPORTER_OTLP_ENDPOINT && !env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT)
|
|
67
66
|
return false;
|
|
68
67
|
const c = await chantHooks();
|
|
69
|
-
if (!c)
|
|
70
|
-
return false;
|
|
71
68
|
c.configureOtlp({ prefix: YODEL_WORDS.product });
|
|
72
69
|
traced = true;
|
|
73
70
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chant-hook.js","sourceRoot":"","sources":["../../src/mcp/chant-hook.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"chant-hook.js","sourceRoot":"","sources":["../../src/mcp/chant-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAkB,MAAM,YAAY,CAAC;AAExE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,YAAY,GACvB,sLAAsL;IACtL,kOAAkO;IAClO,iPAAiP,CAAC;AA0BpP,IAAI,KAAsC,CAAC;AAE3C,iIAAiI;AACjI,MAAM,UAAU,UAAU;IACxB,KAAK,KAAK,CAAC,KAAK,IAAI,EAAE;QACpB,MAAM,SAAS,GAAG,6BAA6B,CAAC;QAChD,MAAM,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAwB,CAAC;QAC7E,IAAI,OAAO,CAAC,CAAC,iBAAiB,KAAK,UAAU,IAAI,OAAO,CAAC,CAAC,aAAa,KAAK,UAAU,IAAI,OAAO,CAAC,CAAC,sBAAsB,KAAK,QAAQ;YAAE,OAAO,CAAe,CAAC;QAC/J,MAAM,IAAI,UAAU,CAAC,2HAA2H,cAAc,oBAAoB,WAAW,EAAE,EAAE,CAAC,CAAC;IACrM,CAAC,CAAC,EAAE,CAAC;IACL,OAAO,KAAK,CAAC;AACf,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,WAAW,CAAC,CAAY;IACtC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,WAAW,CAAC;IACrD,OA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AC,GAAG,CAAC,kCAAkC;QAAE,OAAO,KAAK,CAAC;IAC9F,MAAM,CAAC,GAAG,MAAM,UAAU,EAAE,CAAC;IAC7B,CAAC,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IACjD,MAAM,GAAG,IAAI,CAAC;IACd,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/pr/note.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The plan note through chant's note renderer (#290, chant#4550):
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* product's note reads the same.
|
|
2
|
+
* The plan note through chant's note renderer (#290, chant#4550): `yodel
|
|
3
|
+
* plan <env> --comment` and `--format markdown` give chant's `renderPrNote`
|
|
4
|
+
* in yodel's words (../ci-words.ts), so every product's note reads the
|
|
5
|
+
* same.
|
|
7
6
|
*
|
|
8
7
|
* chant gives the heading, the environment table with its counts, the
|
|
9
8
|
* digest, the approval line and the change-set summary. The SQL rows chant's
|
|
@@ -19,14 +18,13 @@
|
|
|
19
18
|
* and an open pull request keeps one note. The digest's subject stays at the
|
|
20
19
|
* end, hidden, as before.
|
|
21
20
|
*
|
|
22
|
-
* chant's note
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* yodel posts its own note (./render.ts), as it does on a published chant.
|
|
21
|
+
* chant's note names the environment in its approve line (`{target}`) and,
|
|
22
|
+
* under per-wave words, says the waves apply on merge (chant#4601). yodel's
|
|
23
|
+
* own layout, and the probe that chose between the two, left in 0.12 (#303).
|
|
26
24
|
*/
|
|
27
25
|
import { type ChantProduct } from "../ci-words.js";
|
|
28
26
|
import type { VersionedPlan } from "./model.js";
|
|
29
|
-
import type
|
|
27
|
+
import { type TenantSetPlan } from "./tenants.js";
|
|
30
28
|
/** What the note needs of chant beyond yodel's words: the renderer and the change-set composer. */
|
|
31
29
|
export interface ChantNote {
|
|
32
30
|
product: ChantProduct;
|
|
@@ -44,27 +42,32 @@ export interface ChantNote {
|
|
|
44
42
|
};
|
|
45
43
|
};
|
|
46
44
|
}
|
|
45
|
+
/** chant's note renderer and change-set composer, once; refused, naming the install line, on a chant without them. */
|
|
46
|
+
export declare function chantNote(): Promise<ChantNote>;
|
|
47
47
|
/**
|
|
48
|
-
* chant's
|
|
49
|
-
*
|
|
50
|
-
*
|
|
48
|
+
* Whether chant's note can carry a tenant set (#56): its approve line names
|
|
49
|
+
* the set once, not each tenant. The set's gate is the wave's, approved once
|
|
50
|
+
* with `yodel approve <set>` for the set digest; `yodel approve <set>/<tenant>`
|
|
51
|
+
* approves that tenant as an environment of its own and does not open the
|
|
52
|
+
* wave. chant 0.124.67 prints a line per member (prApproveTargets in
|
|
53
|
+
* pr-loop.ts), so the set keeps yodel's own note until chant reads the
|
|
54
|
+
* report's approveTargets.
|
|
51
55
|
*/
|
|
52
|
-
export declare function
|
|
53
|
-
/**
|
|
54
|
-
* chant's renderer, once, when the installed chant has one whose note fits
|
|
55
|
-
* yodel: its approve line names the environment, and it does not tell a
|
|
56
|
-
* per-wave product that a release deploys the merge. Undefined otherwise.
|
|
57
|
-
*/
|
|
58
|
-
export declare function chantNote(): Promise<ChantNote | undefined>;
|
|
56
|
+
export declare function tenantSetNoteFits(note: ChantNote): boolean;
|
|
59
57
|
/** The SQL rows of one environment's plan: the member detail section (chant#4573). */
|
|
60
58
|
export declare function planDetailLines(plan: VersionedPlan, withSql: boolean): string[];
|
|
61
|
-
/** One environment's note through chant
|
|
59
|
+
/** One environment's note through chant. */
|
|
62
60
|
export declare function renderPlanNote(plan: VersionedPlan, options: {
|
|
63
61
|
dir: string;
|
|
64
62
|
base?: string;
|
|
65
63
|
note?: ChantNote;
|
|
66
|
-
}): Promise<string
|
|
67
|
-
/**
|
|
64
|
+
}): Promise<string>;
|
|
65
|
+
/**
|
|
66
|
+
* A tenant set's note through chant (#56): a member per tenant, the set's
|
|
67
|
+
* own section (every tenant by name, the wave's one approval of the set
|
|
68
|
+
* digest), a detail section per tenant. Undefined, so yodel posts its own
|
|
69
|
+
* note, while chant's would ask for an approval per tenant.
|
|
70
|
+
*/
|
|
68
71
|
export declare function renderTenantSetNote(plan: TenantSetPlan, options: {
|
|
69
72
|
dir: string;
|
|
70
73
|
base?: string;
|
package/dist/pr/note.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The plan note through chant's note renderer (#290, chant#4550):
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* product's note reads the same.
|
|
2
|
+
* The plan note through chant's note renderer (#290, chant#4550): `yodel
|
|
3
|
+
* plan <env> --comment` and `--format markdown` give chant's `renderPrNote`
|
|
4
|
+
* in yodel's words (../ci-words.ts), so every product's note reads the
|
|
5
|
+
* same.
|
|
7
6
|
*
|
|
8
7
|
* chant gives the heading, the environment table with its counts, the
|
|
9
8
|
* digest, the approval line and the change-set summary. The SQL rows chant's
|
|
@@ -19,59 +18,63 @@
|
|
|
19
18
|
* and an open pull request keeps one note. The digest's subject stays at the
|
|
20
19
|
* end, hidden, as before.
|
|
21
20
|
*
|
|
22
|
-
* chant's note
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* yodel posts its own note (./render.ts), as it does on a published chant.
|
|
21
|
+
* chant's note names the environment in its approve line (`{target}`) and,
|
|
22
|
+
* under per-wave words, says the waves apply on merge (chant#4601). yodel's
|
|
23
|
+
* own layout, and the probe that chose between the two, left in 0.12 (#303).
|
|
26
24
|
*/
|
|
27
25
|
import { execFileSync } from "node:child_process";
|
|
28
26
|
import { chantProduct, YODEL_WORDS } from "../ci-words.js";
|
|
27
|
+
import { CHANT_CI_FLOOR, installLine } from "../chant-floor-version.js";
|
|
28
|
+
import { YodelError } from "../project.js";
|
|
29
29
|
import { describeMove, encodeSubject } from "../versioned/explain.js";
|
|
30
30
|
import { describeWave } from "../waves/index.js";
|
|
31
31
|
import { WAVES_PIPELINE } from "../waves/record.js";
|
|
32
32
|
import { cell, commentMarker, COMMENT_LIMIT, fence, pendingMarkdown, policyMarkdown, ranOn } from "./render.js";
|
|
33
33
|
import { planPart } from "./part.js";
|
|
34
|
+
import { tenantSetDetailLines } from "./tenants.js";
|
|
34
35
|
let loaded;
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return undefined;
|
|
49
|
-
return { product, words: product.assertProductWords(YODEL_WORDS), renderPrNote: m.renderPrNote, composeChangeSet: cs.composeChangeSet };
|
|
36
|
+
/** chant's note renderer and change-set composer, once; refused, naming the install line, on a chant without them. */
|
|
37
|
+
export function chantNote() {
|
|
38
|
+
loaded ??= (async () => {
|
|
39
|
+
const product = await chantProduct();
|
|
40
|
+
const specifier = "@intentius/chant/ci-product";
|
|
41
|
+
const m = (await import(specifier).catch(() => ({})));
|
|
42
|
+
const cs = (await import("@intentius/chant/change-set").catch(() => ({})));
|
|
43
|
+
if (!product || typeof m.renderPrNote !== "function" || typeof cs.composeChangeSet !== "function") {
|
|
44
|
+
throw new YodelError(`the installed chant has no pull request note renderer (renderPrNote), which yodel plan's note is rendered with from chant ${CHANT_CI_FLOOR}. Install it:\n ${installLine()}`);
|
|
45
|
+
}
|
|
46
|
+
return { product, words: product.assertProductWords(YODEL_WORDS), renderPrNote: m.renderPrNote, composeChangeSet: cs.composeChangeSet };
|
|
47
|
+
})();
|
|
48
|
+
return loaded;
|
|
50
49
|
}
|
|
50
|
+
const tenantSetFit = new WeakMap();
|
|
51
51
|
/** The probe's environment and digest, which a note that names the target prints in its approve line. */
|
|
52
52
|
const PROBE_ENV = "yodel-probe-env";
|
|
53
53
|
const PROBE_DIGEST = "jcs1-sha256:probe";
|
|
54
54
|
/**
|
|
55
|
-
* chant's
|
|
56
|
-
*
|
|
57
|
-
*
|
|
55
|
+
* Whether chant's note can carry a tenant set (#56): its approve line names
|
|
56
|
+
* the set once, not each tenant. The set's gate is the wave's, approved once
|
|
57
|
+
* with `yodel approve <set>` for the set digest; `yodel approve <set>/<tenant>`
|
|
58
|
+
* approves that tenant as an environment of its own and does not open the
|
|
59
|
+
* wave. chant 0.124.67 prints a line per member (prApproveTargets in
|
|
60
|
+
* pr-loop.ts), so the set keeps yodel's own note until chant reads the
|
|
61
|
+
* report's approveTargets.
|
|
58
62
|
*/
|
|
59
|
-
export function
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return loaded;
|
|
63
|
+
export function tenantSetNoteFits(note) {
|
|
64
|
+
const known = tenantSetFit.get(note);
|
|
65
|
+
if (known !== undefined)
|
|
66
|
+
return known;
|
|
67
|
+
let fits;
|
|
68
|
+
try {
|
|
69
|
+
const members = ["a", "b"].map((t) => ({ environment: `${PROBE_ENV}/${t}`, digest: PROBE_DIGEST, pending: 1, refused: false }));
|
|
70
|
+
const probe = note.renderPrNote(report(note, members, { env: PROBE_ENV, op: WAVES_PIPELINE, gate: `${WAVES_PIPELINE}-wave-1`, digest: PROBE_DIGEST, head: "0".repeat(40), base: "0".repeat(40), approval: { status: "pending" }, details: [], approveTargets: [PROBE_ENV] }), { words: note.words });
|
|
71
|
+
fits = probe.includes(`yodel approve ${PROBE_ENV} --plan ${PROBE_DIGEST}`) && !probe.includes(`yodel approve ${PROBE_ENV}/`);
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
fits = false;
|
|
75
|
+
}
|
|
76
|
+
tenantSetFit.set(note, fits);
|
|
77
|
+
return fits;
|
|
75
78
|
}
|
|
76
79
|
/** chant's pull request report for the note: one member per environment (or tenant), at the plan stage. */
|
|
77
80
|
function report(note, members, frame) {
|
|
@@ -164,11 +167,9 @@ function gateOf(plan) {
|
|
|
164
167
|
function framed(env, body, subject) {
|
|
165
168
|
return `${commentMarker(env)}\n${body.replace(/\n*$/, "\n")}${subject ? `\n<!-- yodel:subject ${subject} -->\n` : ""}`;
|
|
166
169
|
}
|
|
167
|
-
/** One environment's note through chant
|
|
170
|
+
/** One environment's note through chant. */
|
|
168
171
|
export async function renderPlanNote(plan, options) {
|
|
169
172
|
const note = options.note ?? (await chantNote());
|
|
170
|
-
if (!note)
|
|
171
|
-
return undefined;
|
|
172
173
|
const { op, gate, digest } = gateOf(plan);
|
|
173
174
|
const subject = plan.subject ? encodeSubject(plan.subject) : undefined;
|
|
174
175
|
const render = (withSql) => framed(plan.environment, note.renderPrNote(report(note, [{ environment: plan.environment, digest: plan.digest, pending: plan.pending.length, refused: plan.refusal !== undefined, part: planPart(plan, plan.environment) }], {
|
|
@@ -184,10 +185,15 @@ export async function renderPlanNote(plan, options) {
|
|
|
184
185
|
const body = render(true);
|
|
185
186
|
return body.length > COMMENT_LIMIT ? render(false) : body;
|
|
186
187
|
}
|
|
187
|
-
/**
|
|
188
|
+
/**
|
|
189
|
+
* A tenant set's note through chant (#56): a member per tenant, the set's
|
|
190
|
+
* own section (every tenant by name, the wave's one approval of the set
|
|
191
|
+
* digest), a detail section per tenant. Undefined, so yodel posts its own
|
|
192
|
+
* note, while chant's would ask for an approval per tenant.
|
|
193
|
+
*/
|
|
188
194
|
export async function renderTenantSetNote(plan, options) {
|
|
189
195
|
const note = options.note ?? (await chantNote());
|
|
190
|
-
if (!note)
|
|
196
|
+
if (!tenantSetNoteFits(note))
|
|
191
197
|
return undefined;
|
|
192
198
|
const members = plan.tenants.map((t) => ({ environment: t.environment, digest: t.digest, pending: t.pending.length, refused: t.refusal !== undefined, part: planPart(t, t.environment) }));
|
|
193
199
|
const wave = plan.wave;
|
|
@@ -198,7 +204,11 @@ export async function renderTenantSetNote(plan, options) {
|
|
|
198
204
|
digest: wave?.digest ?? "",
|
|
199
205
|
...commits(options.dir, options.base),
|
|
200
206
|
approval: { status: "pending" },
|
|
201
|
-
|
|
207
|
+
approveTargets: [plan.environment],
|
|
208
|
+
details: [
|
|
209
|
+
{ member: plan.environment, title: `The tenant set \`${plan.environment}\``, lines: tenantSetDetailLines(plan) },
|
|
210
|
+
...plan.tenants.map((t) => ({ member: t.environment, lines: planDetailLines(t, withSql) })),
|
|
211
|
+
],
|
|
202
212
|
}), { words: note.words, limit: COMMENT_LIMIT }), undefined);
|
|
203
213
|
const body = render(true);
|
|
204
214
|
return body.length > COMMENT_LIMIT ? render(false) : body;
|