@hugo.bastidas/agent-foundation 0.1.0 → 0.2.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/README.md +37 -7
- package/dist/cli.js +1464 -49
- package/dist/hosts.d.ts +1 -1
- package/dist/hosts.d.ts.map +1 -1
- package/dist/hosts.js +2 -1
- package/dist/hosts.js.map +1 -1
- package/package.json +4 -2
package/dist/cli.js
CHANGED
|
@@ -1,12 +1,1429 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
try {
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
+
} catch (e) {
|
|
12
|
+
throw mod = 0, e;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
|
|
32
|
+
// node_modules/sisteransi/src/index.js
|
|
33
|
+
var require_src = __commonJS({
|
|
34
|
+
"node_modules/sisteransi/src/index.js"(exports, module) {
|
|
35
|
+
"use strict";
|
|
36
|
+
var ESC2 = "\x1B";
|
|
37
|
+
var CSI2 = `${ESC2}[`;
|
|
38
|
+
var beep = "\x07";
|
|
39
|
+
var cursor3 = {
|
|
40
|
+
to(x, y) {
|
|
41
|
+
if (!y) return `${CSI2}${x + 1}G`;
|
|
42
|
+
return `${CSI2}${y + 1};${x + 1}H`;
|
|
43
|
+
},
|
|
44
|
+
move(x, y) {
|
|
45
|
+
let ret = "";
|
|
46
|
+
if (x < 0) ret += `${CSI2}${-x}D`;
|
|
47
|
+
else if (x > 0) ret += `${CSI2}${x}C`;
|
|
48
|
+
if (y < 0) ret += `${CSI2}${-y}A`;
|
|
49
|
+
else if (y > 0) ret += `${CSI2}${y}B`;
|
|
50
|
+
return ret;
|
|
51
|
+
},
|
|
52
|
+
up: (count = 1) => `${CSI2}${count}A`,
|
|
53
|
+
down: (count = 1) => `${CSI2}${count}B`,
|
|
54
|
+
forward: (count = 1) => `${CSI2}${count}C`,
|
|
55
|
+
backward: (count = 1) => `${CSI2}${count}D`,
|
|
56
|
+
nextLine: (count = 1) => `${CSI2}E`.repeat(count),
|
|
57
|
+
prevLine: (count = 1) => `${CSI2}F`.repeat(count),
|
|
58
|
+
left: `${CSI2}G`,
|
|
59
|
+
hide: `${CSI2}?25l`,
|
|
60
|
+
show: `${CSI2}?25h`,
|
|
61
|
+
save: `${ESC2}7`,
|
|
62
|
+
restore: `${ESC2}8`
|
|
63
|
+
};
|
|
64
|
+
var scroll = {
|
|
65
|
+
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
66
|
+
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
67
|
+
};
|
|
68
|
+
var erase3 = {
|
|
69
|
+
screen: `${CSI2}2J`,
|
|
70
|
+
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
71
|
+
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
72
|
+
line: `${CSI2}2K`,
|
|
73
|
+
lineEnd: `${CSI2}K`,
|
|
74
|
+
lineStart: `${CSI2}1K`,
|
|
75
|
+
lines(count) {
|
|
76
|
+
let clear = "";
|
|
77
|
+
for (let i2 = 0; i2 < count; i2++)
|
|
78
|
+
clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
|
|
79
|
+
if (count)
|
|
80
|
+
clear += cursor3.left;
|
|
81
|
+
return clear;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// src/cli.ts
|
|
89
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
90
|
+
|
|
91
|
+
// src/foundation.ts
|
|
92
|
+
import { readFile, writeFile, mkdir, rm } from "node:fs/promises";
|
|
93
|
+
import { dirname, join, resolve } from "node:path";
|
|
94
|
+
var AGENT_FOUNDATION_START = "<!-- >>> agent-foundation >>> -->";
|
|
95
|
+
var AGENT_FOUNDATION_END = "<!-- <<< agent-foundation <<< -->";
|
|
96
|
+
var AGENT_FOUNDATION_FILE = "AGENT_FOUNDATION.md";
|
|
97
|
+
var AGENT_FOUNDATION_INSTRUCTIONS = [
|
|
98
|
+
"## Agent Foundation",
|
|
99
|
+
"",
|
|
100
|
+
"### Code conventions",
|
|
101
|
+
"",
|
|
102
|
+
"| Element | Language |",
|
|
103
|
+
"|---|---|",
|
|
104
|
+
"| Variables, functions, constants | English |",
|
|
105
|
+
"| Classes and types | English |",
|
|
106
|
+
"| File names | English |",
|
|
107
|
+
"| Inline/block comments | Spanish |",
|
|
108
|
+
"| User-facing UI text | Spanish unless the project targets a specific locale |",
|
|
109
|
+
"",
|
|
110
|
+
"These conventions apply across TypeScript, JavaScript, Python, Astro, CSS, and other stacks.",
|
|
111
|
+
"",
|
|
112
|
+
"### Code quality and security",
|
|
113
|
+
"",
|
|
114
|
+
"- Write optimal code: avoid redundant logic, unnecessary loops, avoidable re-renders, N+1 queries, and preventable inefficiencies.",
|
|
115
|
+
"- Write secure code: prevent OWASP Top 10 issues, never hardcode secrets, and validate inputs at system boundaries.",
|
|
116
|
+
"- Boundary input validation and secret/security controls are required even when the user did not explicitly request them.",
|
|
117
|
+
"- Prefer simple, direct solutions over premature abstractions.",
|
|
118
|
+
"- Do not add error handling, validations, or features that were not explicitly requested unless they are necessary for boundary security, data integrity, or safe failure of the requested behavior.",
|
|
119
|
+
"",
|
|
120
|
+
"### Documentation lookups",
|
|
121
|
+
"",
|
|
122
|
+
"- When current library, framework, SDK, API, CLI, or cloud-service documentation is needed, use the available Context7 MCP/tooling first.",
|
|
123
|
+
"- If Context7 is unavailable or does not cover the requested technology, use the best available official documentation source.",
|
|
124
|
+
"- Do not rely on memory alone for version-sensitive syntax, setup, migration, or API behavior.",
|
|
125
|
+
"",
|
|
126
|
+
"### Required project structure",
|
|
127
|
+
"",
|
|
128
|
+
"Every new or existing project should have:",
|
|
129
|
+
"",
|
|
130
|
+
"1. `.env` \u2014 real environment variables, never committed.",
|
|
131
|
+
"2. `.env.example` \u2014 same keys without sensitive values, committed.",
|
|
132
|
+
"3. `.gitignore` \u2014 adjusted to the project stack.",
|
|
133
|
+
"4. Lock file \u2014 commit it (`package-lock.json`, `uv.lock`, `go.sum`, etc.). Never add lock files to `.gitignore`.",
|
|
134
|
+
"",
|
|
135
|
+
"The `.gitignore` should include at minimum:",
|
|
136
|
+
"",
|
|
137
|
+
"- Node/JS/TS: `node_modules/`, `dist/`, `.env`, `.env.local`, `*.log`",
|
|
138
|
+
"- Python: `__pycache__/`, `*.pyc`, `.venv/`, `.env`, `dist/`, `*.egg-info/`",
|
|
139
|
+
"- Astro: Node entries plus `.astro/`",
|
|
140
|
+
"- General: `.DS_Store`, `Thumbs.db`, `.idea/`, `.vscode/` unless team settings are intentionally shared.",
|
|
141
|
+
"- AI tool artifacts: `.minimax/runs/`, `.minimax/cli-tests/`, `.minimax/multimodal-tests/`",
|
|
142
|
+
"",
|
|
143
|
+
"If these files are missing, tell the user and offer to create them.",
|
|
144
|
+
"",
|
|
145
|
+
"### Node.js workflow",
|
|
146
|
+
"",
|
|
147
|
+
"Use `npm` by default. Do not switch to yarn, pnpm, or bun unless the project already uses one of them (check for `yarn.lock`, `pnpm-lock.yaml`, or `bun.lockb`). Commit `package-lock.json` \u2014 never gitignore it.",
|
|
148
|
+
"",
|
|
149
|
+
"Do not install a package to do something the runtime or an already-present dependency already handles.",
|
|
150
|
+
"",
|
|
151
|
+
"### Python workflow",
|
|
152
|
+
"",
|
|
153
|
+
"Always use `uv` for Python projects. Use `pyproject.toml` plus `uv.lock` as the default dependency contract, create/update dependencies with `uv add` or `uv remove`, install reproducibly with `uv sync --locked` (or `uv sync --frozen` when the project already standardizes on that flag), and run tools through `uv run` (for example `uv run pytest`, `uv run ruff check .`, `uv run mypy src`, or `uv run python -m package`). Do not introduce raw `pip`, manual `venv` setup, Poetry, Pipenv, or requirements-only workflows unless the user explicitly asks for compatibility with an existing project that already depends on them.",
|
|
154
|
+
"",
|
|
155
|
+
"### Testing",
|
|
156
|
+
"",
|
|
157
|
+
"Write tests only when explicitly requested or when the project already has a test suite and new code clearly belongs in it. Do not create a test suite from scratch unless asked.",
|
|
158
|
+
"",
|
|
159
|
+
"When writing tests:",
|
|
160
|
+
"- Test observable behavior, not implementation details.",
|
|
161
|
+
"- Follow the naming and placement convention already used in the project (e.g., `foo.test.ts` next to source, or a `/tests` directory at the project root).",
|
|
162
|
+
"- Prefer integration-level assertions over mocking internals.",
|
|
163
|
+
"",
|
|
164
|
+
"### Git repository initialization",
|
|
165
|
+
"",
|
|
166
|
+
"When starting or scaffolding any new project:",
|
|
167
|
+
"",
|
|
168
|
+
"1. Verify the directory is a git repository (`git status`). If not, run `git init` immediately before creating any project files.",
|
|
169
|
+
"2. Verify `.gitignore` exists and covers the project stack (see above). Create or update it before making any commit.",
|
|
170
|
+
"3. Make the initial commit only after `.gitignore`, `.env.example`, and the main documentation file (`AGENTS.md` or `README.md`) are in place.",
|
|
171
|
+
"",
|
|
172
|
+
"If any of these are missing when starting work on a new project, tell the user and offer to create them.",
|
|
173
|
+
"",
|
|
174
|
+
"### Git commit conventions",
|
|
175
|
+
"",
|
|
176
|
+
"When making commits in any project:",
|
|
177
|
+
"",
|
|
178
|
+
"- Use the Conventional Commits format: `type(scope): short description`",
|
|
179
|
+
"- Write commit title and body bullets in Spanish.",
|
|
180
|
+
"- Allowed types: `feat`, `fix`, `refactor`, `style`, `chore`, `docs`, `test`, `perf`, `ci`, `build`",
|
|
181
|
+
"- Keep the title concise (under 72 characters), lowercase, no trailing period.",
|
|
182
|
+
"- Add a body with bullet points when 3+ files change or changes clearly span different areas.",
|
|
183
|
+
"- Never include secrets, tokens, keys, or env variable values in commit messages.",
|
|
184
|
+
"- Always show the proposed message to the user and ask for confirmation before running `git commit`.",
|
|
185
|
+
"- After committing, ask the user whether to also run `git push`.",
|
|
186
|
+
"",
|
|
187
|
+
"Examples:",
|
|
188
|
+
"",
|
|
189
|
+
"```",
|
|
190
|
+
"fix(auth): corregir validaci\xF3n de token expirado",
|
|
191
|
+
"```",
|
|
192
|
+
"",
|
|
193
|
+
"```",
|
|
194
|
+
"feat(install): agregar componente de alias de shell y selecci\xF3n de hosts",
|
|
195
|
+
"",
|
|
196
|
+
"- agregar shell-alias.ts para generar alias mmx en bash/zsh",
|
|
197
|
+
"- ampliar el instalador con selecci\xF3n m\xFAltiple de hosts Claude",
|
|
198
|
+
"- expandir estad\xEDsticas de uso con desglose por herramienta",
|
|
199
|
+
"```",
|
|
200
|
+
"",
|
|
201
|
+
"### Required project documentation",
|
|
202
|
+
"",
|
|
203
|
+
"All local project documentation files (AGENTS.md, README.md, ARCHITECTURE.md, DESIGN.md) must be written in Spanish. Global sidecars (AGENT_FOUNDATION.md and any other host-level references you have installed) remain in English.",
|
|
204
|
+
"",
|
|
205
|
+
"Every new project must include these files at the repository root:",
|
|
206
|
+
"",
|
|
207
|
+
'1. `CLAUDE.md` \u2014 keep it free of project content; it only points the agent to `AGENTS.md`. Use a single line such as: "Always read and follow `AGENTS.md` for all project context and instructions."',
|
|
208
|
+
"2. `AGENTS.md` \u2014 the canonical project brief. It holds the most relevant information: project purpose, stack, run/build/test commands, project-specific constraints, and agent guidance. This is where the real instructions live.",
|
|
209
|
+
"3. `ARCHITECTURE.md` \u2014 a short, high-level map of the system (see below). Create it once the project has more than a couple of modules.",
|
|
210
|
+
"4. `DESIGN.md` \u2014 the design-system contract for the UI (see below). **Frontend projects only.**",
|
|
211
|
+
"",
|
|
212
|
+
"A project-local `AGENTS.md` must contain ONLY what is unique to that project. Never copy, paraphrase, or summarize sections already provided by global sidecars (`AGENT_FOUNDATION.md` or any other host-level references you have installed).",
|
|
213
|
+
"",
|
|
214
|
+
"**Never include in a local AGENTS.md:**",
|
|
215
|
+
"- Code conventions (variables, comments, file names, UI text language)",
|
|
216
|
+
"- Code quality or security rules",
|
|
217
|
+
"- Documentation lookup instructions (Context7, etc.)",
|
|
218
|
+
"- Required project structure (.env, .gitignore, lock file rules)",
|
|
219
|
+
"- Node.js or Python workflow rules",
|
|
220
|
+
"- Git repository initialization steps",
|
|
221
|
+
"- Git commit conventions or examples",
|
|
222
|
+
"- Any tool-specific routing or delegation policy (belongs in that tool's own sidecar)",
|
|
223
|
+
"- Any section that would be identical or near-identical across projects",
|
|
224
|
+
"",
|
|
225
|
+
"**A correct local AGENTS.md contains only:**",
|
|
226
|
+
"- What this project does (1\u20133 sentences)",
|
|
227
|
+
"- Stack and key dependencies",
|
|
228
|
+
"- How to build, test, and run the project",
|
|
229
|
+
"- Project-specific constraints or domain rules not covered globally",
|
|
230
|
+
"",
|
|
231
|
+
"When in doubt, omit the section. The global sidecars are always active \u2014 repeating them wastes tokens and creates drift when the global rule changes.",
|
|
232
|
+
"",
|
|
233
|
+
"#### ARCHITECTURE.md (keep it to ~1 page; point to code, do not duplicate it)",
|
|
234
|
+
"",
|
|
235
|
+
"- Overview: a few sentences on what the system does and its bird's-eye shape.",
|
|
236
|
+
"- Codemap: name the important modules, files, and types and what each is responsible for. Refer to them by name so symbol search can find them; avoid links that go stale.",
|
|
237
|
+
'- Invariants: rules that must always hold, especially "absence" rules (e.g. the model layer never imports the view layer).',
|
|
238
|
+
"- Boundaries: the seams between layers/systems and what each side may assume about the other.",
|
|
239
|
+
"- Cross-cutting concerns: logging, auth, error handling, configuration \u2014 anything that spans modules.",
|
|
240
|
+
"- Update it when the coarse structure changes, not on every edit.",
|
|
241
|
+
"",
|
|
242
|
+
"#### DESIGN.md (frontend only)",
|
|
243
|
+
"",
|
|
244
|
+
"A machine- and human-readable design-system spec so the UI stays consistent (format: github.com/google-labs-code/design.md):",
|
|
245
|
+
"",
|
|
246
|
+
"- YAML front matter with design tokens: colors (hex), typography (family, size, weight, line height), spacing scale, radius scale, and components that reference those tokens.",
|
|
247
|
+
"- Markdown body with the rationale: design philosophy and how/when to apply each token.",
|
|
248
|
+
"- Recommended sections, in order: Overview, Colors, Typography, Layout, Elevation & Depth, Shapes, Components, Do's and Don'ts.",
|
|
249
|
+
"- Treat it as the source of truth for styling; generate framework tokens (e.g. Tailwind) from it instead of hardcoding values.",
|
|
250
|
+
"",
|
|
251
|
+
"If any required documentation file is missing when starting or scaffolding a project, tell the user and offer to create it."
|
|
252
|
+
].join("\n");
|
|
253
|
+
var LEGACY_CLAUDE_SECTION_PATTERNS = [
|
|
254
|
+
/## Ruta del usuario\n[\s\S]*?(?=\n## Convenciones de código|\n## Calidad y seguridad del código|\n## Estructura obligatoria de proyectos|\n@RTK\.md|\n<!-- >>> minimax-plugin >>>|$)/g,
|
|
255
|
+
/## Convenciones de código \(aplican a todos los proyectos\)\n[\s\S]*?(?=\n## Calidad y seguridad del código|\n## Estructura obligatoria de proyectos|\n@RTK\.md|\n<!-- >>> minimax-plugin >>>|$)/g,
|
|
256
|
+
/## Calidad y seguridad del código\n[\s\S]*?(?=\n## Estructura obligatoria de proyectos|\n@RTK\.md|\n<!-- >>> minimax-plugin >>>|$)/g,
|
|
257
|
+
/## Estructura obligatoria de proyectos\n[\s\S]*?(?=\n@RTK\.md|\n<!-- >>> minimax-plugin >>>|$)/g
|
|
258
|
+
];
|
|
259
|
+
function escapeRegExp(str) {
|
|
260
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
261
|
+
}
|
|
262
|
+
function normalizeLf(content) {
|
|
263
|
+
return content.replace(/\r\n/g, "\n");
|
|
264
|
+
}
|
|
265
|
+
function stripManagedAgentFoundation(content) {
|
|
266
|
+
return normalizeLf(content).replace(
|
|
267
|
+
new RegExp(`${escapeRegExp(AGENT_FOUNDATION_START)}[\\s\\S]*?${escapeRegExp(AGENT_FOUNDATION_END)}`, "g"),
|
|
268
|
+
""
|
|
269
|
+
).trim();
|
|
270
|
+
}
|
|
271
|
+
function stripLegacyClaudeSections(content) {
|
|
272
|
+
return LEGACY_CLAUDE_SECTION_PATTERNS.reduce((current, pattern) => current.replace(pattern, ""), normalizeLf(content)).replace(/\n{3,}/g, "\n\n").trim();
|
|
273
|
+
}
|
|
274
|
+
function instructionReference(filePath) {
|
|
275
|
+
return `@${resolve(filePath).replace(/\\/g, "/")}`;
|
|
276
|
+
}
|
|
277
|
+
function managedReferenceBlock(targetPath) {
|
|
278
|
+
return [
|
|
279
|
+
AGENT_FOUNDATION_START,
|
|
280
|
+
instructionReference(targetPath),
|
|
281
|
+
AGENT_FOUNDATION_END
|
|
282
|
+
].join("\n");
|
|
283
|
+
}
|
|
284
|
+
function agentFoundationPath(globalInstructionsPath) {
|
|
285
|
+
return join(dirname(globalInstructionsPath), AGENT_FOUNDATION_FILE);
|
|
286
|
+
}
|
|
287
|
+
async function writeAgentFoundation(filePath) {
|
|
288
|
+
const targetPath = agentFoundationPath(filePath);
|
|
289
|
+
let existing = "";
|
|
290
|
+
try {
|
|
291
|
+
existing = await readFile(filePath, "utf8");
|
|
292
|
+
} catch {
|
|
293
|
+
}
|
|
294
|
+
const stripped = stripLegacyClaudeSections(stripManagedAgentFoundation(existing));
|
|
295
|
+
const block2 = managedReferenceBlock(targetPath);
|
|
296
|
+
const updated = stripped ? `${block2}
|
|
297
|
+
|
|
298
|
+
${stripped}
|
|
299
|
+
` : `${block2}
|
|
300
|
+
`;
|
|
301
|
+
await mkdir(dirname(filePath), { recursive: true });
|
|
302
|
+
await mkdir(dirname(targetPath), { recursive: true });
|
|
303
|
+
await writeFile(targetPath, `${AGENT_FOUNDATION_INSTRUCTIONS}
|
|
304
|
+
`, "utf8");
|
|
305
|
+
await writeFile(filePath, updated, "utf8");
|
|
306
|
+
}
|
|
307
|
+
async function removeAgentFoundation(filePath) {
|
|
308
|
+
let existing = "";
|
|
309
|
+
try {
|
|
310
|
+
existing = await readFile(filePath, "utf8");
|
|
311
|
+
} catch {
|
|
312
|
+
await rm(agentFoundationPath(filePath), { force: true });
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const stripped = stripManagedAgentFoundation(existing);
|
|
316
|
+
await writeFile(filePath, stripped ? `${stripped}
|
|
317
|
+
` : "", "utf8");
|
|
318
|
+
await rm(agentFoundationPath(filePath), { force: true });
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// src/hosts.ts
|
|
322
|
+
import { homedir } from "node:os";
|
|
323
|
+
import { join as join2 } from "node:path";
|
|
324
|
+
var HOSTS = {
|
|
325
|
+
claude: { label: "Claude Code", instructions: join2(homedir(), ".claude", "CLAUDE.md") },
|
|
326
|
+
codex: { label: "Codex", instructions: join2(homedir(), ".codex", "AGENTS.md") },
|
|
327
|
+
opencode: { label: "OpenCode", instructions: join2(homedir(), ".config", "opencode", "AGENTS.md") },
|
|
328
|
+
pi: { label: "Pi Agent", instructions: join2(homedir(), ".pi", "agent", "AGENTS.md") }
|
|
329
|
+
};
|
|
330
|
+
var ALL_HOSTS = ["claude", "codex", "opencode", "pi"];
|
|
331
|
+
function parseHosts(value) {
|
|
332
|
+
if (!value || value === "all") return ALL_HOSTS;
|
|
333
|
+
const requested = value.split(",").map((host) => host.trim().toLowerCase());
|
|
334
|
+
const invalid = requested.filter((host) => !(host in HOSTS));
|
|
335
|
+
if (invalid.length) {
|
|
336
|
+
throw new Error(`Unknown host(s): ${invalid.join(", ")}. Valid hosts: ${ALL_HOSTS.join(", ")}, all`);
|
|
337
|
+
}
|
|
338
|
+
return [...new Set(requested)];
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// node_modules/@clack/core/dist/index.mjs
|
|
342
|
+
import { stdout, stdin } from "node:process";
|
|
343
|
+
import l__default from "node:readline";
|
|
344
|
+
|
|
345
|
+
// node_modules/fast-string-truncated-width/dist/utils.js
|
|
346
|
+
var getCodePointsLength = /* @__PURE__ */ (() => {
|
|
347
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
348
|
+
return (input) => {
|
|
349
|
+
let surrogatePairsNr = 0;
|
|
350
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
351
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
352
|
+
surrogatePairsNr += 1;
|
|
353
|
+
}
|
|
354
|
+
return input.length - surrogatePairsNr;
|
|
355
|
+
};
|
|
356
|
+
})();
|
|
357
|
+
var isFullWidth = (x) => {
|
|
358
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
359
|
+
};
|
|
360
|
+
var isWideNotCJKTNotEmoji = (x) => {
|
|
361
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
// node_modules/fast-string-truncated-width/dist/index.js
|
|
365
|
+
var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
366
|
+
var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
367
|
+
var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
368
|
+
var TAB_RE = /\t{1,1000}/y;
|
|
369
|
+
var EMOJI_RE = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
|
|
370
|
+
var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
371
|
+
var MODIFIER_RE = new RegExp("\\p{M}+", "gu");
|
|
372
|
+
var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
373
|
+
var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
374
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
375
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
376
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
377
|
+
const ANSI_WIDTH = 0;
|
|
378
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
379
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
380
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
381
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
382
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
383
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
384
|
+
const PARSE_BLOCKS = [
|
|
385
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
386
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
387
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
388
|
+
[TAB_RE, TAB_WIDTH],
|
|
389
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
390
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
391
|
+
];
|
|
392
|
+
let indexPrev = 0;
|
|
393
|
+
let index = 0;
|
|
394
|
+
let length = input.length;
|
|
395
|
+
let lengthExtra = 0;
|
|
396
|
+
let truncationEnabled = false;
|
|
397
|
+
let truncationIndex = length;
|
|
398
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
399
|
+
let unmatchedStart = 0;
|
|
400
|
+
let unmatchedEnd = 0;
|
|
401
|
+
let width = 0;
|
|
402
|
+
let widthExtra = 0;
|
|
403
|
+
outer: while (true) {
|
|
404
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
405
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
406
|
+
lengthExtra = 0;
|
|
407
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
408
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
409
|
+
if (isFullWidth(codePoint)) {
|
|
410
|
+
widthExtra = FULL_WIDTH_WIDTH;
|
|
411
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
412
|
+
widthExtra = WIDE_WIDTH;
|
|
413
|
+
} else {
|
|
414
|
+
widthExtra = REGULAR_WIDTH;
|
|
415
|
+
}
|
|
416
|
+
if (width + widthExtra > truncationLimit) {
|
|
417
|
+
truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
418
|
+
}
|
|
419
|
+
if (width + widthExtra > LIMIT) {
|
|
420
|
+
truncationEnabled = true;
|
|
421
|
+
break outer;
|
|
422
|
+
}
|
|
423
|
+
lengthExtra += char.length;
|
|
424
|
+
width += widthExtra;
|
|
425
|
+
}
|
|
426
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
427
|
+
}
|
|
428
|
+
if (index >= length) {
|
|
429
|
+
break outer;
|
|
430
|
+
}
|
|
431
|
+
for (let i2 = 0, l = PARSE_BLOCKS.length; i2 < l; i2++) {
|
|
432
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
|
|
433
|
+
BLOCK_RE.lastIndex = index;
|
|
434
|
+
if (BLOCK_RE.test(input)) {
|
|
435
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
436
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
437
|
+
if (width + widthExtra > truncationLimit) {
|
|
438
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
439
|
+
}
|
|
440
|
+
if (width + widthExtra > LIMIT) {
|
|
441
|
+
truncationEnabled = true;
|
|
442
|
+
break outer;
|
|
443
|
+
}
|
|
444
|
+
width += widthExtra;
|
|
445
|
+
unmatchedStart = indexPrev;
|
|
446
|
+
unmatchedEnd = index;
|
|
447
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
448
|
+
continue outer;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
index += 1;
|
|
452
|
+
}
|
|
453
|
+
return {
|
|
454
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
455
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
456
|
+
truncated: truncationEnabled,
|
|
457
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
458
|
+
};
|
|
459
|
+
};
|
|
460
|
+
var dist_default = getStringTruncatedWidth;
|
|
461
|
+
|
|
462
|
+
// node_modules/fast-string-width/dist/index.js
|
|
463
|
+
var NO_TRUNCATION2 = {
|
|
464
|
+
limit: Infinity,
|
|
465
|
+
ellipsis: "",
|
|
466
|
+
ellipsisWidth: 0
|
|
467
|
+
};
|
|
468
|
+
var fastStringWidth = (input, options = {}) => {
|
|
469
|
+
return dist_default(input, NO_TRUNCATION2, options).width;
|
|
470
|
+
};
|
|
471
|
+
var dist_default2 = fastStringWidth;
|
|
472
|
+
|
|
473
|
+
// node_modules/fast-wrap-ansi/lib/main.js
|
|
474
|
+
var ESC = "\x1B";
|
|
475
|
+
var CSI = "\x9B";
|
|
476
|
+
var END_CODE = 39;
|
|
477
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
478
|
+
var ANSI_CSI = "[";
|
|
479
|
+
var ANSI_OSC = "]";
|
|
480
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
481
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
482
|
+
var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
483
|
+
var getClosingCode = (openingCode) => {
|
|
484
|
+
if (openingCode >= 30 && openingCode <= 37)
|
|
485
|
+
return 39;
|
|
486
|
+
if (openingCode >= 90 && openingCode <= 97)
|
|
487
|
+
return 39;
|
|
488
|
+
if (openingCode >= 40 && openingCode <= 47)
|
|
489
|
+
return 49;
|
|
490
|
+
if (openingCode >= 100 && openingCode <= 107)
|
|
491
|
+
return 49;
|
|
492
|
+
if (openingCode === 1 || openingCode === 2)
|
|
493
|
+
return 22;
|
|
494
|
+
if (openingCode === 3)
|
|
495
|
+
return 23;
|
|
496
|
+
if (openingCode === 4)
|
|
497
|
+
return 24;
|
|
498
|
+
if (openingCode === 7)
|
|
499
|
+
return 27;
|
|
500
|
+
if (openingCode === 8)
|
|
501
|
+
return 28;
|
|
502
|
+
if (openingCode === 9)
|
|
503
|
+
return 29;
|
|
504
|
+
if (openingCode === 0)
|
|
505
|
+
return 0;
|
|
506
|
+
return void 0;
|
|
507
|
+
};
|
|
508
|
+
var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
509
|
+
var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
510
|
+
var wrapWord = (rows, word, columns) => {
|
|
511
|
+
const characters = word[Symbol.iterator]();
|
|
512
|
+
let isInsideEscape = false;
|
|
513
|
+
let isInsideLinkEscape = false;
|
|
514
|
+
let lastRow = rows.at(-1);
|
|
515
|
+
let visible = lastRow === void 0 ? 0 : dist_default2(lastRow);
|
|
516
|
+
let currentCharacter = characters.next();
|
|
517
|
+
let nextCharacter = characters.next();
|
|
518
|
+
let rawCharacterIndex = 0;
|
|
519
|
+
while (!currentCharacter.done) {
|
|
520
|
+
const character = currentCharacter.value;
|
|
521
|
+
const characterLength = dist_default2(character);
|
|
522
|
+
if (visible + characterLength <= columns) {
|
|
523
|
+
rows[rows.length - 1] += character;
|
|
524
|
+
} else {
|
|
525
|
+
rows.push(character);
|
|
526
|
+
visible = 0;
|
|
527
|
+
}
|
|
528
|
+
if (character === ESC || character === CSI) {
|
|
529
|
+
isInsideEscape = true;
|
|
530
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
531
|
+
}
|
|
532
|
+
if (isInsideEscape) {
|
|
533
|
+
if (isInsideLinkEscape) {
|
|
534
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
535
|
+
isInsideEscape = false;
|
|
536
|
+
isInsideLinkEscape = false;
|
|
537
|
+
}
|
|
538
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
539
|
+
isInsideEscape = false;
|
|
540
|
+
}
|
|
541
|
+
} else {
|
|
542
|
+
visible += characterLength;
|
|
543
|
+
if (visible === columns && !nextCharacter.done) {
|
|
544
|
+
rows.push("");
|
|
545
|
+
visible = 0;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
currentCharacter = nextCharacter;
|
|
549
|
+
nextCharacter = characters.next();
|
|
550
|
+
rawCharacterIndex += character.length;
|
|
551
|
+
}
|
|
552
|
+
lastRow = rows.at(-1);
|
|
553
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
|
|
554
|
+
rows[rows.length - 2] += rows.pop();
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
var stringVisibleTrimSpacesRight = (string) => {
|
|
558
|
+
const words = string.split(" ");
|
|
559
|
+
let last = words.length;
|
|
560
|
+
while (last) {
|
|
561
|
+
if (dist_default2(words[last - 1])) {
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
|
+
last--;
|
|
565
|
+
}
|
|
566
|
+
if (last === words.length) {
|
|
567
|
+
return string;
|
|
568
|
+
}
|
|
569
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
570
|
+
};
|
|
571
|
+
var exec = (string, columns, options = {}) => {
|
|
572
|
+
if (options.trim !== false && string.trim() === "") {
|
|
573
|
+
return "";
|
|
574
|
+
}
|
|
575
|
+
let returnValue = "";
|
|
576
|
+
let escapeCode;
|
|
577
|
+
let escapeUrl;
|
|
578
|
+
const words = string.split(" ");
|
|
579
|
+
let rows = [""];
|
|
580
|
+
let rowLength = 0;
|
|
581
|
+
for (let index = 0; index < words.length; index++) {
|
|
582
|
+
const word = words[index];
|
|
583
|
+
if (options.trim !== false) {
|
|
584
|
+
const row = rows.at(-1) ?? "";
|
|
585
|
+
const trimmed = row.trimStart();
|
|
586
|
+
if (row.length !== trimmed.length) {
|
|
587
|
+
rows[rows.length - 1] = trimmed;
|
|
588
|
+
rowLength = dist_default2(trimmed);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
if (index !== 0) {
|
|
592
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
593
|
+
rows.push("");
|
|
594
|
+
rowLength = 0;
|
|
595
|
+
}
|
|
596
|
+
if (rowLength || options.trim === false) {
|
|
597
|
+
rows[rows.length - 1] += " ";
|
|
598
|
+
rowLength++;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
const wordLength = dist_default2(word);
|
|
602
|
+
if (options.hard && wordLength > columns) {
|
|
603
|
+
const remainingColumns = columns - rowLength;
|
|
604
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
605
|
+
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
|
|
606
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
607
|
+
rows.push("");
|
|
608
|
+
}
|
|
609
|
+
wrapWord(rows, word, columns);
|
|
610
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
611
|
+
continue;
|
|
612
|
+
}
|
|
613
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
614
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
615
|
+
wrapWord(rows, word, columns);
|
|
616
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
617
|
+
continue;
|
|
618
|
+
}
|
|
619
|
+
rows.push("");
|
|
620
|
+
rowLength = 0;
|
|
621
|
+
}
|
|
622
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
623
|
+
wrapWord(rows, word, columns);
|
|
624
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
625
|
+
continue;
|
|
626
|
+
}
|
|
627
|
+
rows[rows.length - 1] += word;
|
|
628
|
+
rowLength += wordLength;
|
|
629
|
+
}
|
|
630
|
+
if (options.trim !== false) {
|
|
631
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
632
|
+
}
|
|
633
|
+
const preString = rows.join("\n");
|
|
634
|
+
let inSurrogate = false;
|
|
635
|
+
for (let i2 = 0; i2 < preString.length; i2++) {
|
|
636
|
+
const character = preString[i2];
|
|
637
|
+
returnValue += character;
|
|
638
|
+
if (!inSurrogate) {
|
|
639
|
+
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
640
|
+
if (inSurrogate) {
|
|
641
|
+
continue;
|
|
642
|
+
}
|
|
643
|
+
} else {
|
|
644
|
+
inSurrogate = false;
|
|
645
|
+
}
|
|
646
|
+
if (character === ESC || character === CSI) {
|
|
647
|
+
GROUP_REGEX.lastIndex = i2 + 1;
|
|
648
|
+
const groupsResult = GROUP_REGEX.exec(preString);
|
|
649
|
+
const groups = groupsResult?.groups;
|
|
650
|
+
if (groups?.code !== void 0) {
|
|
651
|
+
const code = Number.parseFloat(groups.code);
|
|
652
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
653
|
+
} else if (groups?.uri !== void 0) {
|
|
654
|
+
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
if (preString[i2 + 1] === "\n") {
|
|
658
|
+
if (escapeUrl) {
|
|
659
|
+
returnValue += wrapAnsiHyperlink("");
|
|
660
|
+
}
|
|
661
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
662
|
+
if (escapeCode && closingCode) {
|
|
663
|
+
returnValue += wrapAnsiCode(closingCode);
|
|
664
|
+
}
|
|
665
|
+
} else if (character === "\n") {
|
|
666
|
+
if (escapeCode && getClosingCode(escapeCode)) {
|
|
667
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
668
|
+
}
|
|
669
|
+
if (escapeUrl) {
|
|
670
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
return returnValue;
|
|
675
|
+
};
|
|
676
|
+
var CRLF_OR_LF = /\r?\n/;
|
|
677
|
+
function wrapAnsi(string, columns, options) {
|
|
678
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
// node_modules/@clack/core/dist/index.mjs
|
|
682
|
+
var import_sisteransi = __toESM(require_src(), 1);
|
|
683
|
+
function findCursor(s, o2, l) {
|
|
684
|
+
if (!l.some((r2) => !r2.disabled))
|
|
685
|
+
return s;
|
|
686
|
+
const t2 = s + o2, n2 = Math.max(l.length - 1, 0), e = t2 < 0 ? n2 : t2 > n2 ? 0 : t2;
|
|
687
|
+
return l[e].disabled ? findCursor(e, o2 < 0 ? -1 : 1, l) : e;
|
|
688
|
+
}
|
|
689
|
+
var a$2 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
690
|
+
var t = [
|
|
691
|
+
"January",
|
|
692
|
+
"February",
|
|
693
|
+
"March",
|
|
694
|
+
"April",
|
|
695
|
+
"May",
|
|
696
|
+
"June",
|
|
697
|
+
"July",
|
|
698
|
+
"August",
|
|
699
|
+
"September",
|
|
700
|
+
"October",
|
|
701
|
+
"November",
|
|
702
|
+
"December"
|
|
703
|
+
];
|
|
704
|
+
var settings = {
|
|
705
|
+
actions: new Set(a$2),
|
|
706
|
+
aliases: /* @__PURE__ */ new Map([
|
|
707
|
+
// vim support
|
|
708
|
+
["k", "up"],
|
|
709
|
+
["j", "down"],
|
|
710
|
+
["h", "left"],
|
|
711
|
+
["l", "right"],
|
|
712
|
+
["", "cancel"],
|
|
713
|
+
// opinionated defaults!
|
|
714
|
+
["escape", "cancel"]
|
|
715
|
+
]),
|
|
716
|
+
messages: {
|
|
717
|
+
cancel: "Canceled",
|
|
718
|
+
error: "Something went wrong"
|
|
719
|
+
},
|
|
720
|
+
withGuide: true,
|
|
721
|
+
date: {
|
|
722
|
+
monthNames: [...t],
|
|
723
|
+
messages: {
|
|
724
|
+
required: "Please enter a valid date",
|
|
725
|
+
invalidMonth: "There are only 12 months in a year",
|
|
726
|
+
invalidDay: (n2, e) => `There are only ${n2} days in ${e}`,
|
|
727
|
+
afterMin: (n2) => `Date must be on or after ${n2.toISOString().slice(0, 10)}`,
|
|
728
|
+
beforeMax: (n2) => `Date must be on or before ${n2.toISOString().slice(0, 10)}`
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
function isActionKey(n2, e) {
|
|
733
|
+
if (typeof n2 == "string")
|
|
734
|
+
return settings.aliases.get(n2) === e;
|
|
735
|
+
for (const s of n2)
|
|
736
|
+
if (s !== void 0 && isActionKey(s, e))
|
|
737
|
+
return true;
|
|
738
|
+
return false;
|
|
739
|
+
}
|
|
740
|
+
function diffLines(i2, s) {
|
|
741
|
+
if (i2 === s) return;
|
|
742
|
+
const e = i2.split(`
|
|
743
|
+
`), t2 = s.split(`
|
|
744
|
+
`), r2 = Math.max(e.length, t2.length), f = [];
|
|
745
|
+
for (let n2 = 0; n2 < r2; n2++)
|
|
746
|
+
e[n2] !== t2[n2] && f.push(n2);
|
|
747
|
+
return {
|
|
748
|
+
lines: f,
|
|
749
|
+
numLinesBefore: e.length,
|
|
750
|
+
numLinesAfter: t2.length,
|
|
751
|
+
numLines: r2
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
var R = globalThis.process.platform.startsWith("win");
|
|
755
|
+
var CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
|
|
756
|
+
function isCancel(e) {
|
|
757
|
+
return e === CANCEL_SYMBOL;
|
|
758
|
+
}
|
|
759
|
+
function setRawMode(e, r2) {
|
|
760
|
+
const o2 = e;
|
|
761
|
+
o2.isTTY && o2.setRawMode(r2);
|
|
762
|
+
}
|
|
763
|
+
var getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
764
|
+
var getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
765
|
+
function wrapTextWithPrefix(e, r2, o2, t2 = o2, s = o2, n2) {
|
|
766
|
+
const f = getColumns(e ?? stdout);
|
|
767
|
+
return wrapAnsi(r2, f - o2.length, {
|
|
768
|
+
hard: true,
|
|
769
|
+
trim: false
|
|
770
|
+
}).split(`
|
|
771
|
+
`).map((c2, i2, m) => {
|
|
772
|
+
const d2 = n2 ? n2(c2, i2) : c2;
|
|
773
|
+
return i2 === 0 ? `${t2}${d2}` : i2 === m.length - 1 ? `${s}${d2}` : `${o2}${d2}`;
|
|
774
|
+
}).join(`
|
|
775
|
+
`);
|
|
776
|
+
}
|
|
777
|
+
function runValidation(e, n2) {
|
|
778
|
+
if ("~standard" in e) {
|
|
779
|
+
const a3 = e["~standard"].validate(n2);
|
|
780
|
+
if (a3 instanceof Promise)
|
|
781
|
+
throw new TypeError(
|
|
782
|
+
"Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic."
|
|
783
|
+
);
|
|
784
|
+
return a3.issues?.at(0)?.message;
|
|
785
|
+
}
|
|
786
|
+
return e(n2);
|
|
787
|
+
}
|
|
788
|
+
var V = class {
|
|
789
|
+
input;
|
|
790
|
+
output;
|
|
791
|
+
_abortSignal;
|
|
792
|
+
rl;
|
|
793
|
+
opts;
|
|
794
|
+
_render;
|
|
795
|
+
_track = false;
|
|
796
|
+
_prevFrame = "";
|
|
797
|
+
_subscribers = /* @__PURE__ */ new Map();
|
|
798
|
+
_cursor = 0;
|
|
799
|
+
state = "initial";
|
|
800
|
+
error = "";
|
|
801
|
+
value;
|
|
802
|
+
userInput = "";
|
|
803
|
+
constructor(t2, e = true) {
|
|
804
|
+
const { input: i2 = stdin, output: n2 = stdout, render: s, signal: r2, ...o2 } = t2;
|
|
805
|
+
this.opts = o2, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = s.bind(this), this._track = e, this._abortSignal = r2, this.input = i2, this.output = n2;
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Unsubscribe all listeners
|
|
809
|
+
*/
|
|
810
|
+
unsubscribe() {
|
|
811
|
+
this._subscribers.clear();
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* Set a subscriber with opts
|
|
815
|
+
* @param event - The event name
|
|
816
|
+
*/
|
|
817
|
+
setSubscriber(t2, e) {
|
|
818
|
+
const i2 = this._subscribers.get(t2) ?? [];
|
|
819
|
+
i2.push(e), this._subscribers.set(t2, i2);
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* Subscribe to an event
|
|
823
|
+
* @param event - The event name
|
|
824
|
+
* @param cb - The callback
|
|
825
|
+
*/
|
|
826
|
+
on(t2, e) {
|
|
827
|
+
this.setSubscriber(t2, { cb: e });
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Subscribe to an event once
|
|
831
|
+
* @param event - The event name
|
|
832
|
+
* @param cb - The callback
|
|
833
|
+
*/
|
|
834
|
+
once(t2, e) {
|
|
835
|
+
this.setSubscriber(t2, { cb: e, once: true });
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Emit an event with data
|
|
839
|
+
* @param event - The event name
|
|
840
|
+
* @param data - The data to pass to the callback
|
|
841
|
+
*/
|
|
842
|
+
emit(t2, ...e) {
|
|
843
|
+
const i2 = this._subscribers.get(t2) ?? [], n2 = [];
|
|
844
|
+
for (const s of i2)
|
|
845
|
+
s.cb(...e), s.once && n2.push(() => i2.splice(i2.indexOf(s), 1));
|
|
846
|
+
for (const s of n2)
|
|
847
|
+
s();
|
|
848
|
+
}
|
|
849
|
+
prompt() {
|
|
850
|
+
return new Promise((t2) => {
|
|
851
|
+
if (this._abortSignal) {
|
|
852
|
+
if (this._abortSignal.aborted)
|
|
853
|
+
return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
|
|
854
|
+
this._abortSignal.addEventListener(
|
|
855
|
+
"abort",
|
|
856
|
+
() => {
|
|
857
|
+
this.state = "cancel", this.close();
|
|
858
|
+
},
|
|
859
|
+
{ once: true }
|
|
860
|
+
);
|
|
861
|
+
}
|
|
862
|
+
this.rl = l__default.createInterface({
|
|
863
|
+
input: this.input,
|
|
864
|
+
tabSize: 2,
|
|
865
|
+
prompt: "",
|
|
866
|
+
escapeCodeTimeout: 50,
|
|
867
|
+
terminal: true
|
|
868
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
869
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
870
|
+
}), this.once("cancel", () => {
|
|
871
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
872
|
+
});
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
_isActionKey(t2, e) {
|
|
876
|
+
return t2 === " ";
|
|
877
|
+
}
|
|
878
|
+
_shouldSubmit(t2, e) {
|
|
879
|
+
return true;
|
|
880
|
+
}
|
|
881
|
+
_setValue(t2) {
|
|
882
|
+
this.value = t2, this.emit("value", this.value);
|
|
883
|
+
}
|
|
884
|
+
_setUserInput(t2, e) {
|
|
885
|
+
this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
886
|
+
}
|
|
887
|
+
_clearUserInput() {
|
|
888
|
+
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
889
|
+
}
|
|
890
|
+
onKeypress(t2, e) {
|
|
891
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
|
|
892
|
+
if (this.opts.validate) {
|
|
893
|
+
const i2 = runValidation(this.opts.validate, this.value);
|
|
894
|
+
i2 && (this.error = i2 instanceof Error ? i2.message : i2, this.state = "error", this.rl?.write(this.userInput));
|
|
895
|
+
}
|
|
896
|
+
this.state !== "error" && (this.state = "submit");
|
|
897
|
+
}
|
|
898
|
+
isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
899
|
+
}
|
|
900
|
+
close() {
|
|
901
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
902
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
903
|
+
}
|
|
904
|
+
restoreCursor() {
|
|
905
|
+
const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
906
|
+
`).length - 1;
|
|
907
|
+
this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
|
|
908
|
+
}
|
|
909
|
+
render() {
|
|
910
|
+
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
911
|
+
hard: true,
|
|
912
|
+
trim: false
|
|
913
|
+
});
|
|
914
|
+
if (t2 !== this._prevFrame) {
|
|
915
|
+
if (this.state === "initial")
|
|
916
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
917
|
+
else {
|
|
918
|
+
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
919
|
+
if (this.restoreCursor(), e) {
|
|
920
|
+
const n2 = Math.max(0, e.numLinesAfter - i2), s = Math.max(0, e.numLinesBefore - i2);
|
|
921
|
+
let r2 = e.lines.find((o2) => o2 >= n2);
|
|
922
|
+
if (r2 === void 0) {
|
|
923
|
+
this._prevFrame = t2;
|
|
924
|
+
return;
|
|
925
|
+
}
|
|
926
|
+
if (e.lines.length === 1) {
|
|
927
|
+
this.output.write(import_sisteransi.cursor.move(0, r2 - s)), this.output.write(import_sisteransi.erase.lines(1));
|
|
928
|
+
const o2 = t2.split(`
|
|
929
|
+
`);
|
|
930
|
+
this.output.write(o2[r2]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o2.length - r2 - 1));
|
|
931
|
+
return;
|
|
932
|
+
} else if (e.lines.length > 1) {
|
|
933
|
+
if (n2 < s)
|
|
934
|
+
r2 = n2;
|
|
935
|
+
else {
|
|
936
|
+
const h2 = r2 - s;
|
|
937
|
+
h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
|
|
938
|
+
}
|
|
939
|
+
this.output.write(import_sisteransi.erase.down());
|
|
940
|
+
const f = t2.split(`
|
|
941
|
+
`).slice(r2);
|
|
942
|
+
this.output.write(f.join(`
|
|
943
|
+
`)), this._prevFrame = t2;
|
|
944
|
+
return;
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
this.output.write(import_sisteransi.erase.down());
|
|
948
|
+
}
|
|
949
|
+
this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
};
|
|
953
|
+
var a$1 = class a extends V {
|
|
954
|
+
options;
|
|
955
|
+
cursor = 0;
|
|
956
|
+
get _value() {
|
|
957
|
+
return this.options[this.cursor].value;
|
|
958
|
+
}
|
|
959
|
+
get _enabledOptions() {
|
|
960
|
+
return this.options.filter((e) => e.disabled !== true);
|
|
961
|
+
}
|
|
962
|
+
toggleAll() {
|
|
963
|
+
const e = this._enabledOptions, i2 = this.value !== void 0 && this.value.length === e.length;
|
|
964
|
+
this.value = i2 ? [] : e.map((t2) => t2.value);
|
|
965
|
+
}
|
|
966
|
+
toggleInvert() {
|
|
967
|
+
const e = this.value;
|
|
968
|
+
if (!e)
|
|
969
|
+
return;
|
|
970
|
+
const i2 = this._enabledOptions.filter((t2) => !e.includes(t2.value));
|
|
971
|
+
this.value = i2.map((t2) => t2.value);
|
|
972
|
+
}
|
|
973
|
+
toggleValue() {
|
|
974
|
+
this.value === void 0 && (this.value = []);
|
|
975
|
+
const e = this.value.includes(this._value);
|
|
976
|
+
this.value = e ? this.value.filter((i2) => i2 !== this._value) : [...this.value, this._value];
|
|
977
|
+
}
|
|
978
|
+
constructor(e) {
|
|
979
|
+
super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
|
|
980
|
+
const i2 = Math.max(
|
|
981
|
+
this.options.findIndex(({ value: t2 }) => t2 === e.cursorAt),
|
|
982
|
+
0
|
|
983
|
+
);
|
|
984
|
+
this.cursor = this.options[i2].disabled ? findCursor(i2, 1, this.options) : i2, this.on("key", (t2, l) => {
|
|
985
|
+
l.name === "a" && this.toggleAll(), l.name === "i" && this.toggleInvert();
|
|
986
|
+
}), this.on("cursor", (t2) => {
|
|
987
|
+
switch (t2) {
|
|
988
|
+
case "left":
|
|
989
|
+
case "up":
|
|
990
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
991
|
+
break;
|
|
992
|
+
case "down":
|
|
993
|
+
case "right":
|
|
994
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
995
|
+
break;
|
|
996
|
+
case "space":
|
|
997
|
+
this.toggleValue();
|
|
998
|
+
break;
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
var a2 = class extends V {
|
|
1004
|
+
options;
|
|
1005
|
+
cursor = 0;
|
|
1006
|
+
get _selectedValue() {
|
|
1007
|
+
return this.options[this.cursor];
|
|
1008
|
+
}
|
|
1009
|
+
changeValue() {
|
|
1010
|
+
this.value = this._selectedValue.value;
|
|
1011
|
+
}
|
|
1012
|
+
constructor(t2) {
|
|
1013
|
+
super(t2, false), this.options = t2.options;
|
|
1014
|
+
const i2 = this.options.findIndex(({ value: s }) => s === t2.initialValue), e = i2 === -1 ? 0 : i2;
|
|
1015
|
+
this.cursor = this.options[e].disabled ? findCursor(e, 1, this.options) : e, this.changeValue(), this.on("cursor", (s) => {
|
|
1016
|
+
switch (s) {
|
|
1017
|
+
case "left":
|
|
1018
|
+
case "up":
|
|
1019
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
1020
|
+
break;
|
|
1021
|
+
case "down":
|
|
1022
|
+
case "right":
|
|
1023
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
1024
|
+
break;
|
|
1025
|
+
}
|
|
1026
|
+
this.changeValue();
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
// node_modules/@clack/prompts/dist/index.mjs
|
|
1032
|
+
import { styleText, stripVTControlCharacters } from "node:util";
|
|
1033
|
+
import process$1 from "node:process";
|
|
1034
|
+
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
1035
|
+
function isUnicodeSupported() {
|
|
1036
|
+
if (process$1.platform !== "win32") {
|
|
1037
|
+
return process$1.env.TERM !== "linux";
|
|
1038
|
+
}
|
|
1039
|
+
return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
1040
|
+
}
|
|
1041
|
+
var unicode = isUnicodeSupported();
|
|
1042
|
+
var unicodeOr = (e, o2) => unicode ? e : o2;
|
|
1043
|
+
var S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
1044
|
+
var S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
1045
|
+
var S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
1046
|
+
var S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
|
|
1047
|
+
var S_BAR_START = unicodeOr("\u250C", "T");
|
|
1048
|
+
var S_BAR = unicodeOr("\u2502", "|");
|
|
1049
|
+
var S_BAR_END = unicodeOr("\u2514", "\u2014");
|
|
1050
|
+
var S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
|
|
1051
|
+
var S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
|
|
1052
|
+
var S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
|
|
1053
|
+
var S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
|
|
1054
|
+
var S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
|
|
1055
|
+
var S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
|
|
1056
|
+
var S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
|
|
1057
|
+
var S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
|
|
1058
|
+
var S_BAR_H = unicodeOr("\u2500", "-");
|
|
1059
|
+
var S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
|
|
1060
|
+
var S_CONNECT_LEFT = unicodeOr("\u251C", "+");
|
|
1061
|
+
var S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
|
|
1062
|
+
var S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
|
|
1063
|
+
var S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
|
|
1064
|
+
var S_INFO = unicodeOr("\u25CF", "\u2022");
|
|
1065
|
+
var S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
1066
|
+
var S_WARN = unicodeOr("\u25B2", "!");
|
|
1067
|
+
var S_ERROR = unicodeOr("\u25A0", "x");
|
|
1068
|
+
var symbol = (e) => {
|
|
1069
|
+
switch (e) {
|
|
1070
|
+
case "initial":
|
|
1071
|
+
case "active":
|
|
1072
|
+
return styleText("cyan", S_STEP_ACTIVE);
|
|
1073
|
+
case "cancel":
|
|
1074
|
+
return styleText("red", S_STEP_CANCEL);
|
|
1075
|
+
case "error":
|
|
1076
|
+
return styleText("yellow", S_STEP_ERROR);
|
|
1077
|
+
case "submit":
|
|
1078
|
+
return styleText("green", S_STEP_SUBMIT);
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1081
|
+
var symbolBar = (e) => {
|
|
1082
|
+
switch (e) {
|
|
1083
|
+
case "initial":
|
|
1084
|
+
case "active":
|
|
1085
|
+
return styleText("cyan", S_BAR);
|
|
1086
|
+
case "cancel":
|
|
1087
|
+
return styleText("red", S_BAR);
|
|
1088
|
+
case "error":
|
|
1089
|
+
return styleText("yellow", S_BAR);
|
|
1090
|
+
case "submit":
|
|
1091
|
+
return styleText("green", S_BAR);
|
|
1092
|
+
}
|
|
1093
|
+
};
|
|
1094
|
+
var E$1 = (l, o2, g, c2, h2, O = false) => {
|
|
1095
|
+
let r2 = o2, w = 0;
|
|
1096
|
+
if (O)
|
|
1097
|
+
for (let i2 = c2 - 1; i2 >= g && (r2 -= l[i2].length, w++, !(r2 <= h2)); i2--)
|
|
1098
|
+
;
|
|
1099
|
+
else
|
|
1100
|
+
for (let i2 = g; i2 < c2 && (r2 -= l[i2].length, w++, !(r2 <= h2)); i2++)
|
|
1101
|
+
;
|
|
1102
|
+
return { lineCount: r2, removals: w };
|
|
1103
|
+
};
|
|
1104
|
+
var limitOptions = ({
|
|
1105
|
+
cursor: l,
|
|
1106
|
+
options: o2,
|
|
1107
|
+
style: g,
|
|
1108
|
+
output: c2 = process.stdout,
|
|
1109
|
+
maxItems: h2 = Number.POSITIVE_INFINITY,
|
|
1110
|
+
columnPadding: O = 0,
|
|
1111
|
+
rowPadding: r2 = 4
|
|
1112
|
+
}) => {
|
|
1113
|
+
const i2 = getColumns(c2) - O, I = getRows(c2), C = styleText("dim", "..."), x = Math.max(I - r2, 0), m = Math.max(Math.min(h2, x), 5);
|
|
1114
|
+
let p = 0;
|
|
1115
|
+
l >= m - 3 && (p = Math.max(
|
|
1116
|
+
Math.min(l - m + 3, o2.length - m),
|
|
1117
|
+
0
|
|
1118
|
+
));
|
|
1119
|
+
let f = m < o2.length && p > 0, u3 = m < o2.length && p + m < o2.length;
|
|
1120
|
+
const W = Math.min(
|
|
1121
|
+
p + m,
|
|
1122
|
+
o2.length
|
|
1123
|
+
), e = [];
|
|
1124
|
+
let d2 = 0;
|
|
1125
|
+
f && d2++, u3 && d2++;
|
|
1126
|
+
const v = p + (f ? 1 : 0), P = W - (u3 ? 1 : 0);
|
|
1127
|
+
for (let t2 = v; t2 < P; t2++) {
|
|
1128
|
+
const n2 = wrapAnsi(g(o2[t2], t2 === l), i2, {
|
|
1129
|
+
hard: true,
|
|
1130
|
+
trim: false
|
|
1131
|
+
}).split(`
|
|
1132
|
+
`);
|
|
1133
|
+
e.push(n2), d2 += n2.length;
|
|
1134
|
+
}
|
|
1135
|
+
if (d2 > x) {
|
|
1136
|
+
let t2 = 0, n2 = 0, s = d2;
|
|
1137
|
+
const M = l - v;
|
|
1138
|
+
let a3 = x;
|
|
1139
|
+
const T = () => E$1(e, s, 0, M, a3), L = () => E$1(
|
|
1140
|
+
e,
|
|
1141
|
+
s,
|
|
1142
|
+
M + 1,
|
|
1143
|
+
e.length,
|
|
1144
|
+
a3,
|
|
1145
|
+
true
|
|
1146
|
+
);
|
|
1147
|
+
f ? ({ lineCount: s, removals: t2 } = T(), s > a3 && (u3 || (a3 -= 1), { lineCount: s, removals: n2 } = L())) : (u3 || (a3 -= 1), { lineCount: s, removals: n2 } = L(), s > a3 && (a3 -= 1, { lineCount: s, removals: t2 } = T())), t2 > 0 && (f = true, e.splice(0, t2)), n2 > 0 && (u3 = true, e.splice(e.length - n2, n2));
|
|
1148
|
+
}
|
|
1149
|
+
const b = [];
|
|
1150
|
+
f && b.push(C);
|
|
1151
|
+
for (const t2 of e)
|
|
1152
|
+
for (const n2 of t2)
|
|
1153
|
+
b.push(n2);
|
|
1154
|
+
return u3 && b.push(C), b;
|
|
1155
|
+
};
|
|
1156
|
+
var outro = (o2 = "", t2) => {
|
|
1157
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText("gray", S_BAR)}
|
|
1158
|
+
${styleText("gray", S_BAR_END)} ` : "";
|
|
1159
|
+
i2.write(`${e}${o2}
|
|
1160
|
+
|
|
1161
|
+
`);
|
|
1162
|
+
};
|
|
1163
|
+
var d = (n2, a3) => n2.split(`
|
|
1164
|
+
`).map((m) => a3(m)).join(`
|
|
1165
|
+
`);
|
|
1166
|
+
var multiselect = (n2) => {
|
|
1167
|
+
const a3 = (t2, o2) => {
|
|
1168
|
+
const r2 = t2.label ?? String(t2.value);
|
|
1169
|
+
return o2 === "disabled" ? `${styleText("gray", S_CHECKBOX_INACTIVE)} ${d(r2, (l) => styleText(["strikethrough", "gray"], l))}${t2.hint ? ` ${styleText("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : o2 === "active" ? `${styleText("cyan", S_CHECKBOX_ACTIVE)} ${r2}${t2.hint ? ` ${styleText("dim", `(${t2.hint})`)}` : ""}` : o2 === "selected" ? `${styleText("green", S_CHECKBOX_SELECTED)} ${d(r2, (l) => styleText("dim", l))}${t2.hint ? ` ${styleText("dim", `(${t2.hint})`)}` : ""}` : o2 === "cancelled" ? `${d(r2, (l) => styleText(["strikethrough", "dim"], l))}` : o2 === "active-selected" ? `${styleText("green", S_CHECKBOX_SELECTED)} ${r2}${t2.hint ? ` ${styleText("dim", `(${t2.hint})`)}` : ""}` : o2 === "submitted" ? `${d(r2, (l) => styleText("dim", l))}` : `${styleText("dim", S_CHECKBOX_INACTIVE)} ${d(r2, (l) => styleText("dim", l))}`;
|
|
1170
|
+
}, m = n2.required ?? true;
|
|
1171
|
+
return new a$1({
|
|
1172
|
+
options: n2.options,
|
|
1173
|
+
signal: n2.signal,
|
|
1174
|
+
input: n2.input,
|
|
1175
|
+
output: n2.output,
|
|
1176
|
+
initialValues: n2.initialValues,
|
|
1177
|
+
required: m,
|
|
1178
|
+
cursorAt: n2.cursorAt,
|
|
1179
|
+
validate(t2) {
|
|
1180
|
+
if (m && (t2 === void 0 || t2.length === 0))
|
|
1181
|
+
return `Please select at least one option.
|
|
1182
|
+
${styleText(
|
|
1183
|
+
"reset",
|
|
1184
|
+
styleText(
|
|
1185
|
+
"dim",
|
|
1186
|
+
`Press ${styleText(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText(
|
|
1187
|
+
"gray",
|
|
1188
|
+
styleText("bgWhite", styleText("inverse", " enter "))
|
|
1189
|
+
)} to submit`
|
|
1190
|
+
)
|
|
1191
|
+
)}`;
|
|
1192
|
+
},
|
|
1193
|
+
render() {
|
|
1194
|
+
const t2 = n2.withGuide ?? settings.withGuide, o2 = wrapTextWithPrefix(
|
|
1195
|
+
n2.output,
|
|
1196
|
+
n2.message,
|
|
1197
|
+
t2 ? `${symbolBar(this.state)} ` : "",
|
|
1198
|
+
`${symbol(this.state)} `
|
|
1199
|
+
), r2 = `${t2 ? `${styleText("gray", S_BAR)}
|
|
1200
|
+
` : ""}${o2}
|
|
1201
|
+
`, l = this.value ?? [], g = (i2, u3) => {
|
|
1202
|
+
if (i2.disabled)
|
|
1203
|
+
return a3(i2, "disabled");
|
|
1204
|
+
const s = l.includes(i2.value);
|
|
1205
|
+
return u3 && s ? a3(i2, "active-selected") : s ? a3(i2, "selected") : a3(i2, u3 ? "active" : "inactive");
|
|
1206
|
+
};
|
|
1207
|
+
switch (this.state) {
|
|
1208
|
+
case "submit": {
|
|
1209
|
+
const i2 = this.options.filter(({ value: s }) => l.includes(s)).map((s) => a3(s, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none"), u3 = wrapTextWithPrefix(
|
|
1210
|
+
n2.output,
|
|
1211
|
+
i2,
|
|
1212
|
+
t2 ? `${styleText("gray", S_BAR)} ` : ""
|
|
1213
|
+
);
|
|
1214
|
+
return `${r2}${u3}`;
|
|
1215
|
+
}
|
|
1216
|
+
case "cancel": {
|
|
1217
|
+
const i2 = this.options.filter(({ value: s }) => l.includes(s)).map((s) => a3(s, "cancelled")).join(styleText("dim", ", "));
|
|
1218
|
+
if (i2.trim() === "")
|
|
1219
|
+
return `${r2}${styleText("gray", S_BAR)}`;
|
|
1220
|
+
const u3 = wrapTextWithPrefix(
|
|
1221
|
+
n2.output,
|
|
1222
|
+
i2,
|
|
1223
|
+
t2 ? `${styleText("gray", S_BAR)} ` : ""
|
|
1224
|
+
);
|
|
1225
|
+
return `${r2}${u3}${t2 ? `
|
|
1226
|
+
${styleText("gray", S_BAR)}` : ""}`;
|
|
1227
|
+
}
|
|
1228
|
+
case "error": {
|
|
1229
|
+
const i2 = t2 ? `${styleText("yellow", S_BAR)} ` : "", u3 = this.error.split(`
|
|
1230
|
+
`).map(
|
|
1231
|
+
(h2, x) => x === 0 ? `${t2 ? `${styleText("yellow", S_BAR_END)} ` : ""}${styleText("yellow", h2)}` : ` ${h2}`
|
|
1232
|
+
).join(`
|
|
1233
|
+
`), s = r2.split(`
|
|
1234
|
+
`).length, v = u3.split(`
|
|
1235
|
+
`).length + 1;
|
|
1236
|
+
return `${r2}${i2}${limitOptions({
|
|
1237
|
+
output: n2.output,
|
|
1238
|
+
options: this.options,
|
|
1239
|
+
cursor: this.cursor,
|
|
1240
|
+
maxItems: n2.maxItems,
|
|
1241
|
+
columnPadding: i2.length,
|
|
1242
|
+
rowPadding: s + v,
|
|
1243
|
+
style: g
|
|
1244
|
+
}).join(`
|
|
1245
|
+
${i2}`)}
|
|
1246
|
+
${u3}
|
|
1247
|
+
`;
|
|
1248
|
+
}
|
|
1249
|
+
default: {
|
|
1250
|
+
const i2 = t2 ? `${styleText("cyan", S_BAR)} ` : "", u3 = r2.split(`
|
|
1251
|
+
`).length, s = t2 ? 2 : 1;
|
|
1252
|
+
return `${r2}${i2}${limitOptions({
|
|
1253
|
+
output: n2.output,
|
|
1254
|
+
options: this.options,
|
|
1255
|
+
cursor: this.cursor,
|
|
1256
|
+
maxItems: n2.maxItems,
|
|
1257
|
+
columnPadding: i2.length,
|
|
1258
|
+
rowPadding: u3 + s,
|
|
1259
|
+
style: g
|
|
1260
|
+
}).join(`
|
|
1261
|
+
${i2}`)}
|
|
1262
|
+
${t2 ? styleText("cyan", S_BAR_END) : ""}
|
|
1263
|
+
`;
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
}).prompt();
|
|
1268
|
+
};
|
|
1269
|
+
var u2 = {
|
|
1270
|
+
light: unicodeOr("\u2500", "-"),
|
|
1271
|
+
heavy: unicodeOr("\u2501", "="),
|
|
1272
|
+
block: unicodeOr("\u2588", "#")
|
|
1273
|
+
};
|
|
1274
|
+
var c = (e, a3) => e.includes(`
|
|
1275
|
+
`) ? e.split(`
|
|
1276
|
+
`).map((t2) => a3(t2)).join(`
|
|
1277
|
+
`) : a3(e);
|
|
1278
|
+
var select = (e) => {
|
|
1279
|
+
const a3 = (t2, d2) => {
|
|
1280
|
+
const s = t2.label ?? String(t2.value);
|
|
1281
|
+
switch (d2) {
|
|
1282
|
+
case "disabled":
|
|
1283
|
+
return `${styleText("gray", S_RADIO_INACTIVE)} ${c(s, (n2) => styleText("gray", n2))}${t2.hint ? ` ${styleText("dim", `(${t2.hint ?? "disabled"})`)}` : ""}`;
|
|
1284
|
+
case "selected":
|
|
1285
|
+
return `${c(s, (n2) => styleText("dim", n2))}`;
|
|
1286
|
+
case "active":
|
|
1287
|
+
return `${styleText("green", S_RADIO_ACTIVE)} ${s}${t2.hint ? ` ${styleText("dim", `(${t2.hint})`)}` : ""}`;
|
|
1288
|
+
case "cancelled":
|
|
1289
|
+
return `${c(s, (n2) => styleText(["strikethrough", "dim"], n2))}`;
|
|
1290
|
+
default:
|
|
1291
|
+
return `${styleText("dim", S_RADIO_INACTIVE)} ${c(s, (n2) => styleText("dim", n2))}`;
|
|
1292
|
+
}
|
|
1293
|
+
};
|
|
1294
|
+
return new a2({
|
|
1295
|
+
options: e.options,
|
|
1296
|
+
signal: e.signal,
|
|
1297
|
+
input: e.input,
|
|
1298
|
+
output: e.output,
|
|
1299
|
+
initialValue: e.initialValue,
|
|
1300
|
+
render() {
|
|
1301
|
+
const t2 = e.withGuide ?? settings.withGuide, d2 = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, n2 = wrapTextWithPrefix(
|
|
1302
|
+
e.output,
|
|
1303
|
+
e.message,
|
|
1304
|
+
s,
|
|
1305
|
+
d2
|
|
1306
|
+
), u3 = `${t2 ? `${styleText("gray", S_BAR)}
|
|
1307
|
+
` : ""}${n2}
|
|
1308
|
+
`;
|
|
1309
|
+
switch (this.state) {
|
|
1310
|
+
case "submit": {
|
|
1311
|
+
const r2 = t2 ? `${styleText("gray", S_BAR)} ` : "", l = wrapTextWithPrefix(
|
|
1312
|
+
e.output,
|
|
1313
|
+
a3(this.options[this.cursor], "selected"),
|
|
1314
|
+
r2
|
|
1315
|
+
);
|
|
1316
|
+
return `${u3}${l}`;
|
|
1317
|
+
}
|
|
1318
|
+
case "cancel": {
|
|
1319
|
+
const r2 = t2 ? `${styleText("gray", S_BAR)} ` : "", l = wrapTextWithPrefix(
|
|
1320
|
+
e.output,
|
|
1321
|
+
a3(this.options[this.cursor], "cancelled"),
|
|
1322
|
+
r2
|
|
1323
|
+
);
|
|
1324
|
+
return `${u3}${l}${t2 ? `
|
|
1325
|
+
${styleText("gray", S_BAR)}` : ""}`;
|
|
1326
|
+
}
|
|
1327
|
+
default: {
|
|
1328
|
+
const r2 = t2 ? `${styleText("cyan", S_BAR)} ` : "", l = t2 ? styleText("cyan", S_BAR_END) : "", g = u3.split(`
|
|
1329
|
+
`).length, h2 = t2 ? 2 : 1;
|
|
1330
|
+
return `${u3}${r2}${limitOptions({
|
|
1331
|
+
output: e.output,
|
|
1332
|
+
cursor: this.cursor,
|
|
1333
|
+
options: this.options,
|
|
1334
|
+
maxItems: e.maxItems,
|
|
1335
|
+
columnPadding: r2.length,
|
|
1336
|
+
rowPadding: g + h2,
|
|
1337
|
+
style: (p, b) => a3(p, p.disabled ? "disabled" : b ? "active" : "inactive")
|
|
1338
|
+
}).join(`
|
|
1339
|
+
${r2}`)}
|
|
1340
|
+
${l}
|
|
1341
|
+
`;
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
}).prompt();
|
|
1346
|
+
};
|
|
1347
|
+
var i = `${styleText("gray", S_BAR)} `;
|
|
1348
|
+
|
|
1349
|
+
// src/installer.ts
|
|
1350
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
1351
|
+
import { dirname as dirname2 } from "node:path";
|
|
1352
|
+
var OWL = `
|
|
1353
|
+
,_,
|
|
1354
|
+
(O,O)
|
|
1355
|
+
( )
|
|
1356
|
+
" "`;
|
|
1357
|
+
function printBanner() {
|
|
1358
|
+
console.log(OWL);
|
|
1359
|
+
console.log(` agent-foundation v${"0.2.1"}`);
|
|
1360
|
+
console.log(" Install your AI agent conventions\n");
|
|
1361
|
+
}
|
|
1362
|
+
async function selectHosts() {
|
|
1363
|
+
const result = await multiselect({
|
|
1364
|
+
message: "Target hosts (space to select, enter to confirm)",
|
|
1365
|
+
options: ALL_HOSTS.map((id) => ({ value: id, label: HOSTS[id].label })),
|
|
1366
|
+
required: true
|
|
1367
|
+
});
|
|
1368
|
+
if (isCancel(result)) process.exit(0);
|
|
1369
|
+
return result;
|
|
1370
|
+
}
|
|
1371
|
+
async function runInstall(hosts) {
|
|
1372
|
+
for (const host of hosts) {
|
|
1373
|
+
const { instructions } = HOSTS[host];
|
|
1374
|
+
const dir = dirname2(instructions);
|
|
1375
|
+
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
1376
|
+
await writeAgentFoundation(instructions);
|
|
1377
|
+
console.log(` \u2713 Installed in ${instructions}`);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
async function runRemove(hosts) {
|
|
1381
|
+
for (const host of hosts) {
|
|
1382
|
+
await removeAgentFoundation(HOSTS[host].instructions);
|
|
1383
|
+
console.log(` \u2713 Removed from ${HOSTS[host].instructions}`);
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
function runStatus() {
|
|
1387
|
+
console.table(
|
|
1388
|
+
ALL_HOSTS.map((host) => ({
|
|
1389
|
+
Host: HOSTS[host].label,
|
|
1390
|
+
Instructions: existsSync(HOSTS[host].instructions) ? "yes" : "no",
|
|
1391
|
+
Foundation: existsSync(agentFoundationPath(HOSTS[host].instructions)) ? "installed" : "missing"
|
|
1392
|
+
}))
|
|
1393
|
+
);
|
|
1394
|
+
}
|
|
1395
|
+
async function runInteractive() {
|
|
1396
|
+
printBanner();
|
|
1397
|
+
const action = await select({
|
|
1398
|
+
message: "Choose an action",
|
|
1399
|
+
options: [
|
|
1400
|
+
{ value: "install", label: "Install", hint: "Write AGENT_FOUNDATION.md to selected hosts" },
|
|
1401
|
+
{ value: "remove", label: "Remove", hint: "Remove AGENT_FOUNDATION.md from selected hosts" },
|
|
1402
|
+
{ value: "status", label: "Status", hint: "Show installation status per host" },
|
|
1403
|
+
{ value: "exit", label: "Exit" }
|
|
1404
|
+
]
|
|
1405
|
+
});
|
|
1406
|
+
if (isCancel(action) || action === "exit") {
|
|
1407
|
+
outro("Goodbye");
|
|
1408
|
+
process.exit(0);
|
|
1409
|
+
}
|
|
1410
|
+
if (action === "status") {
|
|
1411
|
+
runStatus();
|
|
1412
|
+
outro("Done");
|
|
1413
|
+
return;
|
|
1414
|
+
}
|
|
1415
|
+
const hosts = await selectHosts();
|
|
1416
|
+
if (action === "install") await runInstall(hosts);
|
|
1417
|
+
if (action === "remove") await runRemove(hosts);
|
|
1418
|
+
outro("Done");
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
// src/cli.ts
|
|
1422
|
+
var USAGE = `agent-foundation \u2014 install personal agent conventions across AI coding hosts
|
|
6
1423
|
|
|
7
1424
|
Usage:
|
|
8
|
-
agent-foundation install [--host <claude|codex|opencode|all>]
|
|
9
|
-
agent-foundation remove [--host <claude|codex|opencode|all>]
|
|
1425
|
+
agent-foundation install [--host <claude|codex|opencode|pi|all>]
|
|
1426
|
+
agent-foundation remove [--host <claude|codex|opencode|pi|all>]
|
|
10
1427
|
agent-foundation status
|
|
11
1428
|
agent-foundation --help
|
|
12
1429
|
|
|
@@ -14,57 +1431,55 @@ Writes AGENT_FOUNDATION.md next to each host's global instructions file and
|
|
|
14
1431
|
injects a managed @reference block. "remove" deletes both. Default host: all.
|
|
15
1432
|
Hosts accept a comma-separated list (e.g. --host claude,codex).`;
|
|
16
1433
|
function getHostFlag(args) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
throw new Error('--host requires a value');
|
|
23
|
-
return value;
|
|
1434
|
+
const index = args.indexOf("--host");
|
|
1435
|
+
if (index === -1) return void 0;
|
|
1436
|
+
const value = args[index + 1];
|
|
1437
|
+
if (!value || value.startsWith("--")) throw new Error("--host requires a value");
|
|
1438
|
+
return value;
|
|
24
1439
|
}
|
|
25
1440
|
async function install(hosts) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1441
|
+
for (const host of hosts) {
|
|
1442
|
+
await writeAgentFoundation(HOSTS[host].instructions);
|
|
1443
|
+
console.log(`Installed Agent Foundation reference in ${HOSTS[host].instructions}`);
|
|
1444
|
+
}
|
|
30
1445
|
}
|
|
31
1446
|
async function remove(hosts) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1447
|
+
for (const host of hosts) {
|
|
1448
|
+
await removeAgentFoundation(HOSTS[host].instructions);
|
|
1449
|
+
console.log(`Removed Agent Foundation reference from ${HOSTS[host].instructions}`);
|
|
1450
|
+
}
|
|
36
1451
|
}
|
|
37
1452
|
function status() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1453
|
+
console.table(ALL_HOSTS.map((host) => ({
|
|
1454
|
+
Host: HOSTS[host].label,
|
|
1455
|
+
Instructions: existsSync2(HOSTS[host].instructions) ? "yes" : "no",
|
|
1456
|
+
Foundation: existsSync2(agentFoundationPath(HOSTS[host].instructions)) ? "installed" : "missing"
|
|
1457
|
+
})));
|
|
43
1458
|
}
|
|
44
1459
|
async function main() {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
1460
|
+
const [command, ...args] = process.argv.slice(2);
|
|
1461
|
+
if (!command || command === "--help" || command === "-h" || command === "help") {
|
|
1462
|
+
await runInteractive();
|
|
1463
|
+
return;
|
|
1464
|
+
}
|
|
1465
|
+
switch (command) {
|
|
1466
|
+
case "install":
|
|
1467
|
+
await install(parseHosts(getHostFlag(args)));
|
|
1468
|
+
break;
|
|
1469
|
+
case "remove":
|
|
1470
|
+
await remove(parseHosts(getHostFlag(args)));
|
|
1471
|
+
break;
|
|
1472
|
+
case "status":
|
|
1473
|
+
status();
|
|
1474
|
+
break;
|
|
1475
|
+
default:
|
|
1476
|
+
console.error(`Unknown command: ${command}
|
|
1477
|
+
`);
|
|
1478
|
+
console.log(USAGE);
|
|
1479
|
+
process.exit(1);
|
|
1480
|
+
}
|
|
65
1481
|
}
|
|
66
1482
|
main().catch((err) => {
|
|
67
|
-
|
|
68
|
-
|
|
1483
|
+
console.error(err instanceof Error ? err.message : err);
|
|
1484
|
+
process.exit(1);
|
|
69
1485
|
});
|
|
70
|
-
//# sourceMappingURL=cli.js.map
|