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
@@ -2,145 +2,267 @@
2
2
 
3
3
  #### 1. Overview
4
4
 
5
- When multiple candidates exist for the same registry path, the pipeline must decide which content to use. This document describes the conflict resolution rules.
5
+ When multiple workspace candidates exist for the same registry path, the pipeline must decide which content to save. This document describes the conflict resolution rules for the **workspace → source** save flow.
6
6
 
7
7
  ---
8
8
 
9
- #### 2. Resolution Goals
9
+ #### 2. Single-Direction Principle
10
10
 
11
- For each group, the pipeline decides:
11
+ Save is a **unidirectional** operation: workspace content overwrites source content. There is no comparison or "merging" with existing source files. The only conflicts that need resolution are:
12
12
 
13
- - Whether any action is needed (no-op when everything matches).
14
- - Which content becomes the **universal** package content for that registry path.
15
- - Which workspace candidates, if any, should be treated as **platform‑specific** sidecars.
13
+ 1. **Multiple workspace files mapping to the same registry path**
14
+ 2. **Platform-specific vs. universal content selection**
15
+
16
+ The source file is only used for **optimization** (skip writes when content is identical) and **parity checking** (skip prompts when workspace matches source).
16
17
 
17
18
  ---
18
19
 
19
- #### 3. Conflict Types
20
+ #### 3. Resolution Goals
20
21
 
21
- There are two main flavors of groups:
22
+ For each group where multiple workspace candidates exist, the pipeline decides:
22
23
 
23
- 1. **Root conflicts** (root documentation file for the package)
24
- 2. **Regular conflicts** (all other paths)
24
+ - Which workspace candidate becomes the **universal** package content
25
+ - Which workspace candidates should be saved as **platform-specific** variants
26
+ - Which candidates should be skipped (already at parity or user choice)
25
27
 
26
28
  ---
27
29
 
28
- #### 4. Root Conflicts
30
+ #### 4. Parity Checking
31
+
32
+ Before prompting, the pipeline checks if workspace files are already at parity with source:
29
33
 
30
- For the root package section file (e.g. the unified agents document):
34
+ ##### Universal Parity
35
+ A workspace file is at **universal parity** if its content hash matches the universal source file.
31
36
 
32
- ##### Ordering and deduplication
37
+ ##### Platform-Specific Parity
38
+ A workspace file is at **platform-specific parity** if:
39
+ - It has a platform association (e.g., `cursor`, `claude`)
40
+ - Its content hash matches the corresponding platform-specific source file (e.g., `commands.cursor.md`)
33
41
 
34
- - The pipeline orders candidates roughly by:
35
- - Existing local content first (if any).
36
- - Workspace candidates by newest modification time, then by display path.
37
- - Deduplicates candidates by content hash.
42
+ ##### Auto-Skipping
43
+ Files at parity are automatically skipped with a clear message:
44
+ - "Already matches universal - auto-skipping"
45
+ - "Already matches platform-specific file - auto-skipping"
38
46
 
39
- ##### Single candidate
47
+ This eliminates unnecessary prompts when files are already up-to-date.
40
48
 
41
- - If there is exactly one unique candidate:
42
- - That candidate is used as the universal content for the root file.
49
+ ---
43
50
 
44
- ##### Multiple differing candidates
51
+ #### 5. Conflict Types
45
52
 
46
- - If the local candidate is newer than or equal to all workspace candidates:
47
- - The local candidate is selected automatically.
48
- - Otherwise:
49
- - With `--force`:
50
- - The local candidate always wins.
51
- - Without `--force`:
52
- - The user is prompted to choose which candidate should become the universal root content.
53
+ ##### No Workspace Candidates
54
+ - No action needed
55
+ - Group is skipped entirely
53
56
 
54
- ##### Output
57
+ ##### Single Workspace Candidate
58
+ - **If matches source (parity)**: Auto-skip (no write needed)
59
+ - **If differs from source**: Write to source automatically (no prompt)
55
60
 
56
- - The chosen root content is written into the package's root file location.
57
- - Platform‑specific root selections (e.g. separate root files for individual platforms) are persisted as separate package files where appropriate.
61
+ ##### Multiple Identical Workspace Candidates (Same Content Hash)
62
+ - **If all match source (parity)**: Auto-skip all
63
+ - **If differ from source**: Pick newest by mtime, write to source (no prompt)
64
+
65
+ ##### Multiple Differing Workspace Candidates
66
+ - **With `--force` flag:**
67
+ - Auto-select newest by mtime (alphabetical tie-breaker if mtimes equal)
68
+ - Skip others
69
+ - No prompts
70
+ - **Without `--force`:**
71
+ - Interactive resolution (see below)
58
72
 
59
73
  ---
60
74
 
61
- #### 5. Regular Conflicts
75
+ #### 6. Interactive Resolution Flow
62
76
 
63
- For non‑root paths:
77
+ When multiple differing workspace candidates exist, the user is prompted **once per file** in a single-step process:
64
78
 
65
- ##### Ordering and deduplication
79
+ ##### Step 1: Parity Filtering
80
+ For each candidate (ordered by mtime, newest first):
81
+ - Check universal parity → Auto-skip if matches
82
+ - Check platform-specific parity → Auto-skip if matches
83
+ - Continue to prompt if not at parity
66
84
 
67
- - The pipeline again orders and deduplicates candidates.
68
- - Checks whether any workspace candidate actually **differs** from the local candidate.
85
+ ##### Step 2: Per-File Prompts
86
+ For each remaining candidate:
69
87
 
70
- ##### No local candidate
88
+ **Before universal selected:**
89
+ - Options: `[Set as universal]` `[Mark as platform-specific]` `[Skip]`
71
90
 
72
- - If the file does not yet exist in the package:
73
- - The selected workspace candidate becomes the new file content.
91
+ **After universal selected:**
92
+ - Check if identical to selected universal Auto-skip if matches
93
+ - Options: `[Mark as platform-specific]` `[Skip]`
74
94
 
75
- ##### Identical content
95
+ ##### Step 3: Resolution
96
+ After all prompts:
97
+ - **Universal selected**: Write to `<registry-path>`
98
+ - **Platform-specific marked**: Write to `<registry-path>.<platform>.<ext>`
99
+ - **Skipped**: No action (neither written)
100
+ - **No universal selected**: Original universal file remains untouched, only platform-specific files written
76
101
 
77
- - If local and all workspace candidates have identical content:
78
- - The group is skipped (no changes).
102
+ ---
79
103
 
80
- ##### Differences with local candidate
104
+ #### 7. Resolution Principles
81
105
 
82
- When there are differences and a local candidate exists:
106
+ The save flow ensures:
83
107
 
84
- - If the local candidate is newer or as new as any workspace candidate:
85
- - The local version wins silently (no prompt).
86
- - If a newer workspace candidate exists:
87
- - Without `--force`:
88
- - The user is prompted to choose which candidate should become universal content.
89
- - With `--force`:
90
- - The local candidate wins even if workspace content is newer.
108
+ 1. **Workspace always wins**: Source content is overwritten by workspace selections
109
+ 2. **Smart filtering**: Files at parity are auto-skipped (no unnecessary prompts)
110
+ 3. **Progressive disclosure**: Options simplify after universal is selected
111
+ 4. **No data loss**: Skipped files remain in workspace, can be saved later
112
+ 5. **Platform-aware**: Respects both universal and platform-specific parity
113
+ 6. **User control**: User can skip individual files or mark as platform-specific
91
114
 
92
115
  ---
93
116
 
94
- #### 6. Resolution Principles
117
+ #### 8. Force Mode Behavior
118
+
119
+ With `--force` flag:
120
+ - Auto-selects newest workspace file by mtime
121
+ - **Tie-breaking**: If multiple files have same mtime, selects first alphabetically
122
+ - No prompts (fully automated)
123
+ - Transparent logging of selections and skipped files
124
+ - Does NOT auto-create platform-specific variants (only universal)
125
+
126
+ Example force mode output:
127
+ ```
128
+ ℹ Force mode: Auto-selecting newest (.cursor/commands/test.md)
129
+ Skipping: .claude/commands/test.md (older)
130
+ Skipping: .opencode/commands/test.md (older)
131
+
132
+ ✓ Saved my-pkg
133
+ Updated: commands/test.md
134
+ ```
135
+
136
+ Example with tie-breaking:
137
+ ```
138
+ ℹ Force mode: Multiple files have same modification time (1/15/2024 10:30 AM)
139
+ Auto-selecting first alphabetically: .claude/commands/test.md
140
+ Tied files:
141
+ → .claude/commands/test.md
142
+ .cursor/commands/test.md
143
+ Skipping: .cursor/commands/test.md (tied, not alphabetically first)
144
+
145
+ 💡 Tip: If this wasn't the file you wanted, run without --force
146
+ ```
147
+
148
+ ---
149
+
150
+ #### 9. Edge Cases
151
+
152
+ ##### No Universal Selected
153
+ If user skips all candidates or marks all as platform-specific:
154
+ - Original universal file remains **untouched**
155
+ - Only platform-specific files are written
156
+ - No confirmation prompt needed
95
157
 
96
- In all cases, the goal is to:
158
+ ##### All Files Skipped
159
+ If user skips all files (or all are at parity):
160
+ - No changes made
161
+ - No confirmation prompt needed
162
+ - Message: "No changes to `<path>`"
97
163
 
98
- - Prefer local content when it is at least as new as workspace content.
99
- - Ask the user only when a newer workspace change would override local content.
100
- - Respect an explicit `--force` override in favor of local content.
164
+ ##### All Files at Parity
165
+ If all workspace files match source:
166
+ - All auto-skipped with clear messages
167
+ - No prompts shown
168
+ - Message: "No changes needed"
101
169
 
102
170
  ---
103
171
 
104
- #### 7. Platform‑Specific Selection
172
+ #### 10. Example Scenarios
105
173
 
106
- Some workspace candidates are associated with specific platforms (e.g. platform‑specific variants of a shared file).
174
+ ##### Scenario A: Mixed Parity
175
+ ```
176
+ Workspace:
177
+ .cursor/commands/test.md (hash: abc123) ← Matches universal
178
+ .claude/commands/test.md (hash: def456) ← Different!
107
179
 
108
- ##### Marking platform-specific candidates
180
+ Source:
181
+ commands/test.md (hash: abc123)
109
182
 
110
- - Before choosing the universal content, the user can be offered a chance to:
111
- - Mark one or more workspace candidates as **platform‑specific**.
112
- - These marked candidates will be written to platform‑specific registry paths instead of becoming the universal content.
183
+ Interactive flow:
184
+ .cursor/commands/test.md
185
+ Already matches universal - auto-skipping
113
186
 
114
- ##### After marking
187
+ .claude/commands/test.md (claude) [1/14/2024]
188
+ What should we do with this file?
189
+ > Mark as platform-specific
115
190
 
116
- - The remaining candidates (local + unmarked workspace candidates) participate in universal conflict resolution as described above.
117
- - Marked candidates are saved as platformspecific sidecars if they are not chosen as the universal content.
191
+ Result:
192
+ Created: commands.claude.md (platform-specific)
193
+ ```
118
194
 
119
- ##### Use case
195
+ ##### Scenario B: Platform-Specific at Parity
196
+ ```
197
+ Workspace:
198
+ .cursor/commands/test.md (hash: abc123) ← Different from universal
199
+ .claude/commands/test.md (hash: def456) ← Matches platform file!
120
200
 
121
- This mechanism lets a user:
201
+ Source:
202
+ commands/test.md (hash: xyz789)
203
+ commands.claude.md (hash: def456) ← Matches!
122
204
 
123
- - Keep a single universal file.
124
- - Simultaneously maintain richer, platform‑specific versions where needed.
205
+ Interactive flow:
206
+ .cursor/commands/test.md (cursor) [1/15/2024]
207
+ What should we do with this file?
208
+ > Set as universal
209
+
210
+ ✓ .claude/commands/test.md
211
+ Already matches platform-specific file - auto-skipping
212
+
213
+ Result:
214
+ Updated: commands/test.md (from cursor)
215
+ ```
216
+
217
+ ##### Scenario C: One Edited, Others at Parity
218
+ ```
219
+ Workspace:
220
+ .cursor/commands/test.md (hash: NEW123) ← User just edited
221
+ .claude/commands/test.md (hash: abc123) ← At parity
222
+ .opencode/commands/test.md (hash: abc123) ← At parity
223
+
224
+ Source:
225
+ commands/test.md (hash: abc123)
226
+
227
+ Interactive flow:
228
+ .cursor/commands/test.md (cursor) [1/15/2024 10:35 AM]
229
+ What should we do with this file?
230
+ > Set as universal
231
+
232
+ ✓ .claude/commands/test.md
233
+ Already matches universal - auto-skipping
234
+ ✓ .opencode/commands/test.md
235
+ Already matches universal - auto-skipping
236
+
237
+ Result:
238
+ Updated: commands/test.md (from cursor)
239
+ ```
125
240
 
126
241
  ---
127
242
 
128
- #### 8. Escalation from YAML Overrides to Full Platform Markdown
243
+ #### 11. Removed Behaviors
129
244
 
130
- When a registry path participates in the frontmatter/YAML override pipeline (e.g. `.openpackage/agents/*.md`) **and** the user marks one or more workspace candidates as platform‑specific during conflict resolution:
245
+ The following behaviors have been removed as they conflicted with single-direction flow:
131
246
 
132
- - **Universal body update**
133
- - The universal markdown file keeps its existing frontmatter.
134
- - If the selected universal candidate’s body differs, only the **markdown body** is updated.
135
- - Frontmatter for that path continues to be managed by the YAML override pipeline.
247
+ - Comparing workspace mtime against source mtime for resolution
248
+ - Preferring source content when it's newer
249
+ - Prompting to choose between source and workspace versions
250
+ - "Local wins with --force" logic
251
+ - ❌ Two-phase prompt flow (platform marking + universal selection)
252
+
253
+ ---
136
254
 
137
- - **Escalating a platform to full `.platform.md`**
138
- - Each marked platform‑specific workspace candidate is written to a platform‑specific markdown path (e.g. `yaml-test.qwen.md`) using the **full candidate content** (frontmatter + body).
139
- - For root conflicts, only the section body is used (consistent with root handling elsewhere).
255
+ #### 12. Summary
140
256
 
141
- - **Interaction with YAML overrides**
142
- - If a platform has an existing YAML override file (e.g. `yaml-test.qwen.yml`) and is escalated to a full `.platform.md`:
143
- - The corresponding YAML override file is removed as redundant.
144
- - That platform is removed from the frontmatter merge plan for that registry path.
145
- - After escalation, the remaining frontmatter/YAML plans (if any) are applied only for platforms that still use YAML overrides, ensuring universal frontmatter is not recomputed based on escalated full‑markdown variants.
257
+ | Situation | Behavior |
258
+ |-----------|----------|
259
+ | **Single workspace file** | Write if differs from source, skip if at parity |
260
+ | **Multiple identical** | Pick newest, write if differs from source |
261
+ | **Multiple differing + force** | Auto-select newest (alphabetical tie-breaker) |
262
+ | **Multiple differing + interactive** | Prompt per file (parity-filtered, single-step) |
263
+ | **File matches universal** | Auto-skip with message |
264
+ | **File matches platform-specific** | Auto-skip with message |
265
+ | **No universal selected** | Original untouched, only platform-specific written |
266
+ | **All skipped** | No changes, no confirmation |
146
267
 
268
+ The conflict resolution ensures a smooth, intuitive workflow that minimizes prompts while giving users full control over their content.
@@ -12,9 +12,11 @@ For each save/pack run, the pipeline considers up to four sets of candidates:
12
12
 
13
13
  ##### Local platform candidates
14
14
 
15
- - Files already present in the **package directory** under `.openpackage/packages/<name>/`.
15
+ - Files already present in the **package root**:
16
+ - **Root package**: `<cwd>/` (universal subdirs, root files, `root/` direct copy)
17
+ - **Nested package**: `<cwd>/.openpackage/packages/<name>/`
16
18
  - Excludes:
17
- - Internal `package.index.yml` metadata.
19
+ - Internal `openpackage.index.yml` metadata.
18
20
  - Certain root marker files (e.g. the unified root agents file) that are handled specially.
19
21
  - Only includes paths that are allowed by the registry path rules (e.g. skip internal or unsupported paths).
20
22
 
@@ -54,7 +56,7 @@ Each candidate includes:
54
56
 
55
57
  #### 4. First Save vs Subsequent Saves
56
58
 
57
- The behavior changes depending on whether the package already has an index (`package.index.yml`) with file mapping information.
59
+ The behavior changes depending on whether the package already has an index (`openpackage.index.yml`) with file mapping information.
58
60
 
59
61
  ##### First save (no index present, or empty file mapping)
60
62
 
@@ -67,7 +69,7 @@ The behavior changes depending on whether the package already has an index (`pac
67
69
 
68
70
  ##### Subsequent saves (index present with file mappings)
69
71
 
70
- - The pipeline uses `package.index.yml` as a **filter** for which workspace paths are relevant:
72
+ - The pipeline uses `openpackage.index.yml` as a **filter** for which workspace paths are relevant:
71
73
  - It builds a set of allowed registry paths and directories based on the index's `files` keys.
72
74
  - Workspace candidates whose registry paths are outside this allowed set are ignored, except for root files that are deliberately allowed.
73
75
  - It merges local and workspace candidates:
@@ -1,8 +1,8 @@
1
- ### Save Pipeline – Frontmatter and YAML Overrides
1
+ ### Save Pipeline – Frontmatter and Inline Platform Overrides
2
2
 
3
3
  #### 1. Overview
4
4
 
5
- For markdown files, the pipeline manages **frontmatter** and platform‑specific overrides to keep shared metadata centralized while allowing platform-specific behavior.
5
+ For markdown files, the pipeline manages **frontmatter** and platform‑specific overrides to keep shared metadata centralized while allowing platform-specific behavior. Platform overrides now live **inline** inside the universal markdown frontmatter under `openpackage.<platform>` (ids/aliases); no separate `.yml` override files are written.
6
6
 
7
7
  ---
8
8
 
@@ -26,25 +26,22 @@ For each platform:
26
26
 
27
27
  - The per‑platform frontmatter is compared against the universal frontmatter.
28
28
  - Only the **difference** per platform is treated as that platform's override, or omitted if empty.
29
- - Platform overrides are written into **separate YAML files** in a dedicated overrides location.
29
+ - Platform overrides are embedded **inline** under `openpackage.<platform>` (id/alias) in the universal frontmatter.
30
+ - During apply/install, the target platform’s block is deep‑merged onto the common frontmatter to produce the final frontmatter for that platform. Platform blocks are not emitted in the installed files.
30
31
 
31
32
  ---
32
33
 
33
34
  #### 5. Conflicts with Existing Overrides
34
35
 
35
- When a platform override file already exists for a path:
36
-
37
- - The pipeline compares existing and new frontmatter, taking modification times into account.
38
- - Typically:
39
- - If the newer change comes from the workspace, it is preferred by default.
40
- - When there is a conflicting but not clearly newer override, the user may be prompted to choose between workspace and existing override content where appropriate.
36
+ All overrides are computed from workspace candidates (overwrite-derived). The universal frontmatter is rewritten to contain the shared keys plus per-platform blocks; no external override files are consulted or prompted for.
41
37
 
42
38
  ---
43
39
 
44
40
  #### 6. Resulting Layout
45
41
 
46
- - One universal markdown file with shared frontmatter.
47
- - Zero or more per‑platform YAML override files capturing only the per‑platform differences.
42
+ - One universal markdown file with:
43
+ - Shared/common frontmatter keys
44
+ - Per‑platform blocks nested under `openpackage.<platform>` containing only the per‑platform differences
48
45
 
49
46
  This scheme keeps:
50
47
 
@@ -60,15 +57,14 @@ After all conflicts and frontmatter merges are resolved, the pipeline reads the
60
57
 
61
58
  ##### Excluded
62
59
 
63
- - `package.index.yml`.
60
+ - `openpackage.index.yml`.
64
61
  - Internal files that are not considered part of the package content.
65
62
 
66
63
  ##### Included
67
64
 
68
65
  - Paths allowed by the regular registry path rules.
69
66
  - Root files (the unified root agents file and related root docs).
70
- - YAML override files that represent platform‑specific metadata.
71
- - Root‑level files adjacent to `package.yml` that are intended as part of the package.
67
+ - Root‑level files adjacent to `openpackage.yml` that are intended as part of the package.
72
68
 
73
69
  ---
74
70
 
@@ -77,5 +73,5 @@ After all conflicts and frontmatter merges are resolved, the pipeline reads the
77
73
  The resulting list of files, with paths relative to the package directory, is what gets:
78
74
 
79
75
  - Copied into the local registry under the computed version.
80
- - Used to drive platform sync and any subsequent operations in the save pipeline.
76
+ - Used to drive optional platform apply/sync and any subsequent operations in the save pipeline.
81
77
 
@@ -1,55 +1,25 @@
1
- ### Save Pipeline Modes and Inputs
1
+ ### Save – Inputs and Flags
2
2
 
3
3
  #### 1. Overview
4
4
 
5
- The **save pipeline** is the shared engine behind:
5
+ `opkg save` syncs workspace edits back to a package **source of truth** using the unified workspace index (`.openpackage/openpackage.index.yml`) as the mapping authority.
6
6
 
7
- - `opkg save` creates a **WIP prerelease** snapshot for the current workspace.
8
- - `opkg pack` – promotes the current workspace state to a **stable** snapshot.
9
-
10
- Both commands:
11
-
12
- - Detect which package to operate on.
13
- - Resolve the effective package name (including scoping and optional rename).
14
- - Compute a target version (WIP vs stable) following `save-pack-versioning.md`.
15
- - Select the set of files that belong to the package.
16
- - Copy those files into the local registry.
17
- - Clean up outdated WIP copies for the current workspace.
18
- - Sync files to platform‑specific layouts (platform sync).
19
-
20
- Versioning details are defined in `../save-pack-versioning.md`.
21
-
22
- ---
23
-
24
- #### 2. Modes
25
-
26
- The pipeline runs in one of two **modes**:
27
-
28
- ##### WIP mode (`save`)
29
-
30
- - Always produces a **WIP prerelease** version derived from the stable line in `package.yml`.
31
- - May optionally auto‑bump `package.yml.version` to the next patch after a stable cycle, per `../save-pack-versioning.md`.
32
-
33
- ##### Stable mode (`pack`)
34
-
35
- - Produces a **stable** version exactly equal to the current `package.yml.version`.
36
- - Never mutates `package.yml.version`.
7
+ It does **not** create registry snapshots (that is `opkg pack`).
37
8
 
38
9
  ---
39
10
 
40
11
  #### 3. Inputs
41
12
 
42
- - **Working directory (`cwd`)** – establishes the workspace.
43
- - **Package name argument (optional)** – may be omitted (context detection) or provided explicitly.
44
- - **Optional path argument (when package is provided)** – `opkg save <package> <path>` first runs the add pipeline for that path (including conflict handling and optional platform-specific transforms) and then saves the package snapshot.
13
+ - **Working directory (`effective cwd` via shell dir or global `--cwd <dir>` flag)** – establishes the workspace root for file discovery, package detection, and saving (see [../cli-options.md]).
14
+ - **Package name argument (required)** – `save` requires a package name because it operates on mappings stored in the unified workspace index.
15
+ - **Optional path argument** – `opkg save <package> <path>` first runs the add pipeline for that path (copy-to-root for non-platform paths), then runs `save` for the package.
45
16
 
46
17
  ---
47
18
 
48
19
  #### 4. Flags
49
20
 
50
21
  - **`force`**
51
- - In WIP mode: can suppress prompts and allow overwriting existing WIP versions.
52
- - In stable mode: allows overwriting existing stable registry entries.
53
- - **`rename <newName>`**optional new package name to apply during this pipeline run.
54
- - **`platform-specific` (save only, when path is provided)** – forwarded to the add stage to generate platform-scoped variants for platform subdirectories.
22
+ - Auto-selects by latest mtime when conflicts occur (non-interactive resolution).
23
+ - **`platform-specific` (only when path is provided)** forwarded to the add stage to generate platform-scoped variants for platform subdirectory inputs.
24
+ - **`apply` (only when path is provided)** forwarded to the add stage to immediately apply after adding (sync platforms).
55
25
 
@@ -13,7 +13,7 @@ After the package context is known, the pipeline determines the **effective name
13
13
  - The detected package config's `name` when no argument is provided.
14
14
  - The pipeline **never accepts a version suffix** here:
15
15
  - Any `name@version` input is rejected with a clear error.
16
- - The error instructs the user to change the stable line in `package.yml` instead.
16
+ - The error instructs the user to change the stable line in `openpackage.yml` instead.
17
17
 
18
18
  ---
19
19
 
@@ -67,7 +67,7 @@ At the end of this phase the pipeline knows:
67
67
 
68
68
  When a rename is needed during `save` or `pack`, the workspace is updated so that **on‑disk layout matches the new name**.
69
69
 
70
- ##### `package.yml`
70
+ ##### `openpackage.yml`
71
71
 
72
72
  - The package's `name` field is updated to the final name.
73
73
 
@@ -75,9 +75,9 @@ When a rename is needed during `save` or `pack`, the workspace is updated so tha
75
75
 
76
76
  - Root files that contain package markers (e.g. sections in shared documentation) are updated so that markers reference the new name instead of the old one.
77
77
 
78
- ##### Root `package.yml` dependencies
78
+ ##### Root `openpackage.yml` dependencies
79
79
 
80
- - The workspace's root `package.yml` (if present) updates any dependency entries that reference the old name to the new name in both `packages` and `dev-packages`.
80
+ - The workspace's root `openpackage.yml` (if present) updates any dependency entries that reference the old name to the new name in both `packages` and `dev-packages`.
81
81
 
82
82
  ##### Nested package directories
83
83
 
@@ -8,7 +8,7 @@ Before any name or version logic, the pipeline determines which package is being
8
8
 
9
9
  #### 2. Core Rule
10
10
 
11
- Any directory that contains `.openpackage/package.yml` is considered a **valid package**.
11
+ Any directory that contains `openpackage.yml` is considered a **valid package**.
12
12
 
13
13
  ---
14
14
 
@@ -16,23 +16,23 @@ Any directory that contains `.openpackage/package.yml` is considered a **valid p
16
16
 
17
17
  ##### No package name argument
18
18
 
19
- - Looks for `.openpackage/package.yml` in the current directory.
19
+ - Looks for `openpackage.yml` in the current directory.
20
20
  - If found:
21
21
  - Treats the current directory as the **root package**.
22
- - Uses its `package.yml` as the configuration source.
22
+ - Uses its `openpackage.yml` as the configuration source.
23
23
  - If not found:
24
24
  - The pipeline **aborts** with a user‑friendly message describing:
25
- - That no package was detected at `cwd`.
26
- - That a `.openpackage/package.yml` file is required.
25
+ - That no package was detected at effective `cwd` (shell dir or `--cwd <dir>`; see [../../cli-options.md]).
26
+ - That an `openpackage.yml` file is required.
27
27
  - How to initialize a package or specify a name explicitly.
28
28
 
29
29
  ##### Package name argument provided
30
30
 
31
- - First checks whether the **root package** (`.openpackage/package.yml` at `cwd`) has a matching `name`.
31
+ - First checks whether the **root package** (`openpackage.yml` at `cwd`) has a matching `name`.
32
32
  - If yes, the root is the target.
33
33
  - Otherwise, looks under the **nested packages directory**:
34
- - Direct directory match under `.openpackage/packages/<name>/package.yml`.
35
- - If necessary, scans all nested package directories to find a `package.yml` whose `name` field equals the requested package name, even if the directory name differs.
34
+ - Direct directory match under `.openpackage/packages/<name>/openpackage.yml`.
35
+ - If necessary, scans all nested package directories to find an `openpackage.yml` whose `name` field equals the requested package name, even if the directory name differs.
36
36
  - If no matching package is found:
37
37
  - The pipeline **aborts** with a message explaining:
38
38
  - The package name was not found.
@@ -46,11 +46,11 @@ Any directory that contains `.openpackage/package.yml` is considered a **valid p
46
46
  Each detected package context includes:
47
47
 
48
48
  - **Package directory** (logical package root for reporting).
49
- - **Path to `package.yml`** (authoritative manifest location).
50
- - **Package files directory** (`packageFilesDir` in code):
51
- - For the **root package**: `<cwd>/.openpackage/…`
52
- - For **nested packages**: `<cwd>/.openpackage/packages/<name>/…`
53
- - Parsed `package.yml` configuration.
49
+ - **Path to `openpackage.yml`** (authoritative manifest location).
50
+ - **Package files directory** (`packageFilesDir` in code; same as package root):
51
+ - For the **root package**: `<cwd>/`
52
+ - For **nested packages**: `<cwd>/.openpackage/packages/<name>/`
53
+ - Parsed `openpackage.yml` configuration.
54
54
  - Whether it is the **root package** or **nested**.
55
55
  - Whether the package's directory is the same as `cwd`.
56
56