@ultimat3/cli 31.44.0 → 31.45.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/cli",
3
- "version": "31.44.0",
3
+ "version": "31.45.0",
4
4
  "description": "The `x` binary: new, dev, build, verify, generate, db, mcp, doctor, deploy",
5
5
  "keywords": [
6
6
  "ultimate",
@@ -53,34 +53,34 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "@babel/core": "^8.0.10",
56
- "@ultimat3/action": "31.44.0",
57
- "@ultimat3/admin": "31.44.0",
58
- "@ultimat3/ai": "31.44.0",
59
- "@ultimat3/auth": "31.44.0",
60
- "@ultimat3/cache": "31.44.0",
61
- "@ultimat3/core": "31.44.0",
62
- "@ultimat3/db": "31.44.0",
63
- "@ultimat3/entity": "31.44.0",
64
- "@ultimat3/flags": "31.44.0",
65
- "@ultimat3/http": "31.44.0",
66
- "@ultimat3/i18n": "31.44.0",
67
- "@ultimat3/jobs": "31.44.0",
68
- "@ultimat3/mail": "31.44.0",
69
- "@ultimat3/manifest": "31.44.0",
70
- "@ultimat3/mcp": "31.44.0",
71
- "@ultimat3/money": "31.44.0",
72
- "@ultimat3/notify": "31.44.0",
73
- "@ultimat3/policy": "31.44.0",
74
- "@ultimat3/pwa": "31.44.0",
75
- "@ultimat3/query": "31.44.0",
76
- "@ultimat3/realtime": "31.44.0",
77
- "@ultimat3/render": "31.44.0",
78
- "@ultimat3/schema": "31.44.0",
79
- "@ultimat3/scraping": "31.44.0",
80
- "@ultimat3/seo": "31.44.0",
81
- "@ultimat3/storage": "31.44.0",
82
- "@ultimat3/testing": "31.44.0",
83
- "@ultimat3/time": "31.44.0",
56
+ "@ultimat3/action": "31.45.0",
57
+ "@ultimat3/admin": "31.45.0",
58
+ "@ultimat3/ai": "31.45.0",
59
+ "@ultimat3/auth": "31.45.0",
60
+ "@ultimat3/cache": "31.45.0",
61
+ "@ultimat3/core": "31.45.0",
62
+ "@ultimat3/db": "31.45.0",
63
+ "@ultimat3/entity": "31.45.0",
64
+ "@ultimat3/flags": "31.45.0",
65
+ "@ultimat3/http": "31.45.0",
66
+ "@ultimat3/i18n": "31.45.0",
67
+ "@ultimat3/jobs": "31.45.0",
68
+ "@ultimat3/mail": "31.45.0",
69
+ "@ultimat3/manifest": "31.45.0",
70
+ "@ultimat3/mcp": "31.45.0",
71
+ "@ultimat3/money": "31.45.0",
72
+ "@ultimat3/notify": "31.45.0",
73
+ "@ultimat3/policy": "31.45.0",
74
+ "@ultimat3/pwa": "31.45.0",
75
+ "@ultimat3/query": "31.45.0",
76
+ "@ultimat3/realtime": "31.45.0",
77
+ "@ultimat3/render": "31.45.0",
78
+ "@ultimat3/schema": "31.45.0",
79
+ "@ultimat3/scraping": "31.45.0",
80
+ "@ultimat3/seo": "31.45.0",
81
+ "@ultimat3/storage": "31.45.0",
82
+ "@ultimat3/testing": "31.45.0",
83
+ "@ultimat3/time": "31.45.0",
84
84
  "babel-preset-solid": "^1.9.16"
85
85
  }
86
86
  }
@@ -0,0 +1,63 @@
1
+ // 31.45.0: ci.yml's `verify-part-*` upload keeps its document one day. The verdict job reads it in
2
+ // the same run, and GitHub's 90-day default let one adopter's parts fill the org's artifact quota
3
+ // until CI could not run. Keyed on the upload's `name:` line, not the template's exact bytes, so an
4
+ // upload the app reshaped still gets it; one already holding a `retention-days` is the app's.
5
+
6
+ import { CI_WORKFLOW_PATH } from '../templates/github/ci.yml';
7
+ import type { Codemod, CodemodResult } from './codemod';
8
+ import { readText } from './engine-edits';
9
+
10
+ /** What the template writes at the end of the upload's `with:`, at its 10-column indent. */
11
+ export const RETENTION_LINES = [
12
+ " # The verdict reads it in this run only: kept GitHub's 90 days, every push's parts",
13
+ " # pile up until the org's artifact storage quota stops CI from running at all.",
14
+ ' retention-days: 1',
15
+ '',
16
+ ].join('\n');
17
+
18
+ /** The stock upload's artifact name, at whatever indent the app's `with:` sits. */
19
+ const PART_NAME = /^( +)name: verify-part-\$\{\{ matrix\.part \}\}\s*$/;
20
+
21
+ const NOTHING: CodemodResult = { changed: [], skipped: [] };
22
+
23
+ const indentOf = (line: string): number => line.length - line.trimStart().length;
24
+
25
+ /** The `with:` block holding line `at`: the run of non-blank lines at its indent or deeper. */
26
+ const blockAround = (lines: readonly string[], at: number, indent: number): [number, number] => {
27
+ const inside = (line: string | undefined): boolean =>
28
+ line !== undefined && line.trim() !== '' && indentOf(line) >= indent;
29
+ let first = at;
30
+ while (inside(lines[first - 1])) first -= 1;
31
+ let last = at;
32
+ while (inside(lines[last + 1])) last += 1;
33
+ return [first, last];
34
+ };
35
+
36
+ const reindent = (indent: number): string[] =>
37
+ RETENTION_LINES.trimEnd()
38
+ .split('\n')
39
+ .map((line) => `${' '.repeat(indent)}${line.trimStart()}`);
40
+
41
+ export const codemod: Codemod = {
42
+ id: 'ci-artifact-retention',
43
+ since: '31.45.0',
44
+ summary: `${CI_WORKFLOW_PATH}: the verify-part-* upload the verdict reads in the same run keeps its document one day, never GitHub's 90`,
45
+ run: async (app) => {
46
+ const file = await readText(app, CI_WORKFLOW_PATH);
47
+ if (file === undefined) return NOTHING;
48
+ const lines = file.text.split('\n');
49
+ // Bottom-up, so an insert never shifts a block still to be read.
50
+ for (let at = lines.length - 1; at >= 0; at -= 1) {
51
+ const indent = PART_NAME.exec(lines[at] ?? '')?.[1]?.length;
52
+ if (indent === undefined) continue;
53
+ const [first, last] = blockAround(lines, at, indent);
54
+ const block = lines.slice(first, last + 1);
55
+ if (block.some((line) => line.trimStart().startsWith('retention-days:'))) continue;
56
+ lines.splice(last + 1, 0, ...reindent(indent));
57
+ }
58
+ const next = lines.join('\n');
59
+ if (next === file.text) return NOTHING;
60
+ await app.write(CI_WORKFLOW_PATH, file.restore(next));
61
+ return { changed: [CI_WORKFLOW_PATH], skipped: [] };
62
+ },
63
+ };
@@ -1,59 +1,143 @@
1
- // 31.43.0: the workflows `x new` writes run every action by commit SHA (`templates/github/
2
- // actions.ts`), and ci.yml's checkouts drop the job token before `bun install`. Each stock line is
3
- // swapped wherever it stands — every occurrence is the template's, so many is no guess — and a
4
- // file still holding a movable `actions/*` tag after the swap is the author's, reported whole.
1
+ // 31.43.0: `x new`'s workflows run every action by commit SHA (`templates/github/actions.ts`) and
2
+ // a checkout drops the job token before `bun install`. Line by line, so any tagged major moves
3
+ // (`@v5` included); a SHA or an action with no pin is never touched, and a line no edit reads
4
+ // safely (quoted, an inline `with:`) leaves the file the author's, with the diff.
5
5
 
6
6
  import { CACHE, CHECKOUT, DOWNLOAD_ARTIFACT, UPLOAD_ARTIFACT } from '../templates/github/actions';
7
7
  import { CI_WORKFLOW_PATH } from '../templates/github/ci.yml';
8
8
  import { IMAGE_WORKFLOW_PATH } from '../templates/github/image.yml';
9
9
  import type { Codemod, CodemodApp, CodemodResult } from './codemod';
10
10
  import { unifiedDiff } from './engine-diff';
11
- import type { SnippetEdit } from './engine-edits';
12
11
  import { mergeResults, readText } from './engine-edits';
13
12
 
14
- const SETUP_BUN = ' - uses: oven-sh/setup-bun@';
13
+ /** Each action this codemod pins, to the pin the template writes today. */
14
+ const PINS: Readonly<Record<string, string>> = {
15
+ checkout: CHECKOUT,
16
+ cache: CACHE,
17
+ 'upload-artifact': UPLOAD_ARTIFACT,
18
+ 'download-artifact': DOWNLOAD_ARTIFACT,
19
+ };
15
20
 
16
- /** ci.yml: each checkout is followed by setup-bun, so it has no `with:` of its own to collide. */
17
- export const CI_PINNED_EDITS: readonly SnippetEdit[] = [
18
- {
19
- from: ` - uses: actions/checkout@v7\n${SETUP_BUN}`,
20
- to: ` - uses: ${CHECKOUT}\n with:\n persist-credentials: false\n${SETUP_BUN}`,
21
- },
22
- { from: ' - uses: actions/cache@v6\n', to: ` - uses: ${CACHE}\n` },
23
- { from: ' - uses: actions/upload-artifact@v7\n', to: ` - uses: ${UPLOAD_ARTIFACT}\n` },
24
- {
25
- from: ' - uses: actions/download-artifact@v8\n',
26
- to: ` - uses: ${DOWNLOAD_ARTIFACT}\n`,
27
- },
28
- ];
21
+ const NAMES = Object.keys(PINS).join('|');
22
+ /** A step's `uses:` on a tag — `- uses:` or a later key of the step — in the one shape edited. */
23
+ const TAGGED = new RegExp(`^( *)(- )?uses: actions/(${NAMES})@v\\d+(?:\\.\\d+){0,2}[ \\t]*$`);
24
+ /** Any mention of a pinned action that is not a SHA: what must have read as TAGGED, or be refused. */
25
+ const MENTION = new RegExp(`actions/(?:${NAMES})@(?![0-9a-f]{40}(?![\\w-]))`);
26
+ const WITH = /^with:(.*)$/;
29
27
 
30
- /** image.yml: its checkout already set `persist-credentials: false`; only the pin moves. */
31
- export const IMAGE_PINNED_EDITS: readonly SnippetEdit[] = [
32
- { from: ' - uses: actions/checkout@v7\n', to: ` - uses: ${CHECKOUT}\n` },
33
- ];
28
+ const NOTHING: CodemodResult = { changed: [], skipped: [] };
34
29
 
35
- /** A GitHub-owned action still on a tag: what a stock file never holds once the edits ran. */
36
- const MOVABLE = /uses:\s*actions\/[\w./-]+@v\d[^\n]*$/m;
30
+ /** A line this codemod cannot edit safely, as its 1-based number and text. */
31
+ class Unsafe {
32
+ constructor(
33
+ readonly line: number,
34
+ readonly text: string,
35
+ ) {}
36
+ }
37
37
 
38
- const NOTHING: CodemodResult = { changed: [], skipped: [] };
38
+ const indentOf = (line: string): number => line.length - line.trimStart().length;
39
+ const isBlank = (line: string): boolean => line.trim() === '';
40
+
41
+ /** The step's lines around its `uses:` at `at`, as [first, last], keys at `keys` columns. */
42
+ const stepRange = (lines: readonly string[], at: number, keys: number, dashed: boolean) => {
43
+ let first = at;
44
+ if (!dashed) {
45
+ while (first > 0) {
46
+ const line = lines[first - 1] ?? '';
47
+ first -= 1;
48
+ if (indentOf(line) === keys - 2 && line.trimStart().startsWith('- ')) break;
49
+ if (!isBlank(line) && indentOf(line) < keys) return undefined;
50
+ }
51
+ }
52
+ let last = at;
53
+ for (let next = at + 1; next < lines.length; next += 1) {
54
+ const line = lines[next] ?? '';
55
+ if (isBlank(line)) continue;
56
+ if (indentOf(line) < keys) break;
57
+ last = next;
58
+ }
59
+ return [first, last] as const;
60
+ };
61
+
62
+ /** The lines a checkout's step needs inserted to drop the token, and where; Unsafe when unreadable. */
63
+ const persistInsert = (
64
+ lines: readonly string[],
65
+ at: number,
66
+ keys: number,
67
+ dashed: boolean,
68
+ ): { readonly after: number; readonly lines: readonly string[] } | Unsafe | undefined => {
69
+ const range = stepRange(lines, at, keys, dashed);
70
+ if (range === undefined) return new Unsafe(at + 1, lines[at] ?? '');
71
+ const [first, last] = range;
72
+ const own = (index: number): string => {
73
+ const line = lines[index] ?? '';
74
+ return indentOf(line) === keys || (index === first && dashed) ? line.trimStart() : '';
75
+ };
76
+ for (let index = first; index <= last; index += 1) {
77
+ const key = own(index).replace(/^- /, '');
78
+ const opened = WITH.exec(key);
79
+ if (opened === null) continue;
80
+ if (!/^\s*(?:#.*)?$/.test(opened[1] ?? '')) return new Unsafe(index + 1, lines[index] ?? '');
81
+ const children = lines.slice(index + 1, last + 1).filter((line) => !isBlank(line));
82
+ if (children.some((line) => line.trimStart().startsWith('persist-credentials:'))) return;
83
+ const inner = children[0] === undefined ? keys + 2 : indentOf(children[0]);
84
+ return { after: index, lines: [`${' '.repeat(inner)}persist-credentials: false`] };
85
+ }
86
+ const pad = ' '.repeat(keys);
87
+ return { after: at, lines: [`${pad}with:`, `${pad} persist-credentials: false`] };
88
+ };
89
+
90
+ /** `text` with every tagged pin moved and each moved checkout's token dropped, or the first Unsafe. */
91
+ function pinActions(text: string): string | Unsafe {
92
+ const lines = text.split('\n');
93
+ // Bottom-up, so an insert never shifts a line still to be read.
94
+ for (let at = lines.length - 1; at >= 0; at -= 1) {
95
+ const line = lines[at] ?? '';
96
+ const tagged = TAGGED.exec(line);
97
+ if (tagged === null) {
98
+ if (MENTION.test(line)) return new Unsafe(at + 1, line);
99
+ continue;
100
+ }
101
+ const [, lead = '', dash, name = ''] = tagged;
102
+ const keys = lead.length + (dash === undefined ? 0 : 2);
103
+ if (name === 'checkout') {
104
+ const insert = persistInsert(lines, at, keys, dash !== undefined);
105
+ if (insert instanceof Unsafe) return insert;
106
+ if (insert !== undefined) lines.splice(insert.after + 1, 0, ...insert.lines);
107
+ }
108
+ lines[at] = `${lead}${dash ?? ''}uses: ${PINS[name] ?? ''}`;
109
+ }
110
+ return lines.join('\n');
111
+ }
112
+
113
+ /** The template's own change, for a file it leaves to the author. */
114
+ const TEMPLATE_DIFF = (path: string): string =>
115
+ unifiedDiff(
116
+ path,
117
+ `${Object.keys(PINS)
118
+ .map((name) => ` - uses: actions/${name}@v<N>`)
119
+ .join('\n')}\n`,
120
+ `${Object.entries(PINS)
121
+ .map(([name, pin]) =>
122
+ name === 'checkout'
123
+ ? ` - uses: ${pin}\n with:\n persist-credentials: false`
124
+ : ` - uses: ${pin}`,
125
+ )
126
+ .join('\n')}\n`,
127
+ );
39
128
 
40
- async function pin(
41
- app: CodemodApp,
42
- path: string,
43
- edits: readonly SnippetEdit[],
44
- ): Promise<CodemodResult> {
129
+ async function pin(app: CodemodApp, path: string): Promise<CodemodResult> {
45
130
  const file = await readText(app, path);
46
131
  if (file === undefined) return NOTHING;
47
- const next = edits.reduce((source, edit) => source.replaceAll(edit.from, edit.to), file.text);
48
- if (MOVABLE.test(next)) {
49
- const side = (key: 'from' | 'to') => `${edits.map((edit) => edit[key]).join('\n')}\n`;
132
+ const next = pinActions(file.text);
133
+ if (next instanceof Unsafe) {
50
134
  return {
51
135
  changed: [],
52
136
  skipped: [
53
137
  {
54
138
  path,
55
- reason: `${path} runs an actions/* step by movable tag in a shape the scaffold never wrote (${MOVABLE.exec(next)?.[0].trim() ?? ''}), so the diff below is the template's change, to make by hand`,
56
- diff: unifiedDiff(path, side('from'), side('to')),
139
+ reason: `${path}:${String(next.line)} runs ${next.text.trim()} in a shape this codemod cannot edit safely (quoted, commented, an inline with:), so the diff below is the template's change, to make by hand`,
140
+ diff: TEMPLATE_DIFF(path),
57
141
  },
58
142
  ],
59
143
  };
@@ -68,8 +152,5 @@ export const codemod: Codemod = {
68
152
  since: '31.43.0',
69
153
  summary: `${CI_WORKFLOW_PATH}, ${IMAGE_WORKFLOW_PATH}: every actions/* step pinned by commit SHA, and ci.yml's checkouts keep no git credential`,
70
154
  run: async (app) =>
71
- mergeResults([
72
- await pin(app, CI_WORKFLOW_PATH, CI_PINNED_EDITS),
73
- await pin(app, IMAGE_WORKFLOW_PATH, IMAGE_PINNED_EDITS),
74
- ]),
155
+ mergeResults([await pin(app, CI_WORKFLOW_PATH), await pin(app, IMAGE_WORKFLOW_PATH)]),
75
156
  };
@@ -7,6 +7,7 @@ import { codemod as authenticatorSessionRefusal } from './authenticator-session-
7
7
  import { codemod as biomeNoDefaultExport } from './biome-no-default-export';
8
8
  import { codemod as bunfigIslandCoverage } from './bunfig-island-coverage';
9
9
  import { codemod as chartDashboard } from './chart-dashboard';
10
+ import { codemod as ciArtifactRetention } from './ci-artifact-retention';
10
11
  import { codemod as ciE2eBrowser } from './ci-e2e-browser';
11
12
  import { codemod as ciPinnedActions } from './ci-pinned-actions';
12
13
  import { codemod as ciServicesEnv } from './ci-services-env';
@@ -65,4 +66,5 @@ export const CODEMODS: readonly Codemod[] = [
65
66
  docsEnvGuard,
66
67
  testServices,
67
68
  ciPinnedActions,
69
+ ciArtifactRetention,
68
70
  ];
@@ -151,6 +151,9 @@ ${SETUP_STEPS}
151
151
  path: \${{ runner.temp }}/parts/\${{ matrix.part }}.json
152
152
  if-no-files-found: error
153
153
  overwrite: true
154
+ # The verdict reads it in this run only: kept GitHub's 90 days, every push's parts
155
+ # pile up until the org's artifact storage quota stops CI from running at all.
156
+ retention-days: 1
154
157
 
155
158
  # THE VERDICT: \`x verify merge\` is green only when the parts are provably the whole gate — every
156
159
  # step from exactly one part, every shard of a split over one corpus, each part green. It runs
@@ -71,6 +71,7 @@ export const RELEASED_GUARD_FORMS: Readonly<
71
71
  ['3b0u9i8hze00x', 'error'],
72
72
  ],
73
73
  'undeclared-env': [
74
+ ['13k4amuxgsnla', 'error'],
74
75
  ['1xkusngzbabza', 'error'],
75
76
  ['2jbihvbp83mb4', 'error'],
76
77
  ['3gsy96z8bgrrl', 'error'],
@@ -225,7 +225,8 @@ export function undeclaredEnv(files: readonly SourceFile[], config: string): rea
225
225
  findings.push({
226
226
  code: CODE,
227
227
  cause: \`\${file.path}:\${lineOf(text, match.index)} reads \${match[0]}, which app.config.ts does not declare — x env check never asks for it, so a deploy without it boots and fails at the first read\`,
228
- fix: \`add \${name}: { type: 'string', description: '…' } to envSchema in app.config.ts, read it as env.\${name} in \${file.path}, then: x env example\`,
228
+ // Second branch: a value \`bun build --define\` bakes in is no runtime env, and no deploy sets it.
229
+ fix: \`\${name}: { type: 'string', description: '…' }, // into envSchema in app.config.ts, read it as env.\${name} in \${file.path}, then: x env example. A build-time constant, not runtime env: declare const \${name}: string in a .d.ts, read \${name} in place of \${match[0]}, and bun build --define \${name}='"…"'\`,
229
230
  at: file.path,
230
231
  });
231
232
  }
@@ -29,7 +29,7 @@ import { verifyFloor } from './scaffold-verify-floor';
29
29
  * config as out of date on every `bun run lint`. A formatter is a build input: a floating range
30
30
  * is a `lint` step whose verdict depends on the day the app was installed.
31
31
  */
32
- const BIOME_VERSION = '2.6.3';
32
+ const BIOME_VERSION = '2.6.4';
33
33
 
34
34
  /**
35
35
  * The checker a scaffolded app typechecks with, and it must not lag the one the FRAMEWORK is built
package/wiki/Upgrading.md CHANGED
@@ -312,6 +312,9 @@ A setter still on a package's `.` barrel is `X_ADAPTER_PORT_INCOMPLETE` on the `
312
312
  | a `timestamp()` filter given zoneless ISO text reads it as UTC in both drivers (**31.44.0**); a Postgres whose session `TimeZone` was not UTC read it in that zone | to mean another zone, pass a `Date` or ISO text with its offset (`'2026-01-01T00:00:00+02:00'`) |
313
313
  | a required column with no default is added nullable and contracted to NOT NULL in the migration's non-transactional step (**31.44.0**), so a fresh or reset database migrates clean | a committed migration that still holds the old `-- backfill "c", then: … set not null;` comment: declare the column `.nullable()`, `x db gen "relax c"`, declare it required again, `x db gen "contract c"`, then `x db migrate`. A populated production table: ship `.nullable()` plus its `backfill()` first, then required |
314
314
  | two shipped guards change (**31.44.0**), built in: `undeclared-env` (`X_UNDECLARED_ENV`) also refuses a `defineEnv(` record anywhere in app source whose keys `envSchema` in `app.config.ts` does not declare; `untranslated-string` (`X_UNTRANSLATED_STRING`) ends its fix with `x verify --only boundaries`. A copy still in `guards/` keeps the old rule until `x upgrade` migrates it to the release after 31.43.0 | each `undeclared-env` finding names the keys to move into `envSchema`; then `x env example` |
315
+ | `x new`'s `ci.yml` uploads each `verify-part-*` document with `retention-days: 1` (**31.45.0**): the verdict job reads it in the same run, and GitHub's 90-day default let one adopter's parts fill the org's artifact storage quota until CI could not run | nothing: `x upgrade` applies codemod `ci-artifact-retention`; an upload that already sets `retention-days` is left as it is. Artifacts already stored keep their 90 days: delete them from the repository's Actions storage settings if the quota is already full |
316
+ | codemod `ci-pinned-actions` pins any tagged major of `actions/checkout`, `cache`, `upload-artifact` and `download-artifact` (**31.45.0**), and adds `persist-credentials: false` to each checkout it pins, inside the step's own `with:` when it has one; 31.43–31.44 skipped a workflow on another major (`actions/checkout@v5`) | nothing: `x doctor` names it as `X_UPGRADE_CODEMODS_PENDING`, and `x upgrade --json` applies it. A SHA-pinned line and an action with no pin are never touched |
317
+ | the shipped `undeclared-env` guard's fix changes (**31.45.0**), built in; its findings do not: `X_UNDECLARED_ENV` still opens with the `envSchema` line to paste, and adds a second branch for a build-time constant injected by `bun build --define process.env.X=…` (declare a global, `--define NAME=…`), which no deploy sets. A copy still in `guards/` keeps the old text until `x upgrade` migrates it to the release after 31.44.0 | nothing; for a `--define` constant, follow the second branch rather than declaring an env var |
315
318
 
316
319
  ## 29.x → 30.0.0, entry by entry
317
320