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 @@
1
+ {"version":3,"sources":["../src/ui/resource-display.ts","../src/ui/resource-list-render.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),\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B,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;","names":[]}
@@ -0,0 +1,172 @@
1
+ import {
2
+ executeProjectUse,
3
+ printApplyPayload
4
+ } from "./chunk-KDAV2GUT.js";
5
+ import {
6
+ MISSING_PROJECT_CONFIG_MESSAGE
7
+ } from "./chunk-VZQG2JDV.js";
8
+ import {
9
+ initializeSchema
10
+ } from "./chunk-IK524ZDW.js";
11
+ import {
12
+ findProjectConfig,
13
+ resolveProfileEnvironment
14
+ } from "./chunk-3IZ7SEGT.js";
15
+ import {
16
+ parseOutputFormat,
17
+ printJson
18
+ } from "./chunk-TQ2NA4Z4.js";
19
+ import {
20
+ formatCount,
21
+ ui
22
+ } from "./chunk-YDD3ES2K.js";
23
+ import {
24
+ getDb
25
+ } from "./chunk-DWVAR4BP.js";
26
+
27
+ // src/services/use-command.ts
28
+ import { resolve } from "path";
29
+ function profileTarget(entry) {
30
+ switch (entry.source) {
31
+ case "catalog":
32
+ case "local":
33
+ return entry.selector ?? "";
34
+ case "inline":
35
+ return entry.plugin ?? "";
36
+ default: {
37
+ const unhandledSource = entry.source;
38
+ throw new Error(`Unhandled profile source: ${unhandledSource}`);
39
+ }
40
+ }
41
+ }
42
+ function buildProjectProfileListRows(config) {
43
+ return config.profiles.map((entry) => ({
44
+ profile: entry.name,
45
+ source: entry.source,
46
+ target: profileTarget(entry),
47
+ environment: resolveProfileEnvironment(config, entry) ?? "",
48
+ default: entry.name === config.default_profile ? "*" : ""
49
+ }));
50
+ }
51
+ function listProjectProfiles(config, format) {
52
+ const rows = buildProjectProfileListRows(config);
53
+ if (format === "json") {
54
+ printJson(
55
+ rows.map((row) => ({
56
+ profile: row.profile,
57
+ source: row.source,
58
+ selector_or_plugin: row.target,
59
+ environment: row.environment || void 0,
60
+ default: row.default === "*"
61
+ }))
62
+ );
63
+ return;
64
+ }
65
+ if (rows.length === 0) {
66
+ ui.dim("No profiles configured in project config.");
67
+ return;
68
+ }
69
+ ui.table.print({
70
+ columns: [
71
+ { key: "profile", header: "PROFILE", width: 16 },
72
+ { key: "source", header: "SOURCE", width: 10 },
73
+ { key: "target", header: "SELECTOR/PLUGIN", width: 24 },
74
+ { key: "environment", header: "ENVIRONMENT", width: 16 },
75
+ { key: "default", header: "", width: 2 }
76
+ ],
77
+ rows,
78
+ summary: formatCount(rows.length, "profile")
79
+ });
80
+ }
81
+ function renderProjectUseHuman(result) {
82
+ if (result.skipped) {
83
+ const environmentSuffix = result.environment_name ? ` with environment ${ui.theme.accent(result.environment_name)}` : "";
84
+ ui.info(
85
+ `Profile ${ui.theme.accent(result.profile_key)} (${result.plugin_name}) is already active and in sync${environmentSuffix}.`
86
+ );
87
+ return;
88
+ }
89
+ if (result.cancelled) {
90
+ process.exitCode = 1;
91
+ ui.warn("Profile apply cancelled.");
92
+ return;
93
+ }
94
+ if (result.environment_name) {
95
+ ui.info(`Environment: ${ui.theme.accent(result.environment_name)}`);
96
+ }
97
+ if ((result.pulled_plugins?.length ?? 0) > 0) {
98
+ ui.info(`Pulled ${result.pulled_plugins?.length ?? 0} missing plugin dependencies:`);
99
+ for (const pulled of result.pulled_plugins ?? []) {
100
+ console.log(` - ${pulled.plugin_name} (${pulled.source})`);
101
+ }
102
+ }
103
+ printApplyPayload(result);
104
+ }
105
+ function toProjectUseOptions(opts) {
106
+ return {
107
+ profile: opts.profile,
108
+ project: opts.project,
109
+ dryRun: opts.dryRun,
110
+ force: opts.force,
111
+ pull: opts.pull,
112
+ harness: opts.harness,
113
+ account: opts.account,
114
+ baseUrl: opts.baseUrl,
115
+ onConflict: opts.onConflict,
116
+ format: opts.format,
117
+ interactive: opts.interactive,
118
+ noInteractive: opts.noInteractive
119
+ };
120
+ }
121
+ async function handleUseCommand(opts) {
122
+ const db = getDb();
123
+ initializeSchema(db);
124
+ const format = parseOutputFormat(opts.format);
125
+ const projectPath = resolve(opts.project ?? process.cwd());
126
+ if (opts.list) {
127
+ const config = findProjectConfig(projectPath);
128
+ if (!config) {
129
+ process.exitCode = 1;
130
+ ui.danger(MISSING_PROJECT_CONFIG_MESSAGE);
131
+ return;
132
+ }
133
+ listProjectProfiles(config, format);
134
+ return;
135
+ }
136
+ try {
137
+ const result = await executeProjectUse({
138
+ ...toProjectUseOptions({ ...opts, project: projectPath })
139
+ });
140
+ if (format === "json") {
141
+ printJson(result);
142
+ return;
143
+ }
144
+ renderProjectUseHuman(result);
145
+ } catch (err) {
146
+ process.exitCode = 1;
147
+ ui.danger(err instanceof Error ? err.message : String(err));
148
+ }
149
+ }
150
+ function mapProfileUseDelegationOptions(opts) {
151
+ return {
152
+ profile: opts.profile,
153
+ project: opts.project,
154
+ dryRun: opts.dryRun,
155
+ force: opts.force,
156
+ pull: opts.pull,
157
+ harness: opts.harness,
158
+ account: opts.account,
159
+ baseUrl: opts.baseUrl,
160
+ onConflict: opts.onConflict,
161
+ format: opts.format,
162
+ interactive: opts.interactive,
163
+ noInteractive: opts.noInteractive
164
+ };
165
+ }
166
+
167
+ export {
168
+ renderProjectUseHuman,
169
+ handleUseCommand,
170
+ mapProfileUseDelegationOptions
171
+ };
172
+ //# sourceMappingURL=chunk-BSOBXLYI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/services/use-command.ts"],"sourcesContent":["import { resolve } from \"node:path\";\nimport { getDb } from \"../db/connection.js\";\nimport { initializeSchema } from \"../db/schema.js\";\nimport { ui } from \"../ui/index.js\";\nimport { printApplyPayload } from \"../cli/print-apply-summary.js\";\nimport { formatCount } from \"../copy/plurals.js\";\nimport { parseOutputFormat, printJson } from \"../utils/output-format.js\";\nimport { MISSING_PROJECT_CONFIG_MESSAGE } from \"./project-config-messages.js\";\nimport {\n executeProjectUse,\n type ProjectUseOptions,\n type ProjectUseResult,\n} from \"./project-config-use.js\";\nimport {\n findProjectConfig,\n resolveProfileEnvironment,\n type ProjectProfileEntry,\n type ResolvedProjectConfig,\n} from \"./project-config.js\";\n\nexport interface UseCommandOptions {\n profile?: string;\n project?: string;\n list?: boolean;\n dryRun?: boolean;\n force?: boolean;\n pull?: boolean;\n harness?: string;\n account?: string;\n baseUrl?: string;\n onConflict?: string;\n interactive?: boolean;\n noInteractive?: boolean;\n format?: string;\n}\n\ninterface ProjectProfileListRow {\n profile: string;\n source: string;\n target: string;\n environment: string;\n default: string;\n}\n\nfunction profileTarget(entry: ProjectProfileEntry): string {\n switch (entry.source) {\n case \"catalog\":\n case \"local\":\n return entry.selector ?? \"\";\n case \"inline\":\n return entry.plugin ?? \"\";\n default: {\n const unhandledSource: never = entry.source;\n throw new Error(`Unhandled profile source: ${unhandledSource}`);\n }\n }\n}\n\nfunction buildProjectProfileListRows(config: ResolvedProjectConfig): ProjectProfileListRow[] {\n return config.profiles.map((entry) => ({\n profile: entry.name,\n source: entry.source,\n target: profileTarget(entry),\n environment: resolveProfileEnvironment(config, entry) ?? \"\",\n default: entry.name === config.default_profile ? \"*\" : \"\",\n }));\n}\n\nfunction listProjectProfiles(config: ResolvedProjectConfig, format: \"human\" | \"json\"): void {\n const rows = buildProjectProfileListRows(config);\n\n if (format === \"json\") {\n printJson(\n rows.map((row) => ({\n profile: row.profile,\n source: row.source,\n selector_or_plugin: row.target,\n environment: row.environment || undefined,\n default: row.default === \"*\",\n })),\n );\n return;\n }\n\n if (rows.length === 0) {\n ui.dim(\"No profiles configured in project config.\");\n return;\n }\n\n ui.table.print({\n columns: [\n { key: \"profile\", header: \"PROFILE\", width: 16 },\n { key: \"source\", header: \"SOURCE\", width: 10 },\n { key: \"target\", header: \"SELECTOR/PLUGIN\", width: 24 },\n { key: \"environment\", header: \"ENVIRONMENT\", width: 16 },\n { key: \"default\", header: \"\", width: 2 },\n ],\n rows,\n summary: formatCount(rows.length, \"profile\"),\n });\n}\n\nexport function renderProjectUseHuman(result: ProjectUseResult): void {\n if (result.skipped) {\n const environmentSuffix = result.environment_name\n ? ` with environment ${ui.theme.accent(result.environment_name)}`\n : \"\";\n ui.info(\n `Profile ${ui.theme.accent(result.profile_key)} (${result.plugin_name}) is already active and in sync${environmentSuffix}.`,\n );\n return;\n }\n\n if (result.cancelled) {\n process.exitCode = 1;\n ui.warn(\"Profile apply cancelled.\");\n return;\n }\n\n if (result.environment_name) {\n ui.info(`Environment: ${ui.theme.accent(result.environment_name)}`);\n }\n if ((result.pulled_plugins?.length ?? 0) > 0) {\n ui.info(`Pulled ${result.pulled_plugins?.length ?? 0} missing plugin dependencies:`);\n for (const pulled of result.pulled_plugins ?? []) {\n console.log(` - ${pulled.plugin_name} (${pulled.source})`);\n }\n }\n printApplyPayload(result);\n}\n\nfunction toProjectUseOptions(opts: UseCommandOptions): ProjectUseOptions {\n return {\n profile: opts.profile,\n project: opts.project,\n dryRun: opts.dryRun,\n force: opts.force,\n pull: opts.pull,\n harness: opts.harness,\n account: opts.account,\n baseUrl: opts.baseUrl,\n onConflict: opts.onConflict,\n format: opts.format,\n interactive: opts.interactive,\n noInteractive: opts.noInteractive,\n };\n}\n\nexport async function handleUseCommand(opts: UseCommandOptions): Promise<void> {\n const db = getDb();\n initializeSchema(db);\n const format = parseOutputFormat(opts.format);\n const projectPath = resolve(opts.project ?? process.cwd());\n\n if (opts.list) {\n const config = findProjectConfig(projectPath);\n if (!config) {\n process.exitCode = 1;\n ui.danger(MISSING_PROJECT_CONFIG_MESSAGE);\n return;\n }\n listProjectProfiles(config, format);\n return;\n }\n\n try {\n const result = await executeProjectUse({\n ...toProjectUseOptions({ ...opts, project: projectPath }),\n });\n if (format === \"json\") {\n printJson(result);\n return;\n }\n renderProjectUseHuman(result);\n } catch (err) {\n process.exitCode = 1;\n ui.danger(err instanceof Error ? err.message : String(err));\n }\n}\n\nexport function mapProfileUseDelegationOptions(opts: {\n profile?: string;\n project?: string;\n dryRun?: boolean;\n harness?: string;\n onConflict?: string;\n account?: string;\n baseUrl?: string;\n pull?: boolean;\n force?: boolean;\n interactive?: boolean;\n noInteractive?: boolean;\n format?: string;\n}): ProjectUseOptions {\n return {\n profile: opts.profile,\n project: opts.project,\n dryRun: opts.dryRun,\n force: opts.force,\n pull: opts.pull,\n harness: opts.harness,\n account: opts.account,\n baseUrl: opts.baseUrl,\n onConflict: opts.onConflict,\n format: opts.format,\n interactive: opts.interactive,\n noInteractive: opts.noInteractive,\n };\n}\n\nexport async function handleProfileUseProjectDelegation(\n opts: Parameters<typeof mapProfileUseDelegationOptions>[0],\n): Promise<boolean> {\n const config = findProjectConfig(resolve(opts.project ?? process.cwd()));\n if (!config) {\n return false;\n }\n\n const format = parseOutputFormat(opts.format);\n try {\n const result = await executeProjectUse(mapProfileUseDelegationOptions(opts));\n if (format === \"json\") {\n printJson(result);\n return true;\n }\n renderProjectUseHuman(result);\n return true;\n } catch (err) {\n process.exitCode = 1;\n ui.danger(err instanceof Error ? err.message : String(err));\n return true;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,eAAe;AA4CxB,SAAS,cAAc,OAAoC;AACzD,UAAQ,MAAM,QAAQ;AAAA,IACpB,KAAK;AAAA,IACL,KAAK;AACH,aAAO,MAAM,YAAY;AAAA,IAC3B,KAAK;AACH,aAAO,MAAM,UAAU;AAAA,IACzB,SAAS;AACP,YAAM,kBAAyB,MAAM;AACrC,YAAM,IAAI,MAAM,6BAA6B,eAAe,EAAE;AAAA,IAChE;AAAA,EACF;AACF;AAEA,SAAS,4BAA4B,QAA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,EACF;AAEA,MAAI;AACF,UAAM,SAAS,MAAM,kBAAkB;AAAA,MACrC,GAAG,oBAAoB,EAAE,GAAG,MAAM,SAAS,YAAY,CAAC;AAAA,IAC1D,CAAC;AACD,QAAI,WAAW,QAAQ;AACrB,gBAAU,MAAM;AAChB;AAAA,IACF;AACA,0BAAsB,MAAM;AAAA,EAC9B,SAAS,KAAK;AACZ,YAAQ,WAAW;AACnB,OAAG,OAAO,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAAA,EAC5D;AACF;AAEO,SAAS,+BAA+B,MAazB;AACpB,SAAO;AAAA,IACL,SAAS,KAAK;AAAA,IACd,SAAS,KAAK;AAAA,IACd,QAAQ,KAAK;AAAA,IACb,OAAO,KAAK;AAAA,IACZ,MAAM,KAAK;AAAA,IACX,SAAS,KAAK;AAAA,IACd,SAAS,KAAK;AAAA,IACd,SAAS,KAAK;AAAA,IACd,YAAY,KAAK;AAAA,IACjB,QAAQ,KAAK;AAAA,IACb,aAAa,KAAK;AAAA,IAClB,eAAe,KAAK;AAAA,EACtB;AACF;","names":[]}
@@ -0,0 +1,32 @@
1
+ import {
2
+ createProgress,
3
+ isTty
4
+ } from "./chunk-YDD3ES2K.js";
5
+ import {
6
+ DEVICE_LOGIN_WAITING
7
+ } from "./chunk-DWVAR4BP.js";
8
+
9
+ // src/services/device-login-prompt.ts
10
+ function printDeviceLoginInstructions(input) {
11
+ console.log(`Visit: ${input.verificationUri}`);
12
+ console.log(`Code: ${input.userCode}`);
13
+ if (isTty() && process.env.NODE_ENV !== "test") {
14
+ return createProgress(DEVICE_LOGIN_WAITING);
15
+ }
16
+ console.log(DEVICE_LOGIN_WAITING);
17
+ return {
18
+ succeed() {
19
+ },
20
+ fail() {
21
+ },
22
+ stop() {
23
+ },
24
+ update() {
25
+ }
26
+ };
27
+ }
28
+
29
+ export {
30
+ printDeviceLoginInstructions
31
+ };
32
+ //# sourceMappingURL=chunk-C4QBVVEH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/services/device-login-prompt.ts"],"sourcesContent":["import { DEVICE_LOGIN_WAITING } from \"../copy/cli.js\";\nimport { createProgress, type ProgressHandle } from \"../ui/progress.js\";\nimport { isTty } from \"../ui/theme.js\";\n\nexport { DEVICE_LOGIN_WAITING };\n\nexport function printDeviceLoginInstructions(input: {\n verificationUri: string;\n userCode: string;\n}): ProgressHandle {\n console.log(`Visit: ${input.verificationUri}`);\n console.log(`Code: ${input.userCode}`);\n if (isTty() && process.env.NODE_ENV !== \"test\") {\n return createProgress(DEVICE_LOGIN_WAITING);\n }\n console.log(DEVICE_LOGIN_WAITING);\n return {\n succeed() {},\n fail() {},\n stop() {},\n update() {},\n };\n}\n"],"mappings":";;;;;;;;;AAMO,SAAS,6BAA6B,OAG1B;AACjB,UAAQ,IAAI,UAAU,MAAM,eAAe,EAAE;AAC7C,UAAQ,IAAI,UAAU,MAAM,QAAQ,EAAE;AACtC,MAAI,MAAM,KAAK,QAAQ,IAAI,aAAa,QAAQ;AAC9C,WAAO,eAAe,oBAAoB;AAAA,EAC5C;AACA,UAAQ,IAAI,oBAAoB;AAChC,SAAO;AAAA,IACL,UAAU;AAAA,IAAC;AAAA,IACX,OAAO;AAAA,IAAC;AAAA,IACR,OAAO;AAAA,IAAC;AAAA,IACR,SAAS;AAAA,IAAC;AAAA,EACZ;AACF;","names":[]}
@@ -0,0 +1,283 @@
1
+ // src/services/export/license.ts
2
+ import { existsSync, lstatSync, readFileSync } from "fs";
3
+ import { dirname, join } from "path";
4
+ import { parse as parseYaml } from "yaml";
5
+
6
+ // src/services/export/spdx-ids.ts
7
+ var SPDX_LICENSE_IDS = /* @__PURE__ */ new Set([
8
+ "0BSD",
9
+ "AAL",
10
+ "AFL-1.1",
11
+ "AFL-1.2",
12
+ "AFL-2.0",
13
+ "AFL-2.1",
14
+ "AFL-3.0",
15
+ "AGPL-1.0-only",
16
+ "AGPL-1.0-or-later",
17
+ "AGPL-3.0",
18
+ "AGPL-3.0-only",
19
+ "AGPL-3.0-or-later",
20
+ "Apache-1.0",
21
+ "Apache-1.1",
22
+ "Apache-2.0",
23
+ "APL-1.0",
24
+ "APSL-1.0",
25
+ "APSL-1.1",
26
+ "APSL-1.2",
27
+ "APSL-2.0",
28
+ "Artistic-1.0",
29
+ "Artistic-1.0-cl8",
30
+ "Artistic-1.0-Perl",
31
+ "Artistic-2.0",
32
+ "BlueOak-1.0.0",
33
+ "BSD-1-Clause",
34
+ "BSD-2-Clause",
35
+ "BSD-2-Clause-Patent",
36
+ "BSD-3-Clause",
37
+ "BSD-3-Clause-Clear",
38
+ "BSD-3-Clause-LBNL",
39
+ "BSD-4-Clause",
40
+ "BSD-4-Clause-UC",
41
+ "BSL-1.0",
42
+ "CC-BY-4.0",
43
+ "CC-BY-SA-4.0",
44
+ "CC0-1.0",
45
+ "CDDL-1.0",
46
+ "CDDL-1.1",
47
+ "CPL-1.0",
48
+ "EPL-1.0",
49
+ "EPL-2.0",
50
+ "EUPL-1.1",
51
+ "EUPL-1.2",
52
+ "GPL-2.0",
53
+ "GPL-2.0-only",
54
+ "GPL-2.0-or-later",
55
+ "GPL-3.0",
56
+ "GPL-3.0-only",
57
+ "GPL-3.0-or-later",
58
+ "HPND",
59
+ "ICU",
60
+ "IJG",
61
+ "ISC",
62
+ "LGPL-2.0-only",
63
+ "LGPL-2.0-or-later",
64
+ "LGPL-2.1",
65
+ "LGPL-2.1-only",
66
+ "LGPL-2.1-or-later",
67
+ "LGPL-3.0",
68
+ "LGPL-3.0-only",
69
+ "LGPL-3.0-or-later",
70
+ "Libpng",
71
+ "libpng-2.0",
72
+ "Lil-1.0",
73
+ "LPPL-1.3c",
74
+ "MIT",
75
+ "MIT-0",
76
+ "MIT-CMU",
77
+ "MIT-Modern-Variant",
78
+ "MPL-1.0",
79
+ "MPL-1.1",
80
+ "MPL-2.0",
81
+ "MPL-2.0-no-copyleft-exception",
82
+ "MS-PL",
83
+ "MS-RL",
84
+ "NCSA",
85
+ "OFL-1.0",
86
+ "OFL-1.1",
87
+ "OSL-3.0",
88
+ "PostgreSQL",
89
+ "Python-2.0",
90
+ "Ruby",
91
+ "Unlicense",
92
+ "UPL-1.0",
93
+ "W3C",
94
+ "WTFPL",
95
+ "X11",
96
+ "Zlib",
97
+ "ZPL-2.0",
98
+ "ZPL-2.1"
99
+ ]);
100
+ var SPDX_EXCEPTION_IDS = /* @__PURE__ */ new Set([
101
+ "Autoconf-exception-2.0",
102
+ "Autoconf-exception-3.0",
103
+ "Bison-exception-2.2",
104
+ "Classpath-exception-2.0",
105
+ "Font-exception-2.0",
106
+ "GCC-exception-2.0",
107
+ "GCC-exception-3.1",
108
+ "Libtool-exception",
109
+ "Linux-syscall-note",
110
+ "LLVM-exception",
111
+ "openvpn-openssl-exception",
112
+ "Qt-GPL-exception-1.0",
113
+ "Qt-LGPL-exception-1.1",
114
+ "Universal-FOSS-exception-1.0",
115
+ "WxWindows-exception-3.1"
116
+ ]);
117
+
118
+ // src/services/export/license.ts
119
+ var LICENSE_KIND_ID = "id";
120
+ var LICENSE_KIND_EXPRESSION = "expression";
121
+ var LICENSE_KIND_NAMED = "named";
122
+ var OPERATORS = /* @__PURE__ */ new Set(["AND", "OR"]);
123
+ function isRecord(value) {
124
+ return value !== null && typeof value === "object" && !Array.isArray(value);
125
+ }
126
+ function cleanLicense(value) {
127
+ if (typeof value !== "string") {
128
+ return void 0;
129
+ }
130
+ const stripped = value.trim();
131
+ return stripped.length > 0 ? stripped : void 0;
132
+ }
133
+ function fromApmYml(path) {
134
+ try {
135
+ const parsed = parseYaml(readFileSync(path, "utf8"));
136
+ if (!isRecord(parsed)) {
137
+ return void 0;
138
+ }
139
+ return cleanLicense(parsed.license);
140
+ } catch {
141
+ return void 0;
142
+ }
143
+ }
144
+ function fromPluginJson(path) {
145
+ try {
146
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
147
+ if (!isRecord(parsed)) {
148
+ return void 0;
149
+ }
150
+ return cleanLicense(parsed.license);
151
+ } catch {
152
+ return void 0;
153
+ }
154
+ }
155
+ function manifestSearchRoot(installPath) {
156
+ try {
157
+ return lstatSync(installPath).isDirectory() ? installPath : dirname(installPath);
158
+ } catch {
159
+ return installPath;
160
+ }
161
+ }
162
+ function readDeclaredLicense(installPath) {
163
+ const base = manifestSearchRoot(installPath);
164
+ const apmYml = join(base, "apm.yml");
165
+ if (existsSync(apmYml)) {
166
+ const declared = fromApmYml(apmYml);
167
+ if (declared !== void 0) {
168
+ return declared;
169
+ }
170
+ }
171
+ const pluginJson = join(base, "plugin.json");
172
+ if (existsSync(pluginJson)) {
173
+ return fromPluginJson(pluginJson);
174
+ }
175
+ return void 0;
176
+ }
177
+ function isLicenseRef(token) {
178
+ return token.startsWith("LicenseRef-") || token.startsWith("DocumentRef-");
179
+ }
180
+ function isValidLicenseId(token) {
181
+ const bare = token.endsWith("+") ? token.slice(0, -1) : token;
182
+ return Boolean(bare) && (SPDX_LICENSE_IDS.has(bare) || isLicenseRef(token));
183
+ }
184
+ function tokenize(text) {
185
+ return text.replaceAll("(", " ( ").replaceAll(")", " ) ").split(/\s+/).filter(Boolean);
186
+ }
187
+ function hasExpressionSyntax(tokens) {
188
+ return tokens.some(
189
+ (token) => token === "(" || token === ")" || OPERATORS.has(token.toUpperCase()) || token.toUpperCase() === "WITH"
190
+ );
191
+ }
192
+ var ExpressionParser = class {
193
+ constructor(tokens) {
194
+ this.tokens = tokens;
195
+ }
196
+ pos = 0;
197
+ parse() {
198
+ if (!this.parseOr()) {
199
+ return false;
200
+ }
201
+ return this.pos === this.tokens.length;
202
+ }
203
+ peek() {
204
+ return this.tokens[this.pos];
205
+ }
206
+ advance() {
207
+ const token = this.peek();
208
+ if (token !== void 0) {
209
+ this.pos += 1;
210
+ }
211
+ return token;
212
+ }
213
+ parseOr() {
214
+ if (!this.parseUnit()) {
215
+ return false;
216
+ }
217
+ let next = this.peek();
218
+ while (next !== void 0 && OPERATORS.has(next.toUpperCase())) {
219
+ this.advance();
220
+ if (!this.parseUnit()) {
221
+ return false;
222
+ }
223
+ next = this.peek();
224
+ }
225
+ return true;
226
+ }
227
+ parseUnit() {
228
+ const token = this.peek();
229
+ if (token === void 0) {
230
+ return false;
231
+ }
232
+ if (token === "(") {
233
+ this.advance();
234
+ if (!this.parseOr()) {
235
+ return false;
236
+ }
237
+ return this.advance() === ")";
238
+ }
239
+ if (token === ")" || OPERATORS.has(token) || token.toUpperCase() === "WITH") {
240
+ return false;
241
+ }
242
+ this.advance();
243
+ if (!isValidLicenseId(token)) {
244
+ return false;
245
+ }
246
+ const next = this.peek();
247
+ if (next !== void 0 && next.toUpperCase() === "WITH") {
248
+ this.advance();
249
+ const exception = this.advance();
250
+ return exception !== void 0 && SPDX_EXCEPTION_IDS.has(exception);
251
+ }
252
+ return true;
253
+ }
254
+ };
255
+ function classifyDeclaredLicense(declared) {
256
+ const value = declared.trim();
257
+ if (!value) {
258
+ return { kind: LICENSE_KIND_NAMED, value };
259
+ }
260
+ if (value.toUpperCase() === "UNLICENSED" || value.toUpperCase().startsWith("SEE LICENSE IN ")) {
261
+ return { kind: LICENSE_KIND_NAMED, value };
262
+ }
263
+ const tokens = tokenize(value);
264
+ if (!hasExpressionSyntax(tokens)) {
265
+ if (tokens.length === 1 && tokens[0] && isValidLicenseId(tokens[0])) {
266
+ return { kind: LICENSE_KIND_ID, value };
267
+ }
268
+ return { kind: LICENSE_KIND_NAMED, value };
269
+ }
270
+ if (new ExpressionParser(tokens).parse()) {
271
+ return { kind: LICENSE_KIND_EXPRESSION, value };
272
+ }
273
+ return { kind: LICENSE_KIND_NAMED, value };
274
+ }
275
+
276
+ export {
277
+ LICENSE_KIND_ID,
278
+ LICENSE_KIND_EXPRESSION,
279
+ LICENSE_KIND_NAMED,
280
+ readDeclaredLicense,
281
+ classifyDeclaredLicense
282
+ };
283
+ //# sourceMappingURL=chunk-CHQGE2HF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/services/export/license.ts","../src/services/export/spdx-ids.ts"],"sourcesContent":["import { existsSync, lstatSync, readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { parse as parseYaml } from \"yaml\";\nimport { SPDX_EXCEPTION_IDS, SPDX_LICENSE_IDS } from \"./spdx-ids.js\";\n\nexport const LICENSE_KIND_ID = \"id\" as const;\nexport const LICENSE_KIND_EXPRESSION = \"expression\" as const;\nexport const LICENSE_KIND_NAMED = \"named\" as const;\n\nexport type LicenseKind =\n | typeof LICENSE_KIND_ID\n | typeof LICENSE_KIND_EXPRESSION\n | typeof LICENSE_KIND_NAMED;\n\nexport interface LicenseClass {\n kind: LicenseKind;\n value: string;\n}\n\nconst OPERATORS = new Set([\"AND\", \"OR\"]);\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction cleanLicense(value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return undefined;\n }\n const stripped = value.trim();\n return stripped.length > 0 ? stripped : undefined;\n}\n\nfunction fromApmYml(path: string): string | undefined {\n try {\n const parsed: unknown = parseYaml(readFileSync(path, \"utf8\"));\n if (!isRecord(parsed)) {\n return undefined;\n }\n return cleanLicense(parsed.license);\n } catch {\n return undefined;\n }\n}\n\nfunction fromPluginJson(path: string): string | undefined {\n try {\n const parsed: unknown = JSON.parse(readFileSync(path, \"utf8\"));\n if (!isRecord(parsed)) {\n return undefined;\n }\n return cleanLicense(parsed.license);\n } catch {\n return undefined;\n }\n}\n\n/**\n * Read the declared license from a dependency manifest (`license:` in `apm.yml`,\n * else `license` in `plugin.json`). Never reads LICENSE file text.\n */\nfunction manifestSearchRoot(installPath: string): string {\n try {\n return lstatSync(installPath).isDirectory() ? installPath : dirname(installPath);\n } catch {\n return installPath;\n }\n}\n\nexport function readDeclaredLicense(installPath: string): string | undefined {\n const base = manifestSearchRoot(installPath);\n\n const apmYml = join(base, \"apm.yml\");\n if (existsSync(apmYml)) {\n const declared = fromApmYml(apmYml);\n if (declared !== undefined) {\n return declared;\n }\n }\n\n const pluginJson = join(base, \"plugin.json\");\n if (existsSync(pluginJson)) {\n return fromPluginJson(pluginJson);\n }\n\n return undefined;\n}\n\nfunction isLicenseRef(token: string): boolean {\n return token.startsWith(\"LicenseRef-\") || token.startsWith(\"DocumentRef-\");\n}\n\nfunction isValidLicenseId(token: string): boolean {\n const bare = token.endsWith(\"+\") ? token.slice(0, -1) : token;\n return Boolean(bare) && (SPDX_LICENSE_IDS.has(bare) || isLicenseRef(token));\n}\n\nfunction tokenize(text: string): string[] {\n return text.replaceAll(\"(\", \" ( \").replaceAll(\")\", \" ) \").split(/\\s+/).filter(Boolean);\n}\n\nfunction hasExpressionSyntax(tokens: string[]): boolean {\n return tokens.some(\n (token) => token === \"(\" || token === \")\" || OPERATORS.has(token.toUpperCase()) || token.toUpperCase() === \"WITH\",\n );\n}\n\nclass ExpressionParser {\n private pos = 0;\n\n constructor(private readonly tokens: string[]) {}\n\n parse(): boolean {\n if (!this.parseOr()) {\n return false;\n }\n return this.pos === this.tokens.length;\n }\n\n private peek(): string | undefined {\n return this.tokens[this.pos];\n }\n\n private advance(): string | undefined {\n const token = this.peek();\n if (token !== undefined) {\n this.pos += 1;\n }\n return token;\n }\n\n private parseOr(): boolean {\n if (!this.parseUnit()) {\n return false;\n }\n let next = this.peek();\n while (next !== undefined && OPERATORS.has(next.toUpperCase())) {\n this.advance();\n if (!this.parseUnit()) {\n return false;\n }\n next = this.peek();\n }\n return true;\n }\n\n private parseUnit(): boolean {\n const token = this.peek();\n if (token === undefined) {\n return false;\n }\n if (token === \"(\") {\n this.advance();\n if (!this.parseOr()) {\n return false;\n }\n return this.advance() === \")\";\n }\n if (token === \")\" || OPERATORS.has(token) || token.toUpperCase() === \"WITH\") {\n return false;\n }\n this.advance();\n if (!isValidLicenseId(token)) {\n return false;\n }\n const next = this.peek();\n if (next !== undefined && next.toUpperCase() === \"WITH\") {\n this.advance();\n const exception = this.advance();\n return exception !== undefined && SPDX_EXCEPTION_IDS.has(exception);\n }\n return true;\n }\n}\n\n/**\n * Classify a non-empty declared license for CycloneDX rendering.\n * SPDX `licenseDeclared` always uses the verbatim string.\n */\nexport function classifyDeclaredLicense(declared: string): LicenseClass {\n const value = declared.trim();\n if (!value) {\n return { kind: LICENSE_KIND_NAMED, value };\n }\n if (value.toUpperCase() === \"UNLICENSED\" || value.toUpperCase().startsWith(\"SEE LICENSE IN \")) {\n return { kind: LICENSE_KIND_NAMED, value };\n }\n\n const tokens = tokenize(value);\n if (!hasExpressionSyntax(tokens)) {\n if (tokens.length === 1 && tokens[0] && isValidLicenseId(tokens[0])) {\n return { kind: LICENSE_KIND_ID, value };\n }\n return { kind: LICENSE_KIND_NAMED, value };\n }\n\n if (new ExpressionParser(tokens).parse()) {\n return { kind: LICENSE_KIND_EXPRESSION, value };\n }\n return { kind: LICENSE_KIND_NAMED, value };\n}\n","/** Common SPDX license identifiers used for CycloneDX `license.id` classification. */\nexport const SPDX_LICENSE_IDS = new Set<string>([\n \"0BSD\",\n \"AAL\",\n \"AFL-1.1\",\n \"AFL-1.2\",\n \"AFL-2.0\",\n \"AFL-2.1\",\n \"AFL-3.0\",\n \"AGPL-1.0-only\",\n \"AGPL-1.0-or-later\",\n \"AGPL-3.0\",\n \"AGPL-3.0-only\",\n \"AGPL-3.0-or-later\",\n \"Apache-1.0\",\n \"Apache-1.1\",\n \"Apache-2.0\",\n \"APL-1.0\",\n \"APSL-1.0\",\n \"APSL-1.1\",\n \"APSL-1.2\",\n \"APSL-2.0\",\n \"Artistic-1.0\",\n \"Artistic-1.0-cl8\",\n \"Artistic-1.0-Perl\",\n \"Artistic-2.0\",\n \"BlueOak-1.0.0\",\n \"BSD-1-Clause\",\n \"BSD-2-Clause\",\n \"BSD-2-Clause-Patent\",\n \"BSD-3-Clause\",\n \"BSD-3-Clause-Clear\",\n \"BSD-3-Clause-LBNL\",\n \"BSD-4-Clause\",\n \"BSD-4-Clause-UC\",\n \"BSL-1.0\",\n \"CC-BY-4.0\",\n \"CC-BY-SA-4.0\",\n \"CC0-1.0\",\n \"CDDL-1.0\",\n \"CDDL-1.1\",\n \"CPL-1.0\",\n \"EPL-1.0\",\n \"EPL-2.0\",\n \"EUPL-1.1\",\n \"EUPL-1.2\",\n \"GPL-2.0\",\n \"GPL-2.0-only\",\n \"GPL-2.0-or-later\",\n \"GPL-3.0\",\n \"GPL-3.0-only\",\n \"GPL-3.0-or-later\",\n \"HPND\",\n \"ICU\",\n \"IJG\",\n \"ISC\",\n \"LGPL-2.0-only\",\n \"LGPL-2.0-or-later\",\n \"LGPL-2.1\",\n \"LGPL-2.1-only\",\n \"LGPL-2.1-or-later\",\n \"LGPL-3.0\",\n \"LGPL-3.0-only\",\n \"LGPL-3.0-or-later\",\n \"Libpng\",\n \"libpng-2.0\",\n \"Lil-1.0\",\n \"LPPL-1.3c\",\n \"MIT\",\n \"MIT-0\",\n \"MIT-CMU\",\n \"MIT-Modern-Variant\",\n \"MPL-1.0\",\n \"MPL-1.1\",\n \"MPL-2.0\",\n \"MPL-2.0-no-copyleft-exception\",\n \"MS-PL\",\n \"MS-RL\",\n \"NCSA\",\n \"OFL-1.0\",\n \"OFL-1.1\",\n \"OSL-3.0\",\n \"PostgreSQL\",\n \"Python-2.0\",\n \"Ruby\",\n \"Unlicense\",\n \"UPL-1.0\",\n \"W3C\",\n \"WTFPL\",\n \"X11\",\n \"Zlib\",\n \"ZPL-2.0\",\n \"ZPL-2.1\",\n]);\n\n/** Common SPDX exception identifiers used in `WITH` expressions. */\nexport const SPDX_EXCEPTION_IDS = new Set<string>([\n \"Autoconf-exception-2.0\",\n \"Autoconf-exception-3.0\",\n \"Bison-exception-2.2\",\n \"Classpath-exception-2.0\",\n \"Font-exception-2.0\",\n \"GCC-exception-2.0\",\n \"GCC-exception-3.1\",\n \"Libtool-exception\",\n \"Linux-syscall-note\",\n \"LLVM-exception\",\n \"openvpn-openssl-exception\",\n \"Qt-GPL-exception-1.0\",\n \"Qt-LGPL-exception-1.1\",\n \"Universal-FOSS-exception-1.0\",\n \"WxWindows-exception-3.1\",\n]);\n"],"mappings":";AAAA,SAAS,YAAY,WAAW,oBAAoB;AACpD,SAAS,SAAS,YAAY;AAC9B,SAAS,SAAS,iBAAiB;;;ACD5B,IAAM,mBAAmB,oBAAI,IAAY;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,IAAM,qBAAqB,oBAAI,IAAY;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA,EACA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