@codemcp/ade 0.2.2 → 0.2.3
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/.beads/issues.jsonl +6 -0
- package/.beads/last-touched +1 -1
- package/.kiro/agents/ade.json +1 -1
- package/.prettierignore +1 -0
- package/.vibe/beads-state-ade-fix-bundling-h7ahz.json +34 -0
- package/.vibe/development-plan-fix-bundling.md +78 -0
- package/package.json +1 -1
- package/packages/cli/dist/index.js +908 -21
- package/packages/cli/package.json +1 -1
- package/packages/cli/tsup.config.ts +2 -1
- package/packages/core/package.json +1 -1
- package/packages/harnesses/package.json +1 -1
- package/packages/harnesses/src/writers/kiro.spec.ts +3 -2
- package/packages/harnesses/src/writers/kiro.ts +1 -1
- package/rebuild_cli.sh +3 -0
package/.beads/issues.jsonl
CHANGED
|
@@ -44,3 +44,9 @@
|
|
|
44
44
|
{"id":"ade-2.3.8","title":"Replan autonomy model per harness around built-in permissions only","status":"in_progress","priority":1,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-18T11:01:01.074975+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-18T11:02:11.748853+01:00","dependencies":[{"issue_id":"ade-2.3.8","depends_on_id":"ade-2.3","type":"parent-child","created_at":"0001-01-01T00:00:00Z"}]}
|
|
45
45
|
{"id":"ade-2.3.9","title":"Implement core autonomy abstraction rewrite for built-in permissions only","status":"closed","priority":1,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-18T11:15:29.905083+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-18T11:49:04.856825+01:00","closed_at":"2026-03-18T11:49:04.856825+01:00","close_reason":"Closed","dependencies":[{"issue_id":"ade-2.3.9","depends_on_id":"ade-2.3","type":"parent-child","created_at":"0001-01-01T00:00:00Z"}]}
|
|
46
46
|
{"id":"ade-2.4","title":"Commit","description":"Ensure code quality and documentation accuracy through systematic cleanup and review. **STEP 1: Code Cleanup** Systematically clean up development artifacts: 1. **Remove Debug Output**: Search for and remove all temporary debug output statements used during development. Look for language-specific debug output methods (console logging, print statements, debug output functions). Remove any debugging statements that were added for development purposes. 2. **Review TODO/FIXME Comments**: - Address each TODO/FIXME comment by either implementing the solution or documenting why it's deferred - Remove completed TODOs - Convert remaining TODOs to proper issue tracking if needed 3. **Remove Debugging Code Blocks**: - Remove temporary debugging code, test code blocks, and commented-out code - Clean up any experimental code that's no longer needed - Ensure proper error handling replaces temporary debug logging **STEP 2: Documentation Review** Review and update documentation to reflect final implementation: 1. **Update Long-Term Memory Documents**: Based on what was actually implemented: - If exists: Update it if requirements changed during development - If exists: Update it if architectural impacts were identified - If exists: Update it if design details were refined or changed - Otherwise: Document any changes in the plan file 2. **Compare Against Implementation**: Review documentation against actual implemented functionality 3. **Update Changed Sections**: Only modify documentation sections that have functional changes 4. **Remove Development Progress**: Remove references to development iterations, progress notes, and temporary decisions 5. **Focus on Final State**: Ensure documentation describes the final implemented state, not the development process 6. **Ask User to Review Document Updates** **STEP 3: Final Validation** - Run existing tests to ensure cleanup didn't break functionality - Verify documentation accuracy with a final review - Ensure code is ready for production/delivery Update task progress and mark completed work as you finalize the feature.","status":"open","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-18T08:42:25.322426+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-18T08:42:25.322426+01:00","dependencies":[{"issue_id":"ade-2.4","depends_on_id":"ade-2","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"ade-2.4","depends_on_id":"ade-2.3","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]}
|
|
47
|
+
{"id":"ade-3","title":"ade: bugfix (development-plan-fix-bundling.md)","description":"Responsible vibe engineering session using bugfix workflow for ade","status":"open","priority":2,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-18T16:29:09.750129+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-18T16:29:09.750129+01:00"}
|
|
48
|
+
{"id":"ade-3.1","title":"Reproduce","description":"Gather specific information to reliably reproduce the reported bug: - What are the exact OS, browser/runtime versions, and hardware specs? - What is the precise sequence of actions that trigger the bug? - What error messages, logs, or stack traces are available? - Does this happen every time or intermittently? - How many users are affected and what is the business impact? Create test cases that demonstrate the problem. Document your findings and create tasks as needed.","status":"open","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-18T16:29:09.932272+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-18T16:29:09.932272+01:00","dependencies":[{"issue_id":"ade-3.1","depends_on_id":"ade-3","type":"parent-child","created_at":"0001-01-01T00:00:00Z"}]}
|
|
49
|
+
{"id":"ade-3.2","title":"Analyze","description":"Examine the code paths involved in the bug, identify the root cause, and understand why the issue occurs. Use debugging tools, add logging, and trace through the problematic code. Document your analysis and create tasks as needed.","status":"open","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-18T16:29:10.091911+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-18T16:29:10.091911+01:00","dependencies":[{"issue_id":"ade-3.2","depends_on_id":"ade-3","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"ade-3.2","depends_on_id":"ade-3.1","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]}
|
|
50
|
+
{"id":"ade-3.3","title":"Fix","description":"Implement the solution based on your analysis: - If exists: Follow the design from it - Otherwise: Elaborate design options and present them to the user Before implementing, assess the approach: - How critical is this system? What is the blast radius if the fix causes issues? - Should this be a minimal fix or a more comprehensive solution? Make targeted changes that address the root cause without introducing new issues. Be careful to maintain existing functionality while fixing the bug.","status":"open","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-18T16:29:10.265074+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-18T16:29:10.265074+01:00","dependencies":[{"issue_id":"ade-3.3","depends_on_id":"ade-3","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"ade-3.3","depends_on_id":"ade-3.2","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]}
|
|
51
|
+
{"id":"ade-3.4","title":"Verify","description":"Test the fix thoroughly to ensure the original bug is resolved and no new issues were introduced. Run existing tests, create new ones if needed, and verify the solution is robust.","status":"open","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-18T16:29:10.449967+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-18T16:29:10.449967+01:00","dependencies":[{"issue_id":"ade-3.4","depends_on_id":"ade-3","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"ade-3.4","depends_on_id":"ade-3.3","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]}
|
|
52
|
+
{"id":"ade-3.5","title":"Finalize","description":"Ensure code quality and documentation accuracy through systematic cleanup and review. **STEP 1: Code Cleanup** Systematically clean up development artifacts: - Remove all temporary debug output statements used during bug investigation (console logging, print statements, debug output functions) - Address each TODO/FIXME comment by either implementing the solution or documenting why it's deferred - Remove completed TODOs and convert remaining ones to proper issue tracking if needed - Remove temporary debugging code, test code blocks, and commented-out code - Ensure proper error handling replaces temporary debug logging **STEP 2: Documentation Review** Review and update documentation to reflect the bug fix: - If exists, update it if design details were refined or changed during the fix - Compare documentation against the actual bug fix implementation - Update only the documentation sections that have functional changes - Remove references to investigation iterations, progress notes, and temporary decisions - Ensure documentation describes the final fixed state, not the debugging process - Ask the user to review document updates **STEP 3: Final Validation** - Run existing tests to ensure cleanup didn't break functionality - Verify documentation accuracy with a final review - Ensure bug fix is ready for production - Update task progress and mark completed work as you finalize the bug fix","status":"open","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-18T16:29:10.642935+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-18T16:29:10.642935+01:00","dependencies":[{"issue_id":"ade-3.5","depends_on_id":"ade-3","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"ade-3.5","depends_on_id":"ade-3.4","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]}
|
package/.beads/last-touched
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ade-
|
|
1
|
+
ade-3.5
|
package/.kiro/agents/ade.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"autoApprove": ["*"]
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
"tools": ["read", "write", "spec", "@workflows/*", "@agentskills/*"],
|
|
17
|
+
"tools": ["read", "write", "spec", "@workflows/*", "@agentskills/*", "shell"],
|
|
18
18
|
"allowedTools": ["read", "write", "spec", "@workflows/*", "@agentskills/*"],
|
|
19
19
|
"useLegacyMcpJson": true
|
|
20
20
|
}
|
package/.prettierignore
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"conversationId": "ade-fix-bundling-h7ahz",
|
|
3
|
+
"projectPath": "/Users/oliverjaegle/projects/privat/codemcp/ade",
|
|
4
|
+
"epicId": "ade-3",
|
|
5
|
+
"phaseTasks": [
|
|
6
|
+
{
|
|
7
|
+
"phaseId": "reproduce",
|
|
8
|
+
"phaseName": "Reproduce",
|
|
9
|
+
"taskId": "ade-3.1"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"phaseId": "analyze",
|
|
13
|
+
"phaseName": "Analyze",
|
|
14
|
+
"taskId": "ade-3.2"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"phaseId": "fix",
|
|
18
|
+
"phaseName": "Fix",
|
|
19
|
+
"taskId": "ade-3.3"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"phaseId": "verify",
|
|
23
|
+
"phaseName": "Verify",
|
|
24
|
+
"taskId": "ade-3.4"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"phaseId": "finalize",
|
|
28
|
+
"phaseName": "Finalize",
|
|
29
|
+
"taskId": "ade-3.5"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"createdAt": "2026-03-18T15:29:11.195Z",
|
|
33
|
+
"updatedAt": "2026-03-18T15:29:11.195Z"
|
|
34
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Development Plan: ade (fix-bundling branch)
|
|
2
|
+
|
|
3
|
+
*Generated on 2026-03-18 by Vibe Feature MCP*
|
|
4
|
+
*Workflow: [bugfix](https://mrsimpson.github.io/responsible-vibe-mcp/workflows/bugfix)*
|
|
5
|
+
|
|
6
|
+
## Goal
|
|
7
|
+
Fix bundling issue where `npx @codemcp/ade@latest setup` fails with ERR_MODULE_NOT_FOUND for '@clack/prompts' dependency.
|
|
8
|
+
|
|
9
|
+
## Reproduce
|
|
10
|
+
<!-- beads-phase-id: ade-3.1 -->
|
|
11
|
+
### Tasks
|
|
12
|
+
- [ ] Reproduce the error by running `npx @codemcp/ade@latest setup`
|
|
13
|
+
- [ ] Examine the bundled output to confirm @clack/prompts is not included
|
|
14
|
+
- [ ] Document the exact error and bundling configuration
|
|
15
|
+
|
|
16
|
+
## Analyze
|
|
17
|
+
<!-- beads-phase-id: ade-3.2 -->
|
|
18
|
+
### Phase Entrance Criteria:
|
|
19
|
+
- [ ] The error has been successfully reproduced
|
|
20
|
+
- [ ] The bundled output has been examined
|
|
21
|
+
- [ ] The root cause is identified
|
|
22
|
+
|
|
23
|
+
### Tasks
|
|
24
|
+
- [ ] Analyze tsup configuration in packages/cli/tsup.config.ts
|
|
25
|
+
- [ ] Identify why @clack/prompts is not being bundled
|
|
26
|
+
- [ ] Research tsup bundling options for dependencies
|
|
27
|
+
|
|
28
|
+
## Fix
|
|
29
|
+
<!-- beads-phase-id: ade-3.3 -->
|
|
30
|
+
### Phase Entrance Criteria:
|
|
31
|
+
- [ ] Root cause analysis is complete
|
|
32
|
+
- [ ] Solution approach is identified
|
|
33
|
+
- [ ] tsup configuration issues are understood
|
|
34
|
+
|
|
35
|
+
### Tasks
|
|
36
|
+
- [ ] Update tsup.config.ts to bundle @clack/prompts dependency
|
|
37
|
+
- [ ] Rebuild the CLI package
|
|
38
|
+
- [ ] Test the bundled output locally
|
|
39
|
+
|
|
40
|
+
## Verify
|
|
41
|
+
<!-- beads-phase-id: ade-3.4 -->
|
|
42
|
+
### Phase Entrance Criteria:
|
|
43
|
+
- [ ] Fix has been implemented
|
|
44
|
+
- [ ] Local build is successful
|
|
45
|
+
- [ ] Bundled output includes @clack/prompts
|
|
46
|
+
|
|
47
|
+
### Tasks
|
|
48
|
+
- [ ] Test the fixed CLI locally
|
|
49
|
+
- [ ] Verify npx command works after publishing
|
|
50
|
+
- [ ] Confirm no other dependencies are missing
|
|
51
|
+
|
|
52
|
+
## Finalize
|
|
53
|
+
<!-- beads-phase-id: ade-3.5 -->
|
|
54
|
+
### Phase Entrance Criteria:
|
|
55
|
+
- [ ] Fix has been verified to work
|
|
56
|
+
- [ ] No regressions introduced
|
|
57
|
+
- [ ] All tests pass
|
|
58
|
+
|
|
59
|
+
### Tasks
|
|
60
|
+
- [ ] Document the fix in commit message
|
|
61
|
+
- [ ] Update version if needed
|
|
62
|
+
- [ ] Publish the fixed package
|
|
63
|
+
|
|
64
|
+
## Key Decisions
|
|
65
|
+
- **Root Cause Identified**: tsup is not bundling the `@clack/prompts` dependency, leaving it as an external import in the bundled output
|
|
66
|
+
- **Solution**: Add `noExternal: ["@clack/prompts"]` to tsup.config.ts to force bundling of this dependency
|
|
67
|
+
- **Fix Applied**: Updated packages/cli/tsup.config.ts with noExternal configuration
|
|
68
|
+
- **Verification Status**: Fix is implemented but requires rebuild to take effect
|
|
69
|
+
|
|
70
|
+
## Notes
|
|
71
|
+
- The error occurs because when npx installs @codemcp/ade, it doesn't install the @clack/prompts dependency
|
|
72
|
+
- The bundled dist/index.js contains `import * as clack from "@clack/prompts";` instead of bundled code
|
|
73
|
+
- tsup by default treats all dependencies as external unless explicitly configured otherwise
|
|
74
|
+
- **Current bundled output still shows external imports** - rebuild needed to apply fix
|
|
75
|
+
- After rebuild, the @clack/prompts code should be bundled inline instead of imported externally
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
*This plan is maintained by the LLM and uses beads CLI for task management. Tool responses provide guidance on which bd commands to use for task management.*
|
package/package.json
CHANGED
|
@@ -1,10 +1,898 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
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
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
|
|
28
|
+
// ../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
29
|
+
var require_src = __commonJS({
|
|
30
|
+
"../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
|
|
31
|
+
"use strict";
|
|
32
|
+
var ESC = "\x1B";
|
|
33
|
+
var CSI = `${ESC}[`;
|
|
34
|
+
var beep = "\x07";
|
|
35
|
+
var cursor = {
|
|
36
|
+
to(x3, y2) {
|
|
37
|
+
if (!y2) return `${CSI}${x3 + 1}G`;
|
|
38
|
+
return `${CSI}${y2 + 1};${x3 + 1}H`;
|
|
39
|
+
},
|
|
40
|
+
move(x3, y2) {
|
|
41
|
+
let ret = "";
|
|
42
|
+
if (x3 < 0) ret += `${CSI}${-x3}D`;
|
|
43
|
+
else if (x3 > 0) ret += `${CSI}${x3}C`;
|
|
44
|
+
if (y2 < 0) ret += `${CSI}${-y2}A`;
|
|
45
|
+
else if (y2 > 0) ret += `${CSI}${y2}B`;
|
|
46
|
+
return ret;
|
|
47
|
+
},
|
|
48
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
49
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
50
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
51
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
52
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
53
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
54
|
+
left: `${CSI}G`,
|
|
55
|
+
hide: `${CSI}?25l`,
|
|
56
|
+
show: `${CSI}?25h`,
|
|
57
|
+
save: `${ESC}7`,
|
|
58
|
+
restore: `${ESC}8`
|
|
59
|
+
};
|
|
60
|
+
var scroll = {
|
|
61
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
62
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
63
|
+
};
|
|
64
|
+
var erase = {
|
|
65
|
+
screen: `${CSI}2J`,
|
|
66
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
67
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
68
|
+
line: `${CSI}2K`,
|
|
69
|
+
lineEnd: `${CSI}K`,
|
|
70
|
+
lineStart: `${CSI}1K`,
|
|
71
|
+
lines(count) {
|
|
72
|
+
let clear = "";
|
|
73
|
+
for (let i = 0; i < count; i++)
|
|
74
|
+
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
75
|
+
if (count)
|
|
76
|
+
clear += cursor.left;
|
|
77
|
+
return clear;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
module.exports = { cursor, scroll, erase, beep };
|
|
81
|
+
}
|
|
82
|
+
});
|
|
2
83
|
|
|
3
84
|
// src/version.ts
|
|
4
85
|
var version = "0.0.0-development";
|
|
5
86
|
|
|
87
|
+
// ../../node_modules/.pnpm/@clack+core@1.1.0/node_modules/@clack/core/dist/index.mjs
|
|
88
|
+
var import_sisteransi = __toESM(require_src(), 1);
|
|
89
|
+
import { styleText as D } from "util";
|
|
90
|
+
import { stdout as R, stdin as q } from "process";
|
|
91
|
+
import * as k from "readline";
|
|
92
|
+
import ot from "readline";
|
|
93
|
+
import { ReadStream as J } from "tty";
|
|
94
|
+
function x(t2, e, s) {
|
|
95
|
+
if (!s.some((u) => !u.disabled)) return t2;
|
|
96
|
+
const i = t2 + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
|
|
97
|
+
return s[n].disabled ? x(n, e < 0 ? -1 : 1, s) : n;
|
|
98
|
+
}
|
|
99
|
+
var at = (t2) => t2 === 161 || t2 === 164 || t2 === 167 || t2 === 168 || t2 === 170 || t2 === 173 || t2 === 174 || t2 >= 176 && t2 <= 180 || t2 >= 182 && t2 <= 186 || t2 >= 188 && t2 <= 191 || t2 === 198 || t2 === 208 || t2 === 215 || t2 === 216 || t2 >= 222 && t2 <= 225 || t2 === 230 || t2 >= 232 && t2 <= 234 || t2 === 236 || t2 === 237 || t2 === 240 || t2 === 242 || t2 === 243 || t2 >= 247 && t2 <= 250 || t2 === 252 || t2 === 254 || t2 === 257 || t2 === 273 || t2 === 275 || t2 === 283 || t2 === 294 || t2 === 295 || t2 === 299 || t2 >= 305 && t2 <= 307 || t2 === 312 || t2 >= 319 && t2 <= 322 || t2 === 324 || t2 >= 328 && t2 <= 331 || t2 === 333 || t2 === 338 || t2 === 339 || t2 === 358 || t2 === 359 || t2 === 363 || t2 === 462 || t2 === 464 || t2 === 466 || t2 === 468 || t2 === 470 || t2 === 472 || t2 === 474 || t2 === 476 || t2 === 593 || t2 === 609 || t2 === 708 || t2 === 711 || t2 >= 713 && t2 <= 715 || t2 === 717 || t2 === 720 || t2 >= 728 && t2 <= 731 || t2 === 733 || t2 === 735 || t2 >= 768 && t2 <= 879 || t2 >= 913 && t2 <= 929 || t2 >= 931 && t2 <= 937 || t2 >= 945 && t2 <= 961 || t2 >= 963 && t2 <= 969 || t2 === 1025 || t2 >= 1040 && t2 <= 1103 || t2 === 1105 || t2 === 8208 || t2 >= 8211 && t2 <= 8214 || t2 === 8216 || t2 === 8217 || t2 === 8220 || t2 === 8221 || t2 >= 8224 && t2 <= 8226 || t2 >= 8228 && t2 <= 8231 || t2 === 8240 || t2 === 8242 || t2 === 8243 || t2 === 8245 || t2 === 8251 || t2 === 8254 || t2 === 8308 || t2 === 8319 || t2 >= 8321 && t2 <= 8324 || t2 === 8364 || t2 === 8451 || t2 === 8453 || t2 === 8457 || t2 === 8467 || t2 === 8470 || t2 === 8481 || t2 === 8482 || t2 === 8486 || t2 === 8491 || t2 === 8531 || t2 === 8532 || t2 >= 8539 && t2 <= 8542 || t2 >= 8544 && t2 <= 8555 || t2 >= 8560 && t2 <= 8569 || t2 === 8585 || t2 >= 8592 && t2 <= 8601 || t2 === 8632 || t2 === 8633 || t2 === 8658 || t2 === 8660 || t2 === 8679 || t2 === 8704 || t2 === 8706 || t2 === 8707 || t2 === 8711 || t2 === 8712 || t2 === 8715 || t2 === 8719 || t2 === 8721 || t2 === 8725 || t2 === 8730 || t2 >= 8733 && t2 <= 8736 || t2 === 8739 || t2 === 8741 || t2 >= 8743 && t2 <= 8748 || t2 === 8750 || t2 >= 8756 && t2 <= 8759 || t2 === 8764 || t2 === 8765 || t2 === 8776 || t2 === 8780 || t2 === 8786 || t2 === 8800 || t2 === 8801 || t2 >= 8804 && t2 <= 8807 || t2 === 8810 || t2 === 8811 || t2 === 8814 || t2 === 8815 || t2 === 8834 || t2 === 8835 || t2 === 8838 || t2 === 8839 || t2 === 8853 || t2 === 8857 || t2 === 8869 || t2 === 8895 || t2 === 8978 || t2 >= 9312 && t2 <= 9449 || t2 >= 9451 && t2 <= 9547 || t2 >= 9552 && t2 <= 9587 || t2 >= 9600 && t2 <= 9615 || t2 >= 9618 && t2 <= 9621 || t2 === 9632 || t2 === 9633 || t2 >= 9635 && t2 <= 9641 || t2 === 9650 || t2 === 9651 || t2 === 9654 || t2 === 9655 || t2 === 9660 || t2 === 9661 || t2 === 9664 || t2 === 9665 || t2 >= 9670 && t2 <= 9672 || t2 === 9675 || t2 >= 9678 && t2 <= 9681 || t2 >= 9698 && t2 <= 9701 || t2 === 9711 || t2 === 9733 || t2 === 9734 || t2 === 9737 || t2 === 9742 || t2 === 9743 || t2 === 9756 || t2 === 9758 || t2 === 9792 || t2 === 9794 || t2 === 9824 || t2 === 9825 || t2 >= 9827 && t2 <= 9829 || t2 >= 9831 && t2 <= 9834 || t2 === 9836 || t2 === 9837 || t2 === 9839 || t2 === 9886 || t2 === 9887 || t2 === 9919 || t2 >= 9926 && t2 <= 9933 || t2 >= 9935 && t2 <= 9939 || t2 >= 9941 && t2 <= 9953 || t2 === 9955 || t2 === 9960 || t2 === 9961 || t2 >= 9963 && t2 <= 9969 || t2 === 9972 || t2 >= 9974 && t2 <= 9977 || t2 === 9979 || t2 === 9980 || t2 === 9982 || t2 === 9983 || t2 === 10045 || t2 >= 10102 && t2 <= 10111 || t2 >= 11094 && t2 <= 11097 || t2 >= 12872 && t2 <= 12879 || t2 >= 57344 && t2 <= 63743 || t2 >= 65024 && t2 <= 65039 || t2 === 65533 || t2 >= 127232 && t2 <= 127242 || t2 >= 127248 && t2 <= 127277 || t2 >= 127280 && t2 <= 127337 || t2 >= 127344 && t2 <= 127373 || t2 === 127375 || t2 === 127376 || t2 >= 127387 && t2 <= 127404 || t2 >= 917760 && t2 <= 917999 || t2 >= 983040 && t2 <= 1048573 || t2 >= 1048576 && t2 <= 1114109;
|
|
100
|
+
var lt = (t2) => t2 === 12288 || t2 >= 65281 && t2 <= 65376 || t2 >= 65504 && t2 <= 65510;
|
|
101
|
+
var ht = (t2) => t2 >= 4352 && t2 <= 4447 || t2 === 8986 || t2 === 8987 || t2 === 9001 || t2 === 9002 || t2 >= 9193 && t2 <= 9196 || t2 === 9200 || t2 === 9203 || t2 === 9725 || t2 === 9726 || t2 === 9748 || t2 === 9749 || t2 >= 9800 && t2 <= 9811 || t2 === 9855 || t2 === 9875 || t2 === 9889 || t2 === 9898 || t2 === 9899 || t2 === 9917 || t2 === 9918 || t2 === 9924 || t2 === 9925 || t2 === 9934 || t2 === 9940 || t2 === 9962 || t2 === 9970 || t2 === 9971 || t2 === 9973 || t2 === 9978 || t2 === 9981 || t2 === 9989 || t2 === 9994 || t2 === 9995 || t2 === 10024 || t2 === 10060 || t2 === 10062 || t2 >= 10067 && t2 <= 10069 || t2 === 10071 || t2 >= 10133 && t2 <= 10135 || t2 === 10160 || t2 === 10175 || t2 === 11035 || t2 === 11036 || t2 === 11088 || t2 === 11093 || t2 >= 11904 && t2 <= 11929 || t2 >= 11931 && t2 <= 12019 || t2 >= 12032 && t2 <= 12245 || t2 >= 12272 && t2 <= 12287 || t2 >= 12289 && t2 <= 12350 || t2 >= 12353 && t2 <= 12438 || t2 >= 12441 && t2 <= 12543 || t2 >= 12549 && t2 <= 12591 || t2 >= 12593 && t2 <= 12686 || t2 >= 12688 && t2 <= 12771 || t2 >= 12783 && t2 <= 12830 || t2 >= 12832 && t2 <= 12871 || t2 >= 12880 && t2 <= 19903 || t2 >= 19968 && t2 <= 42124 || t2 >= 42128 && t2 <= 42182 || t2 >= 43360 && t2 <= 43388 || t2 >= 44032 && t2 <= 55203 || t2 >= 63744 && t2 <= 64255 || t2 >= 65040 && t2 <= 65049 || t2 >= 65072 && t2 <= 65106 || t2 >= 65108 && t2 <= 65126 || t2 >= 65128 && t2 <= 65131 || t2 >= 94176 && t2 <= 94180 || t2 === 94192 || t2 === 94193 || t2 >= 94208 && t2 <= 100343 || t2 >= 100352 && t2 <= 101589 || t2 >= 101632 && t2 <= 101640 || t2 >= 110576 && t2 <= 110579 || t2 >= 110581 && t2 <= 110587 || t2 === 110589 || t2 === 110590 || t2 >= 110592 && t2 <= 110882 || t2 === 110898 || t2 >= 110928 && t2 <= 110930 || t2 === 110933 || t2 >= 110948 && t2 <= 110951 || t2 >= 110960 && t2 <= 111355 || t2 === 126980 || t2 === 127183 || t2 === 127374 || t2 >= 127377 && t2 <= 127386 || t2 >= 127488 && t2 <= 127490 || t2 >= 127504 && t2 <= 127547 || t2 >= 127552 && t2 <= 127560 || t2 === 127568 || t2 === 127569 || t2 >= 127584 && t2 <= 127589 || t2 >= 127744 && t2 <= 127776 || t2 >= 127789 && t2 <= 127797 || t2 >= 127799 && t2 <= 127868 || t2 >= 127870 && t2 <= 127891 || t2 >= 127904 && t2 <= 127946 || t2 >= 127951 && t2 <= 127955 || t2 >= 127968 && t2 <= 127984 || t2 === 127988 || t2 >= 127992 && t2 <= 128062 || t2 === 128064 || t2 >= 128066 && t2 <= 128252 || t2 >= 128255 && t2 <= 128317 || t2 >= 128331 && t2 <= 128334 || t2 >= 128336 && t2 <= 128359 || t2 === 128378 || t2 === 128405 || t2 === 128406 || t2 === 128420 || t2 >= 128507 && t2 <= 128591 || t2 >= 128640 && t2 <= 128709 || t2 === 128716 || t2 >= 128720 && t2 <= 128722 || t2 >= 128725 && t2 <= 128727 || t2 >= 128732 && t2 <= 128735 || t2 === 128747 || t2 === 128748 || t2 >= 128756 && t2 <= 128764 || t2 >= 128992 && t2 <= 129003 || t2 === 129008 || t2 >= 129292 && t2 <= 129338 || t2 >= 129340 && t2 <= 129349 || t2 >= 129351 && t2 <= 129535 || t2 >= 129648 && t2 <= 129660 || t2 >= 129664 && t2 <= 129672 || t2 >= 129680 && t2 <= 129725 || t2 >= 129727 && t2 <= 129733 || t2 >= 129742 && t2 <= 129755 || t2 >= 129760 && t2 <= 129768 || t2 >= 129776 && t2 <= 129784 || t2 >= 131072 && t2 <= 196605 || t2 >= 196608 && t2 <= 262141;
|
|
102
|
+
var O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
103
|
+
var y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
104
|
+
var L = /\t{1,1000}/y;
|
|
105
|
+
var P = 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");
|
|
106
|
+
var M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
107
|
+
var ct = new RegExp("\\p{M}+", "gu");
|
|
108
|
+
var ft = { limit: 1 / 0, ellipsis: "" };
|
|
109
|
+
var X = (t2, e = {}, s = {}) => {
|
|
110
|
+
const i = e.limit ?? 1 / 0, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, ft, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V2 = s.wideWidth ?? 2;
|
|
111
|
+
let h2 = 0, o = 0, p = t2.length, v = 0, F = false, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
|
|
112
|
+
t: for (; ; ) {
|
|
113
|
+
if (w > C || o >= p && o > h2) {
|
|
114
|
+
const ut = t2.slice(C, w) || t2.slice(h2, o);
|
|
115
|
+
v = 0;
|
|
116
|
+
for (const Y of ut.replaceAll(ct, "")) {
|
|
117
|
+
const $ = Y.codePointAt(0) || 0;
|
|
118
|
+
if (lt($) ? f = m : ht($) ? f = V2 : E !== A && at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h2) + v)), c + f > i) {
|
|
119
|
+
F = true;
|
|
120
|
+
break t;
|
|
121
|
+
}
|
|
122
|
+
v += Y.length, c += f;
|
|
123
|
+
}
|
|
124
|
+
C = w = 0;
|
|
125
|
+
}
|
|
126
|
+
if (o >= p) break;
|
|
127
|
+
if (M.lastIndex = o, M.test(t2)) {
|
|
128
|
+
if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
|
|
129
|
+
F = true;
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
c += f, C = h2, w = o, o = h2 = M.lastIndex;
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (O.lastIndex = o, O.test(t2)) {
|
|
136
|
+
if (c + u > b && (d = Math.min(d, o)), c + u > i) {
|
|
137
|
+
F = true;
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
c += u, C = h2, w = o, o = h2 = O.lastIndex;
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (y.lastIndex = o, y.test(t2)) {
|
|
144
|
+
if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
|
|
145
|
+
F = true;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
c += f, C = h2, w = o, o = h2 = y.lastIndex;
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (L.lastIndex = o, L.test(t2)) {
|
|
152
|
+
if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
|
|
153
|
+
F = true;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
c += f, C = h2, w = o, o = h2 = L.lastIndex;
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (P.lastIndex = o, P.test(t2)) {
|
|
160
|
+
if (c + g > b && (d = Math.min(d, o)), c + g > i) {
|
|
161
|
+
F = true;
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
c += g, C = h2, w = o, o = h2 = P.lastIndex;
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
o += 1;
|
|
168
|
+
}
|
|
169
|
+
return { width: F ? b : c, index: F ? d : p, truncated: F, ellipsed: F && i >= n };
|
|
170
|
+
};
|
|
171
|
+
var pt = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
|
|
172
|
+
var S = (t2, e = {}) => X(t2, pt, e).width;
|
|
173
|
+
var T = "\x1B";
|
|
174
|
+
var Z = "\x9B";
|
|
175
|
+
var Ft = 39;
|
|
176
|
+
var j = "\x07";
|
|
177
|
+
var Q = "[";
|
|
178
|
+
var dt = "]";
|
|
179
|
+
var tt = "m";
|
|
180
|
+
var U = `${dt}8;;`;
|
|
181
|
+
var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
|
|
182
|
+
var mt = (t2) => {
|
|
183
|
+
if (t2 >= 30 && t2 <= 37 || t2 >= 90 && t2 <= 97) return 39;
|
|
184
|
+
if (t2 >= 40 && t2 <= 47 || t2 >= 100 && t2 <= 107) return 49;
|
|
185
|
+
if (t2 === 1 || t2 === 2) return 22;
|
|
186
|
+
if (t2 === 3) return 23;
|
|
187
|
+
if (t2 === 4) return 24;
|
|
188
|
+
if (t2 === 7) return 27;
|
|
189
|
+
if (t2 === 8) return 28;
|
|
190
|
+
if (t2 === 9) return 29;
|
|
191
|
+
if (t2 === 0) return 0;
|
|
192
|
+
};
|
|
193
|
+
var st = (t2) => `${T}${Q}${t2}${tt}`;
|
|
194
|
+
var it = (t2) => `${T}${U}${t2}${j}`;
|
|
195
|
+
var gt = (t2) => t2.map((e) => S(e));
|
|
196
|
+
var G = (t2, e, s) => {
|
|
197
|
+
const i = e[Symbol.iterator]();
|
|
198
|
+
let r = false, n = false, u = t2.at(-1), a = u === void 0 ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
|
|
199
|
+
for (; !l.done; ) {
|
|
200
|
+
const m = l.value, A = S(m);
|
|
201
|
+
a + A <= s ? t2[t2.length - 1] += m : (t2.push(m), a = 0), (m === T || m === Z) && (r = true, n = e.startsWith(U, g + 1)), r ? n ? m === j && (r = false, n = false) : m === tt && (r = false) : (a += A, a === s && !E.done && (t2.push(""), a = 0)), l = E, E = i.next(), g += m.length;
|
|
202
|
+
}
|
|
203
|
+
u = t2.at(-1), !a && u !== void 0 && u.length > 0 && t2.length > 1 && (t2[t2.length - 2] += t2.pop());
|
|
204
|
+
};
|
|
205
|
+
var vt = (t2) => {
|
|
206
|
+
const e = t2.split(" ");
|
|
207
|
+
let s = e.length;
|
|
208
|
+
for (; s > 0 && !(S(e[s - 1]) > 0); ) s--;
|
|
209
|
+
return s === e.length ? t2 : e.slice(0, s).join(" ") + e.slice(s).join("");
|
|
210
|
+
};
|
|
211
|
+
var Et = (t2, e, s = {}) => {
|
|
212
|
+
if (s.trim !== false && t2.trim() === "") return "";
|
|
213
|
+
let i = "", r, n;
|
|
214
|
+
const u = t2.split(" "), a = gt(u);
|
|
215
|
+
let l = [""];
|
|
216
|
+
for (const [h2, o] of u.entries()) {
|
|
217
|
+
s.trim !== false && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
|
|
218
|
+
let p = S(l.at(-1) ?? "");
|
|
219
|
+
if (h2 !== 0 && (p >= e && (s.wordWrap === false || s.trim === false) && (l.push(""), p = 0), (p > 0 || s.trim === false) && (l[l.length - 1] += " ", p++)), s.hard && a[h2] > e) {
|
|
220
|
+
const v = e - p, F = 1 + Math.floor((a[h2] - v - 1) / e);
|
|
221
|
+
Math.floor((a[h2] - 1) / e) < F && l.push(""), G(l, o, e);
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (p + a[h2] > e && p > 0 && a[h2] > 0) {
|
|
225
|
+
if (s.wordWrap === false && p < e) {
|
|
226
|
+
G(l, o, e);
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
l.push("");
|
|
230
|
+
}
|
|
231
|
+
if (p + a[h2] > e && s.wordWrap === false) {
|
|
232
|
+
G(l, o, e);
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
l[l.length - 1] += o;
|
|
236
|
+
}
|
|
237
|
+
s.trim !== false && (l = l.map((h2) => vt(h2)));
|
|
238
|
+
const E = l.join(`
|
|
239
|
+
`), g = E[Symbol.iterator]();
|
|
240
|
+
let m = g.next(), A = g.next(), V2 = 0;
|
|
241
|
+
for (; !m.done; ) {
|
|
242
|
+
const h2 = m.value, o = A.value;
|
|
243
|
+
if (i += h2, h2 === T || h2 === Z) {
|
|
244
|
+
et.lastIndex = V2 + 1;
|
|
245
|
+
const F = et.exec(E)?.groups;
|
|
246
|
+
if (F?.code !== void 0) {
|
|
247
|
+
const d = Number.parseFloat(F.code);
|
|
248
|
+
r = d === Ft ? void 0 : d;
|
|
249
|
+
} else F?.uri !== void 0 && (n = F.uri.length === 0 ? void 0 : F.uri);
|
|
250
|
+
}
|
|
251
|
+
const p = r ? mt(r) : void 0;
|
|
252
|
+
o === `
|
|
253
|
+
` ? (n && (i += it("")), r && p && (i += st(p))) : h2 === `
|
|
254
|
+
` && (r && p && (i += st(r)), n && (i += it(n))), V2 += h2.length, m = A, A = g.next();
|
|
255
|
+
}
|
|
256
|
+
return i;
|
|
257
|
+
};
|
|
258
|
+
function K(t2, e, s) {
|
|
259
|
+
return String(t2).normalize().replaceAll(`\r
|
|
260
|
+
`, `
|
|
261
|
+
`).split(`
|
|
262
|
+
`).map((i) => Et(i, e, s)).join(`
|
|
263
|
+
`);
|
|
264
|
+
}
|
|
265
|
+
var At = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
266
|
+
var _ = { actions: new Set(At), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
|
|
267
|
+
function H(t2, e) {
|
|
268
|
+
if (typeof t2 == "string") return _.aliases.get(t2) === e;
|
|
269
|
+
for (const s of t2) if (s !== void 0 && H(s, e)) return true;
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
function _t(t2, e) {
|
|
273
|
+
if (t2 === e) return;
|
|
274
|
+
const s = t2.split(`
|
|
275
|
+
`), i = e.split(`
|
|
276
|
+
`), r = Math.max(s.length, i.length), n = [];
|
|
277
|
+
for (let u = 0; u < r; u++) s[u] !== i[u] && n.push(u);
|
|
278
|
+
return { lines: n, numLinesBefore: s.length, numLinesAfter: i.length, numLines: r };
|
|
279
|
+
}
|
|
280
|
+
var bt = globalThis.process.platform.startsWith("win");
|
|
281
|
+
var z = /* @__PURE__ */ Symbol("clack:cancel");
|
|
282
|
+
function W(t2, e) {
|
|
283
|
+
const s = t2;
|
|
284
|
+
s.isTTY && s.setRawMode(e);
|
|
285
|
+
}
|
|
286
|
+
var rt = (t2) => "columns" in t2 && typeof t2.columns == "number" ? t2.columns : 80;
|
|
287
|
+
var nt = (t2) => "rows" in t2 && typeof t2.rows == "number" ? t2.rows : 20;
|
|
288
|
+
function Bt(t2, e, s, i = s) {
|
|
289
|
+
const r = rt(t2 ?? R);
|
|
290
|
+
return K(e, r - s.length, { hard: true, trim: false }).split(`
|
|
291
|
+
`).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
|
|
292
|
+
`);
|
|
293
|
+
}
|
|
294
|
+
var B = class {
|
|
295
|
+
input;
|
|
296
|
+
output;
|
|
297
|
+
_abortSignal;
|
|
298
|
+
rl;
|
|
299
|
+
opts;
|
|
300
|
+
_render;
|
|
301
|
+
_track = false;
|
|
302
|
+
_prevFrame = "";
|
|
303
|
+
_subscribers = /* @__PURE__ */ new Map();
|
|
304
|
+
_cursor = 0;
|
|
305
|
+
state = "initial";
|
|
306
|
+
error = "";
|
|
307
|
+
value;
|
|
308
|
+
userInput = "";
|
|
309
|
+
constructor(e, s = true) {
|
|
310
|
+
const { input: i = q, output: r = R, render: n, signal: u, ...a } = e;
|
|
311
|
+
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = u, this.input = i, this.output = r;
|
|
312
|
+
}
|
|
313
|
+
unsubscribe() {
|
|
314
|
+
this._subscribers.clear();
|
|
315
|
+
}
|
|
316
|
+
setSubscriber(e, s) {
|
|
317
|
+
const i = this._subscribers.get(e) ?? [];
|
|
318
|
+
i.push(s), this._subscribers.set(e, i);
|
|
319
|
+
}
|
|
320
|
+
on(e, s) {
|
|
321
|
+
this.setSubscriber(e, { cb: s });
|
|
322
|
+
}
|
|
323
|
+
once(e, s) {
|
|
324
|
+
this.setSubscriber(e, { cb: s, once: true });
|
|
325
|
+
}
|
|
326
|
+
emit(e, ...s) {
|
|
327
|
+
const i = this._subscribers.get(e) ?? [], r = [];
|
|
328
|
+
for (const n of i) n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
|
|
329
|
+
for (const n of r) n();
|
|
330
|
+
}
|
|
331
|
+
prompt() {
|
|
332
|
+
return new Promise((e) => {
|
|
333
|
+
if (this._abortSignal) {
|
|
334
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(z);
|
|
335
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
336
|
+
this.state = "cancel", this.close();
|
|
337
|
+
}, { once: true });
|
|
338
|
+
}
|
|
339
|
+
this.rl = ot.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), W(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
340
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), W(this.input, false), e(this.value);
|
|
341
|
+
}), this.once("cancel", () => {
|
|
342
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), W(this.input, false), e(z);
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
_isActionKey(e, s) {
|
|
347
|
+
return e === " ";
|
|
348
|
+
}
|
|
349
|
+
_setValue(e) {
|
|
350
|
+
this.value = e, this.emit("value", this.value);
|
|
351
|
+
}
|
|
352
|
+
_setUserInput(e, s) {
|
|
353
|
+
this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
354
|
+
}
|
|
355
|
+
_clearUserInput() {
|
|
356
|
+
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
357
|
+
}
|
|
358
|
+
onKeypress(e, s) {
|
|
359
|
+
if (this._track && s.name !== "return" && (s.name && this._isActionKey(e, s) && 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"), s?.name && (!this._track && _.aliases.has(s.name) && this.emit("cursor", _.aliases.get(s.name)), _.actions.has(s.name) && this.emit("cursor", s.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e?.toLowerCase(), s), s?.name === "return") {
|
|
360
|
+
if (this.opts.validate) {
|
|
361
|
+
const i = this.opts.validate(this.value);
|
|
362
|
+
i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
|
|
363
|
+
}
|
|
364
|
+
this.state !== "error" && (this.state = "submit");
|
|
365
|
+
}
|
|
366
|
+
H([e, s?.name, s?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
367
|
+
}
|
|
368
|
+
close() {
|
|
369
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
370
|
+
`), W(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
371
|
+
}
|
|
372
|
+
restoreCursor() {
|
|
373
|
+
const e = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
374
|
+
`).length - 1;
|
|
375
|
+
this.output.write(import_sisteransi.cursor.move(-999, e * -1));
|
|
376
|
+
}
|
|
377
|
+
render() {
|
|
378
|
+
const e = K(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
|
|
379
|
+
if (e !== this._prevFrame) {
|
|
380
|
+
if (this.state === "initial") this.output.write(import_sisteransi.cursor.hide);
|
|
381
|
+
else {
|
|
382
|
+
const s = _t(this._prevFrame, e), i = nt(this.output);
|
|
383
|
+
if (this.restoreCursor(), s) {
|
|
384
|
+
const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
|
|
385
|
+
let u = s.lines.find((a) => a >= r);
|
|
386
|
+
if (u === void 0) {
|
|
387
|
+
this._prevFrame = e;
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
if (s.lines.length === 1) {
|
|
391
|
+
this.output.write(import_sisteransi.cursor.move(0, u - n)), this.output.write(import_sisteransi.erase.lines(1));
|
|
392
|
+
const a = e.split(`
|
|
393
|
+
`);
|
|
394
|
+
this.output.write(a[u]), this._prevFrame = e, this.output.write(import_sisteransi.cursor.move(0, a.length - u - 1));
|
|
395
|
+
return;
|
|
396
|
+
} else if (s.lines.length > 1) {
|
|
397
|
+
if (r < n) u = r;
|
|
398
|
+
else {
|
|
399
|
+
const l = u - n;
|
|
400
|
+
l > 0 && this.output.write(import_sisteransi.cursor.move(0, l));
|
|
401
|
+
}
|
|
402
|
+
this.output.write(import_sisteransi.erase.down());
|
|
403
|
+
const a = e.split(`
|
|
404
|
+
`).slice(u);
|
|
405
|
+
this.output.write(a.join(`
|
|
406
|
+
`)), this._prevFrame = e;
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
this.output.write(import_sisteransi.erase.down());
|
|
411
|
+
}
|
|
412
|
+
this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
var Lt = class extends B {
|
|
417
|
+
options;
|
|
418
|
+
cursor = 0;
|
|
419
|
+
get _value() {
|
|
420
|
+
return this.options[this.cursor].value;
|
|
421
|
+
}
|
|
422
|
+
get _enabledOptions() {
|
|
423
|
+
return this.options.filter((e) => e.disabled !== true);
|
|
424
|
+
}
|
|
425
|
+
toggleAll() {
|
|
426
|
+
const e = this._enabledOptions, s = this.value !== void 0 && this.value.length === e.length;
|
|
427
|
+
this.value = s ? [] : e.map((i) => i.value);
|
|
428
|
+
}
|
|
429
|
+
toggleInvert() {
|
|
430
|
+
const e = this.value;
|
|
431
|
+
if (!e) return;
|
|
432
|
+
const s = this._enabledOptions.filter((i) => !e.includes(i.value));
|
|
433
|
+
this.value = s.map((i) => i.value);
|
|
434
|
+
}
|
|
435
|
+
toggleValue() {
|
|
436
|
+
this.value === void 0 && (this.value = []);
|
|
437
|
+
const e = this.value.includes(this._value);
|
|
438
|
+
this.value = e ? this.value.filter((s) => s !== this._value) : [...this.value, this._value];
|
|
439
|
+
}
|
|
440
|
+
constructor(e) {
|
|
441
|
+
super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
|
|
442
|
+
const s = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), 0);
|
|
443
|
+
this.cursor = this.options[s].disabled ? x(s, 1, this.options) : s, this.on("key", (i) => {
|
|
444
|
+
i === "a" && this.toggleAll(), i === "i" && this.toggleInvert();
|
|
445
|
+
}), this.on("cursor", (i) => {
|
|
446
|
+
switch (i) {
|
|
447
|
+
case "left":
|
|
448
|
+
case "up":
|
|
449
|
+
this.cursor = x(this.cursor, -1, this.options);
|
|
450
|
+
break;
|
|
451
|
+
case "down":
|
|
452
|
+
case "right":
|
|
453
|
+
this.cursor = x(this.cursor, 1, this.options);
|
|
454
|
+
break;
|
|
455
|
+
case "space":
|
|
456
|
+
this.toggleValue();
|
|
457
|
+
break;
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
var Tt = class extends B {
|
|
463
|
+
options;
|
|
464
|
+
cursor = 0;
|
|
465
|
+
get _selectedValue() {
|
|
466
|
+
return this.options[this.cursor];
|
|
467
|
+
}
|
|
468
|
+
changeValue() {
|
|
469
|
+
this.value = this._selectedValue.value;
|
|
470
|
+
}
|
|
471
|
+
constructor(e) {
|
|
472
|
+
super(e, false), this.options = e.options;
|
|
473
|
+
const s = this.options.findIndex(({ value: r }) => r === e.initialValue), i = s === -1 ? 0 : s;
|
|
474
|
+
this.cursor = this.options[i].disabled ? x(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
|
|
475
|
+
switch (r) {
|
|
476
|
+
case "left":
|
|
477
|
+
case "up":
|
|
478
|
+
this.cursor = x(this.cursor, -1, this.options);
|
|
479
|
+
break;
|
|
480
|
+
case "down":
|
|
481
|
+
case "right":
|
|
482
|
+
this.cursor = x(this.cursor, 1, this.options);
|
|
483
|
+
break;
|
|
484
|
+
}
|
|
485
|
+
this.changeValue();
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
// ../../node_modules/.pnpm/@clack+prompts@1.1.0/node_modules/@clack/prompts/dist/index.mjs
|
|
491
|
+
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
492
|
+
import { styleText as t, stripVTControlCharacters as ue } from "util";
|
|
493
|
+
import N2 from "process";
|
|
494
|
+
import { readdirSync as $t2, existsSync as dt2, lstatSync as xe } from "fs";
|
|
495
|
+
import { dirname as _e, join as ht2 } from "path";
|
|
496
|
+
function pt2() {
|
|
497
|
+
return N2.platform !== "win32" ? N2.env.TERM !== "linux" : !!N2.env.CI || !!N2.env.WT_SESSION || !!N2.env.TERMINUS_SUBLIME || N2.env.ConEmuTask === "{cmd::Cmder}" || N2.env.TERM_PROGRAM === "Terminus-Sublime" || N2.env.TERM_PROGRAM === "vscode" || N2.env.TERM === "xterm-256color" || N2.env.TERM === "alacritty" || N2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
498
|
+
}
|
|
499
|
+
var ee = pt2();
|
|
500
|
+
var I2 = (e, r) => ee ? e : r;
|
|
501
|
+
var Re = I2("\u25C6", "*");
|
|
502
|
+
var $e = I2("\u25A0", "x");
|
|
503
|
+
var de = I2("\u25B2", "x");
|
|
504
|
+
var V = I2("\u25C7", "o");
|
|
505
|
+
var he = I2("\u250C", "T");
|
|
506
|
+
var h = I2("\u2502", "|");
|
|
507
|
+
var x2 = I2("\u2514", "\u2014");
|
|
508
|
+
var Oe = I2("\u2510", "T");
|
|
509
|
+
var Pe = I2("\u2518", "\u2014");
|
|
510
|
+
var z2 = I2("\u25CF", ">");
|
|
511
|
+
var H2 = I2("\u25CB", " ");
|
|
512
|
+
var te = I2("\u25FB", "[\u2022]");
|
|
513
|
+
var U2 = I2("\u25FC", "[+]");
|
|
514
|
+
var q2 = I2("\u25FB", "[ ]");
|
|
515
|
+
var Ne = I2("\u25AA", "\u2022");
|
|
516
|
+
var se = I2("\u2500", "-");
|
|
517
|
+
var pe = I2("\u256E", "+");
|
|
518
|
+
var We = I2("\u251C", "+");
|
|
519
|
+
var me = I2("\u256F", "+");
|
|
520
|
+
var ge = I2("\u2570", "+");
|
|
521
|
+
var Ge = I2("\u256D", "+");
|
|
522
|
+
var fe = I2("\u25CF", "\u2022");
|
|
523
|
+
var Fe = I2("\u25C6", "*");
|
|
524
|
+
var ye = I2("\u25B2", "!");
|
|
525
|
+
var Ee = I2("\u25A0", "x");
|
|
526
|
+
var W2 = (e) => {
|
|
527
|
+
switch (e) {
|
|
528
|
+
case "initial":
|
|
529
|
+
case "active":
|
|
530
|
+
return t("cyan", Re);
|
|
531
|
+
case "cancel":
|
|
532
|
+
return t("red", $e);
|
|
533
|
+
case "error":
|
|
534
|
+
return t("yellow", de);
|
|
535
|
+
case "submit":
|
|
536
|
+
return t("green", V);
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
var ve = (e) => {
|
|
540
|
+
switch (e) {
|
|
541
|
+
case "initial":
|
|
542
|
+
case "active":
|
|
543
|
+
return t("cyan", h);
|
|
544
|
+
case "cancel":
|
|
545
|
+
return t("red", h);
|
|
546
|
+
case "error":
|
|
547
|
+
return t("yellow", h);
|
|
548
|
+
case "submit":
|
|
549
|
+
return t("green", h);
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
var mt2 = (e) => e === 161 || e === 164 || e === 167 || e === 168 || e === 170 || e === 173 || e === 174 || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || e === 198 || e === 208 || e === 215 || e === 216 || e >= 222 && e <= 225 || e === 230 || e >= 232 && e <= 234 || e === 236 || e === 237 || e === 240 || e === 242 || e === 243 || e >= 247 && e <= 250 || e === 252 || e === 254 || e === 257 || e === 273 || e === 275 || e === 283 || e === 294 || e === 295 || e === 299 || e >= 305 && e <= 307 || e === 312 || e >= 319 && e <= 322 || e === 324 || e >= 328 && e <= 331 || e === 333 || e === 338 || e === 339 || e === 358 || e === 359 || e === 363 || e === 462 || e === 464 || e === 466 || e === 468 || e === 470 || e === 472 || e === 474 || e === 476 || e === 593 || e === 609 || e === 708 || e === 711 || e >= 713 && e <= 715 || e === 717 || e === 720 || e >= 728 && e <= 731 || e === 733 || e === 735 || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || e === 1025 || e >= 1040 && e <= 1103 || e === 1105 || e === 8208 || e >= 8211 && e <= 8214 || e === 8216 || e === 8217 || e === 8220 || e === 8221 || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || e === 8240 || e === 8242 || e === 8243 || e === 8245 || e === 8251 || e === 8254 || e === 8308 || e === 8319 || e >= 8321 && e <= 8324 || e === 8364 || e === 8451 || e === 8453 || e === 8457 || e === 8467 || e === 8470 || e === 8481 || e === 8482 || e === 8486 || e === 8491 || e === 8531 || e === 8532 || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || e === 8585 || e >= 8592 && e <= 8601 || e === 8632 || e === 8633 || e === 8658 || e === 8660 || e === 8679 || e === 8704 || e === 8706 || e === 8707 || e === 8711 || e === 8712 || e === 8715 || e === 8719 || e === 8721 || e === 8725 || e === 8730 || e >= 8733 && e <= 8736 || e === 8739 || e === 8741 || e >= 8743 && e <= 8748 || e === 8750 || e >= 8756 && e <= 8759 || e === 8764 || e === 8765 || e === 8776 || e === 8780 || e === 8786 || e === 8800 || e === 8801 || e >= 8804 && e <= 8807 || e === 8810 || e === 8811 || e === 8814 || e === 8815 || e === 8834 || e === 8835 || e === 8838 || e === 8839 || e === 8853 || e === 8857 || e === 8869 || e === 8895 || e === 8978 || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || e === 9632 || e === 9633 || e >= 9635 && e <= 9641 || e === 9650 || e === 9651 || e === 9654 || e === 9655 || e === 9660 || e === 9661 || e === 9664 || e === 9665 || e >= 9670 && e <= 9672 || e === 9675 || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || e === 9711 || e === 9733 || e === 9734 || e === 9737 || e === 9742 || e === 9743 || e === 9756 || e === 9758 || e === 9792 || e === 9794 || e === 9824 || e === 9825 || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || e === 9836 || e === 9837 || e === 9839 || e === 9886 || e === 9887 || e === 9919 || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || e === 9955 || e === 9960 || e === 9961 || e >= 9963 && e <= 9969 || e === 9972 || e >= 9974 && e <= 9977 || e === 9979 || e === 9980 || e === 9982 || e === 9983 || e === 10045 || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || e === 65533 || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || e === 127375 || e === 127376 || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109;
|
|
553
|
+
var gt2 = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510;
|
|
554
|
+
var ft2 = (e) => e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9800 && e <= 9811 || e === 9855 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 19968 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e === 94192 || e === 94193 || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129672 || e >= 129680 && e <= 129725 || e >= 129727 && e <= 129733 || e >= 129742 && e <= 129755 || e >= 129760 && e <= 129768 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141;
|
|
555
|
+
var we = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
556
|
+
var re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
557
|
+
var ie = /\t{1,1000}/y;
|
|
558
|
+
var Ae = 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");
|
|
559
|
+
var ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
560
|
+
var Ft2 = new RegExp("\\p{M}+", "gu");
|
|
561
|
+
var yt2 = { limit: 1 / 0, ellipsis: "" };
|
|
562
|
+
var Le = (e, r = {}, s = {}) => {
|
|
563
|
+
const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? Le(a, yt2, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, p = s.emojiWidth ?? 2, f = s.fullWidthWidth ?? 2, g = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
|
|
564
|
+
let $ = 0, m = 0, d = e.length, F = 0, y2 = false, v = d, C = Math.max(0, i - o), A = 0, b = 0, w = 0, S2 = 0;
|
|
565
|
+
e: for (; ; ) {
|
|
566
|
+
if (b > A || m >= d && m > $) {
|
|
567
|
+
const T2 = e.slice(A, b) || e.slice($, m);
|
|
568
|
+
F = 0;
|
|
569
|
+
for (const M2 of T2.replaceAll(Ft2, "")) {
|
|
570
|
+
const O2 = M2.codePointAt(0) || 0;
|
|
571
|
+
if (gt2(O2) ? S2 = f : ft2(O2) ? S2 = E : c !== g && mt2(O2) ? S2 = c : S2 = g, w + S2 > C && (v = Math.min(v, Math.max(A, $) + F)), w + S2 > i) {
|
|
572
|
+
y2 = true;
|
|
573
|
+
break e;
|
|
574
|
+
}
|
|
575
|
+
F += M2.length, w += S2;
|
|
576
|
+
}
|
|
577
|
+
A = b = 0;
|
|
578
|
+
}
|
|
579
|
+
if (m >= d) break;
|
|
580
|
+
if (ne.lastIndex = m, ne.test(e)) {
|
|
581
|
+
if (F = ne.lastIndex - m, S2 = F * g, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S2 > i) {
|
|
582
|
+
y2 = true;
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
w += S2, A = $, b = m, m = $ = ne.lastIndex;
|
|
586
|
+
continue;
|
|
587
|
+
}
|
|
588
|
+
if (we.lastIndex = m, we.test(e)) {
|
|
589
|
+
if (w + u > C && (v = Math.min(v, m)), w + u > i) {
|
|
590
|
+
y2 = true;
|
|
591
|
+
break;
|
|
592
|
+
}
|
|
593
|
+
w += u, A = $, b = m, m = $ = we.lastIndex;
|
|
594
|
+
continue;
|
|
595
|
+
}
|
|
596
|
+
if (re.lastIndex = m, re.test(e)) {
|
|
597
|
+
if (F = re.lastIndex - m, S2 = F * l, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S2 > i) {
|
|
598
|
+
y2 = true;
|
|
599
|
+
break;
|
|
600
|
+
}
|
|
601
|
+
w += S2, A = $, b = m, m = $ = re.lastIndex;
|
|
602
|
+
continue;
|
|
603
|
+
}
|
|
604
|
+
if (ie.lastIndex = m, ie.test(e)) {
|
|
605
|
+
if (F = ie.lastIndex - m, S2 = F * n, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S2 > i) {
|
|
606
|
+
y2 = true;
|
|
607
|
+
break;
|
|
608
|
+
}
|
|
609
|
+
w += S2, A = $, b = m, m = $ = ie.lastIndex;
|
|
610
|
+
continue;
|
|
611
|
+
}
|
|
612
|
+
if (Ae.lastIndex = m, Ae.test(e)) {
|
|
613
|
+
if (w + p > C && (v = Math.min(v, m)), w + p > i) {
|
|
614
|
+
y2 = true;
|
|
615
|
+
break;
|
|
616
|
+
}
|
|
617
|
+
w += p, A = $, b = m, m = $ = Ae.lastIndex;
|
|
618
|
+
continue;
|
|
619
|
+
}
|
|
620
|
+
m += 1;
|
|
621
|
+
}
|
|
622
|
+
return { width: y2 ? C : w, index: y2 ? v : d, truncated: y2, ellipsed: y2 && i >= o };
|
|
623
|
+
};
|
|
624
|
+
var Et2 = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
|
|
625
|
+
var D2 = (e, r = {}) => Le(e, Et2, r).width;
|
|
626
|
+
var ae = "\x1B";
|
|
627
|
+
var je = "\x9B";
|
|
628
|
+
var vt2 = 39;
|
|
629
|
+
var Ce = "\x07";
|
|
630
|
+
var ke = "[";
|
|
631
|
+
var wt = "]";
|
|
632
|
+
var Ve = "m";
|
|
633
|
+
var Se = `${wt}8;;`;
|
|
634
|
+
var He = new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y");
|
|
635
|
+
var At2 = (e) => {
|
|
636
|
+
if (e >= 30 && e <= 37 || e >= 90 && e <= 97) return 39;
|
|
637
|
+
if (e >= 40 && e <= 47 || e >= 100 && e <= 107) return 49;
|
|
638
|
+
if (e === 1 || e === 2) return 22;
|
|
639
|
+
if (e === 3) return 23;
|
|
640
|
+
if (e === 4) return 24;
|
|
641
|
+
if (e === 7) return 27;
|
|
642
|
+
if (e === 8) return 28;
|
|
643
|
+
if (e === 9) return 29;
|
|
644
|
+
if (e === 0) return 0;
|
|
645
|
+
};
|
|
646
|
+
var Ue = (e) => `${ae}${ke}${e}${Ve}`;
|
|
647
|
+
var Ke = (e) => `${ae}${Se}${e}${Ce}`;
|
|
648
|
+
var Ct2 = (e) => e.map((r) => D2(r));
|
|
649
|
+
var Ie = (e, r, s) => {
|
|
650
|
+
const i = r[Symbol.iterator]();
|
|
651
|
+
let a = false, o = false, u = e.at(-1), l = u === void 0 ? 0 : D2(u), n = i.next(), c = i.next(), p = 0;
|
|
652
|
+
for (; !n.done; ) {
|
|
653
|
+
const f = n.value, g = D2(f);
|
|
654
|
+
l + g <= s ? e[e.length - 1] += f : (e.push(f), l = 0), (f === ae || f === je) && (a = true, o = r.startsWith(Se, p + 1)), a ? o ? f === Ce && (a = false, o = false) : f === Ve && (a = false) : (l += g, l === s && !c.done && (e.push(""), l = 0)), n = c, c = i.next(), p += f.length;
|
|
655
|
+
}
|
|
656
|
+
u = e.at(-1), !l && u !== void 0 && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
657
|
+
};
|
|
658
|
+
var St = (e) => {
|
|
659
|
+
const r = e.split(" ");
|
|
660
|
+
let s = r.length;
|
|
661
|
+
for (; s > 0 && !(D2(r[s - 1]) > 0); ) s--;
|
|
662
|
+
return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
|
|
663
|
+
};
|
|
664
|
+
var It2 = (e, r, s = {}) => {
|
|
665
|
+
if (s.trim !== false && e.trim() === "") return "";
|
|
666
|
+
let i = "", a, o;
|
|
667
|
+
const u = e.split(" "), l = Ct2(u);
|
|
668
|
+
let n = [""];
|
|
669
|
+
for (const [$, m] of u.entries()) {
|
|
670
|
+
s.trim !== false && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
|
|
671
|
+
let d = D2(n.at(-1) ?? "");
|
|
672
|
+
if ($ !== 0 && (d >= r && (s.wordWrap === false || s.trim === false) && (n.push(""), d = 0), (d > 0 || s.trim === false) && (n[n.length - 1] += " ", d++)), s.hard && l[$] > r) {
|
|
673
|
+
const F = r - d, y2 = 1 + Math.floor((l[$] - F - 1) / r);
|
|
674
|
+
Math.floor((l[$] - 1) / r) < y2 && n.push(""), Ie(n, m, r);
|
|
675
|
+
continue;
|
|
676
|
+
}
|
|
677
|
+
if (d + l[$] > r && d > 0 && l[$] > 0) {
|
|
678
|
+
if (s.wordWrap === false && d < r) {
|
|
679
|
+
Ie(n, m, r);
|
|
680
|
+
continue;
|
|
681
|
+
}
|
|
682
|
+
n.push("");
|
|
683
|
+
}
|
|
684
|
+
if (d + l[$] > r && s.wordWrap === false) {
|
|
685
|
+
Ie(n, m, r);
|
|
686
|
+
continue;
|
|
687
|
+
}
|
|
688
|
+
n[n.length - 1] += m;
|
|
689
|
+
}
|
|
690
|
+
s.trim !== false && (n = n.map(($) => St($)));
|
|
691
|
+
const c = n.join(`
|
|
692
|
+
`), p = c[Symbol.iterator]();
|
|
693
|
+
let f = p.next(), g = p.next(), E = 0;
|
|
694
|
+
for (; !f.done; ) {
|
|
695
|
+
const $ = f.value, m = g.value;
|
|
696
|
+
if (i += $, $ === ae || $ === je) {
|
|
697
|
+
He.lastIndex = E + 1;
|
|
698
|
+
const y2 = He.exec(c)?.groups;
|
|
699
|
+
if (y2?.code !== void 0) {
|
|
700
|
+
const v = Number.parseFloat(y2.code);
|
|
701
|
+
a = v === vt2 ? void 0 : v;
|
|
702
|
+
} else y2?.uri !== void 0 && (o = y2.uri.length === 0 ? void 0 : y2.uri);
|
|
703
|
+
}
|
|
704
|
+
const d = a ? At2(a) : void 0;
|
|
705
|
+
m === `
|
|
706
|
+
` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
|
|
707
|
+
` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
|
|
708
|
+
}
|
|
709
|
+
return i;
|
|
710
|
+
};
|
|
711
|
+
function J2(e, r, s) {
|
|
712
|
+
return String(e).normalize().replaceAll(`\r
|
|
713
|
+
`, `
|
|
714
|
+
`).split(`
|
|
715
|
+
`).map((i) => It2(i, r, s)).join(`
|
|
716
|
+
`);
|
|
717
|
+
}
|
|
718
|
+
var bt2 = (e, r, s, i, a) => {
|
|
719
|
+
let o = r, u = 0;
|
|
720
|
+
for (let l = s; l < i; l++) {
|
|
721
|
+
const n = e[l];
|
|
722
|
+
if (o = o - n.length, u++, o <= a) break;
|
|
723
|
+
}
|
|
724
|
+
return { lineCount: o, removals: u };
|
|
725
|
+
};
|
|
726
|
+
var X2 = ({ cursor: e, options: r, style: s, output: i = process.stdout, maxItems: a = Number.POSITIVE_INFINITY, columnPadding: o = 0, rowPadding: u = 4 }) => {
|
|
727
|
+
const l = rt(i) - o, n = nt(i), c = t("dim", "..."), p = Math.max(n - u, 0), f = Math.max(Math.min(a, p), 5);
|
|
728
|
+
let g = 0;
|
|
729
|
+
e >= f - 3 && (g = Math.max(Math.min(e - f + 3, r.length - f), 0));
|
|
730
|
+
let E = f < r.length && g > 0, $ = f < r.length && g + f < r.length;
|
|
731
|
+
const m = Math.min(g + f, r.length), d = [];
|
|
732
|
+
let F = 0;
|
|
733
|
+
E && F++, $ && F++;
|
|
734
|
+
const y2 = g + (E ? 1 : 0), v = m - ($ ? 1 : 0);
|
|
735
|
+
for (let A = y2; A < v; A++) {
|
|
736
|
+
const b = J2(s(r[A], A === e), l, { hard: true, trim: false }).split(`
|
|
737
|
+
`);
|
|
738
|
+
d.push(b), F += b.length;
|
|
739
|
+
}
|
|
740
|
+
if (F > p) {
|
|
741
|
+
let A = 0, b = 0, w = F;
|
|
742
|
+
const S2 = e - y2, T2 = (M2, O2) => bt2(d, w, M2, O2, p);
|
|
743
|
+
E ? ({ lineCount: w, removals: A } = T2(0, S2), w > p && ({ lineCount: w, removals: b } = T2(S2 + 1, d.length))) : ({ lineCount: w, removals: b } = T2(S2 + 1, d.length), w > p && ({ lineCount: w, removals: A } = T2(0, S2))), A > 0 && (E = true, d.splice(0, A)), b > 0 && ($ = true, d.splice(d.length - b, b));
|
|
744
|
+
}
|
|
745
|
+
const C = [];
|
|
746
|
+
E && C.push(c);
|
|
747
|
+
for (const A of d) for (const b of A) C.push(b);
|
|
748
|
+
return $ && C.push(c), C;
|
|
749
|
+
};
|
|
750
|
+
var R2 = { message: (e = [], { symbol: r = t("gray", h), secondarySymbol: s = t("gray", h), output: i = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
|
|
751
|
+
const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "", p = l ? `${s} ` : "";
|
|
752
|
+
for (let g = 0; g < a; g++) u.push(n);
|
|
753
|
+
const f = Array.isArray(e) ? e : e.split(`
|
|
754
|
+
`);
|
|
755
|
+
if (f.length > 0) {
|
|
756
|
+
const [g, ...E] = f;
|
|
757
|
+
g.length > 0 ? u.push(`${c}${g}`) : u.push(l ? r : "");
|
|
758
|
+
for (const $ of E) $.length > 0 ? u.push(`${p}${$}`) : u.push(l ? s : "");
|
|
759
|
+
}
|
|
760
|
+
i.write(`${u.join(`
|
|
761
|
+
`)}
|
|
762
|
+
`);
|
|
763
|
+
}, info: (e, r) => {
|
|
764
|
+
R2.message(e, { ...r, symbol: t("blue", fe) });
|
|
765
|
+
}, success: (e, r) => {
|
|
766
|
+
R2.message(e, { ...r, symbol: t("green", Fe) });
|
|
767
|
+
}, step: (e, r) => {
|
|
768
|
+
R2.message(e, { ...r, symbol: t("green", V) });
|
|
769
|
+
}, warn: (e, r) => {
|
|
770
|
+
R2.message(e, { ...r, symbol: t("yellow", ye) });
|
|
771
|
+
}, warning: (e, r) => {
|
|
772
|
+
R2.warn(e, r);
|
|
773
|
+
}, error: (e, r) => {
|
|
774
|
+
R2.message(e, { ...r, symbol: t("red", Ee) });
|
|
775
|
+
} };
|
|
776
|
+
var Nt = (e = "", r) => {
|
|
777
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${t("gray", x2)} ` : "";
|
|
778
|
+
s.write(`${i}${t("red", e)}
|
|
779
|
+
|
|
780
|
+
`);
|
|
781
|
+
};
|
|
782
|
+
var Wt2 = (e = "", r) => {
|
|
783
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${t("gray", he)} ` : "";
|
|
784
|
+
s.write(`${i}${e}
|
|
785
|
+
`);
|
|
786
|
+
};
|
|
787
|
+
var Gt = (e = "", r) => {
|
|
788
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${t("gray", h)}
|
|
789
|
+
${t("gray", x2)} ` : "";
|
|
790
|
+
s.write(`${i}${e}
|
|
791
|
+
|
|
792
|
+
`);
|
|
793
|
+
};
|
|
794
|
+
var Q2 = (e, r) => e.split(`
|
|
795
|
+
`).map((s) => r(s)).join(`
|
|
796
|
+
`);
|
|
797
|
+
var Lt2 = (e) => {
|
|
798
|
+
const r = (i, a) => {
|
|
799
|
+
const o = i.label ?? String(i.value);
|
|
800
|
+
return a === "disabled" ? `${t("gray", q2)} ${Q2(o, (u) => t(["strikethrough", "gray"], u))}${i.hint ? ` ${t("dim", `(${i.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${t("cyan", te)} ${o}${i.hint ? ` ${t("dim", `(${i.hint})`)}` : ""}` : a === "selected" ? `${t("green", U2)} ${Q2(o, (u) => t("dim", u))}${i.hint ? ` ${t("dim", `(${i.hint})`)}` : ""}` : a === "cancelled" ? `${Q2(o, (u) => t(["strikethrough", "dim"], u))}` : a === "active-selected" ? `${t("green", U2)} ${o}${i.hint ? ` ${t("dim", `(${i.hint})`)}` : ""}` : a === "submitted" ? `${Q2(o, (u) => t("dim", u))}` : `${t("dim", q2)} ${Q2(o, (u) => t("dim", u))}`;
|
|
801
|
+
}, s = e.required ?? true;
|
|
802
|
+
return new Lt({ options: e.options, signal: e.signal, input: e.input, output: e.output, initialValues: e.initialValues, required: s, cursorAt: e.cursorAt, validate(i) {
|
|
803
|
+
if (s && (i === void 0 || i.length === 0)) return `Please select at least one option.
|
|
804
|
+
${t("reset", t("dim", `Press ${t(["gray", "bgWhite", "inverse"], " space ")} to select, ${t("gray", t("bgWhite", t("inverse", " enter ")))} to submit`))}`;
|
|
805
|
+
}, render() {
|
|
806
|
+
const i = Bt(e.output, e.message, `${ve(this.state)} `, `${W2(this.state)} `), a = `${t("gray", h)}
|
|
807
|
+
${i}
|
|
808
|
+
`, o = this.value ?? [], u = (l, n) => {
|
|
809
|
+
if (l.disabled) return r(l, "disabled");
|
|
810
|
+
const c = o.includes(l.value);
|
|
811
|
+
return n && c ? r(l, "active-selected") : c ? r(l, "selected") : r(l, n ? "active" : "inactive");
|
|
812
|
+
};
|
|
813
|
+
switch (this.state) {
|
|
814
|
+
case "submit": {
|
|
815
|
+
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join(t("dim", ", ")) || t("dim", "none"), n = Bt(e.output, l, `${t("gray", h)} `);
|
|
816
|
+
return `${a}${n}`;
|
|
817
|
+
}
|
|
818
|
+
case "cancel": {
|
|
819
|
+
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(t("dim", ", "));
|
|
820
|
+
if (l.trim() === "") return `${a}${t("gray", h)}`;
|
|
821
|
+
const n = Bt(e.output, l, `${t("gray", h)} `);
|
|
822
|
+
return `${a}${n}
|
|
823
|
+
${t("gray", h)}`;
|
|
824
|
+
}
|
|
825
|
+
case "error": {
|
|
826
|
+
const l = `${t("yellow", h)} `, n = this.error.split(`
|
|
827
|
+
`).map((f, g) => g === 0 ? `${t("yellow", x2)} ${t("yellow", f)}` : ` ${f}`).join(`
|
|
828
|
+
`), c = a.split(`
|
|
829
|
+
`).length, p = n.split(`
|
|
830
|
+
`).length + 1;
|
|
831
|
+
return `${a}${l}${X2({ output: e.output, options: this.options, cursor: this.cursor, maxItems: e.maxItems, columnPadding: l.length, rowPadding: c + p, style: u }).join(`
|
|
832
|
+
${l}`)}
|
|
833
|
+
${n}
|
|
834
|
+
`;
|
|
835
|
+
}
|
|
836
|
+
default: {
|
|
837
|
+
const l = `${t("cyan", h)} `, n = a.split(`
|
|
838
|
+
`).length;
|
|
839
|
+
return `${a}${l}${X2({ output: e.output, options: this.options, cursor: this.cursor, maxItems: e.maxItems, columnPadding: l.length, rowPadding: n + 2, style: u }).join(`
|
|
840
|
+
${l}`)}
|
|
841
|
+
${t("cyan", x2)}
|
|
842
|
+
`;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
} }).prompt();
|
|
846
|
+
};
|
|
847
|
+
var ze = { light: I2("\u2500", "-"), heavy: I2("\u2501", "="), block: I2("\u2588", "#") };
|
|
848
|
+
var oe = (e, r) => e.includes(`
|
|
849
|
+
`) ? e.split(`
|
|
850
|
+
`).map((s) => r(s)).join(`
|
|
851
|
+
`) : r(e);
|
|
852
|
+
var Jt = (e) => {
|
|
853
|
+
const r = (s, i) => {
|
|
854
|
+
const a = s.label ?? String(s.value);
|
|
855
|
+
switch (i) {
|
|
856
|
+
case "disabled":
|
|
857
|
+
return `${t("gray", H2)} ${oe(a, (o) => t("gray", o))}${s.hint ? ` ${t("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
858
|
+
case "selected":
|
|
859
|
+
return `${oe(a, (o) => t("dim", o))}`;
|
|
860
|
+
case "active":
|
|
861
|
+
return `${t("green", z2)} ${a}${s.hint ? ` ${t("dim", `(${s.hint})`)}` : ""}`;
|
|
862
|
+
case "cancelled":
|
|
863
|
+
return `${oe(a, (o) => t(["strikethrough", "dim"], o))}`;
|
|
864
|
+
default:
|
|
865
|
+
return `${t("dim", H2)} ${oe(a, (o) => t("dim", o))}`;
|
|
866
|
+
}
|
|
867
|
+
};
|
|
868
|
+
return new Tt({ options: e.options, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue, render() {
|
|
869
|
+
const s = e.withGuide ?? _.withGuide, i = `${W2(this.state)} `, a = `${ve(this.state)} `, o = Bt(e.output, e.message, a, i), u = `${s ? `${t("gray", h)}
|
|
870
|
+
` : ""}${o}
|
|
871
|
+
`;
|
|
872
|
+
switch (this.state) {
|
|
873
|
+
case "submit": {
|
|
874
|
+
const l = s ? `${t("gray", h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "selected"), l);
|
|
875
|
+
return `${u}${n}`;
|
|
876
|
+
}
|
|
877
|
+
case "cancel": {
|
|
878
|
+
const l = s ? `${t("gray", h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "cancelled"), l);
|
|
879
|
+
return `${u}${n}${s ? `
|
|
880
|
+
${t("gray", h)}` : ""}`;
|
|
881
|
+
}
|
|
882
|
+
default: {
|
|
883
|
+
const l = s ? `${t("cyan", h)} ` : "", n = s ? t("cyan", x2) : "", c = u.split(`
|
|
884
|
+
`).length, p = s ? 2 : 1;
|
|
885
|
+
return `${u}${l}${X2({ output: e.output, cursor: this.cursor, options: this.options, maxItems: e.maxItems, columnPadding: l.length, rowPadding: c + p, style: (f, g) => r(f, f.disabled ? "disabled" : g ? "active" : "inactive") }).join(`
|
|
886
|
+
${l}`)}
|
|
887
|
+
${n}
|
|
888
|
+
`;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
} }).prompt();
|
|
892
|
+
};
|
|
893
|
+
var Qe = `${t("gray", h)} `;
|
|
894
|
+
|
|
6
895
|
// src/commands/setup.ts
|
|
7
|
-
import * as clack from "@clack/prompts";
|
|
8
896
|
import {
|
|
9
897
|
readUserConfig,
|
|
10
898
|
writeUserConfig,
|
|
@@ -24,7 +912,7 @@ import {
|
|
|
24
912
|
writeInlineSkills
|
|
25
913
|
} from "@codemcp/ade-harnesses";
|
|
26
914
|
async function runSetup(projectRoot, catalog) {
|
|
27
|
-
|
|
915
|
+
Wt2("ade setup");
|
|
28
916
|
const existingConfig = await readUserConfig(projectRoot);
|
|
29
917
|
const existingChoices = existingConfig?.choices ?? {};
|
|
30
918
|
for (const [facetId, value] of Object.entries(existingChoices)) {
|
|
@@ -33,7 +921,7 @@ async function runSetup(projectRoot, catalog) {
|
|
|
33
921
|
const ids = Array.isArray(value) ? value : [value];
|
|
34
922
|
for (const optionId of ids) {
|
|
35
923
|
if (!getOption(facet, optionId)) {
|
|
36
|
-
|
|
924
|
+
R2.warn(
|
|
37
925
|
`Previously selected option "${optionId}" is no longer available in facet "${facet.label}".`
|
|
38
926
|
);
|
|
39
927
|
}
|
|
@@ -48,7 +936,7 @@ async function runSetup(projectRoot, catalog) {
|
|
|
48
936
|
if (facet.multiSelect) {
|
|
49
937
|
const selected = await promptMultiSelect(visibleFacet, existingChoices);
|
|
50
938
|
if (typeof selected === "symbol") {
|
|
51
|
-
|
|
939
|
+
Nt("Setup cancelled.");
|
|
52
940
|
return;
|
|
53
941
|
}
|
|
54
942
|
if (selected.length > 0) {
|
|
@@ -57,7 +945,7 @@ async function runSetup(projectRoot, catalog) {
|
|
|
57
945
|
} else {
|
|
58
946
|
const selected = await promptSelect(visibleFacet, existingChoices);
|
|
59
947
|
if (typeof selected === "symbol") {
|
|
60
|
-
|
|
948
|
+
Nt("Setup cancelled.");
|
|
61
949
|
return;
|
|
62
950
|
}
|
|
63
951
|
if (typeof selected === "string" && selected !== "__skip__") {
|
|
@@ -68,7 +956,7 @@ async function runSetup(projectRoot, catalog) {
|
|
|
68
956
|
const impliedDocsets = collectDocsets(choices, catalog);
|
|
69
957
|
let excludedDocsets;
|
|
70
958
|
if (impliedDocsets.length > 0) {
|
|
71
|
-
const selected = await
|
|
959
|
+
const selected = await Lt2({
|
|
72
960
|
message: "Documentation \u2014 deselect any you don't need",
|
|
73
961
|
options: impliedDocsets.map((d) => ({
|
|
74
962
|
value: d.id,
|
|
@@ -79,7 +967,7 @@ async function runSetup(projectRoot, catalog) {
|
|
|
79
967
|
required: false
|
|
80
968
|
});
|
|
81
969
|
if (typeof selected === "symbol") {
|
|
82
|
-
|
|
970
|
+
Nt("Setup cancelled.");
|
|
83
971
|
return;
|
|
84
972
|
}
|
|
85
973
|
const selectedSet = new Set(selected);
|
|
@@ -95,16 +983,16 @@ async function runSetup(projectRoot, catalog) {
|
|
|
95
983
|
hint: w.description
|
|
96
984
|
}));
|
|
97
985
|
const validExistingHarnesses = existingHarnesses?.filter(
|
|
98
|
-
(
|
|
986
|
+
(h2) => allHarnessWriters.some((w) => w.id === h2)
|
|
99
987
|
);
|
|
100
|
-
const selectedHarnesses = await
|
|
988
|
+
const selectedHarnesses = await Lt2({
|
|
101
989
|
message: "Harnesses \u2014 which coding agents should receive config?",
|
|
102
990
|
options: harnessOptions,
|
|
103
991
|
initialValues: validExistingHarnesses && validExistingHarnesses.length > 0 ? validExistingHarnesses : ["universal"],
|
|
104
992
|
required: false
|
|
105
993
|
});
|
|
106
994
|
if (typeof selectedHarnesses === "symbol") {
|
|
107
|
-
|
|
995
|
+
Nt("Setup cancelled.");
|
|
108
996
|
return;
|
|
109
997
|
}
|
|
110
998
|
const harnesses = selectedHarnesses;
|
|
@@ -132,7 +1020,7 @@ async function runSetup(projectRoot, catalog) {
|
|
|
132
1020
|
}
|
|
133
1021
|
const modifiedSkills = await writeInlineSkills(logicalConfig, projectRoot);
|
|
134
1022
|
if (modifiedSkills.length > 0) {
|
|
135
|
-
|
|
1023
|
+
R2.warn(
|
|
136
1024
|
`The following skills have been locally modified and will NOT be updated:
|
|
137
1025
|
` + modifiedSkills.map((s) => ` - ${s}`).join("\n") + `
|
|
138
1026
|
|
|
@@ -141,14 +1029,14 @@ To use the latest defaults, remove .ade/skills/ and re-run setup.`
|
|
|
141
1029
|
}
|
|
142
1030
|
await installSkills(logicalConfig.skills, projectRoot);
|
|
143
1031
|
if (logicalConfig.knowledge_sources.length > 0) {
|
|
144
|
-
|
|
1032
|
+
R2.info(
|
|
145
1033
|
"Knowledge sources selected. Initialize them separately:\n npx @codemcp/knowledge init"
|
|
146
1034
|
);
|
|
147
1035
|
}
|
|
148
1036
|
for (const note of logicalConfig.setup_notes) {
|
|
149
|
-
|
|
1037
|
+
R2.info(note);
|
|
150
1038
|
}
|
|
151
|
-
|
|
1039
|
+
Gt("Setup complete!");
|
|
152
1040
|
}
|
|
153
1041
|
function getValidInitialValue(facet, existingChoices) {
|
|
154
1042
|
const value = existingChoices[facet.id];
|
|
@@ -171,7 +1059,7 @@ function promptSelect(facet, existingChoices) {
|
|
|
171
1059
|
options.push({ value: "__skip__", label: "Skip", hint: "" });
|
|
172
1060
|
}
|
|
173
1061
|
const initialValue = getValidInitialValue(facet, existingChoices);
|
|
174
|
-
return
|
|
1062
|
+
return Jt({
|
|
175
1063
|
message: facet.label,
|
|
176
1064
|
options,
|
|
177
1065
|
...initialValue !== void 0 && { initialValue }
|
|
@@ -184,7 +1072,7 @@ function promptMultiSelect(facet, existingChoices) {
|
|
|
184
1072
|
hint: o.description
|
|
185
1073
|
}));
|
|
186
1074
|
const initialValues = getValidInitialValues(facet, existingChoices);
|
|
187
|
-
return
|
|
1075
|
+
return Lt2({
|
|
188
1076
|
message: facet.label,
|
|
189
1077
|
options,
|
|
190
1078
|
required: false,
|
|
@@ -193,7 +1081,6 @@ function promptMultiSelect(facet, existingChoices) {
|
|
|
193
1081
|
}
|
|
194
1082
|
|
|
195
1083
|
// src/commands/install.ts
|
|
196
|
-
import * as clack2 from "@clack/prompts";
|
|
197
1084
|
import { readLockFile } from "@codemcp/ade-core";
|
|
198
1085
|
import {
|
|
199
1086
|
getHarnessWriter as getHarnessWriter2,
|
|
@@ -202,7 +1089,7 @@ import {
|
|
|
202
1089
|
writeInlineSkills as writeInlineSkills2
|
|
203
1090
|
} from "@codemcp/ade-harnesses";
|
|
204
1091
|
async function runInstall(projectRoot, harnessIds) {
|
|
205
|
-
|
|
1092
|
+
Wt2("ade install");
|
|
206
1093
|
const lockFile = await readLockFile(projectRoot);
|
|
207
1094
|
if (!lockFile) {
|
|
208
1095
|
throw new Error("config.lock.yaml not found. Run `ade setup` first.");
|
|
@@ -225,7 +1112,7 @@ async function runInstall(projectRoot, harnessIds) {
|
|
|
225
1112
|
}
|
|
226
1113
|
const modifiedSkills = await writeInlineSkills2(logicalConfig, projectRoot);
|
|
227
1114
|
if (modifiedSkills.length > 0) {
|
|
228
|
-
|
|
1115
|
+
R2.warn(
|
|
229
1116
|
`The following skills have been locally modified and will NOT be updated:
|
|
230
1117
|
` + modifiedSkills.map((s) => ` - ${s}`).join("\n") + `
|
|
231
1118
|
|
|
@@ -234,11 +1121,11 @@ To use the latest defaults, remove .ade/skills/ and re-run install.`
|
|
|
234
1121
|
}
|
|
235
1122
|
await installSkills2(logicalConfig.skills, projectRoot);
|
|
236
1123
|
if (logicalConfig.knowledge_sources.length > 0) {
|
|
237
|
-
|
|
1124
|
+
R2.info(
|
|
238
1125
|
"Knowledge sources configured. Initialize them separately:\n npx @codemcp/knowledge init"
|
|
239
1126
|
);
|
|
240
1127
|
}
|
|
241
|
-
|
|
1128
|
+
Gt("Install complete!");
|
|
242
1129
|
}
|
|
243
1130
|
|
|
244
1131
|
// src/index.ts
|
|
@@ -206,16 +206,17 @@ describe("kiroWriter", () => {
|
|
|
206
206
|
|
|
207
207
|
expect(rigidAgent.tools).toContain("read");
|
|
208
208
|
expect(rigidAgent.tools).toContain("spec");
|
|
209
|
+
expect(rigidAgent.tools).toContain("shell");
|
|
209
210
|
expect(rigidAgent.tools).toContain("@workflows/*");
|
|
210
211
|
expect(rigidAgent.allowedTools).toContain("@workflows/*");
|
|
211
212
|
expect(rigidAgent.mcpServers.workflows.autoApprove).toEqual(["*"]);
|
|
212
213
|
expect(rigidAgent.tools).not.toContain("write");
|
|
213
|
-
expect(rigidAgent.tools).not.toContain("shell");
|
|
214
|
+
expect(rigidAgent.tools).not.toContain("shell(*)");
|
|
214
215
|
expect(rigidAgent.tools).not.toContain("web");
|
|
215
216
|
|
|
216
217
|
expect(maxAgent.tools).toContain("read");
|
|
217
218
|
expect(maxAgent.tools).toContain("write");
|
|
218
|
-
expect(maxAgent.tools).toContain("shell");
|
|
219
|
+
expect(maxAgent.tools).toContain("shell(*)");
|
|
219
220
|
expect(maxAgent.tools).toContain("spec");
|
|
220
221
|
expect(maxAgent.tools).toContain("@workflows/*");
|
|
221
222
|
expect(maxAgent.allowedTools).toContain("@workflows/*");
|
|
@@ -53,7 +53,7 @@ function getKiroTools(config: LogicalConfig): string[] {
|
|
|
53
53
|
return [
|
|
54
54
|
...(getCapabilityDecision(config, "read") !== "deny" ? ["read"] : []),
|
|
55
55
|
...(allowsCapability(config, "edit_write") ? ["write"] : []),
|
|
56
|
-
...(allowsCapability(config, "bash_unsafe") ? ["shell"] : []),
|
|
56
|
+
...(allowsCapability(config, "bash_unsafe") ? ["shell(*)"] : ["shell"]),
|
|
57
57
|
"spec",
|
|
58
58
|
...mcpTools
|
|
59
59
|
];
|
package/rebuild_cli.sh
ADDED