@nwire/please 0.12.1 → 0.13.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/dist/define-command.d.ts +0 -3
- package/dist/define-command.js +0 -3
- package/dist/please.js +19 -6
- package/package.json +5 -5
package/dist/define-command.d.ts
CHANGED
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
* pushes ops scripts to the layer they belong on.
|
|
23
23
|
*/
|
|
24
24
|
import type { App } from "@nwire/app";
|
|
25
|
-
import type { SourceLocation } from "@nwire/messages";
|
|
26
25
|
/**
|
|
27
26
|
* Minimal zod-like schema contract — anything with `.parse(input) → output`.
|
|
28
27
|
* Lets `defineCommand` accept a real `z.object({...})` schema, a plain `{}`
|
|
@@ -67,7 +66,5 @@ export interface CommandDefinition<TSchema extends CommandArgsSchema | undefined
|
|
|
67
66
|
readonly describe?: string;
|
|
68
67
|
readonly args?: TSchema;
|
|
69
68
|
readonly handler: CommandHandler<TSchema extends CommandArgsSchema<infer T> ? T : Record<string, unknown>>;
|
|
70
|
-
/** Where the command was declared. Studio/Hooks page uses this for IDE links. */
|
|
71
|
-
readonly $source?: SourceLocation;
|
|
72
69
|
}
|
|
73
70
|
export declare function defineCommand<TSchema extends CommandArgsSchema | undefined = undefined>(name: string, meta: CommandMeta<TSchema>): CommandDefinition<TSchema>;
|
package/dist/define-command.js
CHANGED
|
@@ -21,15 +21,12 @@
|
|
|
21
21
|
* back to the action/query surface. This keeps the action graph clean and
|
|
22
22
|
* pushes ops scripts to the layer they belong on.
|
|
23
23
|
*/
|
|
24
|
-
import { captureSourceLocation } from "@nwire/messages";
|
|
25
24
|
export function defineCommand(name, meta) {
|
|
26
|
-
const $source = captureSourceLocation();
|
|
27
25
|
return {
|
|
28
26
|
$kind: "command",
|
|
29
27
|
name,
|
|
30
28
|
describe: meta.describe,
|
|
31
29
|
args: meta.args,
|
|
32
30
|
handler: meta.handler,
|
|
33
|
-
$source,
|
|
34
31
|
};
|
|
35
32
|
}
|
package/dist/please.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Dispatches against any registered action/query in any provided app, or
|
|
11
11
|
* a named operator-script command.
|
|
12
12
|
*/
|
|
13
|
-
import { runCli,
|
|
13
|
+
import { runCli, FORGE_ACTION_RUNNER_BINDING, FORGE_QUERY_RUNNER_BINDING, } from "@nwire/forge";
|
|
14
14
|
export async function runPlease(options) {
|
|
15
15
|
const instances = options.apps;
|
|
16
16
|
await Promise.all(instances.map((a) => a.start()));
|
|
@@ -124,9 +124,23 @@ function coerceFlag(value) {
|
|
|
124
124
|
return Number(value);
|
|
125
125
|
return value;
|
|
126
126
|
}
|
|
127
|
+
/** Resolve a forge runner binding, returning undefined when it isn't installed. */
|
|
128
|
+
function tryRunner(app, binding) {
|
|
129
|
+
try {
|
|
130
|
+
return app.container.resolve(binding);
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function actionNames(app) {
|
|
137
|
+
return tryRunner(app, FORGE_ACTION_RUNNER_BINDING)?.listHandlers() ?? [];
|
|
138
|
+
}
|
|
139
|
+
function queryNames(app) {
|
|
140
|
+
return tryRunner(app, FORGE_QUERY_RUNNER_BINDING)?.listQueries() ?? [];
|
|
141
|
+
}
|
|
127
142
|
function actionOrQueryNames(app) {
|
|
128
|
-
|
|
129
|
-
return [...dispatcher.listHandlers(), ...dispatcher.listQueries()];
|
|
143
|
+
return [...actionNames(app), ...queryNames(app)];
|
|
130
144
|
}
|
|
131
145
|
function printAllHelp(instances, commands, out) {
|
|
132
146
|
out("please — Nwire operator CLI\n");
|
|
@@ -140,10 +154,9 @@ function printAllHelp(instances, commands, out) {
|
|
|
140
154
|
}
|
|
141
155
|
for (const app of instances) {
|
|
142
156
|
out(`# App: ${app.appName}`);
|
|
143
|
-
const
|
|
144
|
-
for (const name of dispatcher.listHandlers())
|
|
157
|
+
for (const name of actionNames(app))
|
|
145
158
|
out(` ${name}`);
|
|
146
|
-
for (const name of
|
|
159
|
+
for (const name of queryNames(app))
|
|
147
160
|
out(` ${name}`);
|
|
148
161
|
out("");
|
|
149
162
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nwire/please",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Nwire — operator CLI. runPlease dispatches actions/queries by name across all registered apps; --tenant for tenant scoping; --help lists everything.
|
|
3
|
+
"version": "0.13.1",
|
|
4
|
+
"description": "Nwire — operator CLI. runPlease dispatches actions/queries by name across all registered apps; --tenant for tenant scoping; --help lists everything.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ace",
|
|
7
7
|
"artisan",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@nwire/app": "0.
|
|
32
|
-
"@nwire/forge": "0.
|
|
33
|
-
"@nwire/messages": "0.
|
|
31
|
+
"@nwire/app": "0.13.1",
|
|
32
|
+
"@nwire/forge": "0.13.1",
|
|
33
|
+
"@nwire/messages": "0.13.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^22.19.9",
|