harnesstap 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/apply-SUNDXRJ3.js +54 -0
- package/dist/{approve-KQNCNH2R.js → approve-FBGYQGWN.js} +14 -15
- package/dist/{approve-KQNCNH2R.js.map → approve-FBGYQGWN.js.map} +1 -1
- package/dist/{audit-SLYOZCMI.js → audit-VI4QZ6X2.js} +30 -39
- package/dist/{audit-SLYOZCMI.js.map → audit-VI4QZ6X2.js.map} +1 -1
- package/dist/{auth-3IEVICFT.js → auth-4CQCDS2W.js} +17 -19
- package/dist/{auth-3IEVICFT.js.map → auth-4CQCDS2W.js.map} +1 -1
- package/dist/bin.js +3 -3
- package/dist/{chunk-KDDXZBMC.js → chunk-23XSG7LI.js} +7 -11
- package/dist/{chunk-KDDXZBMC.js.map → chunk-23XSG7LI.js.map} +1 -1
- package/dist/{chunk-YDD3ES2K.js → chunk-2A36HWDE.js} +63 -13
- package/dist/chunk-2A36HWDE.js.map +1 -0
- package/dist/{chunk-IK524ZDW.js → chunk-3FS775NP.js} +51 -4
- package/dist/chunk-3FS775NP.js.map +1 -0
- package/dist/{chunk-IBOABSIA.js → chunk-3P6BWL5F.js} +2 -2
- package/dist/{chunk-G26HZZDJ.js → chunk-43BDGVN3.js} +19 -6
- package/dist/chunk-43BDGVN3.js.map +1 -0
- package/dist/{chunk-TYULB6ZY.js → chunk-4ZQ2SCGY.js} +146 -78
- package/dist/chunk-4ZQ2SCGY.js.map +1 -0
- package/dist/{chunk-6BY4BV5G.js → chunk-6LTLYV5D.js} +353 -230
- package/dist/chunk-6LTLYV5D.js.map +1 -0
- package/dist/{chunk-GQKKX7OE.js → chunk-73OJQTBW.js} +6 -2
- package/dist/chunk-73OJQTBW.js.map +1 -0
- package/dist/{chunk-IRU7NBOT.js → chunk-7HP6AAI3.js} +2 -2
- package/dist/{chunk-MWXA4PFE.js → chunk-BPWFQKI5.js} +5 -7
- package/dist/{chunk-MWXA4PFE.js.map → chunk-BPWFQKI5.js.map} +1 -1
- package/dist/{chunk-3RBYT7QN.js → chunk-D432JAXV.js} +44 -19
- package/dist/chunk-D432JAXV.js.map +1 -0
- package/dist/chunk-DF4Z7LAD.js +3463 -0
- package/dist/chunk-DF4Z7LAD.js.map +1 -0
- package/dist/{chunk-J4CKQXQ6.js → chunk-EOPFER6N.js} +71 -318
- package/dist/chunk-EOPFER6N.js.map +1 -0
- package/dist/chunk-G6WKY2W4.js +389 -0
- package/dist/chunk-G6WKY2W4.js.map +1 -0
- package/dist/{chunk-JKGSJGCC.js → chunk-GRASK6M6.js} +5 -5
- package/dist/{chunk-63U7QWNY.js → chunk-IE7B6Q5K.js} +33 -39
- package/dist/chunk-IE7B6Q5K.js.map +1 -0
- package/dist/{chunk-VC6OKCJF.js → chunk-IMROMZ2K.js} +7 -4
- package/dist/{chunk-VC6OKCJF.js.map → chunk-IMROMZ2K.js.map} +1 -1
- package/dist/{chunk-DV74UZJI.js → chunk-L6YZE5MY.js} +3 -3
- package/dist/{chunk-SNVAMWB7.js → chunk-M2U3J7UX.js} +7 -1
- package/dist/chunk-M2U3J7UX.js.map +1 -0
- package/dist/{chunk-BSOBXLYI.js → chunk-M4KLHJ6U.js} +16 -13
- package/dist/chunk-M4KLHJ6U.js.map +1 -0
- package/dist/{chunk-VL7BGD47.js → chunk-MR7IOHSX.js} +16 -19
- package/dist/chunk-MR7IOHSX.js.map +1 -0
- package/dist/{chunk-4KNQZDZC.js → chunk-N3VGY3T3.js} +15 -15
- package/dist/chunk-N3VGY3T3.js.map +1 -0
- package/dist/{chunk-ZY2MZ2KQ.js → chunk-N3ZCH64F.js} +496 -10
- package/dist/chunk-N3ZCH64F.js.map +1 -0
- package/dist/{chunk-H6DVP2SI.js → chunk-OML4HXKT.js} +20 -22
- package/dist/chunk-OML4HXKT.js.map +1 -0
- package/dist/{chunk-NJ7WRKIQ.js → chunk-P2C7JPLD.js} +3 -3
- package/dist/{chunk-LNJ3WZZX.js → chunk-PCMON7Y2.js} +7 -7
- package/dist/{chunk-VL2NWCZV.js → chunk-PNGF5EV2.js} +2 -2
- package/dist/{chunk-SZNBUIDR.js → chunk-QA5U36JN.js} +199 -215
- package/dist/chunk-QA5U36JN.js.map +1 -0
- package/dist/{chunk-KDAV2GUT.js → chunk-R7ZOYVN3.js} +241 -126
- package/dist/chunk-R7ZOYVN3.js.map +1 -0
- package/dist/{chunk-QO4LBDVI.js → chunk-RDG5DT7S.js} +45 -49
- package/dist/{chunk-QO4LBDVI.js.map → chunk-RDG5DT7S.js.map} +1 -1
- package/dist/{chunk-VQVUJYYY.js → chunk-REHRUNBB.js} +8 -3
- package/dist/chunk-REHRUNBB.js.map +1 -0
- package/dist/{chunk-DXKAKKLP.js → chunk-RFQ3N7FB.js} +19 -29
- package/dist/chunk-RFQ3N7FB.js.map +1 -0
- package/dist/{chunk-C4QBVVEH.js → chunk-RVEXPMM3.js} +3 -3
- package/dist/{chunk-XFZQVYIN.js → chunk-TPEJFLV7.js} +13 -15
- package/dist/{chunk-XFZQVYIN.js.map → chunk-TPEJFLV7.js.map} +1 -1
- package/dist/{chunk-7LWH5SWH.js → chunk-U6DXASQP.js} +2 -2
- package/dist/{chunk-BIBUCC2E.js → chunk-ULCD6DJE.js} +30 -8
- package/dist/chunk-ULCD6DJE.js.map +1 -0
- package/dist/{chunk-KMWHZSEG.js → chunk-UVVZHWD2.js} +2 -2
- package/dist/{chunk-DWVAR4BP.js → chunk-WG5A6EAU.js} +270 -12
- package/dist/chunk-WG5A6EAU.js.map +1 -0
- package/dist/{chunk-QRZPQNLX.js → chunk-WGP4GUYZ.js} +10 -10
- package/dist/{chunk-F2L4VNQK.js → chunk-XTVGCVU4.js} +124 -83
- package/dist/chunk-XTVGCVU4.js.map +1 -0
- package/dist/{chunk-EIWXS4RM.js → chunk-XUJKZQZA.js} +8 -8
- package/dist/chunk-XUJKZQZA.js.map +1 -0
- package/dist/chunk-ZUASVASP.js +30317 -0
- package/dist/chunk-ZUASVASP.js.map +1 -0
- package/dist/{compile-57EEIUMB.js → compile-GXADKGH5.js} +37 -50
- package/dist/{compile-57EEIUMB.js.map → compile-GXADKGH5.js.map} +1 -1
- package/dist/{config-4EJ3D7QJ.js → config-JMHNA2U5.js} +22 -35
- package/dist/{config-4EJ3D7QJ.js.map → config-JMHNA2U5.js.map} +1 -1
- package/dist/cursor-local-install-46RWRBDT.js +98 -0
- package/dist/cursor-local-install-46RWRBDT.js.map +1 -0
- package/dist/{doctor-EEV6P5CH.js → doctor-N7ZULPOL.js} +18 -19
- package/dist/{doctor-EEV6P5CH.js.map → doctor-N7ZULPOL.js.map} +1 -1
- package/dist/{environment-WFEG4DAT.js → environment-OBB3WU5B.js} +60 -71
- package/dist/{environment-WFEG4DAT.js.map → environment-OBB3WU5B.js.map} +1 -1
- package/dist/{github-BSMQD72A.js → github-PBYBGOLH.js} +17 -17
- package/dist/{harness-VX3PNVQW.js → harness-7KYATIV6.js} +56 -67
- package/dist/{harness-VX3PNVQW.js.map → harness-7KYATIV6.js.map} +1 -1
- package/dist/{help-AW2HKX63.js → help-EE3AJQD4.js} +48 -52
- package/dist/help-EE3AJQD4.js.map +1 -0
- package/dist/{help-BVFOZD7E.js → help-VXWKLQ6A.js} +55 -15
- package/dist/help-VXWKLQ6A.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +16 -24
- package/dist/{init-SPN2GEZ4.js → init-LBTMPDVJ.js} +43 -56
- package/dist/init-LBTMPDVJ.js.map +1 -0
- package/dist/live-read-cache-TUSP7U3D.js +10 -0
- package/dist/{lock-K2LLUU7H.js → lock-WLJRXRVK.js} +16 -16
- package/dist/{marketplace-VEKSWGX3.js → marketplace-GXSV6QIY.js} +62 -28
- package/dist/marketplace-GXSV6QIY.js.map +1 -0
- package/dist/{mcp-T6DKIKSF.js → mcp-XPDWWU75.js} +35 -48
- package/dist/{mcp-T6DKIKSF.js.map → mcp-XPDWWU75.js.map} +1 -1
- package/dist/{migrate-OO37WSB2.js → migrate-SBUIWN3U.js} +79 -64
- package/dist/migrate-SBUIWN3U.js.map +1 -0
- package/dist/open-HDGLYYVU.js +24 -0
- package/dist/{pack-V32UPC7W.js → pack-A73LDVOX.js} +16 -22
- package/dist/{pack-V32UPC7W.js.map → pack-A73LDVOX.js.map} +1 -1
- package/dist/plugin-CEO6ZJM5.js +51 -0
- package/dist/plugin-from-project-UK7VJVUP.js +18 -0
- package/dist/{policy-F5MKZNOC.js → policy-6VY3CMSU.js} +13 -14
- package/dist/{policy-F5MKZNOC.js.map → policy-6VY3CMSU.js.map} +1 -1
- package/dist/{profile-H4PMH4XT.js → profile-YCKPMRRU.js} +96 -102
- package/dist/profile-YCKPMRRU.js.map +1 -0
- package/dist/{project-QVNEJJGH.js → project-KHPPBKPN.js} +63 -77
- package/dist/{project-QVNEJJGH.js.map → project-KHPPBKPN.js.map} +1 -1
- package/dist/{resource-GL4RLSGI.js → resource-IJU3FAN5.js} +42 -49
- package/dist/{resource-GL4RLSGI.js.map → resource-IJU3FAN5.js.map} +1 -1
- package/dist/{version-PBHZK44K.js → version-Z66FWWMQ.js} +2 -2
- package/dist/version-Z66FWWMQ.js.map +1 -0
- package/package.json +4 -1
- package/schemas/fixtures/confidence.ap.json +1 -1
- package/schemas/fixtures/context7.ap.json +1 -1
- package/schemas/fixtures/legacy-schema-v1.ap.json +13 -0
- package/schemas/fixtures/legacy-schemas-v1.ap.json +13 -0
- package/schemas/fixtures/minimal-with-schema.ap.json +1 -1
- package/schemas/fixtures/superpowers.ap.json +1 -1
- package/schemas/fixtures/third-party-skills.ap.json +1 -1
- package/dist/apply-2GRNKR5H.js +0 -67
- package/dist/chunk-2EIJYDNI.js +0 -10945
- package/dist/chunk-2EIJYDNI.js.map +0 -1
- package/dist/chunk-3IWTJCPA.js +0 -6448
- package/dist/chunk-3IWTJCPA.js.map +0 -1
- package/dist/chunk-3IZ7SEGT.js +0 -346
- package/dist/chunk-3IZ7SEGT.js.map +0 -1
- package/dist/chunk-3RBYT7QN.js.map +0 -1
- package/dist/chunk-4KNQZDZC.js.map +0 -1
- package/dist/chunk-63U7QWNY.js.map +0 -1
- package/dist/chunk-6BY4BV5G.js.map +0 -1
- package/dist/chunk-7L2K4N25.js +0 -610
- package/dist/chunk-7L2K4N25.js.map +0 -1
- package/dist/chunk-BIBUCC2E.js.map +0 -1
- package/dist/chunk-BSOBXLYI.js.map +0 -1
- package/dist/chunk-DWVAR4BP.js.map +0 -1
- package/dist/chunk-DXKAKKLP.js.map +0 -1
- package/dist/chunk-EIWXS4RM.js.map +0 -1
- package/dist/chunk-EWBCFAF3.js +0 -681
- package/dist/chunk-EWBCFAF3.js.map +0 -1
- package/dist/chunk-F2L4VNQK.js.map +0 -1
- package/dist/chunk-G26HZZDJ.js.map +0 -1
- package/dist/chunk-GQKKX7OE.js.map +0 -1
- package/dist/chunk-GRJY22U6.js +0 -691
- package/dist/chunk-GRJY22U6.js.map +0 -1
- package/dist/chunk-H6DVP2SI.js.map +0 -1
- package/dist/chunk-HVVPTCKR.js +0 -1173
- package/dist/chunk-HVVPTCKR.js.map +0 -1
- package/dist/chunk-IK524ZDW.js.map +0 -1
- package/dist/chunk-J4CKQXQ6.js.map +0 -1
- package/dist/chunk-JRFUTIEH.js +0 -426
- package/dist/chunk-JRFUTIEH.js.map +0 -1
- package/dist/chunk-K2BPYEH5.js +0 -491
- package/dist/chunk-K2BPYEH5.js.map +0 -1
- package/dist/chunk-KCQC7YBK.js +0 -7795
- package/dist/chunk-KCQC7YBK.js.map +0 -1
- package/dist/chunk-KDAV2GUT.js.map +0 -1
- package/dist/chunk-MY62SSKC.js +0 -183
- package/dist/chunk-MY62SSKC.js.map +0 -1
- package/dist/chunk-PXU2OS26.js +0 -238
- package/dist/chunk-PXU2OS26.js.map +0 -1
- package/dist/chunk-SNVAMWB7.js.map +0 -1
- package/dist/chunk-SPRVUATR.js +0 -430
- package/dist/chunk-SPRVUATR.js.map +0 -1
- package/dist/chunk-SY7G5QEI.js +0 -35
- package/dist/chunk-SY7G5QEI.js.map +0 -1
- package/dist/chunk-SZNBUIDR.js.map +0 -1
- package/dist/chunk-TYULB6ZY.js.map +0 -1
- package/dist/chunk-UJYFTXHV.js +0 -296
- package/dist/chunk-UJYFTXHV.js.map +0 -1
- package/dist/chunk-VL7BGD47.js.map +0 -1
- package/dist/chunk-VQVUJYYY.js.map +0 -1
- package/dist/chunk-XQFT4PEP.js +0 -60
- package/dist/chunk-XQFT4PEP.js.map +0 -1
- package/dist/chunk-YDD3ES2K.js.map +0 -1
- package/dist/chunk-ZY2MZ2KQ.js.map +0 -1
- package/dist/help-AW2HKX63.js.map +0 -1
- package/dist/help-BVFOZD7E.js.map +0 -1
- package/dist/init-SPN2GEZ4.js.map +0 -1
- package/dist/marketplace-VEKSWGX3.js.map +0 -1
- package/dist/migrate-OO37WSB2.js.map +0 -1
- package/dist/open-3V3QK5RK.js +0 -32
- package/dist/plugin-KOBNQ7GT.js +0 -64
- package/dist/plugin-from-project-X3VO3MB6.js +0 -16
- package/dist/profile-H4PMH4XT.js.map +0 -1
- /package/dist/{apply-2GRNKR5H.js.map → apply-SUNDXRJ3.js.map} +0 -0
- /package/dist/{chunk-IBOABSIA.js.map → chunk-3P6BWL5F.js.map} +0 -0
- /package/dist/{chunk-IRU7NBOT.js.map → chunk-7HP6AAI3.js.map} +0 -0
- /package/dist/{chunk-JKGSJGCC.js.map → chunk-GRASK6M6.js.map} +0 -0
- /package/dist/{chunk-DV74UZJI.js.map → chunk-L6YZE5MY.js.map} +0 -0
- /package/dist/{chunk-NJ7WRKIQ.js.map → chunk-P2C7JPLD.js.map} +0 -0
- /package/dist/{chunk-LNJ3WZZX.js.map → chunk-PCMON7Y2.js.map} +0 -0
- /package/dist/{chunk-VL2NWCZV.js.map → chunk-PNGF5EV2.js.map} +0 -0
- /package/dist/{chunk-C4QBVVEH.js.map → chunk-RVEXPMM3.js.map} +0 -0
- /package/dist/{chunk-7LWH5SWH.js.map → chunk-U6DXASQP.js.map} +0 -0
- /package/dist/{chunk-KMWHZSEG.js.map → chunk-UVVZHWD2.js.map} +0 -0
- /package/dist/{chunk-QRZPQNLX.js.map → chunk-WGP4GUYZ.js.map} +0 -0
- /package/dist/{github-BSMQD72A.js.map → github-PBYBGOLH.js.map} +0 -0
- /package/dist/{open-3V3QK5RK.js.map → live-read-cache-TUSP7U3D.js.map} +0 -0
- /package/dist/{lock-K2LLUU7H.js.map → lock-WLJRXRVK.js.map} +0 -0
- /package/dist/{plugin-KOBNQ7GT.js.map → open-HDGLYYVU.js.map} +0 -0
- /package/dist/{plugin-from-project-X3VO3MB6.js.map → plugin-CEO6ZJM5.js.map} +0 -0
- /package/dist/{version-PBHZK44K.js.map → plugin-from-project-UK7VJVUP.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/services/plugin-resource-mode.ts","../src/config/settings.ts"],"sourcesContent":["export const PLUGIN_RESOURCE_MODES = [\"symlink\", \"copy\", \"clone\"] as const;\n\nexport type PluginResourceMode = (typeof PLUGIN_RESOURCE_MODES)[number];\n\nexport const DEFAULT_PLUGIN_RESOURCE_MODE: PluginResourceMode = \"symlink\";\n\nexport function isPluginResourceMode(value: unknown): value is PluginResourceMode {\n return value === \"symlink\" || value === \"copy\" || value === \"clone\";\n}\n\nexport function parsePluginResourceMode(\n value: string | undefined,\n): PluginResourceMode {\n if (isPluginResourceMode(value)) return value;\n throw new Error(\n `Invalid plugin resource mode: ${value}. Use symlink, copy, or clone.`,\n );\n}\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport {\n DEFAULT_PLUGIN_RESOURCE_MODE,\n isPluginResourceMode,\n type PluginResourceMode,\n} from \"../services/plugin-resource-mode.js\";\n\nexport type PluginMarketplacePlatform =\n | \"claude-code\"\n | \"cursor\"\n | \"goose\"\n | \"copilot-cli\";\n\nexport interface PluginMarketplaceEntry {\n name: string;\n url: string;\n platforms: PluginMarketplacePlatform[];\n /** Extra git branches to catalog. Empty/omitted tracks only the default branch. */\n trackedBranches?: string[];\n}\n\nexport interface HarnesstapSettings {\n plugins: {\n refreshMaxAgeHours: number;\n marketplaceRefreshMaxAgeMinutes: number;\n marketplaces: PluginMarketplaceEntry[];\n };\n pluginVersionHistoryLimit: number;\n harnessSync: {\n pluginResources: PluginResourceMode;\n /** When true, Codex and Copilot load Agent Plugins packages instead of the portable extract. */\n nativeAgentPlugins: boolean;\n };\n}\n\nconst VALID_PLATFORMS = new Set<PluginMarketplacePlatform>([\n \"claude-code\",\n \"cursor\",\n \"goose\",\n \"copilot-cli\",\n]);\n\nexport const DEFAULT_MARKETPLACE_REFRESH_MAX_AGE_MINUTES = 60;\n\nexport function marketplaceRefreshMaxAgeMs(minutes: number): number {\n return minutes * 60 * 1000;\n}\n\nconst DEFAULTS: HarnesstapSettings = {\n plugins: {\n refreshMaxAgeHours: 24,\n marketplaceRefreshMaxAgeMinutes: DEFAULT_MARKETPLACE_REFRESH_MAX_AGE_MINUTES,\n marketplaces: [],\n },\n pluginVersionHistoryLimit: 10,\n harnessSync: {\n pluginResources: DEFAULT_PLUGIN_RESOURCE_MODE,\n nativeAgentPlugins: false,\n },\n};\n\nfunction isPluginMarketplacePlatform(\n value: unknown,\n): value is PluginMarketplacePlatform {\n return (\n typeof value === \"string\" &&\n VALID_PLATFORMS.has(value as PluginMarketplacePlatform)\n );\n}\n\nexport function parseTrackedBranches(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n\n const seen = new Set<string>();\n const branches: string[] = [];\n for (const item of value) {\n if (typeof item !== \"string\") continue;\n const trimmed = item.trim();\n if (!trimmed || seen.has(trimmed)) continue;\n seen.add(trimmed);\n branches.push(trimmed);\n }\n return branches;\n}\n\nexport function settingsPath(harnesstapDir: string): string {\n return existsSync(join(harnesstapDir, \"config.jsonc\"))\n ? join(harnesstapDir, \"config.jsonc\")\n : join(harnesstapDir, \"config.json\");\n}\n\nexport function parseMarketplaces(value: unknown): PluginMarketplaceEntry[] {\n if (!Array.isArray(value)) return [];\n\n const marketplaces: PluginMarketplaceEntry[] = [];\n for (const row of value) {\n if (typeof row !== \"object\" || row === null) continue;\n\n const record = row as Record<string, unknown>;\n const name = record.name;\n const url = record.url;\n const platforms = record.platforms;\n\n if (typeof name !== \"string\") continue;\n const trimmedName = name.trim();\n if (trimmedName.length === 0) continue;\n if (typeof url !== \"string\") continue;\n const trimmedUrl = url.trim();\n if (trimmedUrl.length === 0) continue;\n if (!Array.isArray(platforms)) continue;\n\n const parsedPlatforms = platforms.filter(isPluginMarketplacePlatform);\n if (parsedPlatforms.length === 0) continue;\n\n const trackedBranches = parseTrackedBranches(record.trackedBranches);\n marketplaces.push({\n name: trimmedName,\n url: trimmedUrl,\n platforms: parsedPlatforms,\n ...(trackedBranches.length > 0 ? { trackedBranches } : {}),\n });\n }\n\n return marketplaces;\n}\n\nexport function parseJsonc(content: string): unknown {\n let normalized = \"\";\n let inString = false;\n let stringQuote = '\"';\n let escaping = false;\n let inLineComment = false;\n let inBlockComment = false;\n\n for (let index = 0; index < content.length; index++) {\n const char = content[index];\n const nextChar = content[index + 1];\n\n if (inLineComment) {\n if (char === \"\\n\") {\n inLineComment = false;\n normalized += char;\n }\n continue;\n }\n\n if (inBlockComment) {\n if (char === \"*\" && nextChar === \"/\") {\n inBlockComment = false;\n index++;\n }\n continue;\n }\n\n if (inString) {\n normalized += char;\n if (escaping) {\n escaping = false;\n continue;\n }\n if (char === \"\\\\\") {\n escaping = true;\n continue;\n }\n if (char === stringQuote) {\n inString = false;\n }\n continue;\n }\n\n if ((char === '\"' || char === \"'\") && !inString) {\n inString = true;\n stringQuote = char;\n normalized += char;\n continue;\n }\n\n if (char === \"/\" && nextChar === \"/\") {\n inLineComment = true;\n index++;\n continue;\n }\n\n if (char === \"/\" && nextChar === \"*\") {\n inBlockComment = true;\n index++;\n continue;\n }\n\n if (char === \",\") {\n let lookahead = index + 1;\n while (lookahead < content.length) {\n const lookaheadChar = content[lookahead];\n const lookaheadNextChar = content[lookahead + 1];\n\n if (lookaheadChar !== undefined && /\\s/.test(lookaheadChar)) {\n lookahead++;\n continue;\n }\n\n if (lookaheadChar === \"/\" && lookaheadNextChar === \"/\") {\n lookahead += 2;\n while (lookahead < content.length && content[lookahead] !== \"\\n\") {\n lookahead++;\n }\n continue;\n }\n\n if (lookaheadChar === \"/\" && lookaheadNextChar === \"*\") {\n lookahead += 2;\n while (\n lookahead < content.length &&\n !(content[lookahead] === \"*\" && content[lookahead + 1] === \"/\")\n ) {\n lookahead++;\n }\n lookahead += 2;\n continue;\n }\n\n if (lookaheadChar === \"}\" || lookaheadChar === \"]\") {\n break;\n }\n\n normalized += char;\n break;\n }\n\n if (lookahead >= content.length) {\n normalized += char;\n }\n continue;\n }\n\n normalized += char;\n }\n\n return JSON.parse(normalized);\n}\n\nexport function loadSettings(harnesstapDir: string): HarnesstapSettings {\n const path = settingsPath(harnesstapDir);\n if (!existsSync(path)) return DEFAULTS;\n try {\n const raw = parseJsonc(readFileSync(path, \"utf-8\")) as Partial<HarnesstapSettings> & {\n harnessSync?: { pluginResources?: unknown; nativeAgentPlugins?: unknown };\n };\n const hours = raw.plugins?.refreshMaxAgeHours;\n const marketplaceMinutes = raw.plugins?.marketplaceRefreshMaxAgeMinutes;\n const limit = raw.pluginVersionHistoryLimit;\n const pluginResources = raw.harnessSync?.pluginResources;\n const nativeAgentPlugins = raw.harnessSync?.nativeAgentPlugins === true;\n return {\n plugins: {\n refreshMaxAgeHours:\n typeof hours === \"number\" && hours > 0\n ? hours\n : DEFAULTS.plugins.refreshMaxAgeHours,\n marketplaceRefreshMaxAgeMinutes:\n typeof marketplaceMinutes === \"number\" && marketplaceMinutes > 0\n ? marketplaceMinutes\n : DEFAULTS.plugins.marketplaceRefreshMaxAgeMinutes,\n marketplaces: parseMarketplaces(raw.plugins?.marketplaces),\n },\n pluginVersionHistoryLimit:\n typeof limit === \"number\" && Number.isInteger(limit) && limit >= 1\n ? limit\n : DEFAULTS.pluginVersionHistoryLimit,\n harnessSync: {\n pluginResources: isPluginResourceMode(pluginResources)\n ? pluginResources\n : DEFAULTS.harnessSync.pluginResources,\n nativeAgentPlugins,\n },\n };\n } catch {\n return DEFAULTS;\n }\n}\n\nexport function readToolkitConfigRecord(\n harnesstapDir: string,\n path = settingsPath(harnesstapDir),\n): Record<string, unknown> {\n if (!existsSync(path)) {\n return {};\n }\n try {\n const parsed = parseJsonc(readFileSync(path, \"utf-8\"));\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n return parsed as Record<string, unknown>;\n }\n return {};\n } catch {\n return {};\n }\n}\n\nexport function writeToolkitConfigRecord(\n harnesstapDir: string,\n record: Record<string, unknown>,\n path = settingsPath(harnesstapDir),\n): void {\n mkdirSync(harnesstapDir, { recursive: true });\n writeFileSync(path, `${JSON.stringify(record, null, 2)}\\n`, \"utf-8\");\n}\n\nexport function saveSettings(\n harnesstapDir: string,\n settings: HarnesstapSettings,\n): void {\n const path = settingsPath(harnesstapDir);\n const existing = readToolkitConfigRecord(harnesstapDir, path);\n writeToolkitConfigRecord(\n harnesstapDir,\n {\n ...existing,\n plugins: settings.plugins,\n pluginVersionHistoryLimit: settings.pluginVersionHistoryLimit,\n harnessSync: settings.harnessSync,\n },\n path,\n );\n}\n"],"mappings":";AAIO,IAAM,+BAAmD;AAEzD,SAAS,qBAAqB,OAA6C;AAChF,SAAO,UAAU,aAAa,UAAU,UAAU,UAAU;AAC9D;AAEO,SAAS,wBACd,OACoB;AACpB,MAAI,qBAAqB,KAAK,EAAG,QAAO;AACxC,QAAM,IAAI;AAAA,IACR,iCAAiC,KAAK;AAAA,EACxC;AACF;;;ACjBA,SAAS,YAAY,WAAW,cAAc,qBAAqB;AACnE,SAAS,YAAY;AAmCrB,IAAM,kBAAkB,oBAAI,IAA+B;AAAA,EACzD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,8CAA8C;AAEpD,SAAS,2BAA2B,SAA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A36HWDE.js";
|
|
1
4
|
import {
|
|
2
5
|
CLI_ERRORS,
|
|
3
6
|
CLI_HINTS,
|
|
4
7
|
ensureErrorPrefix,
|
|
5
8
|
gitFailureHint,
|
|
6
9
|
mapGitStderr
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
|
|
9
|
-
// src/services/cli-errors.ts
|
|
10
|
-
var CliUsageError = class extends Error {
|
|
11
|
-
constructor(message, hints = [], exitCode = 1) {
|
|
12
|
-
super(message);
|
|
13
|
-
this.hints = hints;
|
|
14
|
-
this.name = "CliUsageError";
|
|
15
|
-
this.exitCode = exitCode;
|
|
16
|
-
}
|
|
17
|
-
exitCode;
|
|
18
|
-
};
|
|
19
|
-
function missingRequiredArg(name, commandPath) {
|
|
20
|
-
return new CliUsageError(
|
|
21
|
-
`missing required argument '${name}'`,
|
|
22
|
-
[`Run ht ${commandPath} --help to see the options.`]
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
function conflictingOptions(a, b) {
|
|
26
|
-
return new CliUsageError(`error: cannot use ${a} together with ${b}`);
|
|
27
|
-
}
|
|
10
|
+
} from "./chunk-WG5A6EAU.js";
|
|
28
11
|
|
|
29
12
|
// src/cli/on-conflict.ts
|
|
30
|
-
var ON_CONFLICT_HELP = "What to do when it already exists: replace, skip, prompt or cancel";
|
|
31
|
-
var ON_CONFLICT_PLUGIN_IMPORT_HELP = "What to do when it already exists: replace, skip, prompt, cancel or merge";
|
|
32
|
-
var ON_CONFLICT_APPLY_HELP = "What to do when it already exists: replace, skip, prompt or cancel. Non-interactive default: cancel";
|
|
13
|
+
var ON_CONFLICT_HELP = "What to do when it already exists: replace, skip, prompt or cancel. overwrite, ignore and fail are aliases";
|
|
14
|
+
var ON_CONFLICT_PLUGIN_IMPORT_HELP = "What to do when it already exists: replace, skip, prompt, cancel or merge. overwrite, ignore and fail are aliases";
|
|
15
|
+
var ON_CONFLICT_APPLY_HELP = "What to do when it already exists: replace, skip, prompt or cancel. overwrite, ignore and fail are aliases. Non-interactive default: cancel";
|
|
33
16
|
var ON_CONFLICT_VALUE_HELP = {
|
|
34
17
|
replace: "Replace the existing one",
|
|
35
18
|
skip: "Keep the existing one and move on",
|
|
@@ -236,6 +219,14 @@ function fail(message, opts) {
|
|
|
236
219
|
}
|
|
237
220
|
}
|
|
238
221
|
}
|
|
222
|
+
function hintsFromError(error) {
|
|
223
|
+
if (!error || typeof error !== "object" || !("hints" in error)) return [];
|
|
224
|
+
const raw = error.hints;
|
|
225
|
+
if (!Array.isArray(raw)) return [];
|
|
226
|
+
return raw.filter(
|
|
227
|
+
(hint) => typeof hint === "string" && hint.trim().length > 0
|
|
228
|
+
);
|
|
229
|
+
}
|
|
239
230
|
function failCaught(error, opts) {
|
|
240
231
|
if (error instanceof CliUsageError) {
|
|
241
232
|
fail(error.message, {
|
|
@@ -246,8 +237,10 @@ function failCaught(error, opts) {
|
|
|
246
237
|
}
|
|
247
238
|
const mapped = mapUserFacingError(error);
|
|
248
239
|
const commanderHint = isCommanderError(error) ? void 0 : mapped.hint;
|
|
240
|
+
const ownHints = hintsFromError(error);
|
|
241
|
+
const hints = commanderHint ? [commanderHint, ...ownHints.filter((hint) => hint !== commanderHint)] : ownHints;
|
|
249
242
|
fail(mapped.message, {
|
|
250
|
-
|
|
243
|
+
hints,
|
|
251
244
|
exitCode: opts?.exitCode ?? mapped.exitCode
|
|
252
245
|
});
|
|
253
246
|
}
|
|
@@ -276,9 +269,6 @@ function isGroupedCommandFallbackError(error) {
|
|
|
276
269
|
}
|
|
277
270
|
|
|
278
271
|
export {
|
|
279
|
-
CliUsageError,
|
|
280
|
-
missingRequiredArg,
|
|
281
|
-
conflictingOptions,
|
|
282
272
|
ON_CONFLICT_HELP,
|
|
283
273
|
ON_CONFLICT_PLUGIN_IMPORT_HELP,
|
|
284
274
|
ON_CONFLICT_APPLY_HELP,
|
|
@@ -299,4 +289,4 @@ export {
|
|
|
299
289
|
isVerboseMode,
|
|
300
290
|
isGroupedCommandFallbackError
|
|
301
291
|
};
|
|
302
|
-
//# sourceMappingURL=chunk-
|
|
292
|
+
//# sourceMappingURL=chunk-RFQ3N7FB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/on-conflict.ts","../src/cli/shared.ts","../src/cli/user-errors.ts"],"sourcesContent":["/** Shared --on-conflict vocabulary (DS-6). Hidden aliases for one release: overwrite, ignore, fail. */\n\nexport const ON_CONFLICT_VALUES = [\"replace\", \"skip\", \"prompt\", \"cancel\"] as const;\nexport type OnConflictValue = (typeof ON_CONFLICT_VALUES)[number];\n\nexport const ON_CONFLICT_HELP =\n \"What to do when it already exists: replace, skip, prompt or cancel. overwrite, ignore and fail are aliases\";\n\nexport const ON_CONFLICT_PLUGIN_IMPORT_HELP =\n \"What to do when it already exists: replace, skip, prompt, cancel or merge. overwrite, ignore and fail are aliases\";\n\n/** Apply, profile, and project: non-interactive default is cancel. Pass --on-conflict replace in CI. */\nexport const ON_CONFLICT_APPLY_HELP =\n \"What to do when it already exists: replace, skip, prompt or cancel. overwrite, ignore and fail are aliases. Non-interactive default: cancel\";\n\nexport const ON_CONFLICT_VALUE_HELP = {\n replace: \"Replace the existing one\",\n skip: \"Keep the existing one and move on\",\n prompt: \"Ask each time\",\n cancel: \"Stop without changing anything\",\n merge: \"Merge with the existing plugin (plugin import only)\",\n} as const;\n\nfunction mapAlias(value: string): string {\n switch (value) {\n case \"overwrite\":\n return \"replace\";\n case \"ignore\":\n return \"skip\";\n case \"fail\":\n return \"cancel\";\n default:\n return value;\n }\n}\n\nexport function parseOnConflict(\n value: string | undefined,\n opts?: { allowMerge?: boolean },\n): OnConflictValue | \"merge\" | undefined {\n if (!value) {\n return undefined;\n }\n const mapped = mapAlias(value);\n switch (mapped) {\n case \"replace\":\n case \"skip\":\n case \"prompt\":\n case \"cancel\":\n return mapped;\n case \"merge\":\n if (opts?.allowMerge) {\n return \"merge\";\n }\n throw new Error(`Invalid --on-conflict value: ${value}. Use replace, skip, prompt or cancel.`);\n default:\n throw new Error(\n opts?.allowMerge\n ? `Invalid --on-conflict value: ${value}. Use replace, skip, prompt, cancel or merge.`\n : `Invalid --on-conflict value: ${value}. Use replace, skip, prompt or cancel.`,\n );\n }\n}\n\nexport function toResourceSyncOnConflict(\n value: OnConflictValue | \"merge\" | undefined,\n): \"overwrite\" | \"ignore\" | \"fail\" | undefined {\n if (!value || value === \"merge\" || value === \"prompt\") {\n return undefined;\n }\n switch (value) {\n case \"replace\":\n return \"overwrite\";\n case \"skip\":\n return \"ignore\";\n case \"cancel\":\n return \"fail\";\n default: {\n const _exhaustive: never = value;\n return _exhaustive;\n }\n }\n}\n\nexport function toPluginImportOnConflict(\n value: OnConflictValue | \"merge\" | undefined,\n): \"overwrite\" | \"cancel\" | \"merge\" | undefined {\n if (!value) {\n return undefined;\n }\n switch (value) {\n case \"replace\":\n return \"overwrite\";\n case \"cancel\":\n case \"skip\":\n return \"cancel\";\n case \"merge\":\n return \"merge\";\n case \"prompt\":\n return \"cancel\";\n default: {\n const _exhaustive: never = value;\n return _exhaustive;\n }\n }\n}\n","import { basename } from \"node:path\";\nimport { CliUsageError } from \"../services/cli-errors.js\";\nimport { ensureErrorPrefix } from \"./messages.js\";\nimport { isCommanderError, mapUserFacingError } from \"./user-errors.js\";\n\nexport const GUIDE_SCENARIOS_URL =\n \"https://github.com/harnesstap/harnesstap/blob/main/docs/scenarios/scenarios.md\";\n\nexport const GIT_ORIGIN_HINTS = [\n \"Add a remote: git remote add origin <url>\",\n \"Snapshots, drift, history, and revert require a git repository with origin configured.\",\n];\n\nexport function resolveInvocationName(): \"harnesstap\" | \"ht\" {\n return basename(process.argv[1] ?? \"\") === \"ht\" ? \"ht\" : \"harnesstap\";\n}\n\nexport function shellQuote(value: string): string {\n if (value.length === 0) {\n return '\"\"';\n }\n if (/^[A-Za-z0-9_./:@+=,-]+$/.test(value)) {\n return value;\n }\n return `\"${value.replaceAll(\"\\\\\", \"\\\\\\\\\").replaceAll(\"\\\"\", \"\\\\\\\"\")}\"`;\n}\n\n/** DS-6: hints always say `ht` and shell-quote each argument (W2-1, W3-3). */\nexport function formatCommand(pathOrArgs: string | readonly string[]): string {\n if (typeof pathOrArgs === \"string\") {\n const trimmed = pathOrArgs.trim();\n const stripped = trimmed.replace(/^(?:harnesstap|ht)\\s+/, \"\");\n return stripped.length > 0 ? `ht ${stripped}` : \"ht\";\n }\n return [\"ht\", ...pathOrArgs.map(shellQuote)].join(\" \");\n}\n\nexport function formatHintCommand(args: readonly string[]): string {\n return formatCommand(args);\n}\n\nexport function fail(\n message: string,\n opts?: { hint?: string; hints?: string[]; exitCode?: number },\n): void {\n process.exitCode = opts?.exitCode ?? 1;\n console.error(ensureErrorPrefix(message));\n const hints = opts?.hints ?? (opts?.hint ? [opts.hint] : []);\n for (const hint of hints) {\n if (hint.trim().length > 0) {\n console.error(hint);\n }\n }\n}\n\nfunction hintsFromError(error: unknown): string[] {\n if (!error || typeof error !== \"object\" || !(\"hints\" in error)) return [];\n const raw = (error as { hints?: unknown }).hints;\n if (!Array.isArray(raw)) return [];\n return raw.filter(\n (hint): hint is string => typeof hint === \"string\" && hint.trim().length > 0,\n );\n}\n\nexport function failCaught(error: unknown, opts?: { exitCode?: number }): void {\n if (error instanceof CliUsageError) {\n fail(error.message, {\n hint: error.hints[0],\n exitCode: opts?.exitCode ?? error.exitCode,\n });\n return;\n }\n const mapped = mapUserFacingError(error);\n const commanderHint = isCommanderError(error)\n ? undefined\n : mapped.hint;\n const ownHints = hintsFromError(error);\n const hints = commanderHint\n ? [commanderHint, ...ownHints.filter((hint) => hint !== commanderHint)]\n : ownHints;\n fail(mapped.message, {\n hints,\n exitCode: opts?.exitCode ?? mapped.exitCode,\n });\n}\n\n/** DS-6: packaged help and scenario playbooks always show `ht`. */\nexport function formatScenarioCommand(path: string): string {\n const trimmed = path.trim();\n const stripped = trimmed.replace(/^(?:harnesstap|ht)\\s+/, \"\");\n return stripped.length > 0 ? `ht ${stripped}` : \"ht\";\n}\n\nexport function collectRepeatedOption(value: string, previous: string[]): string[] {\n return [...previous, value];\n}\n\nexport function reportNoGitOrigin(_retryCommand?: string): void {\n fail(\"No git remote origin configured.\", {\n hint: GIT_ORIGIN_HINTS[0],\n });\n}\n\nexport function isVerboseMode(argv: string[] = process.argv): boolean {\n return argv.includes(\"-v\") || argv.includes(\"--verbose\");\n}\n\nexport function isGroupedCommandFallbackError(error: unknown): error is {\n code: string;\n exitCode: number;\n message: string;\n} {\n if (!error || typeof error !== \"object\") {\n return false;\n }\n\n const candidate = error as {\n code?: unknown;\n exitCode?: unknown;\n message?: unknown;\n };\n\n return candidate.code === \"commander.excessArguments\"\n && candidate.exitCode === 1\n && typeof candidate.message === \"string\"\n && /too many arguments for '(plugin|resource|plugin|auth|migrate|harness|environment|profile)'/i.test(candidate.message);\n}\n","import { CLI_ERRORS, CLI_HINTS } from \"./messages.js\";\nimport { gitFailureHint, mapGitStderr } from \"../utils/git-errors.js\";\n\nexport { gitFailureHint, mapGitStderr } from \"../utils/git-errors.js\";\n\nexport interface MappedCliError {\n message: string;\n hint?: string;\n exitCode: number;\n}\n\nfunction nodePathFromEnoent(error: Error): string | undefined {\n if (\"path\" in error && typeof error.path === \"string\" && error.path.length > 0) {\n return error.path;\n }\n const match = /ENOENT: no such file or directory, (?:stat|open|scandir|mkdir|unlink) '([^']+)'/.exec(\n error.message,\n );\n return match?.[1];\n}\n\nexport function isSqliteUniqueError(error: unknown): boolean {\n if (!error || typeof error !== \"object\") {\n return false;\n }\n const candidate = error as { code?: unknown; message?: unknown };\n const code = typeof candidate.code === \"string\" ? candidate.code : \"\";\n const message = typeof candidate.message === \"string\" ? candidate.message : \"\";\n return (\n code === \"SQLITE_CONSTRAINT_UNIQUE\"\n || code === \"SQLITE_CONSTRAINT\"\n || message.includes(\"UNIQUE constraint failed\")\n );\n}\n\nfunction mapSqliteUnique(message: string): MappedCliError {\n if (message.includes(\"plugins.\")) {\n return {\n message: CLI_ERRORS.uniqueConstraintGeneric.replace(\n \"That name already exists.\",\n \"A plugin with that name already exists.\",\n ),\n hint: CLI_HINTS.onConflictReplace,\n exitCode: 1,\n };\n }\n if (message.includes(\"environments\")) {\n return {\n message: \"An environment with that name already exists.\",\n hint: CLI_HINTS.onConflictReplace,\n exitCode: 1,\n };\n }\n return {\n message: CLI_ERRORS.uniqueConstraintGeneric,\n hint: CLI_HINTS.onConflictReplace,\n exitCode: 1,\n };\n}\n\nfunction commanderExitCode(error: unknown): number {\n if (error && typeof error === \"object\" && \"exitCode\" in error) {\n const raw = (error as { exitCode?: unknown }).exitCode;\n if (typeof raw === \"number\" && raw > 0) {\n return raw;\n }\n }\n return 1;\n}\n\nexport function isCommanderError(error: unknown): boolean {\n if (!error || typeof error !== \"object\" || !(\"code\" in error)) {\n return false;\n }\n return String((error as { code?: unknown }).code ?? \"\").startsWith(\"commander.\");\n}\n\nexport function mapUserFacingError(error: unknown): MappedCliError {\n const exitCode = commanderExitCode(error);\n\n if (error instanceof Error && isSqliteUniqueError(error)) {\n return { ...mapSqliteUnique(error.message), exitCode };\n }\n\n if (error instanceof Error) {\n const code = \"code\" in error ? String((error as { code?: unknown }).code ?? \"\") : \"\";\n if (code === \"ENOENT\") {\n const filePath = nodePathFromEnoent(error);\n return {\n message: CLI_ERRORS.fileNotFound(filePath ?? \"that path\"),\n exitCode,\n };\n }\n const lower = error.message.toLowerCase();\n if (\n lower.includes(\"could not read username\")\n || lower.includes(\"terminal prompts disabled\")\n || lower.includes(\"authentication failed\")\n || /\\bfatal:/.test(lower)\n || error.message.startsWith(\"Couldn't reach\")\n ) {\n return {\n message: mapGitStderr(error.message),\n hint: gitFailureHint(),\n exitCode,\n };\n }\n return { message: error.message, exitCode };\n }\n\n return { message: String(error), exitCode };\n}\n\nexport function commanderHelpHint(commandPath: string): string {\n return CLI_HINTS.seeOptions(commandPath);\n}\n"],"mappings":";;;;;;;;;;;;AAKO,IAAM,mBACX;AAEK,IAAM,iCACX;AAGK,IAAM,yBACX;AAEK,IAAM,yBAAyB;AAAA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KAAK,IACxC,SACA,OAAO;AACX,QAAM,WAAW,eAAe,KAAK;AACrC,QAAM,QAAQ,gBACV,CAAC,eAAe,GAAG,SAAS,OAAO,CAAC,SAAS,SAAS,aAAa,CAAC,IACpE;AACJ,OAAK,OAAO,SAAS;AAAA,IACnB;AAAA,IACA,UAAU,MAAM,YAAY,OAAO;AAAA,EACrC,CAAC;AACH;AAGO,SAAS,sBAAsB,MAAsB;AAC1D,QAAM,UAAU,KAAK,KAAK;AAC1B,QAAM,WAAW,QAAQ,QAAQ,yBAAyB,EAAE;AAC5D,SAAO,SAAS,SAAS,IAAI,MAAM,QAAQ,KAAK;AAClD;AAEO,SAAS,sBAAsB,OAAe,UAA8B;AACjF,SAAO,CAAC,GAAG,UAAU,KAAK;AAC5B;AAEO,SAAS,kBAAkB,eAA8B;AAC9D,OAAK,oCAAoC;AAAA,IACvC,MAAM,iBAAiB,CAAC;AAAA,EAC1B,CAAC;AACH;AAEO,SAAS,cAAc,OAAiB,QAAQ,MAAe;AACpE,SAAO,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,WAAW;AACzD;AAEO,SAAS,8BAA8B,OAI5C;AACA,MAAI,CAAC,SAAS,OAAO,UAAU,UAAU;AACvC,WAAO;AAAA,EACT;AAEA,QAAM,YAAY;AAMlB,SAAO,UAAU,SAAS,+BACrB,UAAU,aAAa,KACvB,OAAO,UAAU,YAAY,YAC7B,8FAA8F,KAAK,UAAU,OAAO;AAC3H;","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createProgress,
|
|
3
3
|
isTty
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2A36HWDE.js";
|
|
5
5
|
import {
|
|
6
6
|
DEVICE_LOGIN_WAITING
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WG5A6EAU.js";
|
|
8
8
|
|
|
9
9
|
// src/services/device-login-prompt.ts
|
|
10
10
|
function printDeviceLoginInstructions(input) {
|
|
@@ -29,4 +29,4 @@ function printDeviceLoginInstructions(input) {
|
|
|
29
29
|
export {
|
|
30
30
|
printDeviceLoginInstructions
|
|
31
31
|
};
|
|
32
|
-
//# sourceMappingURL=chunk-
|
|
32
|
+
//# sourceMappingURL=chunk-RVEXPMM3.js.map
|
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createProfileCommand,
|
|
3
|
-
getActiveProfileName,
|
|
4
|
-
getGlobalActiveEnvironmentName,
|
|
5
|
-
renameProfileCommand,
|
|
6
|
-
setActiveProfileName,
|
|
7
|
-
setGlobalActiveEnvironment
|
|
8
|
-
} from "./chunk-KCQC7YBK.js";
|
|
9
1
|
import {
|
|
10
2
|
GLOBAL_DEFAULT_PROFILE_NAME,
|
|
11
3
|
LEGACY_DEFAULT_PROFILE_NAME,
|
|
12
4
|
PROFILE_PLUGIN_TAG,
|
|
13
|
-
isProfilePlugin,
|
|
14
|
-
listProfilePlugins
|
|
15
|
-
} from "./chunk-SY7G5QEI.js";
|
|
16
|
-
import {
|
|
17
5
|
addResourceToPlugin,
|
|
18
6
|
createEnvironment,
|
|
19
7
|
createPlugin,
|
|
8
|
+
createProfileCommand,
|
|
20
9
|
diskCaptureHarnessScope,
|
|
10
|
+
getGlobalActiveEnvironmentName,
|
|
21
11
|
getPluginResources,
|
|
12
|
+
isProfilePlugin,
|
|
22
13
|
listEnvironments,
|
|
23
14
|
listPlugins,
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
listProfilePlugins,
|
|
16
|
+
listResources,
|
|
17
|
+
renameProfileCommand,
|
|
18
|
+
setGlobalActiveEnvironment
|
|
19
|
+
} from "./chunk-ZUASVASP.js";
|
|
20
|
+
import {
|
|
21
|
+
getActiveProfileName,
|
|
22
|
+
setActiveProfileName
|
|
23
|
+
} from "./chunk-DF4Z7LAD.js";
|
|
26
24
|
|
|
27
25
|
// src/services/ensure-default-environment.ts
|
|
28
26
|
function ensureDefaultEnvironment() {
|
|
@@ -112,4 +110,4 @@ export {
|
|
|
112
110
|
ensureDefaultProfilePlugin,
|
|
113
111
|
seedDefaultProfileFromLibrary
|
|
114
112
|
};
|
|
115
|
-
//# sourceMappingURL=chunk-
|
|
113
|
+
//# sourceMappingURL=chunk-TPEJFLV7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/services/ensure-default-environment.ts","../src/services/ensure-default-profile.ts"],"sourcesContent":["import {\n createEnvironment,\n listEnvironments,\n} from \"../models/environment.js\";\nimport type { Environment } from \"../types.js\";\nimport {\n getGlobalActiveEnvironmentName,\n setGlobalActiveEnvironment,\n} from \"./environment-session.js\";\n\nexport interface EnsureDefaultEnvironmentResult {\n environment: Environment;\n created: boolean;\n}\n\n/**\n * When no environments exist, seed a `default` environment and point the home\n * active environment at it if unset.\n */\nexport function ensureDefaultEnvironment(): EnsureDefaultEnvironmentResult {\n const existing = listEnvironments();\n const [first] = existing;\n if (first) {\n return { environment: first, created: false };\n }\n\n const environment = createEnvironment({\n name: \"default\",\n description: \"Default environment\",\n });\n\n if (!getGlobalActiveEnvironmentName()) {\n setGlobalActiveEnvironment(environment.name);\n }\n\n return { environment, created: true };\n}\n","import {\n GLOBAL_DEFAULT_PROFILE_NAME,\n LEGACY_DEFAULT_PROFILE_NAME,\n PROFILE_PLUGIN_TAG,\n isProfilePlugin,\n listProfilePlugins,\n} from \"../constants/profile.js\";\nimport {\n addResourceToPlugin,\n createPlugin,\n getPluginResources,\n listPlugins,\n} from \"../models/plugin-model.js\";\nimport { listResources } from \"../models/resource.js\";\nimport type { Plugin } from \"../types.js\";\nimport {\n getActiveProfileName,\n setActiveProfileName,\n} from \"./active-profile.js\";\nimport { createProfileCommand, renameProfileCommand } from \"./profile-commands.js\";\nimport { diskCaptureHarnessScope } from \"./harness-scope.js\";\n\nexport interface EnsureDefaultProfileResult {\n plugin: Plugin;\n created: boolean;\n}\n\nfunction findProfileByName(name: string): Plugin | undefined {\n return listPlugins().find((entry) => entry.name === name && isProfilePlugin(entry));\n}\n\n/**\n * Rename a leftover `default` profile plugin to `global default` when the\n * new name is free.\n */\nexport function migrateLegacyDefaultProfile(): Plugin | undefined {\n const already = findProfileByName(GLOBAL_DEFAULT_PROFILE_NAME);\n if (already) {\n return already;\n }\n const legacy = findProfileByName(LEGACY_DEFAULT_PROFILE_NAME);\n if (!legacy) {\n return undefined;\n }\n renameProfileCommand(legacy.name, GLOBAL_DEFAULT_PROFILE_NAME);\n return findProfileByName(GLOBAL_DEFAULT_PROFILE_NAME);\n}\n\n/**\n * When no profile plugins exist, seed a `global default` profile (same name as\n * `ht init`) and point the active-profile pointer at it if unset.\n */\nexport function ensureDefaultProfilePlugin(): EnsureDefaultProfileResult {\n migrateLegacyDefaultProfile();\n const existing = listProfilePlugins();\n const [first] = existing;\n if (first) {\n return { plugin: first, created: false };\n }\n\n const { plugin, created } = createProfileCommand({\n name: GLOBAL_DEFAULT_PROFILE_NAME,\n description: \"Global default profile\",\n });\n\n if (!getActiveProfileName()) {\n setActiveProfileName(plugin.name);\n }\n\n return { plugin, created };\n}\n\nfunction libraryResourcesForDefaultProfile() {\n return listResources().filter((resource) => resource.type !== \"plugin\");\n}\n\n/**\n * Seed `global default` only when no profile plugins exist (first start).\n * If that profile is already present and empty, attach library resources.\n * Do not recreate it after a rename or when any other profile is present.\n */\nexport function seedDefaultProfileFromLibrary(): EnsureDefaultProfileResult {\n migrateLegacyDefaultProfile();\n let plugin = findProfileByName(GLOBAL_DEFAULT_PROFILE_NAME);\n let created = false;\n if (!plugin) {\n const [existing] = listProfilePlugins();\n if (existing) {\n return { plugin: existing, created: false };\n }\n plugin = createPlugin({\n name: GLOBAL_DEFAULT_PROFILE_NAME,\n version: \"1.0.0\",\n description: \"Bootstrap profile from init\",\n tags: [PROFILE_PLUGIN_TAG],\n });\n created = true;\n }\n\n const attachedMaterial = getPluginResources(plugin.id).filter(\n (resource) => resource.type !== \"plugin\",\n );\n if (attachedMaterial.length === 0) {\n for (const resource of libraryResourcesForDefaultProfile()) {\n addResourceToPlugin(plugin.id, resource.id, diskCaptureHarnessScope(resource));\n }\n }\n\n if (created || !getActiveProfileName()) {\n setActiveProfileName(plugin.name);\n }\n return { plugin, created };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/services/ensure-default-environment.ts","../src/services/ensure-default-profile.ts"],"sourcesContent":["import {\n createEnvironment,\n listEnvironments,\n} from \"../models/environment.js\";\nimport type { Environment } from \"../types.js\";\nimport {\n getGlobalActiveEnvironmentName,\n setGlobalActiveEnvironment,\n} from \"./environment-session.js\";\n\nexport interface EnsureDefaultEnvironmentResult {\n environment: Environment;\n created: boolean;\n}\n\n/**\n * When no environments exist, seed a `default` environment and point the home\n * active environment at it if unset.\n */\nexport function ensureDefaultEnvironment(): EnsureDefaultEnvironmentResult {\n const existing = listEnvironments();\n const [first] = existing;\n if (first) {\n return { environment: first, created: false };\n }\n\n const environment = createEnvironment({\n name: \"default\",\n description: \"Default environment\",\n });\n\n if (!getGlobalActiveEnvironmentName()) {\n setGlobalActiveEnvironment(environment.name);\n }\n\n return { environment, created: true };\n}\n","import {\n GLOBAL_DEFAULT_PROFILE_NAME,\n LEGACY_DEFAULT_PROFILE_NAME,\n PROFILE_PLUGIN_TAG,\n isProfilePlugin,\n listProfilePlugins,\n} from \"../constants/profile.js\";\nimport {\n addResourceToPlugin,\n createPlugin,\n getPluginResources,\n listPlugins,\n} from \"../models/plugin-model.js\";\nimport { listResources } from \"../models/resource.js\";\nimport type { Plugin } from \"../types.js\";\nimport {\n getActiveProfileName,\n setActiveProfileName,\n} from \"./active-profile.js\";\nimport { createProfileCommand, renameProfileCommand } from \"./profile-commands.js\";\nimport { diskCaptureHarnessScope } from \"./harness-scope.js\";\n\nexport interface EnsureDefaultProfileResult {\n plugin: Plugin;\n created: boolean;\n}\n\nfunction findProfileByName(name: string): Plugin | undefined {\n return listPlugins().find((entry) => entry.name === name && isProfilePlugin(entry));\n}\n\n/**\n * Rename a leftover `default` profile plugin to `global default` when the\n * new name is free.\n */\nexport function migrateLegacyDefaultProfile(): Plugin | undefined {\n const already = findProfileByName(GLOBAL_DEFAULT_PROFILE_NAME);\n if (already) {\n return already;\n }\n const legacy = findProfileByName(LEGACY_DEFAULT_PROFILE_NAME);\n if (!legacy) {\n return undefined;\n }\n renameProfileCommand(legacy.name, GLOBAL_DEFAULT_PROFILE_NAME);\n return findProfileByName(GLOBAL_DEFAULT_PROFILE_NAME);\n}\n\n/**\n * When no profile plugins exist, seed a `global default` profile (same name as\n * `ht init`) and point the active-profile pointer at it if unset.\n */\nexport function ensureDefaultProfilePlugin(): EnsureDefaultProfileResult {\n migrateLegacyDefaultProfile();\n const existing = listProfilePlugins();\n const [first] = existing;\n if (first) {\n return { plugin: first, created: false };\n }\n\n const { plugin, created } = createProfileCommand({\n name: GLOBAL_DEFAULT_PROFILE_NAME,\n description: \"Global default profile\",\n });\n\n if (!getActiveProfileName()) {\n setActiveProfileName(plugin.name);\n }\n\n return { plugin, created };\n}\n\nfunction libraryResourcesForDefaultProfile() {\n return listResources().filter((resource) => resource.type !== \"plugin\");\n}\n\n/**\n * Seed `global default` only when no profile plugins exist (first start).\n * If that profile is already present and empty, attach library resources.\n * Do not recreate it after a rename or when any other profile is present.\n */\nexport function seedDefaultProfileFromLibrary(): EnsureDefaultProfileResult {\n migrateLegacyDefaultProfile();\n let plugin = findProfileByName(GLOBAL_DEFAULT_PROFILE_NAME);\n let created = false;\n if (!plugin) {\n const [existing] = listProfilePlugins();\n if (existing) {\n return { plugin: existing, created: false };\n }\n plugin = createPlugin({\n name: GLOBAL_DEFAULT_PROFILE_NAME,\n version: \"1.0.0\",\n description: \"Bootstrap profile from init\",\n tags: [PROFILE_PLUGIN_TAG],\n });\n created = true;\n }\n\n const attachedMaterial = getPluginResources(plugin.id).filter(\n (resource) => resource.type !== \"plugin\",\n );\n if (attachedMaterial.length === 0) {\n for (const resource of libraryResourcesForDefaultProfile()) {\n addResourceToPlugin(plugin.id, resource.id, diskCaptureHarnessScope(resource));\n }\n }\n\n if (created || !getActiveProfileName()) {\n setActiveProfileName(plugin.name);\n }\n return { plugin, created };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,SAAS,2BAA2D;AACzE,QAAM,WAAW,iBAAiB;AAClC,QAAM,CAAC,KAAK,IAAI;AAChB,MAAI,OAAO;AACT,WAAO,EAAE,aAAa,OAAO,SAAS,MAAM;AAAA,EAC9C;AAEA,QAAM,cAAc,kBAAkB;AAAA,IACpC,MAAM;AAAA,IACN,aAAa;AAAA,EACf,CAAC;AAED,MAAI,CAAC,+BAA+B,GAAG;AACrC,+BAA2B,YAAY,IAAI;AAAA,EAC7C;AAEA,SAAO,EAAE,aAAa,SAAS,KAAK;AACtC;;;ACTA,SAAS,kBAAkB,MAAkC;AAC3D,SAAO,YAAY,EAAE,KAAK,CAAC,UAAU,MAAM,SAAS,QAAQ,gBAAgB,KAAK,CAAC;AACpF;AAMO,SAAS,8BAAkD;AAChE,QAAM,UAAU,kBAAkB,2BAA2B;AAC7D,MAAI,SAAS;AACX,WAAO;AAAA,EACT;AACA,QAAM,SAAS,kBAAkB,2BAA2B;AAC5D,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,EACT;AACA,uBAAqB,OAAO,MAAM,2BAA2B;AAC7D,SAAO,kBAAkB,2BAA2B;AACtD;AAMO,SAAS,6BAAyD;AACvE,8BAA4B;AAC5B,QAAM,WAAW,mBAAmB;AACpC,QAAM,CAAC,KAAK,IAAI;AAChB,MAAI,OAAO;AACT,WAAO,EAAE,QAAQ,OAAO,SAAS,MAAM;AAAA,EACzC;AAEA,QAAM,EAAE,QAAQ,QAAQ,IAAI,qBAAqB;AAAA,IAC/C,MAAM;AAAA,IACN,aAAa;AAAA,EACf,CAAC;AAED,MAAI,CAAC,qBAAqB,GAAG;AAC3B,yBAAqB,OAAO,IAAI;AAAA,EAClC;AAEA,SAAO,EAAE,QAAQ,QAAQ;AAC3B;AAEA,SAAS,oCAAoC;AAC3C,SAAO,cAAc,EAAE,OAAO,CAAC,aAAa,SAAS,SAAS,QAAQ;AACxE;AAOO,SAAS,gCAA4D;AAC1E,8BAA4B;AAC5B,MAAI,SAAS,kBAAkB,2BAA2B;AAC1D,MAAI,UAAU;AACd,MAAI,CAAC,QAAQ;AACX,UAAM,CAAC,QAAQ,IAAI,mBAAmB;AACtC,QAAI,UAAU;AACZ,aAAO,EAAE,QAAQ,UAAU,SAAS,MAAM;AAAA,IAC5C;AACA,aAAS,aAAa;AAAA,MACpB,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,kBAAkB;AAAA,IAC3B,CAAC;AACD,cAAU;AAAA,EACZ;AAEA,QAAM,mBAAmB,mBAAmB,OAAO,EAAE,EAAE;AAAA,IACrD,CAAC,aAAa,SAAS,SAAS;AAAA,EAClC;AACA,MAAI,iBAAiB,WAAW,GAAG;AACjC,eAAW,YAAY,kCAAkC,GAAG;AAC1D,0BAAoB,OAAO,IAAI,SAAS,IAAI,wBAAwB,QAAQ,CAAC;AAAA,IAC/E;AAAA,EACF;AAEA,MAAI,WAAW,CAAC,qBAAqB,GAAG;AACtC,yBAAqB,OAAO,IAAI;AAAA,EAClC;AACA,SAAO,EAAE,QAAQ,QAAQ;AAC3B;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ui
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2A36HWDE.js";
|
|
4
4
|
|
|
5
5
|
// src/cli/columns.ts
|
|
6
6
|
function makeIdColumn(showId, width = 12) {
|
|
@@ -15,4 +15,4 @@ function makeIdColumn(showId, width = 12) {
|
|
|
15
15
|
export {
|
|
16
16
|
makeIdColumn
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-U6DXASQP.js.map
|
|
@@ -9,20 +9,21 @@ import {
|
|
|
9
9
|
resolveSectionViewport
|
|
10
10
|
} from "./chunk-XGTTOO4R.js";
|
|
11
11
|
import {
|
|
12
|
+
RESOURCE_TYPES,
|
|
12
13
|
formatHookInventoryLabel,
|
|
13
14
|
hookDisplayInputFromResource
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import {
|
|
16
|
-
RESOURCE_TYPES,
|
|
17
|
-
getAllPlatforms
|
|
18
|
-
} from "./chunk-2EIJYDNI.js";
|
|
15
|
+
} from "./chunk-ZUASVASP.js";
|
|
19
16
|
import {
|
|
20
17
|
formatRelativeTime,
|
|
21
18
|
renderTable,
|
|
22
19
|
resolveTableMaxWidth,
|
|
23
20
|
shortenId,
|
|
24
21
|
theme
|
|
25
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-2A36HWDE.js";
|
|
23
|
+
import {
|
|
24
|
+
getAllPlatforms,
|
|
25
|
+
resolveHomeRoot
|
|
26
|
+
} from "./chunk-DF4Z7LAD.js";
|
|
26
27
|
|
|
27
28
|
// src/ui/resource-display.ts
|
|
28
29
|
var AGENTS_INSTRUCTIONS_RESOURCE_NAME = "agents-instructions";
|
|
@@ -671,6 +672,26 @@ function renderFlatResourceListTable(resources, opts) {
|
|
|
671
672
|
return lines.join("\n");
|
|
672
673
|
}
|
|
673
674
|
|
|
675
|
+
// src/utils/home-path.ts
|
|
676
|
+
function shortenHomePath(path, home = resolveHomeRoot()) {
|
|
677
|
+
const trimmed = path.trim();
|
|
678
|
+
if (!trimmed || trimmed === "~" || trimmed.startsWith("~/")) {
|
|
679
|
+
return trimmed;
|
|
680
|
+
}
|
|
681
|
+
const normalized = trimmed.replaceAll("\\", "/");
|
|
682
|
+
const homeNorm = home.trim().replaceAll("\\", "/").replace(/\/+$/, "");
|
|
683
|
+
if (homeNorm.length < 2) {
|
|
684
|
+
return trimmed;
|
|
685
|
+
}
|
|
686
|
+
if (normalized === homeNorm) {
|
|
687
|
+
return "~";
|
|
688
|
+
}
|
|
689
|
+
if (normalized.startsWith(`${homeNorm}/`)) {
|
|
690
|
+
return `~${normalized.slice(homeNorm.length)}`;
|
|
691
|
+
}
|
|
692
|
+
return trimmed;
|
|
693
|
+
}
|
|
694
|
+
|
|
674
695
|
export {
|
|
675
696
|
formatOriginDisplayLabel,
|
|
676
697
|
resourceHumanName,
|
|
@@ -691,6 +712,7 @@ export {
|
|
|
691
712
|
listNavigablePluginEditRows,
|
|
692
713
|
formatResourceSelectionLabel,
|
|
693
714
|
renderGroupedResourceListTables,
|
|
694
|
-
renderFlatResourceListTable
|
|
715
|
+
renderFlatResourceListTable,
|
|
716
|
+
shortenHomePath
|
|
695
717
|
};
|
|
696
|
-
//# sourceMappingURL=chunk-
|
|
718
|
+
//# sourceMappingURL=chunk-ULCD6DJE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ui/resource-display.ts","../src/ui/resource-list-render.ts","../src/utils/home-path.ts"],"sourcesContent":["import { getAllPlatforms } from \"../platforms/registry.js\";\nimport {\n formatHookInventoryLabel,\n hookDisplayInputFromResource,\n type HookDisplayInput,\n} from \"./hook-display.js\";\n\nexport {\n formatHookInventoryLabel,\n formatHookInventoryTooltipLines,\n hookCommandShortToken,\n hookInventoryWireFromResource,\n normalizeHookEventName,\n} from \"./hook-display.js\";\nexport type { HookDisplayInput, HookInventoryWire } from \"./hook-display.js\";\n\nexport const AGENTS_INSTRUCTIONS_RESOURCE_NAME = \"agents-instructions\";\nexport const AGENTS_MD_DISPLAY_NAME = \"AGENTS.md (shared)\";\nexport const GLOBAL_SCOPE_LABEL = \"global\";\nexport const SHARED_INSTRUCTION_SCOPE_LABEL = \"shared\";\n\nconst LOCAL_ORIGIN_KINDS = new Set([\"local\", \"local_snapshot\", \"manual\"]);\n\nconst ORIGIN_KIND_LABELS: Record<string, string> = {\n local: \"Local\",\n marketplace_link: \"Marketplace\",\n untracked: \"Untracked\",\n};\n\nconst PACKAGE_ENTRY_FILE_NAMES = new Set([\"skill.md\", \"plugin.json\"]);\n\nexport function groupedOriginKind(originKind: string): string {\n if (LOCAL_ORIGIN_KINDS.has(originKind)) {\n return \"local\";\n }\n return originKind;\n}\n\nexport function formatOriginKindLabel(originKind: string): string {\n const grouped = groupedOriginKind(originKind);\n return ORIGIN_KIND_LABELS[grouped] ?? grouped.replaceAll(\"_\", \" \");\n}\n\nexport function formatOriginDisplayLabel(\n originKind: string,\n originRef?: string | null,\n options?: { includeRef?: boolean },\n): string {\n const kind = formatOriginKindLabel(originKind);\n const includeRef = options?.includeRef ?? true;\n const ref = originRef?.trim() ?? \"\";\n if (!includeRef || !ref) {\n return kind;\n }\n return `${kind} (${ref})`;\n}\n\nexport function isAgentsMdResource(resource: {\n name: string;\n source?: string | null;\n}): boolean {\n if (resource.name === AGENTS_INSTRUCTIONS_RESOURCE_NAME) {\n return true;\n }\n const source = (resource.source ?? \"\").replaceAll(\"\\\\\", \"/\").replace(/\\/+$/, \"\");\n if (!source) {\n return false;\n }\n return source === \"AGENTS.md\" || source.endsWith(\"/AGENTS.md\");\n}\n\nexport type ResourceDisplaySource = {\n name: string;\n type?: string | null;\n source?: string | null;\n namespace?: string | null;\n content?: string | null;\n hook?: HookDisplayInput[\"hook\"];\n metadata?: unknown;\n};\n\nfunction instructionFileName(resource: ResourceDisplaySource): string | null {\n const source = (resource.source ?? \"\").replaceAll(\"\\\\\", \"/\");\n if (source) {\n const base = source.split(\"/\").filter(Boolean).at(-1);\n if (base) {\n return base;\n }\n }\n if (isAgentsMdResource(resource)) {\n return \"AGENTS.md\";\n }\n if (resource.name === \"claude-instructions\") {\n return \"CLAUDE.md\";\n }\n if (resource.name.endsWith(\"-instructions\")) {\n return \"AGENTS.md\";\n }\n return null;\n}\n\nfunction platformNameForInstructionResource(name: string): string | null {\n if (!name.endsWith(\"-instructions\") || name === AGENTS_INSTRUCTIONS_RESOURCE_NAME) {\n return null;\n }\n const prefix = name.slice(0, -\"-instructions\".length);\n const platforms = getAllPlatforms();\n const exact = platforms.find((platform) => platform.id === prefix);\n if (exact) {\n return exact.name;\n }\n const withCli = platforms.find((platform) => platform.id === `${prefix}-cli`);\n if (withCli) {\n return withCli.name;\n }\n const withCode = platforms.find(\n (platform) => platform.id === `${prefix}-code` || platform.id.startsWith(`${prefix}-`),\n );\n if (withCode) {\n return withCode.name;\n }\n return null;\n}\n\nfunction instructionQualifier(resource: ResourceDisplaySource): string {\n const namespace = resource.namespace?.trim() ?? \"\";\n if (namespace.length > 0 && namespace !== GLOBAL_SCOPE_LABEL) {\n return namespace;\n }\n const fromName = platformNameForInstructionResource(resource.name);\n if (fromName) {\n return fromName;\n }\n return SHARED_INSTRUCTION_SCOPE_LABEL;\n}\n\nexport function formatInstructionInventoryLabel(\n resource: ResourceDisplaySource,\n): string {\n const file = instructionFileName(resource);\n if (!file) {\n return resource.name;\n }\n return `${file} (${instructionQualifier(resource)})`;\n}\n\nexport function resourceHumanName(resource: ResourceDisplaySource): string {\n if (resource.type === \"instruction\" || isAgentsMdResource(resource)) {\n return formatInstructionInventoryLabel(resource);\n }\n if (resource.type === \"hook\") {\n return formatHookInventoryLabel(hookDisplayInputFromResource(resource));\n }\n return resource.name;\n}\n\nexport type PluginDisplayOptions = {\n /** When true, plugin refs include `@marketplace` so colliding names stay distinct. */\n disambiguatePlugin?: boolean;\n};\n\n/** Plugin ref names that appear more than once. Authored plugin packages are ignored. */\nexport function duplicatePluginNames(\n resources: readonly {\n name: string;\n type?: string | null;\n listKind?: string | null;\n }[],\n): Set<string> {\n const counts = new Map<string, number>();\n for (const resource of resources) {\n if (resource.type !== \"plugin\" || resource.listKind === \"plugin-package\") {\n continue;\n }\n const name = resource.name.trim();\n if (!name) {\n continue;\n }\n counts.set(name, (counts.get(name) ?? 0) + 1);\n }\n const duplicates = new Set<string>();\n for (const [name, count] of counts) {\n if (count >= 2) {\n duplicates.add(name);\n }\n }\n return duplicates;\n}\n\nexport function formatResourceDisplayName(\n resource: ResourceDisplaySource & {\n namespace?: string | null;\n origin_ref?: string | null;\n },\n options?: PluginDisplayOptions,\n): string {\n const base = resourceHumanName(resource);\n if (resource.type === \"instruction\" || isAgentsMdResource(resource)) {\n return base;\n }\n if (resource.type === \"plugin\") {\n if (!options?.disambiguatePlugin) {\n return base;\n }\n const ref = resource.origin_ref?.trim() ?? \"\";\n if (ref.includes(\"@\")) {\n return ref;\n }\n const marketplace = resource.namespace?.trim() ?? \"\";\n return marketplace ? `${base}@${marketplace}` : base;\n }\n const namespace = resource.namespace?.trim() ?? \"\";\n return namespace ? `${base}@${namespace}` : base;\n}\n\nexport function formatResourceScopeLabel(namespace?: string | null): string {\n const ns = namespace?.trim() ?? \"\";\n return ns.length > 0 ? ns : GLOBAL_SCOPE_LABEL;\n}\n\nexport function isPackageEntryFileName(fileName: string): boolean {\n return PACKAGE_ENTRY_FILE_NAMES.has(fileName.trim().toLowerCase());\n}\n\n/** Directory shown for SKILL.md / plugin.json package entry files; otherwise the path unchanged. */\nexport function packageDirectoryDisplayPath(path: string): string {\n const trimmed = path.trim();\n if (!trimmed) {\n return trimmed;\n }\n const hasBackslash = trimmed.includes(\"\\\\\") && !trimmed.includes(\"/\");\n const separator = hasBackslash ? \"\\\\\" : \"/\";\n const normalized = trimmed.replace(/[\\\\/]+$/, \"\");\n const parts = normalized.split(/[/\\\\]/);\n const fileName = parts[parts.length - 1] ?? \"\";\n if (!isPackageEntryFileName(fileName) || parts.length < 2) {\n return trimmed;\n }\n return parts.slice(0, -1).join(separator);\n}\n\nexport function inferContainedFileType(relativePath: string): string {\n const top = relativePath.split(\"/\")[0] ?? \"\";\n switch (top) {\n case \"skills\":\n return \"skill\";\n case \"agents\":\n return \"agent\";\n case \"rules\":\n return \"rule\";\n case \"commands\":\n return \"command\";\n case \"hooks\":\n return \"hook\";\n case \"mcp\":\n return \"mcp_server\";\n default:\n return \"file\";\n }\n}\n\nexport function containedFileStem(relativePath: string): string {\n const base = relativePath.split(\"/\").at(-1) ?? relativePath;\n const dot = base.lastIndexOf(\".\");\n if (dot <= 0) {\n return base;\n }\n return base.slice(0, dot);\n}\n","import type { Resource, ResourceType } from \"../types.js\";\nimport { RESOURCE_TYPES } from \"../types.js\";\nimport * as format from \"./format.js\";\nimport {\n matchesListSearchQuery,\n parseListSearchQuery,\n} from \"./list-search.js\";\nimport {\n computeMaxVisibleTableRows,\n renderFoldedHintLine,\n resolveSectionViewport,\n VIEWPORT_CHROME_LINES,\n type SectionViewport,\n} from \"./list-viewport.js\";\nimport {\n duplicatePluginNames,\n formatResourceDisplayName,\n formatResourceScopeLabel,\n resourceHumanName,\n} from \"./resource-display.js\";\nimport { renderTable, resolveTableMaxWidth, type Column } from \"./table.js\";\nimport { theme } from \"./theme.js\";\n\nexport {\n computeMaxVisibleRows,\n computeMaxVisibleTableRows,\n resolveSectionViewport,\n type SectionViewport,\n} from \"./list-viewport.js\";\n\nexport const DEFAULT_RESOURCE_LIST_PER_TYPE_LIMIT = 10;\n\nexport type ResourceListRow = Resource & {\n namespace: string;\n display_name: string;\n};\n\nexport type ResourceListRenderOptions = {\n showId: boolean;\n showAll?: boolean;\n perTypeLimit?: number;\n selectedResourceId?: string;\n maxWidth?: number;\n};\n\nexport type PluginEditTableRow = ResourceListRow & {\n checked: boolean;\n version_constraint?: string;\n};\n\nexport type PluginEditRenderOptions = ResourceListRenderOptions & {\n activeRowId?: string;\n};\n\ntype ResourceListDisplayRow = ResourceListRow & {\n list_display_name: string;\n list_namespace: string;\n};\n\nexport function formatResourceListNamespace(resource: ResourceListRow): string {\n const ns = resource.namespace.trim();\n if (!ns) return formatResourceScopeLabel(ns);\n if (resource.origin_kind === \"marketplace_link\" && resource.origin_ref.includes(\"@\")) {\n const [plugin, marketplace] = resource.origin_ref.split(\"@\", 2);\n if (plugin && marketplace && ns === plugin) {\n return `${marketplace}/${plugin}`;\n }\n }\n return ns;\n}\n\nfunction hasListNamespace(rows: ResourceListRow[]): boolean {\n return rows.some((row) => formatResourceListNamespace(row).length > 0);\n}\n\nexport type ActiveSectionContext = {\n type: ResourceType;\n indexInSection: number;\n sectionRows: ResourceListRow[];\n prevSection?: { type: ResourceType; count: number };\n nextSection?: { type: ResourceType; count: number };\n};\n\nfunction sectionCount(navigable: ResourceListRow[], type: ResourceType): number {\n return navigable.filter((row) => row.type === type).length;\n}\n\nexport function resolveActiveSectionContext(\n navigable: ResourceListRow[],\n active: number,\n): ActiveSectionContext {\n const selected = navigable[active];\n if (!selected) {\n return { type: \"skill\", indexInSection: 0, sectionRows: [] };\n }\n const type = selected.type;\n const sectionRows = navigable.filter((row) => row.type === type);\n const indexInSection = sectionRows.findIndex((row) => row.id === selected.id);\n\n const typeIndex = RESOURCE_TYPES.indexOf(type);\n const prevSection = RESOURCE_TYPES.slice(0, typeIndex)\n .reverse()\n .map((sectionType) => ({\n type: sectionType,\n count: sectionCount(navigable, sectionType),\n }))\n .find((section) => section.count > 0);\n const nextSection = RESOURCE_TYPES.slice(typeIndex + 1)\n .map((sectionType) => ({\n type: sectionType,\n count: sectionCount(navigable, sectionType),\n }))\n .find((section) => section.count > 0);\n\n return { type, indexInSection, sectionRows, prevSection, nextSection };\n}\n\nexport type ResourceListViewportOptions = ResourceListRenderOptions & {\n activeIndex: number;\n navigable: ResourceListRow[];\n terminalRows: number;\n selectedResourceId?: string;\n};\n\nfunction clampIndex(index: number, length: number): number {\n if (length === 0) return 0;\n return Math.max(0, Math.min(index, length - 1));\n}\n\nexport function buildResourceViewportHintSegments(\n ctx: ActiveSectionContext,\n viewport: SectionViewport,\n): string[] {\n const segments: string[] = [];\n const hiddenBelow = ctx.sectionRows.length - viewport.end;\n const hiddenAbove = viewport.start;\n if (hiddenAbove > 0) {\n segments.push(`↑ ${hiddenAbove} above`);\n }\n if (hiddenBelow > 0) {\n segments.push(`↓ ${hiddenBelow} more in ${ctx.type}`);\n }\n if (ctx.nextSection) {\n segments.push(`${ctx.nextSection.type} (${ctx.nextSection.count})`);\n segments.push(\"↓ next type\");\n }\n if (viewport.start === 0 && ctx.prevSection) {\n segments.push(`${ctx.prevSection.type} (${ctx.prevSection.count})`);\n segments.push(\"↑ prev type\");\n }\n return segments;\n}\n\nfunction renderViewportOverflowHints(\n ctx: ActiveSectionContext,\n viewport: SectionViewport,\n maxWidth: number,\n): string {\n const folded = renderFoldedHintLine(\n buildResourceViewportHintSegments(ctx, viewport),\n maxWidth,\n );\n return folded.length > 0 ? theme.muted(folded) : \"\";\n}\n\nexport function renderGroupedResourceListViewport(\n resources: ResourceListRow[],\n opts: ResourceListViewportOptions,\n): string {\n if (resources.length === 0) {\n return \"No resources found.\";\n }\n\n const ctx = resolveActiveSectionContext(opts.navigable, opts.activeIndex);\n if (ctx.sectionRows.length === 0) {\n return \"No resources found.\";\n }\n\n const maxVisibleRows = computeMaxVisibleTableRows(\n opts.terminalRows,\n VIEWPORT_CHROME_LINES.resourceList,\n );\n const viewport = resolveSectionViewport(\n ctx.sectionRows.length,\n ctx.indexInSection,\n maxVisibleRows,\n );\n const visibleRows = ctx.sectionRows.slice(viewport.start, viewport.end);\n const hasNamespace = hasListNamespace(visibleRows);\n const columns = makeResourceListColumns(opts.showId, false, hasNamespace, true);\n\n const maxWidth = resolveTableMaxWidth(opts.maxWidth);\n\n return [\n renderResourceTypeSubheader(ctx.type, ctx.sectionRows.length),\n renderTable({\n columns,\n rows: decorateRowsForSelection(visibleRows, opts.selectedResourceId),\n ...resourceListTableLayout(opts),\n }),\n renderViewportOverflowHints(ctx, viewport, maxWidth),\n ]\n .filter((line) => line.length > 0)\n .join(\"\\n\");\n}\n\nexport type PluginEditViewportOptions = PluginEditRenderOptions & {\n activeIndex: number;\n navigable: PluginEditTableRow[];\n terminalRows: number;\n};\n\nexport function renderGroupedPluginEditViewport(\n rows: PluginEditTableRow[],\n opts: PluginEditViewportOptions,\n): string {\n if (rows.length === 0) {\n return \"No resources found.\";\n }\n\n const ctx = resolveActiveSectionContext(opts.navigable, opts.activeIndex);\n if (ctx.sectionRows.length === 0) {\n return \"No resources found.\";\n }\n\n const maxVisibleRows = computeMaxVisibleTableRows(\n opts.terminalRows,\n VIEWPORT_CHROME_LINES.pluginEdit,\n );\n const viewport = resolveSectionViewport(\n ctx.sectionRows.length,\n ctx.indexInSection,\n maxVisibleRows,\n );\n const visibleRows = ctx.sectionRows.slice(viewport.start, viewport.end) as PluginEditTableRow[];\n const hasNamespace = hasListNamespace(visibleRows);\n const columns = makeResourceListColumns(opts.showId, false, hasNamespace, true);\n const checkedCount = rows.filter((row) => row.checked).length;\n const maxWidth = resolveTableMaxWidth(opts.maxWidth);\n\n return [\n renderResourceTypeSubheader(ctx.type, ctx.sectionRows.length),\n renderTable({\n columns,\n rows: decorateRowsForCheckboxes(visibleRows, opts),\n ...resourceListTableLayout(opts),\n }),\n renderViewportOverflowHints(ctx, viewport, maxWidth),\n \"\",\n theme.info(`${checkedCount} selected • ${rows.length} resources`),\n ]\n .filter((line) => line.length > 0)\n .join(\"\\n\");\n}\n\nexport function renderFlatPluginEditViewport(\n rows: PluginEditTableRow[],\n opts: PluginEditViewportOptions,\n): string {\n if (rows.length === 0) {\n return \"No resources found.\";\n }\n\n const maxVisibleRows = computeMaxVisibleTableRows(\n opts.terminalRows,\n VIEWPORT_CHROME_LINES.pluginEdit,\n );\n const activeIndex = clampIndex(opts.activeIndex, opts.navigable.length);\n const viewport = resolveSectionViewport(\n opts.navigable.length,\n activeIndex,\n maxVisibleRows,\n );\n const visibleRows = opts.navigable.slice(viewport.start, viewport.end);\n const hasNamespace = hasListNamespace(visibleRows);\n const activeRowId = opts.navigable[activeIndex]?.id;\n const checkedCount = rows.filter((row) => row.checked).length;\n\n const hints: string[] = [];\n if (viewport.start > 0) {\n hints.push(theme.muted(` ↑ ${viewport.start} above`));\n }\n if (viewport.end < opts.navigable.length) {\n hints.push(theme.muted(` ↓ ${opts.navigable.length - viewport.end} more`));\n }\n\n return [\n renderTable({\n columns: makeResourceListColumns(opts.showId, false, hasNamespace, true),\n rows: decorateRowsForCheckboxes(visibleRows, { ...opts, activeRowId }),\n summary: `${checkedCount} selected ${theme.muted(`(${opts.navigable.length} resources)`)}`,\n ...resourceListTableLayout(opts),\n }),\n ...hints,\n ].join(\"\\n\");\n}\n\nexport function renderFlatResourceListViewport(\n resources: ResourceListRow[],\n opts: ResourceListViewportOptions,\n): string {\n if (resources.length === 0) {\n return \"No resources found.\";\n }\n\n const maxVisibleRows = computeMaxVisibleTableRows(\n opts.terminalRows,\n VIEWPORT_CHROME_LINES.resourceList,\n );\n const activeIndex = clampIndex(opts.activeIndex, resources.length);\n const viewport = resolveSectionViewport(resources.length, activeIndex, maxVisibleRows);\n const visibleRows = resources.slice(viewport.start, viewport.end);\n const hasNamespace = hasListNamespace(visibleRows);\n const columns = makeResourceListColumns(opts.showId, false, hasNamespace, true);\n const selectedId = resources[activeIndex]?.id;\n\n const hints: string[] = [];\n if (viewport.start > 0) {\n hints.push(theme.muted(` ↑ ${viewport.start} above`));\n }\n if (viewport.end < resources.length) {\n hints.push(theme.muted(` ↓ ${resources.length - viewport.end} more`));\n }\n\n return [\n renderTable({\n columns,\n rows: decorateRowsForSelection(visibleRows, selectedId),\n summary: `${resources.length} resources`,\n ...resourceListTableLayout(opts),\n }),\n ...hints,\n ].join(\"\\n\");\n}\n\nfunction resourceListTableLayout(opts: ResourceListRenderOptions): {\n maxWidth: number;\n wordWrap: true;\n} {\n return {\n maxWidth: resolveTableMaxWidth(opts.maxWidth),\n wordWrap: true,\n };\n}\n\nfunction makeIdColumn(showId: boolean, width = 13): Column[] {\n return showId\n ? [{\n key: \"id\",\n header: \"ID\",\n width,\n minWidth: width,\n widthShare: 0.18,\n wrapOnWordBoundary: false,\n transform: (value: string) => format.shortenId(String(value)),\n }]\n : [];\n}\n\nfunction makeResourceTypeColumn(width = 14): Column {\n return {\n key: \"type\",\n header: \"TYPE\",\n width,\n style: (value) => theme.resourceType(value),\n };\n}\n\nfunction makeResourceListColumns(\n showId: boolean,\n showType: boolean,\n hasNamespace: boolean,\n highlightSelection: boolean,\n): Column[] {\n return [\n ...makeIdColumn(showId),\n ...(showType ? [makeResourceTypeColumn()] : []),\n {\n key: \"list_display_name\",\n header: \"NAME\",\n width: 28,\n widthShare: 0.45,\n wrapOnWordBoundary: false,\n style: highlightSelection\n ? (value) => (value.startsWith(\"> \") ? theme.accent(value) : value)\n : undefined,\n },\n ...(hasNamespace\n ? [{\n key: \"list_namespace\",\n header: \"NAMESPACE\",\n width: 20,\n widthShare: 0.3,\n style: (value: string) =>\n value ? theme.path(value) : theme.muted(\": \"),\n } as const]\n : []),\n {\n key: \"updated_at\",\n header: \"UPDATED\",\n width: 16,\n fitContent: true,\n transform: (value) => format.formatRelativeTime(String(value)),\n style: (value) => theme.muted(value),\n },\n ];\n}\n\nexport function toResourceListRows(resources: Resource[]): ResourceListRow[] {\n const collidingNames = duplicatePluginNames(resources);\n return resources.map((resource) => ({\n ...resource,\n namespace: resource.namespace ?? \"\",\n display_name: formatResourceDisplayName(resource, {\n disambiguatePlugin: collidingNames.has(resource.name),\n }),\n }));\n}\n\nexport function sortResourcesByUpdatedAt<T extends Pick<Resource, \"updated_at\">>(\n resources: T[],\n): T[] {\n return [...resources].sort(\n (left, right) => Date.parse(right.updated_at) - Date.parse(left.updated_at),\n );\n}\n\nexport function filterResourcesBySearch(\n resources: ResourceListRow[],\n search: string,\n): ResourceListRow[] {\n const parsed = parseListSearchQuery(search);\n if (parsed.raw.length === 0) {\n return resources;\n }\n\n const sectionIsResourceType =\n parsed.section !== undefined\n && (RESOURCE_TYPES as readonly string[]).includes(parsed.section);\n\n const textQuery = sectionIsResourceType\n ? parsed\n : parsed.section !== undefined\n ? { section: undefined, text: parsed.raw, raw: parsed.raw }\n : parsed;\n\n return resources.filter((resource) => {\n if (sectionIsResourceType && resource.type !== parsed.section) {\n return false;\n }\n const haystack = `${resource.name} ${resource.description ?? \"\"} ${resource.display_name} ${formatResourceListNamespace(resource)}`;\n return matchesListSearchQuery(haystack, textQuery);\n });\n}\n\nexport function filterPluginEditRowsBySearch(\n rows: PluginEditTableRow[],\n search: string,\n): PluginEditTableRow[] {\n const normalizedSearch = search.trim().toLowerCase();\n if (normalizedSearch.length === 0) {\n return rows;\n }\n\n return rows.filter((row) =>\n `${row.name} ${row.description ?? \"\"} ${row.display_name} ${row.version_constraint ?? \"\"}`\n .toLowerCase()\n .includes(normalizedSearch),\n );\n}\n\nfunction sortPluginEditRowsForDisplay(rows: PluginEditTableRow[]): PluginEditTableRow[] {\n return [...rows].sort((left, right) => {\n if (left.checked !== right.checked) {\n return left.checked ? -1 : 1;\n }\n return Date.parse(right.updated_at) - Date.parse(left.updated_at);\n });\n}\n\nfunction renderResourceTypeSubheader(type: ResourceType, count: number): string {\n return `${theme.resourceType(type)} ${theme.muted(`(${count})`)}`;\n}\n\nfunction resolvePerTypeLimit(opts: ResourceListRenderOptions): number | undefined {\n if (opts.showAll) {\n return undefined;\n }\n return opts.perTypeLimit ?? DEFAULT_RESOURCE_LIST_PER_TYPE_LIMIT;\n}\n\nfunction limitRows<T extends { id: string }>(\n rows: T[],\n limit: number | undefined,\n selectedResourceId?: string,\n): {\n visible: T[];\n hiddenCount: number;\n} {\n if (limit === undefined || rows.length <= limit) {\n return { visible: rows, hiddenCount: 0 };\n }\n\n let visible = rows.slice(0, limit);\n if (\n selectedResourceId\n && !visible.some((row) => row.id === selectedResourceId)\n ) {\n const selected = rows.find((row) => row.id === selectedResourceId);\n if (selected) {\n visible = [...visible.slice(0, Math.max(0, limit - 1)), selected];\n }\n }\n\n const hiddenCount = rows.length - visible.length;\n return { visible, hiddenCount };\n}\n\nexport function listNavigableResources(\n resources: ResourceListRow[],\n typeFilter?: ResourceType,\n): ResourceListRow[] {\n if (typeFilter) {\n return sortResourcesByUpdatedAt(\n resources.filter((resource) => resource.type === typeFilter),\n );\n }\n\n const ordered: ResourceListRow[] = [];\n for (const type of RESOURCE_TYPES) {\n ordered.push(\n ...sortResourcesByUpdatedAt(\n resources.filter((resource) => resource.type === type),\n ),\n );\n }\n return ordered;\n}\n\nfunction decorateRowsForCheckboxes(\n rows: PluginEditTableRow[],\n opts: PluginEditRenderOptions,\n): ResourceListDisplayRow[] {\n return rows.map((row) => {\n const checkbox = row.checked ? \"[x]\" : \"[ ]\";\n const cursor = row.id === opts.activeRowId ? \">\" : \" \";\n const constraint =\n row.checked && row.version_constraint\n ? ` (${row.version_constraint})`\n : \"\";\n return {\n ...row,\n list_display_name: `${cursor}${checkbox} ${resourceHumanName(row)}${constraint}`,\n list_namespace: formatResourceListNamespace(row),\n };\n });\n}\n\nexport function listNavigablePluginEditRows(\n rows: PluginEditTableRow[],\n typeFilter?: ResourceType,\n): PluginEditTableRow[] {\n if (typeFilter) {\n return sortPluginEditRowsForDisplay(\n rows.filter((row) => row.type === typeFilter),\n );\n }\n\n const ordered: PluginEditTableRow[] = [];\n for (const type of RESOURCE_TYPES) {\n ordered.push(\n ...sortPluginEditRowsForDisplay(\n rows.filter((row) => row.type === type),\n ),\n );\n }\n return ordered;\n}\n\nexport function renderGroupedPluginEditTables(\n rows: PluginEditTableRow[],\n opts: PluginEditRenderOptions,\n): string {\n if (rows.length === 0) {\n return \"No resources found.\";\n }\n\n const hasNamespace = hasListNamespace(rows);\n const columns = makeResourceListColumns(opts.showId, false, hasNamespace, true);\n const perTypeLimit = resolvePerTypeLimit(opts);\n const lines: string[] = [];\n let wroteSection = false;\n\n for (const type of RESOURCE_TYPES) {\n const typeRows = sortPluginEditRowsForDisplay(\n rows.filter((row) => row.type === type),\n );\n if (typeRows.length === 0) {\n continue;\n }\n const { visible, hiddenCount } = limitRows(\n typeRows,\n perTypeLimit,\n opts.activeRowId,\n );\n if (wroteSection) {\n lines.push(\"\");\n }\n wroteSection = true;\n lines.push(renderResourceTypeSubheader(type, typeRows.length));\n lines.push(renderTable({\n columns,\n rows: decorateRowsForCheckboxes(visible, opts),\n ...resourceListTableLayout(opts),\n }));\n if (hiddenCount > 0) {\n lines.push(renderHiddenRowsHint(hiddenCount));\n }\n }\n\n const checkedCount = rows.filter((row) => row.checked).length;\n lines.push(\"\");\n lines.push(theme.info(`${checkedCount} selected • ${rows.length} resources`));\n return lines.join(\"\\n\");\n}\n\nexport function renderFlatPluginEditTable(\n rows: PluginEditTableRow[],\n opts: PluginEditRenderOptions,\n): string {\n if (rows.length === 0) {\n return \"No resources found.\";\n }\n\n const hasNamespace = hasListNamespace(rows);\n const sortedRows = sortPluginEditRowsForDisplay(rows);\n const perTypeLimit = resolvePerTypeLimit(opts);\n const { visible, hiddenCount } = limitRows(\n sortedRows,\n perTypeLimit,\n opts.activeRowId,\n );\n const checkedCount = rows.filter((row) => row.checked).length;\n const lines = [\n renderTable({\n columns: makeResourceListColumns(opts.showId, false, hasNamespace, true),\n rows: decorateRowsForCheckboxes(visible, opts),\n summary: `${checkedCount} selected ${theme.muted(`(${sortedRows.length} resources)`)}`,\n ...resourceListTableLayout(opts),\n }),\n ];\n if (hiddenCount > 0) {\n lines.push(renderHiddenRowsHint(hiddenCount));\n }\n return lines.join(\"\\n\");\n}\n\nfunction decorateRowsForSelection(\n rows: ResourceListRow[],\n selectedResourceId?: string,\n): ResourceListDisplayRow[] {\n return rows.map((row) => ({\n ...row,\n list_display_name: row.id === selectedResourceId\n ? `> ${resourceHumanName(row)}`\n : ` ${resourceHumanName(row)}`,\n list_namespace: formatResourceListNamespace(row),\n }));\n}\n\nexport function formatResourceSelectionLabel(resource: ResourceListRow): string {\n return `${resource.type} ${resourceHumanName(resource)}`;\n}\n\nfunction renderHiddenRowsHint(hiddenCount: number): string {\n return theme.muted(\n ` ... and ${hiddenCount} more ${hiddenCount === 1 ? \"resource\" : \"resources\"} (use --all to show all)`,\n );\n}\n\nexport function renderGroupedResourceListTables(\n resources: ResourceListRow[],\n opts: ResourceListRenderOptions,\n): string {\n if (resources.length === 0) {\n return \"No resources found.\";\n }\n\n const hasNamespace = hasListNamespace(resources);\n const highlightSelection = Boolean(opts.selectedResourceId);\n const columns = makeResourceListColumns(opts.showId, false, hasNamespace, highlightSelection);\n const perTypeLimit = resolvePerTypeLimit(opts);\n const lines: string[] = [];\n let wroteSection = false;\n\n for (const type of RESOURCE_TYPES) {\n const rows = sortResourcesByUpdatedAt(\n resources.filter((resource) => resource.type === type),\n );\n if (rows.length === 0) {\n continue;\n }\n const { visible, hiddenCount } = limitRows(\n rows,\n perTypeLimit,\n opts.selectedResourceId,\n );\n if (wroteSection) {\n lines.push(\"\");\n }\n wroteSection = true;\n lines.push(renderResourceTypeSubheader(type, rows.length));\n lines.push(renderTable({\n columns,\n rows: decorateRowsForSelection(visible, opts.selectedResourceId),\n ...resourceListTableLayout(opts),\n }));\n if (hiddenCount > 0) {\n lines.push(renderHiddenRowsHint(hiddenCount));\n }\n }\n\n lines.push(\"\");\n lines.push(theme.info(`${resources.length} resources`));\n return lines.join(\"\\n\");\n}\n\nexport function renderFlatResourceListTable(\n resources: ResourceListRow[],\n opts: ResourceListRenderOptions,\n): string {\n if (resources.length === 0) {\n return \"No resources found.\";\n }\n\n const hasNamespace = hasListNamespace(resources);\n const sortedRows = sortResourcesByUpdatedAt(resources);\n const perTypeLimit = resolvePerTypeLimit(opts);\n const highlightSelection = Boolean(opts.selectedResourceId);\n const { visible, hiddenCount } = limitRows(\n sortedRows,\n perTypeLimit,\n opts.selectedResourceId,\n );\n const lines = [\n renderTable({\n columns: makeResourceListColumns(opts.showId, false, hasNamespace, highlightSelection),\n rows: decorateRowsForSelection(visible, opts.selectedResourceId),\n summary: `${sortedRows.length} resources`,\n ...resourceListTableLayout(opts),\n }),\n ];\n if (hiddenCount > 0) {\n lines.push(renderHiddenRowsHint(hiddenCount));\n }\n return lines.join(\"\\n\");\n}\n","import { resolveHomeRoot } from \"./home-root.js\";\n\n/**\n * Show a path under the home directory as `~/...`.\n * Paths outside home are unchanged.\n */\nexport function shortenHomePath(path: string, home = resolveHomeRoot()): string {\n const trimmed = path.trim();\n if (!trimmed || trimmed === \"~\" || trimmed.startsWith(\"~/\")) {\n return trimmed;\n }\n const normalized = trimmed.replaceAll(\"\\\\\", \"/\");\n const homeNorm = home.trim().replaceAll(\"\\\\\", \"/\").replace(/\\/+$/, \"\");\n if (homeNorm.length < 2) {\n return trimmed;\n }\n if (normalized === hom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7C,QAAM,qBAAqB,QAAQ,KAAK,kBAAkB;AAC1D,QAAM,EAAE,SAAS,YAAY,IAAI;AAAA,IAC/B;AAAA,IACA;AAAA,IACA,KAAK;AAAA,EACP;AACA,QAAM,QAAQ;AAAA,IACZ,YAAY;AAAA,MACV,SAAS,wBAAwB,KAAK,QAAQ,OAAO,cAAc,kBAAkB;AAAA,MACrF,MAAM,yBAAyB,SAAS,KAAK,kBAAkB;AAAA,MAC/D,SAAS,GAAG,WAAW,MAAM;AAAA,MAC7B,GAAG,wBAAwB,IAAI;AAAA,IACjC,CAAC;AAAA,EACH;AACA,MAAI,cAAc,GAAG;AACnB,UAAM,KAAK,qBAAqB,WAAW,CAAC;AAAA,EAC9C;AACA,SAAO,MAAM,KAAK,IAAI;AACxB;;;AC9uBO,SAAS,gBAAgB,MAAc,OAAO,gBAAgB,GAAW;AAC9E,QAAM,UAAU,KAAK,KAAK;AAC1B,MAAI,CAAC,WAAW,YAAY,OAAO,QAAQ,WAAW,IAAI,GAAG;AAC3D,WAAO;AAAA,EACT;AACA,QAAM,aAAa,QAAQ,WAAW,MAAM,GAAG;AAC/C,QAAM,WAAW,KAAK,KAAK,EAAE,WAAW,MAAM,GAAG,EAAE,QAAQ,QAAQ,EAAE;AACrE,MAAI,SAAS,SAAS,GAAG;AACvB,WAAO;AAAA,EACT;AACA,MAAI,eAAe,UAAU;AAC3B,WAAO;AAAA,EACT;AACA,MAAI,WAAW,WAAW,GAAG,QAAQ,GAAG,GAAG;AACzC,WAAO,IAAI,WAAW,MAAM,SAAS,MAAM,CAAC;AAAA,EAC9C;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
terminalColumns,
|
|
3
3
|
terminalRows
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2A36HWDE.js";
|
|
5
5
|
|
|
6
6
|
// src/services/wizards/prompts/hooks/use-terminal-size.ts
|
|
7
7
|
import { useEffect, useState } from "@inquirer/core";
|
|
@@ -38,4 +38,4 @@ function useTerminalSize() {
|
|
|
38
38
|
export {
|
|
39
39
|
useTerminalSize
|
|
40
40
|
};
|
|
41
|
-
//# sourceMappingURL=chunk-
|
|
41
|
+
//# sourceMappingURL=chunk-UVVZHWD2.js.map
|