appduct 0.9.0 → 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/README.md +122 -52
- package/dist/artifact-inspect.d.ts +5 -4
- package/dist/bin.d.ts +0 -1
- package/dist/bin.js +1250 -2
- package/dist/cli/command-options.d.ts +8 -1
- package/dist/cli/create-cli.d.ts +0 -1
- package/dist/cli/dispatch.d.ts +10 -1
- package/dist/cli/envelope.d.ts +19 -0
- package/dist/cli/global-flags.d.ts +30 -0
- package/dist/cli/open-target.d.ts +25 -8
- package/dist/cli/result-types.d.ts +30 -5
- package/dist/cli/router.d.ts +78 -0
- package/dist/cli/routes/daemon/index.d.ts +9 -0
- package/dist/cli/routes/daemon/index.js +848 -0
- package/dist/cli/routes/daemon/run.d.ts +3 -0
- package/dist/cli/routes/daemon/run.js +3246 -0
- package/dist/cli/routes/daemon/start.d.ts +3 -0
- package/dist/cli/routes/daemon/start.js +1668 -0
- package/dist/cli/routes/daemon/status.d.ts +4 -0
- package/dist/cli/routes/daemon/status.js +1676 -0
- package/dist/cli/routes/daemon/stop.d.ts +4 -0
- package/dist/cli/routes/daemon/stop.js +1646 -0
- package/dist/cli/routes/doctor.d.ts +3 -0
- package/dist/cli/routes/doctor.js +1075 -0
- package/dist/cli/routes/events.d.ts +3 -0
- package/dist/cli/routes/events.js +1906 -0
- package/dist/cli/routes/init.d.ts +3 -0
- package/dist/cli/routes/init.js +1486 -0
- package/dist/cli/routes/invoke.d.ts +3 -0
- package/dist/cli/routes/invoke.js +1884 -0
- package/dist/cli/routes/keygen.d.ts +3 -0
- package/dist/cli/routes/keygen.js +928 -0
- package/dist/cli/routes/link.d.ts +3 -0
- package/dist/cli/routes/link.js +2705 -0
- package/dist/cli/routes/ls.d.ts +3 -0
- package/dist/cli/routes/ls.js +1659 -0
- package/dist/cli/routes/mcp.d.ts +5 -0
- package/dist/cli/routes/mcp.js +3917 -0
- package/dist/cli/routes/revoke.d.ts +3 -0
- package/dist/cli/routes/revoke.js +1675 -0
- package/dist/cli/routes/tools.d.ts +3 -0
- package/dist/cli/routes/tools.js +1851 -0
- package/dist/cli/runner.d.ts +3 -11
- package/dist/cli/types.d.ts +9 -6
- package/dist/cli/version-guard.d.ts +20 -0
- package/dist/cli.d.ts +0 -1
- package/dist/client/app-client.d.ts +0 -1
- package/dist/client/bootstrap.d.ts +4 -4
- package/dist/client/connect.d.ts +0 -1
- package/dist/client/errors.d.ts +0 -1
- package/dist/client/index.d.ts +0 -1
- package/dist/client/index.js +2379 -16
- package/dist/commands/daemon/context.d.ts +14 -0
- package/dist/commands/daemon/run.d.ts +11 -0
- package/dist/commands/daemon/start.d.ts +5 -0
- package/dist/commands/daemon/status.d.ts +5 -0
- package/dist/commands/daemon/stop.d.ts +5 -0
- package/dist/commands/doctor.d.ts +0 -1
- package/dist/commands/events.d.ts +0 -1
- package/dist/commands/init.d.ts +17 -4
- package/dist/commands/invoke.d.ts +0 -1
- package/dist/commands/keygen.d.ts +0 -1
- package/dist/commands/link.d.ts +1 -2
- package/dist/commands/ls.d.ts +0 -1
- package/dist/commands/mcp.d.ts +2 -4
- package/dist/commands/revoke.d.ts +0 -1
- package/dist/commands/tools.d.ts +19 -3
- package/dist/daemon/address.d.ts +0 -1
- package/dist/daemon/audit.d.ts +6 -11
- package/dist/daemon/calls.d.ts +0 -1
- package/dist/daemon/config.d.ts +13 -16
- package/dist/daemon/daemon.d.ts +0 -1
- package/dist/daemon/event-bus.d.ts +0 -1
- package/dist/daemon/links.d.ts +0 -1
- package/dist/daemon/listener.d.ts +0 -1
- package/dist/daemon/log-rotation.d.ts +0 -1
- package/dist/daemon/pidfile.d.ts +14 -8
- package/dist/daemon/policy.d.ts +0 -1
- package/dist/daemon/registry.d.ts +0 -1
- package/dist/daemon/rpc-errors.d.ts +16 -0
- package/dist/daemon/rpc-server.d.ts +0 -11
- package/dist/daemon/sessions.d.ts +0 -1
- package/dist/daemon/socket-probe.d.ts +0 -1
- package/dist/daemon/state-dir.d.ts +0 -1
- package/dist/daemon/timers.d.ts +0 -1
- package/dist/daemon/tls.d.ts +0 -1
- package/dist/errors.d.ts +0 -1
- package/dist/host-certificate.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1307 -3
- package/dist/key-material.d.ts +0 -1
- package/dist/link.d.ts +8 -7
- package/dist/mcp/app-tools.d.ts +153 -0
- package/dist/mcp/connect-tool.d.ts +14 -8
- package/dist/mcp/daemon-tools.d.ts +2 -11
- package/dist/mcp/events-tool.d.ts +0 -1
- package/dist/mcp/server.d.ts +33 -14
- package/dist/native-scheme.d.ts +0 -1
- package/dist/output.d.ts +8 -11
- package/dist/package-root.d.ts +11 -0
- package/dist/package-version.d.ts +0 -1
- package/dist/qr-terminal.d.ts +0 -1
- package/dist/rpc/client.d.ts +0 -1
- package/dist/scheme.d.ts +60 -2
- package/dist/spki-pin.d.ts +0 -1
- package/package.json +4 -3
- package/dist/artifact-inspect.d.ts.map +0 -1
- package/dist/artifact-inspect.js +0 -315
- package/dist/bin.d.ts.map +0 -1
- package/dist/cli/command-options.d.ts.map +0 -1
- package/dist/cli/command-options.js +0 -95
- package/dist/cli/create-cli.d.ts.map +0 -1
- package/dist/cli/create-cli.js +0 -56
- package/dist/cli/dispatch.d.ts.map +0 -1
- package/dist/cli/dispatch.js +0 -275
- package/dist/cli/open-target.d.ts.map +0 -1
- package/dist/cli/open-target.js +0 -438
- package/dist/cli/result-types.d.ts.map +0 -1
- package/dist/cli/result-types.js +0 -6
- package/dist/cli/runner.d.ts.map +0 -1
- package/dist/cli/runner.js +0 -111
- package/dist/cli/types.d.ts.map +0 -1
- package/dist/cli/types.js +0 -10
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -2
- package/dist/client/app-client.d.ts.map +0 -1
- package/dist/client/app-client.js +0 -223
- package/dist/client/bootstrap.d.ts.map +0 -1
- package/dist/client/bootstrap.js +0 -108
- package/dist/client/connect.d.ts.map +0 -1
- package/dist/client/connect.js +0 -38
- package/dist/client/errors.d.ts.map +0 -1
- package/dist/client/errors.js +0 -40
- package/dist/client/index.d.ts.map +0 -1
- package/dist/commands/daemon.d.ts +0 -22
- package/dist/commands/daemon.d.ts.map +0 -1
- package/dist/commands/daemon.js +0 -128
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js +0 -42
- package/dist/commands/events.d.ts.map +0 -1
- package/dist/commands/events.js +0 -76
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -231
- package/dist/commands/invoke.d.ts.map +0 -1
- package/dist/commands/invoke.js +0 -54
- package/dist/commands/keygen.d.ts.map +0 -1
- package/dist/commands/keygen.js +0 -46
- package/dist/commands/link.d.ts.map +0 -1
- package/dist/commands/link.js +0 -43
- package/dist/commands/ls.d.ts.map +0 -1
- package/dist/commands/ls.js +0 -7
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js +0 -98
- package/dist/commands/revoke.d.ts.map +0 -1
- package/dist/commands/revoke.js +0 -7
- package/dist/commands/tools.d.ts.map +0 -1
- package/dist/commands/tools.js +0 -52
- package/dist/daemon/address.d.ts.map +0 -1
- package/dist/daemon/address.js +0 -71
- package/dist/daemon/audit.d.ts.map +0 -1
- package/dist/daemon/audit.js +0 -237
- package/dist/daemon/calls.d.ts.map +0 -1
- package/dist/daemon/calls.js +0 -158
- package/dist/daemon/config.d.ts.map +0 -1
- package/dist/daemon/config.js +0 -170
- package/dist/daemon/daemon.d.ts.map +0 -1
- package/dist/daemon/daemon.js +0 -560
- package/dist/daemon/event-bus.d.ts.map +0 -1
- package/dist/daemon/event-bus.js +0 -111
- package/dist/daemon/links.d.ts.map +0 -1
- package/dist/daemon/links.js +0 -118
- package/dist/daemon/listener.d.ts.map +0 -1
- package/dist/daemon/listener.js +0 -132
- package/dist/daemon/log-rotation.d.ts.map +0 -1
- package/dist/daemon/log-rotation.js +0 -136
- package/dist/daemon/pidfile.d.ts.map +0 -1
- package/dist/daemon/pidfile.js +0 -90
- package/dist/daemon/policy.d.ts.map +0 -1
- package/dist/daemon/policy.js +0 -24
- package/dist/daemon/registry.d.ts.map +0 -1
- package/dist/daemon/registry.js +0 -31
- package/dist/daemon/rpc-server.d.ts.map +0 -1
- package/dist/daemon/rpc-server.js +0 -203
- package/dist/daemon/sessions.d.ts.map +0 -1
- package/dist/daemon/sessions.js +0 -429
- package/dist/daemon/socket-probe.d.ts.map +0 -1
- package/dist/daemon/socket-probe.js +0 -28
- package/dist/daemon/state-dir.d.ts.map +0 -1
- package/dist/daemon/state-dir.js +0 -43
- package/dist/daemon/timers.d.ts.map +0 -1
- package/dist/daemon/timers.js +0 -12
- package/dist/daemon/tls.d.ts.map +0 -1
- package/dist/daemon/tls.js +0 -79
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -162
- package/dist/host-certificate.d.ts.map +0 -1
- package/dist/host-certificate.js +0 -111
- package/dist/index.d.ts.map +0 -1
- package/dist/key-material.d.ts.map +0 -1
- package/dist/key-material.js +0 -42
- package/dist/link.d.ts.map +0 -1
- package/dist/link.js +0 -117
- package/dist/mcp/connect-tool.d.ts.map +0 -1
- package/dist/mcp/connect-tool.js +0 -396
- package/dist/mcp/daemon-tools.d.ts.map +0 -1
- package/dist/mcp/daemon-tools.js +0 -29
- package/dist/mcp/events-tool.d.ts.map +0 -1
- package/dist/mcp/events-tool.js +0 -322
- package/dist/mcp/server.d.ts.map +0 -1
- package/dist/mcp/server.js +0 -538
- package/dist/mcp/tool-mapping.d.ts +0 -58
- package/dist/mcp/tool-mapping.d.ts.map +0 -1
- package/dist/mcp/tool-mapping.js +0 -143
- package/dist/mcp/tool-namespace.d.ts +0 -40
- package/dist/mcp/tool-namespace.d.ts.map +0 -1
- package/dist/mcp/tool-namespace.js +0 -65
- package/dist/native-scheme.d.ts.map +0 -1
- package/dist/native-scheme.js +0 -465
- package/dist/output.d.ts.map +0 -1
- package/dist/output.js +0 -342
- package/dist/package-version.d.ts.map +0 -1
- package/dist/package-version.js +0 -47
- package/dist/qr-terminal.d.ts.map +0 -1
- package/dist/qr-terminal.js +0 -45
- package/dist/rpc/client.d.ts.map +0 -1
- package/dist/rpc/client.js +0 -819
- package/dist/scheme.d.ts.map +0 -1
- package/dist/scheme.js +0 -321
- package/dist/spki-pin.d.ts.map +0 -1
- package/dist/spki-pin.js +0 -14
|
@@ -10,6 +10,14 @@ export declare const parsePositiveIntegerOption: (value: unknown, flagName: stri
|
|
|
10
10
|
* {@link parsePositiveIntegerOption}), or throws a clear `usage_error`. Used by `events --since`,
|
|
11
11
|
* whose cursor `0` is a meaningful "everything retained" value, not an omission. */
|
|
12
12
|
export declare const parseNonNegativeIntegerOption: (value: unknown, flagName: string) => number | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Reads a free-text flag's value exactly as typed. `cac` coerces any numeric-looking value to a
|
|
15
|
+
* number (`--filter 404` arrives as `404`, `--filter 007` as `7`), so the verbatim string is
|
|
16
|
+
* recovered from `argv` (`--flag value` or `--flag=value`, the last occurrence wins, nothing after
|
|
17
|
+
* `--`), falling back to the parsed value if argv somehow does not carry it. A flag given with no
|
|
18
|
+
* value (`cac` reports `true`) is a usage error rather than silently ignored.
|
|
19
|
+
*/
|
|
20
|
+
export declare const readTextOption: (argv: readonly string[], value: unknown, flagName: string) => string | undefined;
|
|
13
21
|
/**
|
|
14
22
|
* Splits the positional args of a command shaped `<command> [selector] <target>` (e.g. `invoke
|
|
15
23
|
* [selector] <tool>`, `tools [selector] <name>`): the last positional is always the required
|
|
@@ -41,4 +49,3 @@ export declare const splitOptionalSelectorAndTarget: (args: readonly string[], c
|
|
|
41
49
|
* wrong-shaped value is a validation error (something was given, and it's invalid).
|
|
42
50
|
*/
|
|
43
51
|
export declare const parseJsonInputOption: (value: string | undefined) => Record<string, unknown>;
|
|
44
|
-
//# sourceMappingURL=command-options.d.ts.map
|
package/dist/cli/create-cli.d.ts
CHANGED
package/dist/cli/dispatch.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI's eager entry: everything that runs before a command word is known. Parses argv with
|
|
3
|
+
* `cac`, resolves the global flags, and hands off to the root router, which lazy-loads exactly one
|
|
4
|
+
* route module (`./routes/<command>.js`) for the command that matched.
|
|
5
|
+
*
|
|
6
|
+
* Keep this module's *static* imports to what every invocation needs (ARCHITECTURE.md §10
|
|
7
|
+
* "Startup cost"): the parser, the runner, the state-dir resolution and the version guard. A
|
|
8
|
+
* command's handler, and anything only that command needs, belongs behind its route's loader in
|
|
9
|
+
* {@link rootRouter}, never up here.
|
|
10
|
+
*/
|
|
1
11
|
import type { RunCliOptions } from "./types.js";
|
|
2
12
|
export declare const runCli: (argv: string[], options?: RunCliOptions) => Promise<number>;
|
|
3
|
-
//# sourceMappingURL=dispatch.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Owns the CLI result envelope — the {@link CommandMeta} block a rendered result carries, and
|
|
3
|
+
* when it's attached. This module sits on the eager path (`runner.ts` calls it for every
|
|
4
|
+
* command), so it imports nothing beyond `result-types`'s types and `global-flags`'s types.
|
|
5
|
+
*/
|
|
6
|
+
import type { CliResult, CommandMeta } from "./result-types.js";
|
|
7
|
+
import type { GlobalFlags } from "./global-flags.js";
|
|
8
|
+
export declare const createCommandMeta: (command: string, startedAt: Date, finishedAt: Date) => CommandMeta;
|
|
9
|
+
export type CommandTiming = {
|
|
10
|
+
command: string;
|
|
11
|
+
startedAt: Date;
|
|
12
|
+
finishedAt: Date;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Attaches `meta` to a command's result, but only under `--verbose` — otherwise the result is
|
|
16
|
+
* returned exactly as the handler produced it, with no `meta` key at all (never `meta: undefined`,
|
|
17
|
+
* so `--json` output carries no `meta` property to filter out).
|
|
18
|
+
*/
|
|
19
|
+
export declare const finalizeResult: <T>(result: CliResult<T>, timing: CommandTiming, flags: Pick<GlobalFlags, "verbose">) => CliResult<T>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI's global output flags (`--json`, `--pretty`, `--verbose`, `--no-color`) as a single
|
|
3
|
+
* declarative table. This module sits on the eager path (ARCHITECTURE.md §10 "Startup cost") —
|
|
4
|
+
* every invocation resolves these flags before a command word is even known — so it imports
|
|
5
|
+
* nothing beyond `cac`'s types (erased at build time) and stays free of runtime dependencies.
|
|
6
|
+
*
|
|
7
|
+
* Add a flag by adding one entry to {@link globalFlagDefinitions}: `create-cli.ts` registers it
|
|
8
|
+
* with `cac` via {@link registerGlobalFlags}, and `dispatch.ts` resolves it into the
|
|
9
|
+
* {@link GlobalFlags} object every route receives as `env.flags` via {@link resolveGlobalFlags} /
|
|
10
|
+
* {@link resolveGlobalFlagsFromArgv} — no other file needs to change.
|
|
11
|
+
*/
|
|
12
|
+
import type { CAC } from "cac";
|
|
13
|
+
export type GlobalFlags = {
|
|
14
|
+
json: boolean;
|
|
15
|
+
pretty: boolean;
|
|
16
|
+
verbose: boolean;
|
|
17
|
+
color: boolean;
|
|
18
|
+
};
|
|
19
|
+
/** Registers every table entry with `cli.option()`, in table order. */
|
|
20
|
+
export declare const registerGlobalFlags: (cli: CAC) => void;
|
|
21
|
+
/** Resolves {@link GlobalFlags} from `cac`'s parsed options object (the normal path). */
|
|
22
|
+
export declare const resolveGlobalFlags: (options: Readonly<Record<string, unknown>>) => GlobalFlags;
|
|
23
|
+
/** Resolves {@link GlobalFlags} directly from argv — used when `cac.parse()` itself throws before
|
|
24
|
+
* a parsed options object exists. */
|
|
25
|
+
export declare const resolveGlobalFlagsFromArgv: (argv: readonly string[]) => GlobalFlags;
|
|
26
|
+
/**
|
|
27
|
+
* The single place that decides compact vs. indented JSON. Compact (`JSON.stringify(value)`) by
|
|
28
|
+
* default; `--pretty` restores the 2-space indentation the CLI used to always apply.
|
|
29
|
+
*/
|
|
30
|
+
export declare const formatJson: (value: unknown, flags: Pick<GlobalFlags, "pretty">) => string;
|
|
@@ -25,6 +25,13 @@ export declare const OPEN_TARGETS: readonly OpenTarget[];
|
|
|
25
25
|
* so such a link must carry the machine's real advertised address (issue #31).
|
|
26
26
|
*/
|
|
27
27
|
export declare const usesLoopbackAddress: (target: OpenTarget) => boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The `appId.<platform>` config key a target's app id is read from — the single place that maps a
|
|
30
|
+
* delivery target to the platform whose app id it needs. `undefined` for `ios-sim`: `simctl
|
|
31
|
+
* openurl` has no equivalent of `-p`/a bundle-id argument, so it needs no app id and none should
|
|
32
|
+
* ever be required for it.
|
|
33
|
+
*/
|
|
34
|
+
export declare const platformOf: (target: OpenTarget) => "ios" | "android" | undefined;
|
|
28
35
|
/**
|
|
29
36
|
* Whether an advertised address is one that only resolves back to the machine that minted the link.
|
|
30
37
|
* `daemon/address.ts` falls back to `127.0.0.1` when it cannot find a routable interface, and such
|
|
@@ -51,10 +58,18 @@ export type PairedIosDevice = {
|
|
|
51
58
|
udid: string;
|
|
52
59
|
name: string;
|
|
53
60
|
};
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
/**
|
|
62
|
+
* The single wording naming every way to supply an app id, shared by the `android` and
|
|
63
|
+
* `ios-device` paths (and by the CLI/MCP/programmatic callers that resolve one before minting a
|
|
64
|
+
* link) so the fix cannot drift between them. This is the *last-line-of-defence* message: the
|
|
65
|
+
* normal path is `scheme.ts`'s `resolveAppId`/`describeMissingAppId`, which names the exact
|
|
66
|
+
* project-config locations it looked in and fires before a link is even minted. This one covers a
|
|
67
|
+
* caller that reaches `deliverToOpenTarget` some other way (a test, or a future direct caller)
|
|
68
|
+
* with no app id at all.
|
|
69
|
+
*/
|
|
70
|
+
export declare const MISSING_APP_ID_MESSAGE: string;
|
|
71
|
+
export declare const isValidAppId: (value: string) => boolean;
|
|
72
|
+
export declare const invalidAppIdMessage: (value: string) => string;
|
|
58
73
|
/** One device a link could be delivered to, resolved concretely enough to deliver without a
|
|
59
74
|
* second, racy lookup: `device` is an adb serial or a simulator udid. */
|
|
60
75
|
export type DetectedTarget = {
|
|
@@ -96,8 +111,11 @@ export type OpenTargetOptions = {
|
|
|
96
111
|
/** An adb device serial (`target: "android"`), a simulator udid (`target: "ios-sim"`) or a
|
|
97
112
|
* paired-device udid (`target: "ios-device"`). */
|
|
98
113
|
device?: string;
|
|
99
|
-
/** The installed app's
|
|
100
|
-
|
|
114
|
+
/** The installed app's id: the Android package name for `target: "android"`, the iOS bundle id
|
|
115
|
+
* for `target: "ios-device"`. Required by both; unused (and never required) for `target:
|
|
116
|
+
* "ios-sim"` — see {@link platformOf}. Resolution (flag, then project config) happens before
|
|
117
|
+
* this is called; see `scheme.ts`'s `resolveAppId`. */
|
|
118
|
+
appId?: string;
|
|
101
119
|
/** `target: "ios-device"` only: terminate a running instance first (`--terminate-existing`)
|
|
102
120
|
* instead of launching over it. Off by default; see {@link deliverToOpenTarget}. */
|
|
103
121
|
relaunch?: boolean;
|
|
@@ -107,6 +125,5 @@ export type OpenTargetOptions = {
|
|
|
107
125
|
};
|
|
108
126
|
/** Delivers `deepLink` to a booted Android device/emulator, an iOS simulator, or (experimentally)
|
|
109
127
|
* a paired physical iOS device. Throws a clear, actionable error (missing tool, no booted device,
|
|
110
|
-
* ambiguous device, missing
|
|
128
|
+
* ambiguous device, missing app id) rather than a raw one. */
|
|
111
129
|
export declare const deliverToOpenTarget: (options: OpenTargetOptions) => Promise<void>;
|
|
112
|
-
//# sourceMappingURL=open-target.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* the thin-client shapes for the v2 command table.
|
|
5
5
|
*/
|
|
6
6
|
import type { OpenTarget } from "./open-target.js";
|
|
7
|
-
import type { AgentEndpoint, EffectivePolicyDecision, EventNotification, SessionSummary, ToolDescriptor } from "@appduct/shared";
|
|
7
|
+
import type { AgentEndpoint, EffectivePolicyDecision, EventNotification, SessionSummary, ToolDescriptor, ToolGroupSummary, ToolsListResult } from "@appduct/shared";
|
|
8
8
|
/**
|
|
9
9
|
* CLI-domain error classes, used only to pick a sysexits-style exit code (see `errors.ts`).
|
|
10
10
|
* `CliError.type` itself is *not* restricted to this union: RPC/app-originated failures preserve
|
|
@@ -70,6 +70,14 @@ export type InitCommandData = {
|
|
|
70
70
|
created: boolean;
|
|
71
71
|
/** This run wrote to the file. `false` on an idempotent re-run. */
|
|
72
72
|
changed: boolean;
|
|
73
|
+
/** `appId.<platform>` as it stands in the project config after this run — from `--ios-app-id`/
|
|
74
|
+
* `--android-app-id` on this invocation, or already recorded from an earlier one. Omitted
|
|
75
|
+
* entirely (rather than `{}`) when neither platform has one, so `--json` output doesn't grow an
|
|
76
|
+
* empty object issue #63 didn't ask for. */
|
|
77
|
+
appId?: {
|
|
78
|
+
ios?: string;
|
|
79
|
+
android?: string;
|
|
80
|
+
};
|
|
73
81
|
/** Present when the recorded scheme and the value discovery would currently find (`app.json` or
|
|
74
82
|
* a native probe) disagree. The recorded one still wins (a re-run must not start failing because
|
|
75
83
|
* the underlying project file was edited); this says so and names the `--force` invocation that
|
|
@@ -94,7 +102,8 @@ export type LinkCommandData = {
|
|
|
94
102
|
expiresAt: number;
|
|
95
103
|
/** The daemon's SPKI pin, same value as embedded in `deepLink`'s `pin` query param — surfaced
|
|
96
104
|
* as its own field for `--json` consumers that don't want to re-parse the URL (opt-in
|
|
97
|
-
* hardening dev-mode: native clients trust
|
|
105
|
+
* hardening dev-mode: native clients trust it only when the build embeds no `cliPins`, in any
|
|
106
|
+
* build type). */
|
|
98
107
|
pin: string;
|
|
99
108
|
/** Present (and `true`) only once `--open <target>` has successfully delivered the link
|
|
100
109
|
* (ARCHITECTURE.md §10). */
|
|
@@ -104,8 +113,25 @@ export type LinkCommandData = {
|
|
|
104
113
|
};
|
|
105
114
|
/** `appduct ls`: `sessions.list` passthrough, verbatim (ARCHITECTURE.md §10: "--json passthrough"). */
|
|
106
115
|
export type LsCommandData = SessionSummary[];
|
|
107
|
-
/** `appduct tools
|
|
108
|
-
|
|
116
|
+
/** `appduct tools`'s listing form: the daemon's `tools.list` result, plus the `--group`/`--filter`/
|
|
117
|
+
* `--limit`/`--offset` inputs that produced it (only the ones actually given — echoed so `--json` and the
|
|
118
|
+
* human renderer's "Showing n of total" line can report what was asked for without threading the
|
|
119
|
+
* CLI options through separately). */
|
|
120
|
+
export type ToolsListing = ToolsListResult & {
|
|
121
|
+
offset?: number;
|
|
122
|
+
limit?: number;
|
|
123
|
+
group?: string;
|
|
124
|
+
filter?: string;
|
|
125
|
+
};
|
|
126
|
+
/** `appduct tools --groups`: the daemon's `groups` summary alone, plus the registry's size. */
|
|
127
|
+
export type ToolGroupsListing = {
|
|
128
|
+
groups: ToolGroupSummary[];
|
|
129
|
+
/** Every tool in the session, grouped or not. */
|
|
130
|
+
total: number;
|
|
131
|
+
};
|
|
132
|
+
/** `appduct tools`: a listing, a groups summary (`--groups`), or a single descriptor when a tool
|
|
133
|
+
* name resolved to a detail lookup. */
|
|
134
|
+
export type ToolsCommandData = ToolsListing | ToolGroupsListing | ToolDescriptor;
|
|
109
135
|
/** `appduct invoke`: the tool's raw result payload, printed as-is. */
|
|
110
136
|
export type InvokeCommandData = unknown;
|
|
111
137
|
export type RevokeCommandData = {
|
|
@@ -191,4 +217,3 @@ export type DaemonStatusCommandData = {
|
|
|
191
217
|
bytes?: number;
|
|
192
218
|
};
|
|
193
219
|
};
|
|
194
|
-
//# sourceMappingURL=result-types.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI's multi-level command router — the mechanism behind ARCHITECTURE.md §10 "Startup cost".
|
|
3
|
+
*
|
|
4
|
+
* A route table maps one command word to a *loader*: a `() => import("./routes/<name>.js")`.
|
|
5
|
+
* Nothing behind a loader is evaluated until its command word actually matches, so the module
|
|
6
|
+
* graph a process pays for at startup is the router plus the one route it takes, never the sum
|
|
7
|
+
* of every command. A route module may itself export another router (`daemon` does), and the
|
|
8
|
+
* same rule applies one level down: `daemon status` never loads `daemon run`'s daemon.
|
|
9
|
+
*
|
|
10
|
+
* The contract for a route module is a single `route` export of type {@link Route}. Keep the
|
|
11
|
+
* route module's *static* imports limited to what that command needs — a static import in a
|
|
12
|
+
* lazily loaded module is still lazy, it is the eager path (`dispatch.ts`, this file, `runner.ts`)
|
|
13
|
+
* that must stay lean.
|
|
14
|
+
*/
|
|
15
|
+
import type { CliEnv } from "./types.js";
|
|
16
|
+
/** The inputs of the daemon version check (ARCHITECTURE.md §4 "Version drift"), as plain data so
|
|
17
|
+
* they can cross the bundle boundary; `cli/version-guard.ts` turns them into the check itself. */
|
|
18
|
+
export type VersionCheckInputs = {
|
|
19
|
+
/** The version this client actually is — always the real package version, never an override. */
|
|
20
|
+
readonly clientVersion: string;
|
|
21
|
+
/** Resolves `--daemon-restart` / `APPDUCT_DAEMON_RESTART` / `restartDaemonOnVersionMismatch`;
|
|
22
|
+
* memoized by the caller, and it never throws (an unreadable config reads as `false`). */
|
|
23
|
+
readonly forceRestart: () => Promise<boolean>;
|
|
24
|
+
/** Where a "the daemon is newer than this client" notice goes for a command that is checked
|
|
25
|
+
* ahead of its first RPC; a no-op under `--json`, whose stdout/stderr contract has no room for
|
|
26
|
+
* it. A command that owns its own log channel (`mcp`) substitutes its own writer. */
|
|
27
|
+
readonly warn: (message: string) => void;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Everything a route needs to run one command; built once by `dispatch.ts`, narrowed per level.
|
|
31
|
+
*
|
|
32
|
+
* This object is the only thing that crosses from the eager bundle (`dist/bin.js`) into a route
|
|
33
|
+
* bundle (`dist/cli/routes/<command>.js`), and each route bundle carries its *own copy* of the
|
|
34
|
+
* modules it shares with the eager one (`scripts/bundle.mjs`). Two copies of a module mean two
|
|
35
|
+
* copies of its classes, and `instanceof` fails across them — so the context carries plain data,
|
|
36
|
+
* writers and closures that never throw. A closure that could throw an `AppductCliError` made in
|
|
37
|
+
* the eager bundle would reach the route's copy of `toCliError` and render as `internal_error`.
|
|
38
|
+
*/
|
|
39
|
+
export type RouteContext = {
|
|
40
|
+
/** The command words matched so far, e.g. `["daemon", "status"]`. Joined with spaces it is the
|
|
41
|
+
* command name used to pick a success-data renderer, and (under `--verbose`) the `meta.command`
|
|
42
|
+
* a rendered result reports. */
|
|
43
|
+
readonly path: readonly string[];
|
|
44
|
+
/** The positional arguments left after {@link path}: what the matched command itself receives. */
|
|
45
|
+
readonly args: readonly string[];
|
|
46
|
+
/** Every parsed flag (global and per-command), as `cac` reports them (camelCased). */
|
|
47
|
+
readonly options: Readonly<Record<string, unknown>>;
|
|
48
|
+
/** The raw argv `runCli` received (no `node`/script prefix). For the rare flag whose value must
|
|
49
|
+
* be read verbatim: `cac` coerces every numeric-looking value to a number (`--filter 007` → `7`),
|
|
50
|
+
* so a free-text flag recovers its exact string from here (`command-options.ts`'s
|
|
51
|
+
* `readTextOption`). */
|
|
52
|
+
readonly argv: readonly string[];
|
|
53
|
+
readonly env: CliEnv;
|
|
54
|
+
/** The resolved state directory (`--state-dir` / `APPDUCT_STATE_DIR` / default). */
|
|
55
|
+
readonly stateDir: string;
|
|
56
|
+
readonly versionCheck: VersionCheckInputs;
|
|
57
|
+
};
|
|
58
|
+
export type Route = (context: RouteContext) => Promise<number>;
|
|
59
|
+
export type RouteLoader = () => Promise<{
|
|
60
|
+
route: Route;
|
|
61
|
+
}>;
|
|
62
|
+
export type RouteTable = Readonly<Record<string, RouteLoader>>;
|
|
63
|
+
export type RouterOptions = {
|
|
64
|
+
/** Builds the error for an unmatched (or missing) command word at this level. */
|
|
65
|
+
readonly unknown: (word: string | undefined, context: RouteContext) => Error;
|
|
66
|
+
};
|
|
67
|
+
/** The command name for a context (the `meta.command` a rendered result reports under
|
|
68
|
+
* `--verbose`): the matched words joined, or the level's own name. */
|
|
69
|
+
export declare const commandName: (context: RouteContext) => string;
|
|
70
|
+
/**
|
|
71
|
+
* Builds a {@link Route} that consumes the next positional as a command word, lazy-loads the
|
|
72
|
+
* matching route module and hands it the rest. An unmatched word renders `options.unknown`'s
|
|
73
|
+
* error through the standard runner, so the exit code and `--json` shape are the same as any
|
|
74
|
+
* other usage error.
|
|
75
|
+
*/
|
|
76
|
+
export declare const createRouter: (table: RouteTable, options: RouterOptions) => Route;
|
|
77
|
+
/** The default {@link RouterOptions.unknown} for a level whose commands are all top-level. */
|
|
78
|
+
export declare const unknownCommandError: (word: string | undefined) => Error;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Route for `appduct daemon` — itself a router over the daemon actions, so `daemon status` loads
|
|
3
|
+
* `status.ts` and nothing else. In particular it never evaluates `run.ts`, the only action that
|
|
4
|
+
* pulls in the daemon implementation (ARCHITECTURE.md §10 "Startup cost").
|
|
5
|
+
*
|
|
6
|
+
* cac only matches a command's first word (`cli/create-cli.ts`), so the action arrives here as
|
|
7
|
+
* the first positional rather than as a cac command of its own.
|
|
8
|
+
*/
|
|
9
|
+
export declare const route: import("../../router.js").Route;
|