@swmansion/argent 0.15.0 → 0.15.1-next.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 +2 -2
- package/bin/argent-android-devtools-0.1.0.apk +0 -0
- package/bin/darwin/ax-service +0 -0
- package/bin/darwin/tcp/ax-service +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/dist/cli-cmds.mjs +610 -81
- package/dist/cli.js +29 -11
- package/dist/cli.js.map +1 -1
- package/dist/installer-help.d.ts +88 -0
- package/dist/installer-help.js +191 -0
- package/dist/installer-help.js.map +1 -0
- package/dist/installer.mjs +284 -246
- package/dist/mcp-server.mjs +296 -63
- package/dist/preview-ui/index.html +69 -0
- package/dist/tool-server.cjs +50205 -42930
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
- package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
- package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
- package/package.json +1 -1
- package/skills/argent-create-flow/SKILL.md +137 -106
- package/skills/argent-device-interact/SKILL.md +3 -3
- package/skills/argent-native-profiler/SKILL.md +1 -0
package/dist/cli.js
CHANGED
|
@@ -30,6 +30,7 @@ import * as fs from "node:fs";
|
|
|
30
30
|
import * as path from "node:path";
|
|
31
31
|
import { BUNDLED_RUNTIME_PATHS } from "./bundled-paths.js";
|
|
32
32
|
import { installFatalHandlers } from "./fatal-handlers.js";
|
|
33
|
+
import { INSTALLER_COMMAND_META, installerHelpRequested, printInstallerHelp, } from "./installer-help.js";
|
|
33
34
|
const PACKAGE_NAME = "@swmansion/argent";
|
|
34
35
|
function getInstalledVersion() {
|
|
35
36
|
try {
|
|
@@ -46,6 +47,16 @@ function getInstalledVersion() {
|
|
|
46
47
|
const [, , command, ...rest] = process.argv;
|
|
47
48
|
const isMcpServer = command === "mcp";
|
|
48
49
|
installFatalHandlers({ isMcpServer });
|
|
50
|
+
// One installer row of the command table: the command's one-line summary plus
|
|
51
|
+
// its indented detail lines, both from INSTALLER_COMMAND_META. The summary is
|
|
52
|
+
// shared with the per-command `--help`, so the two can't drift; the details
|
|
53
|
+
// are table-only prose kept in the meta so each command's help text lives in
|
|
54
|
+
// one place.
|
|
55
|
+
function installerHelpEntry(command) {
|
|
56
|
+
const meta = INSTALLER_COMMAND_META[command];
|
|
57
|
+
const details = (meta.details ?? []).map((line) => `\n ${line}`).join("");
|
|
58
|
+
return `${meta.summary}${details}`;
|
|
59
|
+
}
|
|
49
60
|
function printHelp() {
|
|
50
61
|
const version = getInstalledVersion() ?? "unknown";
|
|
51
62
|
console.log(`
|
|
@@ -55,19 +66,14 @@ Usage: argent <command> [options]
|
|
|
55
66
|
|
|
56
67
|
Commands:
|
|
57
68
|
mcp Start the MCP stdio server (used by editors)
|
|
58
|
-
init
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
(acts on the present install — both when a global install and a
|
|
64
|
-
project devDependency coexist; --global/--local select explicitly)
|
|
65
|
-
uninstall Remove argent configuration from the workspace
|
|
66
|
-
(--global/--local choose which install — package and its
|
|
67
|
-
configs — is removed)
|
|
68
|
-
remove Alias for uninstall
|
|
69
|
+
init ${installerHelpEntry("init")}
|
|
70
|
+
install ${installerHelpEntry("install")}
|
|
71
|
+
update ${installerHelpEntry("update")}
|
|
72
|
+
uninstall ${installerHelpEntry("uninstall")}
|
|
73
|
+
remove ${installerHelpEntry("remove")}
|
|
69
74
|
tools List tools exposed by the tool-server
|
|
70
75
|
run Invoke a tool by name (use \`argent run <tool> --help\` for flags)
|
|
76
|
+
flow Run a saved flow (use \`argent flow --help\` for options)
|
|
71
77
|
server Manage the shared tool-server (start / status / stop / logs)
|
|
72
78
|
lens Open Argent Lens bound to a fresh coding-agent session (macOS)
|
|
73
79
|
link Route client requests to a remote tool-server
|
|
@@ -99,6 +105,16 @@ async function loadCli() {
|
|
|
99
105
|
return (await import("./cli-cmds.mjs"));
|
|
100
106
|
}
|
|
101
107
|
async function main() {
|
|
108
|
+
// The installer subcommands (init / install / update / uninstall / remove)
|
|
109
|
+
// forward their argv straight to the side-effecting installer functions,
|
|
110
|
+
// which do not short-circuit on `--help` — so `argent uninstall --help`
|
|
111
|
+
// would run the real (destructive) command. Intercept help for exactly that
|
|
112
|
+
// set before dispatching. All other subcommands handle `--help` themselves.
|
|
113
|
+
if (installerHelpRequested(command, rest)) {
|
|
114
|
+
// installerHelpRequested only returns true for an InstallerCommand.
|
|
115
|
+
printInstallerHelp(command);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
102
118
|
switch (command) {
|
|
103
119
|
case "mcp":
|
|
104
120
|
return (await loadMcp()).startMcpServer({ paths: BUNDLED_RUNTIME_PATHS });
|
|
@@ -114,6 +130,8 @@ async function main() {
|
|
|
114
130
|
return (await loadCli()).tools(rest, { paths: BUNDLED_RUNTIME_PATHS });
|
|
115
131
|
case "run":
|
|
116
132
|
return (await loadCli()).run(rest, { paths: BUNDLED_RUNTIME_PATHS });
|
|
133
|
+
case "flow":
|
|
134
|
+
return (await loadCli()).flow(rest, { paths: BUNDLED_RUNTIME_PATHS });
|
|
117
135
|
case "server":
|
|
118
136
|
return (await loadCli()).server(rest, { paths: BUNDLED_RUNTIME_PATHS });
|
|
119
137
|
case "lens":
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS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
* uninstall / remove).
|
|
4
|
+
*
|
|
5
|
+
* These commands forward their argv straight to the side-effecting installer
|
|
6
|
+
* functions, which do not themselves short-circuit on `--help`. Without an
|
|
7
|
+
* explicit guard `argent uninstall --help` runs the real uninstall — it even
|
|
8
|
+
* opens the destructive "Remove argent configuration from this workspace?"
|
|
9
|
+
* prompt. The dispatcher checks `installerHelpRequested` before dispatching so
|
|
10
|
+
* a help request prints usage and returns without loading or invoking any
|
|
11
|
+
* installer code.
|
|
12
|
+
*
|
|
13
|
+
* The other subcommands (run / tools / server / link / flags / …) handle
|
|
14
|
+
* `--help` themselves, so they are deliberately excluded here — intercepting
|
|
15
|
+
* them would swallow their own command-specific help.
|
|
16
|
+
*
|
|
17
|
+
* This module is also the single source of truth for each installer command's
|
|
18
|
+
* help text: the top-level `argent --help` table in cli.ts reads the summary
|
|
19
|
+
* and detail lines from `INSTALLER_COMMAND_META` so the two can't drift.
|
|
20
|
+
*/
|
|
21
|
+
/** Installer subcommands that lack their own `--help` handling. */
|
|
22
|
+
export declare const INSTALLER_COMMANDS: readonly ["init", "install", "update", "uninstall", "remove"];
|
|
23
|
+
export type InstallerCommand = (typeof INSTALLER_COMMANDS)[number];
|
|
24
|
+
export declare function isInstallerCommand(command: string | undefined): command is InstallerCommand;
|
|
25
|
+
/**
|
|
26
|
+
* Flags that consume the next argv token, mirroring the real parsers
|
|
27
|
+
* (`extractFlag` in init-args.ts, the lookahead loops in update.ts). A
|
|
28
|
+
* bareword `help` immediately after one of these is that flag's value, not a
|
|
29
|
+
* help request. `--project-root` (update) is agent-internal — parsed but
|
|
30
|
+
* deliberately absent from the help text. Kept in sync with the parsers by
|
|
31
|
+
* test/installer-flags-sync.test.ts.
|
|
32
|
+
*/
|
|
33
|
+
export declare const VALUE_TAKING_FLAGS: Record<InstallerCommand, readonly string[]>;
|
|
34
|
+
/**
|
|
35
|
+
* True when `command` is an installer subcommand and `rest` requests help. Pure
|
|
36
|
+
* — the dispatcher uses it to short-circuit before running any side-effecting
|
|
37
|
+
* installer code.
|
|
38
|
+
*
|
|
39
|
+
* Help is recognised from a help flag anywhere in `rest` (see `isHelpFlag`) or
|
|
40
|
+
* the bareword `help` (case-insensitive) in any position — EXCEPT directly
|
|
41
|
+
* after a value-taking flag, where it is that flag's value: `argent init
|
|
42
|
+
* --from help` names a package literally called `help` and must reach the
|
|
43
|
+
* installer. The bareword matters on the destructive path: `argent uninstall
|
|
44
|
+
* --yes help` would otherwise run a prompt-free uninstall (`--yes` skips the
|
|
45
|
+
* confirmation).
|
|
46
|
+
*/
|
|
47
|
+
export declare function installerHelpRequested(command: string | undefined, rest: string[]): boolean;
|
|
48
|
+
interface InstallerOption {
|
|
49
|
+
/** Flag spelling as shown to the user, e.g. `--from <path>` or `--yes, -y`. */
|
|
50
|
+
flag: string;
|
|
51
|
+
description: string;
|
|
52
|
+
}
|
|
53
|
+
interface InstallerCommandMeta {
|
|
54
|
+
/**
|
|
55
|
+
* One-line summary shared with the top-level `argent --help` table. No
|
|
56
|
+
* trailing period — cli.ts renders it inline in a command list, and
|
|
57
|
+
* `printInstallerHelp` appends its own.
|
|
58
|
+
*/
|
|
59
|
+
summary: string;
|
|
60
|
+
/**
|
|
61
|
+
* Extra lines rendered indented under the summary in the top-level command
|
|
62
|
+
* table (cli.ts). Per-command `--help` conveys the same information through
|
|
63
|
+
* the option descriptions instead.
|
|
64
|
+
*/
|
|
65
|
+
details?: string[];
|
|
66
|
+
/** Usage line, e.g. `argent init [options]`. */
|
|
67
|
+
usage: string;
|
|
68
|
+
/** Real flags this command parses. Empty for aliases (see `aliasOf`). */
|
|
69
|
+
options: InstallerOption[];
|
|
70
|
+
/** When set, this command is an alias; its help defers to the target's. */
|
|
71
|
+
aliasOf?: InstallerCommand;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* How each installer subcommand is described in help — its summary and detail
|
|
75
|
+
* lines (the sole copy, also rendered by the top-level table in cli.ts), usage,
|
|
76
|
+
* and options. The option lists mirror the flags each installer actually parses
|
|
77
|
+
* (init-args.ts, update.ts, uninstall.ts, install-targets.ts in
|
|
78
|
+
* packages/argent-installer); test/installer-flags-sync.test.ts fails when they
|
|
79
|
+
* drift from the parsers.
|
|
80
|
+
*/
|
|
81
|
+
export declare const INSTALLER_COMMAND_META: Record<InstallerCommand, InstallerCommandMeta>;
|
|
82
|
+
/**
|
|
83
|
+
* Print the usage block for an installer subcommand — usage line, summary, the
|
|
84
|
+
* command's options (or a pointer to the aliased command), and a footer.
|
|
85
|
+
* Read-only: no network, no wizard, no prompt.
|
|
86
|
+
*/
|
|
87
|
+
export declare function printInstallerHelp(command: InstallerCommand): void;
|
|
88
|
+
export {};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Help handling for the installer subcommands (init / install / update /
|
|
3
|
+
* uninstall / remove).
|
|
4
|
+
*
|
|
5
|
+
* These commands forward their argv straight to the side-effecting installer
|
|
6
|
+
* functions, which do not themselves short-circuit on `--help`. Without an
|
|
7
|
+
* explicit guard `argent uninstall --help` runs the real uninstall — it even
|
|
8
|
+
* opens the destructive "Remove argent configuration from this workspace?"
|
|
9
|
+
* prompt. The dispatcher checks `installerHelpRequested` before dispatching so
|
|
10
|
+
* a help request prints usage and returns without loading or invoking any
|
|
11
|
+
* installer code.
|
|
12
|
+
*
|
|
13
|
+
* The other subcommands (run / tools / server / link / flags / …) handle
|
|
14
|
+
* `--help` themselves, so they are deliberately excluded here — intercepting
|
|
15
|
+
* them would swallow their own command-specific help.
|
|
16
|
+
*
|
|
17
|
+
* This module is also the single source of truth for each installer command's
|
|
18
|
+
* help text: the top-level `argent --help` table in cli.ts reads the summary
|
|
19
|
+
* and detail lines from `INSTALLER_COMMAND_META` so the two can't drift.
|
|
20
|
+
*/
|
|
21
|
+
/** Installer subcommands that lack their own `--help` handling. */
|
|
22
|
+
export const INSTALLER_COMMANDS = ["init", "install", "update", "uninstall", "remove"];
|
|
23
|
+
export function isInstallerCommand(command) {
|
|
24
|
+
return INSTALLER_COMMANDS.includes(command);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* True when `arg` is a help flag. Accepted spellings, all case-insensitive:
|
|
28
|
+
* `--help`, `-h`, `--help=<anything>`, single-dash `-help`, and an em/en-dash
|
|
29
|
+
* `—help` (smart-dash editors rewrite a pasted `--` into one). Anything else —
|
|
30
|
+
* e.g. `/help` or `--helpme` — is NOT treated as help and falls through to the
|
|
31
|
+
* real command, where uninstall's interactive confirmation still guards the
|
|
32
|
+
* destructive path (unless `--yes` was also passed).
|
|
33
|
+
*/
|
|
34
|
+
function isHelpFlag(arg) {
|
|
35
|
+
// Smart-dash normalization: a leading em/en dash stands for the `--` it was
|
|
36
|
+
// rewritten from.
|
|
37
|
+
const lower = arg.toLowerCase().replace(/^[—–]/, "--");
|
|
38
|
+
return lower === "--help" || lower === "-h" || lower === "-help" || lower.startsWith("--help=");
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Flags that consume the next argv token, mirroring the real parsers
|
|
42
|
+
* (`extractFlag` in init-args.ts, the lookahead loops in update.ts). A
|
|
43
|
+
* bareword `help` immediately after one of these is that flag's value, not a
|
|
44
|
+
* help request. `--project-root` (update) is agent-internal — parsed but
|
|
45
|
+
* deliberately absent from the help text. Kept in sync with the parsers by
|
|
46
|
+
* test/installer-flags-sync.test.ts.
|
|
47
|
+
*/
|
|
48
|
+
export const VALUE_TAKING_FLAGS = {
|
|
49
|
+
init: ["--from"],
|
|
50
|
+
install: ["--from"],
|
|
51
|
+
update: ["--version", "--project-root"],
|
|
52
|
+
uninstall: [],
|
|
53
|
+
remove: [],
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* True when `command` is an installer subcommand and `rest` requests help. Pure
|
|
57
|
+
* — the dispatcher uses it to short-circuit before running any side-effecting
|
|
58
|
+
* installer code.
|
|
59
|
+
*
|
|
60
|
+
* Help is recognised from a help flag anywhere in `rest` (see `isHelpFlag`) or
|
|
61
|
+
* the bareword `help` (case-insensitive) in any position — EXCEPT directly
|
|
62
|
+
* after a value-taking flag, where it is that flag's value: `argent init
|
|
63
|
+
* --from help` names a package literally called `help` and must reach the
|
|
64
|
+
* installer. The bareword matters on the destructive path: `argent uninstall
|
|
65
|
+
* --yes help` would otherwise run a prompt-free uninstall (`--yes` skips the
|
|
66
|
+
* confirmation).
|
|
67
|
+
*/
|
|
68
|
+
export function installerHelpRequested(command, rest) {
|
|
69
|
+
if (!isInstallerCommand(command))
|
|
70
|
+
return false;
|
|
71
|
+
if (rest.some(isHelpFlag))
|
|
72
|
+
return true;
|
|
73
|
+
const valueFlags = VALUE_TAKING_FLAGS[command];
|
|
74
|
+
return rest.some((arg, i) => arg.toLowerCase() === "help" && (i === 0 || !valueFlags.includes(rest[i - 1])));
|
|
75
|
+
}
|
|
76
|
+
const NON_INTERACTIVE_OPTION = {
|
|
77
|
+
flag: "--yes, -y",
|
|
78
|
+
description: "Run without prompts, accepting defaults.",
|
|
79
|
+
};
|
|
80
|
+
const NO_TELEMETRY_OPTION = {
|
|
81
|
+
flag: "--no-telemetry",
|
|
82
|
+
description: "Opt out of anonymous telemetry for this run.",
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* How each installer subcommand is described in help — its summary and detail
|
|
86
|
+
* lines (the sole copy, also rendered by the top-level table in cli.ts), usage,
|
|
87
|
+
* and options. The option lists mirror the flags each installer actually parses
|
|
88
|
+
* (init-args.ts, update.ts, uninstall.ts, install-targets.ts in
|
|
89
|
+
* packages/argent-installer); test/installer-flags-sync.test.ts fails when they
|
|
90
|
+
* drift from the parsers.
|
|
91
|
+
*/
|
|
92
|
+
export const INSTALLER_COMMAND_META = {
|
|
93
|
+
init: {
|
|
94
|
+
summary: "Initialize argent in the current workspace (MCP server + skills + rules)",
|
|
95
|
+
details: [
|
|
96
|
+
"(--global [default] installs on PATH; --local commits a",
|
|
97
|
+
"devDependency setup the whole team gets on `npm install`)",
|
|
98
|
+
],
|
|
99
|
+
usage: "argent init [options]",
|
|
100
|
+
options: [
|
|
101
|
+
NON_INTERACTIVE_OPTION,
|
|
102
|
+
NO_TELEMETRY_OPTION,
|
|
103
|
+
{
|
|
104
|
+
flag: "--from <path>",
|
|
105
|
+
description: "Install from a local tarball or package spec instead of the npm release.",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
flag: "--global",
|
|
109
|
+
description: "Install on PATH for this machine (the default).",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
flag: "--local",
|
|
113
|
+
description: "Commit a devDependency setup the whole team gets on `npm install`.",
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
install: {
|
|
118
|
+
summary: "Alias for init",
|
|
119
|
+
usage: "argent install [options]",
|
|
120
|
+
options: [],
|
|
121
|
+
aliasOf: "init",
|
|
122
|
+
},
|
|
123
|
+
update: {
|
|
124
|
+
summary: "Check for updates and refresh configuration",
|
|
125
|
+
details: [
|
|
126
|
+
"(acts on the present install — both when a global install and a",
|
|
127
|
+
"project devDependency coexist; --global/--local select explicitly)",
|
|
128
|
+
],
|
|
129
|
+
usage: "argent update [options]",
|
|
130
|
+
options: [
|
|
131
|
+
NON_INTERACTIVE_OPTION,
|
|
132
|
+
NO_TELEMETRY_OPTION,
|
|
133
|
+
{
|
|
134
|
+
flag: "--version <version>",
|
|
135
|
+
description: "Update to a specific version instead of the latest.",
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
flag: "--global",
|
|
139
|
+
description: "Act on the global (PATH) install when both kinds coexist.",
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
flag: "--local",
|
|
143
|
+
description: "Act on the project-local (devDependency) install when both kinds coexist.",
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
uninstall: {
|
|
148
|
+
summary: "Remove argent configuration from the current workspace",
|
|
149
|
+
details: ["(--global/--local choose which install — package and its", "configs — is removed)"],
|
|
150
|
+
usage: "argent uninstall [options]",
|
|
151
|
+
options: [
|
|
152
|
+
{ flag: "--yes, -y", description: "Skip the confirmation prompt." },
|
|
153
|
+
{
|
|
154
|
+
flag: "--global",
|
|
155
|
+
description: "Remove the global (PATH) install — the package and its configs.",
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
flag: "--local",
|
|
159
|
+
description: "Remove the project-local (devDependency) install — the package and its configs.",
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
remove: {
|
|
164
|
+
summary: "Alias for uninstall",
|
|
165
|
+
usage: "argent remove [options]",
|
|
166
|
+
options: [],
|
|
167
|
+
aliasOf: "uninstall",
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Print the usage block for an installer subcommand — usage line, summary, the
|
|
172
|
+
* command's options (or a pointer to the aliased command), and a footer.
|
|
173
|
+
* Read-only: no network, no wizard, no prompt.
|
|
174
|
+
*/
|
|
175
|
+
export function printInstallerHelp(command) {
|
|
176
|
+
const meta = INSTALLER_COMMAND_META[command];
|
|
177
|
+
const lines = ["", `Usage: ${meta.usage}`, "", `${meta.summary}.`];
|
|
178
|
+
if (meta.aliasOf) {
|
|
179
|
+
lines.push("", `Run \`argent ${meta.aliasOf} --help\` to see its options.`);
|
|
180
|
+
}
|
|
181
|
+
else if (meta.options.length > 0) {
|
|
182
|
+
const width = Math.max(...meta.options.map((o) => o.flag.length));
|
|
183
|
+
lines.push("", "Options:");
|
|
184
|
+
for (const option of meta.options) {
|
|
185
|
+
lines.push(` ${option.flag.padEnd(width)} ${option.description}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
lines.push("", "Run `argent --help` for the full list of commands.", "");
|
|
189
|
+
console.log(lines.join("\n"));
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=installer-help.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installer-help.js","sourceRoot":"","sources":["../src/installer-help.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;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