@nwire/cli 0.10.1 → 0.11.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/dist/cache-runner.js +15 -13
- package/dist/commands/cache.d.ts +21 -4
- package/dist/commands/cache.js +28 -6
- package/dist/commands/studio.js +1 -2
- package/package.json +4 -4
package/dist/cache-runner.js
CHANGED
|
@@ -31,12 +31,12 @@ async function main() {
|
|
|
31
31
|
// "App" means either:
|
|
32
32
|
// - `AppDefinition` (legacy `defineApp(name, { modules })`)
|
|
33
33
|
// - bootable `App` (modern `createApp({ modules })`)
|
|
34
|
-
//
|
|
35
|
-
//
|
|
34
|
+
// `createApp` returns an App marked with `$nwireApp: true`.
|
|
35
|
+
// Recognized export names:
|
|
36
36
|
// - allApps: App[] | apps: App[]
|
|
37
37
|
// - default: App | App[]
|
|
38
38
|
// - app: App
|
|
39
|
-
// - buildApp(): App | Promise<App> ←
|
|
39
|
+
// - buildApp(): App | Promise<App> ← factory pattern
|
|
40
40
|
// - bootstrap(): { app: App, ... } ← test-bootstrap pattern
|
|
41
41
|
// - bootstrap(opts): { app: App, ... }
|
|
42
42
|
//
|
|
@@ -143,8 +143,9 @@ async function main() {
|
|
|
143
143
|
const outDir = resolve(cwd, config.cacheDir ?? ".nwire");
|
|
144
144
|
await writeCache(cache, outDir);
|
|
145
145
|
// eslint-disable-next-line no-console
|
|
146
|
-
console.log(`nwire cache: wrote ${cache.apps.length} apps, ${cache.
|
|
146
|
+
console.log(`nwire cache: wrote ${cache.apps.length} apps, ${cache.plugins.length} plugins, ` +
|
|
147
147
|
`${cache.actions.length} actions, ${cache.events.length} events, ` +
|
|
148
|
+
`${cache.hooks.length} hooks, ${cache.sinks.length} sinks, ` +
|
|
148
149
|
`${cache.resolvers.length} resolvers to ${outDir}/`);
|
|
149
150
|
// Some bootstrap functions leave foreign-framework servers (Nest,
|
|
150
151
|
// Fastify) listening even after we tear down the Nwire side. Force
|
|
@@ -179,21 +180,22 @@ function findAppInResult(result) {
|
|
|
179
180
|
*/
|
|
180
181
|
function toAppDefinitionShape(x) {
|
|
181
182
|
const a = x;
|
|
183
|
+
const name = a.appName ?? a.name ?? "app";
|
|
182
184
|
return {
|
|
183
|
-
|
|
185
|
+
// Forward both fields — the scanner reads `appName`; legacy
|
|
186
|
+
// consumers may still read `name`.
|
|
187
|
+
name,
|
|
188
|
+
appName: name,
|
|
184
189
|
description: a.description,
|
|
185
|
-
modules: a.modules ?? [],
|
|
186
190
|
plugins: a.plugins ?? [],
|
|
187
|
-
// Forward operator commands defensively.
|
|
188
|
-
// `
|
|
189
|
-
//
|
|
190
|
-
// the scan emitter so `.nwire/commands.json` reflects ops surface.
|
|
191
|
+
// Forward operator commands defensively. Consumers who attach a
|
|
192
|
+
// `commands: defineCommand[]` to their app flow it through to the
|
|
193
|
+
// scan emitter so `.nwire/commands.json` reflects ops surface.
|
|
191
194
|
commands: a.commands ?? [],
|
|
192
195
|
tenantModel: a.tenantModel,
|
|
193
196
|
tenantKey: a.tenantKey,
|
|
194
|
-
// Forward the container so the scanner can walk `container.list()
|
|
195
|
-
//
|
|
196
|
-
// `createApp` exposes it directly.
|
|
197
|
+
// Forward the container so the scanner can walk `container.list()`,
|
|
198
|
+
// resolve the forge dispatcher, and emit DI bindings.
|
|
197
199
|
container: a.container ?? a.runtime?.container,
|
|
198
200
|
runtime: a.runtime,
|
|
199
201
|
};
|
package/dist/commands/cache.d.ts
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `nwire cache` —
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* `nwire cache` — refresh `.nwire/` cache.
|
|
3
|
+
*
|
|
4
|
+
* nwire cache # rebuild unconditionally (force)
|
|
5
|
+
* nwire cache --if-stale # only rebuild when the source fingerprint moved
|
|
6
|
+
*
|
|
7
|
+
* `--if-stale` is the cheap path Studio's middleware uses on every
|
|
8
|
+
* manifest request: when nothing changed, the fingerprint check skips
|
|
9
|
+
* the rebuild in a few ms; when it did, the cache catches up before
|
|
10
|
+
* Studio renders a single page.
|
|
5
11
|
*/
|
|
6
|
-
export declare const cacheCommand: import("citty").CommandDef<
|
|
12
|
+
export declare const cacheCommand: import("citty").CommandDef<{
|
|
13
|
+
"if-stale": {
|
|
14
|
+
type: "boolean";
|
|
15
|
+
description: string;
|
|
16
|
+
default: false;
|
|
17
|
+
};
|
|
18
|
+
quiet: {
|
|
19
|
+
type: "boolean";
|
|
20
|
+
description: string;
|
|
21
|
+
default: false;
|
|
22
|
+
};
|
|
23
|
+
}>;
|
package/dist/commands/cache.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `nwire cache` —
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* `nwire cache` — refresh `.nwire/` cache.
|
|
3
|
+
*
|
|
4
|
+
* nwire cache # rebuild unconditionally (force)
|
|
5
|
+
* nwire cache --if-stale # only rebuild when the source fingerprint moved
|
|
6
|
+
*
|
|
7
|
+
* `--if-stale` is the cheap path Studio's middleware uses on every
|
|
8
|
+
* manifest request: when nothing changed, the fingerprint check skips
|
|
9
|
+
* the rebuild in a few ms; when it did, the cache catches up before
|
|
10
|
+
* Studio renders a single page.
|
|
5
11
|
*/
|
|
6
12
|
import { defineCommand } from "citty";
|
|
7
13
|
import { ensureScanFresh } from "../lib/ensure-scan.js";
|
|
@@ -10,8 +16,24 @@ export const cacheCommand = defineCommand({
|
|
|
10
16
|
name: "cache",
|
|
11
17
|
description: "Rebuild .nwire/ cache (manifest + per-kind JSON)",
|
|
12
18
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
args: {
|
|
20
|
+
"if-stale": {
|
|
21
|
+
type: "boolean",
|
|
22
|
+
description: "Only rebuild when the source fingerprint moved.",
|
|
23
|
+
default: false,
|
|
24
|
+
},
|
|
25
|
+
quiet: {
|
|
26
|
+
type: "boolean",
|
|
27
|
+
description: "Suppress 'scanning project…' progress output.",
|
|
28
|
+
default: false,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
async run({ args }) {
|
|
32
|
+
const force = !args["if-stale"];
|
|
33
|
+
const result = ensureScanFresh(process.cwd(), { force, quiet: args.quiet });
|
|
34
|
+
// exit 0 when the cache is current — whether we just rebuilt it or
|
|
35
|
+
// the cheap-path skipped. exit 1 only when we tried to rebuild and
|
|
36
|
+
// the builder failed.
|
|
37
|
+
process.exit(result.rebuilt || !force ? 0 : 1);
|
|
16
38
|
},
|
|
17
39
|
});
|
package/dist/commands/studio.js
CHANGED
|
@@ -31,8 +31,7 @@ export const studioCommand = defineCommand({
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
studioDir =
|
|
34
|
-
tryResolveFrom(resolve(process.cwd(), "package.json")) ??
|
|
35
|
-
tryResolveFrom(import.meta.url);
|
|
34
|
+
tryResolveFrom(resolve(process.cwd(), "package.json")) ?? tryResolveFrom(import.meta.url);
|
|
36
35
|
if (!studioDir) {
|
|
37
36
|
// eslint-disable-next-line no-console
|
|
38
37
|
console.error(palette.err("nwire studio:") +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nwire/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Nwire CLI — branded TUI. Dev, run, please, build, test, fmt, lint, check, ps, logs, cache, ls, studio. One surface for the whole framework.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"listr2": "^9.0.4",
|
|
37
37
|
"picocolors": "^1.1.1",
|
|
38
38
|
"react": "^18.3.1",
|
|
39
|
-
"@nwire/
|
|
40
|
-
"@nwire/scan": "0.
|
|
41
|
-
"@nwire/
|
|
39
|
+
"@nwire/hooks": "0.11.0",
|
|
40
|
+
"@nwire/scan": "0.11.0",
|
|
41
|
+
"@nwire/mcp": "0.11.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^22.19.9",
|