@ultimat3/cli 31.38.0 → 31.39.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.38.0",
3
+ "version": "31.39.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.38.0",
57
- "@ultimat3/admin": "31.38.0",
58
- "@ultimat3/ai": "31.38.0",
59
- "@ultimat3/auth": "31.38.0",
60
- "@ultimat3/cache": "31.38.0",
61
- "@ultimat3/core": "31.38.0",
62
- "@ultimat3/db": "31.38.0",
63
- "@ultimat3/entity": "31.38.0",
64
- "@ultimat3/flags": "31.38.0",
65
- "@ultimat3/http": "31.38.0",
66
- "@ultimat3/i18n": "31.38.0",
67
- "@ultimat3/jobs": "31.38.0",
68
- "@ultimat3/mail": "31.38.0",
69
- "@ultimat3/manifest": "31.38.0",
70
- "@ultimat3/mcp": "31.38.0",
71
- "@ultimat3/money": "31.38.0",
72
- "@ultimat3/notify": "31.38.0",
73
- "@ultimat3/policy": "31.38.0",
74
- "@ultimat3/pwa": "31.38.0",
75
- "@ultimat3/query": "31.38.0",
76
- "@ultimat3/realtime": "31.38.0",
77
- "@ultimat3/render": "31.38.0",
78
- "@ultimat3/schema": "31.38.0",
79
- "@ultimat3/scraping": "31.38.0",
80
- "@ultimat3/seo": "31.38.0",
81
- "@ultimat3/storage": "31.38.0",
82
- "@ultimat3/testing": "31.38.0",
83
- "@ultimat3/time": "31.38.0",
56
+ "@ultimat3/action": "31.39.0",
57
+ "@ultimat3/admin": "31.39.0",
58
+ "@ultimat3/ai": "31.39.0",
59
+ "@ultimat3/auth": "31.39.0",
60
+ "@ultimat3/cache": "31.39.0",
61
+ "@ultimat3/core": "31.39.0",
62
+ "@ultimat3/db": "31.39.0",
63
+ "@ultimat3/entity": "31.39.0",
64
+ "@ultimat3/flags": "31.39.0",
65
+ "@ultimat3/http": "31.39.0",
66
+ "@ultimat3/i18n": "31.39.0",
67
+ "@ultimat3/jobs": "31.39.0",
68
+ "@ultimat3/mail": "31.39.0",
69
+ "@ultimat3/manifest": "31.39.0",
70
+ "@ultimat3/mcp": "31.39.0",
71
+ "@ultimat3/money": "31.39.0",
72
+ "@ultimat3/notify": "31.39.0",
73
+ "@ultimat3/policy": "31.39.0",
74
+ "@ultimat3/pwa": "31.39.0",
75
+ "@ultimat3/query": "31.39.0",
76
+ "@ultimat3/realtime": "31.39.0",
77
+ "@ultimat3/render": "31.39.0",
78
+ "@ultimat3/schema": "31.39.0",
79
+ "@ultimat3/scraping": "31.39.0",
80
+ "@ultimat3/seo": "31.39.0",
81
+ "@ultimat3/storage": "31.39.0",
82
+ "@ultimat3/testing": "31.39.0",
83
+ "@ultimat3/time": "31.39.0",
84
84
  "babel-preset-solid": "^1.9.16"
85
85
  }
86
86
  }
package/src/cmd-new.ts CHANGED
@@ -204,6 +204,13 @@ function parentDir(cwd: string, dirFlag: string | undefined): string {
204
204
  return isAbsolute(dirFlag) ? dirFlag : join(cwd, dirFlag);
205
205
  }
206
206
 
207
+ /** A walk from the end, never `/[\\/]+$/`: that retried from every separator, quadratic on a run. */
208
+ function withoutTrailingSeparators(path: string): string {
209
+ let end = path.length;
210
+ while (end > 0 && (path[end - 1] === '/' || path[end - 1] === '\\')) end -= 1;
211
+ return path.slice(0, end);
212
+ }
213
+
207
214
  /**
208
215
  * The `--dir`/name split of a positional that is really a path, or `undefined` when it is a name.
209
216
  *
@@ -212,10 +219,10 @@ function parentDir(cwd: string, dirFlag: string | undefined): string {
212
219
  */
213
220
  export function appNamePath(raw: string): { parent: string; base: string } | undefined {
214
221
  if (!/[\\/]/.test(raw)) return undefined;
215
- const trimmed = raw.replace(/[\\/]+$/, '');
222
+ const trimmed = withoutTrailingSeparators(raw);
216
223
  const segments = trimmed.split(/[\\/]+/).filter((segment) => segment.length > 0);
217
224
  const base = segments.at(-1) ?? 'myapp';
218
- const parent = trimmed.slice(0, trimmed.lastIndexOf(base)).replace(/[\\/]+$/, '');
225
+ const parent = withoutTrailingSeparators(trimmed.slice(0, trimmed.lastIndexOf(base)));
219
226
  // `x new ./shop` and `x new shop/` both name the directory the caller is already in; `/shop`
220
227
  // names the root, which is a directory and not "here".
221
228
  if (parent !== '' && parent !== '.') return { parent, base };
@@ -57,8 +57,21 @@ export const COMMAND_TOKENS: readonly RegExp[] = [
57
57
  * `${…}` holds a value only the throw site knows, so it is blanked before the rule runs. Without
58
58
  * this, `check egress to ${new URL(url).host}` reads as a call expression and passes as a command
59
59
  * — the interpolation would launder pure advice into an instruction.
60
+ *
61
+ * Two `indexOf` scans, never `/\$\{[^}]*\}/g`: that pattern re-scanned to the end from every
62
+ * unclosed `${`, quadratic on a line of them. No `}` after one `${` means none after any later one.
60
63
  */
61
- export const staticFix = (raw: string): string => raw.replaceAll(/\$\{[^}]*\}/g, '<value>');
64
+ export const staticFix = (raw: string): string => {
65
+ let out = '';
66
+ let from = 0;
67
+ for (let open = raw.indexOf('${'); open >= 0; open = raw.indexOf('${', from)) {
68
+ const close = raw.indexOf('}', open + 2);
69
+ if (close < 0) break;
70
+ out += `${raw.slice(from, open)}<value>`;
71
+ from = close + 1;
72
+ }
73
+ return out + raw.slice(from);
74
+ };
62
75
 
63
76
  /** The rule, on one fix line. `undefined` means it holds. */
64
77
  export function fixProblem(raw: string): string | undefined {
@@ -153,7 +153,9 @@ const UNITS: Readonly<Record<string, number>> = {
153
153
  * rather than a typo silently meaning "the default".
154
154
  */
155
155
  export const parseBytes = (raw: string): number | undefined => {
156
- const match = /^\s*(\d+(?:\.\d+)?)\s*([a-z]*)\s*$/i.exec(raw);
156
+ // Trimmed first: `\s*` on both sides of an optional unit split one run of spaces two ways, which
157
+ // was quadratic on a long one.
158
+ const match = /^(\d+(?:\.\d+)?)\s*([a-z]*)$/i.exec(raw.trim());
157
159
  if (match === null) return undefined;
158
160
  const unit = (match[2] ?? '').toLowerCase();
159
161
  if (!Object.hasOwn(UNITS, unit)) return undefined;
@@ -112,8 +112,11 @@ export const missingFileFinding = (dir: string, file: string, scaffolder: boolea
112
112
  * (`@ultimat3/core`'s `frameworkVersion()`, the CLI's `loadVersion()`, every dependency `x new` pins).
113
113
  * A manifest with no semver `version` therefore breaks the MCP handshake and every scaffold — so
114
114
  * the gate refuses the publish here, where the fix is one line, rather than at someone's install.
115
+ *
116
+ * One `[-+]` lead, then `+`-separated runs: `(?:[-+][\w.-]+)*` read the same strings, but `-` is
117
+ * in both the lead and the run, so a prerelease of `--` pairs backtracked exponentially.
115
118
  */
116
- export const SEMVER = /^\d+\.\d+\.\d+(?:[-+][\w.-]+)*$/;
119
+ export const SEMVER = /^\d+\.\d+\.\d+(?:[-+][\w.-]+(?:\+[\w.-]+)*)?$/;
117
120
 
118
121
  export const badVersionFinding = (dir: string, found: unknown): Finding => ({
119
122
  code: 'X_PACKAGE_SHAPE',
package/wiki/Money.md CHANGED
@@ -270,9 +270,11 @@ import { formatMoney } from '@ultimat3/money';
270
270
 
271
271
  ## An amount a person typed — `parseAmount`
272
272
 
273
- `As of 2026-11-06`. `parseAmount(text, { currency, locale })` reads the separators and digits of
273
+ `As of 2026-11-16`. `parseAmount(text, { currency, locale })` reads the separators and digits of
274
274
  the person's locale off `Intl.NumberFormat`, then hands the digits to `fromDecimal` as a string:
275
- no float, ever.
275
+ no float, ever. **Whatever `formatMoney` shows in that locale reads back to the same amount**:
276
+ every display (`symbol`, `code`, `narrowSymbol`) and `accounting`, held by
277
+ `packages/testing/src/property-money.test.ts`.
276
278
 
277
279
  | Text | Locale | Currency | Answer |
278
280
  |---|---|---|---|
@@ -283,9 +285,22 @@ no float, ever.
283
285
  | `1,234` | `en-US` | USD | 123400 |
284
286
  | `1,234` | `de-DE` | EUR | refused: three fraction digits, EUR has two |
285
287
  | `1.5` | `de-DE` | EUR | refused: `.` does not group as `de-DE` groups |
288
+ | `€ 1.234,56` or `1 234,56` | `de-AT` | EUR | 123456 — the price form and the plain-number form |
289
+ | `1'234.56 CHF` or `1'234,56` | `fr-CH` | CHF | 123456 |
290
+ | `ZAR 1 234,56` | `en-ZA` | ZAR | 123456 — the code is stripped before the symbol `R` inside it |
291
+ | `(USD 0.01)` | `en-US` | USD | -1 — the locale's accounting parentheses |
292
+ | `(1,00)` | `de-AT` | EUR | refused: `de-AT` writes no accounting parentheses |
293
+ | `1.234,56` | `en-DE` | EUR | refused: the currency form is `€1,234.56`, see below |
286
294
 
287
- The locale's currency symbol and the currency code are ignored, a sign is `-` or the locale's
288
- minus. Every refusal is `X_MONEY_INPUT_INVALID` (422), whose cause names the character: re-prompt
295
+ | Rule | Detail |
296
+ |---|---|
297
+ | Separator sets | every currency form's (decimal, group, grouping) first, the plain number's last. CLDR gives them apart: `de-AT` groups a price with `.` and a number with a no-break space; `mr-IN` and `en-IN`'s accounting form group a price the Western way |
298
+ | Never two amounts | a set whose group mark is an earlier set's decimal mark, or the reverse, is dropped. `en-DE` writes `€1,234.56` and the plain number `1.234,56`, so only the currency form reads there. Sets that agree on both marks cannot read one text two ways |
299
+ | Marks | the code, the symbol and the narrow symbol are ignored, longest first |
300
+ | Sign | `-`, the locale's minus, or the whole amount in parentheses where the locale's accounting form uses them; both at once is refused |
301
+ | Out of contract | `display: 'name'` (`1,234.56 US dollars`): the name is a plural phrase, not a mark. Ask for the amount and render the name beside the field |
302
+
303
+ Every refusal is `X_MONEY_INPUT_INVALID` (422), whose cause names the character: re-prompt
289
304
  the person, never round or guess.
290
305
 
291
306
  ## Where money appears in the framework