harnesstap 1.2.0 → 1.3.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 +28 -15
- package/dist/apply-2GRNKR5H.js +67 -0
- package/dist/apply-2GRNKR5H.js.map +1 -0
- package/dist/approve-KQNCNH2R.js +181 -0
- package/dist/approve-KQNCNH2R.js.map +1 -0
- package/dist/audit-SLYOZCMI.js +434 -0
- package/dist/audit-SLYOZCMI.js.map +1 -0
- package/dist/auth-3IEVICFT.js +220 -0
- package/dist/auth-3IEVICFT.js.map +1 -0
- package/dist/bin.js +166 -0
- package/dist/bin.js.map +1 -0
- package/dist/chunk-2EIJYDNI.js +10945 -0
- package/dist/chunk-2EIJYDNI.js.map +1 -0
- package/dist/chunk-2H7UOFLK.js +11 -0
- package/dist/chunk-2H7UOFLK.js.map +1 -0
- package/dist/chunk-37E5M4JX.js +34 -0
- package/dist/chunk-37E5M4JX.js.map +1 -0
- package/dist/chunk-3FIWOI3H.js +98 -0
- package/dist/chunk-3FIWOI3H.js.map +1 -0
- package/dist/chunk-3IWTJCPA.js +6448 -0
- package/dist/chunk-3IWTJCPA.js.map +1 -0
- package/dist/chunk-3IZ7SEGT.js +346 -0
- package/dist/chunk-3IZ7SEGT.js.map +1 -0
- package/dist/chunk-3RBYT7QN.js +540 -0
- package/dist/chunk-3RBYT7QN.js.map +1 -0
- package/dist/chunk-4KNQZDZC.js +115 -0
- package/dist/chunk-4KNQZDZC.js.map +1 -0
- package/dist/chunk-5F3LNDZG.js +9 -0
- package/dist/chunk-5F3LNDZG.js.map +1 -0
- package/dist/chunk-63U7QWNY.js +364 -0
- package/dist/chunk-63U7QWNY.js.map +1 -0
- package/dist/chunk-6BY4BV5G.js +998 -0
- package/dist/chunk-6BY4BV5G.js.map +1 -0
- package/dist/chunk-7L2K4N25.js +610 -0
- package/dist/chunk-7L2K4N25.js.map +1 -0
- package/dist/chunk-7LWH5SWH.js +18 -0
- package/dist/chunk-7LWH5SWH.js.map +1 -0
- package/dist/chunk-BIBUCC2E.js +696 -0
- package/dist/chunk-BIBUCC2E.js.map +1 -0
- package/dist/chunk-BSOBXLYI.js +172 -0
- package/dist/chunk-BSOBXLYI.js.map +1 -0
- package/dist/chunk-C4QBVVEH.js +32 -0
- package/dist/chunk-C4QBVVEH.js.map +1 -0
- package/dist/chunk-CHQGE2HF.js +283 -0
- package/dist/chunk-CHQGE2HF.js.map +1 -0
- package/dist/chunk-DV74UZJI.js +87 -0
- package/dist/chunk-DV74UZJI.js.map +1 -0
- package/dist/chunk-DWVAR4BP.js +656 -0
- package/dist/chunk-DWVAR4BP.js.map +1 -0
- package/dist/chunk-DXKAKKLP.js +302 -0
- package/dist/chunk-DXKAKKLP.js.map +1 -0
- package/dist/chunk-EIWXS4RM.js +235 -0
- package/dist/chunk-EIWXS4RM.js.map +1 -0
- package/dist/chunk-EWBCFAF3.js +681 -0
- package/dist/chunk-EWBCFAF3.js.map +1 -0
- package/dist/chunk-F2L4VNQK.js +1759 -0
- package/dist/chunk-F2L4VNQK.js.map +1 -0
- package/dist/chunk-G26HZZDJ.js +1359 -0
- package/dist/chunk-G26HZZDJ.js.map +1 -0
- package/dist/chunk-GQKKX7OE.js +818 -0
- package/dist/chunk-GQKKX7OE.js.map +1 -0
- package/dist/chunk-GRJY22U6.js +691 -0
- package/dist/chunk-GRJY22U6.js.map +1 -0
- package/dist/chunk-H6DVP2SI.js +682 -0
- package/dist/chunk-H6DVP2SI.js.map +1 -0
- package/dist/chunk-HVVPTCKR.js +1173 -0
- package/dist/chunk-HVVPTCKR.js.map +1 -0
- package/dist/chunk-I6XFZLTJ.js +9 -0
- package/dist/chunk-I6XFZLTJ.js.map +1 -0
- package/dist/chunk-IBOABSIA.js +17 -0
- package/dist/chunk-IBOABSIA.js.map +1 -0
- package/dist/chunk-IK524ZDW.js +691 -0
- package/dist/chunk-IK524ZDW.js.map +1 -0
- package/dist/chunk-IRU7NBOT.js +141 -0
- package/dist/chunk-IRU7NBOT.js.map +1 -0
- package/dist/chunk-J4CKQXQ6.js +806 -0
- package/dist/chunk-J4CKQXQ6.js.map +1 -0
- package/dist/chunk-JKGSJGCC.js +311 -0
- package/dist/chunk-JKGSJGCC.js.map +1 -0
- package/dist/chunk-JQOKQKQT.js +158 -0
- package/dist/chunk-JQOKQKQT.js.map +1 -0
- package/dist/chunk-JRFUTIEH.js +426 -0
- package/dist/chunk-JRFUTIEH.js.map +1 -0
- package/dist/chunk-K2BPYEH5.js +491 -0
- package/dist/chunk-K2BPYEH5.js.map +1 -0
- package/dist/chunk-KCQC7YBK.js +7795 -0
- package/dist/chunk-KCQC7YBK.js.map +1 -0
- package/dist/chunk-KDAV2GUT.js +1357 -0
- package/dist/chunk-KDAV2GUT.js.map +1 -0
- package/dist/chunk-KDDXZBMC.js +583 -0
- package/dist/chunk-KDDXZBMC.js.map +1 -0
- package/dist/chunk-KMWHZSEG.js +41 -0
- package/dist/chunk-KMWHZSEG.js.map +1 -0
- package/dist/chunk-KRI4R7EM.js +25 -0
- package/dist/chunk-KRI4R7EM.js.map +1 -0
- package/dist/chunk-LNJ3WZZX.js +186 -0
- package/dist/chunk-LNJ3WZZX.js.map +1 -0
- package/dist/chunk-MWXA4PFE.js +103 -0
- package/dist/chunk-MWXA4PFE.js.map +1 -0
- package/dist/chunk-MY62SSKC.js +183 -0
- package/dist/chunk-MY62SSKC.js.map +1 -0
- package/dist/chunk-NAGAJ5UM.js +145 -0
- package/dist/chunk-NAGAJ5UM.js.map +1 -0
- package/dist/chunk-NJ7WRKIQ.js +532 -0
- package/dist/chunk-NJ7WRKIQ.js.map +1 -0
- package/dist/chunk-OS6NUIBJ.js +38 -0
- package/dist/chunk-OS6NUIBJ.js.map +1 -0
- package/dist/chunk-PXU2OS26.js +238 -0
- package/dist/chunk-PXU2OS26.js.map +1 -0
- package/dist/chunk-QO4LBDVI.js +496 -0
- package/dist/chunk-QO4LBDVI.js.map +1 -0
- package/dist/chunk-QRZPQNLX.js +65 -0
- package/dist/chunk-QRZPQNLX.js.map +1 -0
- package/dist/chunk-SNVAMWB7.js +40 -0
- package/dist/chunk-SNVAMWB7.js.map +1 -0
- package/dist/chunk-SPRVUATR.js +430 -0
- package/dist/chunk-SPRVUATR.js.map +1 -0
- package/dist/chunk-SY7G5QEI.js +35 -0
- package/dist/chunk-SY7G5QEI.js.map +1 -0
- package/dist/chunk-SZNBUIDR.js +6438 -0
- package/dist/chunk-SZNBUIDR.js.map +1 -0
- package/dist/chunk-TQ2NA4Z4.js +24 -0
- package/dist/chunk-TQ2NA4Z4.js.map +1 -0
- package/dist/chunk-TYULB6ZY.js +2959 -0
- package/dist/chunk-TYULB6ZY.js.map +1 -0
- package/dist/chunk-UJYFTXHV.js +296 -0
- package/dist/chunk-UJYFTXHV.js.map +1 -0
- package/dist/chunk-VC6OKCJF.js +184 -0
- package/dist/chunk-VC6OKCJF.js.map +1 -0
- package/dist/chunk-VL2NWCZV.js +118 -0
- package/dist/chunk-VL2NWCZV.js.map +1 -0
- package/dist/chunk-VL7BGD47.js +514 -0
- package/dist/chunk-VL7BGD47.js.map +1 -0
- package/dist/chunk-VQVUJYYY.js +244 -0
- package/dist/chunk-VQVUJYYY.js.map +1 -0
- package/dist/chunk-VZQG2JDV.js +9 -0
- package/dist/chunk-VZQG2JDV.js.map +1 -0
- package/dist/chunk-XFZQVYIN.js +115 -0
- package/dist/chunk-XFZQVYIN.js.map +1 -0
- package/dist/chunk-XGTTOO4R.js +84 -0
- package/dist/chunk-XGTTOO4R.js.map +1 -0
- package/dist/chunk-XQFT4PEP.js +60 -0
- package/dist/chunk-XQFT4PEP.js.map +1 -0
- package/dist/chunk-YDD3ES2K.js +571 -0
- package/dist/chunk-YDD3ES2K.js.map +1 -0
- package/dist/chunk-ZY2MZ2KQ.js +1140 -0
- package/dist/chunk-ZY2MZ2KQ.js.map +1 -0
- package/dist/compile-57EEIUMB.js +161 -0
- package/dist/compile-57EEIUMB.js.map +1 -0
- package/dist/config-4EJ3D7QJ.js +438 -0
- package/dist/config-4EJ3D7QJ.js.map +1 -0
- package/dist/doctor-EEV6P5CH.js +111 -0
- package/dist/doctor-EEV6P5CH.js.map +1 -0
- package/dist/environment-WFEG4DAT.js +2745 -0
- package/dist/environment-WFEG4DAT.js.map +1 -0
- package/dist/github-BSMQD72A.js +114 -0
- package/dist/github-BSMQD72A.js.map +1 -0
- package/dist/harness-VX3PNVQW.js +746 -0
- package/dist/harness-VX3PNVQW.js.map +1 -0
- package/dist/help-AW2HKX63.js +2079 -0
- package/dist/help-AW2HKX63.js.map +1 -0
- package/dist/help-BVFOZD7E.js +1892 -0
- package/dist/help-BVFOZD7E.js.map +1 -0
- package/dist/index.d.ts +164 -1
- package/dist/index.js +50 -59246
- package/dist/index.js.map +1 -1
- package/dist/init-SPN2GEZ4.js +873 -0
- package/dist/init-SPN2GEZ4.js.map +1 -0
- package/dist/lock-K2LLUU7H.js +455 -0
- package/dist/lock-K2LLUU7H.js.map +1 -0
- package/dist/marketplace-VEKSWGX3.js +495 -0
- package/dist/marketplace-VEKSWGX3.js.map +1 -0
- package/dist/mcp-T6DKIKSF.js +202 -0
- package/dist/mcp-T6DKIKSF.js.map +1 -0
- package/dist/migrate-OO37WSB2.js +1043 -0
- package/dist/migrate-OO37WSB2.js.map +1 -0
- package/dist/open-3V3QK5RK.js +32 -0
- package/dist/open-3V3QK5RK.js.map +1 -0
- package/dist/pack-V32UPC7W.js +99 -0
- package/dist/pack-V32UPC7W.js.map +1 -0
- package/dist/plugin-KOBNQ7GT.js +64 -0
- package/dist/plugin-KOBNQ7GT.js.map +1 -0
- package/dist/plugin-from-project-X3VO3MB6.js +16 -0
- package/dist/plugin-from-project-X3VO3MB6.js.map +1 -0
- package/dist/policy-F5MKZNOC.js +105 -0
- package/dist/policy-F5MKZNOC.js.map +1 -0
- package/dist/profile-H4PMH4XT.js +1886 -0
- package/dist/profile-H4PMH4XT.js.map +1 -0
- package/dist/project-QVNEJJGH.js +1392 -0
- package/dist/project-QVNEJJGH.js.map +1 -0
- package/dist/resource-GL4RLSGI.js +555 -0
- package/dist/resource-GL4RLSGI.js.map +1 -0
- package/dist/version-PBHZK44K.js +17 -0
- package/dist/version-PBHZK44K.js.map +1 -0
- package/package.json +21 -14
- package/schemas/ap-package.v1.json +36 -0
- package/schemas/fixtures/catalog-missing-schema.ap.json +13 -0
- package/schemas/fixtures/confidence.ap.json +13 -0
- package/schemas/fixtures/context7.ap.json +13 -0
- package/schemas/fixtures/minimal-with-schema.ap.json +13 -0
- package/schemas/fixtures/superpowers.ap.json +13 -0
- package/schemas/fixtures/third-party-skills.ap.json +13 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
__export
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=chunk-2H7UOFLK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/cli/handlers/parse-flags.ts
|
|
2
|
+
function parseHarnessAliases(aliases) {
|
|
3
|
+
return aliases?.split(",").map((value) => value.trim()).filter(Boolean);
|
|
4
|
+
}
|
|
5
|
+
function parseHarnessList(value) {
|
|
6
|
+
return parseHarnessAliases(value);
|
|
7
|
+
}
|
|
8
|
+
function parseCommaSeparatedList(value) {
|
|
9
|
+
if (!value) return void 0;
|
|
10
|
+
const items = value.split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
11
|
+
return items.length > 0 ? items : void 0;
|
|
12
|
+
}
|
|
13
|
+
function resolveAddScope(opts) {
|
|
14
|
+
if (opts.global && opts.project !== void 0) {
|
|
15
|
+
throw new Error("Pass only one of --global or --project.");
|
|
16
|
+
}
|
|
17
|
+
if (opts.global) {
|
|
18
|
+
return { scope: "global" };
|
|
19
|
+
}
|
|
20
|
+
if (opts.project !== void 0) {
|
|
21
|
+
return {
|
|
22
|
+
scope: "project",
|
|
23
|
+
projectRoot: typeof opts.project === "string" ? opts.project : "."
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return void 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
parseHarnessList,
|
|
31
|
+
parseCommaSeparatedList,
|
|
32
|
+
resolveAddScope
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=chunk-37E5M4JX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/handlers/parse-flags.ts"],"sourcesContent":["export function parseHarnessAliases(aliases?: string): string[] | undefined {\n return aliases\n ?.split(\",\")\n .map((value) => value.trim())\n .filter(Boolean);\n}\n\nexport function parseHarnessList(value?: string): string[] | undefined {\n return parseHarnessAliases(value);\n}\n\nexport function parseCommaSeparatedList(value: string | undefined): string[] | undefined {\n if (!value) return undefined;\n const items = value.split(\",\").map((entry) => entry.trim()).filter(Boolean);\n return items.length > 0 ? items : undefined;\n}\n\nexport function resolveAddScope(opts: {\n global?: boolean;\n project?: boolean | string;\n}): { scope: \"global\" | \"project\"; projectRoot?: string } | undefined {\n if (opts.global && opts.project !== undefined) {\n throw new Error(\"Pass only one of --global or --project.\");\n }\n if (opts.global) {\n return { scope: \"global\" };\n }\n if (opts.project !== undefined) {\n return {\n scope: \"project\",\n projectRoot: typeof opts.project === \"string\" ? opts.project : \".\",\n };\n }\n return undefined;\n}\n"],"mappings":";AAAO,SAAS,oBAAoB,SAAwC;AAC1E,SAAO,SACH,MAAM,GAAG,EACV,IAAI,CAAC,UAAU,MAAM,KAAK,CAAC,EAC3B,OAAO,OAAO;AACnB;AAEO,SAAS,iBAAiB,OAAsC;AACrE,SAAO,oBAAoB,KAAK;AAClC;AAEO,SAAS,wBAAwB,OAAiD;AACvF,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,QAAQ,MAAM,MAAM,GAAG,EAAE,IAAI,CAAC,UAAU,MAAM,KAAK,CAAC,EAAE,OAAO,OAAO;AAC1E,SAAO,MAAM,SAAS,IAAI,QAAQ;AACpC;AAEO,SAAS,gBAAgB,MAGsC;AACpE,MAAI,KAAK,UAAU,KAAK,YAAY,QAAW;AAC7C,UAAM,IAAI,MAAM,yCAAyC;AAAA,EAC3D;AACA,MAAI,KAAK,QAAQ;AACf,WAAO,EAAE,OAAO,SAAS;AAAA,EAC3B;AACA,MAAI,KAAK,YAAY,QAAW;AAC9B,WAAO;AAAA,MACL,OAAO;AAAA,MACP,aAAa,OAAO,KAAK,YAAY,WAAW,KAAK,UAAU;AAAA,IACjE;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// src/services/wizards/prompts/primitives.ts
|
|
2
|
+
function isEscapeKey(key) {
|
|
3
|
+
return key.name === "escape" || key.sequence === "\x1B";
|
|
4
|
+
}
|
|
5
|
+
function isLetterKey(key, letter) {
|
|
6
|
+
return !key.ctrl && !key.meta && key.name === letter;
|
|
7
|
+
}
|
|
8
|
+
function toInquirerKey(key) {
|
|
9
|
+
return {
|
|
10
|
+
name: key.name ?? "",
|
|
11
|
+
sequence: key.sequence ?? "",
|
|
12
|
+
ctrl: key.ctrl ?? false,
|
|
13
|
+
meta: key.meta ?? false,
|
|
14
|
+
shift: key.shift ?? false
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function isSearchCharacter(key) {
|
|
18
|
+
return Boolean(
|
|
19
|
+
key.sequence && key.sequence.length === 1 && key.sequence.trim().length > 0 && !key.ctrl && !key.meta
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
function clampActiveIndex(active, length) {
|
|
23
|
+
if (length === 0) {
|
|
24
|
+
return 0;
|
|
25
|
+
}
|
|
26
|
+
return Math.max(0, Math.min(active, length - 1));
|
|
27
|
+
}
|
|
28
|
+
var interactivePromptTheme = {
|
|
29
|
+
helpMode: "always",
|
|
30
|
+
style: {
|
|
31
|
+
keysHelpTip: (keys) => keys.map(([key, action]) => `${key} ${action}`).join(" \u2022 ")
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
function buildHelpLine(keys) {
|
|
35
|
+
return interactivePromptTheme.style.keysHelpTip(keys);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// src/services/wizards/prompts/hooks/use-list-navigation.ts
|
|
39
|
+
import { isDownKey, isUpKey } from "@inquirer/core";
|
|
40
|
+
function moveActiveIndex(active, direction, length, loop = false) {
|
|
41
|
+
if (length === 0) {
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
if (loop) {
|
|
45
|
+
return (active + direction + length) % length;
|
|
46
|
+
}
|
|
47
|
+
return clampActiveIndex(active + direction, length);
|
|
48
|
+
}
|
|
49
|
+
function handleNavigationKeypress(params) {
|
|
50
|
+
const { clampedActive, length, setActive, key, loop = false } = params;
|
|
51
|
+
const inquirerKey = toInquirerKey(key);
|
|
52
|
+
if (length === 0 || !isUpKey(inquirerKey) && !isDownKey(inquirerKey)) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
const direction = isUpKey(inquirerKey) ? -1 : 1;
|
|
56
|
+
setActive(moveActiveIndex(clampedActive, direction, length, loop));
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// src/services/wizards/prompts/hooks/use-local-query-filter.ts
|
|
61
|
+
import { isBackspaceKey } from "@inquirer/core";
|
|
62
|
+
function appendToQuery(query, char) {
|
|
63
|
+
return query + char;
|
|
64
|
+
}
|
|
65
|
+
function backspaceQuery(query) {
|
|
66
|
+
return query.slice(0, -1);
|
|
67
|
+
}
|
|
68
|
+
function handleSearchKeypress(params) {
|
|
69
|
+
const { query, setQuery, setActive, key, onQueryChange } = params;
|
|
70
|
+
const inquirerKey = toInquirerKey(key);
|
|
71
|
+
if (isBackspaceKey(inquirerKey)) {
|
|
72
|
+
const nextQuery = backspaceQuery(query);
|
|
73
|
+
setQuery(nextQuery);
|
|
74
|
+
setActive(0);
|
|
75
|
+
onQueryChange?.(nextQuery);
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
if (isSearchCharacter(key)) {
|
|
79
|
+
const nextQuery = appendToQuery(query, key.sequence);
|
|
80
|
+
setQuery(nextQuery);
|
|
81
|
+
setActive(0);
|
|
82
|
+
onQueryChange?.(nextQuery);
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
isEscapeKey,
|
|
90
|
+
isLetterKey,
|
|
91
|
+
isSearchCharacter,
|
|
92
|
+
clampActiveIndex,
|
|
93
|
+
interactivePromptTheme,
|
|
94
|
+
buildHelpLine,
|
|
95
|
+
handleNavigationKeypress,
|
|
96
|
+
handleSearchKeypress
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=chunk-3FIWOI3H.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/services/wizards/prompts/primitives.ts","../src/services/wizards/prompts/hooks/use-list-navigation.ts","../src/services/wizards/prompts/hooks/use-local-query-filter.ts"],"sourcesContent":["export function isEscapeKey(key: { name?: string; sequence?: string }): boolean {\n return key.name === \"escape\" || key.sequence === \"\\u001b\";\n}\n\nexport function isLetterKey(key: InteractiveKeypress, letter: string): boolean {\n return !key.ctrl && !key.meta && key.name === letter;\n}\n\n/** Key shape from @inquirer/core useKeypress, shared by prompt helpers. */\nexport type InteractiveKeypress = {\n name?: string;\n sequence?: string;\n ctrl?: boolean;\n meta?: boolean;\n shift?: boolean;\n};\n\n/** Widen partial key events for @inquirer/core key guards. */\nexport function toInquirerKey(key: InteractiveKeypress) {\n return {\n name: key.name ?? \"\",\n sequence: key.sequence ?? \"\",\n ctrl: key.ctrl ?? false,\n meta: key.meta ?? false,\n shift: key.shift ?? false,\n };\n}\n\nexport function isSearchCharacter(key: InteractiveKeypress): key is InteractiveKeypress & { sequence: string } {\n return Boolean(\n key.sequence\n && key.sequence.length === 1\n && key.sequence.trim().length > 0\n && !key.ctrl\n && !key.meta,\n );\n}\n\nexport function clampActiveIndex(active: number, length: number): number {\n if (length === 0) {\n return 0;\n }\n return Math.max(0, Math.min(active, length - 1));\n}\n\nexport const interactivePromptTheme = {\n helpMode: \"always\" as const,\n style: {\n keysHelpTip: (keys: Array<[string, string]>) =>\n keys.map(([key, action]) => `${key} ${action}`).join(\" • \"),\n },\n};\n\nexport function buildHelpLine(keys: Array<[string, string]>): string {\n return interactivePromptTheme.style.keysHelpTip(keys);\n}\n","import { isDownKey, isUpKey } from \"@inquirer/core\";\nimport { clampActiveIndex, toInquirerKey, type InteractiveKeypress } from \"../primitives.js\";\n\nexport function moveActiveIndex(\n active: number,\n direction: -1 | 1,\n length: number,\n loop = false,\n): number {\n if (length === 0) {\n return 0;\n }\n\n if (loop) {\n return (active + direction + length) % length;\n }\n\n return clampActiveIndex(active + direction, length);\n}\n\nexport type NavigationKeypressParams = {\n clampedActive: number;\n length: number;\n setActive: (active: number) => void;\n key: InteractiveKeypress;\n loop?: boolean;\n};\n\nexport function handleNavigationKeypress(params: NavigationKeypressParams): boolean {\n const { clampedActive, length, setActive, key, loop = false } = params;\n const inquirerKey = toInquirerKey(key);\n\n if (length === 0 || (!isUpKey(inquirerKey) && !isDownKey(inquirerKey))) {\n return false;\n }\n\n const direction = isUpKey(inquirerKey) ? -1 : 1;\n setActive(moveActiveIndex(clampedActive, direction, length, loop));\n return true;\n}\n","import { isBackspaceKey } from \"@inquirer/core\";\nimport { isSearchCharacter, toInquirerKey, type InteractiveKeypress } from \"../primitives.js\";\n\nexport function appendToQuery(query: string, char: string): string {\n return query + char;\n}\n\nexport function backspaceQuery(query: string): string {\n return query.slice(0, -1);\n}\n\nexport function createQueryFilterState(initialQuery = \"\") {\n return {\n query: initialQuery,\n appendChar(query: string, char: string) {\n return { query: appendToQuery(query, char), activeReset: 0 as const };\n },\n backspace(query: string) {\n return { query: backspaceQuery(query), activeReset: 0 as const };\n },\n };\n}\n\nexport type SearchKeypressParams = {\n query: string;\n setQuery: (query: string) => void;\n setActive: (active: number) => void;\n key: InteractiveKeypress;\n onQueryChange?: (nextQuery: string) => void;\n};\n\nexport function handleSearchKeypress(params: SearchKeypressParams): boolean {\n const { query, setQuery, setActive, key, onQueryChange } = params;\n const inquirerKey = toInquirerKey(key);\n\n if (isBackspaceKey(inquirerKey)) {\n const nextQuery = backspaceQuery(query);\n setQuery(nextQuery);\n setActive(0);\n onQueryChange?.(nextQuery);\n return true;\n }\n\n if (isSearchCharacter(key)) {\n const nextQuery = appendToQuery(query, key.sequence);\n setQuery(nextQuery);\n setActive(0);\n onQueryChange?.(nextQuery);\n return true;\n }\n\n return false;\n}\n"],"mappings":";AAAO,SAAS,YAAY,KAAoD;AAC9E,SAAO,IAAI,SAAS,YAAY,IAAI,aAAa;AACnD;AAEO,SAAS,YAAY,KAA0B,QAAyB;AAC7E,SAAO,CAAC,IAAI,QAAQ,CAAC,IAAI,QAAQ,IAAI,SAAS;AAChD;AAYO,SAAS,cAAc,KAA0B;AACtD,SAAO;AAAA,IACL,MAAM,IAAI,QAAQ;AAAA,IAClB,UAAU,IAAI,YAAY;AAAA,IAC1B,MAAM,IAAI,QAAQ;AAAA,IAClB,MAAM,IAAI,QAAQ;AAAA,IAClB,OAAO,IAAI,SAAS;AAAA,EACtB;AACF;AAEO,SAAS,kBAAkB,KAA6E;AAC7G,SAAO;AAAA,IACL,IAAI,YACC,IAAI,SAAS,WAAW,KACxB,IAAI,SAAS,KAAK,EAAE,SAAS,KAC7B,CAAC,IAAI,QACL,CAAC,IAAI;AAAA,EACZ;AACF;AAEO,SAAS,iBAAiB,QAAgB,QAAwB;AACvE,MAAI,WAAW,GAAG;AAChB,WAAO;AAAA,EACT;AACA,SAAO,KAAK,IAAI,GAAG,KAAK,IAAI,QAAQ,SAAS,CAAC,CAAC;AACjD;AAEO,IAAM,yBAAyB;AAAA,EACpC,UAAU;AAAA,EACV,OAAO;AAAA,IACL,aAAa,CAAC,SACZ,KAAK,IAAI,CAAC,CAAC,KAAK,MAAM,MAAM,GAAG,GAAG,IAAI,MAAM,EAAE,EAAE,KAAK,UAAK;AAAA,EAC9D;AACF;AAEO,SAAS,cAAc,MAAuC;AACnE,SAAO,uBAAuB,MAAM,YAAY,IAAI;AACtD;;;ACvDA,SAAS,WAAW,eAAe;AAG5B,SAAS,gBACd,QACA,WACA,QACA,OAAO,OACC;AACR,MAAI,WAAW,GAAG;AAChB,WAAO;AAAA,EACT;AAEA,MAAI,MAAM;AACR,YAAQ,SAAS,YAAY,UAAU;AAAA,EACzC;AAEA,SAAO,iBAAiB,SAAS,WAAW,MAAM;AACpD;AAUO,SAAS,yBAAyB,QAA2C;AAClF,QAAM,EAAE,eAAe,QAAQ,WAAW,KAAK,OAAO,MAAM,IAAI;AAChE,QAAM,cAAc,cAAc,GAAG;AAErC,MAAI,WAAW,KAAM,CAAC,QAAQ,WAAW,KAAK,CAAC,UAAU,WAAW,GAAI;AACtE,WAAO;AAAA,EACT;AAEA,QAAM,YAAY,QAAQ,WAAW,IAAI,KAAK;AAC9C,YAAU,gBAAgB,eAAe,WAAW,QAAQ,IAAI,CAAC;AACjE,SAAO;AACT;;;ACvCA,SAAS,sBAAsB;AAGxB,SAAS,cAAc,OAAe,MAAsB;AACjE,SAAO,QAAQ;AACjB;AAEO,SAAS,eAAe,OAAuB;AACpD,SAAO,MAAM,MAAM,GAAG,EAAE;AAC1B;AAsBO,SAAS,qBAAqB,QAAuC;AAC1E,QAAM,EAAE,OAAO,UAAU,WAAW,KAAK,cAAc,IAAI;AAC3D,QAAM,cAAc,cAAc,GAAG;AAErC,MAAI,eAAe,WAAW,GAAG;AAC/B,UAAM,YAAY,eAAe,KAAK;AACtC,aAAS,SAAS;AAClB,cAAU,CAAC;AACX,oBAAgB,SAAS;AACzB,WAAO;AAAA,EACT;AAEA,MAAI,kBAAkB,GAAG,GAAG;AAC1B,UAAM,YAAY,cAAc,OAAO,IAAI,QAAQ;AACnD,aAAS,SAAS;AAClB,cAAU,CAAC;AACX,oBAAgB,SAAS;AACzB,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
|