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.
Files changed (202) hide show
  1. package/README.md +28 -15
  2. package/dist/apply-2GRNKR5H.js +67 -0
  3. package/dist/apply-2GRNKR5H.js.map +1 -0
  4. package/dist/approve-KQNCNH2R.js +181 -0
  5. package/dist/approve-KQNCNH2R.js.map +1 -0
  6. package/dist/audit-SLYOZCMI.js +434 -0
  7. package/dist/audit-SLYOZCMI.js.map +1 -0
  8. package/dist/auth-3IEVICFT.js +220 -0
  9. package/dist/auth-3IEVICFT.js.map +1 -0
  10. package/dist/bin.js +166 -0
  11. package/dist/bin.js.map +1 -0
  12. package/dist/chunk-2EIJYDNI.js +10945 -0
  13. package/dist/chunk-2EIJYDNI.js.map +1 -0
  14. package/dist/chunk-2H7UOFLK.js +11 -0
  15. package/dist/chunk-2H7UOFLK.js.map +1 -0
  16. package/dist/chunk-37E5M4JX.js +34 -0
  17. package/dist/chunk-37E5M4JX.js.map +1 -0
  18. package/dist/chunk-3FIWOI3H.js +98 -0
  19. package/dist/chunk-3FIWOI3H.js.map +1 -0
  20. package/dist/chunk-3IWTJCPA.js +6448 -0
  21. package/dist/chunk-3IWTJCPA.js.map +1 -0
  22. package/dist/chunk-3IZ7SEGT.js +346 -0
  23. package/dist/chunk-3IZ7SEGT.js.map +1 -0
  24. package/dist/chunk-3RBYT7QN.js +540 -0
  25. package/dist/chunk-3RBYT7QN.js.map +1 -0
  26. package/dist/chunk-4KNQZDZC.js +115 -0
  27. package/dist/chunk-4KNQZDZC.js.map +1 -0
  28. package/dist/chunk-5F3LNDZG.js +9 -0
  29. package/dist/chunk-5F3LNDZG.js.map +1 -0
  30. package/dist/chunk-63U7QWNY.js +364 -0
  31. package/dist/chunk-63U7QWNY.js.map +1 -0
  32. package/dist/chunk-6BY4BV5G.js +998 -0
  33. package/dist/chunk-6BY4BV5G.js.map +1 -0
  34. package/dist/chunk-7L2K4N25.js +610 -0
  35. package/dist/chunk-7L2K4N25.js.map +1 -0
  36. package/dist/chunk-7LWH5SWH.js +18 -0
  37. package/dist/chunk-7LWH5SWH.js.map +1 -0
  38. package/dist/chunk-BIBUCC2E.js +696 -0
  39. package/dist/chunk-BIBUCC2E.js.map +1 -0
  40. package/dist/chunk-BSOBXLYI.js +172 -0
  41. package/dist/chunk-BSOBXLYI.js.map +1 -0
  42. package/dist/chunk-C4QBVVEH.js +32 -0
  43. package/dist/chunk-C4QBVVEH.js.map +1 -0
  44. package/dist/chunk-CHQGE2HF.js +283 -0
  45. package/dist/chunk-CHQGE2HF.js.map +1 -0
  46. package/dist/chunk-DV74UZJI.js +87 -0
  47. package/dist/chunk-DV74UZJI.js.map +1 -0
  48. package/dist/chunk-DWVAR4BP.js +656 -0
  49. package/dist/chunk-DWVAR4BP.js.map +1 -0
  50. package/dist/chunk-DXKAKKLP.js +302 -0
  51. package/dist/chunk-DXKAKKLP.js.map +1 -0
  52. package/dist/chunk-EIWXS4RM.js +235 -0
  53. package/dist/chunk-EIWXS4RM.js.map +1 -0
  54. package/dist/chunk-EWBCFAF3.js +681 -0
  55. package/dist/chunk-EWBCFAF3.js.map +1 -0
  56. package/dist/chunk-F2L4VNQK.js +1759 -0
  57. package/dist/chunk-F2L4VNQK.js.map +1 -0
  58. package/dist/chunk-G26HZZDJ.js +1359 -0
  59. package/dist/chunk-G26HZZDJ.js.map +1 -0
  60. package/dist/chunk-GQKKX7OE.js +818 -0
  61. package/dist/chunk-GQKKX7OE.js.map +1 -0
  62. package/dist/chunk-GRJY22U6.js +691 -0
  63. package/dist/chunk-GRJY22U6.js.map +1 -0
  64. package/dist/chunk-H6DVP2SI.js +682 -0
  65. package/dist/chunk-H6DVP2SI.js.map +1 -0
  66. package/dist/chunk-HVVPTCKR.js +1173 -0
  67. package/dist/chunk-HVVPTCKR.js.map +1 -0
  68. package/dist/chunk-I6XFZLTJ.js +9 -0
  69. package/dist/chunk-I6XFZLTJ.js.map +1 -0
  70. package/dist/chunk-IBOABSIA.js +17 -0
  71. package/dist/chunk-IBOABSIA.js.map +1 -0
  72. package/dist/chunk-IK524ZDW.js +691 -0
  73. package/dist/chunk-IK524ZDW.js.map +1 -0
  74. package/dist/chunk-IRU7NBOT.js +141 -0
  75. package/dist/chunk-IRU7NBOT.js.map +1 -0
  76. package/dist/chunk-J4CKQXQ6.js +806 -0
  77. package/dist/chunk-J4CKQXQ6.js.map +1 -0
  78. package/dist/chunk-JKGSJGCC.js +311 -0
  79. package/dist/chunk-JKGSJGCC.js.map +1 -0
  80. package/dist/chunk-JQOKQKQT.js +158 -0
  81. package/dist/chunk-JQOKQKQT.js.map +1 -0
  82. package/dist/chunk-JRFUTIEH.js +426 -0
  83. package/dist/chunk-JRFUTIEH.js.map +1 -0
  84. package/dist/chunk-K2BPYEH5.js +491 -0
  85. package/dist/chunk-K2BPYEH5.js.map +1 -0
  86. package/dist/chunk-KCQC7YBK.js +7795 -0
  87. package/dist/chunk-KCQC7YBK.js.map +1 -0
  88. package/dist/chunk-KDAV2GUT.js +1357 -0
  89. package/dist/chunk-KDAV2GUT.js.map +1 -0
  90. package/dist/chunk-KDDXZBMC.js +583 -0
  91. package/dist/chunk-KDDXZBMC.js.map +1 -0
  92. package/dist/chunk-KMWHZSEG.js +41 -0
  93. package/dist/chunk-KMWHZSEG.js.map +1 -0
  94. package/dist/chunk-KRI4R7EM.js +25 -0
  95. package/dist/chunk-KRI4R7EM.js.map +1 -0
  96. package/dist/chunk-LNJ3WZZX.js +186 -0
  97. package/dist/chunk-LNJ3WZZX.js.map +1 -0
  98. package/dist/chunk-MWXA4PFE.js +103 -0
  99. package/dist/chunk-MWXA4PFE.js.map +1 -0
  100. package/dist/chunk-MY62SSKC.js +183 -0
  101. package/dist/chunk-MY62SSKC.js.map +1 -0
  102. package/dist/chunk-NAGAJ5UM.js +145 -0
  103. package/dist/chunk-NAGAJ5UM.js.map +1 -0
  104. package/dist/chunk-NJ7WRKIQ.js +532 -0
  105. package/dist/chunk-NJ7WRKIQ.js.map +1 -0
  106. package/dist/chunk-OS6NUIBJ.js +38 -0
  107. package/dist/chunk-OS6NUIBJ.js.map +1 -0
  108. package/dist/chunk-PXU2OS26.js +238 -0
  109. package/dist/chunk-PXU2OS26.js.map +1 -0
  110. package/dist/chunk-QO4LBDVI.js +496 -0
  111. package/dist/chunk-QO4LBDVI.js.map +1 -0
  112. package/dist/chunk-QRZPQNLX.js +65 -0
  113. package/dist/chunk-QRZPQNLX.js.map +1 -0
  114. package/dist/chunk-SNVAMWB7.js +40 -0
  115. package/dist/chunk-SNVAMWB7.js.map +1 -0
  116. package/dist/chunk-SPRVUATR.js +430 -0
  117. package/dist/chunk-SPRVUATR.js.map +1 -0
  118. package/dist/chunk-SY7G5QEI.js +35 -0
  119. package/dist/chunk-SY7G5QEI.js.map +1 -0
  120. package/dist/chunk-SZNBUIDR.js +6438 -0
  121. package/dist/chunk-SZNBUIDR.js.map +1 -0
  122. package/dist/chunk-TQ2NA4Z4.js +24 -0
  123. package/dist/chunk-TQ2NA4Z4.js.map +1 -0
  124. package/dist/chunk-TYULB6ZY.js +2959 -0
  125. package/dist/chunk-TYULB6ZY.js.map +1 -0
  126. package/dist/chunk-UJYFTXHV.js +296 -0
  127. package/dist/chunk-UJYFTXHV.js.map +1 -0
  128. package/dist/chunk-VC6OKCJF.js +184 -0
  129. package/dist/chunk-VC6OKCJF.js.map +1 -0
  130. package/dist/chunk-VL2NWCZV.js +118 -0
  131. package/dist/chunk-VL2NWCZV.js.map +1 -0
  132. package/dist/chunk-VL7BGD47.js +514 -0
  133. package/dist/chunk-VL7BGD47.js.map +1 -0
  134. package/dist/chunk-VQVUJYYY.js +244 -0
  135. package/dist/chunk-VQVUJYYY.js.map +1 -0
  136. package/dist/chunk-VZQG2JDV.js +9 -0
  137. package/dist/chunk-VZQG2JDV.js.map +1 -0
  138. package/dist/chunk-XFZQVYIN.js +115 -0
  139. package/dist/chunk-XFZQVYIN.js.map +1 -0
  140. package/dist/chunk-XGTTOO4R.js +84 -0
  141. package/dist/chunk-XGTTOO4R.js.map +1 -0
  142. package/dist/chunk-XQFT4PEP.js +60 -0
  143. package/dist/chunk-XQFT4PEP.js.map +1 -0
  144. package/dist/chunk-YDD3ES2K.js +571 -0
  145. package/dist/chunk-YDD3ES2K.js.map +1 -0
  146. package/dist/chunk-ZY2MZ2KQ.js +1140 -0
  147. package/dist/chunk-ZY2MZ2KQ.js.map +1 -0
  148. package/dist/compile-57EEIUMB.js +161 -0
  149. package/dist/compile-57EEIUMB.js.map +1 -0
  150. package/dist/config-4EJ3D7QJ.js +438 -0
  151. package/dist/config-4EJ3D7QJ.js.map +1 -0
  152. package/dist/doctor-EEV6P5CH.js +111 -0
  153. package/dist/doctor-EEV6P5CH.js.map +1 -0
  154. package/dist/environment-WFEG4DAT.js +2745 -0
  155. package/dist/environment-WFEG4DAT.js.map +1 -0
  156. package/dist/github-BSMQD72A.js +114 -0
  157. package/dist/github-BSMQD72A.js.map +1 -0
  158. package/dist/harness-VX3PNVQW.js +746 -0
  159. package/dist/harness-VX3PNVQW.js.map +1 -0
  160. package/dist/help-AW2HKX63.js +2079 -0
  161. package/dist/help-AW2HKX63.js.map +1 -0
  162. package/dist/help-BVFOZD7E.js +1892 -0
  163. package/dist/help-BVFOZD7E.js.map +1 -0
  164. package/dist/index.d.ts +164 -1
  165. package/dist/index.js +50 -59246
  166. package/dist/index.js.map +1 -1
  167. package/dist/init-SPN2GEZ4.js +873 -0
  168. package/dist/init-SPN2GEZ4.js.map +1 -0
  169. package/dist/lock-K2LLUU7H.js +455 -0
  170. package/dist/lock-K2LLUU7H.js.map +1 -0
  171. package/dist/marketplace-VEKSWGX3.js +495 -0
  172. package/dist/marketplace-VEKSWGX3.js.map +1 -0
  173. package/dist/mcp-T6DKIKSF.js +202 -0
  174. package/dist/mcp-T6DKIKSF.js.map +1 -0
  175. package/dist/migrate-OO37WSB2.js +1043 -0
  176. package/dist/migrate-OO37WSB2.js.map +1 -0
  177. package/dist/open-3V3QK5RK.js +32 -0
  178. package/dist/open-3V3QK5RK.js.map +1 -0
  179. package/dist/pack-V32UPC7W.js +99 -0
  180. package/dist/pack-V32UPC7W.js.map +1 -0
  181. package/dist/plugin-KOBNQ7GT.js +64 -0
  182. package/dist/plugin-KOBNQ7GT.js.map +1 -0
  183. package/dist/plugin-from-project-X3VO3MB6.js +16 -0
  184. package/dist/plugin-from-project-X3VO3MB6.js.map +1 -0
  185. package/dist/policy-F5MKZNOC.js +105 -0
  186. package/dist/policy-F5MKZNOC.js.map +1 -0
  187. package/dist/profile-H4PMH4XT.js +1886 -0
  188. package/dist/profile-H4PMH4XT.js.map +1 -0
  189. package/dist/project-QVNEJJGH.js +1392 -0
  190. package/dist/project-QVNEJJGH.js.map +1 -0
  191. package/dist/resource-GL4RLSGI.js +555 -0
  192. package/dist/resource-GL4RLSGI.js.map +1 -0
  193. package/dist/version-PBHZK44K.js +17 -0
  194. package/dist/version-PBHZK44K.js.map +1 -0
  195. package/package.json +21 -14
  196. package/schemas/ap-package.v1.json +36 -0
  197. package/schemas/fixtures/catalog-missing-schema.ap.json +13 -0
  198. package/schemas/fixtures/confidence.ap.json +13 -0
  199. package/schemas/fixtures/context7.ap.json +13 -0
  200. package/schemas/fixtures/minimal-with-schema.ap.json +13 -0
  201. package/schemas/fixtures/superpowers.ap.json +13 -0
  202. package/schemas/fixtures/third-party-skills.ap.json +13 -0
@@ -0,0 +1,145 @@
1
+ // src/services/wizards/shared.ts
2
+ import inquirer from "inquirer";
3
+ import search from "@inquirer/search";
4
+ function isPromptCancellationError(error) {
5
+ if (!(error instanceof Error)) {
6
+ return false;
7
+ }
8
+ if (error.name === "ExitPromptError" || error.name === "CancelPromptError" || error.name === "AbortPromptError") {
9
+ return true;
10
+ }
11
+ return /force closed the prompt/i.test(error.message);
12
+ }
13
+ var PromptBackError = class extends Error {
14
+ name = "PromptBackError";
15
+ };
16
+ function isPromptBackError(error) {
17
+ return error instanceof PromptBackError;
18
+ }
19
+ async function withPromptBack(prompt) {
20
+ try {
21
+ return await prompt();
22
+ } catch (error) {
23
+ if (isPromptCancellationError(error)) {
24
+ throw new PromptBackError();
25
+ }
26
+ throw error;
27
+ }
28
+ }
29
+ function shouldUseBrowsePicker(input) {
30
+ const noInteractive = input.noInteractive ?? process.argv.includes("--no-interactive");
31
+ const ciValue = process.env.CI?.trim().toLowerCase();
32
+ const ciEnabled = Boolean(
33
+ ciValue && ciValue !== "0" && ciValue !== "false" && ciValue !== "no"
34
+ );
35
+ const forceWizard = process.env.HARNESSTAP_FORCE_WIZARD === "1";
36
+ const interactiveTerminal = forceWizard || Boolean(process.stdin.isTTY) && Boolean(process.stdout.isTTY);
37
+ return Boolean(
38
+ interactiveTerminal && !ciEnabled && process.env.HARNESSTAP_NO_INTERACTIVE !== "1" && !noInteractive && input.format !== "json"
39
+ );
40
+ }
41
+ function shouldUseWizard(input) {
42
+ const noInteractive = input.noInteractive ?? process.argv.includes("--no-interactive");
43
+ const ciValue = process.env.CI?.trim().toLowerCase();
44
+ const ciEnabled = Boolean(
45
+ ciValue && ciValue !== "0" && ciValue !== "false" && ciValue !== "no"
46
+ );
47
+ const forceWizard = process.env.HARNESSTAP_FORCE_WIZARD === "1";
48
+ const interactiveTerminal = forceWizard || Boolean(process.stdin.isTTY) && Boolean(process.stdout.isTTY);
49
+ return Boolean(
50
+ interactiveTerminal && !ciEnabled && process.env.HARNESSTAP_NO_INTERACTIVE !== "1" && !noInteractive && input.format !== "json" && (input.interactive || input.missingRequiredArgs)
51
+ );
52
+ }
53
+ async function resolveOrPrompt(input) {
54
+ if (input.value !== void 0) {
55
+ return input.value;
56
+ }
57
+ if (!input.shouldPrompt) {
58
+ return void 0;
59
+ }
60
+ return input.prompt();
61
+ }
62
+ async function promptForValue(input) {
63
+ const { value } = await inquirer.prompt([
64
+ {
65
+ type: "input",
66
+ name: "value",
67
+ message: input.message,
68
+ default: input.default,
69
+ validate: (candidate) => candidate.trim().length > 0 ? true : "A value is required."
70
+ }
71
+ ]);
72
+ return value.trim();
73
+ }
74
+ function promptPageSize(choiceCount) {
75
+ return Math.min(Math.max(choiceCount, 5), 12);
76
+ }
77
+ async function promptForChoice(input) {
78
+ const { value } = await inquirer.prompt([
79
+ {
80
+ type: "list",
81
+ name: "value",
82
+ message: input.message,
83
+ default: input.default,
84
+ choices: input.choices,
85
+ pageSize: promptPageSize(input.choices.length),
86
+ loop: false
87
+ }
88
+ ]);
89
+ return value;
90
+ }
91
+ function sortChoicesWithDefaultFirst(choices, defaultValue) {
92
+ if (!defaultValue) {
93
+ return choices;
94
+ }
95
+ const defaultChoice = choices.find((choice) => choice.value === defaultValue);
96
+ if (!defaultChoice) {
97
+ return choices;
98
+ }
99
+ return [
100
+ defaultChoice,
101
+ ...choices.filter((choice) => choice.value !== defaultValue)
102
+ ];
103
+ }
104
+ async function promptForSearchableChoice(input) {
105
+ return search({
106
+ message: input.message,
107
+ pageSize: promptPageSize(input.choices.length),
108
+ source: async (term) => {
109
+ const normalizedTerm = term?.trim().toLowerCase();
110
+ const choices = sortChoicesWithDefaultFirst(input.choices, input.default);
111
+ if (!normalizedTerm) {
112
+ return choices;
113
+ }
114
+ return choices.filter(
115
+ (choice) => `${choice.name} ${choice.value}`.toLowerCase().includes(normalizedTerm)
116
+ );
117
+ }
118
+ });
119
+ }
120
+ async function promptForConfirmation(input) {
121
+ const { value } = await inquirer.prompt([
122
+ {
123
+ type: "confirm",
124
+ name: "value",
125
+ message: input.message,
126
+ default: input.default ?? false
127
+ }
128
+ ]);
129
+ return value;
130
+ }
131
+
132
+ export {
133
+ isPromptCancellationError,
134
+ PromptBackError,
135
+ isPromptBackError,
136
+ withPromptBack,
137
+ shouldUseBrowsePicker,
138
+ shouldUseWizard,
139
+ resolveOrPrompt,
140
+ promptForValue,
141
+ promptForChoice,
142
+ promptForSearchableChoice,
143
+ promptForConfirmation
144
+ };
145
+ //# sourceMappingURL=chunk-NAGAJ5UM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/services/wizards/shared.ts"],"sourcesContent":["import inquirer from \"inquirer\";\nimport search from \"@inquirer/search\";\n\nexport interface WizardTriggerInput {\n interactive?: boolean;\n noInteractive?: boolean;\n format?: string;\n missingRequiredArgs: boolean;\n}\n\nexport function isPromptCancellationError(error: unknown): boolean {\n if (!(error instanceof Error)) {\n return false;\n }\n\n if (\n error.name === \"ExitPromptError\"\n || error.name === \"CancelPromptError\"\n || error.name === \"AbortPromptError\"\n ) {\n return true;\n }\n\n return /force closed the prompt/i.test(error.message);\n}\n\nexport class PromptBackError extends Error {\n override name = \"PromptBackError\";\n}\n\nexport function isPromptBackError(error: unknown): boolean {\n return error instanceof PromptBackError;\n}\n\nexport async function withPromptBack<T>(prompt: () => Promise<T>): Promise<T> {\n try {\n return await prompt();\n } catch (error) {\n if (isPromptCancellationError(error)) {\n throw new PromptBackError();\n }\n throw error;\n }\n}\n\nexport function shouldUseBrowsePicker(input: {\n noInteractive?: boolean;\n format?: string;\n}): boolean {\n const noInteractive =\n input.noInteractive ?? process.argv.includes(\"--no-interactive\");\n const ciValue = process.env.CI?.trim().toLowerCase();\n const ciEnabled = Boolean(\n ciValue && ciValue !== \"0\" && ciValue !== \"false\" && ciValue !== \"no\",\n );\n const forceWizard = process.env.HARNESSTAP_FORCE_WIZARD === \"1\";\n const interactiveTerminal =\n forceWizard || (Boolean(process.stdin.isTTY) && Boolean(process.stdout.isTTY));\n\n return Boolean(\n interactiveTerminal\n && !ciEnabled\n && process.env.HARNESSTAP_NO_INTERACTIVE !== \"1\"\n && !noInteractive\n && input.format !== \"json\",\n );\n}\n\nexport function shouldUseWizard(input: WizardTriggerInput): boolean {\n const noInteractive =\n input.noInteractive ?? process.argv.includes(\"--no-interactive\");\n const ciValue = process.env.CI?.trim().toLowerCase();\n const ciEnabled = Boolean(\n ciValue && ciValue !== \"0\" && ciValue !== \"false\" && ciValue !== \"no\",\n );\n const forceWizard = process.env.HARNESSTAP_FORCE_WIZARD === \"1\";\n const interactiveTerminal =\n forceWizard || (Boolean(process.stdin.isTTY) && Boolean(process.stdout.isTTY));\n\n return Boolean(\n interactiveTerminal\n && !ciEnabled\n && process.env.HARNESSTAP_NO_INTERACTIVE !== \"1\"\n && !noInteractive\n && input.format !== \"json\"\n && (input.interactive || input.missingRequiredArgs),\n );\n}\n\nexport async function resolveOrPrompt<T>(input: {\n value: T | undefined;\n shouldPrompt: boolean;\n prompt: () => Promise<T>;\n}): Promise<T | undefined> {\n if (input.value !== undefined) {\n return input.value;\n }\n\n if (!input.shouldPrompt) {\n return undefined;\n }\n\n return input.prompt();\n}\n\nexport async function promptForValue(input: {\n message: string;\n default?: string;\n}): Promise<string> {\n const { value } = await inquirer.prompt<{ value: string }>([\n {\n type: \"input\",\n name: \"value\",\n message: input.message,\n default: input.default,\n validate: (candidate: string) =>\n candidate.trim().length > 0 ? true : \"A value is required.\",\n },\n ]);\n\n return value.trim();\n}\n\nexport interface PromptChoice<T extends string = string> {\n name: string;\n value: T;\n description?: string;\n}\n\nfunction promptPageSize(choiceCount: number): number {\n return Math.min(Math.max(choiceCount, 5), 12);\n}\n\nexport async function promptForChoice<T extends string>(input: {\n message: string;\n choices: PromptChoice<T>[];\n default?: T;\n}): Promise<T> {\n const { value } = await inquirer.prompt<{ value: T }>([\n {\n type: \"list\",\n name: \"value\",\n message: input.message,\n default: input.default,\n choices: input.choices,\n pageSize: promptPageSize(input.choices.length),\n loop: false,\n },\n ]);\n\n return value;\n}\n\nfunction sortChoicesWithDefaultFirst<T extends string>(\n choices: PromptChoice<T>[],\n defaultValue?: T,\n): PromptChoice<T>[] {\n if (!defaultValue) {\n return choices;\n }\n\n const defaultChoice = choices.find((choice) => choice.value === defaultValue);\n if (!defaultChoice) {\n return choices;\n }\n\n return [\n defaultChoice,\n ...choices.filter((choice) => choice.value !== defaultValue),\n ];\n}\n\nexport async function promptForSearchableChoice<T extends string>(input: {\n message: string;\n choices: PromptChoice<T>[];\n default?: T;\n}): Promise<T> {\n return search<T>({\n message: input.message,\n pageSize: promptPageSize(input.choices.length),\n source: async (term) => {\n const normalizedTerm = term?.trim().toLowerCase();\n const choices = sortChoicesWithDefaultFirst(input.choices, input.default);\n if (!normalizedTerm) {\n return choices;\n }\n\n return choices.filter((choice) =>\n `${choice.name} ${choice.value}`.toLowerCase().includes(normalizedTerm),\n );\n },\n });\n}\n\nexport async function promptForConfirmation(input: {\n message: string;\n default?: boolean;\n}): Promise<boolean> {\n const { value } = await inquirer.prompt<{ value: boolean }>([\n {\n type: \"confirm\",\n name: \"value\",\n message: input.message,\n default: input.default ?? false,\n },\n ]);\n\n return value;\n}\n"],"mappings":"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","names":[]}
@@ -0,0 +1,532 @@
1
+ import {
2
+ useTerminalSize
3
+ } from "./chunk-KMWHZSEG.js";
4
+ import {
5
+ renderFoldedHintLine
6
+ } from "./chunk-XGTTOO4R.js";
7
+ import {
8
+ buildHelpLine,
9
+ clampActiveIndex,
10
+ handleNavigationKeypress,
11
+ handleSearchKeypress,
12
+ interactivePromptTheme,
13
+ isEscapeKey,
14
+ isSearchCharacter
15
+ } from "./chunk-3FIWOI3H.js";
16
+ import {
17
+ theme
18
+ } from "./chunk-YDD3ES2K.js";
19
+
20
+ // src/services/wizards/prompts/create-table-browser-prompt.ts
21
+ import {
22
+ createPrompt,
23
+ ExitPromptError,
24
+ isBackspaceKey,
25
+ isEnterKey,
26
+ isSpaceKey,
27
+ makeTheme,
28
+ useEffect,
29
+ useKeypress,
30
+ usePrefix,
31
+ useRef,
32
+ useState
33
+ } from "@inquirer/core";
34
+
35
+ // src/ui/prompt-screen.ts
36
+ function createPromptScreen(opts = {}) {
37
+ const output = opts.output ?? process.stdout;
38
+ const isTty = opts.isTty ?? ("isTTY" in output && output.isTTY === true);
39
+ const enterSeq = "\x1B[?1049h";
40
+ const exitSeq = "\x1B[?1049l";
41
+ return {
42
+ enter() {
43
+ if (isTty) {
44
+ output.write(enterSeq);
45
+ }
46
+ },
47
+ render(content) {
48
+ output.write(content);
49
+ },
50
+ exit() {
51
+ if (isTty) {
52
+ output.write(exitSeq);
53
+ }
54
+ }
55
+ };
56
+ }
57
+
58
+ // src/ui/show-viewport.ts
59
+ var SHOW_VIEW_CHROME_LINES = 2;
60
+ function computeShowViewportBounds(totalLines, scrollOffset, terminalRows, chromeLines = SHOW_VIEW_CHROME_LINES) {
61
+ const hintReserve = 1;
62
+ const maxVisible = Math.max(1, terminalRows - chromeLines - hintReserve);
63
+ const maxScroll = Math.max(0, totalLines - maxVisible);
64
+ const clampedOffset = Math.min(scrollOffset, maxScroll);
65
+ const start = clampedOffset;
66
+ const end = Math.min(totalLines, start + maxVisible);
67
+ return { start, end, maxScroll };
68
+ }
69
+ function renderScrollableShowContent(content, scrollOffset, terminalRows, maxWidth) {
70
+ const lines = content.split("\n");
71
+ const { start, end } = computeShowViewportBounds(lines.length, scrollOffset, terminalRows);
72
+ const visible = lines.slice(start, end);
73
+ const hints = [];
74
+ if (start > 0) {
75
+ hints.push(`\u2191 ${start} above`);
76
+ }
77
+ if (end < lines.length) {
78
+ hints.push(`\u2193 ${lines.length - end} below`);
79
+ }
80
+ if (hints.length === 0) {
81
+ return visible.join("\n");
82
+ }
83
+ const hintLine = maxWidth !== void 0 ? renderFoldedHintLine(hints, maxWidth) : ` ${hints.join(" \xB7 ")}`;
84
+ return [...visible, "", hintLine].join("\n");
85
+ }
86
+
87
+ // src/services/wizards/prompts/hooks/use-browse-show-view.ts
88
+ function isInShowView(view) {
89
+ return view === "show";
90
+ }
91
+ function handleShowViewEscape(params) {
92
+ if (!isInShowView(params.view)) {
93
+ return false;
94
+ }
95
+ if (isEscapeKey(params.key)) {
96
+ params.setView("browse");
97
+ params.setShowingItem(null);
98
+ return true;
99
+ }
100
+ return false;
101
+ }
102
+ function handleEnterToShow(params) {
103
+ if (!params.item) {
104
+ return false;
105
+ }
106
+ params.setView("show");
107
+ params.setShowingItem(params.item);
108
+ return true;
109
+ }
110
+
111
+ // src/services/wizards/prompts/create-table-browser-prompt.ts
112
+ function isLetterKey(key, letter) {
113
+ return (key.sequence === letter || key.name === letter) && !key.ctrl && !key.meta;
114
+ }
115
+ function isConfirmYes(key) {
116
+ return isLetterKey(key, "y") || isLetterKey(key, "Y");
117
+ }
118
+ function isConfirmNo(key) {
119
+ return isLetterKey(key, "n") || isLetterKey(key, "N") || isEscapeKey(key);
120
+ }
121
+ function usesCustomBrowseFrame(intent) {
122
+ switch (intent.kind) {
123
+ case "pick-many":
124
+ case "manage":
125
+ return true;
126
+ case "filter":
127
+ case "pick-one":
128
+ case "install":
129
+ return false;
130
+ default: {
131
+ const _exhaustive = intent;
132
+ return _exhaustive;
133
+ }
134
+ }
135
+ }
136
+ function renderBrowseFrame(args) {
137
+ return [
138
+ `${args.prefix} ${args.styledMessage}`,
139
+ `${theme.label("Search:")} ${args.query ? theme.entity(args.query) : theme.muted("(type to filter)")}`,
140
+ "",
141
+ args.body,
142
+ "",
143
+ buildHelpLine(args.helpActions)
144
+ ].join("\n");
145
+ }
146
+ function resolveManageRowIndex(sourceRows, item) {
147
+ if (!sourceRows || !item) {
148
+ return -1;
149
+ }
150
+ return sourceRows.indexOf(item);
151
+ }
152
+ var tableBrowserPromptBase = createPrompt((config, done) => {
153
+ const promptTheme = makeTheme(interactivePromptTheme, {});
154
+ const prefix = usePrefix({ status: "idle", theme: promptTheme });
155
+ const [query, setQuery] = useState(config.initialQuery ?? "");
156
+ const [active, setActive] = useState(0);
157
+ const [view, setView] = useState("browse");
158
+ const [showingItem, setShowingItem] = useState(null);
159
+ const [showScrollOffset, setShowScrollOffset] = useState(0);
160
+ const [pendingDeleteItem, setPendingDeleteItem] = useState(null);
161
+ const [pickManyItems, setPickManyItems] = useState(
162
+ () => config.pickManyItems ? config.pickManyItems.map((item) => ({ ...item })) : []
163
+ );
164
+ const [constraintDraft, setConstraintDraft] = useState("latest");
165
+ const [constraintTargetKey, setConstraintTargetKey] = useState(null);
166
+ const [pendingExitMessage, setPendingExitMessage] = useState(null);
167
+ const promptScreenRef = useRef(null);
168
+ if (promptScreenRef.current === null) {
169
+ promptScreenRef.current = createPromptScreen();
170
+ promptScreenRef.current.enter();
171
+ }
172
+ const { width: terminalWidth, height: terminalRows } = useTerminalSize();
173
+ useEffect(() => {
174
+ return () => promptScreenRef.current?.exit();
175
+ }, []);
176
+ const isPickMany = config.intent.kind === "pick-many";
177
+ const resolved = isPickMany ? config.resolvePickManyItems?.(pickManyItems, query) ?? { filtered: [], navigable: [] } : config.adapter.resolveItems(query);
178
+ const { filtered, navigable } = resolved;
179
+ const clampedActive = clampActiveIndex(active, navigable.length);
180
+ const selectedItem = navigable[clampedActive];
181
+ const styledMessage = promptTheme.style.message(config.message, "idle");
182
+ const checkedCount = isPickMany ? pickManyItems.filter((item) => item.checked).length : void 0;
183
+ const viewportArgs = {
184
+ query,
185
+ filtered,
186
+ navigable,
187
+ active: clampedActive,
188
+ selectedItem,
189
+ terminalWidth,
190
+ terminalRows,
191
+ prefix,
192
+ styledMessage,
193
+ items: isPickMany ? pickManyItems : void 0,
194
+ checkedCount
195
+ };
196
+ const getItemKey = (item) => {
197
+ if (config.adapter.getItemKey) {
198
+ return config.adapter.getItemKey(item);
199
+ }
200
+ return item.id;
201
+ };
202
+ const commitPickMany = () => {
203
+ const values = config.onCommitPickMany ? config.onCommitPickMany(pickManyItems) : pickManyItems;
204
+ done({ kind: "pick-many", values });
205
+ };
206
+ const commitConstraint = () => {
207
+ if (!constraintTargetKey) {
208
+ return;
209
+ }
210
+ const constraint = constraintDraft.trim() || "latest";
211
+ setPickManyItems(
212
+ pickManyItems.map(
213
+ (item) => getItemKey(item) === constraintTargetKey ? { ...item, checked: true, version_constraint: constraint } : item
214
+ )
215
+ );
216
+ setConstraintTargetKey(null);
217
+ setConstraintDraft("latest");
218
+ setView("browse");
219
+ };
220
+ const finishManage = (action) => {
221
+ done({ kind: "manage", action });
222
+ };
223
+ const enterShowView = (item) => {
224
+ if (!item) {
225
+ return;
226
+ }
227
+ setShowScrollOffset(0);
228
+ handleEnterToShow({
229
+ item,
230
+ setView: (next) => setView(next),
231
+ setShowingItem
232
+ });
233
+ };
234
+ useKeypress((key) => {
235
+ if (view === "constraint") {
236
+ if (isEscapeKey(key)) {
237
+ setConstraintTargetKey(null);
238
+ setConstraintDraft("latest");
239
+ setView("browse");
240
+ return;
241
+ }
242
+ if (isEnterKey(key)) {
243
+ commitConstraint();
244
+ return;
245
+ }
246
+ if (isBackspaceKey(key)) {
247
+ setConstraintDraft(constraintDraft.slice(0, -1));
248
+ return;
249
+ }
250
+ if (isSearchCharacter(key)) {
251
+ setConstraintDraft(constraintDraft + key.sequence);
252
+ }
253
+ return;
254
+ }
255
+ if (view === "confirm-delete") {
256
+ if (isConfirmYes(key)) {
257
+ const item = pendingDeleteItem;
258
+ setPendingDeleteItem(null);
259
+ if (item && (config.intent.kind === "filter" || config.intent.kind === "pick-one")) {
260
+ const value = config.adapter.onPick ? config.adapter.onPick(item) : item;
261
+ done(
262
+ config.intent.kind === "filter" ? { kind: "delete", value } : { kind: "pick-one", value }
263
+ );
264
+ return;
265
+ }
266
+ setView("browse");
267
+ if (item && config.adapter.onDelete) {
268
+ void config.adapter.onDelete(item).then(() => void 0);
269
+ }
270
+ } else if (isConfirmNo(key)) {
271
+ setPendingDeleteItem(null);
272
+ setView("browse");
273
+ }
274
+ return;
275
+ }
276
+ if (view === "show" && showingItem && config.adapter.renderShow) {
277
+ if (handleShowViewEscape({
278
+ view: "show",
279
+ setView: (next) => {
280
+ setView(next);
281
+ if (next === "browse") {
282
+ setShowScrollOffset(0);
283
+ }
284
+ },
285
+ setShowingItem,
286
+ key
287
+ })) {
288
+ return;
289
+ }
290
+ const showContent = config.adapter.renderShow(showingItem);
291
+ const { maxScroll } = computeShowViewportBounds(
292
+ showContent.split("\n").length,
293
+ showScrollOffset,
294
+ terminalRows
295
+ );
296
+ if (handleNavigationKeypress({
297
+ clampedActive: showScrollOffset,
298
+ length: maxScroll + 1,
299
+ setActive: setShowScrollOffset,
300
+ key
301
+ })) {
302
+ return;
303
+ }
304
+ return;
305
+ }
306
+ if (handleShowViewEscape({
307
+ view: view === "show" ? "show" : "browse",
308
+ setView: (next) => setView(next),
309
+ setShowingItem,
310
+ key
311
+ })) {
312
+ return;
313
+ }
314
+ if (isEscapeKey(key)) {
315
+ if (config.intent.kind === "filter") {
316
+ done({ kind: "filter", query: query.trim() });
317
+ return;
318
+ }
319
+ if (config.intent.kind === "manage") {
320
+ finishManage({ type: "cancel" });
321
+ return;
322
+ }
323
+ setPendingExitMessage(config.cancelMessage ?? "Table browser cancelled.");
324
+ return;
325
+ }
326
+ if (config.intent.kind === "manage") {
327
+ if (isLetterKey(key, "q")) {
328
+ finishManage({ type: "quit" });
329
+ return;
330
+ }
331
+ if (isLetterKey(key, "a")) {
332
+ finishManage({ type: "add" });
333
+ return;
334
+ }
335
+ if (isLetterKey(key, "d") && selectedItem) {
336
+ const rowIndex = resolveManageRowIndex(config.manageSourceRows, selectedItem);
337
+ if (rowIndex >= 0) {
338
+ finishManage({ type: "delete", rowIndex });
339
+ }
340
+ return;
341
+ }
342
+ if (isEnterKey(key) && selectedItem) {
343
+ const rowIndex = resolveManageRowIndex(config.manageSourceRows, selectedItem);
344
+ if (rowIndex >= 0) {
345
+ finishManage({ type: "edit", rowIndex });
346
+ }
347
+ return;
348
+ }
349
+ }
350
+ if (config.intent.kind === "filter" && key.ctrl && key.name === "e" && selectedItem && config.adapter.onEdit) {
351
+ done({ kind: "edit", value: config.adapter.onEdit(selectedItem) });
352
+ return;
353
+ }
354
+ if ((config.intent.kind === "filter" || config.intent.kind === "pick-one") && key.ctrl && key.name === "x" && selectedItem && (config.adapter.onDelete || config.adapter.formatDeleteConfirm)) {
355
+ setPendingDeleteItem(selectedItem);
356
+ setView("confirm-delete");
357
+ return;
358
+ }
359
+ if (config.intent.kind === "pick-many") {
360
+ if (key.ctrl && key.name === "s") {
361
+ commitPickMany();
362
+ return;
363
+ }
364
+ if (isEnterKey(key)) {
365
+ if (config.adapter.renderShow) {
366
+ enterShowView(selectedItem);
367
+ }
368
+ return;
369
+ }
370
+ if (navigable.length > 0 && isSpaceKey(key) && selectedItem) {
371
+ const activeKey = getItemKey(selectedItem);
372
+ const activeRow = pickManyItems.find((item) => getItemKey(item) === activeKey);
373
+ if (!activeRow) {
374
+ return;
375
+ }
376
+ if (activeRow.checked) {
377
+ setPickManyItems(
378
+ pickManyItems.map(
379
+ (item) => getItemKey(item) === activeKey ? { ...item, checked: false, version_constraint: void 0 } : item
380
+ )
381
+ );
382
+ return;
383
+ }
384
+ if (config.requiresVersionConstraint?.(selectedItem)) {
385
+ setConstraintTargetKey(activeKey);
386
+ setConstraintDraft("latest");
387
+ setView("constraint");
388
+ return;
389
+ }
390
+ setPickManyItems(
391
+ pickManyItems.map(
392
+ (item) => getItemKey(item) === activeKey ? { ...item, checked: true } : item
393
+ )
394
+ );
395
+ return;
396
+ }
397
+ if (key.ctrl && key.name === "a") {
398
+ const visibleKeys = new Set(navigable.map((item) => getItemKey(item)));
399
+ setPickManyItems(
400
+ pickManyItems.map((item) => {
401
+ if (!visibleKeys.has(getItemKey(item))) {
402
+ return item;
403
+ }
404
+ const row = item;
405
+ return {
406
+ ...item,
407
+ checked: true,
408
+ version_constraint: config.requiresVersionConstraint?.(item) ? row.version_constraint ?? "latest" : row.version_constraint
409
+ };
410
+ })
411
+ );
412
+ return;
413
+ }
414
+ if (key.ctrl && key.name === "x") {
415
+ const visibleKeys = new Set(navigable.map((item) => getItemKey(item)));
416
+ setPickManyItems(
417
+ pickManyItems.map(
418
+ (item) => visibleKeys.has(getItemKey(item)) ? { ...item, checked: false, version_constraint: void 0 } : item
419
+ )
420
+ );
421
+ return;
422
+ }
423
+ }
424
+ if (isEnterKey(key)) {
425
+ if (config.intent.kind === "pick-one" || config.intent.kind === "install") {
426
+ if (!selectedItem) {
427
+ return;
428
+ }
429
+ const value = config.adapter.onPick ? config.adapter.onPick(selectedItem) : selectedItem;
430
+ if (config.intent.kind === "install") {
431
+ done({ kind: "install", value });
432
+ return;
433
+ }
434
+ done({ kind: "pick-one", value });
435
+ return;
436
+ }
437
+ if (config.adapter.renderShow) {
438
+ enterShowView(selectedItem);
439
+ }
440
+ return;
441
+ }
442
+ if (config.intent.kind === "install" && isLetterKey(key, "i") && selectedItem) {
443
+ const value = config.adapter.onPick ? config.adapter.onPick(selectedItem) : selectedItem;
444
+ done({ kind: "install", value });
445
+ return;
446
+ }
447
+ if (handleNavigationKeypress({
448
+ clampedActive,
449
+ length: navigable.length,
450
+ setActive,
451
+ key
452
+ })) {
453
+ return;
454
+ }
455
+ handleSearchKeypress({ query, setQuery, setActive, key });
456
+ });
457
+ if (pendingExitMessage) {
458
+ throw new ExitPromptError(pendingExitMessage);
459
+ }
460
+ if (view === "show" && showingItem && config.adapter.renderShow) {
461
+ const showContent = config.adapter.renderShow(showingItem);
462
+ const helpLine = buildHelpLine([["\u2191\u2193", "scroll"], ["esc", "back"]]);
463
+ return [
464
+ renderScrollableShowContent(
465
+ showContent,
466
+ showScrollOffset,
467
+ terminalRows,
468
+ terminalWidth
469
+ ),
470
+ "",
471
+ helpLine
472
+ ].join("\n");
473
+ }
474
+ if (view === "constraint" && constraintTargetKey && config.renderConstraint) {
475
+ const target = pickManyItems.find((item) => getItemKey(item) === constraintTargetKey);
476
+ const constraintMessage = promptTheme.style.message(
477
+ `Version constraint for ${target?.display_name ?? "attachment"}`,
478
+ "idle"
479
+ );
480
+ const helpLine = buildHelpLine([
481
+ ["type", "constraint"],
482
+ ["\u23CE", "confirm"],
483
+ ["esc", "cancel"]
484
+ ]);
485
+ return config.renderConstraint({
486
+ prefix,
487
+ styledMessage: constraintMessage,
488
+ target,
489
+ constraintDraft,
490
+ helpLine
491
+ });
492
+ }
493
+ const body = config.adapter.renderViewport(viewportArgs);
494
+ if (view === "confirm-delete" && pendingDeleteItem) {
495
+ const label = config.adapter.formatDeleteConfirm ? config.adapter.formatDeleteConfirm(pendingDeleteItem) : "Delete selected item?";
496
+ return [
497
+ usesCustomBrowseFrame(config.intent) ? body : renderBrowseFrame({
498
+ prefix,
499
+ styledMessage,
500
+ query,
501
+ body,
502
+ helpActions: config.adapter.helpActions
503
+ }),
504
+ "",
505
+ theme.danger(`${label} [y/N]`)
506
+ ].join("\n");
507
+ }
508
+ if (usesCustomBrowseFrame(config.intent)) {
509
+ return body;
510
+ }
511
+ return renderBrowseFrame({
512
+ prefix,
513
+ styledMessage,
514
+ query,
515
+ body,
516
+ helpActions: config.adapter.helpActions
517
+ });
518
+ });
519
+ function createTableBrowserPrompt(config, context) {
520
+ return tableBrowserPromptBase(
521
+ config,
522
+ context
523
+ );
524
+ }
525
+
526
+ export {
527
+ createPromptScreen,
528
+ computeShowViewportBounds,
529
+ renderScrollableShowContent,
530
+ createTableBrowserPrompt
531
+ };
532
+ //# sourceMappingURL=chunk-NJ7WRKIQ.js.map