@patto/cli 0.1.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 ADDED
@@ -0,0 +1,323 @@
1
+ # @patto/cli
2
+
3
+ Official CLI for Patto Bot Template projects.
4
+
5
+ `@patto/cli` is the user-facing wrapper for Patto tooling. It handles
6
+ scaffolding in TypeScript/Node and delegates heavy project analysis to the
7
+ native Rust core distributed through platform-specific optional dependencies.
8
+
9
+ Everything in this package is licensed under `AGPL-3.0-only`.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ pnpm add -g @patto/cli
15
+ ```
16
+
17
+ or:
18
+
19
+ ```bash
20
+ npm install -g @patto/cli
21
+ ```
22
+
23
+ After installation:
24
+
25
+ ```bash
26
+ patto --help
27
+ ```
28
+
29
+ ## Platform Support
30
+
31
+ `@patto/cli` installs the native core as optional dependencies. Supported
32
+ platforms today:
33
+
34
+ - Linux x64: `@patto/cli-core-linux-x64`
35
+ - Linux arm64: `@patto/cli-core-linux-arm64`
36
+ - Windows x64: `@patto/cli-core-win32-x64`
37
+
38
+ If your platform is not supported yet, the CLI exits with a clear error telling
39
+ you that no compatible native binary is available.
40
+
41
+ ## Project Root
42
+
43
+ Commands that analyze a bot project accept `--root`:
44
+
45
+ ```bash
46
+ patto check --root /path/to/patto-bot
47
+ ```
48
+
49
+ If omitted, the current working directory is used.
50
+
51
+ ## Scaffolding
52
+
53
+ Scaffolding is handled directly by the Node wrapper.
54
+
55
+ ### Command
56
+
57
+ By default, command scaffolding creates a split command:
58
+
59
+ ```bash
60
+ patto generate command info/ping
61
+ ```
62
+
63
+ Creates:
64
+
65
+ ```text
66
+ src/definitions/info/ping.definition.ts
67
+ src/commands/info/ping.command.ts
68
+ ```
69
+
70
+ Create a single command file instead:
71
+
72
+ ```bash
73
+ patto generate command info/ping --single-file
74
+ ```
75
+
76
+ `--unified` is an alias of `--single-file`.
77
+
78
+ ### Subcommand
79
+
80
+ ```bash
81
+ patto generate subcommand get --parent config
82
+ ```
83
+
84
+ Creates:
85
+
86
+ ```text
87
+ src/commands/config/get.command.ts
88
+ ```
89
+
90
+ ### Subcommand Group
91
+
92
+ ```bash
93
+ patto generate subcommand-group set --parent server --group config
94
+ ```
95
+
96
+ Creates:
97
+
98
+ ```text
99
+ src/commands/server/config/set.command.ts
100
+ ```
101
+
102
+ ### Definition
103
+
104
+ ```bash
105
+ patto generate definition help
106
+ ```
107
+
108
+ For subcommand definitions:
109
+
110
+ ```bash
111
+ patto generate definition get --kind subcommand --parent config
112
+ ```
113
+
114
+ For subcommand-group definitions:
115
+
116
+ ```bash
117
+ patto generate definition set --kind subcommand-group --parent server --group config
118
+ ```
119
+
120
+ ### Plugin
121
+
122
+ ```bash
123
+ patto generate plugin audit-log --scope deep-folder --folder moderation
124
+ ```
125
+
126
+ Creates:
127
+
128
+ ```text
129
+ src/plugins/audit-log.plugin.ts
130
+ ```
131
+
132
+ and registers it in:
133
+
134
+ ```text
135
+ src/config/plugins.config.ts
136
+ ```
137
+
138
+ For `PluginScope.Specified`, provide target commands:
139
+
140
+ ```bash
141
+ patto generate plugin review-gate --scope specified --commands info/about,admin/ban
142
+ ```
143
+
144
+ Skip automatic registration:
145
+
146
+ ```bash
147
+ patto generate plugin audit-log --no-register
148
+ ```
149
+
150
+ ### Generate Aliases
151
+
152
+ All generate commands can use aliases:
153
+
154
+ ```bash
155
+ patto g command ping
156
+ patto scaffold command ping
157
+ ```
158
+
159
+ ## Analysis Commands
160
+
161
+ These commands call the native Rust core.
162
+
163
+ ### scan
164
+
165
+ Indexes the project and writes `.patto/index.json`.
166
+
167
+ ```bash
168
+ patto scan --root /path/to/bot
169
+ ```
170
+
171
+ ### lint
172
+
173
+ Runs Patto static rules over commands, definitions, plugins and project
174
+ conventions.
175
+
176
+ ```bash
177
+ patto lint --root /path/to/bot
178
+ ```
179
+
180
+ ### doctor
181
+
182
+ Checks project health: runtime, dependencies, scripts, env files, tsconfig,
183
+ Patto config, sharding/Redis and build output.
184
+
185
+ ```bash
186
+ patto doctor --root /path/to/bot
187
+ ```
188
+
189
+ ### check
190
+
191
+ Runs `scan + lint + doctor`. This is the recommended command for CI and editor
192
+ integrations.
193
+
194
+ ```bash
195
+ patto check --root /path/to/bot
196
+ ```
197
+
198
+ ## Human Output
199
+
200
+ By default, diagnostics are rendered for humans:
201
+
202
+ ```text
203
+ src/config/plugins.config.ts:45:15 WARNING plugin-specified-commands
204
+ PluginScope.Specified no tiene una lista de commands válida.
205
+ 45 | // scope: PluginScope.Specified,
206
+ | ^^^^^^^^^^^^^^^^^^^^^
207
+ hint: Agrega commands: [MiCommand] cuando uses PluginScope.Specified.
208
+ ```
209
+
210
+ Severity colors:
211
+
212
+ - error: red
213
+ - warning: yellow/orange
214
+ - info: blue
215
+
216
+ ## JSON Output
217
+
218
+ Use `--json` to print the raw JSON returned by the Rust core:
219
+
220
+ ```bash
221
+ patto check --root /path/to/bot --json
222
+ ```
223
+
224
+ Diagnostics include:
225
+
226
+ ```json
227
+ {
228
+ "level": "warning",
229
+ "code": "plugin-specified-commands",
230
+ "message": "PluginScope.Specified no tiene una lista de commands válida.",
231
+ "file": "src/config/plugins.config.ts",
232
+ "line": 45,
233
+ "column": 15,
234
+ "hint": "Agrega commands: [MiCommand] cuando uses PluginScope.Specified."
235
+ }
236
+ ```
237
+
238
+ ## Stdin API
239
+
240
+ The CLI exposes a structured API for extensions and other tools:
241
+
242
+ ```bash
243
+ printf '{"command":"check","root":"/path/to/bot","lang":"es"}' | patto core --stdin
244
+ ```
245
+
246
+ Response shape:
247
+
248
+ ```json
249
+ {
250
+ "ok": true,
251
+ "command": "check",
252
+ "exitCode": 0,
253
+ "stderr": "",
254
+ "output": {},
255
+ "diagnostics": []
256
+ }
257
+ ```
258
+
259
+ Supported `command` values:
260
+
261
+ - `scan`
262
+ - `lint`
263
+ - `doctor`
264
+ - `check`
265
+
266
+ ## Configuration
267
+
268
+ Patto projects use:
269
+
270
+ ```text
271
+ .patto/config.json
272
+ ```
273
+
274
+ Minimum config:
275
+
276
+ ```json
277
+ {
278
+ "schemaVersion": 1,
279
+ "lang": "es"
280
+ }
281
+ ```
282
+
283
+ Lint rules can be configured with severities:
284
+
285
+ ```json
286
+ {
287
+ "lint-rules": {
288
+ "duplicate-commands": "error",
289
+ "invalid-command-names": "warning",
290
+ "ghost-parent-mix": "off"
291
+ }
292
+ }
293
+ ```
294
+
295
+ Supported severities:
296
+
297
+ - `off`
298
+ - `info`
299
+ - `warning`
300
+ - `error`
301
+
302
+ ## Development
303
+
304
+ From the monorepo root:
305
+
306
+ ```bash
307
+ pnpm install
308
+ pnpm --filter @patto/cli build
309
+ pnpm --filter @patto/cli dev -- --help
310
+ ```
311
+
312
+ Build native binaries:
313
+
314
+ ```bash
315
+ pnpm build:core
316
+ ```
317
+
318
+ ## License
319
+
320
+ `@patto/cli` is licensed under `AGPL-3.0-only`.
321
+
322
+ The native core packages consumed by this CLI are also licensed under
323
+ `AGPL-3.0-only`.
@@ -0,0 +1,3 @@
1
+ import type { CAC } from 'cac';
2
+ export declare function registerCoreCommands(cli: CAC): void;
3
+ export declare function writeStructuredError(error: unknown): void;
@@ -0,0 +1,82 @@
1
+ import path from 'node:path';
2
+ import { runCore } from '../core/run.js';
3
+ import { readCoreRequest } from '../core/stdin.js';
4
+ import { diagnosticsFromOutput, printHumanOutput } from '../output/diagnostics.js';
5
+ export function registerCoreCommands(cli) {
6
+ registerCoreCommand(cli.command('scan', 'Indexa el proyecto Patto'), 'scan');
7
+ registerCoreCommand(cli.command('lint', 'Ejecuta reglas estaticas de Patto'), 'lint');
8
+ registerCoreCommand(cli.command('doctor', 'Revisa salud del entorno Patto'), 'doctor');
9
+ registerCoreCommand(cli.command('check', 'Ejecuta scan + lint + doctor'), 'check');
10
+ cli.command('core', 'API JSON por stdin para extensiones')
11
+ .option('--stdin', 'Lee un request JSON desde stdin')
12
+ .action(async (options) => {
13
+ if (!options.stdin) {
14
+ throw new Error('Usa patto core --stdin.');
15
+ }
16
+ await runFromStdin();
17
+ });
18
+ }
19
+ function registerCoreCommand(command, coreCommand) {
20
+ command
21
+ .option('--root <path>', 'Raiz del proyecto Patto')
22
+ .option('--lang <lang>', 'Idioma del core: auto o es')
23
+ .option('--json', 'Imprime la salida JSON cruda del core')
24
+ .option('--stdin', 'Lee root/lang desde un request JSON en stdin')
25
+ .action(async (options) => {
26
+ if (options.stdin) {
27
+ await runFromStdin(coreCommand);
28
+ return;
29
+ }
30
+ await runDirect(coreCommand, options);
31
+ });
32
+ }
33
+ async function runDirect(command, options) {
34
+ const root = path.resolve(options.root ?? process.cwd());
35
+ const result = await runCore({
36
+ command,
37
+ root,
38
+ lang: options.lang,
39
+ });
40
+ if (options.json) {
41
+ process.stdout.write(result.stdout);
42
+ if (!result.stdout.endsWith('\n')) {
43
+ process.stdout.write('\n');
44
+ }
45
+ }
46
+ else {
47
+ if (result.stderr.trim().length > 0) {
48
+ process.stderr.write(result.stderr);
49
+ }
50
+ printHumanOutput(result.output, { root, command });
51
+ }
52
+ process.exitCode = result.exitCode;
53
+ }
54
+ async function runFromStdin(defaultCommand) {
55
+ const request = await readCoreRequest(defaultCommand);
56
+ const result = await runCore(request);
57
+ const envelope = {
58
+ ok: result.exitCode === 0,
59
+ command: result.command,
60
+ exitCode: result.exitCode,
61
+ stderr: result.stderr,
62
+ output: result.output,
63
+ diagnostics: diagnosticsFromOutput(result.output),
64
+ };
65
+ process.stdout.write(`${JSON.stringify(envelope, null, 2)}\n`);
66
+ process.exitCode = result.exitCode;
67
+ }
68
+ export function writeStructuredError(error) {
69
+ const message = error instanceof Error ? error.message : String(error);
70
+ const code = error instanceof Error && 'code' in error && typeof error.code === 'string'
71
+ ? error.code
72
+ : 'patto_cli_error';
73
+ const payload = {
74
+ ok: false,
75
+ error: {
76
+ message,
77
+ code,
78
+ },
79
+ };
80
+ process.stderr.write(`${JSON.stringify(payload, null, 2)}\n`);
81
+ }
82
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {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CAC): void;
@@ -0,0 +1,231 @@
1
+ import chalk from "chalk";
2
+ import path from "node:path";
3
+ import { commandDefinitionTemplate, commandImplementationTemplate, commandSingleFileTemplate, normalizeCategory, normalizePluginScope, pluginCommandImportStatements, pluginImportStatement, pluginRegistrationTemplate, pluginTemplate, standaloneDefinitionTemplate, subcommandGroupTemplate, subcommandTemplate, } from "../scaffold/templates.js";
4
+ import { parseDiscordName, parsePathSegments, parseScaffoldName, } from "../scaffold/names.js";
5
+ import { fileExists, projectPath, readTextFile, resolveProject, writeFileOnce, writeTextFile, } from "../scaffold/project.js";
6
+ export function registerGenerateCommand(cli) {
7
+ registerGenerateAlias(cli.command("generate <type> [name]", "Genera scaffolds Patto"));
8
+ registerGenerateAlias(cli.command("g <type> [name]", "Alias de generate"));
9
+ registerGenerateAlias(cli.command("scaffold <type> [name]", "Alias de generate"));
10
+ }
11
+ function registerGenerateAlias(command) {
12
+ withGenerateOptions(command).action(runAction(dispatchGenerate));
13
+ }
14
+ function dispatchGenerate(type, name, options) {
15
+ const scaffoldName = required(name, "nombre");
16
+ switch (type) {
17
+ case "command":
18
+ case "cmd":
19
+ generateCommand(scaffoldName, options);
20
+ return;
21
+ case "subcommand":
22
+ case "sub":
23
+ generateSubcommand(scaffoldName, options);
24
+ return;
25
+ case "subcommand-group":
26
+ case "group":
27
+ generateSubcommandGroup(scaffoldName, options);
28
+ return;
29
+ case "definition":
30
+ case "def":
31
+ generateDefinition(scaffoldName, options);
32
+ return;
33
+ case "plugin":
34
+ generatePlugin(scaffoldName, options);
35
+ return;
36
+ default:
37
+ throw new Error("Tipo de scaffold invalido. Usa command, subcommand, subcommand-group, definition o plugin.");
38
+ }
39
+ }
40
+ function generateCommand(name, options) {
41
+ const project = resolveProject(options.root);
42
+ const parsed = parseScaffoldName(name, "comando");
43
+ const category = normalizeCategory(options.category);
44
+ const commandFile = projectPath(project, "src", "commands", ...parsed.dirs, `${parsed.fileBase}.command.ts`);
45
+ if (options.singleFile || options.unified) {
46
+ const result = writeFileOnce(commandFile, commandSingleFileTemplate(parsed, { ...options, category }), Boolean(options.force));
47
+ printCreated([result], project);
48
+ return;
49
+ }
50
+ const definitionFile = projectPath(project, "src", "definitions", ...parsed.dirs, `${parsed.fileBase}.definition.ts`);
51
+ const results = [
52
+ writeFileOnce(definitionFile, commandDefinitionTemplate(parsed, { ...options, category }), Boolean(options.force)),
53
+ writeFileOnce(commandFile, commandImplementationTemplate(parsed), Boolean(options.force)),
54
+ ];
55
+ printCreated(results, project);
56
+ }
57
+ function generateSubcommand(name, options) {
58
+ const project = resolveProject(options.root);
59
+ const parsed = parseScaffoldName(name, "subcomando");
60
+ const parent = parseDiscordName(required(options.parent, "--parent"), "comando padre");
61
+ const dirs = parsed.dirs.length > 0 ? parsed.dirs : [parent];
62
+ const commandFile = projectPath(project, "src", "commands", ...dirs, `${parsed.fileBase}.command.ts`);
63
+ const result = writeFileOnce(commandFile, subcommandTemplate(parsed, {
64
+ ...options,
65
+ parent,
66
+ category: normalizeCategory(options.category),
67
+ }), Boolean(options.force));
68
+ printCreated([result], project);
69
+ }
70
+ function generateSubcommandGroup(name, options) {
71
+ const project = resolveProject(options.root);
72
+ const parsed = parseScaffoldName(name, "subcomando");
73
+ const parent = parseDiscordName(required(options.parent, "--parent"), "comando padre");
74
+ const group = parseDiscordName(required(options.group, "--group"), "grupo");
75
+ const dirs = parsed.dirs.length > 0 ? parsed.dirs : [parent, group];
76
+ const commandFile = projectPath(project, "src", "commands", ...dirs, `${parsed.fileBase}.command.ts`);
77
+ const result = writeFileOnce(commandFile, subcommandGroupTemplate(parsed, {
78
+ ...options,
79
+ parent,
80
+ group,
81
+ category: normalizeCategory(options.category),
82
+ }), Boolean(options.force));
83
+ printCreated([result], project);
84
+ }
85
+ function generateDefinition(name, options) {
86
+ const project = resolveProject(options.root);
87
+ const parsed = parseScaffoldName(name, "definition");
88
+ const kind = normalizeDefinitionKind(options.kind);
89
+ const definitionFile = projectPath(project, "src", "definitions", ...parsed.dirs, `${parsed.fileBase}.definition.ts`);
90
+ const result = writeFileOnce(definitionFile, standaloneDefinitionTemplate(parsed, kind, {
91
+ ...options,
92
+ category: normalizeCategory(options.category),
93
+ }), Boolean(options.force));
94
+ printCreated([result], project);
95
+ }
96
+ function generatePlugin(name, options) {
97
+ const project = resolveProject(options.root);
98
+ const parsed = parseScaffoldName(name, "plugin");
99
+ const scope = normalizePluginScope(options.scope, options.folder);
100
+ const folder = normalizePluginFolder(scope, options.folder);
101
+ const commands = parseCommandList(options.commands);
102
+ if (scope === "specified" && commands.length === 0) {
103
+ throw new Error("PluginScope.Specified necesita --commands admin/ban,info/ping.");
104
+ }
105
+ const pluginFile = projectPath(project, "src", "plugins", ...parsed.dirs, `${parsed.fileBase}.plugin.ts`);
106
+ const result = writeFileOnce(pluginFile, pluginTemplate(parsed.classBase), Boolean(options.force));
107
+ if (options.register !== false) {
108
+ registerPlugin(project, {
109
+ classBase: parsed.classBase,
110
+ commands,
111
+ folder,
112
+ importPath: `@/plugins/${[...parsed.dirs, `${parsed.fileBase}.plugin`].join("/")}`,
113
+ scope,
114
+ });
115
+ }
116
+ printCreated([result], project);
117
+ }
118
+ function registerPlugin(project, options) {
119
+ const configFile = projectPath(project, "src", "config", "plugins.config.ts");
120
+ let content = fileExists(configFile) ? readTextFile(configFile) : "";
121
+ const imports = [
122
+ "import { PluginRegistry, PluginScope } from './plugin.registry';",
123
+ pluginImportStatement(options.classBase, options.importPath),
124
+ ...pluginCommandImportStatements(options.commands),
125
+ ];
126
+ const registration = pluginRegistrationTemplate(options);
127
+ content = addImports(content, imports);
128
+ if (!content.includes(registration)) {
129
+ content = `${content.trimEnd()}\n\n${registration}\n`;
130
+ }
131
+ writeTextFile(configFile, content);
132
+ console.log(chalk.green(`Plugin registrado en ${path.relative(project.root, configFile)}`));
133
+ }
134
+ function addImports(content, imports) {
135
+ let next = content.trimStart();
136
+ for (const importStatement of imports) {
137
+ if (next.includes(importStatement)) {
138
+ continue;
139
+ }
140
+ const lastImportEnd = findLastImportEnd(next);
141
+ next =
142
+ lastImportEnd === 0
143
+ ? `${importStatement}\n${next}`
144
+ : `${next.slice(0, lastImportEnd)}${importStatement}\n${next.slice(lastImportEnd)}`;
145
+ }
146
+ return next;
147
+ }
148
+ function findLastImportEnd(content) {
149
+ const importRegex = /^import .+;\n/gm;
150
+ let lastEnd = 0;
151
+ let match;
152
+ while ((match = importRegex.exec(content)) !== null) {
153
+ lastEnd = match.index + match[0].length;
154
+ }
155
+ return lastEnd;
156
+ }
157
+ function normalizePluginFolder(scope, folder) {
158
+ if (scope === "specified") {
159
+ return "";
160
+ }
161
+ if (scope === "folder" && !folder) {
162
+ throw new Error("PluginScope.Folder necesita --folder.");
163
+ }
164
+ return folder ? parsePathSegments(folder, "folder").join("/") : "";
165
+ }
166
+ function parseCommandList(input) {
167
+ if (!input) {
168
+ return [];
169
+ }
170
+ return input
171
+ .split(",")
172
+ .map((item) => item.trim())
173
+ .filter(Boolean)
174
+ .map((item) => {
175
+ parseScaffoldName(item, "comando");
176
+ return item;
177
+ });
178
+ }
179
+ function normalizeDefinitionKind(kind) {
180
+ if (kind === undefined) {
181
+ return "command";
182
+ }
183
+ if (kind === "command" ||
184
+ kind === "subcommand" ||
185
+ kind === "subcommand-group") {
186
+ return kind;
187
+ }
188
+ throw new Error("--kind debe ser command, subcommand o subcommand-group.");
189
+ }
190
+ function withGenerateOptions(command) {
191
+ return command
192
+ .option("--root <path>", "Raiz del proyecto Patto")
193
+ .option("--force", "Reemplaza archivos existentes")
194
+ .option("-d, --description <text>", "Descripcion del comando")
195
+ .option("-c, --category <name>", "info, utils, moderation, settings, economy u other")
196
+ .option("--single-file", "Crea solo el archivo .command.ts")
197
+ .option("-u, --unified", "Alias de --single-file")
198
+ .option("--kind <kind>", "command, subcommand o subcommand-group")
199
+ .option("-p, --parent <name>", "Nombre del comando padre")
200
+ .option("-g, --group <name>", "Nombre del grupo")
201
+ .option("--scope <scope>", "specified, folder o deep-folder")
202
+ .option("--folder <path>", "Carpeta de comandos para folder/deep-folder")
203
+ .option("--commands <paths>", "Lista separada por coma para scope specified")
204
+ .option("--no-register", "No modifica src/config/plugins.config.ts");
205
+ }
206
+ function runAction(handler) {
207
+ return async (...args) => {
208
+ try {
209
+ await handler(...args);
210
+ }
211
+ catch (error) {
212
+ console.error(chalk.red(formatError(error)));
213
+ process.exitCode = 1;
214
+ }
215
+ };
216
+ }
217
+ function printCreated(results, project) {
218
+ for (const result of results) {
219
+ console.log(chalk.green(`Creado ${path.relative(project.root, result.path)}`));
220
+ }
221
+ }
222
+ function required(value, option) {
223
+ if (!value) {
224
+ throw new Error(`Falta ${option}.`);
225
+ }
226
+ return value;
227
+ }
228
+ function formatError(error) {
229
+ return error instanceof Error ? error.message : String(error);
230
+ }
231
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACH,yBAAyB,EACzB,6BAA6B,EAC7B,yBAAyB,EACzB,iBAAiB,EACjB,oBAAoB,EACpB,6BAA6B,EAC7B,qBAAqB,EACrB,0BAA0B,EAC1B,cAAc,EACd,4BAA4B,EAC5B,uBAAuB,EACvB,kBAAkB,GAGrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEH,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACH,UAAU,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,GAGhB,MAAM,wBAAwB,CAAC;AAkChC,MAAM,UAAU,uBAAuB,CAAC,GAAQ;IAC5C,qBAAqB,CAAC,GAAG,CAAC,OAAO,CAAC,wBAAwB,EAAE,wBAAwB,CAAC,CAAC,CAAC;IACvF,qBAAqB,CAAC,GAAG,CAAC,OAAO,CAAC,iB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,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACzB,CAAC;IACL,CAAC,CAAC;AACN,CAAC;AAED,SAAS,YAAY,CAAC,OAAsB,EAAE,OAAuB;IACjE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CACP,KAAK,CAAC,KAAK,CAAC,UAAU,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CACpE,CAAC;IACN,CAAC;AACL,CAAC;AAED,SAAS,QAAQ,CAAC,KAAyB,EAAE,MAAc;IACvD,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,SAAS,MAAM,GAAG,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IAC/B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAClE,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare class CoreBinaryError extends Error {
2
+ readonly code = "patto_cli_core_unavailable";
3
+ }
4
+ export declare function resolveCoreBinary(): string;