@herbertgao/pi-extensions 2026.10.5 → 2026.10.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -14
- package/THIRD_PARTY_NOTICES.md +1 -53
- package/extensions/clef-format.mjs +113 -0
- package/extensions/clef.mjs +112 -0
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-debt.md +1 -1
- package/node_modules/@dietrichgebert/ponytail/.opencode/plugins/ponytail.mjs +30 -6
- package/node_modules/@dietrichgebert/ponytail/.qoder-plugin/plugin.json +1 -1
- package/node_modules/@dietrichgebert/ponytail/README.md +5 -1
- package/node_modules/@dietrichgebert/ponytail/hooks/claude-codex-hooks.json +3 -3
- package/node_modules/@dietrichgebert/ponytail/hooks/copilot-hooks.json +4 -4
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-activate.js +158 -127
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-config.js +5 -0
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-map.js +8 -3
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-runtime.js +14 -8
- package/node_modules/@dietrichgebert/ponytail/package.json +1 -1
- package/node_modules/@dietrichgebert/ponytail/pi-extension/index.js +16 -3
- package/node_modules/@dietrichgebert/ponytail/scripts/cursor-hooks.js +13 -3
- package/node_modules/@dietrichgebert/ponytail/scripts/uninstall.js +3 -2
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail-debt/SKILL.md +3 -3
- package/node_modules/@herbertgao/pi-agency/package.json +2 -2
- package/node_modules/@herbertgao/pi-bark/package.json +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +1 -2
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +1 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +5 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +22 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/core.ts +2 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +396 -146
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/reference/index.ts +2 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/reference/subagent.ts +3 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +10 -6
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/token-rate.ts +15 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/working-message.ts +2 -23
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +195 -77
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +23 -471
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +6 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/markdown-enhance.ts +16 -83
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/hover.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +68 -28
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/packets.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/sticky-prompt.ts +53 -5
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ask-user-question.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ccstyle-tool.ts +467 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/ansi-utils.ts +1 -24
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-edit-render.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-limits.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-text.ts +2 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-write-render.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/line-width-safety.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +53 -34
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/message-display.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/names.ts +41 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/result.ts +2 -862
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/tool-io.ts +735 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/tool-state.ts +138 -0
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +6 -5
- package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark.json +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light.json +2 -2
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +8 -0
- package/node_modules/@herbertgao/pi-subagents/docs/packages.md +211 -0
- package/node_modules/@herbertgao/pi-subagents/docs/rpc.md +61 -63
- package/node_modules/@herbertgao/pi-subagents/docs/workflows.md +24 -16
- package/node_modules/@herbertgao/pi-subagents/package.json +6 -5
- package/node_modules/@herbertgao/pi-subagents/src/agent-file-toggle.ts +51 -14
- package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +123 -55
- package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +144 -13
- package/node_modules/@herbertgao/pi-subagents/src/agent-source-badge.ts +78 -0
- package/node_modules/@herbertgao/pi-subagents/src/completion-outbox.ts +122 -0
- package/node_modules/@herbertgao/pi-subagents/src/custom-agents.ts +171 -79
- package/node_modules/@herbertgao/pi-subagents/src/index.ts +597 -296
- package/node_modules/@herbertgao/pi-subagents/src/package-resources.ts +724 -0
- package/node_modules/@herbertgao/pi-subagents/src/schedule.ts +1 -1
- package/node_modules/@herbertgao/pi-subagents/src/settings.ts +66 -0
- package/node_modules/@herbertgao/pi-subagents/src/types.ts +26 -4
- package/node_modules/@herbertgao/pi-subagents/src/ui/agent-widget.ts +2 -0
- package/node_modules/@herbertgao/pi-subagents/src/ui/conversation-viewer.ts +354 -32
- package/node_modules/@herbertgao/pi-subagents/src/ui/fleet-list.ts +33 -15
- package/node_modules/@herbertgao/pi-subagents/src/workflow/host.ts +6 -0
- package/node_modules/@herbertgao/pi-subagents/src/workflow/saved.ts +48 -2
- package/node_modules/@herbertgao/sol-pi/README.md +3 -3
- package/node_modules/@herbertgao/sol-pi/THIRD_PARTY_NOTICES.md +4 -4
- package/node_modules/@herbertgao/sol-pi/agents-install.md +3 -3
- package/node_modules/@herbertgao/sol-pi/docs/compatibility.md +1 -1
- package/node_modules/@herbertgao/sol-pi/package.json +2 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/README.md +3 -3
- package/node_modules/@juicesharp/rpiv-ask-user-question/ask-user-question.ts +89 -39
- package/node_modules/@juicesharp/rpiv-ask-user-question/docs/configuration.md +1 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/docs/hosts.md +4 -4
- package/node_modules/@juicesharp/rpiv-ask-user-question/docs/keyboard.md +56 -23
- package/node_modules/@juicesharp/rpiv-ask-user-question/docs/tool-schema.md +6 -3
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/de.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/en.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/es.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/fr.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/pt-BR.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/pt.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/ru.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/uk.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/zh.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +5 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/presentation.ts +122 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/rpc-fallback.ts +73 -36
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/build-questionnaire.ts +10 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/key-router.ts +15 -13
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/questionnaire-session.ts +5 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/selectors/derivations.ts +15 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/selectors/projections.ts +4 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/state-reducer.ts +29 -18
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/state.ts +1 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/tool/format-answer.ts +5 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/tool/normalize-params.ts +46 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/tool/response-envelope.ts +19 -8
- package/node_modules/@juicesharp/rpiv-ask-user-question/tool/types.ts +9 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/multi-select-view.ts +4 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/preview/preview-block-renderer.ts +56 -25
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/preview/preview-pane.ts +131 -46
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/dialog-builder.ts +94 -106
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/dialog-copy.ts +51 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/scroll-window.ts +73 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/tab-content-strategy.ts +31 -10
- package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts.map +1 -1
- package/node_modules/@pi-plugins/fast-mode/dist/index.mjs +474 -93
- package/node_modules/@pi-plugins/fast-mode/dist/index.mjs.map +1 -1
- package/node_modules/@pi-plugins/fast-mode/package.json +1 -1
- package/node_modules/pi-lens/CHANGELOG.md +88 -0
- package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +3 -1
- package/node_modules/pi-lens/dist/{chunk-BJF25SUG.js → chunk-23WOO7TX.js} +11 -10
- package/node_modules/pi-lens/dist/{chunk-WATC3IQR.js → chunk-2B73ZPOK.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-N2IRDBZI.js → chunk-2BBLFX75.js} +101 -11
- package/node_modules/pi-lens/dist/{chunk-TA5L5KWQ.js → chunk-2CD5RS6M.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-3TTPKMEF.js → chunk-2VUQMUMT.js} +38 -37
- package/node_modules/pi-lens/dist/{chunk-5JHXUETW.js → chunk-3EFKIGZN.js} +3 -3
- package/node_modules/pi-lens/dist/chunk-3JNKMP3B.js +17 -0
- package/node_modules/pi-lens/dist/{chunk-6P54TMWL.js → chunk-3VPVG5SU.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-ZETYB3XG.js → chunk-3W7IEVVL.js} +44 -28
- package/node_modules/pi-lens/dist/chunk-3YN6V5TV.js +85 -0
- package/node_modules/pi-lens/dist/chunk-466Z26MG.js +30 -0
- package/node_modules/pi-lens/dist/{chunk-PCHDGUKT.js → chunk-4UNXBNE2.js} +12 -11
- package/node_modules/pi-lens/dist/{chunk-J7WJZ6W7.js → chunk-4W4VLAPJ.js} +12 -11
- package/node_modules/pi-lens/dist/{chunk-F5VLZHUW.js → chunk-52FUZI6K.js} +4 -2
- package/node_modules/pi-lens/dist/{chunk-H5EV3VMF.js → chunk-5NGR67U5.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-CBD2B5CP.js → chunk-5UCAH366.js} +21 -20
- package/node_modules/pi-lens/dist/{chunk-BHWHXMQ2.js → chunk-67WMNWEE.js} +9 -8
- package/node_modules/pi-lens/dist/{chunk-USHG4DLH.js → chunk-6C7JWPCP.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-VPWKF3GN.js → chunk-6GFRNVYR.js} +11 -10
- package/node_modules/pi-lens/dist/{chunk-3JL6IFD7.js → chunk-6SDEP3AJ.js} +9 -8
- package/node_modules/pi-lens/dist/{chunk-NJF2X5XF.js → chunk-6STA6Z7I.js} +19 -17
- package/node_modules/pi-lens/dist/{chunk-KJCWXUUS.js → chunk-724UL2TJ.js} +6 -4
- package/node_modules/pi-lens/dist/{chunk-MQA2YBAH.js → chunk-76MWC2K6.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-YLN4K6WD.js → chunk-77M37OKR.js} +10 -8
- package/node_modules/pi-lens/dist/{chunk-XHSCVSOL.js → chunk-7DYBLXYA.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-OC7LYAU5.js → chunk-AB3YYG6N.js} +24 -10
- package/node_modules/pi-lens/dist/{chunk-LD7WFTRX.js → chunk-ACXEQZOU.js} +16 -16
- package/node_modules/pi-lens/dist/{chunk-VSMJK3ZJ.js → chunk-AOHZU2BM.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-T4QZ6FEH.js → chunk-AW7R2GWG.js} +65 -8
- package/node_modules/pi-lens/dist/{chunk-GAYGGICG.js → chunk-BKE7E7TC.js} +10 -9
- package/node_modules/pi-lens/dist/{chunk-EUT3B22Y.js → chunk-BRGDSBJE.js} +13 -12
- package/node_modules/pi-lens/dist/{chunk-T54VJRAD.js → chunk-C34ZXZ7O.js} +55 -11
- package/node_modules/pi-lens/dist/{chunk-UGSMCQ4D.js → chunk-CHOW74WE.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-H2W2AXD3.js → chunk-CMMHNUZ2.js} +66 -58
- package/node_modules/pi-lens/dist/chunk-CSHFH5IN.js +17 -0
- package/node_modules/pi-lens/dist/chunk-EC47DWFA.js +56 -0
- package/node_modules/pi-lens/dist/{chunk-KJN4IOEJ.js → chunk-EJIUXPBX.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-IQZXOZ7S.js → chunk-EU63SDCG.js} +720 -334
- package/node_modules/pi-lens/dist/{chunk-LNOMA3MP.js → chunk-FCSOVF55.js} +107 -3
- package/node_modules/pi-lens/dist/{chunk-CFYISHUW.js → chunk-FLKWCIZH.js} +8 -5
- package/node_modules/pi-lens/dist/{chunk-OYTMZXRF.js → chunk-FMSO6RDZ.js} +16 -14
- package/node_modules/pi-lens/dist/{chunk-IUKPRZER.js → chunk-GAEGEPOC.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-6XX5HCLK.js → chunk-GBPP5P7X.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-TQFBZVCG.js → chunk-GXW6K4YJ.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-ZZUFZUQZ.js → chunk-H6MF6EVN.js} +331 -107
- package/node_modules/pi-lens/dist/{chunk-3JSEWUWI.js → chunk-IBGIOBEE.js} +3 -3
- package/node_modules/pi-lens/dist/chunk-IZSHAIJ7.js +26 -0
- package/node_modules/pi-lens/dist/{chunk-7ELY2CSM.js → chunk-JAU72XNY.js} +16 -14
- package/node_modules/pi-lens/dist/chunk-JMYYOTQG.js +77 -0
- package/node_modules/pi-lens/dist/{chunk-ELVWJYRV.js → chunk-JSQFTSC6.js} +12 -11
- package/node_modules/pi-lens/dist/{chunk-J6DFZDFA.js → chunk-KBG47GHP.js} +4 -4
- package/node_modules/pi-lens/dist/chunk-KDERNTCQ.js +28 -0
- package/node_modules/pi-lens/dist/chunk-KSX3TXSZ.js +69 -0
- package/node_modules/pi-lens/dist/{chunk-XGUL4SLQ.js → chunk-L3BLXZG7.js} +2 -2
- package/node_modules/pi-lens/dist/chunk-LOP6GRPH.js +31 -0
- package/node_modules/pi-lens/dist/{chunk-MTDRLSI7.js → chunk-M6HSLBWY.js} +1064 -986
- package/node_modules/pi-lens/dist/chunk-MQLUAEOC.js +162 -0
- package/node_modules/pi-lens/dist/{chunk-3MRXIJ6I.js → chunk-MRXKYPCS.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-D65GOCJB.js → chunk-MXGY6KPT.js} +19 -16
- package/node_modules/pi-lens/dist/{chunk-G3RLJYA2.js → chunk-N2H3ZPZY.js} +47 -1
- package/node_modules/pi-lens/dist/{chunk-HREZQCT3.js → chunk-N3X6Q4YT.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-HSIRMK2D.js → chunk-OCAGUNBC.js} +15 -15
- package/node_modules/pi-lens/dist/{chunk-ZOEYVXSV.js → chunk-OXXKQCSV.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-S6AMWKPC.js → chunk-P7266HLM.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-64LU2OVH.js → chunk-PHDMFAKM.js} +12 -2
- package/node_modules/pi-lens/dist/{chunk-IMSQR4WO.js → chunk-PNQDPDRC.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-IUR76K6A.js → chunk-Q7DUK4LX.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-CULQYFLU.js → chunk-QGQ5CCCG.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-UEAHAMEI.js → chunk-QHJ6DQ2R.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-BNKLYOOO.js → chunk-QILIYSJF.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-VYKKMYVT.js → chunk-QOBUHWHX.js} +11 -6
- package/node_modules/pi-lens/dist/{chunk-3PNFWVHT.js → chunk-QQNQ7SJW.js} +2 -75
- package/node_modules/pi-lens/dist/{chunk-7M4T5N3V.js → chunk-R3PCY3YS.js} +14 -13
- package/node_modules/pi-lens/dist/{chunk-MGIWSROG.js → chunk-RPLINGVB.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-CMU4RMJB.js → chunk-RWWYJ623.js} +10 -1
- package/node_modules/pi-lens/dist/{chunk-3FERWMCH.js → chunk-RXCOMYPY.js} +27 -26
- package/node_modules/pi-lens/dist/{chunk-7BX5DWSA.js → chunk-SAEFPSB6.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-N7YNJE5R.js → chunk-SQ4TVJBR.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-DMS52BEP.js → chunk-SS36ZX4J.js} +9 -7
- package/node_modules/pi-lens/dist/{chunk-JONGANYH.js → chunk-T6CPIZNT.js} +32 -30
- package/node_modules/pi-lens/dist/{chunk-6UYA642J.js → chunk-TYM6OUIT.js} +13 -12
- package/node_modules/pi-lens/dist/{chunk-ALQRYH6O.js → chunk-UXGETRP4.js} +13 -12
- package/node_modules/pi-lens/dist/{chunk-FGALODG3.js → chunk-UZ3TUTRV.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-J3FZR3YY.js → chunk-VCHXCQFG.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-3P4PF2BX.js → chunk-VCO24T4L.js} +34 -22
- package/node_modules/pi-lens/dist/{chunk-O7HZX7CA.js → chunk-VRZP76YM.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-VZHJS6DR.js → chunk-VSSBEUFT.js} +16 -15
- package/node_modules/pi-lens/dist/{chunk-U52SAGRM.js → chunk-VWCXW2E7.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-WW5BLB74.js → chunk-WOA4LN2R.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-ZMOMPX2Z.js → chunk-WU567RSC.js} +11 -10
- package/node_modules/pi-lens/dist/{chunk-N77WFUL7.js → chunk-XAGLWMJ4.js} +23 -22
- package/node_modules/pi-lens/dist/{chunk-WSEWKCXU.js → chunk-XCJN5IJU.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-IR6XFA5P.js → chunk-XIJZVPD5.js} +16 -14
- package/node_modules/pi-lens/dist/{chunk-OYOB3ZFG.js → chunk-XMSXXAHW.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-34OCDWOS.js → chunk-XTMJ7XDT.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-Z6BB4JLQ.js → chunk-XVF2VVXP.js} +5 -3
- package/node_modules/pi-lens/dist/{chunk-AFZYMAIV.js → chunk-YIUAVF7E.js} +37 -35
- package/node_modules/pi-lens/dist/{chunk-NFXP47RV.js → chunk-YSZNHOBY.js} +85 -31
- package/node_modules/pi-lens/dist/{chunk-V5MEBST3.js → chunk-YYOIQFRS.js} +21 -21
- package/node_modules/pi-lens/dist/chunk-Z527N6YQ.js +28 -0
- package/node_modules/pi-lens/dist/{chunk-D6YF5HKX.js → chunk-ZANLILYD.js} +22 -2
- package/node_modules/pi-lens/dist/{chunk-2UMYMRI3.js → chunk-ZGDGW2V3.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-6B5I6ICN.js → chunk-ZHFZWTZV.js} +12 -11
- package/node_modules/pi-lens/dist/{chunk-OEX24ECI.js → chunk-ZWFS3OEF.js} +51 -41
- package/node_modules/pi-lens/dist/{chunk-AXKPQ6ZI.js → chunk-ZXYDQ3TZ.js} +5 -5
- package/node_modules/pi-lens/dist/index.js +73783 -71033
- package/node_modules/pi-lens/dist/mcp/analyze-cli.js +18 -8
- package/node_modules/pi-lens/dist/mcp/cli.js +48 -37
- package/node_modules/pi-lens/dist/mcp/server.js +568 -397
- package/node_modules/pi-lens/dist/mcp/worker.js +67 -55
- package/node_modules/pi-lens/dist/probes/installer.js +20 -19
- package/node_modules/pi-lens/docs/astplayground.md +1 -1
- package/node_modules/pi-lens/docs/configuration.md +29 -0
- package/node_modules/pi-lens/docs/dependencies.md +3 -0
- package/node_modules/pi-lens/docs/features.md +2 -2
- package/node_modules/pi-lens/docs/globalconfig.md +2 -0
- package/node_modules/pi-lens/docs/language-coverage.md +2 -1
- package/node_modules/pi-lens/docs/lsp-capability-matrix.md +29 -7
- package/node_modules/pi-lens/docs/lsp-idle-eviction.md +38 -47
- package/node_modules/pi-lens/docs/pi-lens-fixer.md +4 -0
- package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +17 -4
- package/node_modules/pi-lens/docs/pi-lens-retro.md +2 -1
- package/node_modules/pi-lens/docs/pi-lens-reviewer.md +18 -0
- package/node_modules/pi-lens/docs/pi-lens-subagent.md +7 -0
- package/node_modules/pi-lens/docs/real-harness.md +17 -0
- package/node_modules/pi-lens/docs/schema/pi-lens-config-v1.json +37 -2
- package/node_modules/pi-lens/docs/servercapabilities.md +15 -4
- package/node_modules/pi-lens/docs/settings.md +2 -1
- package/node_modules/pi-lens/package.json +1 -1
- package/node_modules/pi-provider-qoder/dist/index.js +30 -2
- package/node_modules/pi-provider-qoder/package.json +1 -1
- package/node_modules/pi-web-access/CHANGELOG.md +50 -0
- package/node_modules/pi-web-access/README.md +13 -7
- package/node_modules/pi-web-access/brave.ts +20 -2
- package/node_modules/pi-web-access/content-find.ts +2 -1
- package/node_modules/pi-web-access/dist/index.js +655 -406
- package/node_modules/pi-web-access/dist/mcp-cli.js +653 -416
- package/node_modules/pi-web-access/duckduckgo.ts +5 -1
- package/node_modules/pi-web-access/endpoint-pdf-extract.ts +225 -0
- package/node_modules/pi-web-access/extract.ts +51 -13
- package/node_modules/pi-web-access/fetch-params.ts +10 -0
- package/node_modules/pi-web-access/gemini-api.ts +15 -0
- package/node_modules/pi-web-access/gemini-search.ts +32 -152
- package/node_modules/pi-web-access/github-issue-pr.ts +80 -68
- package/node_modules/pi-web-access/index.ts +3 -0
- package/node_modules/pi-web-access/package.json +1 -1
- package/node_modules/pi-web-access/pdf-extract.ts +38 -4
- package/node_modules/pi-web-access/perplexity.ts +19 -2
- package/node_modules/pi-web-access/ssrf-protection.ts +24 -4
- package/node_modules/pi-web-access/summary-review.ts +10 -0
- package/node_modules/pi-web-access/tool-arguments.ts +5 -2
- package/node_modules/pi-web-access/video-extract.ts +6 -2
- package/node_modules/pi-web-access/web-tool-core.ts +53 -13
- package/package.json +19 -24
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/show-more-hint.ts +0 -48
- package/node_modules/pi-jev-auto-mode/CHANGELOG.md +0 -118
- package/node_modules/pi-jev-auto-mode/LICENSE +0 -21
- package/node_modules/pi-jev-auto-mode/README.md +0 -292
- package/node_modules/pi-jev-auto-mode/SECURITY.md +0 -32
- package/node_modules/pi-jev-auto-mode/docs/calibration.md +0 -154
- package/node_modules/pi-jev-auto-mode/docs/design.md +0 -164
- package/node_modules/pi-jev-auto-mode/docs/security.md +0 -124
- package/node_modules/pi-jev-auto-mode/index.ts +0 -1
- package/node_modules/pi-jev-auto-mode/package.json +0 -72
- package/node_modules/pi-jev-auto-mode/src/call.ts +0 -180
- package/node_modules/pi-jev-auto-mode/src/decide.ts +0 -86
- package/node_modules/pi-jev-auto-mode/src/extension.ts +0 -881
- package/node_modules/pi-jev-auto-mode/src/intent.ts +0 -71
- package/node_modules/pi-jev-auto-mode/src/jev/availability.ts +0 -53
- package/node_modules/pi-jev-auto-mode/src/jev/criteria.ts +0 -19
- package/node_modules/pi-jev-auto-mode/src/jev/decide.ts +0 -187
- package/node_modules/pi-jev-auto-mode/src/jev/engine.ts +0 -165
- package/node_modules/pi-jev-auto-mode/src/jev/index.ts +0 -20
- package/node_modules/pi-jev-auto-mode/src/jev/questions.ts +0 -273
- package/node_modules/pi-jev-auto-mode/src/jev/response.ts +0 -64
- package/node_modules/pi-jev-auto-mode/src/jev/state.ts +0 -20
- package/node_modules/pi-jev-auto-mode/src/jev/transport.ts +0 -117
- package/node_modules/pi-jev-auto-mode/src/jev/types.ts +0 -46
- package/node_modules/pi-jev-auto-mode/src/policy.ts +0 -558
- package/node_modules/pi-jev-auto-mode/src/records.ts +0 -184
- package/node_modules/pi-jev-auto-mode/src/settings.ts +0 -349
- package/node_modules/pi-jev-auto-mode/src/ui.ts +0 -243
- package/node_modules/pi-lens/dist/chunk-2FQ62SPM.js +0 -83
- package/node_modules/pi-lens/dist/chunk-7AXO3ZDF.js +0 -30
- package/node_modules/pi-lens/dist/chunk-KMGPUKFD.js +0 -25
- package/node_modules/pi-lens/dist/chunk-OZJINN4O.js +0 -84
- package/node_modules/pi-lens/dist/chunk-RJFED73B.js +0 -79
- package/node_modules/pi-lens/dist/chunk-RTQNRM5X.js +0 -27
- package/node_modules/pi-lens/dist/chunk-VGEVL5EQ.js +0 -29
- package/node_modules/pi-lens/dist/chunk-WPE5FPGR.js +0 -54
- package/node_modules/pi-lens/dist/chunk-Z7QQA2KT.js +0 -27
- package/node_modules/resume-from/LICENSE +0 -21
- package/node_modules/resume-from/README.md +0 -167
- package/node_modules/resume-from/dist/adapters/claude-code/adapter.d.ts +0 -20
- package/node_modules/resume-from/dist/adapters/claude-code/adapter.js +0 -59
- package/node_modules/resume-from/dist/adapters/claude-code/contract.d.ts +0 -8
- package/node_modules/resume-from/dist/adapters/claude-code/contract.js +0 -4
- package/node_modules/resume-from/dist/adapters/claude-code/entries.d.ts +0 -30
- package/node_modules/resume-from/dist/adapters/claude-code/entries.js +0 -107
- package/node_modules/resume-from/dist/adapters/claude-code/index.d.ts +0 -3
- package/node_modules/resume-from/dist/adapters/claude-code/index.js +0 -2
- package/node_modules/resume-from/dist/adapters/claude-code/layout.d.ts +0 -29
- package/node_modules/resume-from/dist/adapters/claude-code/layout.js +0 -80
- package/node_modules/resume-from/dist/adapters/claude-code/readback.d.ts +0 -9
- package/node_modules/resume-from/dist/adapters/claude-code/readback.js +0 -39
- package/node_modules/resume-from/dist/adapters/claude-code/reader.d.ts +0 -40
- package/node_modules/resume-from/dist/adapters/claude-code/reader.js +0 -436
- package/node_modules/resume-from/dist/adapters/claude-code/redaction.d.ts +0 -26
- package/node_modules/resume-from/dist/adapters/claude-code/redaction.js +0 -145
- package/node_modules/resume-from/dist/adapters/claude-code/validation.d.ts +0 -4
- package/node_modules/resume-from/dist/adapters/claude-code/validation.js +0 -39
- package/node_modules/resume-from/dist/adapters/claude-code/writer.d.ts +0 -21
- package/node_modules/resume-from/dist/adapters/claude-code/writer.js +0 -306
- package/node_modules/resume-from/dist/adapters/codex/contract.d.ts +0 -13
- package/node_modules/resume-from/dist/adapters/codex/contract.js +0 -4
- package/node_modules/resume-from/dist/adapters/codex/index.d.ts +0 -6
- package/node_modules/resume-from/dist/adapters/codex/index.js +0 -43
- package/node_modules/resume-from/dist/adapters/codex/read.d.ts +0 -44
- package/node_modules/resume-from/dist/adapters/codex/read.js +0 -723
- package/node_modules/resume-from/dist/adapters/codex/readback.d.ts +0 -9
- package/node_modules/resume-from/dist/adapters/codex/readback.js +0 -47
- package/node_modules/resume-from/dist/adapters/codex/redaction.d.ts +0 -26
- package/node_modules/resume-from/dist/adapters/codex/redaction.js +0 -145
- package/node_modules/resume-from/dist/adapters/codex/rollout.d.ts +0 -115
- package/node_modules/resume-from/dist/adapters/codex/rollout.js +0 -269
- package/node_modules/resume-from/dist/adapters/codex/validation.d.ts +0 -7
- package/node_modules/resume-from/dist/adapters/codex/validation.js +0 -78
- package/node_modules/resume-from/dist/adapters/codex/write.d.ts +0 -17
- package/node_modules/resume-from/dist/adapters/codex/write.js +0 -141
- package/node_modules/resume-from/dist/adapters/contract.d.ts +0 -78
- package/node_modules/resume-from/dist/adapters/contract.js +0 -4
- package/node_modules/resume-from/dist/adapters/pi/adapter.d.ts +0 -15
- package/node_modules/resume-from/dist/adapters/pi/adapter.js +0 -213
- package/node_modules/resume-from/dist/adapters/pi/contract.d.ts +0 -24
- package/node_modules/resume-from/dist/adapters/pi/contract.js +0 -4
- package/node_modules/resume-from/dist/adapters/pi/format.d.ts +0 -162
- package/node_modules/resume-from/dist/adapters/pi/format.js +0 -223
- package/node_modules/resume-from/dist/adapters/pi/index.d.ts +0 -7
- package/node_modules/resume-from/dist/adapters/pi/index.js +0 -10
- package/node_modules/resume-from/dist/adapters/pi/parse.d.ts +0 -41
- package/node_modules/resume-from/dist/adapters/pi/parse.js +0 -371
- package/node_modules/resume-from/dist/adapters/pi/redaction.d.ts +0 -26
- package/node_modules/resume-from/dist/adapters/pi/redaction.js +0 -145
- package/node_modules/resume-from/dist/adapters/pi/serialize.d.ts +0 -20
- package/node_modules/resume-from/dist/adapters/pi/serialize.js +0 -87
- package/node_modules/resume-from/dist/adapters/pi/validate.d.ts +0 -14
- package/node_modules/resume-from/dist/adapters/pi/validate.js +0 -134
- package/node_modules/resume-from/dist/bin.d.ts +0 -35
- package/node_modules/resume-from/dist/bin.js +0 -135
- package/node_modules/resume-from/dist/contract.d.ts +0 -10
- package/node_modules/resume-from/dist/contract.js +0 -4
- package/node_modules/resume-from/dist/host/agents.d.ts +0 -29
- package/node_modules/resume-from/dist/host/agents.js +0 -20
- package/node_modules/resume-from/dist/host/cli/args.d.ts +0 -21
- package/node_modules/resume-from/dist/host/cli/args.js +0 -187
- package/node_modules/resume-from/dist/host/cli/contract.d.ts +0 -27
- package/node_modules/resume-from/dist/host/cli/contract.js +0 -4
- package/node_modules/resume-from/dist/host/cli/index.d.ts +0 -2
- package/node_modules/resume-from/dist/host/cli/index.js +0 -1
- package/node_modules/resume-from/dist/host/cli/presentation.d.ts +0 -2
- package/node_modules/resume-from/dist/host/cli/presentation.js +0 -11
- package/node_modules/resume-from/dist/host/cli/render.d.ts +0 -3
- package/node_modules/resume-from/dist/host/cli/render.js +0 -70
- package/node_modules/resume-from/dist/host/cli/runner.d.ts +0 -8
- package/node_modules/resume-from/dist/host/cli/runner.js +0 -125
- package/node_modules/resume-from/dist/host/contract.d.ts +0 -42
- package/node_modules/resume-from/dist/host/contract.js +0 -4
- package/node_modules/resume-from/dist/host/entry.d.ts +0 -52
- package/node_modules/resume-from/dist/host/entry.js +0 -91
- package/node_modules/resume-from/dist/host/index.d.ts +0 -11
- package/node_modules/resume-from/dist/host/index.js +0 -10
- package/node_modules/resume-from/dist/host/pi-extension/command.d.ts +0 -18
- package/node_modules/resume-from/dist/host/pi-extension/command.js +0 -126
- package/node_modules/resume-from/dist/host/pi-extension/contract.d.ts +0 -34
- package/node_modules/resume-from/dist/host/pi-extension/contract.js +0 -4
- package/node_modules/resume-from/dist/host/pi-extension/index.d.ts +0 -6
- package/node_modules/resume-from/dist/host/pi-extension/index.js +0 -4
- package/node_modules/resume-from/dist/host/pi-extension/picker.d.ts +0 -16
- package/node_modules/resume-from/dist/host/pi-extension/picker.js +0 -35
- package/node_modules/resume-from/dist/host/pi-extension/presentation.d.ts +0 -2
- package/node_modules/resume-from/dist/host/pi-extension/presentation.js +0 -11
- package/node_modules/resume-from/dist/host/pi-extension/register.d.ts +0 -25
- package/node_modules/resume-from/dist/host/pi-extension/register.js +0 -11
- package/node_modules/resume-from/dist/host/pi-extension/ui.d.ts +0 -20
- package/node_modules/resume-from/dist/host/pi-extension/ui.js +0 -1
- package/node_modules/resume-from/dist/host/profile.d.ts +0 -8
- package/node_modules/resume-from/dist/host/profile.js +0 -31
- package/node_modules/resume-from/dist/host/registry.d.ts +0 -8
- package/node_modules/resume-from/dist/host/registry.js +0 -33
- package/node_modules/resume-from/dist/host/wiring.d.ts +0 -41
- package/node_modules/resume-from/dist/host/wiring.js +0 -66
- package/node_modules/resume-from/dist/import/confirmation.d.ts +0 -9
- package/node_modules/resume-from/dist/import/confirmation.js +0 -27
- package/node_modules/resume-from/dist/import/contract.d.ts +0 -43
- package/node_modules/resume-from/dist/import/contract.js +0 -4
- package/node_modules/resume-from/dist/import/discovery/contract.d.ts +0 -63
- package/node_modules/resume-from/dist/import/discovery/contract.js +0 -4
- package/node_modules/resume-from/dist/import/discovery/errors.d.ts +0 -9
- package/node_modules/resume-from/dist/import/discovery/errors.js +0 -12
- package/node_modules/resume-from/dist/import/discovery/finder.d.ts +0 -11
- package/node_modules/resume-from/dist/import/discovery/finder.js +0 -269
- package/node_modules/resume-from/dist/import/discovery/homes.d.ts +0 -23
- package/node_modules/resume-from/dist/import/discovery/homes.js +0 -83
- package/node_modules/resume-from/dist/import/discovery/index.d.ts +0 -2
- package/node_modules/resume-from/dist/import/discovery/index.js +0 -2
- package/node_modules/resume-from/dist/import/discovery/ordering.d.ts +0 -3
- package/node_modules/resume-from/dist/import/discovery/ordering.js +0 -21
- package/node_modules/resume-from/dist/import/errors.d.ts +0 -22
- package/node_modules/resume-from/dist/import/errors.js +0 -20
- package/node_modules/resume-from/dist/import/index.d.ts +0 -3
- package/node_modules/resume-from/dist/import/index.js +0 -5
- package/node_modules/resume-from/dist/import/landing/contract.d.ts +0 -44
- package/node_modules/resume-from/dist/import/landing/contract.js +0 -4
- package/node_modules/resume-from/dist/import/landing/errors.d.ts +0 -15
- package/node_modules/resume-from/dist/import/landing/errors.js +0 -15
- package/node_modules/resume-from/dist/import/landing/handover.d.ts +0 -5
- package/node_modules/resume-from/dist/import/landing/handover.js +0 -12
- package/node_modules/resume-from/dist/import/landing/index.d.ts +0 -4
- package/node_modules/resume-from/dist/import/landing/index.js +0 -4
- package/node_modules/resume-from/dist/import/landing/lander.d.ts +0 -7
- package/node_modules/resume-from/dist/import/landing/lander.js +0 -133
- package/node_modules/resume-from/dist/import/landing/marker.d.ts +0 -9
- package/node_modules/resume-from/dist/import/landing/marker.js +0 -46
- package/node_modules/resume-from/dist/import/pipeline.d.ts +0 -28
- package/node_modules/resume-from/dist/import/pipeline.js +0 -154
- package/node_modules/resume-from/dist/import/preview/builder.d.ts +0 -6
- package/node_modules/resume-from/dist/import/preview/builder.js +0 -80
- package/node_modules/resume-from/dist/import/preview/contract.d.ts +0 -39
- package/node_modules/resume-from/dist/import/preview/contract.js +0 -4
- package/node_modules/resume-from/dist/import/preview/format.d.ts +0 -19
- package/node_modules/resume-from/dist/import/preview/format.js +0 -45
- package/node_modules/resume-from/dist/import/preview/index.d.ts +0 -2
- package/node_modules/resume-from/dist/import/preview/index.js +0 -1
- package/node_modules/resume-from/dist/import/preview/warnings.d.ts +0 -14
- package/node_modules/resume-from/dist/import/preview/warnings.js +0 -86
- package/node_modules/resume-from/dist/import/transfer/contract.d.ts +0 -48
- package/node_modules/resume-from/dist/import/transfer/contract.js +0 -4
- package/node_modules/resume-from/dist/import/transfer/index.d.ts +0 -2
- package/node_modules/resume-from/dist/import/transfer/index.js +0 -1
- package/node_modules/resume-from/dist/import/transfer/rules.d.ts +0 -3
- package/node_modules/resume-from/dist/import/transfer/rules.js +0 -228
- package/node_modules/resume-from/dist/import/wiring.d.ts +0 -24
- package/node_modules/resume-from/dist/import/wiring.js +0 -37
- package/node_modules/resume-from/dist/index.d.ts +0 -36
- package/node_modules/resume-from/dist/index.js +0 -36
- package/node_modules/resume-from/dist/platform/config/contract.d.ts +0 -35
- package/node_modules/resume-from/dist/platform/config/contract.js +0 -4
- package/node_modules/resume-from/dist/platform/config/defaults.d.ts +0 -16
- package/node_modules/resume-from/dist/platform/config/defaults.js +0 -22
- package/node_modules/resume-from/dist/platform/config/errors.d.ts +0 -9
- package/node_modules/resume-from/dist/platform/config/errors.js +0 -12
- package/node_modules/resume-from/dist/platform/config/index.d.ts +0 -5
- package/node_modules/resume-from/dist/platform/config/index.js +0 -6
- package/node_modules/resume-from/dist/platform/config/loader.d.ts +0 -10
- package/node_modules/resume-from/dist/platform/config/loader.js +0 -47
- package/node_modules/resume-from/dist/platform/config/paths.d.ts +0 -13
- package/node_modules/resume-from/dist/platform/config/paths.js +0 -37
- package/node_modules/resume-from/dist/platform/config/validate.d.ts +0 -9
- package/node_modules/resume-from/dist/platform/config/validate.js +0 -117
- package/node_modules/resume-from/dist/platform/repo/contract.d.ts +0 -36
- package/node_modules/resume-from/dist/platform/repo/contract.js +0 -4
- package/node_modules/resume-from/dist/platform/repo/git.d.ts +0 -21
- package/node_modules/resume-from/dist/platform/repo/git.js +0 -77
- package/node_modules/resume-from/dist/platform/repo/index.d.ts +0 -2
- package/node_modules/resume-from/dist/platform/repo/index.js +0 -1
- package/node_modules/resume-from/dist/platform/repo/reader.d.ts +0 -3
- package/node_modules/resume-from/dist/platform/repo/reader.js +0 -170
- package/node_modules/resume-from/dist/platform/store/contract.d.ts +0 -31
- package/node_modules/resume-from/dist/platform/store/contract.js +0 -4
- package/node_modules/resume-from/dist/platform/store/file-committer.d.ts +0 -3
- package/node_modules/resume-from/dist/platform/store/file-committer.js +0 -391
- package/node_modules/resume-from/dist/platform/store/index.d.ts +0 -2
- package/node_modules/resume-from/dist/platform/store/index.js +0 -2
- package/node_modules/resume-from/dist/platform/tokens/contract.d.ts +0 -12
- package/node_modules/resume-from/dist/platform/tokens/contract.js +0 -4
- package/node_modules/resume-from/dist/platform/tokens/estimator.d.ts +0 -12
- package/node_modules/resume-from/dist/platform/tokens/estimator.js +0 -111
- package/node_modules/resume-from/dist/platform/tokens/index.d.ts +0 -2
- package/node_modules/resume-from/dist/platform/tokens/index.js +0 -1
- package/node_modules/resume-from/dist/session/contract.d.ts +0 -116
- package/node_modules/resume-from/dist/session/contract.js +0 -4
- package/node_modules/resume-from/package.json +0 -83
- package/node_modules/resume-from/shims/pi/extensions/resume-from.js +0 -118
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { dirname } from "node:path";
|
|
3
|
-
import { defaultConfig } from "./defaults.js";
|
|
4
|
-
import { ConfigLoadError } from "./errors.js";
|
|
5
|
-
import { defaultConfigPath } from "./paths.js";
|
|
6
|
-
import { buildConfig } from "./validate.js";
|
|
7
|
-
/**
|
|
8
|
-
* A loader that reads one JSON file and fills every missing setting with its default.
|
|
9
|
-
* It never writes: a missing file is a missing file, not something to create (T-CFG-13).
|
|
10
|
-
*/
|
|
11
|
-
export function createConfigLoader(options = {}) {
|
|
12
|
-
const configPath = options.configPath ?? defaultConfigPath();
|
|
13
|
-
return {
|
|
14
|
-
async load() {
|
|
15
|
-
const text = await readConfigFile(configPath);
|
|
16
|
-
// No file, or a file the user emptied: both mean "nothing set", not "nothing works".
|
|
17
|
-
if (text === undefined || text.trim() === "")
|
|
18
|
-
return defaultConfig();
|
|
19
|
-
let parsed;
|
|
20
|
-
try {
|
|
21
|
-
parsed = JSON.parse(text);
|
|
22
|
-
}
|
|
23
|
-
catch (cause) {
|
|
24
|
-
// Not a fallback to defaults: a file the user wrote and the tool ignored is worse
|
|
25
|
-
// than an error.
|
|
26
|
-
throw new ConfigLoadError(configPath, `${configPath} is not valid JSON: ${reason(cause)}. Fix the syntax, or delete the ` +
|
|
27
|
-
"file to use the defaults.");
|
|
28
|
-
}
|
|
29
|
-
return buildConfig(parsed, dirname(configPath), configPath);
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
/** The file's text, or undefined when there is no file to read. */
|
|
34
|
-
async function readConfigFile(configPath) {
|
|
35
|
-
try {
|
|
36
|
-
return await readFile(configPath, "utf8");
|
|
37
|
-
}
|
|
38
|
-
catch (cause) {
|
|
39
|
-
const code = cause.code;
|
|
40
|
-
if (code === "ENOENT")
|
|
41
|
-
return undefined;
|
|
42
|
-
throw new ConfigLoadError(configPath, `${configPath} cannot be read: ${reason(cause)}. Check the path and its permissions.`);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function reason(cause) {
|
|
46
|
-
return cause instanceof Error ? cause.message : String(cause);
|
|
47
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { HomePath } from "./contract.js";
|
|
2
|
-
/** Where the configuration lives when the caller names no other file. */
|
|
3
|
-
export declare function defaultConfigPath(): string;
|
|
4
|
-
/**
|
|
5
|
-
* Turns a home as written into an absolute, symlink-free path: a leading `~` becomes the
|
|
6
|
-
* user's home, a relative path is resolved against the configuration file's own directory
|
|
7
|
-
* (an invocation's working directory would make the same file mean different things), and
|
|
8
|
-
* symlinks are followed so `src/import/discovery/` deduplicates locations, not spellings.
|
|
9
|
-
*
|
|
10
|
-
* A home that does not exist keeps its resolved spelling. Existence is not checked here —
|
|
11
|
-
* a home may be created between the load and the search.
|
|
12
|
-
*/
|
|
13
|
-
export declare function resolveHomePath(raw: string, baseDir: string): Promise<HomePath>;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { realpath } from "node:fs/promises";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
|
-
import { isAbsolute, resolve } from "node:path";
|
|
4
|
-
const CONFIG_DIR = ".config";
|
|
5
|
-
const APP_DIR = "resume-from";
|
|
6
|
-
const CONFIG_FILE = "config.json";
|
|
7
|
-
/** Where the configuration lives when the caller names no other file. */
|
|
8
|
-
export function defaultConfigPath() {
|
|
9
|
-
return resolve(homedir(), CONFIG_DIR, APP_DIR, CONFIG_FILE);
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Turns a home as written into an absolute, symlink-free path: a leading `~` becomes the
|
|
13
|
-
* user's home, a relative path is resolved against the configuration file's own directory
|
|
14
|
-
* (an invocation's working directory would make the same file mean different things), and
|
|
15
|
-
* symlinks are followed so `src/import/discovery/` deduplicates locations, not spellings.
|
|
16
|
-
*
|
|
17
|
-
* A home that does not exist keeps its resolved spelling. Existence is not checked here —
|
|
18
|
-
* a home may be created between the load and the search.
|
|
19
|
-
*/
|
|
20
|
-
export async function resolveHomePath(raw, baseDir) {
|
|
21
|
-
const expanded = expandTilde(raw);
|
|
22
|
-
const absolute = isAbsolute(expanded) ? resolve(expanded) : resolve(baseDir, expanded);
|
|
23
|
-
try {
|
|
24
|
-
return await realpath(absolute);
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
return absolute;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function expandTilde(raw) {
|
|
31
|
-
if (raw === "~")
|
|
32
|
-
return homedir();
|
|
33
|
-
// Only "~/": "~other" is another user's home to a shell, and a plain segment here.
|
|
34
|
-
if (raw.startsWith("~/"))
|
|
35
|
-
return resolve(homedir(), raw.slice(2));
|
|
36
|
-
return raw;
|
|
37
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ImportConfig } from "./contract.js";
|
|
2
|
-
/**
|
|
3
|
-
* Completes and checks one parsed configuration file. Absent settings keep their default;
|
|
4
|
-
* a present but unusable one rejects with the field named (FR-56).
|
|
5
|
-
*
|
|
6
|
-
* @param baseDir directory a relative home is resolved against — the file's own directory.
|
|
7
|
-
* @param source the file's path, used as the field of a whole-file complaint.
|
|
8
|
-
*/
|
|
9
|
-
export declare function buildConfig(raw: unknown, baseDir: string, source: string): Promise<ImportConfig>;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { defaultConfig } from "./defaults.js";
|
|
2
|
-
import { ConfigLoadError } from "./errors.js";
|
|
3
|
-
import { resolveHomePath } from "./paths.js";
|
|
4
|
-
// Exhaustive by construction: adding an agent (FR-57) fails to compile here until it is listed,
|
|
5
|
-
// instead of silently rejecting the new value at run time.
|
|
6
|
-
const AGENTS = { pi: true, codex: true, "claude-code": true };
|
|
7
|
-
const SETTINGS = {
|
|
8
|
-
extraHomes: true,
|
|
9
|
-
budgetShare: true,
|
|
10
|
-
pinnedRecentTurns: true,
|
|
11
|
-
windowOverrides: true,
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Completes and checks one parsed configuration file. Absent settings keep their default;
|
|
15
|
-
* a present but unusable one rejects with the field named (FR-56).
|
|
16
|
-
*
|
|
17
|
-
* @param baseDir directory a relative home is resolved against — the file's own directory.
|
|
18
|
-
* @param source the file's path, used as the field of a whole-file complaint.
|
|
19
|
-
*/
|
|
20
|
-
export async function buildConfig(raw, baseDir, source) {
|
|
21
|
-
const settings = asRecord(raw, source, `${source} must hold a JSON object of settings, such as { "budgetShare": 0.5 }.`);
|
|
22
|
-
for (const key of Object.keys(settings)) {
|
|
23
|
-
if (!Object.hasOwn(SETTINGS, key)) {
|
|
24
|
-
throw new ConfigLoadError(key, `${key} is not a setting. The settings are ${Object.keys(SETTINGS).join(", ")}. ` +
|
|
25
|
-
"Correct the spelling or remove the line.");
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const config = defaultConfig();
|
|
29
|
-
if (settings.budgetShare !== undefined) {
|
|
30
|
-
config.budgetShare = asShare("budgetShare", settings.budgetShare);
|
|
31
|
-
}
|
|
32
|
-
if (settings.pinnedRecentTurns !== undefined) {
|
|
33
|
-
config.pinnedRecentTurns = asTurnCount("pinnedRecentTurns", settings.pinnedRecentTurns);
|
|
34
|
-
}
|
|
35
|
-
if (settings.extraHomes !== undefined) {
|
|
36
|
-
config.extraHomes = await asHomeEntries(settings.extraHomes, baseDir);
|
|
37
|
-
}
|
|
38
|
-
if (settings.windowOverrides !== undefined) {
|
|
39
|
-
config.windowOverrides = asWindowOverrides(settings.windowOverrides);
|
|
40
|
-
}
|
|
41
|
-
return config;
|
|
42
|
-
}
|
|
43
|
-
function asShare(field, value) {
|
|
44
|
-
// 0 is refused: it would make FR-33 block every import, which is a mistake, not a choice.
|
|
45
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0 || value > 1) {
|
|
46
|
-
throw new ConfigLoadError(field, `${field} must be a number greater than 0 and at most 1, for example 0.5. Found ${show(value)}.`);
|
|
47
|
-
}
|
|
48
|
-
return value;
|
|
49
|
-
}
|
|
50
|
-
function asTurnCount(field, value) {
|
|
51
|
-
if (typeof value !== "number" || !Number.isInteger(value) || value < 0) {
|
|
52
|
-
throw new ConfigLoadError(field, `${field} must be a whole number of turns, zero or more, for example 8. Found ${show(value)}.`);
|
|
53
|
-
}
|
|
54
|
-
return value;
|
|
55
|
-
}
|
|
56
|
-
async function asHomeEntries(value, baseDir) {
|
|
57
|
-
const items = asArray(value, "extraHomes");
|
|
58
|
-
const entries = [];
|
|
59
|
-
for (const [index, item] of items.entries()) {
|
|
60
|
-
const field = `extraHomes[${index}]`;
|
|
61
|
-
const entry = asRecord(item, field, `${field} must be an object with an agent and a home, such as ` +
|
|
62
|
-
'{ "agent": "pi", "home": "~/.pi-work" }.');
|
|
63
|
-
entries.push({
|
|
64
|
-
agent: asAgentId(`${field}.agent`, entry.agent),
|
|
65
|
-
home: await resolveHomePath(asPath(`${field}.home`, entry.home), baseDir),
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
// Duplicates are kept: deduplication belongs to the search, which alone sees the
|
|
69
|
-
// adapter defaults an extra home may repeat.
|
|
70
|
-
return entries;
|
|
71
|
-
}
|
|
72
|
-
function asWindowOverrides(value) {
|
|
73
|
-
const items = asArray(value, "windowOverrides");
|
|
74
|
-
return items.map((item, index) => {
|
|
75
|
-
const field = `windowOverrides[${index}]`;
|
|
76
|
-
const entry = asRecord(item, field, `${field} must be an object with an agent and a windowTokens count, such as ` +
|
|
77
|
-
'{ "agent": "claude-code", "windowTokens": 200000 }.');
|
|
78
|
-
return {
|
|
79
|
-
agent: asAgentId(`${field}.agent`, entry.agent),
|
|
80
|
-
windowTokens: asWindowTokens(`${field}.windowTokens`, entry.windowTokens),
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
function asWindowTokens(field, value) {
|
|
85
|
-
if (typeof value !== "number" || !Number.isInteger(value) || value <= 0) {
|
|
86
|
-
throw new ConfigLoadError(field, `${field} must be a whole number of tokens greater than zero, for example 200000. ` +
|
|
87
|
-
`Found ${show(value)}.`);
|
|
88
|
-
}
|
|
89
|
-
return value;
|
|
90
|
-
}
|
|
91
|
-
function asAgentId(field, value) {
|
|
92
|
-
if (typeof value !== "string" || !Object.hasOwn(AGENTS, value)) {
|
|
93
|
-
throw new ConfigLoadError(field, `${field} must name a known agent: ${Object.keys(AGENTS).join(", ")}. Found ${show(value)}.`);
|
|
94
|
-
}
|
|
95
|
-
return value;
|
|
96
|
-
}
|
|
97
|
-
function asPath(field, value) {
|
|
98
|
-
if (typeof value !== "string" || value.trim() === "") {
|
|
99
|
-
throw new ConfigLoadError(field, `${field} must be a path to an agent profile directory. Found ${show(value)}.`);
|
|
100
|
-
}
|
|
101
|
-
return value;
|
|
102
|
-
}
|
|
103
|
-
function asArray(value, field) {
|
|
104
|
-
if (!Array.isArray(value)) {
|
|
105
|
-
throw new ConfigLoadError(field, `${field} must be a list. Found ${show(value)}.`);
|
|
106
|
-
}
|
|
107
|
-
return value;
|
|
108
|
-
}
|
|
109
|
-
function asRecord(value, field, message) {
|
|
110
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
111
|
-
throw new ConfigLoadError(field, message);
|
|
112
|
-
}
|
|
113
|
-
return value;
|
|
114
|
-
}
|
|
115
|
-
function show(value) {
|
|
116
|
-
return typeof value === "string" ? JSON.stringify(value) : String(value);
|
|
117
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/** The repository the command runs in (FR-13). */
|
|
2
|
-
export interface RepoIdentity {
|
|
3
|
-
/** Canonical checkout root, or null when unresolved or bare (not an import destination). */
|
|
4
|
-
root: string | null;
|
|
5
|
-
/** Canonical Git common directory shared by linked worktrees, or null when unresolved. */
|
|
6
|
-
commonDir: string | null;
|
|
7
|
-
/** True only for a resolved bare repository; its linked working trees report false. */
|
|
8
|
-
isBare: boolean;
|
|
9
|
-
/** Current HEAD commit, or null when unresolved or the repository has no commit yet. */
|
|
10
|
-
head: string | null;
|
|
11
|
-
branch: string | null;
|
|
12
|
-
}
|
|
13
|
-
/** How far the tree moved since the source session ran (FR-38). */
|
|
14
|
-
export interface CommitDistance {
|
|
15
|
-
/** False when the source commit is unknown, or absent from this repository. */
|
|
16
|
-
known: boolean;
|
|
17
|
-
/** Commits on HEAD that the source commit does not have. */
|
|
18
|
-
ahead: number;
|
|
19
|
-
/** Commits the source commit has that HEAD does not. */
|
|
20
|
-
behind: number;
|
|
21
|
-
}
|
|
22
|
-
/** Process controls applied to every git command issued by one reader. */
|
|
23
|
-
export interface RepoReaderOptions {
|
|
24
|
-
/** Maximum duration of one git command. Defaults to a finite module-owned limit. */
|
|
25
|
-
timeoutMs?: number | undefined;
|
|
26
|
-
/** Cancels the current command and every later command issued by this reader. */
|
|
27
|
-
signal?: AbortSignal | undefined;
|
|
28
|
-
}
|
|
29
|
-
/** Reads git state. It never writes to the repository. */
|
|
30
|
-
export interface RepoReader {
|
|
31
|
-
/** Throws AbortError with the signal reason as cause when cancelled; performs no I/O. */
|
|
32
|
-
checkCancellation(): void;
|
|
33
|
-
identify(cwd: string): Promise<RepoIdentity>;
|
|
34
|
-
/** Compares HEAD with a commit of a source session (FR-37). */
|
|
35
|
-
distanceFrom(cwd: string, sourceCommit: string): Promise<CommitDistance>;
|
|
36
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { RepoReaderOptions } from "./contract.js";
|
|
2
|
-
export interface GitResult {
|
|
3
|
-
/** True when git exited 0. A completed nonzero exit leaves the requested fact unresolved. */
|
|
4
|
-
ok: boolean;
|
|
5
|
-
stdout: string;
|
|
6
|
-
stderr: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Runs a read-only git command in `cwd`.
|
|
10
|
-
*
|
|
11
|
-
* Rejects operational failures, including spawn failures, timeout and cancellation. A completed
|
|
12
|
-
* nonzero exit is reported in `ok`: callers leave the requested fact unresolved without trying
|
|
13
|
-
* to classify localized stderr (which need not mean the directory is outside Git).
|
|
14
|
-
*/
|
|
15
|
-
export declare function runGit(cwd: string, args: readonly string[], options?: RepoReaderOptions): Promise<GitResult>;
|
|
16
|
-
interface NormalizedOptions {
|
|
17
|
-
timeoutMs: number;
|
|
18
|
-
signal?: AbortSignal | undefined;
|
|
19
|
-
}
|
|
20
|
-
export declare function normalizeGitOptions(options: RepoReaderOptions): NormalizedOptions;
|
|
21
|
-
export {};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
// The only place in this module that reaches git. The binary is spawned with an argument array and
|
|
2
|
-
// never through a shell, so no revision string can ever be interpreted as a command.
|
|
3
|
-
import { execFile } from "node:child_process";
|
|
4
|
-
/** 1 MB. Every command here prints a line or two; more than this means something is wrong. */
|
|
5
|
-
const MAX_OUTPUT_BYTES = 1024 * 1024;
|
|
6
|
-
/** Long enough for local repositories while still bounding a wedged filesystem or git process. */
|
|
7
|
-
const DEFAULT_GIT_TIMEOUT_MS = 10_000;
|
|
8
|
-
/**
|
|
9
|
-
* Runs a read-only git command in `cwd`.
|
|
10
|
-
*
|
|
11
|
-
* Rejects operational failures, including spawn failures, timeout and cancellation. A completed
|
|
12
|
-
* nonzero exit is reported in `ok`: callers leave the requested fact unresolved without trying
|
|
13
|
-
* to classify localized stderr (which need not mean the directory is outside Git).
|
|
14
|
-
*/
|
|
15
|
-
export function runGit(cwd, args, options = {}) {
|
|
16
|
-
const processOptions = normalizeGitOptions(options);
|
|
17
|
-
return new Promise((resolve, reject) => {
|
|
18
|
-
const execOptions = {
|
|
19
|
-
encoding: "utf8",
|
|
20
|
-
env: gitEnv(),
|
|
21
|
-
maxBuffer: MAX_OUTPUT_BYTES,
|
|
22
|
-
timeout: processOptions.timeoutMs,
|
|
23
|
-
windowsHide: true,
|
|
24
|
-
};
|
|
25
|
-
if (processOptions.signal !== undefined)
|
|
26
|
-
execOptions.signal = processOptions.signal;
|
|
27
|
-
execFile("git", ["-C", cwd, ...args], execOptions, (error, stdout, stderr) => {
|
|
28
|
-
if (error === null) {
|
|
29
|
-
resolve({ ok: true, stdout, stderr });
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
// execFile reports an exit code as a number and a genuine failure to run as a string code
|
|
33
|
-
// (ENOENT, EACCES) or a signal.
|
|
34
|
-
const exited = typeof error.code === "number" && !error.signal;
|
|
35
|
-
if (exited) {
|
|
36
|
-
resolve({ ok: false, stdout, stderr });
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
reject(processError(cwd, processOptions, error));
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
export function normalizeGitOptions(options) {
|
|
44
|
-
const timeoutMs = options.timeoutMs ?? DEFAULT_GIT_TIMEOUT_MS;
|
|
45
|
-
if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0) {
|
|
46
|
-
throw new RangeError("git timeoutMs must be a positive, finite integer");
|
|
47
|
-
}
|
|
48
|
-
return options.signal === undefined ? { timeoutMs } : { timeoutMs, signal: options.signal };
|
|
49
|
-
}
|
|
50
|
-
function processError(cwd, options, cause) {
|
|
51
|
-
if (options.signal?.aborted === true || cause.name === "AbortError") {
|
|
52
|
-
const error = new Error(`git command aborted while reading ${cwd}`, { cause });
|
|
53
|
-
error.name = "AbortError";
|
|
54
|
-
return error;
|
|
55
|
-
}
|
|
56
|
-
if (cause.killed === true && cause.signal !== undefined) {
|
|
57
|
-
return new Error(`git command timed out after ${options.timeoutMs} ms while reading ${cwd}`, {
|
|
58
|
-
cause,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
return new Error(`git could not run while reading ${cwd}: ${cause.message}`, {
|
|
62
|
-
cause,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
function gitEnv() {
|
|
66
|
-
const env = { ...process.env };
|
|
67
|
-
// Never take the index lock: a read must not be able to leave a lock file behind or rewrite the
|
|
68
|
-
// index of a repository the user owns.
|
|
69
|
-
env.GIT_OPTIONAL_LOCKS = "0";
|
|
70
|
-
// These would override `-C` and point git at a repository other than the one being asked about,
|
|
71
|
-
// for example when the tool runs inside a git hook.
|
|
72
|
-
delete env.GIT_DIR;
|
|
73
|
-
delete env.GIT_COMMON_DIR;
|
|
74
|
-
delete env.GIT_WORK_TREE;
|
|
75
|
-
delete env.GIT_INDEX_FILE;
|
|
76
|
-
return env;
|
|
77
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createRepoReader } from "./reader.js";
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { realpath } from "node:fs/promises";
|
|
2
|
-
import { resolve } from "node:path";
|
|
3
|
-
import { normalizeGitOptions, runGit } from "./git.js";
|
|
4
|
-
/** Nothing is known: `ahead` and `behind` are 0 so a caller cannot print a fabricated distance. */
|
|
5
|
-
function unknownDistance() {
|
|
6
|
-
return { known: false, ahead: 0, behind: 0 };
|
|
7
|
-
}
|
|
8
|
-
function unresolvedIdentity() {
|
|
9
|
-
return { root: null, commonDir: null, isBare: false, head: null, branch: null };
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Longer than any revision git can resolve: a full commit is 40 characters, a tag or a ref
|
|
13
|
-
* expression a few more. A longer string is a mistake or an attack, and is not sent to git.
|
|
14
|
-
*/
|
|
15
|
-
const MAX_REVISION_LENGTH = 256;
|
|
16
|
-
/** A reader with process controls only; every lookup names its directory explicitly. */
|
|
17
|
-
export function createRepoReader(options = {}) {
|
|
18
|
-
const processOptions = normalizeGitOptions(options);
|
|
19
|
-
const git = (directory, args) => runGit(directory, args, processOptions);
|
|
20
|
-
const checkCancellation = () => {
|
|
21
|
-
if (processOptions.signal?.aborted) {
|
|
22
|
-
const error = new Error("Repository read aborted", { cause: processOptions.signal.reason });
|
|
23
|
-
error.name = "AbortError";
|
|
24
|
-
throw error;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
return {
|
|
28
|
-
checkCancellation,
|
|
29
|
-
identify: async (directory) => {
|
|
30
|
-
checkCancellation();
|
|
31
|
-
const identity = await identify(directory, git);
|
|
32
|
-
checkCancellation();
|
|
33
|
-
return identity;
|
|
34
|
-
},
|
|
35
|
-
distanceFrom: async (cwd, sourceCommit) => {
|
|
36
|
-
checkCancellation();
|
|
37
|
-
const distance = await distanceFrom(cwd, sourceCommit, git);
|
|
38
|
-
checkCancellation();
|
|
39
|
-
return distance;
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
/** Git terminates path records with LF; all preceding whitespace belongs to the path. */
|
|
44
|
-
function pathOutput(stdout) {
|
|
45
|
-
return stdout.endsWith("\n") ? stdout.slice(0, -1) : stdout;
|
|
46
|
-
}
|
|
47
|
-
async function identify(directory, git) {
|
|
48
|
-
// Resolve the input itself: a missing worktree must never inherit its parent's identity.
|
|
49
|
-
const dir = await resolveFully(resolve(directory));
|
|
50
|
-
if (dir === null)
|
|
51
|
-
return unresolvedIdentity();
|
|
52
|
-
const common = await git(dir, ["rev-parse", "--git-common-dir"]);
|
|
53
|
-
const commonPath = pathOutput(common.stdout);
|
|
54
|
-
if (!common.ok || commonPath === "")
|
|
55
|
-
return unresolvedIdentity();
|
|
56
|
-
const commonDir = await resolveFully(resolve(dir, commonPath));
|
|
57
|
-
if (commonDir === null)
|
|
58
|
-
return unresolvedIdentity();
|
|
59
|
-
const bare = await git(dir, ["rev-parse", "--is-bare-repository"]);
|
|
60
|
-
if (!bare.ok)
|
|
61
|
-
return unresolvedIdentity();
|
|
62
|
-
const isBare = bare.stdout.trim() === "true";
|
|
63
|
-
// Bare repositories have a shared identity but no checkout usable as an import destination.
|
|
64
|
-
let root = null;
|
|
65
|
-
if (!isBare) {
|
|
66
|
-
const toplevel = await git(dir, ["rev-parse", "--show-toplevel"]);
|
|
67
|
-
const checkoutPath = pathOutput(toplevel.stdout);
|
|
68
|
-
if (!toplevel.ok || checkoutPath === "")
|
|
69
|
-
return unresolvedIdentity();
|
|
70
|
-
root = await resolveFully(resolve(dir, checkoutPath));
|
|
71
|
-
if (root === null)
|
|
72
|
-
return unresolvedIdentity();
|
|
73
|
-
}
|
|
74
|
-
return {
|
|
75
|
-
root,
|
|
76
|
-
commonDir,
|
|
77
|
-
isBare,
|
|
78
|
-
head: await commitOf(dir, "HEAD", git),
|
|
79
|
-
branch: await branch(dir, git),
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
async function distanceFrom(cwd, sourceCommit, git) {
|
|
83
|
-
const revision = plausibleRevision(sourceCommit);
|
|
84
|
-
if (revision === null)
|
|
85
|
-
return unknownDistance();
|
|
86
|
-
const dir = resolve(cwd);
|
|
87
|
-
const source = await commitOf(dir, revision, git);
|
|
88
|
-
if (source === null)
|
|
89
|
-
return unknownDistance();
|
|
90
|
-
const from = await commitOf(dir, "HEAD", git);
|
|
91
|
-
if (from === null)
|
|
92
|
-
return unknownDistance();
|
|
93
|
-
// Both sides are commits git itself printed, so the range holds no caller input.
|
|
94
|
-
const counts = await git(dir, [
|
|
95
|
-
"rev-list",
|
|
96
|
-
"--left-right",
|
|
97
|
-
"--count",
|
|
98
|
-
`${from}...${source}`,
|
|
99
|
-
"--",
|
|
100
|
-
]);
|
|
101
|
-
if (!counts.ok)
|
|
102
|
-
return unknownDistance();
|
|
103
|
-
const parts = counts.stdout.trim().split(/\s+/);
|
|
104
|
-
if (parts.length !== 2)
|
|
105
|
-
return unknownDistance();
|
|
106
|
-
const ahead = Number(parts[0]);
|
|
107
|
-
const behind = Number(parts[1]);
|
|
108
|
-
if (!Number.isInteger(ahead) || !Number.isInteger(behind))
|
|
109
|
-
return unknownDistance();
|
|
110
|
-
return { known: true, ahead, behind };
|
|
111
|
-
}
|
|
112
|
-
/** The commit a revision names, or null when this repository does not have it. */
|
|
113
|
-
async function commitOf(dir, revision, git) {
|
|
114
|
-
// `--end-of-options` stops git reading the revision as an option, and `^{commit}` rejects a
|
|
115
|
-
// revision that exists but is not a commit.
|
|
116
|
-
const result = await git(dir, [
|
|
117
|
-
"rev-parse",
|
|
118
|
-
"--verify",
|
|
119
|
-
"--quiet",
|
|
120
|
-
"--end-of-options",
|
|
121
|
-
`${revision}^{commit}`,
|
|
122
|
-
]);
|
|
123
|
-
const commit = result.stdout.trim();
|
|
124
|
-
return result.ok && commit !== "" ? commit : null;
|
|
125
|
-
}
|
|
126
|
-
/** The branch HEAD is on, or null when HEAD is detached. An unborn branch still has a name. */
|
|
127
|
-
async function branch(dir, git) {
|
|
128
|
-
const result = await git(dir, ["symbolic-ref", "--quiet", "--short", "HEAD"]);
|
|
129
|
-
const name = result.stdout.trim();
|
|
130
|
-
return result.ok && name !== "" ? name : null;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* A revision worth sending to git, trimmed, or null.
|
|
134
|
-
*
|
|
135
|
-
* A string that starts with `-` would be read as an option, an empty one names nothing, and a
|
|
136
|
-
* control character or an absurd length is never a revision. Rejecting them here means the hostile
|
|
137
|
-
* cases of T-REP-11 never reach a process at all.
|
|
138
|
-
*/
|
|
139
|
-
function plausibleRevision(sourceCommit) {
|
|
140
|
-
if (typeof sourceCommit !== "string")
|
|
141
|
-
return null;
|
|
142
|
-
const revision = sourceCommit.trim();
|
|
143
|
-
if (revision === "" || revision.length > MAX_REVISION_LENGTH)
|
|
144
|
-
return null;
|
|
145
|
-
if (revision.startsWith("-"))
|
|
146
|
-
return null;
|
|
147
|
-
if (hasControlCharacter(revision))
|
|
148
|
-
return null;
|
|
149
|
-
return revision;
|
|
150
|
-
}
|
|
151
|
-
/** A NUL cannot be passed to a process at all, and no control character belongs in a revision. */
|
|
152
|
-
function hasControlCharacter(value) {
|
|
153
|
-
for (let i = 0; i < value.length; i += 1) {
|
|
154
|
-
const code = value.charCodeAt(i);
|
|
155
|
-
if (code < 0x20 || code === 0x7f)
|
|
156
|
-
return true;
|
|
157
|
-
}
|
|
158
|
-
return false;
|
|
159
|
-
}
|
|
160
|
-
/** The real path of a directory, following symlinks, so paths compare as locations. */
|
|
161
|
-
async function resolveFully(directory) {
|
|
162
|
-
try {
|
|
163
|
-
return await realpath(directory);
|
|
164
|
-
}
|
|
165
|
-
catch (error) {
|
|
166
|
-
if (error.code === "ENOENT")
|
|
167
|
-
return null;
|
|
168
|
-
throw error;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/** Raw file content. */
|
|
2
|
-
export type Bytes = Buffer;
|
|
3
|
-
/** A file to create. Its path must not already exist (FR-49). */
|
|
4
|
-
export interface PendingFile {
|
|
5
|
-
absolutePath: string;
|
|
6
|
-
bytes: Bytes;
|
|
7
|
-
}
|
|
8
|
-
/** Why a commit refused to run, or failed (FR-56). */
|
|
9
|
-
export type CommitRefusal = "path-exists" | "not-writable" | "write-failed";
|
|
10
|
-
/** A commit that succeeded and reports the paths it created (FR-52, FR-53). */
|
|
11
|
-
export interface CommitHandle {
|
|
12
|
-
createdPaths: string[];
|
|
13
|
-
}
|
|
14
|
-
/** Raised when a commit refuses to run or fails. Carries an actionable message (FR-56). */
|
|
15
|
-
export interface CommitError {
|
|
16
|
-
refusal: CommitRefusal;
|
|
17
|
-
/** The path that caused the refusal, when there is one. */
|
|
18
|
-
path: string | null;
|
|
19
|
-
/** What failed, and what the user can do next (FR-56). */
|
|
20
|
-
message: string;
|
|
21
|
-
/** Paths retained for safety or not removed by cleanup, when manual inspection may be required. */
|
|
22
|
-
remainingPaths?: string[];
|
|
23
|
-
}
|
|
24
|
-
/** Atomically adds zero or one file to a home (FR-49, FR-53). */
|
|
25
|
-
export interface FileCommitter {
|
|
26
|
-
/**
|
|
27
|
-
* Creates zero or one file. Rejects with a CommitError before filesystem access when more than one
|
|
28
|
-
* file is supplied, or before writing bytes when the destination already exists.
|
|
29
|
-
*/
|
|
30
|
-
commit(root: string, files: PendingFile[]): Promise<CommitHandle>;
|
|
31
|
-
}
|