opkg 0.6.1 → 0.7.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.
Files changed (487) hide show
  1. package/README.md +109 -186
  2. package/assets/openpackage_ascii_dark.png +0 -0
  3. package/assets/openpackage_ascii_light.png +0 -0
  4. package/dist/commands/add.js +34 -10
  5. package/dist/commands/add.js.map +1 -1
  6. package/dist/commands/apply.js +16 -0
  7. package/dist/commands/apply.js.map +1 -0
  8. package/dist/commands/delete.js +1 -1
  9. package/dist/commands/delete.js.map +1 -1
  10. package/dist/commands/install.js +177 -8
  11. package/dist/commands/install.js.map +1 -1
  12. package/dist/commands/list.js +2 -2
  13. package/dist/commands/list.js.map +1 -1
  14. package/dist/commands/login.js +1 -1
  15. package/dist/commands/login.js.map +1 -1
  16. package/dist/commands/logout.js +1 -1
  17. package/dist/commands/logout.js.map +1 -1
  18. package/dist/commands/new.js +125 -0
  19. package/dist/commands/new.js.map +1 -0
  20. package/dist/commands/pack.js +7 -13
  21. package/dist/commands/pack.js.map +1 -1
  22. package/dist/commands/pull.js +1 -1
  23. package/dist/commands/pull.js.map +1 -1
  24. package/dist/commands/push.js +1 -1
  25. package/dist/commands/push.js.map +1 -1
  26. package/dist/commands/remove.js +63 -0
  27. package/dist/commands/remove.js.map +1 -0
  28. package/dist/commands/save.js +11 -17
  29. package/dist/commands/save.js.map +1 -1
  30. package/dist/commands/set.js +33 -0
  31. package/dist/commands/set.js.map +1 -0
  32. package/dist/commands/show.js +16 -94
  33. package/dist/commands/show.js.map +1 -1
  34. package/dist/commands/status.js +26 -701
  35. package/dist/commands/status.js.map +1 -1
  36. package/dist/commands/uninstall.js +14 -427
  37. package/dist/commands/uninstall.js.map +1 -1
  38. package/dist/constants/index.js +72 -16
  39. package/dist/constants/index.js.map +1 -1
  40. package/dist/core/add/add-conflict-handler.js +1 -8
  41. package/dist/core/add/add-conflict-handler.js.map +1 -1
  42. package/dist/core/add/add-pipeline.js +12 -10
  43. package/dist/core/add/add-pipeline.js.map +1 -1
  44. package/dist/core/add/add-to-source-pipeline.js +123 -0
  45. package/dist/core/add/add-to-source-pipeline.js.map +1 -0
  46. package/dist/core/add/package-index-updater.js +77 -78
  47. package/dist/core/add/package-index-updater.js.map +1 -1
  48. package/dist/core/add/platform-path-transformer.js +6 -4
  49. package/dist/core/add/platform-path-transformer.js.map +1 -1
  50. package/dist/core/add/source-collector.js +2 -3
  51. package/dist/core/add/source-collector.js.map +1 -1
  52. package/dist/core/apply/apply-pipeline.js +110 -0
  53. package/dist/core/apply/apply-pipeline.js.map +1 -0
  54. package/dist/core/dependency-resolver.js +263 -21
  55. package/dist/core/dependency-resolver.js.map +1 -1
  56. package/dist/core/discovery/file-discovery.js +1 -2
  57. package/dist/core/discovery/file-discovery.js.map +1 -1
  58. package/dist/core/discovery/platform-files-discovery.js +33 -18
  59. package/dist/core/discovery/platform-files-discovery.js.map +1 -1
  60. package/dist/core/flows/flow-executor.js +974 -0
  61. package/dist/core/flows/flow-executor.js.map +1 -0
  62. package/dist/core/flows/flow-inverter.js +442 -0
  63. package/dist/core/flows/flow-inverter.js.map +1 -0
  64. package/dist/core/flows/flow-key-extractor.js +101 -0
  65. package/dist/core/flows/flow-key-extractor.js.map +1 -0
  66. package/dist/core/flows/flow-key-mapper.js +382 -0
  67. package/dist/core/flows/flow-key-mapper.js.map +1 -0
  68. package/dist/core/flows/flow-transforms.js +632 -0
  69. package/dist/core/flows/flow-transforms.js.map +1 -0
  70. package/dist/core/flows/map-pipeline/context.js +73 -0
  71. package/dist/core/flows/map-pipeline/context.js.map +1 -0
  72. package/dist/core/flows/map-pipeline/index.js +156 -0
  73. package/dist/core/flows/map-pipeline/index.js.map +1 -0
  74. package/dist/core/flows/map-pipeline/operations/copy.js +104 -0
  75. package/dist/core/flows/map-pipeline/operations/copy.js.map +1 -0
  76. package/dist/core/flows/map-pipeline/operations/pipe.js +70 -0
  77. package/dist/core/flows/map-pipeline/operations/pipe.js.map +1 -0
  78. package/dist/core/flows/map-pipeline/operations/rename.js +102 -0
  79. package/dist/core/flows/map-pipeline/operations/rename.js.map +1 -0
  80. package/dist/core/flows/map-pipeline/operations/set.js +50 -0
  81. package/dist/core/flows/map-pipeline/operations/set.js.map +1 -0
  82. package/dist/core/flows/map-pipeline/operations/switch.js +79 -0
  83. package/dist/core/flows/map-pipeline/operations/switch.js.map +1 -0
  84. package/dist/core/flows/map-pipeline/operations/transform.js +543 -0
  85. package/dist/core/flows/map-pipeline/operations/transform.js.map +1 -0
  86. package/dist/core/flows/map-pipeline/operations/unset.js +65 -0
  87. package/dist/core/flows/map-pipeline/operations/unset.js.map +1 -0
  88. package/dist/core/flows/map-pipeline/types.js +8 -0
  89. package/dist/core/flows/map-pipeline/types.js.map +1 -0
  90. package/dist/core/flows/map-pipeline/utils.js +278 -0
  91. package/dist/core/flows/map-pipeline/utils.js.map +1 -0
  92. package/dist/core/flows/platform-converter.js +328 -0
  93. package/dist/core/flows/platform-converter.js.map +1 -0
  94. package/dist/core/flows/source-resolver.js +192 -0
  95. package/dist/core/flows/source-resolver.js.map +1 -0
  96. package/dist/core/flows/toml-domain-transforms.js +23 -0
  97. package/dist/core/flows/toml-domain-transforms.js.map +1 -0
  98. package/dist/core/install/bulk-install-pipeline.js +68 -7
  99. package/dist/core/install/bulk-install-pipeline.js.map +1 -1
  100. package/dist/core/install/canonical-plan.js +3 -3
  101. package/dist/core/install/canonical-plan.js.map +1 -1
  102. package/dist/core/install/dry-run.js +3 -3
  103. package/dist/core/install/dry-run.js.map +1 -1
  104. package/dist/core/install/flow-based-installer.js +1158 -0
  105. package/dist/core/install/flow-based-installer.js.map +1 -0
  106. package/dist/core/install/flow-workspace-tracker.js +111 -0
  107. package/dist/core/install/flow-workspace-tracker.js.map +1 -0
  108. package/dist/core/install/format-detector.js +228 -0
  109. package/dist/core/install/format-detector.js.map +1 -0
  110. package/dist/core/install/git-package-loader.js +20 -0
  111. package/dist/core/install/git-package-loader.js.map +1 -0
  112. package/dist/core/install/install-errors.js +1 -1
  113. package/dist/core/install/install-errors.js.map +1 -1
  114. package/dist/core/install/install-flow.js +34 -14
  115. package/dist/core/install/install-flow.js.map +1 -1
  116. package/dist/core/install/install-pipeline.js +52 -17
  117. package/dist/core/install/install-pipeline.js.map +1 -1
  118. package/dist/core/install/install-reporting.js +26 -8
  119. package/dist/core/install/install-reporting.js.map +1 -1
  120. package/dist/core/install/local-source-resolution.js +103 -0
  121. package/dist/core/install/local-source-resolution.js.map +1 -0
  122. package/dist/core/install/marketplace-handler.js +221 -0
  123. package/dist/core/install/marketplace-handler.js.map +1 -0
  124. package/dist/core/install/path-install-pipeline.js +241 -0
  125. package/dist/core/install/path-install-pipeline.js.map +1 -0
  126. package/dist/core/install/path-package-loader.js +116 -0
  127. package/dist/core/install/path-package-loader.js.map +1 -0
  128. package/dist/core/install/plugin-detector.js +72 -0
  129. package/dist/core/install/plugin-detector.js.map +1 -0
  130. package/dist/core/install/plugin-to-universal-converter.js +218 -0
  131. package/dist/core/install/plugin-to-universal-converter.js.map +1 -0
  132. package/dist/core/install/plugin-transformer.js +191 -0
  133. package/dist/core/install/plugin-transformer.js.map +1 -0
  134. package/dist/core/install/version-selection.js +1 -1
  135. package/dist/core/install/version-selection.js.map +1 -1
  136. package/dist/core/openpackage.js +40 -22
  137. package/dist/core/openpackage.js.map +1 -1
  138. package/dist/core/pack/pack-output.js +62 -0
  139. package/dist/core/pack/pack-output.js.map +1 -0
  140. package/dist/core/pack/pack-pipeline.js +186 -0
  141. package/dist/core/pack/pack-pipeline.js.map +1 -0
  142. package/dist/core/package-context.js +45 -70
  143. package/dist/core/package-context.js.map +1 -1
  144. package/dist/core/package-creation.js +203 -0
  145. package/dist/core/package-creation.js.map +1 -0
  146. package/dist/core/package.js +20 -6
  147. package/dist/core/package.js.map +1 -1
  148. package/dist/core/platforms.js +665 -209
  149. package/dist/core/platforms.js.map +1 -1
  150. package/dist/core/push/push-context.js +1 -1
  151. package/dist/core/push/push-context.js.map +1 -1
  152. package/dist/core/push/push-upload.js +2 -2
  153. package/dist/core/push/push-upload.js.map +1 -1
  154. package/dist/core/registry.js +6 -6
  155. package/dist/core/registry.js.map +1 -1
  156. package/dist/core/remote-pull.js +2 -2
  157. package/dist/core/remote-pull.js.map +1 -1
  158. package/dist/core/remove/removal-collector.js +52 -0
  159. package/dist/core/remove/removal-collector.js.map +1 -0
  160. package/dist/core/remove/removal-confirmation.js +39 -0
  161. package/dist/core/remove/removal-confirmation.js.map +1 -0
  162. package/dist/core/remove/remove-from-source-pipeline.js +173 -0
  163. package/dist/core/remove/remove-from-source-pipeline.js.map +1 -0
  164. package/dist/core/save/constants.js +3 -3
  165. package/dist/core/save/constants.js.map +1 -1
  166. package/dist/core/save/flow-based-saver.js +270 -0
  167. package/dist/core/save/flow-based-saver.js.map +1 -0
  168. package/dist/core/save/name-resolution.js +1 -1
  169. package/dist/core/save/name-resolution.js.map +1 -1
  170. package/dist/core/save/package-yml-generator.js +4 -5
  171. package/dist/core/save/package-yml-generator.js.map +1 -1
  172. package/dist/core/save/save-candidate-builder.js +215 -0
  173. package/dist/core/save/save-candidate-builder.js.map +1 -0
  174. package/dist/core/save/save-candidate-loader.js +12 -11
  175. package/dist/core/save/save-candidate-loader.js.map +1 -1
  176. package/dist/core/save/save-conflict-analyzer.js +150 -0
  177. package/dist/core/save/save-conflict-analyzer.js.map +1 -0
  178. package/dist/core/save/save-conflict-resolution.js +28 -14
  179. package/dist/core/save/save-conflict-resolution.js.map +1 -1
  180. package/dist/core/save/save-conflict-resolver.js +31 -275
  181. package/dist/core/save/save-conflict-resolver.js.map +1 -1
  182. package/dist/core/save/save-group-builder.js +52 -0
  183. package/dist/core/save/save-group-builder.js.map +1 -0
  184. package/dist/core/save/save-interactive-resolver.js +190 -0
  185. package/dist/core/save/save-interactive-resolver.js.map +1 -0
  186. package/dist/core/save/save-pipeline.js +58 -34
  187. package/dist/core/save/save-pipeline.js.map +1 -1
  188. package/dist/core/save/save-platform-handler.js +53 -0
  189. package/dist/core/save/save-platform-handler.js.map +1 -0
  190. package/dist/core/save/save-resolution-executor.js +145 -0
  191. package/dist/core/save/save-resolution-executor.js.map +1 -0
  192. package/dist/core/save/save-result-reporter.js +167 -0
  193. package/dist/core/save/save-result-reporter.js.map +1 -0
  194. package/dist/core/save/save-to-source-pipeline.js +154 -0
  195. package/dist/core/save/save-to-source-pipeline.js.map +1 -0
  196. package/dist/core/save/save-versioning.js +4 -4
  197. package/dist/core/save/save-versioning.js.map +1 -1
  198. package/dist/core/save/save-write-coordinator.js +204 -0
  199. package/dist/core/save/save-write-coordinator.js.map +1 -0
  200. package/dist/core/save/save-yml-resolution.js +28 -216
  201. package/dist/core/save/save-yml-resolution.js.map +1 -1
  202. package/dist/core/save/workspace-rename.js +7 -8
  203. package/dist/core/save/workspace-rename.js.map +1 -1
  204. package/dist/core/set/set-output.js +72 -0
  205. package/dist/core/set/set-output.js.map +1 -0
  206. package/dist/core/set/set-pipeline.js +361 -0
  207. package/dist/core/set/set-pipeline.js.map +1 -0
  208. package/dist/core/set/set-types.js +5 -0
  209. package/dist/core/set/set-types.js.map +1 -0
  210. package/dist/core/show/package-resolver.js +257 -0
  211. package/dist/core/show/package-resolver.js.map +1 -0
  212. package/dist/core/show/scope-discovery.js +165 -0
  213. package/dist/core/show/scope-discovery.js.map +1 -0
  214. package/dist/core/show/show-output.js +168 -0
  215. package/dist/core/show/show-output.js.map +1 -0
  216. package/dist/core/show/show-pipeline.js +113 -0
  217. package/dist/core/show/show-pipeline.js.map +1 -0
  218. package/dist/core/show/show-types.js +5 -0
  219. package/dist/core/show/show-types.js.map +1 -0
  220. package/dist/core/source-resolution/dependency-graph.js +104 -0
  221. package/dist/core/source-resolution/dependency-graph.js.map +1 -0
  222. package/dist/core/source-resolution/resolve-mutable-source.js +109 -0
  223. package/dist/core/source-resolution/resolve-mutable-source.js.map +1 -0
  224. package/dist/core/source-resolution/resolve-package-source.js +29 -0
  225. package/dist/core/source-resolution/resolve-package-source.js.map +1 -0
  226. package/dist/core/source-resolution/resolve-registry-version.js +35 -0
  227. package/dist/core/source-resolution/resolve-registry-version.js.map +1 -0
  228. package/dist/core/source-resolution/types.js.map +1 -0
  229. package/dist/core/status/status-file-discovery.js +23 -12
  230. package/dist/core/status/status-file-discovery.js.map +1 -1
  231. package/dist/core/status/status-pipeline.js +134 -0
  232. package/dist/core/status/status-pipeline.js.map +1 -0
  233. package/dist/core/sync/platform-sync-summary.js +27 -0
  234. package/dist/core/sync/platform-sync-summary.js.map +1 -0
  235. package/dist/core/uninstall/flow-aware-uninstaller.js +189 -0
  236. package/dist/core/uninstall/flow-aware-uninstaller.js.map +1 -0
  237. package/dist/core/uninstall/uninstall-file-discovery.js +11 -6
  238. package/dist/core/uninstall/uninstall-file-discovery.js.map +1 -1
  239. package/dist/core/uninstall/uninstall-pipeline.js +141 -0
  240. package/dist/core/uninstall/uninstall-pipeline.js.map +1 -0
  241. package/dist/core/universal-patterns.js +64 -0
  242. package/dist/core/universal-patterns.js.map +1 -0
  243. package/dist/index.js +99 -6
  244. package/dist/index.js.map +1 -1
  245. package/dist/types/flows.js +8 -0
  246. package/dist/types/flows.js.map +1 -0
  247. package/dist/types/index.js +3 -0
  248. package/dist/types/index.js.map +1 -1
  249. package/dist/types/platform-flows.js +8 -0
  250. package/dist/types/platform-flows.js.map +1 -0
  251. package/dist/types/workspace-index.js +6 -0
  252. package/dist/types/workspace-index.js.map +1 -0
  253. package/dist/utils/custom-path-resolution.js +160 -0
  254. package/dist/utils/custom-path-resolution.js.map +1 -0
  255. package/dist/utils/dependency-coverage.js +1 -1
  256. package/dist/utils/dependency-coverage.js.map +1 -1
  257. package/dist/utils/file-processing.js +1 -1
  258. package/dist/utils/flow-index-installer.js +209 -0
  259. package/dist/utils/flow-index-installer.js.map +1 -0
  260. package/dist/utils/formatters.js +47 -1
  261. package/dist/utils/formatters.js.map +1 -1
  262. package/dist/utils/fs.js +17 -0
  263. package/dist/utils/fs.js.map +1 -1
  264. package/dist/utils/git-clone-registry.js +88 -0
  265. package/dist/utils/git-clone-registry.js.map +1 -0
  266. package/dist/utils/git-clone.js +69 -0
  267. package/dist/utils/git-clone.js.map +1 -0
  268. package/dist/utils/git-spec.js +96 -0
  269. package/dist/utils/git-spec.js.map +1 -0
  270. package/dist/utils/http-client.js +7 -0
  271. package/dist/utils/http-client.js.map +1 -1
  272. package/dist/utils/index-based-installer.js +356 -163
  273. package/dist/utils/index-based-installer.js.map +1 -1
  274. package/dist/utils/install-conflict-handler.js +2 -2
  275. package/dist/utils/install-conflict-handler.js.map +1 -1
  276. package/dist/utils/install-file-discovery.js +18 -13
  277. package/dist/utils/install-file-discovery.js.map +1 -1
  278. package/dist/utils/install-helpers.js +43 -20
  279. package/dist/utils/install-helpers.js.map +1 -1
  280. package/dist/utils/jsonc.js +23 -1
  281. package/dist/utils/jsonc.js.map +1 -1
  282. package/dist/utils/manifest-paths.js +1 -1
  283. package/dist/utils/manifest-paths.js.map +1 -1
  284. package/dist/utils/markdown-frontmatter.js +46 -0
  285. package/dist/utils/markdown-frontmatter.js.map +1 -1
  286. package/dist/utils/package-copy.js +5 -103
  287. package/dist/utils/package-copy.js.map +1 -1
  288. package/dist/utils/package-filters.js +9 -105
  289. package/dist/utils/package-filters.js.map +1 -1
  290. package/dist/utils/package-index-yml.js +27 -6
  291. package/dist/utils/package-index-yml.js.map +1 -1
  292. package/dist/utils/package-input.js +98 -0
  293. package/dist/utils/package-input.js.map +1 -0
  294. package/dist/utils/package-management.js +80 -28
  295. package/dist/utils/package-management.js.map +1 -1
  296. package/dist/utils/package-name-resolution.js +327 -0
  297. package/dist/utils/package-name-resolution.js.map +1 -0
  298. package/dist/utils/package-name.js +18 -16
  299. package/dist/utils/package-name.js.map +1 -1
  300. package/dist/utils/package-versioning.js +2 -33
  301. package/dist/utils/package-versioning.js.map +1 -1
  302. package/dist/utils/package-yml.js +19 -28
  303. package/dist/utils/package-yml.js.map +1 -1
  304. package/dist/utils/path-resolution.js +102 -0
  305. package/dist/utils/path-resolution.js.map +1 -0
  306. package/dist/utils/paths.js +6 -6
  307. package/dist/utils/paths.js.map +1 -1
  308. package/dist/utils/platform-file.js +36 -24
  309. package/dist/utils/platform-file.js.map +1 -1
  310. package/dist/utils/platform-mapper.js +222 -68
  311. package/dist/utils/platform-mapper.js.map +1 -1
  312. package/dist/utils/platform-root-files.js +44 -0
  313. package/dist/utils/platform-root-files.js.map +1 -0
  314. package/dist/utils/platform-utils.js +35 -54
  315. package/dist/utils/platform-utils.js.map +1 -1
  316. package/dist/utils/platform-yaml-merge.js +20 -140
  317. package/dist/utils/platform-yaml-merge.js.map +1 -1
  318. package/dist/utils/prompts.js +92 -7
  319. package/dist/utils/prompts.js.map +1 -1
  320. package/dist/utils/registry-entry-filter.js +50 -27
  321. package/dist/utils/registry-entry-filter.js.map +1 -1
  322. package/dist/utils/registry-paths.js +5 -4
  323. package/dist/utils/registry-paths.js.map +1 -1
  324. package/dist/utils/scope-resolution.js +156 -0
  325. package/dist/utils/scope-resolution.js.map +1 -0
  326. package/dist/utils/source-mutability.js +15 -0
  327. package/dist/utils/source-mutability.js.map +1 -0
  328. package/dist/utils/tarball.js +29 -4
  329. package/dist/utils/tarball.js.map +1 -1
  330. package/dist/utils/version-ranges.js +1 -32
  331. package/dist/utils/version-ranges.js.map +1 -1
  332. package/dist/utils/workspace-index-helpers.js +28 -0
  333. package/dist/utils/workspace-index-helpers.js.map +1 -0
  334. package/dist/utils/workspace-index-ownership.js +100 -0
  335. package/dist/utils/workspace-index-ownership.js.map +1 -0
  336. package/dist/utils/workspace-index-yml.js +173 -0
  337. package/dist/utils/workspace-index-yml.js.map +1 -0
  338. package/examples/custom-subdirs-platform.jsonc +157 -0
  339. package/package.json +7 -2
  340. package/platforms.jsonc +531 -84
  341. package/schemas/map-pipeline-v1.json +256 -0
  342. package/schemas/platforms-v1.json +400 -0
  343. package/specs/README.md +88 -0
  344. package/specs/add/README.md +166 -0
  345. package/specs/agents-claude.md +570 -0
  346. package/specs/agents-opencode.md +622 -0
  347. package/specs/apply/README.md +21 -0
  348. package/specs/apply/apply-behavior.md +58 -0
  349. package/specs/apply/apply-command.md +51 -0
  350. package/specs/apply/conflicts.md +41 -0
  351. package/specs/apply/index-effects.md +81 -0
  352. package/specs/architecture.md +107 -0
  353. package/specs/auth/README.md +17 -0
  354. package/specs/auth/auth-http-contract.md +25 -0
  355. package/specs/auth/cli/credentials.md +39 -0
  356. package/specs/auth/cli/login.md +32 -0
  357. package/specs/auth/cli/logout.md +16 -0
  358. package/specs/claude-mcp.md +1065 -0
  359. package/specs/claude-plugins-marketplace.md +363 -0
  360. package/specs/claude-plugins.md +413 -0
  361. package/specs/cli-options.md +52 -0
  362. package/specs/codex-mcp.md +114 -0
  363. package/specs/commands-overview.md +175 -0
  364. package/specs/directory-layout.md +95 -0
  365. package/specs/install/README.md +12 -4
  366. package/specs/install/git-sources.md +230 -0
  367. package/specs/install/install-behavior.md +483 -73
  368. package/specs/install/package-yml-canonical.md +67 -35
  369. package/specs/install/version-resolution.md +69 -115
  370. package/specs/new/README.md +769 -0
  371. package/specs/new/SUMMARY.md +310 -0
  372. package/specs/new/scope-behavior.md +793 -0
  373. package/specs/pack/README.md +77 -0
  374. package/specs/pack/package-name-resolution.md +330 -0
  375. package/specs/package/README.md +18 -17
  376. package/specs/package/nested-packages-and-parent-packages.md +32 -31
  377. package/specs/package/package-index-yml.md +95 -101
  378. package/specs/package/package-root-layout.md +64 -46
  379. package/specs/package/registry-payload-and-copy.md +50 -44
  380. package/specs/package/universal-content.md +33 -56
  381. package/specs/package-sources.md +248 -0
  382. package/specs/platforms/README.md +52 -0
  383. package/specs/platforms/configuration.md +571 -0
  384. package/specs/platforms/detection.md +552 -0
  385. package/specs/platforms/directory-layout.md +599 -0
  386. package/specs/platforms/examples.md +1146 -0
  387. package/specs/platforms/flow-reference.md +1240 -0
  388. package/specs/platforms/flows.md +1488 -0
  389. package/specs/platforms/map-pipeline.md +801 -0
  390. package/specs/platforms/overview.md +349 -0
  391. package/specs/platforms/specification.md +700 -0
  392. package/specs/platforms/troubleshooting.md +697 -0
  393. package/specs/platforms/universal-converter.md +520 -0
  394. package/specs/push/README.md +1 -0
  395. package/specs/push/push-behavior.md +11 -3
  396. package/specs/push/push-remote-upload.md +1 -1
  397. package/specs/push/push-scoping.md +1 -1
  398. package/specs/push/push-version-selection.md +1 -1
  399. package/specs/registry.md +111 -0
  400. package/specs/remove/README.md +257 -0
  401. package/specs/save/README.md +21 -17
  402. package/specs/save/save-conflict-resolution.md +205 -83
  403. package/specs/save/save-file-discovery.md +6 -4
  404. package/specs/save/save-frontmatter-overrides.md +11 -15
  405. package/specs/save/save-modes-inputs.md +9 -39
  406. package/specs/save/save-naming-scoping.md +4 -4
  407. package/specs/save/save-package-detection.md +13 -13
  408. package/specs/save/save-registry-sync.md +16 -106
  409. package/specs/save/save-versioning.md +80 -0
  410. package/specs/scope-management.md +92 -0
  411. package/specs/set/README.md +520 -0
  412. package/specs/set/set-behavior.md +563 -0
  413. package/specs/show/README.md +483 -0
  414. package/specs/show/show-remote.md +494 -0
  415. package/specs/status/README.md +38 -0
  416. package/specs/uninstall/README.md +231 -0
  417. package/dist/commands/duplicate.js +0 -69
  418. package/dist/commands/duplicate.js.map +0 -1
  419. package/dist/commands/init.js +0 -117
  420. package/dist/commands/init.js.map +0 -1
  421. package/dist/commands/prune.js +0 -357
  422. package/dist/commands/prune.js.map +0 -1
  423. package/dist/commands/tui.js +0 -61
  424. package/dist/commands/tui.js.map +0 -1
  425. package/dist/core/install/index.js +0 -3
  426. package/dist/core/install/index.js.map +0 -1
  427. package/dist/core/push/push-single-file.js +0 -56
  428. package/dist/core/push/push-single-file.js.map +0 -1
  429. package/dist/core/save/package-detection.js +0 -147
  430. package/dist/core/save/package-detection.js.map +0 -1
  431. package/dist/core/save/save-single-file.js +0 -124
  432. package/dist/core/save/save-single-file.js.map +0 -1
  433. package/dist/core/token-store.js +0 -73
  434. package/dist/core/token-store.js.map +0 -1
  435. package/dist/tui/app.js +0 -95
  436. package/dist/tui/app.js.map +0 -1
  437. package/dist/tui/components/package-list.js +0 -73
  438. package/dist/tui/components/package-list.js.map +0 -1
  439. package/dist/tui/controller.js +0 -365
  440. package/dist/tui/controller.js.map +0 -1
  441. package/dist/tui/index.js +0 -12
  442. package/dist/tui/index.js.map +0 -1
  443. package/dist/tui/services/file-index.js +0 -64
  444. package/dist/tui/services/file-index.js.map +0 -1
  445. package/dist/tui/services/packages.js +0 -18
  446. package/dist/tui/services/packages.js.map +0 -1
  447. package/dist/tui/services/save.js +0 -21
  448. package/dist/tui/services/save.js.map +0 -1
  449. package/dist/tui/state/app-state.js +0 -15
  450. package/dist/tui/state/app-state.js.map +0 -1
  451. package/dist/tui/state.js +0 -17
  452. package/dist/tui/state.js.map +0 -1
  453. package/dist/tui/types.js.map +0 -1
  454. package/dist/tui/views/add-file-modal.js +0 -129
  455. package/dist/tui/views/add-file-modal.js.map +0 -1
  456. package/dist/tui/views/file-preview.js +0 -44
  457. package/dist/tui/views/file-preview.js.map +0 -1
  458. package/dist/tui/views/list-packages.js +0 -73
  459. package/dist/tui/views/list-packages.js.map +0 -1
  460. package/dist/tui/views/main-menu.js +0 -29
  461. package/dist/tui/views/main-menu.js.map +0 -1
  462. package/dist/tui/views/manage-view.js +0 -81
  463. package/dist/tui/views/manage-view.js.map +0 -1
  464. package/dist/tui/views/package-hub.js +0 -120
  465. package/dist/tui/views/package-hub.js.map +0 -1
  466. package/dist/tui/views/placeholder.js +0 -24
  467. package/dist/tui/views/placeholder.js.map +0 -1
  468. package/dist/utils/bun-bootstrap.js +0 -72
  469. package/dist/utils/bun-bootstrap.js.map +0 -1
  470. package/dist/utils/entity-id.js +0 -19
  471. package/dist/utils/entity-id.js.map +0 -1
  472. package/dist/utils/package-local-files.js +0 -5
  473. package/dist/utils/package-local-files.js.map +0 -1
  474. package/dist/utils/path-matching.js +0 -74
  475. package/dist/utils/path-matching.js.map +0 -1
  476. package/dist/utils/root-file-operations.js +0 -39
  477. package/dist/utils/root-file-operations.js.map +0 -1
  478. package/dist/utils/root-file-transformer.js +0 -27
  479. package/dist/utils/root-file-transformer.js.map +0 -1
  480. package/dist/utils/yaml-frontmatter.js +0 -25
  481. package/dist/utils/yaml-frontmatter.js.map +0 -1
  482. package/specs/auth/auth-device-flow.md +0 -70
  483. package/specs/login/login-device-flow.md +0 -70
  484. package/specs/platforms.md +0 -193
  485. package/specs/save-pack-versioning.md +0 -224
  486. package/specs/save-pack.md +0 -68
  487. /package/dist/{tui → core/source-resolution}/types.js +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"package-local-files.js","sourceRoot":"","sources":["../../src/utils/package-local-files.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAEhE,MAAM,CAAC,KAAK,UAAU,6BAA6B,CAAC,UAAkB;IACpE,OAAO,MAAM,2BAA2B,CAAC,UAAU,CAAC,CAAC;AACvD,CAAC"}
@@ -1,74 +0,0 @@
1
- import { normalize } from 'path';
2
- /**
3
- * Cross-platform path matching utilities
4
- * Provides consistent path matching logic across different filesystem types
5
- */
6
- /**
7
- * Determine if we're on a case-insensitive filesystem (primarily Windows)
8
- */
9
- export function isCaseInsensitiveFilesystem() {
10
- return process.platform === 'win32';
11
- }
12
- /**
13
- * Normalize a path for cross-platform comparison
14
- * Ensures consistent forward slashes and optional case-insensitive comparison
15
- */
16
- export function normalizePathForComparison(path, caseInsensitive = isCaseInsensitiveFilesystem()) {
17
- const normalized = normalize(path).replace(/\\/g, '/'); // Ensure forward slashes for consistent processing
18
- return caseInsensitive ? normalized.toLowerCase() : normalized;
19
- }
20
- /**
21
- * Match a path against platform directory patterns and extract relative path
22
- * Handles both absolute and relative path patterns across different filesystem types
23
- */
24
- export function matchPlatformPattern(inputPath, platformDir, caseInsensitive = isCaseInsensitiveFilesystem()) {
25
- // Normalize paths for comparison
26
- const normalizedInputPath = normalizePathForComparison(inputPath, caseInsensitive);
27
- const normalizedPlatformDir = caseInsensitive ? platformDir.toLowerCase() : platformDir;
28
- const comparePath = normalizedInputPath;
29
- // Check for platform directory patterns
30
- const absPlatformPattern = `/${normalizedPlatformDir}/`;
31
- const relPlatformPattern = `${normalizedPlatformDir}/`;
32
- let platformIndex = comparePath.indexOf(absPlatformPattern);
33
- let isAbsPattern = true;
34
- if (platformIndex === -1) {
35
- platformIndex = comparePath.indexOf(relPlatformPattern);
36
- isAbsPattern = false;
37
- }
38
- if (platformIndex !== -1) {
39
- // Extract the relative path after the platform directory
40
- const patternLength = isAbsPattern ? absPlatformPattern.length - 1 : relPlatformPattern.length - 1;
41
- let relativePath = normalizedInputPath.substring(platformIndex + patternLength);
42
- // Remove leading separator if present
43
- if (relativePath.startsWith('/') || relativePath.startsWith('\\')) {
44
- relativePath = relativePath.substring(1);
45
- }
46
- return { relativePath, isAbsoluteMatch: isAbsPattern };
47
- }
48
- // Check for exact platform directory matches
49
- const exactAbsMatch = `/${normalizedPlatformDir}`;
50
- const exactRelMatch = normalizedPlatformDir;
51
- const exactMatches = [
52
- comparePath === exactAbsMatch,
53
- comparePath === exactRelMatch,
54
- comparePath.endsWith(absPlatformPattern.slice(0, -1)), // ends with /platformDir
55
- comparePath.endsWith(relPlatformPattern.slice(0, -1)) // ends with platformDir
56
- ];
57
- if (exactMatches.some(match => match)) {
58
- return { relativePath: '', isAbsoluteMatch: comparePath.startsWith('/') };
59
- }
60
- return null;
61
- }
62
- /**
63
- * Check if a path exactly matches a platform directory (for root directory detection)
64
- */
65
- export function isExactPlatformMatch(inputPath, platformDir, caseInsensitive = isCaseInsensitiveFilesystem()) {
66
- const comparePath = normalizePathForComparison(inputPath, caseInsensitive);
67
- const normalizedPlatformDir = caseInsensitive ? platformDir.toLowerCase() : platformDir;
68
- const exactAbsMatch = `/${normalizedPlatformDir}`;
69
- const exactRelMatch = normalizedPlatformDir;
70
- return comparePath === exactAbsMatch ||
71
- comparePath === exactRelMatch ||
72
- comparePath.endsWith(`/${normalizedPlatformDir}`);
73
- }
74
- //# sourceMappingURL=path-matching.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"path-matching.js","sourceRoot":"","sources":["../../src/utils/path-matching.ts"],"names":[],"mappings":"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"}
@@ -1,39 +0,0 @@
1
- /**
2
- * Root File Operations Utility
3
- * Utility functions for operating on root files (AGENTS.md, CLAUDE.md, etc.)
4
- */
5
- import { extractPackageContentFromRootFile } from './root-file-extractor.js';
6
- import { mergePackageContentIntoRootFile } from './root-file-merger.js';
7
- import { readTextFile, writeTextFile } from './fs.js';
8
- import { logger } from './logger.js';
9
- import { getPathLeaf } from './path-normalization.js';
10
- /**
11
- * Add a package marker to a root file if not already present
12
- *
13
- * @param filePath - Path to the root file
14
- * @param packageName - Name of the package to add
15
- * @returns Result indicating if the file was processed and why
16
- */
17
- export async function addPackageToRootFile(filePath, packageName) {
18
- logger.debug(`Processing root file: ${filePath}`);
19
- try {
20
- const content = await readTextFile(filePath);
21
- // Check if package marker already exists
22
- const existingContent = extractPackageContentFromRootFile(content, packageName);
23
- if (existingContent !== null) {
24
- console.log(`✓ Package '${packageName}' is already added to ${getPathLeaf(filePath)}`);
25
- return { processed: false, reason: 'already_exists' };
26
- }
27
- // Add empty marker section at the end
28
- const updatedContent = mergePackageContentIntoRootFile(content, packageName, '');
29
- await writeTextFile(filePath, updatedContent);
30
- console.log(`✓ Added package marker for '${packageName}' to ${getPathLeaf(filePath)}`);
31
- return { processed: true };
32
- }
33
- catch (error) {
34
- logger.error(`Failed to process root file: ${filePath}`, { error });
35
- console.log(`✗ Failed to process ${getPathLeaf(filePath)}: ${error}`);
36
- return { processed: false, reason: 'error' };
37
- }
38
- }
39
- //# sourceMappingURL=root-file-operations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"root-file-operations.js","sourceRoot":"","sources":["../../src/utils/root-file-operations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iCAAiC,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAUtD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,QAAgB,EAChB,WAAmB;IAEnB,MAAM,CAAC,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAC;IAElD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,CAAC;QAE7C,yCAAyC;QACzC,MAAM,eAAe,GAAG,iCAAiC,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAChF,IAAI,eAAe,KAAK,IAAI,EAAE,CAAC;YAC7B,OAAO,CAAC,GAAG,CAAC,cAAc,WAAW,yBAAyB,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YACvF,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;QACxD,CAAC;QAED,sCAAsC;QACtC,MAAM,cAAc,GAAG,+BAA+B,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;QACjF,MAAM,aAAa,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;QAE9C,OAAO,CAAC,GAAG,CAAC,+BAA+B,WAAW,QAAQ,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACvF,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAE7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,gCAAgC,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACpE,OAAO,CAAC,GAAG,CAAC,uBAAuB,WAAW,CAAC,QAAQ,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;QACtE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC/C,CAAC;AACH,CAAC"}
@@ -1,27 +0,0 @@
1
- /**
2
- * Root File Transformer Utility
3
- * Handles transformation of root file content for package operations
4
- */
5
- import { extractPackageSection, buildOpenMarker, CLOSE_MARKER } from './root-file-extractor.js';
6
- /**
7
- * Transform root file content for package renaming
8
- * Updates package name in markers
9
- *
10
- * @param content - The root file content
11
- * @param oldPackageName - The original package name in the marker
12
- * @param newPackageName - The new package name to use in the marker
13
- * @returns Updated content with new package name
14
- */
15
- export function transformRootFileContent(content, oldPackageName, newPackageName) {
16
- // Extract the current package section
17
- const extracted = extractPackageSection(content, oldPackageName);
18
- if (!extracted) {
19
- // No valid marker found for the old package name, return unchanged
20
- return content;
21
- }
22
- // Build new marker with updated name
23
- const newMarker = buildOpenMarker(newPackageName);
24
- // Reconstruct the content with updated marker
25
- return newMarker + '\n' + extracted.sectionBody + '\n' + CLOSE_MARKER;
26
- }
27
- //# sourceMappingURL=root-file-transformer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"root-file-transformer.js","sourceRoot":"","sources":["../../src/utils/root-file-transformer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEhG;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAAe,EACf,cAAsB,EACtB,cAAsB;IAEtB,sCAAsC;IACtC,MAAM,SAAS,GAAG,qBAAqB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACjE,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,mEAAmE;QACnE,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,qCAAqC;IACrC,MAAM,SAAS,GAAG,eAAe,CAAC,cAAc,CAAC,CAAC;IAElD,8CAA8C;IAC9C,OAAO,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC,WAAW,GAAG,IAAI,GAAG,YAAY,CAAC;AACxE,CAAC"}
@@ -1,25 +0,0 @@
1
- import * as yaml from 'js-yaml';
2
- import { isScopedName } from '../core/scoping/package-scoping';
3
- /**
4
- * Generate a properly quoted YAML key-value pair
5
- */
6
- export function generateYamlKeyValue(key, value, indent = '') {
7
- // For boolean values, just output as-is
8
- if (typeof value === 'boolean') {
9
- return `${indent}${key}: ${value}`;
10
- }
11
- // For strings, use js-yaml to ensure proper quoting
12
- if (typeof value === 'string') {
13
- // Check if this is a scoped name (starts with @) - these need explicit quoting
14
- const isScoped = isScopedName(value);
15
- const quotedValue = yaml.dump(value, {
16
- flowLevel: 0,
17
- quotingType: '"', // Prefer double quotes for consistency
18
- forceQuotes: isScoped // Force quotes for scoped names
19
- }).trim();
20
- return `${indent}${key}: ${quotedValue}`;
21
- }
22
- // For other types, fallback to string conversion
23
- return `${indent}${key}: ${String(value)}`;
24
- }
25
- //# sourceMappingURL=yaml-frontmatter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"yaml-frontmatter.js","sourceRoot":"","sources":["../../src/utils/yaml-frontmatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW,EAAE,KAAU,EAAE,SAAiB,EAAE;IAC/E,wCAAwC;IACxC,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,GAAG,MAAM,GAAG,GAAG,KAAK,KAAK,EAAE,CAAC;IACrC,CAAC;IAED,oDAAoD;IACpD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,+EAA+E;QAC/E,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QAErC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACnC,SAAS,EAAE,CAAC;YACZ,WAAW,EAAE,GAAG,EAAG,uCAAuC;YAC1D,WAAW,EAAE,QAAQ,CAAE,gCAAgC;SACxD,CAAC,CAAC,IAAI,EAAE,CAAC;QAEV,OAAO,GAAG,MAAM,GAAG,GAAG,KAAK,WAAW,EAAE,CAAC;IAC3C,CAAC;IAED,iDAAiD;IACjD,OAAO,GAAG,MAAM,GAAG,GAAG,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAC7C,CAAC"}
@@ -1,70 +0,0 @@
1
- # opkg login – Device Authorization Flow (RFC 8628)
2
-
3
- ## Goals
4
- - Add `opkg login [--profile <name>]` using OAuth 2.0 Device Authorization Grant.
5
- - Store bearer tokens per profile; keep API-key auth backward compatible.
6
-
7
- ## Command behavior
8
- - Syntax: `opkg login [--profile <name>]`
9
- - Profile: optional; defaults to `default`.
10
- - Flow:
11
- 1) Start device authorization → get `device_code`, `user_code`, `verification_uri`, `verification_uri_complete`, `expires_in`, `interval`.
12
- 2) Print code/URL; attempt to open browser to `verification_uri_complete`.
13
- 3) Poll token endpoint until success/denied/expired/timeout.
14
- 4) On success, persist access/refresh tokens to the selected profile.
15
- 5) On failure, show actionable error and exit non-zero.
16
-
17
- ## HTTP interactions (backend contract)
18
- - POST `/auth/device/authorize` (no auth):
19
- - Body: `{ clientId: 'opkg-cli', scope?: 'openid', deviceName?: 'opkg-cli' }`
20
- - Response: `{ device_code, user_code, verification_uri, verification_uri_complete, expires_in, interval }`
21
- - POST `/auth/device/token` (no auth):
22
- - Body: `{ deviceCode }`
23
- - Success: `{ access_token, refresh_token, token_type: 'bearer', expires_in }`
24
- - Error codes (HTTP 400): `authorization_pending`, `slow_down`, `expired_token`, `access_denied`
25
- - POST `/auth/refresh` (no auth) for refresh flow:
26
- - Body: `{ refreshToken }`
27
- - Success: `{ accessToken, refreshToken }`
28
-
29
- ## CLI storage & auth selection
30
- - Extend `ProfileCredentials` to include `access_token`, `refresh_token`, `expires_at`, `token_type`.
31
- - Credentials persisted in the existing profile credentials INI; preserve existing `api_key`.
32
- - Header selection:
33
- - Prefer non-expired access token → `Authorization: Bearer <token>`.
34
- - If expired and refresh token present → call `/auth/refresh`, persist new pair.
35
- - Fallback: `X-API-Key` if present.
36
- - If none: instruct user to run `opkg login` or configure API key.
37
-
38
- ## UX requirements
39
- - Print user code and verification URL.
40
- - Open browser best-effort; if it fails, user can manually visit the URL.
41
- - Poll respecting `interval`; on `slow_down` add +5s each time.
42
- - Time out when `expires_in` elapses; show “code expired, rerun opkg login.”
43
- - Errors:
44
- - `access_denied`: “Access denied. Please restart opkg login.”
45
- - `expired_token`: “Code expired. Please rerun opkg login.”
46
-
47
- ## Persistence details
48
- - `expires_at` derived from `Date.now() + expires_in*1000` or JWT `exp`.
49
- - When refreshing, keep existing `api_key` intact in the profile record.
50
-
51
- ## Edge cases & fallbacks
52
- - If profile missing: create credentials entry when saving tokens.
53
- - If refresh fails: drop to API key if present; otherwise require login.
54
- - Platform-specific browser open: `open` (mac), `start` (win), `xdg-open` (linux); ignore failures.
55
-
56
- ## Logout command
57
- - Syntax: `opkg logout [--profile <name>]`
58
- - Requires stored OAuth tokens for the profile; no-op if none.
59
- - Sends `POST /auth/logout` with bearer auth and `{ refreshToken }` body.
60
- - On success or failure, clears local token store entry; keeps any configured API key.
61
- - If profile resolved as direct API key usage, exit with “no OAuth session.”
62
-
63
- ## Telemetry/logging (minimal)
64
- - Debug log start/stop of poll, slow_down adjustments, refresh attempts.
65
- - Do not log tokens.
66
-
67
- ## Non-goals (future)
68
- - Device-name flag, headless/no-browser flag.
69
- - Multi-factor UX in CLI.
70
-
@@ -1,70 +0,0 @@
1
- # opkg login – Device Authorization Flow (RFC 8628)
2
-
3
- ## Goals
4
- - Add `opkg login [--profile <name>]` using OAuth 2.0 Device Authorization Grant.
5
- - Store bearer tokens per profile; keep API-key auth backward compatible.
6
-
7
- ## Command behavior
8
- - Syntax: `opkg login [--profile <name>]`
9
- - Profile: optional; defaults to `default`.
10
- - Flow:
11
- 1) Start device authorization → get `device_code`, `user_code`, `verification_uri`, `verification_uri_complete`, `expires_in`, `interval`.
12
- 2) Print code/URL; attempt to open browser to `verification_uri_complete`.
13
- 3) Poll token endpoint until success/denied/expired/timeout.
14
- 4) On success, persist access/refresh tokens to the selected profile.
15
- 5) On failure, show actionable error and exit non-zero.
16
-
17
- ## HTTP interactions (backend contract)
18
- - POST `/auth/device/authorize` (no auth):
19
- - Body: `{ clientId: 'opkg-cli', scope?: 'openid', deviceName?: 'opkg-cli' }`
20
- - Response: `{ device_code, user_code, verification_uri, verification_uri_complete, expires_in, interval }`
21
- - POST `/auth/device/token` (no auth):
22
- - Body: `{ deviceCode }`
23
- - Success: `{ access_token, refresh_token, token_type: 'bearer', expires_in }`
24
- - Error codes (HTTP 400): `authorization_pending`, `slow_down`, `expired_token`, `access_denied`
25
- - POST `/auth/refresh` (no auth) for refresh flow:
26
- - Body: `{ refreshToken }`
27
- - Success: `{ accessToken, refreshToken }`
28
-
29
- ## CLI storage & auth selection
30
- - Extend `ProfileCredentials` to include `access_token`, `refresh_token`, `expires_at`, `token_type`.
31
- - Credentials persisted in the existing profile credentials INI; preserve existing `api_key`.
32
- - Header selection:
33
- - Prefer non-expired access token → `Authorization: Bearer <token>`.
34
- - If expired and refresh token present → call `/auth/refresh`, persist new pair.
35
- - Fallback: `X-API-Key` if present.
36
- - If none: instruct user to run `opkg login` or configure API key.
37
-
38
- ## UX requirements
39
- - Print user code and verification URL.
40
- - Open browser best-effort; if it fails, user can manually visit the URL.
41
- - Poll respecting `interval`; on `slow_down` add +5s each time.
42
- - Time out when `expires_in` elapses; show “code expired, rerun opkg login.”
43
- - Errors:
44
- - `access_denied`: “Access denied. Please restart opkg login.”
45
- - `expired_token`: “Code expired. Please rerun opkg login.”
46
-
47
- ## Persistence details
48
- - `expires_at` derived from `Date.now() + expires_in*1000` or JWT `exp`.
49
- - When refreshing, keep existing `api_key` intact in the profile record.
50
-
51
- ## Edge cases & fallbacks
52
- - If profile missing: create credentials entry when saving tokens.
53
- - If refresh fails: drop to API key if present; otherwise require login.
54
- - Platform-specific browser open: `open` (mac), `start` (win), `xdg-open` (linux); ignore failures.
55
-
56
- ## Logout command
57
- - Syntax: `opkg logout [--profile <name>]`
58
- - Requires stored OAuth tokens for the profile; no-op if none.
59
- - Sends `POST /auth/logout` with bearer auth and `{ refreshToken }` body.
60
- - On success or failure, clears local token store entry; keeps any configured API key.
61
- - If profile resolved as direct API key usage, exit with “no OAuth session.”
62
-
63
- ## Telemetry/logging (minimal)
64
- - Debug log start/stop of poll, slow_down adjustments, refresh attempts.
65
- - Do not log tokens.
66
-
67
- ## Non-goals (future)
68
- - Device-name flag, headless/no-browser flag.
69
- - Multi-factor UX in CLI.
70
-
@@ -1,193 +0,0 @@
1
- ## Platforms system behavior
2
-
3
- ### Overview
4
-
5
- The platforms system provides a unified way to describe and work with different AI coding platforms (e.g. Cursor, Claude, Gemini) so that OpenPackage can manage platform‑specific rules, commands, agents, and skills consistently.
6
-
7
- From a user’s perspective, the platform layer answers:
8
- - **Which platforms are supported in this workspace?**
9
- - **Where do their files live on disk?**
10
- - **Which files belong to which platform (or to the generic `ai` space)?**
11
- - **Which root files (e.g. `CLAUDE.md`) are active, and how are they used?**
12
-
13
- All platform definitions (names, directories, root files, and subdirectories) are centralized in `platforms.jsonc`.
14
-
15
- Each platform entry in `platforms.jsonc` has the shape:
16
-
17
- - `name` (string): Human‑readable display name.
18
- - `rootDir` (string): Platform root directory (e.g. `.cursor`, `.claude`).
19
- - `rootFile?` (string): Optional root file at the project root (e.g. `CLAUDE.md`, `QWEN.md`).
20
- - `subdirs` (object): Map from universal subdir keys (`rules`, `commands`, `agents`, `skills`) to:
21
- - `path` (string): Directory path under `rootDir`.
22
- - `exts?` (string[]): Allowed workspace file extensions. When omitted, all extensions are allowed; when an empty array, no extensions are allowed.
23
- - `transformations?` (array): Optional extension conversion rules with `{ packageExt, workspaceExt }` entries that describe how files convert between registry and workspace formats.
24
- - `aliases?` (string[]): Optional CLI aliases that resolve to this platform.
25
- - `enabled?` (boolean): When `false`, the platform exists in config but is treated as disabled.
26
-
27
- ---
28
-
29
- ### Platform identities and aliases
30
-
31
- - **Platform id**: each platform has a lowercase id (e.g. `cursor`, `claude`, `gemini`) used throughout the CLI. These ids are the top‑level keys in `platforms.jsonc`.
32
- - **Enabled flag**:
33
- - Platforms are considered **enabled by default**.
34
- - A platform can be explicitly disabled in `platforms.jsonc` via `enabled: false` (e.g. for experimental or unsupported platforms).
35
- - Functions that list or iterate platforms only include **enabled** platforms by default, with optional flags to include disabled ones when needed.
36
- - **Aliases**:
37
- - Each platform can declare **human‑friendly aliases** in its `aliases` array (e.g. `claudecode`, `codexcli`, `geminicli`, `kilocode`, `qwencode`).
38
- - Aliases are resolved case‑insensitively to a canonical platform id.
39
- - User‑facing prompts or configs can accept either the platform id or any of its aliases.
40
-
41
- **Resolution behavior**
42
-
43
- - Given a string input (e.g. from CLI flags, prompts, or config), the system:
44
- - First treats it as a platform id (after lowercasing).
45
- - If there is no direct match, it looks it up in the alias map.
46
- - If neither match, the platform is treated as **unknown**.
47
-
48
- ---
49
-
50
- ### Directory layout and universal subdirs
51
-
52
- Each platform defines:
53
- - A **root directory** (e.g. `.cursor`, `.claude`, `.gemini`).
54
- - Optional **root file** at the project root (e.g. `CLAUDE.md`, `GEMINI.md`, `QWEN.md`, `WARP.md`, or the shared `AGENTS.md`).
55
- - A set of **universal subdirectories**, which describe where different kinds of content live:
56
- - `rules` – steering/rules files for a platform.
57
- - `commands` – command/workflow prompt files.
58
- - `agents` – agent definitions.
59
- - `skills` – skill or tool definitions.
60
-
61
- For each subdirectory, the platform definition specifies:
62
- - **Path** under the platform root (e.g. `.cursor/rules`, `.factory/droids`, `.kilo/workflows`).
63
- - **Allowed extensions**: which workspace file extensions are considered part of that subdir (e.g. `.md`, `.mdc`, `.toml`). Omit to allow any extension or set an empty list to disallow all files.
64
- - **Extension transformations**: optional `{ packageExt, workspaceExt }` pairs that describe how files convert between registry/universal formats and platform-specific workspace formats (e.g. Cursor rules convert `.md` registry files to `.mdc` in the workspace).
65
-
66
- **Examples**
67
-
68
- - Cursor:
69
- - Root dir: `.cursor`
70
- - Subdirs:
71
- - `rules` → `.cursor/rules` (reads `.mdc` + `.md`, writes `.mdc`)
72
- - `commands` → `.cursor/commands` (reads/writes `.md`)
73
- - Claude:
74
- - Root dir: `.claude`
75
- - Root file: `CLAUDE.md`
76
- - Subdirs:
77
- - `commands` → `.claude/commands`
78
- - `agents` → `.claude/agents`
79
- - `skills` → `.claude/skills`
80
-
81
- The system exposes a **platform directory map** that, given a working directory, tells callers where each platform’s `rules`, `commands`, `agents`, and `skills` live on disk.
82
-
83
- ---
84
-
85
- ### Platform detection
86
-
87
- The platforms system can **detect which platforms are present** in a workspace using two signals:
88
-
89
- 1. **Platform directories**:
90
- - For each enabled platform, the system checks whether its root directory exists in the current working directory.
91
- - If the root directory exists, the platform is marked as **present**.
92
-
93
- 2. **Root files**:
94
- - For platforms that define a root file (e.g. `CLAUDE.md`, `GEMINI.md`, `QWEN.md`, `WARP.md`), the system checks whether those files exist at the project root.
95
- - If a root file exists, the corresponding platform is also marked as **present**, even if its standard directory structure is missing.
96
- - The shared `AGENTS.md` file is treated as **universal** and not attributed to a single platform.
97
-
98
- The result is:
99
- - A list of **detection results** (for each platform: `{ name, detected }`).
100
- - A convenience list of **detected platforms only** (used by higher‑level features like setup flows).
101
-
102
- ---
103
-
104
- ### Platform‑specific directories and creation
105
-
106
- The platforms system provides helpers for:
107
-
108
- - **Getting directory paths** for each platform:
109
- - For each enabled platform, callers can retrieve:
110
- - The `rules` directory path.
111
- - Optional `commands`, `agents`, and `skills` directory paths.
112
- - Optional `rootFile` path, if the platform defines one.
113
- - **Creating missing platform directories**:
114
- - Given a list of platform ids and a working directory:
115
- - Ensures the `rules` directory exists for each platform.
116
- - Creates directories as needed and returns a list of newly created paths.
117
-
118
- These helpers allow commands like `opkg init` or platform setup flows to create the necessary folder structure for one or more platforms.
119
-
120
- ---
121
-
122
- ### Validating platform structure
123
-
124
- For a given platform and working directory, the system can validate:
125
- - That the `rules` directory exists.
126
- - That the configured root file (if any) exists.
127
-
128
- It returns:
129
- - A simple `{ valid: boolean, issues: string[] }` result:
130
- - `valid = true` when the platform’s required directories/files are present.
131
- - `issues` describing any missing or inconsistent paths.
132
-
133
- This is used by higher‑level commands to surface actionable warnings when a platform’s layout is incomplete.
134
-
135
- ---
136
-
137
- ### File extension behavior
138
-
139
- For each platform’s `rules` subdir, the system exposes:
140
- - The **set of file extensions** that are considered valid rules files for that platform.
141
- - Example: Cursor rules accept `.mdc` and `.md`, Gemini commands accept `.toml`, etc.
142
- - Higher‑level discovery utilities rely on this to:
143
- - Filter files by extension when searching for platform content.
144
- - Decide which files are safe to manage or delete during uninstall/cleanup operations.
145
-
146
- ---
147
-
148
- ### Universal subdirectory listing
149
-
150
- For any detected platform, the platforms system can return a **normalized list of its subdirectories**:
151
- - Each entry includes:
152
- - The full directory path.
153
- - The universal label (`rules`, `commands`, `agents`, `skills`).
154
- - A short leaf name (last path component) for display.
155
-
156
- This list is consumed by:
157
- - Discovery utilities that search for platform‑specific files.
158
- - Uninstall/cleanup flows that remove platform files for a given package.
159
-
160
- ---
161
-
162
- ### Platform inference from file paths
163
-
164
- The platforms system helps determine which platform a given file belongs to by:
165
-
166
- 1. **Using path‑to‑platform mappings**:
167
- - A dedicated mapper converts full workspace paths into a *universal* representation that includes the platform id where possible (e.g. `.cursor/rules/foo.mdc` → platform `cursor` + `rules/foo.mdc`).
168
-
169
- 2. **Checking for generic workspace directories**:
170
- - Files that do not live under a known platform root (for example, a conventional `ai/` folder) are treated as workspace-level content rather than being assigned to a specific platform.
171
-
172
- 3. **Looking at source directory names**:
173
- - If a file lives under a known platform root directory (e.g. `.cursor`, `.claude`), the system infers that platform from the directory.
174
-
175
- 4. **Parsing registry paths with platform suffixes**:
176
- - As a final fallback, the system inspects registry paths for explicit platform suffixes (e.g. `rules/file.cursor.md`) and maps them back to a platform id when possible.
177
-
178
- The result is a best‑effort platform id (or a `workspace` classification) for a given file, which other components use to route content to the right registry paths and conflict‑resolution logic.
179
-
180
- ---
181
-
182
- ### Root file handling
183
-
184
- The platforms system exposes **all known platform root filenames**, derived from the `rootFile` fields in `platforms.jsonc` plus the universal `AGENTS.md`. These are used to:
185
- - Discover root files in the workspace or in the local registry.
186
- - Map root files back to platforms (except for universal `AGENTS.md`).
187
- - Coordinate how content from multiple platform‑specific root files is merged or extracted into a universal view (handled by other utilities).
188
-
189
- From a behavioral perspective:
190
- - Platforms that define root files can participate in root‑file‑based flows (e.g. reading/writing `CLAUDE.md`).
191
- - Platforms without root files rely exclusively on their directory layout (`.cursor/rules`, `.kilo/workflows`, etc.).
192
-
193
-