@fbincon/claude-code-statusline 3.7.0 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -79
- package/candidate.json +434 -289
- package/node_modules/@fbincon/statusline-cli/dist/src/config/arguments.js +18 -4
- package/node_modules/@fbincon/statusline-cli/dist/src/config/arguments.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/commands.js +26 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/commands.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.js +7 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/selective-import.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/selective-import.js +40 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/selective-import.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/observations.js +5 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/observations.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js +9 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/doctor.js +20 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/doctor.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/mods.d.ts +4 -3
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/mods.js +14 -13
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/mods.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/resources.d.ts +5 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/resources.js +8 -6
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/resources.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js +14 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/management/arguments.d.ts +17 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/arguments.js +56 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/arguments.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/bootstrap.d.ts +7 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/bootstrap.js +69 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/bootstrap.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/configuration.d.ts +10 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/configuration.js +123 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/configuration.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/first-entry.d.ts +20 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/first-entry.js +170 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/first-entry.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/integration-runner.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/integration-runner.js +51 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/integration-runner.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/integration.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/integration.js +34 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/integration.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/mod-transition-runner.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/mod-transition-runner.js +16 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/mod-transition-runner.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/mod-transition.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/mod-transition.js +96 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/mod-transition.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.js +62 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/service.d.ts +18 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/service.js +319 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/service.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/store.d.ts +53 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/store.js +117 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/store.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/worker-entry.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/worker-entry.js +13 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/worker-entry.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/git.js +9 -10
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/git.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/usage-index.js +2 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/usage-index.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/context.js +4 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/context.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/providers.js +6 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/providers.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js +22 -6
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/.claude-plugin/plugin.json +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/hooks/register.ts +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/backend.ts +7 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +9 -6
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts +5 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/alignment-manager.ts +59 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/alignments.ts +77 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/appearance.ts +3 -2
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts +17 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/forms.ts +18 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/gradients.ts +29 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/group-manager.ts +5 -3
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/groups.ts +2 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/import-differences.ts +72 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/import-review.ts +49 -2
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/import-selection.ts +38 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/profile-manager.ts +14 -5
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts +9 -3
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/generated-locales.ts +552 -6
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/presentation.ts +2 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/session.ts +3 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +26 -21
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +6 -2
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/help.ts +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/.claude-plugin/plugin.json +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/resource-manifest.json +3 -3
- package/node_modules/@fbincon/statusline-core/dist/src/config/defaults.js +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/display.d.ts +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/display.js +13 -4
- package/node_modules/@fbincon/statusline-core/dist/src/config/display.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/editor-fields.js +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/editor-fields.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/formatting.js +11 -4
- package/node_modules/@fbincon/statusline-core/dist/src/config/formatting.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/import-review.d.ts +2 -4
- package/node_modules/@fbincon/statusline-core/dist/src/config/import-review.js +2 -83
- package/node_modules/@fbincon/statusline-core/dist/src/config/import-review.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/instances.js +12 -3
- package/node_modules/@fbincon/statusline-core/dist/src/config/instances.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.d.ts +15 -3
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js +2 -2
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/alignment-manager.d.ts +18 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/alignment-manager.js +112 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/alignment-manager.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/alignments.d.ts +21 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/alignments.js +117 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/alignments.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/appearance.js +3 -2
- package/node_modules/@fbincon/statusline-core/dist/src/editor/appearance.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js +8 -4
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js +16 -3
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/forms.js +24 -4
- package/node_modules/@fbincon/statusline-core/dist/src/editor/forms.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/gradients.d.ts +16 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/gradients.js +31 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/gradients.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/group-manager.d.ts +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/group-manager.js +5 -3
- package/node_modules/@fbincon/statusline-core/dist/src/editor/group-manager.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/groups.js +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/groups.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/import-differences.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/import-differences.js +86 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/import-differences.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/import-review.d.ts +8 -2
- package/node_modules/@fbincon/statusline-core/dist/src/editor/import-review.js +67 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/import-review.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/import-selection.d.ts +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/import-selection.js +42 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/import-selection.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.d.ts +4 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.js +16 -4
- package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.d.ts +546 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +552 -6
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.d.ts +27 -0
- package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.js +78 -0
- package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/management/package.d.ts +41 -0
- package/node_modules/@fbincon/statusline-core/dist/src/management/package.js +15 -0
- package/node_modules/@fbincon/statusline-core/dist/src/management/package.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/release.d.ts +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/release.js +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/alignment.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/alignment.js +97 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/alignment.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.d.ts +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/diagnose.js +2 -3
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/diagnose.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/explain.js +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/explain.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/gradients.d.ts +13 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/gradients.js +68 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/gradients.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/groups.js +5 -4
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/groups.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.d.ts +4 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js +41 -15
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.d.ts +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.js +9 -3
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js +15 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js +7 -5
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.js +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/git.d.ts +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/git.js +1 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/en.json +92 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +92 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +92 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +92 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +92 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +92 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/command.d.ts +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/command.js +1 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/command.js.map +1 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/files.d.ts +1 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/files.js +5 -5
- package/node_modules/@fbincon/statusline-platform/dist/src/files.js.map +1 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/git.d.ts +31 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/git.js +180 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/git.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/npm.d.ts +44 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/npm.js +229 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/npm.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/package-copy.d.ts +4 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/package-copy.js +49 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/package-copy.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/remove-tree.d.ts +2 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/remove-tree.js +51 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/remove-tree.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/source-process.d.ts +4 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/source-process.js +24 -2
- package/node_modules/@fbincon/statusline-platform/dist/src/source-process.js.map +1 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/capabilities.d.ts +12 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/capabilities.js +20 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/capabilities.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/session.d.ts +3 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/session.js +5 -2
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/session.js.map +1 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.d.ts +3 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.js +20 -3
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.js.map +1 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-environment.d.ts +3 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-environment.js +5 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-environment.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js +5 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/presentation.js +5 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/presentation.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js +2 -2
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js +7 -8
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/setup.d.ts +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/setup.js +6 -4
- package/node_modules/@fbincon/statusline-tui/dist/src/setup.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js +12 -5
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -1
- package/package.json +47 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { spawn } from 'node:child_process';
|
|
6
|
+
import { productIdentity, productRoot } from '@fbincon/statusline-platform/npm';
|
|
7
|
+
import { copyPackage } from '@fbincon/statusline-platform/package-copy';
|
|
8
|
+
import { removeTree } from '@fbincon/statusline-platform/remove-tree';
|
|
9
|
+
import { VERSION } from '@fbincon/statusline-core/release';
|
|
10
|
+
import { t } from '@fbincon/statusline-core/i18n/messages';
|
|
11
|
+
import { managementOptions } from './arguments.js';
|
|
12
|
+
import { expandUser, resolvedPath } from '@fbincon/statusline-platform/commands';
|
|
13
|
+
/** Resolve user paths before moving the executor's working directory. */
|
|
14
|
+
export function managementPaths(argv, environment, cwd = process.cwd()) {
|
|
15
|
+
const args = [...argv], absolute = (value) => resolvedPath(resolve(cwd, expandUser(value)));
|
|
16
|
+
for (let i = 0; i < args.length; i++) {
|
|
17
|
+
const name = args[i].split('=')[0];
|
|
18
|
+
if (!['--prefix', '--config-dir'].includes(name))
|
|
19
|
+
continue;
|
|
20
|
+
if (args[i].includes('='))
|
|
21
|
+
args[i] = name + '=' + absolute(args[i].slice(name.length + 1));
|
|
22
|
+
else {
|
|
23
|
+
args[i + 1] = absolute(args[i + 1]);
|
|
24
|
+
i++;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const selected = environment.CLAUDE_CONFIG_DIR;
|
|
28
|
+
const result = Object.fromEntries(Object.entries(environment).filter(([key]) => key.toUpperCase() !== 'CLAUDE_CONFIG_DIR'));
|
|
29
|
+
if (selected?.trim())
|
|
30
|
+
result.CLAUDE_CONFIG_DIR = absolute(selected);
|
|
31
|
+
return { args, environment: result };
|
|
32
|
+
}
|
|
33
|
+
/** Do not load the original package's native adapter before replacing it on Windows. */
|
|
34
|
+
export async function bootstrap(argv, stderr) {
|
|
35
|
+
let temporary;
|
|
36
|
+
try {
|
|
37
|
+
const flags = managementOptions(argv), request = managementPaths(argv, process.env), origin = productRoot(fileURLToPath(import.meta.url));
|
|
38
|
+
if (!origin || productIdentity(origin)?.version !== VERSION) {
|
|
39
|
+
stderr(t('package.reason_development', flags.language ?? 'en') + '\n');
|
|
40
|
+
return 2;
|
|
41
|
+
}
|
|
42
|
+
temporary = fs.realpathSync.native(fs.mkdtempSync(join(tmpdir(), 'claude-statusline-manager-')));
|
|
43
|
+
fs.chmodSync(temporary, 0o700);
|
|
44
|
+
const runner = join(temporary, 'runner');
|
|
45
|
+
copyPackage(origin, runner);
|
|
46
|
+
const entry = join(runner, 'node_modules/@fbincon/statusline-cli/dist/src/management/worker-entry.js');
|
|
47
|
+
return await new Promise((resolve, reject) => {
|
|
48
|
+
const child = spawn(process.execPath, [entry, origin, JSON.stringify(request.args)], { stdio: ['inherit', 'inherit', 'inherit', 'ipc'], shell: false, cwd: temporary, env: request.environment });
|
|
49
|
+
const stop = () => {
|
|
50
|
+
if (child.connected)
|
|
51
|
+
child.send({ type: 'cancel' }, () => { });
|
|
52
|
+
};
|
|
53
|
+
process.on('SIGINT', stop);
|
|
54
|
+
process.on('SIGTERM', stop);
|
|
55
|
+
const cleanup = () => { process.off('SIGINT', stop); process.off('SIGTERM', stop); };
|
|
56
|
+
child.once('error', error => { cleanup(); reject(error); });
|
|
57
|
+
child.once('exit', (code, signal) => { cleanup(); resolve(code ?? (signal ? 130 : 2)); });
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
stderr((error instanceof Error ? error.message : 'Package runner failed') + '\n');
|
|
62
|
+
return 2;
|
|
63
|
+
}
|
|
64
|
+
finally {
|
|
65
|
+
if (temporary)
|
|
66
|
+
removeTree(temporary);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../src/management/bootstrap.ts"],"names":[],"mappings":"A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B,MAAM,OAAO,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACrF,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5D,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9F,CAAC,CAAC,CAAC;IACP,CAAC;IACD,OAAO,KAAK,EAAE,CAAC;QACX,MAAM,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,uBAAuB,CAAC,GAAG,IAAI,CAAC,CAAC;QAClF,OAAO,CAAC,CAAC;IACb,CAAC;YACO,CAAC;QACL,IAAI,SAAS;YACT,UAAU,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type PackageCompatibility } from '@fbincon/statusline-core/management/compatibility';
|
|
2
|
+
export declare const CONFIG_FILES: string[];
|
|
3
|
+
export type ConfigBytes = Record<string, Buffer | null>;
|
|
4
|
+
export type ConfigHashes = Record<string, string | null>;
|
|
5
|
+
export declare function configurationBytes(directory: string): ConfigBytes;
|
|
6
|
+
export declare const configurationHashes: (bytes: ConfigBytes) => ConfigHashes;
|
|
7
|
+
export declare function assertConfiguration(directory: string, expected: ConfigHashes): void;
|
|
8
|
+
export declare function configurationCompatibility(bytes: ConfigBytes, target: PackageCompatibility): string[];
|
|
9
|
+
export declare function saveSnapshot(directory: string, transaction: string, bytes: ConfigBytes): ConfigHashes;
|
|
10
|
+
export declare function readSnapshot(directory: string, transaction: string, hashes: ConfigHashes): ConfigBytes;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { CONFIG_FORMATS } from '@fbincon/statusline-core/management/compatibility';
|
|
4
|
+
import { PackageError } from '@fbincon/statusline-core/management/package';
|
|
5
|
+
import { readJson } from '@fbincon/statusline-core/json-read';
|
|
6
|
+
import { integer } from '@fbincon/statusline-core/json';
|
|
7
|
+
import { validateDisplay } from '@fbincon/statusline-core/config/display';
|
|
8
|
+
import { validateProfiles } from '@fbincon/statusline-core/config/profiles';
|
|
9
|
+
import { registry } from '@fbincon/statusline-core/extensions/model';
|
|
10
|
+
import { parseNative, parseFeature, parseRuntime } from '@fbincon/statusline-core/config/backend-preferences';
|
|
11
|
+
import { resolveLanguage } from '@fbincon/statusline-core/i18n/registry';
|
|
12
|
+
import { safeTarget } from '../integration/paths.js';
|
|
13
|
+
import { BINDING_FILE } from '../integration/ownership.js';
|
|
14
|
+
import { hash, readRegular } from '../recovery/journal.js';
|
|
15
|
+
import { atomicWrite } from '@fbincon/statusline-platform/files';
|
|
16
|
+
import { decodeUtf8 } from '@fbincon/statusline-platform/utf8';
|
|
17
|
+
export const CONFIG_FILES = [...Object.keys(CONFIG_FORMATS), 'settings.json', BINDING_FILE];
|
|
18
|
+
export function configurationBytes(directory) {
|
|
19
|
+
const result = {};
|
|
20
|
+
let size = 0;
|
|
21
|
+
for (const name of CONFIG_FILES) {
|
|
22
|
+
const path = join(directory, name);
|
|
23
|
+
safeTarget(directory, path);
|
|
24
|
+
try {
|
|
25
|
+
const stat = fs.lstatSync(path);
|
|
26
|
+
if (!stat.isFile() || stat.size > 32 * 1024 * 1024)
|
|
27
|
+
throw new PackageError('configuration');
|
|
28
|
+
result[name] = fs.readFileSync(path);
|
|
29
|
+
size += result[name].length;
|
|
30
|
+
if (size > 64 * 1024 * 1024)
|
|
31
|
+
throw new PackageError('configuration');
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
if (error.code === 'ENOENT')
|
|
35
|
+
result[name] = null;
|
|
36
|
+
else
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
export const configurationHashes = (bytes) => Object.fromEntries(CONFIG_FILES.map(name => [name, hash(bytes[name] ?? null)]));
|
|
43
|
+
export function assertConfiguration(directory, expected) {
|
|
44
|
+
const actual = configurationHashes(configurationBytes(directory));
|
|
45
|
+
if (CONFIG_FILES.some(name => actual[name] !== expected[name]))
|
|
46
|
+
throw new PackageError('conflict');
|
|
47
|
+
}
|
|
48
|
+
export function configurationCompatibility(bytes, target) {
|
|
49
|
+
const reasons = [];
|
|
50
|
+
for (const [name, format] of Object.entries(CONFIG_FORMATS)) {
|
|
51
|
+
const raw = bytes[name];
|
|
52
|
+
if (raw === null || raw === undefined)
|
|
53
|
+
continue;
|
|
54
|
+
try {
|
|
55
|
+
const value = readJson(decodeUtf8(raw), { duplicate() { throw new Error('duplicate'); } });
|
|
56
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
57
|
+
throw new Error();
|
|
58
|
+
const version = Number(integer(format === 'profiles' || format === 'sources' ? value.version : value.schema_version));
|
|
59
|
+
const [minimum, maximum] = target.read[format];
|
|
60
|
+
if (version < minimum || version > maximum)
|
|
61
|
+
throw new Error();
|
|
62
|
+
if (format === 'display')
|
|
63
|
+
validateDisplay(value);
|
|
64
|
+
if (format === 'profiles') {
|
|
65
|
+
validateProfiles(value);
|
|
66
|
+
for (const profile of value.profiles) {
|
|
67
|
+
const schema = Number(integer(profile.display.schema_version));
|
|
68
|
+
if (schema < target.read.display[0] || schema > target.read.display[1])
|
|
69
|
+
throw new Error();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (format === 'sources')
|
|
73
|
+
registry(value);
|
|
74
|
+
if (format === 'native_preferences')
|
|
75
|
+
parseNative(decodeUtf8(raw));
|
|
76
|
+
if (format === 'external_preferences')
|
|
77
|
+
parseFeature(decodeUtf8(raw));
|
|
78
|
+
if (format === 'runtime_preferences')
|
|
79
|
+
parseRuntime(decodeUtf8(raw));
|
|
80
|
+
if (format === 'ui_preferences' && !resolveLanguage(value.ui_language))
|
|
81
|
+
throw new Error();
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
reasons.push(name);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return reasons;
|
|
88
|
+
}
|
|
89
|
+
export function saveSnapshot(directory, transaction, bytes) {
|
|
90
|
+
const hashes = configurationHashes(bytes);
|
|
91
|
+
for (const name of CONFIG_FILES) {
|
|
92
|
+
const raw = bytes[name];
|
|
93
|
+
if (raw === null || raw === undefined)
|
|
94
|
+
continue;
|
|
95
|
+
const path = join(transaction, 'snapshot', name);
|
|
96
|
+
safeTarget(directory, path);
|
|
97
|
+
atomicWrite(path, raw);
|
|
98
|
+
}
|
|
99
|
+
return hashes;
|
|
100
|
+
}
|
|
101
|
+
export function readSnapshot(directory, transaction, hashes) {
|
|
102
|
+
if (!hashes || Object.keys(hashes).sort().join('\0') !== [...CONFIG_FILES].sort().join('\0'))
|
|
103
|
+
throw new PackageError('backup');
|
|
104
|
+
const bytes = {};
|
|
105
|
+
for (const name of CONFIG_FILES) {
|
|
106
|
+
if (hashes[name] === null) {
|
|
107
|
+
bytes[name] = null;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const path = join(transaction, 'snapshot', name);
|
|
111
|
+
safeTarget(directory, path);
|
|
112
|
+
try {
|
|
113
|
+
bytes[name] = readRegular(path);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
throw new PackageError('backup');
|
|
117
|
+
}
|
|
118
|
+
if (hash(bytes[name]) !== hashes[name])
|
|
119
|
+
throw new PackageError('backup');
|
|
120
|
+
}
|
|
121
|
+
return bytes;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../src/management/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAA6B,MAAM,mDAAmD,CAAC;AAC9G,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AAC9G,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC;AAG5F,MAAM,UAAU,kBAAkB,CA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AI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAE,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC;YACnC,MAAM,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Language } from '@fbincon/statusline-core/i18n/messages';
|
|
2
|
+
import { type PackageIdentity } from '@fbincon/statusline-core/management/package';
|
|
3
|
+
import { Npm } from '@fbincon/statusline-platform/npm';
|
|
4
|
+
export declare function entryOptions(args: readonly string[]): {
|
|
5
|
+
prefix?: string;
|
|
6
|
+
dryRun: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function confirmPackage(language: Language, output: (value: string) => void, signal?: AbortSignal): Promise<boolean>;
|
|
9
|
+
export interface FirstEntryOptions {
|
|
10
|
+
configDir: string;
|
|
11
|
+
language: Language;
|
|
12
|
+
stdout: (value: string) => void;
|
|
13
|
+
stderr: (value: string) => void;
|
|
14
|
+
tty?: boolean;
|
|
15
|
+
origin?: string | null;
|
|
16
|
+
npm?: Npm;
|
|
17
|
+
confirm?: () => Promise<boolean>;
|
|
18
|
+
handoff?: (identity: PackageIdentity) => Promise<number>;
|
|
19
|
+
}
|
|
20
|
+
export declare function firstEntry(args: readonly string[], options: FirstEntryOptions): Promise<number>;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { spawn } from 'node:child_process';
|
|
5
|
+
import { createInterface } from 'node:readline/promises';
|
|
6
|
+
import { t } from '@fbincon/statusline-core/i18n/messages';
|
|
7
|
+
import { VERSION, PACKAGE_NAME } from '@fbincon/statusline-core/release';
|
|
8
|
+
import { supportedNode } from '@fbincon/statusline-core/node-runtime';
|
|
9
|
+
import { PackageError, entryAction } from '@fbincon/statusline-core/management/package';
|
|
10
|
+
import { Npm, productRoot, productIdentity, writablePrefix, within } from '@fbincon/statusline-platform/npm';
|
|
11
|
+
import { lock } from '@fbincon/statusline-platform/files';
|
|
12
|
+
import { sameLaunchEntry, which } from '@fbincon/statusline-platform/commands';
|
|
13
|
+
import { ArgumentError, optionToken } from '../config/arguments.js';
|
|
14
|
+
import { createPrefix, pendingPath, startOperation, saveOperation, recordInstallation, finishOperation, observeOperation } from './store.js';
|
|
15
|
+
import { previousBinding } from '../integration/ownership.js';
|
|
16
|
+
import { createStorage } from '../config/storage.js';
|
|
17
|
+
export function entryOptions(args) {
|
|
18
|
+
const result = { dryRun: false }, seen = new Set();
|
|
19
|
+
for (let i = 0; i < args.length; i++) {
|
|
20
|
+
const [name] = args[i].split('=');
|
|
21
|
+
if (seen.has(name))
|
|
22
|
+
throw new ArgumentError('duplicate ' + name);
|
|
23
|
+
seen.add(name);
|
|
24
|
+
if (name === '--dry-run' && args[i] === name) {
|
|
25
|
+
result.dryRun = true;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (!['--prefix', '--config-dir'].includes(name))
|
|
29
|
+
throw new ArgumentError('unrecognized arguments: ' + args[i]);
|
|
30
|
+
const value = args[i].includes('=') ? args[i].slice(name.length + 1) : args[++i];
|
|
31
|
+
if (!value || optionToken(value) || /[\0\r\n]/u.test(value))
|
|
32
|
+
throw new ArgumentError(name + ' requires a path');
|
|
33
|
+
if (name === '--prefix')
|
|
34
|
+
result.prefix = value;
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
export async function confirmPackage(language, output, signal) {
|
|
39
|
+
output(t('package.confirm', language) + ' ');
|
|
40
|
+
const reader = createInterface({ input: process.stdin, output: process.stdout, terminal: false });
|
|
41
|
+
const closed = new AbortController();
|
|
42
|
+
reader.once('close', () => closed.abort());
|
|
43
|
+
try {
|
|
44
|
+
return /^(?:y|yes)$/iu.test((await reader.question('', { signal: signal ? AbortSignal.any([signal, closed.signal]) : closed.signal })).trim());
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
reader.close();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export async function firstEntry(args, options) {
|
|
54
|
+
const flags = entryOptions(args), { language, stdout, stderr, configDir } = options;
|
|
55
|
+
if (!(options.tty ?? (process.stdin.isTTY && process.stdout.isTTY)) && !flags.dryRun) {
|
|
56
|
+
stderr(t('package.tty', language) + '\n');
|
|
57
|
+
return 2;
|
|
58
|
+
}
|
|
59
|
+
let stage = 'review', release;
|
|
60
|
+
const controller = new AbortController(), cancel = () => controller.abort();
|
|
61
|
+
process.on('SIGINT', cancel);
|
|
62
|
+
process.on('SIGTERM', cancel);
|
|
63
|
+
try {
|
|
64
|
+
if (!supportedNode(process.versions.node))
|
|
65
|
+
throw new PackageError('runtime');
|
|
66
|
+
const origin = options.origin === undefined ? productRoot(fileURLToPath(import.meta.url)) : options.origin;
|
|
67
|
+
if (!origin || productIdentity(origin)?.version !== VERSION)
|
|
68
|
+
throw new PackageError('development');
|
|
69
|
+
const npm = options.npm ?? new Npm(process.env, undefined, undefined, controller.signal), layout = await npm.layout(flags.prefix);
|
|
70
|
+
const before = productIdentity(layout.root, layout.prefix), action = entryAction(before, VERSION);
|
|
71
|
+
if (within(configDir, layout.root))
|
|
72
|
+
throw new PackageError('prefix');
|
|
73
|
+
if (action === 'version_conflict') {
|
|
74
|
+
stdout(JSON.stringify({ installed: before.version, target: VERSION, prefix: layout.prefix }, null, 2) + '\n');
|
|
75
|
+
throw new PackageError('version_conflict');
|
|
76
|
+
}
|
|
77
|
+
const pathEntry = which('claude-statusline');
|
|
78
|
+
const previous = previousBinding(configDir, createStorage());
|
|
79
|
+
const priorRoot = previous?.args.length === 1 ? productRoot(previous.args[0]) : null;
|
|
80
|
+
const inferredPrefix = (root) => dirname(dirname(dirname(process.platform === 'win32' ? root : dirname(root))));
|
|
81
|
+
for (const root of [origin, priorRoot])
|
|
82
|
+
if (!flags.prefix && root && !within(root, layout.cache)) {
|
|
83
|
+
const prefix = inferredPrefix(root), expected = join(prefix, process.platform === 'win32' ? 'node_modules' : 'lib/node_modules', PACKAGE_NAME);
|
|
84
|
+
if (root === expected && root !== layout.root)
|
|
85
|
+
throw new PackageError('prefix_ambiguous');
|
|
86
|
+
}
|
|
87
|
+
if (!flags.prefix && pathEntry && !sameLaunchEntry(pathEntry, { executable: process.execPath, args: [join(layout.root, 'node_modules/@fbincon/statusline-cli/dist/src/entry.js')] }))
|
|
88
|
+
throw new PackageError('prefix_ambiguous');
|
|
89
|
+
if (fs.existsSync(pendingPath(layout.prefix)))
|
|
90
|
+
throw new PackageError('pending');
|
|
91
|
+
if (!before)
|
|
92
|
+
writablePrefix(layout.prefix);
|
|
93
|
+
stdout(t('package.review', language, { action: t('package.action_' + action, language), name: PACKAGE_NAME, version: VERSION, prefix: layout.prefix, node: process.execPath, npm: layout.npmVersion, npm_entry: npm.entry, entry: join(layout.root, 'node_modules/@fbincon/statusline-cli/dist/src/entry.js'), config_dir: configDir, registry: layout.registry }) + '\n');
|
|
94
|
+
if (flags.dryRun)
|
|
95
|
+
return 0;
|
|
96
|
+
const approved = await (options.confirm?.() ?? confirmPackage(language, stdout, controller.signal));
|
|
97
|
+
if (controller.signal.aborted)
|
|
98
|
+
throw new PackageError('interrupted');
|
|
99
|
+
if (!approved) {
|
|
100
|
+
stdout(t('package.cancelled', language) + '\n');
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
const handoff = async (installed) => {
|
|
104
|
+
stdout(t('package.verified', language, { prefix: layout.prefix }) + '\n');
|
|
105
|
+
if (options.handoff)
|
|
106
|
+
return options.handoff(installed);
|
|
107
|
+
return new Promise((resolve, reject) => {
|
|
108
|
+
const child = spawn(process.execPath, [installed.entry, '--language', language, 'setup', '--config-dir', configDir], { stdio: 'inherit', shell: false });
|
|
109
|
+
const stop = () => child.kill('SIGTERM');
|
|
110
|
+
controller.signal.addEventListener('abort', stop, { once: true });
|
|
111
|
+
child.once('error', reject);
|
|
112
|
+
child.once('exit', code => { controller.signal.removeEventListener('abort', stop); resolve(code ?? 2); });
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
if (before) {
|
|
116
|
+
await npm.verify(before, layout.bin);
|
|
117
|
+
if (JSON.stringify(productIdentity(layout.root, layout.prefix)) !== JSON.stringify(before))
|
|
118
|
+
throw new PackageError('conflict');
|
|
119
|
+
stage = 'package_verified';
|
|
120
|
+
return await handoff(before);
|
|
121
|
+
}
|
|
122
|
+
createPrefix(layout.prefix);
|
|
123
|
+
release = lock(join(layout.prefix, '.claude-statusline-install.lock'), true);
|
|
124
|
+
if (JSON.stringify(productIdentity(layout.root, layout.prefix)) !== JSON.stringify(before) || fs.existsSync(pendingPath(layout.prefix)))
|
|
125
|
+
throw new PackageError('conflict');
|
|
126
|
+
const operation = startOperation(configDir, layout.prefix, VERSION, layout.registry, before);
|
|
127
|
+
npm.onProcess = observeOperation(operation);
|
|
128
|
+
try {
|
|
129
|
+
if (!before) {
|
|
130
|
+
stage = 'installing';
|
|
131
|
+
operation.stage = 'installing';
|
|
132
|
+
saveOperation(operation);
|
|
133
|
+
await npm.install(VERSION, layout);
|
|
134
|
+
}
|
|
135
|
+
const installed = productIdentity(layout.root, layout.prefix);
|
|
136
|
+
if (!installed || installed.version !== VERSION)
|
|
137
|
+
throw new PackageError('identity');
|
|
138
|
+
await npm.verify(installed, layout.bin);
|
|
139
|
+
operation.after = { ...installed, registry: layout.registry };
|
|
140
|
+
stage = 'package_verified';
|
|
141
|
+
operation.stage = 'package_verified';
|
|
142
|
+
saveOperation(operation);
|
|
143
|
+
recordInstallation(operation);
|
|
144
|
+
finishOperation(operation);
|
|
145
|
+
release();
|
|
146
|
+
release = undefined;
|
|
147
|
+
return await handoff(installed);
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
if (operation.stage !== 'complete') {
|
|
151
|
+
operation.stage = 'uncertain';
|
|
152
|
+
saveOperation(operation);
|
|
153
|
+
}
|
|
154
|
+
throw error;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
const reason = error instanceof PackageError ? error.code : 'io_error';
|
|
159
|
+
stderr(t('package.failure', language, { reason: t('package.reason_' + reason, language) }) + '\n');
|
|
160
|
+
if (stage !== 'review')
|
|
161
|
+
stderr(t('package.partial', language, { stage }) + '\n');
|
|
162
|
+
return reason === 'interrupted' ? 130 : 2;
|
|
163
|
+
}
|
|
164
|
+
finally {
|
|
165
|
+
release?.();
|
|
166
|
+
process.off('SIGINT', cancel);
|
|
167
|
+
process.off('SIGTERM', cancel);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=first-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-entry.js","sourceRoot":"","sources":["../../../src/management/first-entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,CAAC,EAAiB,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAwB,MAAM,6CAA6C,CAAC;AAC9G,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC7G,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AA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3B,OAAO,EAAE,CAAC;YACV,OAAO,GAAG,SAAS,CAAC;YACpB,OAAO,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,KAAK,EAAE,CAAC;YACX,IAAI,SAAS,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;gBACjC,SAAS,CAAC,KAAK,GAAG,WAAW,CAAC;gBAC9B,aAAa,CAAC,SAAS,CAAC,CAAC;YAC7B,CAAC;YACD,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC;IACD,OAAO,KAAK,EAAE,CAAC;QACX,MAAM,MAAM,GAAG,KAAK,YAAY,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;QACvE,MAAM,CAAC,CAAC,CAAC,iBAAiB,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,iBAAiB,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QACnG,IAAI,KAAK,KAAK,QAAQ;YAClB,MAAM,CAAC,CAAC,CAAC,iBAAiB,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QAC7D,OAAO,MAAM,KAAK,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;YACO,CAAC;QACL,OAAO,EAAE,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
// This process loads only the target package's native adapter. Do not import
|
|
10
|
+
// the transaction runner's platform modules here (Windows cannot unload Koffi).
|
|
11
|
+
import * as fs from 'node:fs';
|
|
12
|
+
import { join } from 'node:path';
|
|
13
|
+
import { pathToFileURL } from 'node:url';
|
|
14
|
+
import { createHash } from 'node:crypto';
|
|
15
|
+
const [requestPath, receipt] = process.argv.slice(2);
|
|
16
|
+
const request = JSON.parse(fs.readFileSync(requestPath, 'utf8'));
|
|
17
|
+
const load = (path) => import(__rewriteRelativeImportExtension(pathToFileURL(join(request.root, 'node_modules/@fbincon/statusline-cli/dist/src', path + '.js')).href));
|
|
18
|
+
try {
|
|
19
|
+
const [{ install, installContext }, { doctor }, { safeTarget }] = await Promise.all([load('integration/install'), load('integration/doctor'), load('integration/paths')]);
|
|
20
|
+
const guard = () => {
|
|
21
|
+
for (const [name, expected] of Object.entries(request.hashes)) {
|
|
22
|
+
const path = join(request.configDir, name);
|
|
23
|
+
safeTarget(request.configDir, path);
|
|
24
|
+
let hash = null;
|
|
25
|
+
try {
|
|
26
|
+
const stat = fs.lstatSync(path);
|
|
27
|
+
if (!stat.isFile() || stat.size > 32 * 1024 * 1024)
|
|
28
|
+
throw new Error('Invalid configuration file');
|
|
29
|
+
hash = createHash('sha256').update(fs.readFileSync(path)).digest('hex');
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (error.code !== 'ENOENT')
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
if (hash !== expected)
|
|
36
|
+
throw new Error('Configuration changed after review');
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
guard();
|
|
40
|
+
const context = installContext(request.configDir, { executable: process.execPath, args: [request.entry] }, request.host);
|
|
41
|
+
const result = install(context, { dryRun: request.dryRun, beforeCommit: guard });
|
|
42
|
+
const diagnostics = request.dryRun ? [] : doctor(context);
|
|
43
|
+
const valid = !result.failed && !diagnostics.some((row) => row.level === 'ERROR');
|
|
44
|
+
fs.writeFileSync(receipt, JSON.stringify({ valid, result, diagnostics }) + '\n', { mode: 0o600 });
|
|
45
|
+
process.exitCode = valid ? 0 : 2;
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
fs.writeFileSync(receipt, JSON.stringify({ valid: false, error: 'integration_failed' }) + '\n', { mode: 0o600 });
|
|
49
|
+
process.exitCode = 2;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=integration-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-runner.js","sourceRoot":"","sources":["../../../src/management/integration-runner.ts"],"names":[],"mappings":";;;;;;;;AAAA,6EAA6E;AAC7E,gFAAgF;AAChF,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACrD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAY,EAAE,MAAM,CAAC,CAAC,CAAC;AAClE,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,kCAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,+CAA+C,EAAE,IAAI,GAAG,KAAK,CA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on/statusline-core/management/package';
|
|
2
|
+
import { type ConfigHashes } from './configuration.js';
|
|
3
|
+
export declare function refreshIntegration(root: string, identity: PackageIdentity, configDir: string, host: readonly number[] | null, hashes: ConfigHashes, workspace: string, dryRun: boolean, environment: NodeJS.ProcessEnv, signal?: AbortSignal, onProcess?: (pid: number | null) => void): Promise<void>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { randomUUID } from 'node:crypto';
|
|
5
|
+
import { runSourceProcess } from '@fbincon/statusline-platform/source-process';
|
|
6
|
+
import { removeTree } from '@fbincon/statusline-platform/remove-tree';
|
|
7
|
+
import { PackageError } from '@fbincon/statusline-core/management/package';
|
|
8
|
+
export async function refreshIntegration(root, identity, configDir, host, hashes, workspace, dryRun, environment, signal, onProcess) {
|
|
9
|
+
const id = randomUUID(), request = join(workspace, id + '-request.json'), receipt = join(workspace, id + '-result.json');
|
|
10
|
+
const payload = { root, version: identity.version, entry: identity.entry, configDir, host, hashes, dryRun };
|
|
11
|
+
fs.writeFileSync(request, JSON.stringify(payload), { mode: 0o600 });
|
|
12
|
+
try {
|
|
13
|
+
const transition = await runSourceProcess({ executable: process.execPath, args: [fileURLToPath(new URL('./mod-transition-runner.js', import.meta.url)), request, receipt], cwd: workspace, input: '', timeoutMs: 180000, environment, signal, onProcess });
|
|
14
|
+
if (transition.reason === 'cancelled')
|
|
15
|
+
throw new PackageError('interrupted');
|
|
16
|
+
if (transition.reason !== 'completed')
|
|
17
|
+
throw new PackageError('integration_failed');
|
|
18
|
+
const prepared = JSON.parse(fs.readFileSync(receipt, 'utf8'));
|
|
19
|
+
if (!prepared.valid)
|
|
20
|
+
throw new PackageError('integration_failed');
|
|
21
|
+
fs.writeFileSync(request, JSON.stringify({ ...payload, hashes: prepared.hashes }), { mode: 0o600 });
|
|
22
|
+
fs.unlinkSync(receipt);
|
|
23
|
+
const result = await runSourceProcess({ executable: process.execPath, args: [fileURLToPath(new URL('./integration-runner.js', import.meta.url)), request, receipt], cwd: workspace, input: '', timeoutMs: 180000, environment, signal, onProcess });
|
|
24
|
+
if (result.reason === 'cancelled')
|
|
25
|
+
throw new PackageError('interrupted');
|
|
26
|
+
if (result.reason !== 'completed' || !JSON.parse(fs.readFileSync(receipt, 'utf8')).valid)
|
|
27
|
+
throw new PackageError('integration_failed');
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
removeTree(request);
|
|
31
|
+
removeTree(receipt);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.js","sourceRoot":"","sources":["../../../src/management/integration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,YAAY,EAAwB,MAAM,6CAA6C,CAAC;AAEjG,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAY,EAAE,QAAyB,EAAE,SAAiB,EAAE,IAA8B,EAAE,MAAoB,EAAE,SAAiB,EAAE,MAAe,EAAE,WAA8B,EAAE,MAAoB,EAAE,SAAwC;IACzR,MAAM,EAAE,GAAG,UAAU,EAAE,EAAE,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,EAAE,GAAG,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,EAAE,GAAG,cAAc,CAAC,CAAC;IACzH,MAAM,OAAO,GAAG,EAA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OAAO,CAAC,CAAC;QACvB,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,yBAAyB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;QACpP,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW;YAC7B,MAAM,IAAI,YAAY,CAAC,aAAa,CAAC,CAAC;QAC1C,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK;YACpF,MAAM,IAAI,YAAY,CAAC,oBAAoB,CAAC,CAAC;IACrD,CAAC;YACO,CAAC;QACL,UAAU,CAAC,OAAO,CAAC,CAAC;QACpB,UAAU,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// A separate process keeps this runner's native adapter out of the target installer's process.
|
|
2
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { installContext } from '../integration/install.js';
|
|
4
|
+
import { prepareModDowngrade } from './mod-transition.js';
|
|
5
|
+
const [requestPath, receipt] = process.argv.slice(2);
|
|
6
|
+
try {
|
|
7
|
+
const request = JSON.parse(readFileSync(requestPath, 'utf8'));
|
|
8
|
+
const context = installContext(request.configDir, { executable: process.execPath, args: [request.entry] }, request.host);
|
|
9
|
+
const hashes = prepareModDowngrade(context, request.root, request.version, request.hashes, request.dryRun);
|
|
10
|
+
writeFileSync(receipt, JSON.stringify({ valid: true, hashes }) + '\n', { mode: 0o600 });
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
writeFileSync(receipt, JSON.stringify({ valid: false, reason: error instanceof Error ? error.message : 'integration_failed' }) + '\n', { mode: 0o600 });
|
|
14
|
+
process.exitCode = 2;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=mod-transition-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod-transition-runner.js","sourceRoot":"","sources":["../../../src/management/mod-transition-runner.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACrD,IAAI,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACzH,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3G,aAAa,CAAC,OAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AAC7F,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACb,aAAa,CAAC,OAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAoB,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACzJ,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type InstallContext } from '../integration/model.js';
|
|
2
|
+
import { type ConfigHashes } from './configuration.js';
|
|
3
|
+
export declare function prepareModDowngrade(context: InstallContext, root: string, version: string, expected: ConfigHashes, dryRun: boolean): ConfigHashes;
|