opkg 0.9.2 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/code-reviewer.md +171 -0
- package/.claude/commands/commit-push-pr.md +20 -0
- package/.claude/commands/{specs/read.md → read-specs.md} +1 -1
- package/.claude/commands/{specs/update.md → update-specs.md} +4 -0
- package/.claude/skills/code-review-excellence/SKILL.md +538 -0
- package/README.md +2 -2
- package/package.json +3 -1
- package/packages/cli/dist/add-IJAPFHIX.js +624 -0
- package/packages/cli/dist/add-IJAPFHIX.js.map +7 -0
- package/packages/cli/dist/add-LLUNFLJI.js +624 -0
- package/packages/cli/dist/add-LLUNFLJI.js.map +7 -0
- package/packages/cli/dist/add-U44SL3OR.js +624 -0
- package/packages/cli/dist/add-U44SL3OR.js.map +7 -0
- package/packages/cli/dist/chunk-23VBP5L6.js +371 -0
- package/packages/cli/dist/chunk-23VBP5L6.js.map +7 -0
- package/packages/cli/dist/chunk-2SVHLF5C.js +1419 -0
- package/packages/cli/dist/chunk-2SVHLF5C.js.map +7 -0
- package/packages/cli/dist/chunk-37256POU.js +99 -0
- package/packages/cli/dist/chunk-37256POU.js.map +7 -0
- package/packages/cli/dist/chunk-3PZRVA6O.js +196 -0
- package/packages/cli/dist/chunk-3PZRVA6O.js.map +7 -0
- package/packages/cli/dist/chunk-427DCURL.js +155 -0
- package/packages/cli/dist/chunk-427DCURL.js.map +7 -0
- package/packages/cli/dist/chunk-4B5HJLP2.js +48 -0
- package/packages/cli/dist/chunk-4B5HJLP2.js.map +7 -0
- package/packages/cli/dist/chunk-4OWT3YEG.js +413 -0
- package/packages/cli/dist/chunk-4OWT3YEG.js.map +7 -0
- package/packages/cli/dist/chunk-4RIBTBXI.js +568 -0
- package/packages/cli/dist/chunk-4RIBTBXI.js.map +7 -0
- package/packages/cli/dist/chunk-4X2EJHJN.js +63 -0
- package/packages/cli/dist/chunk-4X2EJHJN.js.map +7 -0
- package/packages/cli/dist/chunk-6CYW66HD.js +1136 -0
- package/packages/cli/dist/chunk-6CYW66HD.js.map +7 -0
- package/packages/cli/dist/chunk-6DITYAFA.js +172 -0
- package/packages/cli/dist/chunk-6DITYAFA.js.map +7 -0
- package/packages/cli/dist/chunk-7KEAKEVZ.js +568 -0
- package/packages/cli/dist/chunk-7KEAKEVZ.js.map +7 -0
- package/packages/cli/dist/chunk-ABFUD25D.js +61 -0
- package/packages/cli/dist/chunk-ABFUD25D.js.map +7 -0
- package/packages/cli/dist/chunk-AR7GJCG6.js +274 -0
- package/packages/cli/dist/chunk-AR7GJCG6.js.map +7 -0
- package/packages/cli/dist/chunk-AYTGQCXH.js +86 -0
- package/packages/cli/dist/chunk-AYTGQCXH.js.map +7 -0
- package/packages/cli/dist/chunk-BROJ6OUT.js +631 -0
- package/packages/cli/dist/chunk-BROJ6OUT.js.map +7 -0
- package/packages/cli/dist/chunk-BVVSU7QD.js +23 -0
- package/packages/cli/dist/chunk-BVVSU7QD.js.map +7 -0
- package/packages/cli/dist/chunk-C6FY55UP.js +108 -0
- package/packages/cli/dist/chunk-C6FY55UP.js.map +7 -0
- package/packages/cli/dist/chunk-CVA64SXK.js +1136 -0
- package/packages/cli/dist/chunk-CVA64SXK.js.map +7 -0
- package/packages/cli/dist/chunk-D3O7LY2Q.js +1151 -0
- package/packages/cli/dist/chunk-D3O7LY2Q.js.map +7 -0
- package/packages/cli/dist/chunk-D6LEPODL.js +413 -0
- package/packages/cli/dist/chunk-D6LEPODL.js.map +7 -0
- package/packages/cli/dist/chunk-DEC24S7E.js +186 -0
- package/packages/cli/dist/chunk-DEC24S7E.js.map +7 -0
- package/packages/cli/dist/chunk-FMVVJH5M.js +371 -0
- package/packages/cli/dist/chunk-FMVVJH5M.js.map +7 -0
- package/packages/cli/dist/chunk-GDVFS3YP.js +130 -0
- package/packages/cli/dist/chunk-GDVFS3YP.js.map +7 -0
- package/packages/cli/dist/chunk-GEP2G5HF.js +31 -0
- package/packages/cli/dist/chunk-GEP2G5HF.js.map +7 -0
- package/packages/cli/dist/chunk-GSWHZBT2.js +62 -0
- package/packages/cli/dist/chunk-GSWHZBT2.js.map +7 -0
- package/packages/cli/dist/chunk-HTYHJA3B.js +61 -0
- package/packages/cli/dist/chunk-HTYHJA3B.js.map +7 -0
- package/packages/cli/dist/chunk-HYKYECAE.js +222 -0
- package/packages/cli/dist/chunk-HYKYECAE.js.map +7 -0
- package/packages/cli/dist/chunk-I7FEAHB4.js +100 -0
- package/packages/cli/dist/chunk-I7FEAHB4.js.map +7 -0
- package/packages/cli/dist/chunk-IHVZ5AUJ.js +107 -0
- package/packages/cli/dist/chunk-IHVZ5AUJ.js.map +7 -0
- package/packages/cli/dist/chunk-KI7FDU3H.js +99 -0
- package/packages/cli/dist/chunk-KI7FDU3H.js.map +7 -0
- package/packages/cli/dist/chunk-L5GRJQBS.js +32 -0
- package/packages/cli/dist/chunk-L5GRJQBS.js.map +7 -0
- package/packages/cli/dist/chunk-LHEAUDJL.js +302 -0
- package/packages/cli/dist/chunk-LHEAUDJL.js.map +7 -0
- package/packages/cli/dist/chunk-MIURCESJ.js +48 -0
- package/packages/cli/dist/chunk-MIURCESJ.js.map +7 -0
- package/packages/cli/dist/chunk-N43IXOND.js +732 -0
- package/packages/cli/dist/chunk-N43IXOND.js.map +7 -0
- package/packages/cli/dist/chunk-OUZRMGPV.js +274 -0
- package/packages/cli/dist/chunk-OUZRMGPV.js.map +7 -0
- package/packages/cli/dist/chunk-PSQXKAL4.js +371 -0
- package/packages/cli/dist/chunk-PSQXKAL4.js.map +7 -0
- package/packages/cli/dist/chunk-PUDRKDVZ.js +1419 -0
- package/packages/cli/dist/chunk-PUDRKDVZ.js.map +7 -0
- package/packages/cli/dist/chunk-RAKMX654.js +631 -0
- package/packages/cli/dist/chunk-RAKMX654.js.map +7 -0
- package/packages/cli/dist/chunk-RSFLK2TP.js +195 -0
- package/packages/cli/dist/chunk-RSFLK2TP.js.map +7 -0
- package/packages/cli/dist/chunk-S26PR2BS.js +99 -0
- package/packages/cli/dist/chunk-S26PR2BS.js.map +7 -0
- package/packages/cli/dist/chunk-U7FW7SXX.js +568 -0
- package/packages/cli/dist/chunk-U7FW7SXX.js.map +7 -0
- package/packages/cli/dist/chunk-VKM6K5TN.js +413 -0
- package/packages/cli/dist/chunk-VKM6K5TN.js.map +7 -0
- package/packages/cli/dist/chunk-VKNJG4JN.js +253 -0
- package/packages/cli/dist/chunk-VKNJG4JN.js.map +7 -0
- package/packages/cli/dist/chunk-VQ2KY6CK.js +113 -0
- package/packages/cli/dist/chunk-VQ2KY6CK.js.map +7 -0
- package/packages/cli/dist/chunk-VQDTXLOX.js +1312 -0
- package/packages/cli/dist/chunk-VQDTXLOX.js.map +7 -0
- package/packages/cli/dist/chunk-VXNS3X5O.js +60 -0
- package/packages/cli/dist/chunk-VXNS3X5O.js.map +7 -0
- package/packages/cli/dist/chunk-WF7H2YDU.js +376 -0
- package/packages/cli/dist/chunk-WF7H2YDU.js.map +7 -0
- package/packages/cli/dist/chunk-WNRXZLWW.js +266 -0
- package/packages/cli/dist/chunk-WNRXZLWW.js.map +7 -0
- package/packages/cli/dist/chunk-WT4VVCXM.js +1121 -0
- package/packages/cli/dist/chunk-WT4VVCXM.js.map +7 -0
- package/packages/cli/dist/configure-3AZUMDJZ.js +107 -0
- package/packages/cli/dist/configure-3AZUMDJZ.js.map +7 -0
- package/packages/cli/dist/configure-D722JQOD.js +107 -0
- package/packages/cli/dist/configure-D722JQOD.js.map +7 -0
- package/packages/cli/dist/configure-IU5H7XD6.js +107 -0
- package/packages/cli/dist/configure-IU5H7XD6.js.map +7 -0
- package/packages/cli/dist/file-format-detector-PXCIAKTK.js +22 -0
- package/packages/cli/dist/file-format-detector-PXCIAKTK.js.map +7 -0
- package/packages/cli/dist/index.js +17 -17
- package/packages/cli/dist/install-EZNWMLJR.js +7581 -0
- package/packages/cli/dist/install-EZNWMLJR.js.map +7 -0
- package/packages/cli/dist/install-F5ANFUBX.js +7577 -0
- package/packages/cli/dist/install-F5ANFUBX.js.map +7 -0
- package/packages/cli/dist/install-JSXEPPC2.js +7104 -0
- package/packages/cli/dist/install-JSXEPPC2.js.map +7 -0
- package/packages/cli/dist/install-QHEBX7JH.js +7101 -0
- package/packages/cli/dist/install-QHEBX7JH.js.map +7 -0
- package/packages/cli/dist/list-DMOUATYI.js +327 -0
- package/packages/cli/dist/list-DMOUATYI.js.map +7 -0
- package/packages/cli/dist/list-UESSCB7Y.js +327 -0
- package/packages/cli/dist/list-UESSCB7Y.js.map +7 -0
- package/packages/cli/dist/list-XR7RSJFS.js +327 -0
- package/packages/cli/dist/list-XR7RSJFS.js.map +7 -0
- package/packages/cli/dist/login-EYZ2SOYZ.js +150 -0
- package/packages/cli/dist/login-EYZ2SOYZ.js.map +7 -0
- package/packages/cli/dist/login-JWCSTAEU.js +150 -0
- package/packages/cli/dist/login-JWCSTAEU.js.map +7 -0
- package/packages/cli/dist/login-NRKHXZKM.js +150 -0
- package/packages/cli/dist/login-NRKHXZKM.js.map +7 -0
- package/packages/cli/dist/logout-HDMYRXIE.js +40 -0
- package/packages/cli/dist/logout-HDMYRXIE.js.map +7 -0
- package/packages/cli/dist/logout-SYHXCVCQ.js +40 -0
- package/packages/cli/dist/logout-SYHXCVCQ.js.map +7 -0
- package/packages/cli/dist/logout-X3XUUOH5.js +40 -0
- package/packages/cli/dist/logout-X3XUUOH5.js.map +7 -0
- package/packages/cli/dist/new-3LTFKDTQ.js +277 -0
- package/packages/cli/dist/new-3LTFKDTQ.js.map +7 -0
- package/packages/cli/dist/new-F46OSD72.js +277 -0
- package/packages/cli/dist/new-F46OSD72.js.map +7 -0
- package/packages/cli/dist/new-OPCCLNL2.js +277 -0
- package/packages/cli/dist/new-OPCCLNL2.js.map +7 -0
- package/packages/cli/dist/package-marker-detector-T5O5YD2E.js +80 -0
- package/packages/cli/dist/package-marker-detector-T5O5YD2E.js.map +7 -0
- package/packages/cli/dist/package-yml-QWZIJDYU.js +16 -0
- package/packages/cli/dist/package-yml-QWZIJDYU.js.map +7 -0
- package/packages/cli/dist/plugin-naming-YP2I4NPA.js +29 -0
- package/packages/cli/dist/plugin-naming-YP2I4NPA.js.map +7 -0
- package/packages/cli/dist/publish-4H43PCSG.js +619 -0
- package/packages/cli/dist/publish-4H43PCSG.js.map +7 -0
- package/packages/cli/dist/publish-RULKLNUX.js +619 -0
- package/packages/cli/dist/publish-RULKLNUX.js.map +7 -0
- package/packages/cli/dist/publish-URWY2P3E.js +619 -0
- package/packages/cli/dist/publish-URWY2P3E.js.map +7 -0
- package/packages/cli/dist/remove-BD52BHR2.js +542 -0
- package/packages/cli/dist/remove-BD52BHR2.js.map +7 -0
- package/packages/cli/dist/remove-G5NRC7LD.js +542 -0
- package/packages/cli/dist/remove-G5NRC7LD.js.map +7 -0
- package/packages/cli/dist/remove-TC3FQUYQ.js +542 -0
- package/packages/cli/dist/remove-TC3FQUYQ.js.map +7 -0
- package/packages/cli/dist/resource-discoverer-4X4RY43E.js +17 -0
- package/packages/cli/dist/resource-discoverer-4X4RY43E.js.map +7 -0
- package/packages/cli/dist/save-24TESYKI.js +1728 -0
- package/packages/cli/dist/save-24TESYKI.js.map +7 -0
- package/packages/cli/dist/save-N3QWF2WN.js +1728 -0
- package/packages/cli/dist/save-N3QWF2WN.js.map +7 -0
- package/packages/cli/dist/save-P2U67DTV.js +1728 -0
- package/packages/cli/dist/save-P2U67DTV.js.map +7 -0
- package/packages/cli/dist/search-ABROK3UO.js +157 -0
- package/packages/cli/dist/search-ABROK3UO.js.map +7 -0
- package/packages/cli/dist/search-WVFXFNAV.js +157 -0
- package/packages/cli/dist/search-WVFXFNAV.js.map +7 -0
- package/packages/cli/dist/search-YQN2Q2SO.js +157 -0
- package/packages/cli/dist/search-YQN2Q2SO.js.map +7 -0
- package/packages/cli/dist/set-DCWF73F6.js +251 -0
- package/packages/cli/dist/set-DCWF73F6.js.map +7 -0
- package/packages/cli/dist/set-GJEG2F6Y.js +251 -0
- package/packages/cli/dist/set-GJEG2F6Y.js.map +7 -0
- package/packages/cli/dist/set-NGM2FIKF.js +251 -0
- package/packages/cli/dist/set-NGM2FIKF.js.map +7 -0
- package/packages/cli/dist/uninstall-3CJQMTYH.js +539 -0
- package/packages/cli/dist/uninstall-3CJQMTYH.js.map +7 -0
- package/packages/cli/dist/uninstall-Q3CP4UN5.js +539 -0
- package/packages/cli/dist/uninstall-Q3CP4UN5.js.map +7 -0
- package/packages/cli/dist/uninstall-QU5OMEEC.js +539 -0
- package/packages/cli/dist/uninstall-QU5OMEEC.js.map +7 -0
- package/packages/cli/dist/unpublish-GHJQYC4S.js +245 -0
- package/packages/cli/dist/unpublish-GHJQYC4S.js.map +7 -0
- package/packages/cli/dist/unpublish-L2CYMK4B.js +245 -0
- package/packages/cli/dist/unpublish-L2CYMK4B.js.map +7 -0
- package/packages/cli/dist/unpublish-VBTNTMS5.js +245 -0
- package/packages/cli/dist/unpublish-VBTNTMS5.js.map +7 -0
- package/packages/cli/dist/view-MXRBMXOG.js +488 -0
- package/packages/cli/dist/view-MXRBMXOG.js.map +7 -0
- package/packages/cli/dist/view-NMND7SAW.js +488 -0
- package/packages/cli/dist/view-NMND7SAW.js.map +7 -0
- package/packages/cli/dist/view-RPQRDSYB.js +488 -0
- package/packages/cli/dist/view-RPQRDSYB.js.map +7 -0
- package/packages/cli/package.json +2 -0
- package/packages/core/dist/constants/index.d.ts +9 -0
- package/packages/core/dist/constants/index.d.ts.map +1 -1
- package/packages/core/dist/constants/index.js +12 -0
- package/packages/core/dist/constants/index.js.map +1 -1
- package/packages/core/dist/core/dependency-resolver/index.d.ts +2 -10
- package/packages/core/dist/core/dependency-resolver/index.d.ts.map +1 -1
- package/packages/core/dist/core/dependency-resolver/index.js +3 -14
- package/packages/core/dist/core/dependency-resolver/index.js.map +1 -1
- package/packages/core/dist/core/install/base-detector.d.ts +2 -1
- package/packages/core/dist/core/install/base-detector.d.ts.map +1 -1
- package/packages/core/dist/core/install/base-detector.js +54 -1
- package/packages/core/dist/core/install/base-detector.js.map +1 -1
- package/packages/core/dist/core/install/conflicts/file-conflict-resolver.d.ts +7 -5
- package/packages/core/dist/core/install/conflicts/file-conflict-resolver.d.ts.map +1 -1
- package/packages/core/dist/core/install/conflicts/file-conflict-resolver.js +25 -9
- package/packages/core/dist/core/install/conflicts/file-conflict-resolver.js.map +1 -1
- package/packages/core/dist/core/install/flow-index-installer.d.ts +2 -1
- package/packages/core/dist/core/install/flow-index-installer.d.ts.map +1 -1
- package/packages/core/dist/core/install/flow-index-installer.js +19 -4
- package/packages/core/dist/core/install/flow-index-installer.js.map +1 -1
- package/packages/core/dist/core/install/input-classifier-base.js +3 -3
- package/packages/core/dist/core/install/input-classifier-base.js.map +1 -1
- package/packages/core/dist/core/install/install-reporting.d.ts.map +1 -1
- package/packages/core/dist/core/install/install-reporting.js +7 -9
- package/packages/core/dist/core/install/install-reporting.js.map +1 -1
- package/packages/core/dist/core/install/list-handler.d.ts.map +1 -1
- package/packages/core/dist/core/install/list-handler.js +3 -0
- package/packages/core/dist/core/install/list-handler.js.map +1 -1
- package/packages/core/dist/core/install/marketplace-handler.d.ts.map +1 -1
- package/packages/core/dist/core/install/marketplace-handler.js.map +1 -1
- package/packages/core/dist/core/install/operations/conflict-handler.d.ts +2 -1
- package/packages/core/dist/core/install/operations/conflict-handler.d.ts.map +1 -1
- package/packages/core/dist/core/install/operations/conflict-handler.js +2 -2
- package/packages/core/dist/core/install/operations/conflict-handler.js.map +1 -1
- package/packages/core/dist/core/install/operations/installation-executor.d.ts +3 -0
- package/packages/core/dist/core/install/operations/installation-executor.d.ts.map +1 -1
- package/packages/core/dist/core/install/operations/installation-executor.js +39 -22
- package/packages/core/dist/core/install/operations/installation-executor.js.map +1 -1
- package/packages/core/dist/core/install/orchestrator/orchestrator.d.ts +7 -3
- package/packages/core/dist/core/install/orchestrator/orchestrator.d.ts.map +1 -1
- package/packages/core/dist/core/install/orchestrator/orchestrator.js +193 -93
- package/packages/core/dist/core/install/orchestrator/orchestrator.js.map +1 -1
- package/packages/core/dist/core/install/orchestrator/strategies/git-strategy.d.ts +1 -0
- package/packages/core/dist/core/install/orchestrator/strategies/git-strategy.d.ts.map +1 -1
- package/packages/core/dist/core/install/orchestrator/strategies/git-strategy.js +11 -24
- package/packages/core/dist/core/install/orchestrator/strategies/git-strategy.js.map +1 -1
- package/packages/core/dist/core/install/orchestrator/strategies/path-strategy.d.ts +2 -0
- package/packages/core/dist/core/install/orchestrator/strategies/path-strategy.d.ts.map +1 -1
- package/packages/core/dist/core/install/orchestrator/strategies/path-strategy.js +14 -14
- package/packages/core/dist/core/install/orchestrator/strategies/path-strategy.js.map +1 -1
- package/packages/core/dist/core/install/orchestrator/strategies/registry-strategy.d.ts +7 -0
- package/packages/core/dist/core/install/orchestrator/strategies/registry-strategy.d.ts.map +1 -1
- package/packages/core/dist/core/install/orchestrator/strategies/registry-strategy.js +28 -0
- package/packages/core/dist/core/install/orchestrator/strategies/registry-strategy.js.map +1 -1
- package/packages/core/dist/core/install/orchestrator/types.d.ts +2 -0
- package/packages/core/dist/core/install/orchestrator/types.d.ts.map +1 -1
- package/packages/core/dist/core/install/path-package-loader.d.ts.map +1 -1
- package/packages/core/dist/core/install/path-package-loader.js +20 -1
- package/packages/core/dist/core/install/path-package-loader.js.map +1 -1
- package/packages/core/dist/core/install/platform-resolution.d.ts +3 -0
- package/packages/core/dist/core/install/platform-resolution.d.ts.map +1 -1
- package/packages/core/dist/core/install/platform-resolution.js +5 -2
- package/packages/core/dist/core/install/platform-resolution.js.map +1 -1
- package/packages/core/dist/core/install/preprocessing/context-population.d.ts +18 -0
- package/packages/core/dist/core/install/preprocessing/context-population.d.ts.map +1 -0
- package/packages/core/dist/core/install/preprocessing/context-population.js +36 -0
- package/packages/core/dist/core/install/preprocessing/context-population.js.map +1 -0
- package/packages/core/dist/core/install/preprocessing/convenience-preprocessor.d.ts +23 -0
- package/packages/core/dist/core/install/preprocessing/convenience-preprocessor.d.ts.map +1 -1
- package/packages/core/dist/core/install/preprocessing/convenience-preprocessor.js +44 -0
- package/packages/core/dist/core/install/preprocessing/convenience-preprocessor.js.map +1 -1
- package/packages/core/dist/core/install/sources/git-source.d.ts.map +1 -1
- package/packages/core/dist/core/install/sources/git-source.js +67 -4
- package/packages/core/dist/core/install/sources/git-source.js.map +1 -1
- package/packages/core/dist/core/install/sources/path-source.d.ts.map +1 -1
- package/packages/core/dist/core/install/sources/path-source.js +8 -0
- package/packages/core/dist/core/install/sources/path-source.js.map +1 -1
- package/packages/core/dist/core/install/strategies/flow-based-strategy.d.ts.map +1 -1
- package/packages/core/dist/core/install/strategies/flow-based-strategy.js +12 -5
- package/packages/core/dist/core/install/strategies/flow-based-strategy.js.map +1 -1
- package/packages/core/dist/core/install/strategies/types.d.ts +11 -1
- package/packages/core/dist/core/install/strategies/types.d.ts.map +1 -1
- package/packages/core/dist/core/install/unified/context-builders.d.ts +5 -0
- package/packages/core/dist/core/install/unified/context-builders.d.ts.map +1 -1
- package/packages/core/dist/core/install/unified/context-builders.js +12 -0
- package/packages/core/dist/core/install/unified/context-builders.js.map +1 -1
- package/packages/core/dist/core/install/unified/context-helpers.d.ts +0 -4
- package/packages/core/dist/core/install/unified/context-helpers.d.ts.map +1 -1
- package/packages/core/dist/core/install/unified/context-helpers.js +0 -24
- package/packages/core/dist/core/install/unified/context-helpers.js.map +1 -1
- package/packages/core/dist/core/install/unified/index.d.ts +1 -1
- package/packages/core/dist/core/install/unified/index.d.ts.map +1 -1
- package/packages/core/dist/core/install/unified/index.js +1 -1
- package/packages/core/dist/core/install/unified/index.js.map +1 -1
- package/packages/core/dist/core/install/unified/multi-context-pipeline.d.ts +6 -0
- package/packages/core/dist/core/install/unified/multi-context-pipeline.d.ts.map +1 -1
- package/packages/core/dist/core/install/unified/multi-context-pipeline.js +11 -4
- package/packages/core/dist/core/install/unified/multi-context-pipeline.js.map +1 -1
- package/packages/core/dist/core/install/unified/phases/conflicts.d.ts.map +1 -1
- package/packages/core/dist/core/install/unified/phases/conflicts.js +1 -1
- package/packages/core/dist/core/install/unified/phases/conflicts.js.map +1 -1
- package/packages/core/dist/core/install/unified/phases/execute.d.ts.map +1 -1
- package/packages/core/dist/core/install/unified/phases/execute.js +5 -5
- package/packages/core/dist/core/install/unified/phases/execute.js.map +1 -1
- package/packages/core/dist/core/install/unified/phases/load-package.js +3 -3
- package/packages/core/dist/core/install/unified/phases/load-package.js.map +1 -1
- package/packages/core/dist/core/install/unified/phases/report.js +1 -1
- package/packages/core/dist/core/install/unified/phases/report.js.map +1 -1
- package/packages/core/dist/core/install/unified/pipeline.d.ts.map +1 -1
- package/packages/core/dist/core/install/unified/pipeline.js +7 -10
- package/packages/core/dist/core/install/unified/pipeline.js.map +1 -1
- package/packages/core/dist/core/install/wave-resolver/content-root-cache.d.ts +24 -0
- package/packages/core/dist/core/install/wave-resolver/content-root-cache.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/content-root-cache.js +71 -0
- package/packages/core/dist/core/install/wave-resolver/content-root-cache.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/context-builder.d.ts +39 -0
- package/packages/core/dist/core/install/wave-resolver/context-builder.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/context-builder.js +148 -0
- package/packages/core/dist/core/install/wave-resolver/context-builder.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/fetcher.d.ts +49 -0
- package/packages/core/dist/core/install/wave-resolver/fetcher.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/fetcher.js +221 -0
- package/packages/core/dist/core/install/wave-resolver/fetcher.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/index-updater.d.ts +23 -0
- package/packages/core/dist/core/install/wave-resolver/index-updater.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/index-updater.js +87 -0
- package/packages/core/dist/core/install/wave-resolver/index-updater.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/index-write-collector.d.ts +101 -0
- package/packages/core/dist/core/install/wave-resolver/index-write-collector.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/index-write-collector.js +194 -0
- package/packages/core/dist/core/install/wave-resolver/index-write-collector.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/index.d.ts +17 -0
- package/packages/core/dist/core/install/wave-resolver/index.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/index.js +16 -0
- package/packages/core/dist/core/install/wave-resolver/index.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/manifest-reader.d.ts +34 -0
- package/packages/core/dist/core/install/wave-resolver/manifest-reader.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/manifest-reader.js +112 -0
- package/packages/core/dist/core/install/wave-resolver/manifest-reader.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/types.d.ts +210 -0
- package/packages/core/dist/core/install/wave-resolver/types.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/types.js +6 -0
- package/packages/core/dist/core/install/wave-resolver/types.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/version-solver.d.ts +65 -0
- package/packages/core/dist/core/install/wave-resolver/version-solver.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/version-solver.js +166 -0
- package/packages/core/dist/core/install/wave-resolver/version-solver.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/wave-engine.d.ts +16 -0
- package/packages/core/dist/core/install/wave-resolver/wave-engine.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/wave-engine.js +337 -0
- package/packages/core/dist/core/install/wave-resolver/wave-engine.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/wave-installer.d.ts +50 -0
- package/packages/core/dist/core/install/wave-resolver/wave-installer.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/wave-installer.js +246 -0
- package/packages/core/dist/core/install/wave-resolver/wave-installer.js.map +1 -0
- package/packages/core/dist/core/ports/buffered-output.d.ts +36 -0
- package/packages/core/dist/core/ports/buffered-output.d.ts.map +1 -0
- package/packages/core/dist/core/ports/buffered-output.js +89 -0
- package/packages/core/dist/core/ports/buffered-output.js.map +1 -0
- package/packages/core/dist/core/ports/resolve.d.ts +0 -13
- package/packages/core/dist/core/ports/resolve.d.ts.map +1 -1
- package/packages/core/dist/core/ports/resolve.js +0 -28
- package/packages/core/dist/core/ports/resolve.js.map +1 -1
- package/packages/core/dist/core/remove/removal-confirmation.d.ts +4 -1
- package/packages/core/dist/core/remove/removal-confirmation.d.ts.map +1 -1
- package/packages/core/dist/core/remove/removal-confirmation.js +5 -4
- package/packages/core/dist/core/remove/removal-confirmation.js.map +1 -1
- package/packages/core/dist/core/remove/remove-from-source-pipeline.d.ts.map +1 -1
- package/packages/core/dist/core/remove/remove-from-source-pipeline.js +1 -10
- package/packages/core/dist/core/remove/remove-from-source-pipeline.js.map +1 -1
- package/packages/core/dist/core/uninstall/uninstall-executor.js +1 -1
- package/packages/core/dist/core/uninstall/uninstall-executor.js.map +1 -1
- package/packages/core/dist/core/uninstall/uninstall-reporter.d.ts +2 -2
- package/packages/core/dist/core/uninstall/uninstall-reporter.d.ts.map +1 -1
- package/packages/core/dist/core/uninstall/uninstall-reporter.js +4 -4
- package/packages/core/dist/core/uninstall/uninstall-reporter.js.map +1 -1
- package/packages/core/dist/index.d.ts +1 -1
- package/packages/core/dist/index.d.ts.map +1 -1
- package/packages/core/dist/types/execution-context.d.ts +40 -10
- package/packages/core/dist/types/execution-context.d.ts.map +1 -1
- package/packages/core/dist/utils/concurrency-pool.d.ts +34 -0
- package/packages/core/dist/utils/concurrency-pool.d.ts.map +1 -0
- package/packages/core/dist/utils/concurrency-pool.js +58 -0
- package/packages/core/dist/utils/concurrency-pool.js.map +1 -0
- package/packages/core/dist/utils/plugin-naming.d.ts +11 -3
- package/packages/core/dist/utils/plugin-naming.d.ts.map +1 -1
- package/packages/core/dist/utils/plugin-naming.js +27 -7
- package/packages/core/dist/utils/plugin-naming.js.map +1 -1
- package/plans/wave-resolver.md +254 -0
- package/.claude/agents/essentials/code-simplifier.md +0 -52
- package/.claude/commands/essentials/cleanup.md +0 -1
- package/.claude/commands/essentials/review.md +0 -8
- package/.claude/commands/git/commit.md +0 -5
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
getLocalOpenPackageDir
|
|
4
|
+
} from "./chunk-VXNS3X5O.js";
|
|
5
|
+
import {
|
|
6
|
+
normalizePathForProcessing
|
|
7
|
+
} from "./chunk-YMKK4XPN.js";
|
|
8
|
+
import {
|
|
9
|
+
FILE_PATTERNS
|
|
10
|
+
} from "./chunk-IHVZ5AUJ.js";
|
|
11
|
+
import {
|
|
12
|
+
ensureDir,
|
|
13
|
+
exists,
|
|
14
|
+
readTextFile,
|
|
15
|
+
writeTextFile
|
|
16
|
+
} from "./chunk-S47F4OG4.js";
|
|
17
|
+
import {
|
|
18
|
+
logger
|
|
19
|
+
} from "./chunk-5EFWGD33.js";
|
|
20
|
+
|
|
21
|
+
// ../core/src/utils/workspace-index-yml.ts
|
|
22
|
+
import { dirname, join } from "path";
|
|
23
|
+
import * as yaml from "js-yaml";
|
|
24
|
+
var HEADER_COMMENT = "# This file is managed by OpenPackage. Do not edit manually.";
|
|
25
|
+
function getWorkspaceIndexPath(targetDir) {
|
|
26
|
+
return join(getLocalOpenPackageDir(targetDir), FILE_PATTERNS.OPENPACKAGE_INDEX_YML);
|
|
27
|
+
}
|
|
28
|
+
function sortAndDedupeStrings(values) {
|
|
29
|
+
return Array.from(new Set(values)).sort();
|
|
30
|
+
}
|
|
31
|
+
function sortFilesMapping(files) {
|
|
32
|
+
let sorted = {}, keys = Object.keys(files).sort();
|
|
33
|
+
for (let key of keys) {
|
|
34
|
+
let values = files[key] ?? [];
|
|
35
|
+
values.some((v) => typeof v == "object" && v !== null) ? sorted[key] = values.sort((a, b) => {
|
|
36
|
+
let targetA = typeof a == "string" ? a : a.target, targetB = typeof b == "string" ? b : b.target;
|
|
37
|
+
return targetA.localeCompare(targetB);
|
|
38
|
+
}) : sorted[key] = sortAndDedupeStrings(values);
|
|
39
|
+
}
|
|
40
|
+
return sorted;
|
|
41
|
+
}
|
|
42
|
+
function sanitizeWorkspaceIndexPackage(entry) {
|
|
43
|
+
if (!entry || typeof entry != "object") return null;
|
|
44
|
+
let rawPath = entry.path;
|
|
45
|
+
if (typeof rawPath != "string" || rawPath.trim().length === 0)
|
|
46
|
+
return null;
|
|
47
|
+
let pkg = {
|
|
48
|
+
path: rawPath,
|
|
49
|
+
files: {}
|
|
50
|
+
}, rawVersion = entry.version;
|
|
51
|
+
typeof rawVersion == "string" && rawVersion.trim().length > 0 && (pkg.version = rawVersion);
|
|
52
|
+
let rawDeps = entry.dependencies;
|
|
53
|
+
if (Array.isArray(rawDeps)) {
|
|
54
|
+
let deps = rawDeps.filter((d) => typeof d == "string" && d.trim().length > 0);
|
|
55
|
+
deps.length > 0 && (pkg.dependencies = sortAndDedupeStrings(deps));
|
|
56
|
+
}
|
|
57
|
+
let rawFiles = entry.files;
|
|
58
|
+
if (rawFiles && typeof rawFiles == "object") {
|
|
59
|
+
let files = {};
|
|
60
|
+
for (let [k, v] of Object.entries(rawFiles)) {
|
|
61
|
+
if (typeof k != "string" || !Array.isArray(v)) continue;
|
|
62
|
+
let normalizedKey = normalizePathForProcessing(k), targets = [];
|
|
63
|
+
for (let item of v) {
|
|
64
|
+
if (typeof item == "string") {
|
|
65
|
+
let trimmed = item.trim();
|
|
66
|
+
if (!trimmed) continue;
|
|
67
|
+
targets.push(normalizePathForProcessing(trimmed));
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (item && typeof item == "object") {
|
|
71
|
+
let rawTarget = item.target;
|
|
72
|
+
if (typeof rawTarget != "string" || rawTarget.trim().length === 0) continue;
|
|
73
|
+
let mapping = {
|
|
74
|
+
target: normalizePathForProcessing(rawTarget)
|
|
75
|
+
}, rawMerge = item.merge;
|
|
76
|
+
(rawMerge === "deep" || rawMerge === "shallow" || rawMerge === "replace" || rawMerge === "composite") && (mapping.merge = rawMerge);
|
|
77
|
+
let rawKeys = item.keys;
|
|
78
|
+
if (Array.isArray(rawKeys)) {
|
|
79
|
+
let cleanedKeys = rawKeys.filter((x) => typeof x == "string" && x.trim().length > 0);
|
|
80
|
+
cleanedKeys.length > 0 && (mapping.keys = cleanedKeys);
|
|
81
|
+
}
|
|
82
|
+
targets.push(mapping);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
targets.length !== 0 && (files[normalizedKey] = targets);
|
|
86
|
+
}
|
|
87
|
+
pkg.files = sortFilesMapping(files);
|
|
88
|
+
}
|
|
89
|
+
let rawMarketplace = entry.marketplace;
|
|
90
|
+
if (rawMarketplace && typeof rawMarketplace == "object") {
|
|
91
|
+
let url = rawMarketplace.url, commitSha = rawMarketplace.commitSha, pluginName = rawMarketplace.pluginName;
|
|
92
|
+
typeof url == "string" && url.trim().length > 0 && typeof commitSha == "string" && commitSha.trim().length > 0 && typeof pluginName == "string" && pluginName.trim().length > 0 && (pkg.marketplace = { url, commitSha, pluginName });
|
|
93
|
+
}
|
|
94
|
+
return pkg;
|
|
95
|
+
}
|
|
96
|
+
function sanitizeWorkspaceIndexData(data) {
|
|
97
|
+
if (!data || typeof data != "object") return null;
|
|
98
|
+
let packagesSection = data.packages;
|
|
99
|
+
if (!packagesSection || typeof packagesSection != "object")
|
|
100
|
+
return { packages: {} };
|
|
101
|
+
let packages = {};
|
|
102
|
+
for (let [pkgName, pkgEntry] of Object.entries(packagesSection)) {
|
|
103
|
+
if (typeof pkgName != "string" || pkgName.trim().length === 0) continue;
|
|
104
|
+
let sanitized = sanitizeWorkspaceIndexPackage(pkgEntry);
|
|
105
|
+
sanitized && (packages[pkgName] = sanitized);
|
|
106
|
+
}
|
|
107
|
+
return { packages };
|
|
108
|
+
}
|
|
109
|
+
async function readWorkspaceIndex(targetDir) {
|
|
110
|
+
let indexPath = getWorkspaceIndexPath(targetDir);
|
|
111
|
+
if (!await exists(indexPath))
|
|
112
|
+
return {
|
|
113
|
+
path: indexPath,
|
|
114
|
+
index: { packages: {} }
|
|
115
|
+
};
|
|
116
|
+
try {
|
|
117
|
+
let content = await readTextFile(indexPath), parsed = yaml.load(content), sanitized = sanitizeWorkspaceIndexData(parsed);
|
|
118
|
+
return sanitized ? { path: indexPath, index: migrateGitHubPackageNames(sanitized) } : (logger.warn(`Invalid workspace index detected at ${indexPath}, returning empty.`), { path: indexPath, index: { packages: {} } });
|
|
119
|
+
} catch (error) {
|
|
120
|
+
return logger.warn(`Failed to read workspace index at ${indexPath}: ${error}`), { path: indexPath, index: { packages: {} } };
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function migrateGitHubPackageNames(index) {
|
|
124
|
+
let migratedPackages = {};
|
|
125
|
+
for (let [pkgName, pkgData] of Object.entries(index.packages)) {
|
|
126
|
+
let normalizedPath = pkgData.path.replace(/\\/g, "/"), isGitSource = !pkgData.version, isGitCache = normalizedPath.includes("/.openpackage/cache/git/") || normalizedPath.includes(".openpackage/cache/git/");
|
|
127
|
+
if (!isGitSource && !isGitCache) {
|
|
128
|
+
migratedPackages[pkgName] = pkgData;
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
let actualSubpath = normalizedPath.match(/\.openpackage\/cache\/git\/[^\/]+\/[^\/]+(?:\/(.+))?$/)?.[1] || void 0, username, repo, nameHasGhPrefix = !1, nameSubpathFromName;
|
|
132
|
+
if (pkgName.startsWith("gh@")) {
|
|
133
|
+
nameHasGhPrefix = !0;
|
|
134
|
+
let ghMatch = pkgName.match(/^gh@([^\/]+)\/([^\/]+)(?:\/(.+))?$/);
|
|
135
|
+
ghMatch && (username = ghMatch[1], repo = ghMatch[2], nameSubpathFromName = ghMatch[3] || void 0);
|
|
136
|
+
} else if (pkgName.startsWith("@")) {
|
|
137
|
+
let atMatch = pkgName.match(/^@([^\/]+)\/([^\/]+)(?:\/(.+))?$/);
|
|
138
|
+
atMatch && (username = atMatch[1], repo = atMatch[2], nameSubpathFromName = atMatch[3] || void 0);
|
|
139
|
+
} else {
|
|
140
|
+
let noAtMatch = pkgName.match(/^([^\/]+)\/([^\/]+)(?:\/(.+))?$/);
|
|
141
|
+
noAtMatch && (username = noAtMatch[1], repo = noAtMatch[2], nameSubpathFromName = noAtMatch[3] || void 0);
|
|
142
|
+
}
|
|
143
|
+
if (!username || !repo) {
|
|
144
|
+
migratedPackages[pkgName] = pkgData;
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
let nameSubpath = nameSubpathFromName, targetSubpath = actualSubpath;
|
|
148
|
+
if (actualSubpath && nameSubpath) {
|
|
149
|
+
let actualNorm = actualSubpath.replace(/\\/g, "/"), nameNorm = nameSubpath.replace(/\\/g, "/");
|
|
150
|
+
nameNorm === actualNorm || actualNorm.endsWith(`/${nameNorm}`) ? targetSubpath = actualSubpath : (nameNorm.startsWith(`${actualNorm}/`), targetSubpath = nameSubpath);
|
|
151
|
+
} else !actualSubpath && nameSubpath ? targetSubpath = nameSubpath : actualSubpath && !nameSubpath && (targetSubpath = actualSubpath);
|
|
152
|
+
let correctName = targetSubpath ? `gh@${username}/${repo}/${targetSubpath}` : `gh@${username}/${repo}`;
|
|
153
|
+
migratedPackages[correctName] = pkgData;
|
|
154
|
+
}
|
|
155
|
+
return { packages: migratedPackages };
|
|
156
|
+
}
|
|
157
|
+
async function writeWorkspaceIndex(record) {
|
|
158
|
+
let indexPath = record.path, packages = migrateGitHubPackageNames(record.index).packages ?? {}, sortedPackages = {};
|
|
159
|
+
for (let pkgName of Object.keys(packages).sort()) {
|
|
160
|
+
let pkg = packages[pkgName], sortedPkg = {
|
|
161
|
+
path: pkg.path,
|
|
162
|
+
files: sortFilesMapping(pkg.files ?? {})
|
|
163
|
+
};
|
|
164
|
+
pkg.version && (sortedPkg.version = pkg.version), pkg.dependencies && pkg.dependencies.length > 0 && (sortedPkg.dependencies = sortAndDedupeStrings(pkg.dependencies)), pkg.marketplace && (sortedPkg.marketplace = pkg.marketplace), sortedPackages[pkgName] = sortedPkg;
|
|
165
|
+
}
|
|
166
|
+
await ensureDir(dirname(indexPath));
|
|
167
|
+
let body = yaml.dump(
|
|
168
|
+
{
|
|
169
|
+
packages: sortedPackages
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
lineWidth: 120,
|
|
173
|
+
sortKeys: !0
|
|
174
|
+
}
|
|
175
|
+
), serialized = `${HEADER_COMMENT}
|
|
176
|
+
|
|
177
|
+
${body}`;
|
|
178
|
+
await writeTextFile(indexPath, serialized);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export {
|
|
182
|
+
getWorkspaceIndexPath,
|
|
183
|
+
readWorkspaceIndex,
|
|
184
|
+
writeWorkspaceIndex
|
|
185
|
+
};
|
|
186
|
+
//# sourceMappingURL=chunk-DEC24S7E.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../core/src/utils/workspace-index-yml.ts"],
|
|
4
|
+
"sourcesContent": ["import { dirname, join } from 'path';\nimport * as yaml from 'js-yaml';\nimport { FILE_PATTERNS } from '../constants/index.js';\nimport { getLocalOpenPackageDir } from './paths.js';\nimport { exists, ensureDir, readTextFile, writeTextFile } from './fs.js';\nimport { normalizePathForProcessing } from './path-normalization.js';\nimport { logger } from './logger.js';\nimport { WorkspaceIndex, WorkspaceIndexPackage } from '../types/workspace-index.js';\nimport type { WorkspaceIndexFileMapping } from '../types/workspace-index.js';\n\nconst HEADER_COMMENT = '# This file is managed by OpenPackage. Do not edit manually.';\n\nexport interface WorkspaceIndexRecord {\n path: string;\n index: WorkspaceIndex;\n}\n\nexport function getWorkspaceIndexPath(targetDir: string): string {\n return join(getLocalOpenPackageDir(targetDir), FILE_PATTERNS.OPENPACKAGE_INDEX_YML);\n}\n\nfunction sortAndDedupeStrings(values: string[]): string[] {\n return Array.from(new Set(values)).sort();\n}\n\nfunction sortFilesMapping(files: Record<string, any[]>): Record<string, any[]> {\n const sorted: Record<string, any[]> = {};\n const keys = Object.keys(files).sort();\n for (const key of keys) {\n const values = files[key] ?? [];\n // Handle both string[] and (string | WorkspaceIndexFileMapping)[]\n const hasComplex = values.some(v => typeof v === 'object' && v !== null);\n if (hasComplex) {\n // Complex mappings - sort by target path\n sorted[key] = values.sort((a, b) => {\n const targetA = typeof a === 'string' ? a : a.target;\n const targetB = typeof b === 'string' ? b : b.target;\n return targetA.localeCompare(targetB);\n });\n } else {\n // Simple string array\n sorted[key] = sortAndDedupeStrings(values as string[]);\n }\n }\n return sorted;\n}\n\nfunction sanitizeWorkspaceIndexPackage(entry: any): WorkspaceIndexPackage | null {\n if (!entry || typeof entry !== 'object') return null;\n\n const rawPath = (entry as { path?: unknown }).path;\n if (typeof rawPath !== 'string' || rawPath.trim().length === 0) {\n return null;\n }\n\n const pkg: WorkspaceIndexPackage = {\n path: rawPath,\n files: {}\n };\n\n const rawVersion = (entry as { version?: unknown }).version;\n if (typeof rawVersion === 'string' && rawVersion.trim().length > 0) {\n pkg.version = rawVersion;\n }\n\n const rawDeps = (entry as { dependencies?: unknown }).dependencies;\n if (Array.isArray(rawDeps)) {\n const deps = rawDeps.filter((d): d is string => typeof d === 'string' && d.trim().length > 0);\n if (deps.length > 0) {\n pkg.dependencies = sortAndDedupeStrings(deps);\n }\n }\n\n const rawFiles = (entry as { files?: unknown }).files;\n if (rawFiles && typeof rawFiles === 'object') {\n const files: Record<string, (string | WorkspaceIndexFileMapping)[]> = {};\n for (const [k, v] of Object.entries(rawFiles as Record<string, unknown>)) {\n if (typeof k !== 'string' || !Array.isArray(v)) continue;\n const normalizedKey = normalizePathForProcessing(k);\n const targets: (string | WorkspaceIndexFileMapping)[] = [];\n for (const item of v as unknown[]) {\n if (typeof item === 'string') {\n const trimmed = item.trim();\n if (!trimmed) continue;\n targets.push(normalizePathForProcessing(trimmed));\n continue;\n }\n if (item && typeof item === 'object') {\n const rawTarget = (item as any).target;\n if (typeof rawTarget !== 'string' || rawTarget.trim().length === 0) continue;\n const mapping: WorkspaceIndexFileMapping = {\n target: normalizePathForProcessing(rawTarget)\n };\n const rawMerge = (item as any).merge;\n if (rawMerge === 'deep' || rawMerge === 'shallow' || rawMerge === 'replace' || rawMerge === 'composite') {\n mapping.merge = rawMerge;\n }\n const rawKeys = (item as any).keys;\n if (Array.isArray(rawKeys)) {\n const cleanedKeys = rawKeys.filter((x: any) => typeof x === 'string' && x.trim().length > 0);\n if (cleanedKeys.length > 0) {\n mapping.keys = cleanedKeys;\n }\n }\n targets.push(mapping);\n }\n }\n if (targets.length === 0) continue;\n files[normalizedKey] = targets;\n }\n pkg.files = sortFilesMapping(files);\n }\n\n // Parse marketplace metadata if present\n const rawMarketplace = (entry as { marketplace?: unknown }).marketplace;\n if (rawMarketplace && typeof rawMarketplace === 'object') {\n const url = (rawMarketplace as any).url;\n const commitSha = (rawMarketplace as any).commitSha;\n const pluginName = (rawMarketplace as any).pluginName;\n \n if (typeof url === 'string' && url.trim().length > 0 &&\n typeof commitSha === 'string' && commitSha.trim().length > 0 &&\n typeof pluginName === 'string' && pluginName.trim().length > 0) {\n pkg.marketplace = { url, commitSha, pluginName };\n }\n }\n\n return pkg;\n}\n\nfunction sanitizeWorkspaceIndexData(data: any): WorkspaceIndex | null {\n if (!data || typeof data !== 'object') return null;\n const packagesSection = (data as { packages?: unknown }).packages;\n if (!packagesSection || typeof packagesSection !== 'object') {\n return { packages: {} };\n }\n\n const packages: Record<string, WorkspaceIndexPackage> = {};\n for (const [pkgName, pkgEntry] of Object.entries(packagesSection as Record<string, unknown>)) {\n if (typeof pkgName !== 'string' || pkgName.trim().length === 0) continue;\n const sanitized = sanitizeWorkspaceIndexPackage(pkgEntry);\n if (sanitized) {\n packages[pkgName] = sanitized;\n }\n }\n\n return { packages };\n}\n\nexport async function readWorkspaceIndex(targetDir: string): Promise<WorkspaceIndexRecord> {\n const indexPath = getWorkspaceIndexPath(targetDir);\n\n if (!(await exists(indexPath))) {\n return {\n path: indexPath,\n index: { packages: {} }\n };\n }\n\n try {\n const content = await readTextFile(indexPath);\n const parsed = yaml.load(content) as any;\n const sanitized = sanitizeWorkspaceIndexData(parsed);\n if (!sanitized) {\n logger.warn(`Invalid workspace index detected at ${indexPath}, returning empty.`);\n return { path: indexPath, index: { packages: {} } };\n }\n \n // Migrate in-memory on read so consumers see a unified key format.\n // (Disk is only updated when writeWorkspaceIndex is called.)\n return { path: indexPath, index: migrateGitHubPackageNames(sanitized) };\n } catch (error) {\n logger.warn(`Failed to read workspace index at ${indexPath}: ${error}`);\n return { path: indexPath, index: { packages: {} } };\n }\n}\n\n/**\n * Migrate old GitHub package names to new format.\n * Converts:\n * - @username/repo \u2192 gh@username/repo\n * - @username/repo/path \u2192 gh@username/repo/path\n * \n * Also normalizes package names to use full path from git cache location.\n * For example: gh@user/repo/basename \u2192 gh@user/repo/full/path\n */\nfunction migrateGitHubPackageNames(index: WorkspaceIndex): WorkspaceIndex {\n const migratedPackages: Record<string, WorkspaceIndexPackage> = {};\n \n for (const [pkgName, pkgData] of Object.entries(index.packages)) {\n const normalizedPath = pkgData.path.replace(/\\\\/g, '/');\n \n // Detect if this is a git source by checking:\n // 1. No version field (git sources don't have semver versions)\n // 2. Path contains git cache location marker\n const isGitSource = !pkgData.version;\n const isGitCache = normalizedPath.includes('/.openpackage/cache/git/') || \n normalizedPath.includes('.openpackage/cache/git/');\n \n if (!isGitSource && !isGitCache) {\n // Not a git source, keep as-is\n migratedPackages[pkgName] = pkgData;\n continue;\n }\n \n // Extract the actual path from git cache location\n // Format: .openpackage/cache/git/{url-hash}/{commit-hash}/{optional-subpath}\n const gitCacheMatch = normalizedPath.match(/\\.openpackage\\/cache\\/git\\/[^\\/]+\\/[^\\/]+(?:\\/(.+))?$/);\n const actualSubpath = gitCacheMatch?.[1] || undefined;\n \n // Parse package name to extract username/repo\n let username: string | undefined;\n let repo: string | undefined;\n let nameHasGhPrefix = false;\n let nameSubpathFromName: string | undefined;\n \n // Check for gh@ prefix first\n if (pkgName.startsWith('gh@')) {\n nameHasGhPrefix = true;\n const ghMatch = pkgName.match(/^gh@([^\\/]+)\\/([^\\/]+)(?:\\/(.+))?$/);\n if (ghMatch) {\n username = ghMatch[1];\n repo = ghMatch[2];\n nameSubpathFromName = ghMatch[3] || undefined;\n }\n }\n // Check for @ prefix (old format)\n else if (pkgName.startsWith('@')) {\n const atMatch = pkgName.match(/^@([^\\/]+)\\/([^\\/]+)(?:\\/(.+))?$/);\n if (atMatch) {\n username = atMatch[1];\n repo = atMatch[2];\n nameSubpathFromName = atMatch[3] || undefined;\n }\n }\n // Check for no prefix (missing @)\n else {\n const noAtMatch = pkgName.match(/^([^\\/]+)\\/([^\\/]+)(?:\\/(.+))?$/);\n if (noAtMatch) {\n username = noAtMatch[1];\n repo = noAtMatch[2];\n nameSubpathFromName = noAtMatch[3] || undefined;\n }\n }\n \n // If we couldn't extract username/repo, keep original\n if (!username || !repo) {\n migratedPackages[pkgName] = pkgData;\n continue;\n }\n\n // Decide whether to migrate the subpath portion.\n // IMPORTANT: Never \"collapse\" a more-specific resource name to a less-specific path.\n // Example: keep gh@u/r/plugins/x/skills/y even if cache path is plugins/x.\n const nameSubpath = nameSubpathFromName;\n\n let targetSubpath: string | undefined = actualSubpath;\n if (actualSubpath && nameSubpath) {\n const actualNorm = actualSubpath.replace(/\\\\/g, '/');\n const nameNorm = nameSubpath.replace(/\\\\/g, '/');\n\n if (nameNorm === actualNorm) {\n // exact match, ok\n targetSubpath = actualSubpath;\n } else if (actualNorm.endsWith(`/${nameNorm}`)) {\n // Old basename-style name: gh@u/r/basename \u2192 gh@u/r/full/path\n targetSubpath = actualSubpath;\n } else if (nameNorm.startsWith(`${actualNorm}/`)) {\n // Resource-scoped install: keep the more-specific name\n targetSubpath = nameSubpath;\n } else {\n // Unknown relationship: prefer not to rewrite (avoid data loss)\n targetSubpath = nameSubpath;\n }\n } else if (!actualSubpath && nameSubpath) {\n // No cache subpath detected, keep explicit name subpath\n targetSubpath = nameSubpath;\n } else if (actualSubpath && !nameSubpath) {\n // Name has no subpath but cache does \u2192 upgrade to include subpath\n targetSubpath = actualSubpath;\n }\n\n // Build the correct package name (at minimum, normalize to gh@ prefix)\n const correctName = targetSubpath\n ? `gh@${username}/${repo}/${targetSubpath}`\n : `gh@${username}/${repo}`;\n \n // Use the correct name (which might be the same as original if already correct)\n migratedPackages[correctName] = pkgData;\n }\n \n return { packages: migratedPackages };\n}\n\nexport async function writeWorkspaceIndex(record: WorkspaceIndexRecord): Promise<void> {\n const indexPath = record.path;\n \n // Migrate package names before writing\n const migrated = migrateGitHubPackageNames(record.index);\n const packages = migrated.packages ?? {};\n\n const sortedPackages: Record<string, WorkspaceIndexPackage> = {};\n for (const pkgName of Object.keys(packages).sort()) {\n const pkg = packages[pkgName];\n const sortedPkg: WorkspaceIndexPackage = {\n path: pkg.path,\n files: sortFilesMapping(pkg.files ?? {})\n };\n if (pkg.version) {\n sortedPkg.version = pkg.version;\n }\n if (pkg.dependencies && pkg.dependencies.length > 0) {\n sortedPkg.dependencies = sortAndDedupeStrings(pkg.dependencies);\n }\n if (pkg.marketplace) {\n sortedPkg.marketplace = pkg.marketplace;\n }\n sortedPackages[pkgName] = sortedPkg;\n }\n\n await ensureDir(dirname(indexPath));\n\n const body = yaml.dump(\n {\n packages: sortedPackages\n },\n {\n lineWidth: 120,\n sortKeys: true\n }\n );\n\n const serialized = `${HEADER_COMMENT}\\n\\n${body}`;\n await writeTextFile(indexPath, serialized);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS,YAAY;AAC9B,YAAY,UAAU;AAStB,IAAM,iBAAiB;AAOhB,SAAS,sBAAsB,WAA2B;AAC/D,SAAO,KAAK,uBAAuB,SAAS,GAAG,cAAc,qBAAqB;AACpF;AAEA,SAAS,qBAAqB,QAA4B;AACxD,SAAO,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,EAAE,KAAK;AAC1C;AAEA,SAAS,iBAAiB,OAAqD;AAC7E,MAAM,SAAgC,CAAC,GACjC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Q,IAAI,IAAI,IAAI,aAAa,KACvC,MAAM,QAAQ,IAAI,IAAI;AAG1B,qBAAiB,WAAW,IAAI;AAAA,EAClC;AAEA,SAAO,EAAE,UAAU,iBAAiB;AACtC;AAEA,eAAsB,oBAAoB,QAA6C;AACrF,MAAM,YAAY,OAAO,MAInB,WADW,0BAA0B,OAAO,KAAK,EAC7B,YAAY,CAAC,GAEjC,iBAAwD,CAAC;AAC/D,WAAW,WAAW,OAAO,KAAK,QAAQ,EAAE,KAAK,GAAG;AAClD,QAAM,MAAM,SAAS,OAAO,GACtB,YAAmC;AAAA,MACvC,MAAM,IAAI;AAAA,MACV,OAAO,iBAAiB,IAAI,SAAS,CAAC,CAAC;AAAA,IACzC;AACA,IAAI,IAAI,YACN,UAAU,UAAU,IAAI,UAEtB,IAAI,gBAAgB,IAAI,aAAa,SAAS,MAChD,UAAU,eAAe,qBAAqB,IAAI,YAAY,IAE5D,IAAI,gBACN,UAAU,cAAc,IAAI,cAE9B,eAAe,OAAO,IAAI;AAAA,EAC5B;AAEA,QAAM,UAAU,QAAQ,SAAS,CAAC;AAElC,MAAM,OAAY;AAAA,IAChB;AAAA,MACE,UAAU;AAAA,IACZ;AAAA,IACA;AAAA,MACE,WAAW;AAAA,MACX,UAAU;AAAA,IACZ;AAAA,EACF,GAEM,aAAa,GAAG,cAAc;AAAA;AAAA,EAAO,IAAI;AAC/C,QAAM,cAAc,WAAW,UAAU;AAC3C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
walkFiles
|
|
4
|
+
} from "./chunk-A6ISKBNM.js";
|
|
5
|
+
import {
|
|
6
|
+
createWorkspacePackageYml,
|
|
7
|
+
ensureLocalOpenPackageStructure
|
|
8
|
+
} from "./chunk-D3O7LY2Q.js";
|
|
9
|
+
import {
|
|
10
|
+
getLocalOpenPackageDir
|
|
11
|
+
} from "./chunk-VXNS3X5O.js";
|
|
12
|
+
import {
|
|
13
|
+
parsePackageYml
|
|
14
|
+
} from "./chunk-427DCURL.js";
|
|
15
|
+
import {
|
|
16
|
+
FILE_PATTERNS
|
|
17
|
+
} from "./chunk-IHVZ5AUJ.js";
|
|
18
|
+
import {
|
|
19
|
+
exists
|
|
20
|
+
} from "./chunk-S47F4OG4.js";
|
|
21
|
+
import {
|
|
22
|
+
logger
|
|
23
|
+
} from "./chunk-5EFWGD33.js";
|
|
24
|
+
|
|
25
|
+
// ../core/src/core/workspace-package-context.ts
|
|
26
|
+
import { join, basename } from "path";
|
|
27
|
+
async function buildWorkspacePackageContext(cwd) {
|
|
28
|
+
await ensureLocalOpenPackageStructure(cwd), await createWorkspacePackageYml(cwd);
|
|
29
|
+
let openpackageDir = getLocalOpenPackageDir(cwd), packageYmlPath = join(openpackageDir, FILE_PATTERNS.OPENPACKAGE_YML), config;
|
|
30
|
+
try {
|
|
31
|
+
config = await parsePackageYml(packageYmlPath);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
throw new Error(
|
|
34
|
+
`Failed to read workspace manifest at ${packageYmlPath}: ${error}`
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
name: config.name || basename(cwd),
|
|
39
|
+
version: config.version,
|
|
40
|
+
config,
|
|
41
|
+
packageYmlPath,
|
|
42
|
+
packageRootDir: openpackageDir,
|
|
43
|
+
packageFilesDir: openpackageDir
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// ../core/src/utils/expand-directory-selections.ts
|
|
48
|
+
import { join as join2, relative } from "path";
|
|
49
|
+
import { promises as fs } from "fs";
|
|
50
|
+
import { isJunk } from "junk";
|
|
51
|
+
async function expandDirectorySelections(selectedPaths, basePath) {
|
|
52
|
+
let expandedFiles = [], seenFiles = /* @__PURE__ */ new Set();
|
|
53
|
+
for (let path of selectedPaths)
|
|
54
|
+
if (path.endsWith("/")) {
|
|
55
|
+
let dirPath = path.slice(0, -1), absDirPath = join2(basePath, dirPath);
|
|
56
|
+
try {
|
|
57
|
+
if (!(await fs.stat(absDirPath)).isDirectory())
|
|
58
|
+
continue;
|
|
59
|
+
} catch {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
let filter = (filePath, isDirectory) => {
|
|
63
|
+
if (isDirectory)
|
|
64
|
+
return !0;
|
|
65
|
+
let segments = filePath.split("/"), basename2 = segments[segments.length - 1];
|
|
66
|
+
return !isJunk(basename2);
|
|
67
|
+
};
|
|
68
|
+
for await (let filePath of walkFiles(absDirPath, { filter })) {
|
|
69
|
+
let relativePath = relative(basePath, filePath);
|
|
70
|
+
seenFiles.has(relativePath) || (seenFiles.add(relativePath), expandedFiles.push(relativePath));
|
|
71
|
+
}
|
|
72
|
+
} else
|
|
73
|
+
seenFiles.has(path) || (seenFiles.add(path), expandedFiles.push(path));
|
|
74
|
+
return expandedFiles;
|
|
75
|
+
}
|
|
76
|
+
function hasDirectorySelections(selectedPaths) {
|
|
77
|
+
return selectedPaths.some((path) => path.endsWith("/"));
|
|
78
|
+
}
|
|
79
|
+
function countSelectionTypes(selectedPaths) {
|
|
80
|
+
let dirs = 0, files = 0;
|
|
81
|
+
for (let path of selectedPaths)
|
|
82
|
+
path.endsWith("/") ? dirs++ : files++;
|
|
83
|
+
return { dirs, files };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// src/utils/interactive-file-selector.ts
|
|
87
|
+
import { note, log } from "@clack/prompts";
|
|
88
|
+
|
|
89
|
+
// src/utils/file-selector-with-header.ts
|
|
90
|
+
import { AutocompletePrompt, isCancel } from "@clack/core";
|
|
91
|
+
import { search } from "fast-fuzzy";
|
|
92
|
+
import pico from "picocolors";
|
|
93
|
+
var FileSelectorWithHeader = class extends AutocompletePrompt {
|
|
94
|
+
constructor(options) {
|
|
95
|
+
let fileOptions = options.files.map((file) => ({
|
|
96
|
+
value: file,
|
|
97
|
+
label: file
|
|
98
|
+
}));
|
|
99
|
+
super({
|
|
100
|
+
options: fileOptions,
|
|
101
|
+
multiple: !0,
|
|
102
|
+
render() {
|
|
103
|
+
return this.renderWithHeader();
|
|
104
|
+
}
|
|
105
|
+
}), this.allFiles = options.files, this.message = options.message, this.placeholder = options.placeholder || "Type to search...", this.maxVisibleItems = options.maxItems || 10, this.fuzzyThreshold = options.fuzzyThreshold || 0.5, this.setupFuzzyFiltering(), this.setupNoOverscroll();
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Prevent wrap-around: stay at top when pressing up at first item (don't jump to last)
|
|
109
|
+
*/
|
|
110
|
+
setupNoOverscroll() {
|
|
111
|
+
this.on("key", (_char, key) => {
|
|
112
|
+
let len = this.filteredOptions.length;
|
|
113
|
+
len <= 1 || key.name === "up" && this.cursor === len - 1 && this.emit("key", void 0, { name: "down", ctrl: !1, meta: !1, shift: !1 });
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Setup fuzzy filtering based on user input
|
|
118
|
+
*/
|
|
119
|
+
setupFuzzyFiltering() {
|
|
120
|
+
this.on("userInput", () => {
|
|
121
|
+
this.updateFilteredOptions();
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Update filtered options based on current user input
|
|
126
|
+
*/
|
|
127
|
+
updateFilteredOptions() {
|
|
128
|
+
let input = this.userInput, filteredFiles;
|
|
129
|
+
!input || input.trim() === "" ? filteredFiles = this.allFiles : filteredFiles = search(input, this.allFiles, {
|
|
130
|
+
threshold: this.fuzzyThreshold,
|
|
131
|
+
ignoreCase: !0,
|
|
132
|
+
returnMatchData: !1
|
|
133
|
+
}), this.filteredOptions = filteredFiles.map((file) => ({
|
|
134
|
+
value: file,
|
|
135
|
+
label: file
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Main render method with dynamic header
|
|
140
|
+
*/
|
|
141
|
+
renderWithHeader() {
|
|
142
|
+
if (this.state === "cancel")
|
|
143
|
+
return this.renderCancelled();
|
|
144
|
+
if (this.state === "submit")
|
|
145
|
+
return this.selectedValues.length === 0 ? this.renderCancelled() : this.renderSubmitted();
|
|
146
|
+
let sections = [];
|
|
147
|
+
return sections.push(this.renderSelectedFilesHeader()), sections.push(this.renderSearchSection()), sections.push(this.renderOptionsList()), sections.push(this.renderFooter()), sections.join(`
|
|
148
|
+
`);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Get a smart label for the current selection (e.g., "2 dirs, 1 file" or "3 files")
|
|
152
|
+
*/
|
|
153
|
+
getSelectionLabel() {
|
|
154
|
+
let count = this.selectedValues.length, dirs = this.selectedValues.filter((v) => v.endsWith("/")).length, files = count - dirs;
|
|
155
|
+
return dirs === 0 ? `${files} file${files === 1 ? "" : "s"}` : files === 0 ? `${dirs} dir${dirs === 1 ? "" : "s"}` : `${dirs} dir${dirs === 1 ? "" : "s"}, ${files} file${files === 1 ? "" : "s"}`;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Render the selected files header using Clack's simple log-style format
|
|
159
|
+
*/
|
|
160
|
+
renderSelectedFilesHeader() {
|
|
161
|
+
let count = this.selectedValues.length, lines = [], title = count === 0 ? `Selected: ${pico.dim("none (use Space to select)")}` : `Selected: ${pico.cyan(this.getSelectionLabel())}`;
|
|
162
|
+
if (lines.push(`${pico.cyan("\u25C6")} ${title}`), count > 0) {
|
|
163
|
+
let displayCount = Math.min(5, count);
|
|
164
|
+
for (let i = 0; i < displayCount; i++) {
|
|
165
|
+
let file = this.selectedValues[i];
|
|
166
|
+
lines.push(`${pico.cyan("\u2502")} ${pico.dim("\u2713 " + file)}`);
|
|
167
|
+
}
|
|
168
|
+
count > displayCount && lines.push(`${pico.cyan("\u2502")} ${pico.dim(`... and ${count - displayCount} more`)}`);
|
|
169
|
+
}
|
|
170
|
+
return lines.push(pico.cyan("\u2502")), lines.join(`
|
|
171
|
+
`);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Render the search section
|
|
175
|
+
*/
|
|
176
|
+
renderSearchSection() {
|
|
177
|
+
let matchCount = this.filteredOptions.length, totalCount = this.allFiles.length, stateSymbol = pico.cyan("\u25C6"), searchLabel = pico.dim("Search:"), input = this.userInput || pico.gray(this.placeholder), cursor = this.state === "active" ? pico.cyan("\u2588") : "", matches = matchCount !== totalCount ? pico.dim(` (${matchCount} ${matchCount === 1 ? "match" : "matches"})`) : "";
|
|
178
|
+
return `${stateSymbol} ${this.message}
|
|
179
|
+
${pico.cyan("\u2502")} ${searchLabel} ${input}${cursor}${matches}`;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Render the options list with sliding window to keep cursor in view
|
|
183
|
+
*/
|
|
184
|
+
renderOptionsList() {
|
|
185
|
+
let lines = [], totalOptions = this.filteredOptions.length, maxItems = this.maxVisibleItems;
|
|
186
|
+
if (totalOptions === 0)
|
|
187
|
+
return lines.push(`${pico.cyan("\u2502")} ${pico.gray("No matches found")}`), lines.join(`
|
|
188
|
+
`);
|
|
189
|
+
let visibleStart = 0;
|
|
190
|
+
this.cursor >= maxItems - 3 && (visibleStart = Math.max(0, Math.min(this.cursor - maxItems + 3, totalOptions - maxItems)));
|
|
191
|
+
let visibleEnd = Math.min(visibleStart + maxItems, totalOptions), visibleOptions = this.filteredOptions.slice(visibleStart, visibleEnd);
|
|
192
|
+
visibleStart > 0 && lines.push(`${pico.cyan("\u2502")} ${pico.gray(`... ${visibleStart} above`)}`);
|
|
193
|
+
for (let i = 0; i < visibleOptions.length; i++) {
|
|
194
|
+
let option = visibleOptions[i], isSelected = this.selectedValues.includes(option.value), isCursor = visibleStart + i === this.cursor, checkbox = isSelected ? pico.cyan("\u25FC") : pico.dim("\u25FB"), cursorMark = isCursor ? pico.cyan("\u25B8") : " ", fileName = option.label;
|
|
195
|
+
isCursor ? fileName = pico.cyan(fileName) : isSelected ? fileName = pico.white(fileName) : fileName = pico.dim(fileName), lines.push(`${pico.cyan("\u2502")} ${cursorMark} ${checkbox} ${fileName}`);
|
|
196
|
+
}
|
|
197
|
+
if (visibleEnd < totalOptions) {
|
|
198
|
+
let remaining = totalOptions - visibleEnd;
|
|
199
|
+
lines.push(`${pico.cyan("\u2502")} ${pico.gray(`... ${remaining} more`)}`);
|
|
200
|
+
}
|
|
201
|
+
return lines.join(`
|
|
202
|
+
`);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Render the footer with hints
|
|
206
|
+
*/
|
|
207
|
+
renderFooter() {
|
|
208
|
+
let hints = pico.dim("Space: select \u2022 Enter: confirm \u2022 Esc: cancel");
|
|
209
|
+
return `${pico.cyan("\u2514")} ${hints}`;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Render the collapsed cancelled state
|
|
213
|
+
*/
|
|
214
|
+
renderCancelled() {
|
|
215
|
+
let symbol = pico.red("\u25A0"), end = pico.gray("\u2514");
|
|
216
|
+
return `${symbol} ${this.message}
|
|
217
|
+
${end} ${pico.dim("Operation cancelled")}`;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Render the collapsed submitted state (for successful selection)
|
|
221
|
+
*/
|
|
222
|
+
renderSubmitted() {
|
|
223
|
+
let symbol = pico.green("\u25C7"), bar = pico.gray("\u2502"), status = pico.dim(this.getSelectionLabel() + " selected");
|
|
224
|
+
return `${symbol} ${this.message}
|
|
225
|
+
${bar} ${status}`;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
async function promptFileSelector(options) {
|
|
229
|
+
let result = await new FileSelectorWithHeader(options).prompt();
|
|
230
|
+
return isCancel(result) ? null : result;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// ../core/src/utils/file-scanner.ts
|
|
234
|
+
import { relative as relative2 } from "path";
|
|
235
|
+
import { isJunk as isJunk2 } from "junk";
|
|
236
|
+
var DEFAULT_EXCLUDE_DIRS = /* @__PURE__ */ new Set([
|
|
237
|
+
"node_modules",
|
|
238
|
+
".git",
|
|
239
|
+
".next",
|
|
240
|
+
".turbo",
|
|
241
|
+
"dist",
|
|
242
|
+
"build",
|
|
243
|
+
"out",
|
|
244
|
+
".cache",
|
|
245
|
+
"coverage",
|
|
246
|
+
".nyc_output",
|
|
247
|
+
".parcel-cache",
|
|
248
|
+
".webpack",
|
|
249
|
+
".vscode",
|
|
250
|
+
".idea",
|
|
251
|
+
"__pycache__",
|
|
252
|
+
"target",
|
|
253
|
+
"vendor"
|
|
254
|
+
]);
|
|
255
|
+
function isExcludedDir(fullPath, excludeDirs) {
|
|
256
|
+
let segments = fullPath.split("/");
|
|
257
|
+
for (let segment of segments)
|
|
258
|
+
if (excludeDirs.has(segment))
|
|
259
|
+
return !0;
|
|
260
|
+
return !1;
|
|
261
|
+
}
|
|
262
|
+
async function scanWorkspaceFiles(options = {}) {
|
|
263
|
+
let {
|
|
264
|
+
cwd = process.cwd(),
|
|
265
|
+
basePath,
|
|
266
|
+
excludeDirs = [],
|
|
267
|
+
maxFiles = 1e4,
|
|
268
|
+
followSymlinks = !1,
|
|
269
|
+
includeDirs = !1
|
|
270
|
+
} = options, scanDir = basePath || cwd, allExcludeDirs = /* @__PURE__ */ new Set([
|
|
271
|
+
...DEFAULT_EXCLUDE_DIRS,
|
|
272
|
+
...excludeDirs
|
|
273
|
+
]), files = [], dirs = [], fileCount = 0;
|
|
274
|
+
try {
|
|
275
|
+
let filter = (path, isDirectory) => {
|
|
276
|
+
let segments = path.split("/"), basename2 = segments[segments.length - 1];
|
|
277
|
+
return !(isJunk2(basename2) || isExcludedDir(path, allExcludeDirs));
|
|
278
|
+
};
|
|
279
|
+
for await (let filePath of walkFiles(scanDir, { filter, followSymlinks, includeDirs })) {
|
|
280
|
+
if (fileCount >= maxFiles) {
|
|
281
|
+
logger.debug(`File scan limit reached: ${maxFiles} files`);
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
let relativePath = relative2(scanDir, filePath);
|
|
285
|
+
!relativePath || relativePath === "." || (includeDirs && (await (await import("fs")).promises.stat(filePath)).isDirectory() ? dirs.push(relativePath + "/") : files.push(relativePath), fileCount++);
|
|
286
|
+
}
|
|
287
|
+
let allItems = [...dirs.sort(), ...files.sort()];
|
|
288
|
+
return allItems.sort((a, b) => {
|
|
289
|
+
let aPath = a.endsWith("/") ? a.slice(0, -1) : a, bPath = b.endsWith("/") ? b.slice(0, -1) : b, aDepth = aPath.split("/").length, bDepth = bPath.split("/").length;
|
|
290
|
+
return aDepth !== bDepth ? aDepth - bDepth : a.localeCompare(b);
|
|
291
|
+
}), logger.debug(`Scanned ${allItems.length} items in workspace`, { scanDir, includeDirs }), allItems;
|
|
292
|
+
} catch (error) {
|
|
293
|
+
throw logger.error("Error scanning workspace files", { error, scanDir }), new Error(`Failed to scan workspace files: ${error}`);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// src/utils/interactive-file-selector.ts
|
|
298
|
+
async function interactiveFileSelect(options = {}) {
|
|
299
|
+
let {
|
|
300
|
+
cwd = process.cwd(),
|
|
301
|
+
basePath,
|
|
302
|
+
message,
|
|
303
|
+
placeholder,
|
|
304
|
+
maxItems = 10,
|
|
305
|
+
excludeDirs = [],
|
|
306
|
+
fuzzyThreshold = 0.5,
|
|
307
|
+
includeDirs = !1
|
|
308
|
+
} = options, finalMessage = message || (includeDirs ? "Select files or directories to add" : "Select files to add"), finalPlaceholder = placeholder || (includeDirs ? "Type to search..." : "Type to search files..."), scanDir = basePath || cwd;
|
|
309
|
+
try {
|
|
310
|
+
logger.debug("Scanning workspace for files", { scanDir });
|
|
311
|
+
let allFiles = await scanWorkspaceFiles({ cwd, basePath, excludeDirs, includeDirs });
|
|
312
|
+
if (allFiles.length === 0)
|
|
313
|
+
return logger.warn("No files found in workspace"), note("No files found in the workspace directory", "No Files"), null;
|
|
314
|
+
logger.debug(`Found ${allFiles.length} files to display`);
|
|
315
|
+
let selectedFiles = await promptFileSelector({
|
|
316
|
+
message: finalMessage,
|
|
317
|
+
files: allFiles,
|
|
318
|
+
placeholder: finalPlaceholder,
|
|
319
|
+
maxItems,
|
|
320
|
+
fuzzyThreshold
|
|
321
|
+
});
|
|
322
|
+
if (!selectedFiles || selectedFiles.length === 0)
|
|
323
|
+
return logger.debug("No files selected or user cancelled"), null;
|
|
324
|
+
logger.debug(`User selected ${selectedFiles.length} file(s)`, { selectedFiles });
|
|
325
|
+
let fileList = selectedFiles.length <= 5 ? selectedFiles.join(`
|
|
326
|
+
`) : selectedFiles.slice(0, 5).join(`
|
|
327
|
+
`) + `
|
|
328
|
+
... and ${selectedFiles.length - 5} more`, countLabel = includeDirs ? (() => {
|
|
329
|
+
let { dirs, files } = countSelectionTypes(selectedFiles), parts = [];
|
|
330
|
+
return dirs > 0 && parts.push(`${dirs} dir${dirs === 1 ? "" : "s"}`), files > 0 && parts.push(`${files} file${files === 1 ? "" : "s"}`), parts.join(" and ");
|
|
331
|
+
})() : `${selectedFiles.length} file${selectedFiles.length === 1 ? "" : "s"}`;
|
|
332
|
+
return log.success(`Selected ${countLabel}:
|
|
333
|
+
${fileList}`), selectedFiles;
|
|
334
|
+
} catch (error) {
|
|
335
|
+
throw logger.error("Error during file selection", { error }), new Error(`File selection failed: ${error}`);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// ../core/src/utils/source-operation-arguments.ts
|
|
340
|
+
import { resolve as resolvePath, join as join3 } from "path";
|
|
341
|
+
async function resolveSourceOperationArguments(cwd, packageName, pathArg, options) {
|
|
342
|
+
let { command, checkWorkspaceRoot = !1 } = options, flagName = command === "add" ? "--to" : "--from";
|
|
343
|
+
if (packageName && pathArg)
|
|
344
|
+
return { resolvedPackageName: packageName, resolvedPath: pathArg };
|
|
345
|
+
let singleArg = packageName || pathArg;
|
|
346
|
+
if (!singleArg)
|
|
347
|
+
throw new Error(`Path argument is required for ${command}.`);
|
|
348
|
+
let absPath = resolvePath(cwd, singleArg), pathExists = await exists(absPath);
|
|
349
|
+
if (!pathExists && checkWorkspaceRoot) {
|
|
350
|
+
let openpackageDir = getLocalOpenPackageDir(cwd), workspaceRootPath = join3(openpackageDir, singleArg);
|
|
351
|
+
pathExists = await exists(workspaceRootPath);
|
|
352
|
+
}
|
|
353
|
+
if (pathExists)
|
|
354
|
+
return { resolvedPackageName: null, resolvedPath: singleArg };
|
|
355
|
+
if (checkWorkspaceRoot && command === "remove")
|
|
356
|
+
return { resolvedPackageName: null, resolvedPath: singleArg };
|
|
357
|
+
throw new Error(
|
|
358
|
+
`Path '${singleArg}' not found.
|
|
359
|
+
|
|
360
|
+
If you meant to specify a package name, use: opkg ${command} <path> ${flagName} ${singleArg}`
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export {
|
|
365
|
+
resolveSourceOperationArguments,
|
|
366
|
+
buildWorkspacePackageContext,
|
|
367
|
+
expandDirectorySelections,
|
|
368
|
+
hasDirectorySelections,
|
|
369
|
+
interactiveFileSelect
|
|
370
|
+
};
|
|
371
|
+
//# sourceMappingURL=chunk-FMVVJH5M.js.map
|