@ultimat3/cli 31.40.0 → 31.40.1
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 +29 -29
- package/src/cmd-new-spec.ts +4 -2
- package/src/cmd-new-target.ts +51 -9
- package/src/cmd-new.ts +1 -0
- package/src/messages.ts +3 -0
- package/wiki/CLI-Reference.md +2 -2
- package/wiki/Installation.md +1 -1
- package/wiki/Realtime.md +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/cli",
|
|
3
|
-
"version": "31.40.
|
|
3
|
+
"version": "31.40.1",
|
|
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.40.
|
|
57
|
-
"@ultimat3/admin": "31.40.
|
|
58
|
-
"@ultimat3/ai": "31.40.
|
|
59
|
-
"@ultimat3/auth": "31.40.
|
|
60
|
-
"@ultimat3/cache": "31.40.
|
|
61
|
-
"@ultimat3/core": "31.40.
|
|
62
|
-
"@ultimat3/db": "31.40.
|
|
63
|
-
"@ultimat3/entity": "31.40.
|
|
64
|
-
"@ultimat3/flags": "31.40.
|
|
65
|
-
"@ultimat3/http": "31.40.
|
|
66
|
-
"@ultimat3/i18n": "31.40.
|
|
67
|
-
"@ultimat3/jobs": "31.40.
|
|
68
|
-
"@ultimat3/mail": "31.40.
|
|
69
|
-
"@ultimat3/manifest": "31.40.
|
|
70
|
-
"@ultimat3/mcp": "31.40.
|
|
71
|
-
"@ultimat3/money": "31.40.
|
|
72
|
-
"@ultimat3/notify": "31.40.
|
|
73
|
-
"@ultimat3/policy": "31.40.
|
|
74
|
-
"@ultimat3/pwa": "31.40.
|
|
75
|
-
"@ultimat3/query": "31.40.
|
|
76
|
-
"@ultimat3/realtime": "31.40.
|
|
77
|
-
"@ultimat3/render": "31.40.
|
|
78
|
-
"@ultimat3/schema": "31.40.
|
|
79
|
-
"@ultimat3/scraping": "31.40.
|
|
80
|
-
"@ultimat3/seo": "31.40.
|
|
81
|
-
"@ultimat3/storage": "31.40.
|
|
82
|
-
"@ultimat3/testing": "31.40.
|
|
83
|
-
"@ultimat3/time": "31.40.
|
|
56
|
+
"@ultimat3/action": "31.40.1",
|
|
57
|
+
"@ultimat3/admin": "31.40.1",
|
|
58
|
+
"@ultimat3/ai": "31.40.1",
|
|
59
|
+
"@ultimat3/auth": "31.40.1",
|
|
60
|
+
"@ultimat3/cache": "31.40.1",
|
|
61
|
+
"@ultimat3/core": "31.40.1",
|
|
62
|
+
"@ultimat3/db": "31.40.1",
|
|
63
|
+
"@ultimat3/entity": "31.40.1",
|
|
64
|
+
"@ultimat3/flags": "31.40.1",
|
|
65
|
+
"@ultimat3/http": "31.40.1",
|
|
66
|
+
"@ultimat3/i18n": "31.40.1",
|
|
67
|
+
"@ultimat3/jobs": "31.40.1",
|
|
68
|
+
"@ultimat3/mail": "31.40.1",
|
|
69
|
+
"@ultimat3/manifest": "31.40.1",
|
|
70
|
+
"@ultimat3/mcp": "31.40.1",
|
|
71
|
+
"@ultimat3/money": "31.40.1",
|
|
72
|
+
"@ultimat3/notify": "31.40.1",
|
|
73
|
+
"@ultimat3/policy": "31.40.1",
|
|
74
|
+
"@ultimat3/pwa": "31.40.1",
|
|
75
|
+
"@ultimat3/query": "31.40.1",
|
|
76
|
+
"@ultimat3/realtime": "31.40.1",
|
|
77
|
+
"@ultimat3/render": "31.40.1",
|
|
78
|
+
"@ultimat3/schema": "31.40.1",
|
|
79
|
+
"@ultimat3/scraping": "31.40.1",
|
|
80
|
+
"@ultimat3/seo": "31.40.1",
|
|
81
|
+
"@ultimat3/storage": "31.40.1",
|
|
82
|
+
"@ultimat3/testing": "31.40.1",
|
|
83
|
+
"@ultimat3/time": "31.40.1",
|
|
84
84
|
"babel-preset-solid": "^1.9.16"
|
|
85
85
|
}
|
|
86
86
|
}
|
package/src/cmd-new-spec.ts
CHANGED
|
@@ -38,8 +38,10 @@ export const newSpec: CommandSpec = {
|
|
|
38
38
|
{
|
|
39
39
|
name: 'force',
|
|
40
40
|
type: 'boolean',
|
|
41
|
-
// Never over an app: `cmd-new-target.ts` refuses a directory holding
|
|
42
|
-
|
|
41
|
+
// Never over an app, never over a file: `cmd-new-target.ts` refuses a directory holding
|
|
42
|
+
// `app.config.ts` (D1) or any path the scaffold writes (round 3).
|
|
43
|
+
summary:
|
|
44
|
+
'write into an existing directory that holds no app.config.ts and none of the files x new writes',
|
|
43
45
|
},
|
|
44
46
|
],
|
|
45
47
|
};
|
package/src/cmd-new-target.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// `x new`'s refusal of a target directory that already exists. Its fix names a FREE directory —
|
|
2
2
|
// never `--force`: a fix is pasted with no diff in front of it, and `--force` over an existing app
|
|
3
|
-
// reset its `api/index.ts` and `roles.ts` to the template (D1, 2026-11-16).
|
|
3
|
+
// reset its `api/index.ts` and `roles.ts` to the template (D1, 2026-11-16). `--force` writes only
|
|
4
|
+
// into free paths: one planned path already on disk refuses the run (round 3, 2026-11-16).
|
|
4
5
|
|
|
5
|
-
// why: the target is a DIRECTORY, which `Bun.file().exists()` answers false for
|
|
6
|
-
|
|
6
|
+
// why: the target is a DIRECTORY, which `Bun.file().exists()` answers false for; `lstatSync`
|
|
7
|
+
// also sees a dangling symlink, which `Bun.write` would write through.
|
|
8
|
+
import { existsSync, lstatSync } from 'node:fs';
|
|
7
9
|
// why: Bun ships no path API; `dirname`/`join` place the sibling the fix names.
|
|
8
10
|
import { dirname, join } from 'node:path';
|
|
9
11
|
import { ERROR_DOCS_URL } from '@ultimat3/core';
|
|
@@ -37,29 +39,69 @@ export interface NewTarget {
|
|
|
37
39
|
readonly invocation: string;
|
|
38
40
|
/** The caller's flags as `reproducedFlags` spells them; `--force` is dropped here. */
|
|
39
41
|
readonly flags: readonly string[];
|
|
42
|
+
/** `planNewApp`'s paths, relative to `target`: what `--force` would write. */
|
|
43
|
+
readonly planned: readonly string[];
|
|
40
44
|
}
|
|
41
45
|
|
|
46
|
+
/** How many colliding paths the cause spells out before it counts the rest. */
|
|
47
|
+
const LISTED_COLLISIONS = 5;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The planned paths `--force` would overwrite: the path itself on disk (file, directory or link),
|
|
51
|
+
* or one of its parent segments on disk as something other than a directory.
|
|
52
|
+
*/
|
|
53
|
+
export function collisions(target: string, planned: readonly string[]): readonly string[] {
|
|
54
|
+
const hit = new Set<string>();
|
|
55
|
+
for (const path of planned) {
|
|
56
|
+
const segments = path.split('/');
|
|
57
|
+
for (let i = 1; i <= segments.length; i += 1) {
|
|
58
|
+
const prefix = segments.slice(0, i).join('/');
|
|
59
|
+
const stat = lstatSync(join(target, prefix), { throwIfNoEntry: false });
|
|
60
|
+
if (stat === undefined) break;
|
|
61
|
+
if (i === segments.length || !stat.isDirectory()) {
|
|
62
|
+
hit.add(prefix);
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return [...hit].sort();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const listed = (paths: readonly string[]): string => {
|
|
71
|
+
const head = paths.slice(0, LISTED_COLLISIONS).join(', ');
|
|
72
|
+
const rest = paths.length - LISTED_COLLISIONS;
|
|
73
|
+
return rest > 0 ? `${head} and ${rest} more` : head;
|
|
74
|
+
};
|
|
75
|
+
|
|
42
76
|
/**
|
|
43
77
|
* The refusal of an existing target, before a byte is written — `undefined` when the run may go on.
|
|
44
|
-
* `--force` lifts it only for a directory that holds no `app.config.ts`
|
|
45
|
-
*
|
|
46
|
-
*
|
|
78
|
+
* `--force` lifts it only for a directory that holds no `app.config.ts` and none of the planned
|
|
79
|
+
* paths — a fresh clone the platform scaffolds into (`.git`, a `LICENSE`). Over an app it would
|
|
80
|
+
* reset every file the template also writes; over a monorepo root, its `package.json` and
|
|
81
|
+
* `README.md`. A result, not a throw, so the summary says which it was.
|
|
47
82
|
*/
|
|
48
83
|
export function targetConflict(input: NewTarget): CommandResult | undefined {
|
|
49
84
|
const { target, slug, force, invocation, flags } = input;
|
|
50
85
|
if (!existsSync(target)) return undefined;
|
|
51
86
|
const holdsApp = existsSync(join(target, 'app.config.ts'));
|
|
52
|
-
|
|
87
|
+
const taken = force && !holdsApp ? collisions(target, input.planned) : [];
|
|
88
|
+
if (force && !holdsApp && taken.length === 0) return undefined;
|
|
53
89
|
return {
|
|
54
90
|
ok: false,
|
|
55
91
|
command: 'new',
|
|
56
|
-
summary:
|
|
92
|
+
summary: holdsApp
|
|
93
|
+
? msg('cli.new.existsApp', { dir: target })
|
|
94
|
+
: taken.length > 0
|
|
95
|
+
? msg('cli.new.existsFiles', { dir: target, count: taken.length })
|
|
96
|
+
: msg('cli.new.exists', { dir: target }),
|
|
57
97
|
findings: [
|
|
58
98
|
{
|
|
59
99
|
code: 'X_GENERATE_CONFLICT',
|
|
60
100
|
cause: holdsApp
|
|
61
101
|
? `${target} already exists and holds an app (app.config.ts): scaffolding into it, --force included, would reset its registrations and grants to the template, so x new refuses it`
|
|
62
|
-
:
|
|
102
|
+
: taken.length > 0
|
|
103
|
+
? `${target} already holds ${taken.length} path(s) x new would write: ${listed(taken)}. --force writes only into free paths, so nothing was written — move each aside (mv -n ${quoteArg(taken[0] ?? '')} ${quoteArg(`${taken[0] ?? ''}.orig`)}, …) and run with --force again to scaffold here, or take a free name for a fresh app`
|
|
104
|
+
: `${target} already exists and holds no app.config.ts — --force writes the scaffold into it only when none of its paths are taken, a free name writes a fresh app`,
|
|
63
105
|
fix: [
|
|
64
106
|
invocation,
|
|
65
107
|
quoteArg(freeSibling(target, slug) ?? '<another-name>'),
|
package/src/cmd-new.ts
CHANGED
|
@@ -315,6 +315,7 @@ export const newCommand: CliCommand = {
|
|
|
315
315
|
force: flagBool(ctx.args, 'force'),
|
|
316
316
|
invocation: invocationOf(ctx, 'new'),
|
|
317
317
|
flags: callerFlags(ctx),
|
|
318
|
+
planned: planNewApp(options).map((file) => file.path),
|
|
318
319
|
});
|
|
319
320
|
if (conflict !== undefined) return conflict;
|
|
320
321
|
// Read BEFORE writing: `--force` into a directory that already held files must never
|
package/src/messages.ts
CHANGED
|
@@ -226,6 +226,9 @@ const CATALOG = {
|
|
|
226
226
|
'cli.new.exists': '{dir} already exists — nothing was written',
|
|
227
227
|
'cli.new.existsApp':
|
|
228
228
|
'{dir} already holds an app — x new never scaffolds over one, --force included',
|
|
229
|
+
// `--force` over a directory that already holds paths the scaffold writes: refused, not overwritten.
|
|
230
|
+
'cli.new.existsFiles':
|
|
231
|
+
'{dir} already holds {count} of the files x new writes — nothing was written, --force included',
|
|
229
232
|
'cli.new.wrote': ' {count} files in {dir}',
|
|
230
233
|
'cli.new.noRepository': ' no repository — {problem}',
|
|
231
234
|
// `git init` ran and the commit did not: `.git` exists, so "no repository" was false.
|
package/wiki/CLI-Reference.md
CHANGED
|
@@ -87,7 +87,7 @@ x new <name> [--dir path] [--shape api|blog|dashboard] [--no-example] [--no-git]
|
|
|
87
87
|
| `--shape` | string | none | start from an app shape — `api`, `blog` or `dashboard`, each an overlay over this scaffold ([Shapes](Shapes)). An unknown name is `X_NEW_SHAPE_UNKNOWN`; with `--no-example`, `X_NEW_SHAPE_CONFLICT` (a shape is its own example). Both refuse before a file is written. `dashboard` then runs `x g sign-in --password` in the new app (listed under `data.generate` by `--dry-run`); a refusal there is `X_NEW_SHAPE_GENERATE_FAILED` |
|
|
88
88
|
| `--git` / `--no-git` | boolean | `true` | `git init`, then one commit named `x new`. On by default because three surfaces assume a repository — `x affected`, `x ci` and `x pr`. A git that is absent or fails never fails `x new`: the tree is the verdict, and `data.git` carries `{ initialized, committed, problem }` |
|
|
89
89
|
| `--dry-run` | boolean | `false` | print the file list, write nothing |
|
|
90
|
-
| `--force` | boolean | `false` | write into a directory that already exists and holds no `app.config.ts`. Over an app it is refused, `--force` included (`X_GENERATE_CONFLICT`), and the fix names a free directory (`<name>-2`), never `--force`. `As of 2026-11` |
|
|
90
|
+
| `--force` | boolean | `false` | write into a directory that already exists and holds no `app.config.ts`, only into free paths: one path the scaffold would write already on disk (`README.md`, `package.json`, `.gitignore`, …) refuses the run before a byte is written — `X_GENERATE_CONFLICT`, the first five taken paths and a count in `cause`, the same free-directory fix. Never an overwrite. A fresh clone holding `.git` and a `LICENSE` scaffolds. Over an app it is refused, `--force` included (`X_GENERATE_CONFLICT`), and the fix names a free directory (`<name>-2`), never `--force`. `As of 2026-11` |
|
|
91
91
|
|
|
92
92
|
**The name must be one `app.config.ts` accepts.** `x new` asks core's own `defineConfig` about the slug before anything is planned (`appNameIssue`, `packages/cli/src/app-name.ts`) — it is written verbatim as `name:`. Refused with `X_CLI_BAD_FLAG` and a corrected name in the `fix:`, the rest of your flags kept:
|
|
93
93
|
|
|
@@ -127,7 +127,7 @@ Deployment artifacts are part of the scaffold — an app is deployable the momen
|
|
|
127
127
|
|
|
128
128
|
The framework repo's own `docker/helm` carries one template the scaffold does not — `pdb.yaml`, cluster policy rather than app topology. It ships in no npm tarball, so copying it is a `git clone` of this repo, not an install. An app chart from before the monitoring pair gets it from `x g chart-alerts`.
|
|
129
129
|
|
|
130
|
-
`bunx create-ultimate myapp` is the same generator without a global install — and it says so in its own refusals, `As of 2026-08-23`: a `fix:` line is a command the reader is meant to RUN, and `x new myapp` named a binary they have not installed yet. Errors: `X_GENERATE_CONFLICT` (the directory exists — `fix` is the same command with `--force`), `X_CLI_BAD_FLAG` (no name given, or a path where a name goes), `X_BUN_VERSION`.
|
|
130
|
+
`bunx create-ultimate myapp` is the same generator without a global install — and it says so in its own refusals, `As of 2026-08-23`: a `fix:` line is a command the reader is meant to RUN, and `x new myapp` named a binary they have not installed yet. Errors: `X_GENERATE_CONFLICT` (the directory exists — `fix` is the same command with a free name, `<name>-2`; never `--force`), `X_CLI_BAD_FLAG` (no name given, or a path where a name goes), `X_BUN_VERSION`.
|
|
131
131
|
|
|
132
132
|
## x dev
|
|
133
133
|
|
package/wiki/Installation.md
CHANGED
|
@@ -69,7 +69,7 @@ one.
|
|
|
69
69
|
| `--shape <shape>` | none | start from `api`, `blog` or `dashboard` instead of the dashboard and example slice — what each writes and leaves out: [Shapes](Shapes) |
|
|
70
70
|
| `--git` / `--no-git` | `--git` | `git init` and commit the scaffold |
|
|
71
71
|
| `--dry-run` | off | print the file list, write nothing |
|
|
72
|
-
| `--force` | off | write into a directory that already exists
|
|
72
|
+
| `--force` | off | write into a directory that already exists, holds no `app.config.ts` and none of the paths the scaffold writes (a fresh clone: `.git`, a `LICENSE`); one taken path (`README.md`, `package.json`, …) refuses the run with `X_GENERATE_CONFLICT` naming them, nothing written — never an overwrite |
|
|
73
73
|
| `--json` | off | machine-readable result: the directory, every path written, the git outcome |
|
|
74
74
|
|
|
75
75
|
There is **no** `--admin`, `--locale`, `--tz`, `--currency`, `--no-install` or `--yes` — this table
|
package/wiki/Realtime.md
CHANGED
|
@@ -368,6 +368,16 @@ plan-101 DX ledger #21.
|
|
|
368
368
|
| the browser | `useChannel(decl, params, handlers?)`; `topic()` is the one way to spell a topic, and `bun run channel-literals` refuses any other |
|
|
369
369
|
| the manifest | lists every channel (`describeChannels`, on `@ultimat3/realtime/server`). In a contract diff these are **breaking**: a channel removed, its params changed, its policy changed, a record type no longer carried, `events` switched off |
|
|
370
370
|
|
|
371
|
+
### A tenant param is the subscriber's org
|
|
372
|
+
|
|
373
|
+
`As of 2026-11-17` (31.41.0). A channel param that names a records entity's tenant column — `orgId` on
|
|
374
|
+
`records: [posts]` — must equal the subscribing actor's org, checked by the hub before the policy
|
|
375
|
+
runs: the topic `org-feed.<orgId>` IS that org's stream of records, events and presence. Another
|
|
376
|
+
org's value is `X_TOPIC_FORBIDDEN` (cause `X_TENANCY_ACTOR_MISMATCH`), an actor with no org
|
|
377
|
+
`X_TENANCY_ACTOR_ORG_REQUIRED`, a proven `crossTenant()` scope passes. So `policy: can('post:read')`
|
|
378
|
+
is enough: the policy decides the permission, the mechanism decides the tenant — the same split an
|
|
379
|
+
HTTP read has.
|
|
380
|
+
|
|
371
381
|
## A channel event re-reads the page
|
|
372
382
|
|
|
373
383
|
`As of 30.0.0`. For a server-rendered page with nothing to push but "this changed": the channel
|