@intentius/sql-yodeler 0.13.1 → 0.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/bin.js +2 -2
  2. package/dist/bin.js.map +1 -1
  3. package/dist/chant/apply.js +3 -1
  4. package/dist/chant/apply.js.map +1 -1
  5. package/dist/chant/build.js +3 -1
  6. package/dist/chant/build.js.map +1 -1
  7. package/dist/chant/confirm.d.ts +20 -20
  8. package/dist/chant/confirm.js +14 -27
  9. package/dist/chant/confirm.js.map +1 -1
  10. package/dist/chant/drift.d.ts +13 -49
  11. package/dist/chant/drift.js +25 -138
  12. package/dist/chant/drift.js.map +1 -1
  13. package/dist/chant/sql-types.d.ts +4 -5
  14. package/dist/chant/sql-types.js +9 -10
  15. package/dist/chant/sql-types.js.map +1 -1
  16. package/dist/ci/render.d.ts +61 -18
  17. package/dist/ci/render.js +212 -132
  18. package/dist/ci/render.js.map +1 -1
  19. package/dist/ci-words.d.ts +10 -0
  20. package/dist/ci-words.js +10 -0
  21. package/dist/ci-words.js.map +1 -1
  22. package/dist/commands/approve.d.ts +1 -1
  23. package/dist/commands/approve.js +6 -7
  24. package/dist/commands/approve.js.map +1 -1
  25. package/dist/commands/chant.d.ts +1 -1
  26. package/dist/commands/chant.js +2 -2
  27. package/dist/commands/chant.js.map +1 -1
  28. package/dist/commands/ci.js +32 -19
  29. package/dist/commands/ci.js.map +1 -1
  30. package/dist/commands/create.d.ts +2 -2
  31. package/dist/commands/create.js +2 -2
  32. package/dist/commands/create.js.map +1 -1
  33. package/dist/commands/drift.d.ts +1 -1
  34. package/dist/commands/drift.js +6 -42
  35. package/dist/commands/drift.js.map +1 -1
  36. package/dist/commands/emulator.d.ts +2 -2
  37. package/dist/commands/emulator.js +2 -2
  38. package/dist/commands/emulator.js.map +1 -1
  39. package/dist/commands/override.js +2 -2
  40. package/dist/commands/override.js.map +1 -1
  41. package/dist/commands/plan.js +79 -80
  42. package/dist/commands/plan.js.map +1 -1
  43. package/dist/config/define.d.ts +29 -0
  44. package/dist/config/define.js.map +1 -1
  45. package/dist/config/load.js +20 -3
  46. package/dist/config/load.js.map +1 -1
  47. package/dist/declarative/plan.d.ts +2 -2
  48. package/dist/declarative/plan.js +2 -2
  49. package/dist/mcp/tools.js +2 -2
  50. package/dist/mcp/tools.js.map +1 -1
  51. package/dist/notify/index.d.ts +4 -0
  52. package/dist/notify/index.js +3 -1
  53. package/dist/notify/index.js.map +1 -1
  54. package/dist/pr/forge.d.ts +1 -1
  55. package/dist/pr/forge.js +1 -1
  56. package/dist/pr/issue.d.ts +10 -5
  57. package/dist/pr/issue.js +26 -13
  58. package/dist/pr/issue.js.map +1 -1
  59. package/dist/pr/model.d.ts +1 -5
  60. package/dist/pr/model.js +2 -7
  61. package/dist/pr/model.js.map +1 -1
  62. package/dist/pr/note.d.ts +25 -9
  63. package/dist/pr/note.js +56 -21
  64. package/dist/pr/note.js.map +1 -1
  65. package/dist/pr/render.d.ts +4 -6
  66. package/dist/pr/render.js +4 -10
  67. package/dist/pr/render.js.map +1 -1
  68. package/dist/versioned/explain.d.ts +1 -9
  69. package/dist/versioned/explain.js +1 -20
  70. package/dist/versioned/explain.js.map +1 -1
  71. package/dist/versioned/op.js +3 -1
  72. package/dist/versioned/op.js.map +1 -1
  73. package/package.json +7 -7
  74. package/schemas/drift.schema.json +9 -5
  75. package/schemas/plan.schema.json +1 -1
  76. package/dist/chant/process.d.ts +0 -34
  77. package/dist/chant/process.js +0 -74
  78. package/dist/chant/process.js.map +0 -1
  79. package/dist/chant/resolve-fallback.d.ts +0 -35
  80. package/dist/chant/resolve-fallback.js +0 -89
  81. package/dist/chant/resolve-fallback.js.map +0 -1
  82. package/dist/pr/overdue.d.ts +0 -41
  83. package/dist/pr/overdue.js +0 -46
  84. package/dist/pr/overdue.js.map +0 -1
@@ -1,74 +0,0 @@
1
- /**
2
- * Running the `chant` CLI that yodel depends on, for the commands that have
3
- * no library surface (`build`, `run`, `lifecycle diff`).
4
- *
5
- * The chant it runs is the one in yodel's own dependencies, not whatever
6
- * `chant` is first on PATH: chant's `bundledChant`, spawned with
7
- * `chantArgv` and `chantEnv` from `@intentius/chant/chant-install` (chant
8
- * issue 4800), which put that chant's bin first on the child's PATH, because
9
- * chant's Op activities shell out to `chant` themselves (`lifecycleDiff`
10
- * runs `chant lifecycle diff`).
11
- *
12
- * A child runs in chant's own words, not yodel's (#287): ../chant/apply.ts
13
- * reads chant's `approve: chant approve ...` line from its output for the
14
- * `chantApprove` field scripts use. `yodel chant <args>` is the line that
15
- * runs chant in yodel's words (../commands/chant.ts).
16
- */
17
- import { spawn } from "node:child_process";
18
- import { chantArgv, chantEnv as chantInstallEnv } from "@intentius/chant/chant-install";
19
- import { fallbackImportArgs } from "./resolve-fallback.js";
20
- /** The environment a chant child runs with: the caller's, with chant's bin first on PATH, and no colour. */
21
- export function chantEnv(base = process.env) {
22
- return { ...chantInstallEnv(base), FORCE_COLOR: "0", NO_COLOR: "1" };
23
- }
24
- /** Runs `chant <args>` in `cwd` and resolves with its exit code and output. Never rejects on a non-zero exit. */
25
- export function runChant(args, options) {
26
- const [node = process.execPath, ...argv] = chantArgv(args, { nodeArgs: fallbackImportArgs() });
27
- return new Promise((resolvePromise, reject) => {
28
- const child = spawn(node, argv, {
29
- cwd: options.cwd,
30
- env: chantEnv(options.env),
31
- stdio: ["ignore", "pipe", "pipe"],
32
- });
33
- let stdout = "";
34
- let stderr = "";
35
- child.stdout.setEncoding("utf8");
36
- child.stderr.setEncoding("utf8");
37
- child.stdout.on("data", (chunk) => {
38
- stdout += chunk;
39
- options.onStdout?.(chunk);
40
- });
41
- child.stderr.on("data", (chunk) => {
42
- stderr += chunk;
43
- options.onStderr?.(chunk);
44
- });
45
- child.on("error", reject);
46
- child.on("close", (code, signal) => {
47
- resolvePromise({ code: code ?? (signal ? 128 : 1), stdout, stderr });
48
- });
49
- });
50
- }
51
- /** The last line of `stdout` that parses as a JSON object: chant prints its `--json` document as one line, after any log lines. */
52
- export function lastJsonLine(stdout) {
53
- const lines = stdout.split("\n").map((l) => l.trim()).filter((l) => l.startsWith("{"));
54
- for (const line of lines.reverse()) {
55
- try {
56
- return JSON.parse(line);
57
- }
58
- catch {
59
- // A log line that happens to start with "{"; keep looking.
60
- }
61
- }
62
- // A pretty-printed document spans lines; try the whole of stdout from its first "{".
63
- const at = stdout.indexOf("{");
64
- if (at >= 0) {
65
- try {
66
- return JSON.parse(stdout.slice(at));
67
- }
68
- catch {
69
- // Not JSON.
70
- }
71
- }
72
- return undefined;
73
- }
74
- //# sourceMappingURL=process.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/chant/process.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAgB3D,4GAA4G;AAC5G,MAAM,UAAU,QAAQ,CAAC,OAA0B,OAAO,CAAC,GAAG;IAC5D,OAAO,EAAE,GAAG,eAAe,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;AACvE,CAAC;AAED,iHAAiH;AACjH,MAAM,UAAU,QAAQ,CAAC,IAAuB,EAAE,OAAwB;IACxE,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;IAC/F,OAAO,IAAI,OAAO,CAAC,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE;QAC5C,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE;YAC9B,GAA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E,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IACvF,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;QACnC,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAY,CAAC;QACrC,CAAC;QAAC,MAAM,CAAC;YACP,2DAA2D;QAC7D,CAAC;IACH,CAAC;IACD,qFAAqF;IACrF,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QACZ,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAY,CAAC;QACjD,CAAC;QAAC,MAAM,CAAC;YACP,YAAY;QACd,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -1,35 +0,0 @@
1
- /**
2
- * Packages for a project with no `node_modules` of its own (#312).
3
- *
4
- * chant's commit job runs `yodel new` in a git worktree of the pull
5
- * request's head, outside the checkout the job installed, so the worktree
6
- * has no `node_modules` and nothing above it does either (chant pull
7
- * request 4798). Its `chant.config.ts` and `src/` import chant, the sql
8
- * lexicon and `@intentius/sql-yodeler` by name, and Node finds a package by
9
- * walking up from the importing file, so every such import fails there.
10
- *
11
- * yodel itself runs from the checkout's install (`node_modules/.bin/yodel`
12
- * on the job's PATH), or from the CI image's global one, and that install
13
- * holds every package the project's files import. This module registers a
14
- * Node resolve hook that retries a bare specifier from yodel's own
15
- * `node_modules` when it was not found, and only for an importing file with
16
- * no `node_modules` directory in itself or any directory above it, where
17
- * the import could never resolve. A project that has its own install
18
- * resolves as before: the hook only ever sees imports that already failed.
19
- *
20
- * yodel's bin registers it in its own process (`chant.config.ts` and the
21
- * Ops are loaded there), and {@link fallbackImportArgs} gives the
22
- * `--import` the chant children run with (`chant build`, `chant sql
23
- * types`). The hooks are a `data:` module, so they load the same from
24
- * `src/` under tsx and from `dist/`.
25
- */
26
- /** The `node_modules` directory yodel's own packages are installed in, found from chant's place in it. */
27
- export declare function ownModules(from?: string): string | undefined;
28
- /** Registers the hook in this process, once. */
29
- export declare function registerResolveFallback(modules?: string | undefined): void;
30
- /**
31
- * The `--import` a chant child runs with, before tsx's, so its own imports
32
- * of the project's files get the same hook; none when yodel's install is
33
- * not found.
34
- */
35
- export declare function fallbackImportArgs(modules?: string | undefined): string[];
@@ -1,89 +0,0 @@
1
- /**
2
- * Packages for a project with no `node_modules` of its own (#312).
3
- *
4
- * chant's commit job runs `yodel new` in a git worktree of the pull
5
- * request's head, outside the checkout the job installed, so the worktree
6
- * has no `node_modules` and nothing above it does either (chant pull
7
- * request 4798). Its `chant.config.ts` and `src/` import chant, the sql
8
- * lexicon and `@intentius/sql-yodeler` by name, and Node finds a package by
9
- * walking up from the importing file, so every such import fails there.
10
- *
11
- * yodel itself runs from the checkout's install (`node_modules/.bin/yodel`
12
- * on the job's PATH), or from the CI image's global one, and that install
13
- * holds every package the project's files import. This module registers a
14
- * Node resolve hook that retries a bare specifier from yodel's own
15
- * `node_modules` when it was not found, and only for an importing file with
16
- * no `node_modules` directory in itself or any directory above it, where
17
- * the import could never resolve. A project that has its own install
18
- * resolves as before: the hook only ever sees imports that already failed.
19
- *
20
- * yodel's bin registers it in its own process (`chant.config.ts` and the
21
- * Ops are loaded there), and {@link fallbackImportArgs} gives the
22
- * `--import` the chant children run with (`chant build`, `chant sql
23
- * types`). The hooks are a `data:` module, so they load the same from
24
- * `src/` under tsx and from `dist/`.
25
- */
26
- import { createRequire, register } from "node:module";
27
- import { dirname, join, sep } from "node:path";
28
- import { pathToFileURL } from "node:url";
29
- /** The resolve hook, run on Node's hooks thread. `data.parent` is a file URL in the directory that holds yodel's `node_modules`. */
30
- const HOOKS = `
31
- import { existsSync } from "node:fs";
32
- import { dirname, join } from "node:path";
33
- import { fileURLToPath } from "node:url";
34
- let parent;
35
- export function initialize(data) { parent = data && data.parent; }
36
- const bare = (s) => !/^(\\.{0,2}\\/|[a-zA-Z][a-zA-Z0-9+.-]*:)/.test(s) && !s.startsWith("#");
37
- function installed(url) {
38
- if (!url || !url.startsWith("file:")) return true;
39
- let d = dirname(fileURLToPath(url));
40
- for (;;) {
41
- if (existsSync(join(d, "node_modules"))) return true;
42
- const up = dirname(d);
43
- if (up === d) return false;
44
- d = up;
45
- }
46
- }
47
- export async function resolve(specifier, context, next) {
48
- try {
49
- return await next(specifier, context);
50
- } catch (e) {
51
- if (!parent || !e || e.code !== "ERR_MODULE_NOT_FOUND" || !bare(specifier) || installed(context.parentURL)) throw e;
52
- return next(specifier, { ...context, parentURL: parent });
53
- }
54
- }
55
- `;
56
- const HOOKS_URL = `data:text/javascript,${encodeURIComponent(HOOKS)}`;
57
- /** The `node_modules` directory yodel's own packages are installed in, found from chant's place in it. */
58
- export function ownModules(from = import.meta.url) {
59
- try {
60
- const entry = createRequire(from).resolve("@intentius/chant");
61
- const at = entry.lastIndexOf(`${sep}node_modules${sep}`);
62
- return at < 0 ? undefined : entry.slice(0, at + `${sep}node_modules`.length);
63
- }
64
- catch {
65
- return undefined;
66
- }
67
- }
68
- /** A file URL in the directory holding `modules`, from which a bare specifier resolves into it. */
69
- const parentOf = (modules) => pathToFileURL(join(dirname(modules), "yodel-resolve-fallback.js")).href;
70
- let registered = false;
71
- /** Registers the hook in this process, once. */
72
- export function registerResolveFallback(modules = ownModules()) {
73
- if (registered || modules === undefined)
74
- return;
75
- registered = true;
76
- register(HOOKS_URL, { data: { parent: parentOf(modules) } });
77
- }
78
- /**
79
- * The `--import` a chant child runs with, before tsx's, so its own imports
80
- * of the project's files get the same hook; none when yodel's install is
81
- * not found.
82
- */
83
- export function fallbackImportArgs(modules = ownModules()) {
84
- if (modules === undefined)
85
- return [];
86
- const registerIt = `import { register } from "node:module"; register(${JSON.stringify(HOOKS_URL)}, { data: { parent: ${JSON.stringify(parentOf(modules))} } });`;
87
- return ["--import", `data:text/javascript,${encodeURIComponent(registerIt)}`];
88
- }
89
- //# sourceMappingURL=resolve-fallback.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-fallback.js","sourceRoot":"","sources":["../../src/chant/resolve-fallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,oIAAoI;AACpI,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBb,CAAC;AAEF,MAAM,SAAS,GAAG,wBAAwB,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;AAEtE,0GAA0G;AAC1G,MAAM,UAAU,UAAU,CAAC,OAAe,MAAM,CAAC,IAAI,CAAC,GAAG;IACvD,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC9D,MAAM,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,GAAG,eAAe,GAAG,EAAE,CAAC,CAAC;QACzD,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,GAAG,GAAG,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAC/E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,mGAAmG;AACnG,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,2BAA2B,CAAC,CAAC,CAAC,IAAI,CAAC;AAEtH,IAAI,UAAU,GAAG,KAAK,CAAC;AAEvB,gDAAgD;AAChD,MAAM,UAAU,uBAAuB,CAAC,UAA8B,UAAU,EAAE;IAChF,IAAI,UAAU,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO;IAChD,UAAU,GAAG,IAAI,CAAC;IAClB,QAAQ,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,UAA8B,UAAU,EAAE;IAC3E,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACrC,MAAM,UAAU,GAAG,oDAAoD,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,uBAAuB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;IACjK,OAAO,CAAC,UAAU,EAAE,wBAAwB,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AAChF,CAAC"}
@@ -1,41 +0,0 @@
1
- /**
2
- * The plan comment's warning that an environment's drift watch stopped
3
- * running (chant#4289). A scheduled job can stop with no error anywhere:
4
- * GitHub turns a scheduled workflow off after 60 days with no activity in
5
- * the repository, and on GitLab the job runs only from a pipeline schedule
6
- * someone created. The watch cannot report its own absence, so `yodel plan
7
- * --comment` asks the forge when the environment's WatchOp job last ran and
8
- * warns when its cron has fired at least twice since.
9
- *
10
- * chant decides and finds the file (`checkOverdueOps` in
11
- * `op/schedule-overdue.ts`, chant issue 4789): it reads every workflow and
12
- * pipeline file, `.gitlab/yodel-watch.gitlab-ci.yml` included, so yodel says
13
- * only which Ops. The Op is the WatchOp whose `Env` label is the environment
14
- * (chant's `WatchOp` sets `Watch` and `Env`).
15
- *
16
- * Nothing here fails the plan. A forge that does not answer is a line in
17
- * the job log and no warning.
18
- */
19
- import type { OpConfig } from "@intentius/chant/op/types";
20
- import type { OverdueOp } from "@intentius/chant/op/schedule-overdue";
21
- import type { PrForge } from "@intentius/chant/pr-forge";
22
- /** The environment's scheduled WatchOps, by name. */
23
- export declare function envWatches(ops: Iterable<OpConfig>, env: string): Promise<{
24
- op: string;
25
- cron: string;
26
- }[]>;
27
- /**
28
- * The environment's overdue watches, each logged with `log`. `ops` are the
29
- * project's discovered Op configs; `dir` is the project, where `yodel ci`
30
- * writes its files.
31
- */
32
- export declare function overdueWatches(input: {
33
- ops: Iterable<OpConfig>;
34
- env: string;
35
- dir: string;
36
- forge: Pick<PrForge, "kind" | "scheduledRuns">;
37
- now: Date;
38
- log: (line: string) => void;
39
- }): Promise<OverdueOp[]>;
40
- /** The notes `yodel plan --comment` adds for the environment's overdue watches: discovers the Ops, never throws. */
41
- export declare function overdueNotes(dir: string, env: string, forge: Pick<PrForge, "kind" | "scheduledRuns">, log: (line: string) => void, now?: Date): Promise<string[]>;
@@ -1,46 +0,0 @@
1
- /**
2
- * The plan comment's warning that an environment's drift watch stopped
3
- * running (chant#4289). A scheduled job can stop with no error anywhere:
4
- * GitHub turns a scheduled workflow off after 60 days with no activity in
5
- * the repository, and on GitLab the job runs only from a pipeline schedule
6
- * someone created. The watch cannot report its own absence, so `yodel plan
7
- * --comment` asks the forge when the environment's WatchOp job last ran and
8
- * warns when its cron has fired at least twice since.
9
- *
10
- * chant decides and finds the file (`checkOverdueOps` in
11
- * `op/schedule-overdue.ts`, chant issue 4789): it reads every workflow and
12
- * pipeline file, `.gitlab/yodel-watch.gitlab-ci.yml` included, so yodel says
13
- * only which Ops. The Op is the WatchOp whose `Env` label is the environment
14
- * (chant's `WatchOp` sets `Watch` and `Env`).
15
- *
16
- * Nothing here fails the plan. A forge that does not answer is a line in
17
- * the job log and no warning.
18
- */
19
- /** The environment's scheduled WatchOps, by name. */
20
- export async function envWatches(ops, env) {
21
- const { scheduledWatches } = await import("@intentius/chant/op/schedule-overdue");
22
- return scheduledWatches([...ops].filter((o) => o.labels?.Watch === "true" && o.labels.Env === env));
23
- }
24
- /**
25
- * The environment's overdue watches, each logged with `log`. `ops` are the
26
- * project's discovered Op configs; `dir` is the project, where `yodel ci`
27
- * writes its files.
28
- */
29
- export async function overdueWatches(input) {
30
- const { checkOverdueOps } = await import("@intentius/chant/op/schedule-overdue");
31
- return checkOverdueOps({ watches: await envWatches(input.ops, input.env), forge: input.forge, repoRoot: input.dir, now: input.now, log: (line) => { input.log(`yodel plan: ${line}`); } });
32
- }
33
- /** The notes `yodel plan --comment` adds for the environment's overdue watches: discovers the Ops, never throws. */
34
- export async function overdueNotes(dir, env, forge, log, now = new Date()) {
35
- try {
36
- const { discoverOps } = await import("@intentius/chant/op/discover");
37
- const found = await discoverOps({ cwd: dir });
38
- const overdue = await overdueWatches({ ops: [...found.ops.values()].map((o) => o.config), env, dir, forge, now, log });
39
- return overdue.map((o) => `Warning: ${o.message}`);
40
- }
41
- catch (e) {
42
- log(`yodel plan: the watch schedule was not checked: ${(e instanceof Error ? e.message : String(e)).split("\n")[0] ?? ""}`);
43
- return [];
44
- }
45
- }
46
- //# sourceMappingURL=overdue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"overdue.js","sourceRoot":"","sources":["../../src/pr/overdue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,qDAAqD;AACrD,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAuB,EAAE,GAAW;IACnE,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,sCAAsC,CAAC,CAAC;IAClF,OAAO,gBAAgB,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,KAAK,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,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