breakaway 2.0.0-main.94 → 2.0.0-main.96

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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "breakaway",
3
- "version": "2.0.0-main.94",
3
+ "version": "2.0.0-main.96",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "breakaway",
9
- "version": "2.0.0-main.94",
9
+ "version": "2.0.0-main.96",
10
10
  "license": "FSL-1.1-Apache-2.0",
11
11
  "bin": {
12
12
  "breakaway": "scripts/tasks.mjs"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "breakaway",
3
- "version": "2.0.0-main.94",
3
+ "version": "2.0.0-main.96",
4
4
  "description": "The task board for you and your coding agents: a Cloudflare Worker, its web app, Taskwarrior sync, and the CLI (npx breakaway).",
5
5
  "license": "FSL-1.1-Apache-2.0",
6
6
  "type": "module",
@@ -4,8 +4,12 @@
4
4
  * so the Worker renders an empty repository's first commit from the same files as the CLI. It's generated, never
5
5
  * committed (BRK-148): `pnpm install`, `build`, `typecheck`, `test`, and `deploy` run this first, and the release
6
6
  * workflow's build puts it in the bundle.
7
+ *
8
+ * It writes src/infra-shipped-templates.json too (BRK-259), generated and never committed the same way: the golden
9
+ * paths breakaway ships, template/infra/templates/<name>/, each file by name, so the board's console can add from
10
+ * them when a repository has no template of that name.
7
11
  */
8
- import { readFileSync, writeFileSync } from 'node:fs';
12
+ import { readdirSync, readFileSync, writeFileSync } from 'node:fs';
9
13
  import { boardSources } from '../src/init.js';
10
14
 
11
15
  const ROOT = new URL('../', import.meta.url);
@@ -13,8 +17,26 @@ const read = (path) => readFileSync(new URL(path, ROOT), 'utf8');
13
17
 
14
18
  export const boardFiles = () => Object.fromEntries(boardSources(read).map((path) => [path, read(path)]));
15
19
 
20
+ const TEMPLATES = 'template/infra/templates/';
21
+ export const shippedTemplates = () =>
22
+ Object.fromEntries(
23
+ readdirSync(new URL(TEMPLATES, ROOT), { withFileTypes: true })
24
+ .filter((d) => d.isDirectory())
25
+ .map((d) => d.name)
26
+ .sort()
27
+ .map((name) => [
28
+ name,
29
+ Object.fromEntries(
30
+ readdirSync(new URL(`${TEMPLATES}${name}/`, ROOT))
31
+ .sort()
32
+ .map((file) => [file, read(`${TEMPLATES}${name}/${file}`)]),
33
+ ),
34
+ ]),
35
+ );
36
+
16
37
  if (import.meta.url === `file://${process.argv[1]}`) {
17
38
  writeFileSync(new URL('src/board-files.json', ROOT), `${JSON.stringify(boardFiles(), null, 2)}\n`);
39
+ writeFileSync(new URL('src/infra-shipped-templates.json', ROOT), `${JSON.stringify(shippedTemplates(), null, 2)}\n`);
18
40
  // On stderr: npm pack and npm publish run it (prepare), and their --json goes to stdout.
19
- console.error('Wrote src/board-files.json.');
41
+ console.error('Wrote src/board-files.json and src/infra-shipped-templates.json.');
20
42
  }
@@ -277,7 +277,7 @@ export function blastRadius(diff, inventory) {
277
277
 
278
278
  /**
279
279
  * A plan's row as the API shows it. The summary (`full` false) leaves out the diff's settings and the blast radius's
280
- * list, for the list of plans.
280
+ * list, for the list of plans. `environment.removed` is true when the plan's environment was removed (BRK-265).
281
281
  * @param {Record<string, any>} row
282
282
  * @param {{ full?: boolean }} [options]
283
283
  */
@@ -289,7 +289,7 @@ export function planView(row, { full = true } = {}) {
289
289
  return {
290
290
  id: planId(Number(row.n)),
291
291
  repo: row.repo,
292
- environment: { id: Number(row.environment), name: row.env_name },
292
+ environment: { id: Number(row.environment), name: row.env_name, ...(row.env_gone ? { removed: true } : {}) },
293
293
  provider: row.provider,
294
294
  target: row.target ?? null,
295
295
  desiredSha: row.desired_sha ?? null,