@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
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import { validAlignments } from './editor/alignments.ts';
|
|
3
|
+
import { GRADIENT_KEYS, validGradient } from './editor/gradients.ts';
|
|
2
4
|
import { validCostRateOptions } from './editor/cost-rate.ts';
|
|
3
5
|
import { validGroups } from './editor/groups.ts';
|
|
4
6
|
import { INDICATOR_KEYS, validIndicatorOptions } from './editor/indicators.ts';
|
|
@@ -108,10 +110,10 @@ function formatOverrides(value: unknown): boolean {
|
|
|
108
110
|
function itemOptions(value: unknown, ids: readonly string[], scope: "main" | "subagent"): boolean {
|
|
109
111
|
if (!object(value)) return false;
|
|
110
112
|
return Object.entries(value).every(([id, option]) => ids.includes(id) && object(option) &&
|
|
111
|
-
exact(option, ['label', 'icon', 'priority', 'max_width', 'formatting', 'foreground', 'background', 'visibility', 'visibility_threshold', ...(option.link !== undefined ? ['link'] : []), ...INDICATOR_KEYS.filter(key => Object.hasOwn(option, key)), ...(Object.hasOwn(option, 'cost_rate_basis') ? ['cost_rate_basis'] : [])]) && (option.link === undefined || ['off','auto','on'].includes(String(option.link))) &&
|
|
113
|
+
exact(option, [...GRADIENT_KEYS.filter(key => Object.hasOwn(option, key)), 'label', 'icon', 'priority', 'max_width', 'formatting', 'foreground', 'background', 'visibility', 'visibility_threshold', ...(option.link !== undefined ? ['link'] : []), ...INDICATOR_KEYS.filter(key => Object.hasOwn(option, key)), ...(Object.hasOwn(option, 'cost_rate_basis') ? ['cost_rate_basis'] : [])]) && (option.link === undefined || ['off','auto','on'].includes(String(option.link))) &&
|
|
112
114
|
(option.label === null || (text(option.label) && [...option.label].length <= 256)) &&
|
|
113
115
|
(option.icon === null || (text(option.icon) && [...option.icon].length <= 256)) &&
|
|
114
|
-
validIndicatorOptions(option, scope, id) && validCostRateOptions(option, scope, id) && range(option.priority, 0, 100) && range(option.max_width, 2, 10000, true) &&
|
|
116
|
+
GRADIENT_KEYS.every(key => option[key] === undefined || id !== 'spacer' && validGradient(option[key])) && validIndicatorOptions(option, scope, id) && validCostRateOptions(option, scope, id) && range(option.priority, 0, 100) && range(option.max_width, 2, 10000, true) &&
|
|
115
117
|
formatOverrides(option.formatting) && validColor(option.foreground) && validColor(option.background) &&
|
|
116
118
|
typeof option.visibility === "string" && visibilityChoices(scope, id).includes(option.visibility) &&
|
|
117
119
|
range(option.visibility_threshold, 0, 100));
|
|
@@ -173,7 +175,7 @@ export function isDraft(value: unknown): value is Draft {
|
|
|
173
175
|
)
|
|
174
176
|
return false;
|
|
175
177
|
if (
|
|
176
|
-
d.schema_version !==
|
|
178
|
+
d.schema_version !== 15 ||
|
|
177
179
|
!object(d.powerline) || !exact(d.powerline, POWERLINE_FIELDS.map(f => f.key.slice(10))) ||
|
|
178
180
|
!POWERLINE_FIELDS.every(f => f.kind === 'boolean' ? typeof (d.powerline as Record<string, unknown>)[f.key.slice(10)] === 'boolean' :
|
|
179
181
|
(f.choices as readonly unknown[]).includes((d.powerline as Record<string, unknown>)[f.key.slice(10)])) ||
|
|
@@ -208,12 +210,13 @@ export function isDraft(value: unknown): value is Draft {
|
|
|
208
210
|
const ids = d.instances.map(i=>i.id);
|
|
209
211
|
const spacers = new Set(d.instances.filter(i=>i.type_id==='spacer').map(i=>i.id));
|
|
210
212
|
const layout = d.layout;
|
|
211
|
-
if (!object(layout) || !exact(layout, ['mode', 'rows']) ||
|
|
213
|
+
if (!object(layout) || !exact(layout, ['mode', 'rows', ...(Object.hasOwn(layout, 'alignments') ? ['alignments'] : [])]) ||
|
|
212
214
|
!['auto', 'explicit'].includes(String(layout.mode)) || !Array.isArray(layout.rows) ||
|
|
213
215
|
!layout.rows.every((r) => selection(r, ids) && r.length > 0 && r.filter(id => spacers.has(id)).length <= 1) ||
|
|
214
216
|
(layout.mode === 'auto' ? layout.rows.length !== 0 || spacers.size > 0 :
|
|
215
217
|
JSON.stringify(layout.rows.flat()) !== JSON.stringify(ids))) return false;
|
|
216
218
|
if (!validGroups(d.groups, d.instances, layout as unknown as import('./generated-contracts.ts').LayoutDraft) || !validGroups(sub.groups, sub.instances)) return false;
|
|
219
|
+
if (!validAlignments(layout.alignments, layout as unknown as import('./generated-contracts.ts').LayoutDraft, d.instances, d.groups)) return false;
|
|
217
220
|
// Exclusions come from describe; the backend remains the final draft validator.
|
|
218
221
|
return (
|
|
219
222
|
typeof h.padding === 'number' &&
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { openAlignments, alignmentsKey } from '../editor/alignment-manager.ts';
|
|
1
2
|
import { openGroups, groupsKey } from '../editor/group-manager.ts';
|
|
2
3
|
import { openSources, sourcesKey } from '../editor/source-manager.ts';
|
|
3
4
|
import { openExplanation, explanationKey } from '../editor/explanation.ts';
|
|
@@ -37,6 +38,7 @@ export function handleKey(view: View, event: NativeKeyEvent, columns: number, ro
|
|
|
37
38
|
const shortcut = /^[A-Z]$/.test(key) ? key.toLowerCase() : key;
|
|
38
39
|
if (!e || view.busy) return null;
|
|
39
40
|
if (event.overflow) { setMessage(view, 'message', localizedText('input.overflow')); return null; }
|
|
41
|
+
if (e.alignmentManager) return alignmentsKey(e,event);
|
|
40
42
|
if (e.groupManager) return groupsKey(e, event);
|
|
41
43
|
if (event.ctrl && key.toLowerCase() === 'b' && !view.input && !view.uncertain && !e.sources && !e.profiles && !e.review && !e.quick && !e.explanation && !event.text) { openGroups(e); return null; }
|
|
42
44
|
if (e.sources) return sourcesKey(e,event);
|
|
@@ -56,7 +58,7 @@ export function handleKey(view: View, event: NativeKeyEvent, columns: number, ro
|
|
|
56
58
|
if (view.uncertain) return event.ctrl || event.meta ? null : shortcut === 'k' ? 'reconcile' : shortcut === 'q' ? 'close' : null;
|
|
57
59
|
if (e.review) {
|
|
58
60
|
if (event.ctrl || event.meta) return null;
|
|
59
|
-
if (shortcut === 'a') {
|
|
61
|
+
if (shortcut === 'a' && !e.review.choosing) {
|
|
60
62
|
e.replaceDraft(e.review.result.draft);
|
|
61
63
|
setMessage(view, 'message', localizedText('review.accepted'));
|
|
62
64
|
return 'reviewPreview';
|
|
@@ -64,7 +66,7 @@ export function handleKey(view: View, event: NativeKeyEvent, columns: number, ro
|
|
|
64
66
|
if (shortcut === 'q') { cancelInput(view); return 'reviewPreview'; }
|
|
65
67
|
const layout = editorLayout(view, columns, rows);
|
|
66
68
|
navigateReview(e.review, key, view.language ?? 'en', Math.max(2, columns - (layout.framed ? 2 : 0)), Math.max(1, layout.bodyRows - 1));
|
|
67
|
-
return
|
|
69
|
+
return 'reviewPreview';
|
|
68
70
|
}
|
|
69
71
|
if (e.guidanceScroll !== null && e.detail) {
|
|
70
72
|
const layout = editorLayout(view, columns, rows);
|
|
@@ -141,11 +143,11 @@ export function handleKey(view: View, event: NativeKeyEvent, columns: number, ro
|
|
|
141
143
|
if(!event.meta && key.toLowerCase()==='a'&&!e.adding){e.openPicker(scope);return null;}
|
|
142
144
|
if(!event.meta && ['d','x'].includes(key.toLowerCase())&&!e.adding){
|
|
143
145
|
if(!e.instanceAction(scope,key.toLowerCase()==='d'?'copy':'remove'))
|
|
144
|
-
setMessage(view,'message',
|
|
146
|
+
setMessage(view,'message',e.compositionError);
|
|
145
147
|
return null;
|
|
146
148
|
}
|
|
147
149
|
if(e.adding&&!event.ctrl&&!event.meta&&(key==='return'||key===' ')){
|
|
148
|
-
if(!e.instanceAction(scope,'add',e.selected[scope]))setMessage(view,'message',
|
|
150
|
+
if(!e.instanceAction(scope,'add',e.selected[scope]))setMessage(view,'message',e.compositionError);
|
|
149
151
|
return null;
|
|
150
152
|
}
|
|
151
153
|
if(e.adding&&!event.ctrl&&!event.meta&&shortcut==='q'){e.closePicker(scope);return null;}
|
|
@@ -198,11 +200,12 @@ export function handleKey(view: View, event: NativeKeyEvent, columns: number, ro
|
|
|
198
200
|
if (isSettings) adjustSetting(view, key === 'left' ? -1 : 1);
|
|
199
201
|
else {
|
|
200
202
|
const delta = key === 'left' ? -1 : 1;
|
|
201
|
-
if (keys[index + delta] && !e.move(scope, delta)) setMessage(view, 'message',
|
|
203
|
+
if (keys[index + delta] && !e.move(scope, delta)) setMessage(view, 'message', e.compositionError);
|
|
202
204
|
}
|
|
203
205
|
return isSettings && e.setting === 'preview-background' ? 'previewBackground' : isSettings && e.setting === 'ui-language' ? 'uiLanguage' : null;
|
|
204
206
|
} else if (key === 'return' || key === ' ' || key === 'space') {
|
|
205
|
-
if (!isSettings) { if(!e.toggle(scope, selected))setMessage(view,"message",
|
|
207
|
+
if (!isSettings) { if(!e.toggle(scope, selected))setMessage(view,"message",e.compositionError); }
|
|
208
|
+
else if (e.setting === 'row-alignment') { openAlignments(e); return null; }
|
|
206
209
|
else if (e.setting === 'component-groups') { openGroups(e); return null; }
|
|
207
210
|
else if (e.setting === 'sources') {openSources(e);return 'sources';}
|
|
208
211
|
else if (e.setting === 'profiles') { if (e.acceptNumeric()) { openProfiles(e); return 'profiles'; } }
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts
CHANGED
|
@@ -16,7 +16,11 @@ export interface SettingRow {
|
|
|
16
16
|
export function settingRows(view: View): SettingRow[] {
|
|
17
17
|
const e = view.editor!;
|
|
18
18
|
if (e.detail) return [...(!e.adding ? [{key:'item-explain',label:'Configuration and sample explanation',group:'Item format',value:'Enter',editable:true}] : []), {key:'item-guidance', label:'Sources and requirements', group:'Item format', value:'Enter: read guidance', editable:true}, ...formRows(view)];
|
|
19
|
-
if (e.page === 'layout')
|
|
19
|
+
if (e.page === 'layout') {
|
|
20
|
+
const fields = formRows(view);
|
|
21
|
+
if (!e.draft.display.instances.length) return fields;
|
|
22
|
+
return [fields[0]!, {key:'row-alignment',label:'Align explicit main rows',group:'Layout',value:'Enter',editable:true}, ...fields.slice(1)];
|
|
23
|
+
}
|
|
20
24
|
const d = e.draft.display;
|
|
21
25
|
const h = e.draft.host;
|
|
22
26
|
const rows: SettingRow[] = [
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import type { AlignmentDraft, AlignmentRef } from '../generated-contracts.ts';
|
|
3
|
+
import type { Editor } from './draft.ts';
|
|
4
|
+
import type { TextKey } from './text-input.ts';
|
|
5
|
+
import { alignmentUnits, editAlignment, refKey } from './alignments.ts';
|
|
6
|
+
import { newInstance } from './instances.ts';
|
|
7
|
+
import { t, type Language } from '../i18n/index.ts';
|
|
8
|
+
import { wrapText } from '../../ui/text.ts';
|
|
9
|
+
export interface AlignmentManager {
|
|
10
|
+
page:'list'|'actions'|'form';cursor:number;selected:string|null;column:number;columns:AlignmentRef[][];error:boolean;
|
|
11
|
+
}
|
|
12
|
+
export function openAlignments(e: Editor): void {
|
|
13
|
+
e.alignmentManager={page:'list',cursor:0,selected:null,column:0,columns:[[]],error:false};
|
|
14
|
+
}
|
|
15
|
+
function form(e:Editor,value?:AlignmentDraft):void {
|
|
16
|
+
const m=e.alignmentManager!;m.page='form';m.cursor=0;m.selected=value?.id??null;m.columns=JSON.parse(JSON.stringify(value?.columns??[[]]));m.column=0;m.error=false;
|
|
17
|
+
}
|
|
18
|
+
export function alignmentsKey(e:Editor,event:TextKey):null {
|
|
19
|
+
const m=e.alignmentManager!;if(event.text||event.paste||event.meta||event.overflow)return null;
|
|
20
|
+
const key=event.key==='return'?'enter':event.key;
|
|
21
|
+
if(key==='escape'||event.ctrl&&key.toLowerCase()==='g') { if(m.page==='list')e.alignmentManager=null;else {m.page='list';m.cursor=0;m.error=false;}return null; }
|
|
22
|
+
if(event.ctrl)return null;
|
|
23
|
+
const d=e.draft.display, values=d.layout.alignments??[], length=m.page==='list'?values.length+1:m.page==='actions'?2:d.layout.rows.length+4;
|
|
24
|
+
if(['up','down','tab'].includes(key))m.cursor=Math.max(0,Math.min(length-1,m.cursor+(key==='up'?-1:1)));
|
|
25
|
+
if(key==='home')m.cursor=0;if(key==='end')m.cursor=length-1;
|
|
26
|
+
if(m.page==='list'&&key==='enter') { const value=values[m.cursor];if(value){m.selected=value.id;m.page='actions';m.cursor=0;}else form(e); }
|
|
27
|
+
else if(m.page==='actions'&&key==='enter') {
|
|
28
|
+
if(m.cursor===0)form(e,values.find(v=>v.id===m.selected));
|
|
29
|
+
else { e.draft={...e.draft,display:editAlignment(d,m.selected!)};m.page='list';m.cursor=0; }
|
|
30
|
+
} else if(m.page==='form'&&['left','right','enter','space',' '].includes(key)) {
|
|
31
|
+
const rows=d.layout.rows.length;
|
|
32
|
+
if(m.cursor===0)m.column=(m.column+(key==='left'?m.columns.length-1:1))%m.columns.length;
|
|
33
|
+
else if(m.cursor<=rows) {
|
|
34
|
+
const row=m.cursor-1, units=alignmentUnits(d.layout,d.instances,d.groups), choices=units.filter(u=>u.row===row);
|
|
35
|
+
const previous=m.columns[m.column]!.find(ref=>choices.some(u=>refKey(u.ref)===refKey(ref)));
|
|
36
|
+
const index=previous?choices.findIndex(u=>refKey(u.ref)===refKey(previous))+1:0;
|
|
37
|
+
const next=(index+(key==='left'?choices.length:1))%(choices.length+1);
|
|
38
|
+
m.columns[m.column]=m.columns[m.column]!.filter(ref=>!choices.some(u=>refKey(u.ref)===refKey(ref)));
|
|
39
|
+
if(next)m.columns[m.column]!.push(choices[next-1]!.ref);
|
|
40
|
+
} else if(key==='enter'&&m.cursor===rows+1) {m.columns.push([]);m.column=m.columns.length-1;m.cursor=1;}
|
|
41
|
+
else if(key==='enter'&&m.cursor===rows+2) {if(m.columns.length>1)m.columns.splice(m.column,1);else m.columns=[[]];m.column=Math.min(m.column,m.columns.length-1);}
|
|
42
|
+
else if(key==='enter'&&m.cursor===rows+3) {
|
|
43
|
+
try {
|
|
44
|
+
let id=m.selected??newInstance('text',d.instances).id;while(!m.selected&&values.some(v=>v.id===id))id=newInstance('text',d.instances).id;
|
|
45
|
+
e.draft={...e.draft,display:editAlignment(d,id,m.columns)};m.page='list';m.cursor=0;m.error=false;
|
|
46
|
+
}catch {m.error=true;}return null;
|
|
47
|
+
}
|
|
48
|
+
m.error=false;
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
export function alignmentsView(e:Editor,language:Language,width:number,height:number):{text:string;selected?:boolean}[] {
|
|
53
|
+
const m=e.alignmentManager!,d=e.draft.display,tr=(key:string)=>t('alignment.'+key,language),units=alignmentUnits(d.layout,d.instances,d.groups);
|
|
54
|
+
const label=(ref:AlignmentRef)=>{const u=units.find(u=>refKey(u.ref)===refKey(ref));return u?e.instanceLabel('main',ref.kind==='group'?d.groups.find(g=>g.id===ref.id)!.primary_id:ref.id,language)+(ref.kind==='group'?' · '+tr('group'):'')+' ('+ref.id+')':'—';};
|
|
55
|
+
const values=m.page==='list'?[...(d.layout.alignments??[]).map(v=>v.id+' · '+v.columns.length),tr('create')]:m.page==='actions'?[tr('edit'),tr('remove')]:
|
|
56
|
+
[tr('column')+': '+(m.column+1)+'/'+m.columns.length,...d.layout.rows.map((_,row)=>tr('row')+' '+(row+1)+': '+(m.columns[m.column]!.find(ref=>units.some(u=>u.row===row&&refKey(u.ref)===refKey(ref))) ? label(m.columns[m.column]!.find(ref=>units.some(u=>u.row===row&&refKey(u.ref)===refKey(ref)))!) : '—')),tr('add_column'),tr('remove_column'),tr('apply')];
|
|
57
|
+
const note=wrapText([tr(d.layout.mode!=='explicit'?'explicit':m.error?'invalid':'help')],width),capacity=Math.max(1,height-Math.min(2,note.length)),start=Math.max(0,m.cursor-capacity+1);
|
|
58
|
+
return [...values.slice(start,start+capacity).map((text,i)=>({text:(start+i===m.cursor?'› ':' ')+text,selected:start+i===m.cursor})),...note.slice(0,Math.max(0,height-Math.min(capacity,values.length))).map(text=>({text}))];
|
|
59
|
+
}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/alignments.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
/** Stable references to whole units; row positions are resolved from the current explicit layout. */
|
|
3
|
+
import type { AlignmentRef, DisplayDraft, GroupDraft, InstanceDraft, LayoutDraft } from '../generated-contracts.ts';
|
|
4
|
+
export interface AlignmentUnit { ref: AlignmentRef; ids: string[]; row: number; side: 'left' | 'right'; position: number }
|
|
5
|
+
export const refKey = (ref: AlignmentRef): string => ref.kind + ':' + ref.id;
|
|
6
|
+
const object = (v: unknown): v is Record<string, unknown> => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
7
|
+
const identifier = (v: unknown): v is string => typeof v === 'string' && /^[A-Za-z0-9][A-Za-z0-9_-]{0,95}$/u.test(v);
|
|
8
|
+
export function alignmentUnits(layout: LayoutDraft, nodes: readonly InstanceDraft[], groups: readonly GroupDraft[]): AlignmentUnit[] {
|
|
9
|
+
const byId = new Map(nodes.map(n => [n.id,n])), membership = new Map(groups.flatMap(g=>g.member_ids.map(id=>[id,g] as const)));
|
|
10
|
+
return layout.rows.flatMap((ids,row) => {
|
|
11
|
+
const seen = new Set<string>(), units: AlignmentUnit[] = []; let side: 'left' | 'right' = 'left';
|
|
12
|
+
for (const id of ids) {
|
|
13
|
+
if (byId.get(id)?.type_id === 'spacer') { side='right';continue; }
|
|
14
|
+
const group=membership.get(id); if(group && seen.has(group.id))continue;
|
|
15
|
+
if(group)seen.add(group.id);
|
|
16
|
+
units.push({ref:{kind:group?'group':'instance',id:group?.id??id},ids:group?[...group.member_ids]:[id],row,side,position:units.length});
|
|
17
|
+
}
|
|
18
|
+
return units;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export function validAlignments(value: unknown, layout: LayoutDraft, nodes: readonly InstanceDraft[], groups: readonly GroupDraft[]): boolean {
|
|
22
|
+
if(value === undefined)return true;
|
|
23
|
+
if(!Array.isArray(value)||value.length>nodes.length)return false;
|
|
24
|
+
if(!value.length)return true;
|
|
25
|
+
if(layout.mode!=='explicit')return false;
|
|
26
|
+
const units=new Map(alignmentUnits(layout,nodes,groups).map(u=>[refKey(u.ref),u])), used=new Set<string>(), ids=new Set<string>(), ownership=new Map<string,string>();
|
|
27
|
+
return value.every(alignment=>{
|
|
28
|
+
if(!object(alignment)||Object.keys(alignment).sort().join(',')!=='columns,id'||!identifier(alignment.id)||ids.has(alignment.id)||
|
|
29
|
+
!Array.isArray(alignment.columns)||!alignment.columns.length||alignment.columns.length>nodes.length)return false;
|
|
30
|
+
ids.add(alignment.id);const positions=new Map<string,number>();
|
|
31
|
+
return alignment.columns.every(column=>{
|
|
32
|
+
if(!Array.isArray(column)||column.length<2||column.length>layout.rows.length)return false;
|
|
33
|
+
const rows=new Set<number>();let side: string|undefined;
|
|
34
|
+
return column.every(ref=>{
|
|
35
|
+
if(!object(ref)||Object.keys(ref).sort().join(',')!=='id,kind'||!['instance','group'].includes(String(ref.kind))||!identifier(ref.id))return false;
|
|
36
|
+
const key=refKey(ref as unknown as AlignmentRef), unit=units.get(key);
|
|
37
|
+
if(!unit||used.has(key)||rows.has(unit.row)||side!==undefined&&unit.side!==side)return false;
|
|
38
|
+
const owner=unit.row+':'+unit.side, previous=positions.get(owner);
|
|
39
|
+
if(ownership.has(owner)&&ownership.get(owner)!==alignment.id||previous!==undefined&&previous>=unit.position)return false;
|
|
40
|
+
ownership.set(owner,alignment.id as string);positions.set(owner,unit.position);rows.add(unit.row);used.add(key);side=unit.side;return true;
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export function editAlignment(display: DisplayDraft, id: string, columns?: AlignmentRef[][]): DisplayDraft {
|
|
46
|
+
const result=JSON.parse(JSON.stringify(display)) as DisplayDraft, values=result.layout.alignments??[];
|
|
47
|
+
if(!identifier(id))throw new Error('alignment.invalid');
|
|
48
|
+
const index=values.findIndex(v=>v.id===id);
|
|
49
|
+
if(columns===undefined) { if(index<0)throw new Error('alignment.invalid');values.splice(index,1); }
|
|
50
|
+
else { const value={id,columns};if(index<0)values.push(value);else values[index]=value; }
|
|
51
|
+
result.layout.alignments=values;
|
|
52
|
+
if(!validAlignments(values,result.layout,result.instances,result.groups))throw new Error('alignment.invalid');
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
/** Identify relationships that a proposed structural edit would invalidate. */
|
|
56
|
+
export function alignmentConflicts(display: DisplayDraft): string[] {
|
|
57
|
+
const values = display.layout.alignments;
|
|
58
|
+
if (validAlignments(values, display.layout, display.instances, display.groups)) return [];
|
|
59
|
+
if (!Array.isArray(values)) return [];
|
|
60
|
+
const named = values.filter(value => object(value) && identifier(value.id));
|
|
61
|
+
const invalid = named.filter(value => !validAlignments([value], display.layout, display.instances, display.groups));
|
|
62
|
+
return (invalid.length ? invalid : named).map(value => value.id);
|
|
63
|
+
}
|
|
64
|
+
export function requireAlignments(display: DisplayDraft): void {
|
|
65
|
+
const ids = alignmentConflicts(display);
|
|
66
|
+
if (ids.length) throw new AlignmentReferenceError(ids);
|
|
67
|
+
}
|
|
68
|
+
export class AlignmentReferenceError extends Error {
|
|
69
|
+
constructor(readonly ids: string[]) { super('alignment.references'); }
|
|
70
|
+
}
|
|
71
|
+
export function parseAlignmentColumns(raw: string): AlignmentRef[][] {
|
|
72
|
+
return raw.split(';').map(column=>column.split(',').map(token=>{
|
|
73
|
+
const match=/^(instance|group):([A-Za-z0-9][A-Za-z0-9_-]{0,95})$/u.exec(token.trim());
|
|
74
|
+
if(!match)throw new Error('alignment.invalid');
|
|
75
|
+
return {kind:match[1] as AlignmentRef['kind'],id:match[2]!};
|
|
76
|
+
}));
|
|
77
|
+
}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/appearance.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import { GRADIENT_FIELDS } from './gradients.ts';
|
|
2
3
|
import { COST_RATE_FIELD } from './cost-rate.ts';
|
|
3
4
|
import { supportsIndicator, INDICATOR_FIELDS } from './indicators.ts';
|
|
4
5
|
/** Pure controls/validation from Python's scoped visibility capabilities. */
|
|
@@ -27,13 +28,13 @@ export function supportedFormats(scope: Scope, id: string, capability?: ItemCapa
|
|
|
27
28
|
|
|
28
29
|
export function itemFields(fields: EditorField[], scope: Scope, id: string, capability?: ItemCapability): EditorField[] {
|
|
29
30
|
if(id==='spacer')return [];
|
|
30
|
-
if(id==='text')return [{key:'text',label:'Literal text',group:'Item format',kind:'text',choices:[],minimum:0,maximum:256,nullable:false},
|
|
31
|
+
if(id==='text')return [...GRADIENT_FIELDS,{key:'text',label:'Literal text',group:'Item format',kind:'text',choices:[],minimum:0,maximum:256,nullable:false},
|
|
31
32
|
...fields.filter(f=>['label','icon','foreground','background','priority','max_width'].includes(f.key))];
|
|
32
33
|
const choices = capability?.visibility ?? visibilityChoices(scope, id);
|
|
33
34
|
const links: EditorField[] = capability?.link ? [{key:'link',label:'Links',group:'Item format',kind:'choice',choices:['off','auto','on'],minimum:0,maximum:0,nullable:false}] : [];
|
|
34
35
|
const formats = supportedFormats(scope, id, capability);
|
|
35
36
|
fields = fields.filter(field => !Object.hasOwn(FORMAT_CHOICES,field.key) || formats.includes(field.key));
|
|
36
|
-
return [...(scope === 'main' && id === 'session-cost-rate' ? [COST_RATE_FIELD] : []), ...(supportsIndicator(scope, id) ? INDICATOR_FIELDS : []), ...links, ...fields.filter(spec => (spec.key !== 'visibility' || choices.length > 1) &&
|
|
37
|
+
return [...GRADIENT_FIELDS, ...(scope === 'main' && id === 'session-cost-rate' ? [COST_RATE_FIELD] : []), ...(supportsIndicator(scope, id) ? INDICATOR_FIELDS : []), ...links, ...fields.filter(spec => (spec.key !== 'visibility' || choices.length > 1) &&
|
|
37
38
|
(spec.key !== 'visibility_threshold' || choices.includes('used-at-least')))
|
|
38
39
|
.map(spec => spec.key === 'visibility' ? {...spec, choices} : spec)];
|
|
39
40
|
}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import type { AlignmentManager } from './alignment-manager.ts';
|
|
2
3
|
import type { GroupManager } from './group-manager.ts';
|
|
3
4
|
import { reconcileGroups, insertionAfter } from './groups.ts';
|
|
4
5
|
import type { ExplanationView } from './explanation.ts';
|
|
5
6
|
import type { SourceManager } from './source-manager.ts';
|
|
6
7
|
import type { ProfileManager } from './profile-manager.ts';
|
|
7
8
|
import type { QuickSetup } from './quick-setup.ts';
|
|
8
|
-
import { t, type Language } from '../i18n/index.ts';
|
|
9
|
+
import { t, text, type Language } from '../i18n/index.ts';
|
|
10
|
+
import { alignmentConflicts } from './alignments.ts';
|
|
9
11
|
import { nodes, newInstance, reconcileRows } from './instances.ts';
|
|
10
12
|
import { isDraft } from '../backend.ts';
|
|
11
13
|
import type {
|
|
@@ -50,6 +52,8 @@ export class Editor {
|
|
|
50
52
|
profiles: ProfileManager | null = null;
|
|
51
53
|
sources: SourceManager | null = null;
|
|
52
54
|
groupManager: GroupManager | null = null;
|
|
55
|
+
alignmentManager: AlignmentManager | null = null;
|
|
56
|
+
compositionError: LocalizedText = text('composition.invalid');
|
|
53
57
|
preset = 'minimal';
|
|
54
58
|
path = 'statusline.json';
|
|
55
59
|
pendingTransfer: 'import' | 'export' | 'preset' | null = null;
|
|
@@ -95,7 +99,7 @@ export class Editor {
|
|
|
95
99
|
this.detail = null;
|
|
96
100
|
this.guidanceScroll = null;
|
|
97
101
|
this.explanation = null;
|
|
98
|
-
this.review = null;
|
|
102
|
+
this.review = null; this.alignmentManager = null;
|
|
99
103
|
}
|
|
100
104
|
|
|
101
105
|
get modified(): boolean {
|
|
@@ -153,6 +157,7 @@ export class Editor {
|
|
|
153
157
|
this.adding=false;this.pickerSaved=null;
|
|
154
158
|
}
|
|
155
159
|
instanceAction(scope: Scope, action:'add'|'copy'|'remove', typeId?:string): boolean {
|
|
160
|
+
this.compositionError = text('composition.invalid');
|
|
156
161
|
const draft=copyDraft(this.draft), list=nodes(draft,scope);
|
|
157
162
|
const selected=this.adding ? this.pickerSaved?.selected : this.selected[scope];
|
|
158
163
|
const index=list.findIndex(i=>i.id===selected);
|
|
@@ -168,7 +173,7 @@ export class Editor {
|
|
|
168
173
|
const target = scope === 'main' ? draft.display : draft.display.subagents;
|
|
169
174
|
target.groups = reconcileGroups(target.groups, list);
|
|
170
175
|
if(scope==='main')reconcileRows(draft);
|
|
171
|
-
if(!
|
|
176
|
+
if(!this.acceptStructure(draft))return false;
|
|
172
177
|
if(this.adding){this.closePicker(scope);this.search[scope]='';this.category[scope]='all';}
|
|
173
178
|
this.draft=draft;this.order[scope]=list.map(i=>i.id);this.selected[scope]=next;
|
|
174
179
|
return true;
|
|
@@ -197,6 +202,7 @@ export class Editor {
|
|
|
197
202
|
}
|
|
198
203
|
|
|
199
204
|
toggle(scope: Scope, id: string): boolean {
|
|
205
|
+
this.compositionError = text('composition.invalid');
|
|
200
206
|
if(this.adding)return this.instanceAction(scope,'add',id);
|
|
201
207
|
const draft=copyDraft(this.draft),node=nodes(draft,scope).find(i=>i.id===id);
|
|
202
208
|
if(!node)return false;
|
|
@@ -206,6 +212,7 @@ export class Editor {
|
|
|
206
212
|
}
|
|
207
213
|
|
|
208
214
|
move(scope: Scope, delta: -1 | 1): boolean {
|
|
215
|
+
this.compositionError = text('composition.invalid');
|
|
209
216
|
if (this.adding || this.filtered(scope)) return false;
|
|
210
217
|
const visible = this.visible(scope).map((item) => item.id as string);
|
|
211
218
|
const id = this.selected[scope];
|
|
@@ -218,12 +225,18 @@ export class Editor {
|
|
|
218
225
|
const [moving] = ordered.splice(sourceIndex, 1);
|
|
219
226
|
ordered.splice(ordered.findIndex(node => node.id === target) + (delta > 0 ? 1 : 0), 0, moving!);
|
|
220
227
|
if (scope === 'main') reconcileRows(draft);
|
|
221
|
-
if (!
|
|
228
|
+
if (!this.acceptStructure(draft)) return false;
|
|
222
229
|
this.draft = draft;
|
|
223
230
|
this.order[scope] = ordered.map(node => node.id);
|
|
224
231
|
return true;
|
|
225
232
|
}
|
|
226
233
|
|
|
234
|
+
private acceptStructure(draft: Draft): boolean {
|
|
235
|
+
const ids = alignmentConflicts(draft.display);
|
|
236
|
+
if (ids.length) this.compositionError = text('alignment.references', { ids: ids.join(', ') });
|
|
237
|
+
return isDraft(draft);
|
|
238
|
+
}
|
|
239
|
+
|
|
227
240
|
setBuffer(field: NumericField, value: string): void {
|
|
228
241
|
this.activeNumeric = field;
|
|
229
242
|
this.buffers[field] = value;
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/forms.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import { GRADIENT_KEYS, GRADIENT_DEFAULTS, GRADIENT_PRESETS, parseGradient, gradientName } from './gradients.ts';
|
|
3
|
+
import { alignmentConflicts } from './alignments.ts';
|
|
2
4
|
import { COST_RATE_DEFAULTS } from './cost-rate.ts';
|
|
3
5
|
import { INDICATOR_DEFAULTS } from './indicators.ts';
|
|
4
6
|
import { nodes } from './instances.ts';
|
|
@@ -57,7 +59,7 @@ function format(raw: unknown): string {
|
|
|
57
59
|
return raw === null ? 'inherit' : typeof raw === 'boolean' ? raw ? 'on' : 'off' : String(raw);
|
|
58
60
|
}
|
|
59
61
|
function row(spec: EditorField, key: string, valueRaw: unknown): FormRow {
|
|
60
|
-
return { ...spec, spec, key, valueRaw, value: format(valueRaw), editable: true };
|
|
62
|
+
return { ...spec, spec, key, valueRaw, value: (GRADIENT_KEYS as readonly string[]).includes(spec.key) ? gradientName(valueRaw) : format(valueRaw), editable: true };
|
|
61
63
|
}
|
|
62
64
|
export function formRows(view: FormView): FormRow[] {
|
|
63
65
|
const e = view.editor!;
|
|
@@ -66,7 +68,7 @@ export function formRows(view: FormView): FormRow[] {
|
|
|
66
68
|
const node = e.instance(e.detail.scope, e.detail.id)!;
|
|
67
69
|
const options = node.options;
|
|
68
70
|
return itemFields(e.description.editor_fields.item!, e.detail.scope, node.type_id, e.definition(e.detail.scope,node.id)?.capabilities).map((spec) => row(spec, 'item:' + spec.key, spec.key === 'text' ? node.text : spec.key === 'link' ? options.link ?? 'off' : spec.key in e.description.formatting_options ? options.formatting[spec.key] ?? 'inherit' :
|
|
69
|
-
options[spec.key as keyof typeof options] ?? INDICATOR_DEFAULTS[spec.key as keyof typeof INDICATOR_DEFAULTS] ?? COST_RATE_DEFAULTS[spec.key as keyof typeof COST_RATE_DEFAULTS] ?? ITEM_DEFAULTS[spec.key as keyof typeof ITEM_DEFAULTS]))
|
|
71
|
+
options[spec.key as keyof typeof options] ?? INDICATOR_DEFAULTS[spec.key as keyof typeof INDICATOR_DEFAULTS] ?? COST_RATE_DEFAULTS[spec.key as keyof typeof COST_RATE_DEFAULTS] ?? GRADIENT_DEFAULTS[spec.key as keyof typeof GRADIENT_DEFAULTS] ?? ITEM_DEFAULTS[spec.key as keyof typeof ITEM_DEFAULTS]))
|
|
70
72
|
.sort((a, b) => ['Item format', 'Conditional visibility', 'Item colors', 'Item fitting'].indexOf(a.group) - ['Item format', 'Conditional visibility', 'Item colors', 'Item fitting'].indexOf(b.group));
|
|
71
73
|
}
|
|
72
74
|
if (e.page === 'layout') {
|
|
@@ -109,9 +111,12 @@ export function setFormValue(view: FormView, current: FormRow, raw: string | boo
|
|
|
109
111
|
return false;
|
|
110
112
|
if (spec.key === "foreground" || spec.key === "background")
|
|
111
113
|
value = normalizeColor(value);
|
|
114
|
+
if ((GRADIENT_KEYS as readonly string[]).includes(spec.key)) {
|
|
115
|
+
try { value = parseGradient(value); } catch { setMessage(view, 'message', localizedText('gradients.invalid')); return false; }
|
|
116
|
+
}
|
|
112
117
|
const draft = copyDraft(e.draft);
|
|
113
118
|
if (current.key === 'layout.mode') {
|
|
114
|
-
draft.display.layout = { mode: value as 'auto' | 'explicit', rows: value === 'explicit' && draft.display.instances.length ? [draft.display.instances.map(i => i.id)] : [] };
|
|
119
|
+
draft.display.layout = { ...draft.display.layout, mode: value as 'auto' | 'explicit', rows: value === 'explicit' && draft.display.instances.length ? [draft.display.instances.map(i => i.id)] : [] };
|
|
115
120
|
}
|
|
116
121
|
else if (current.key.startsWith('break:')) {
|
|
117
122
|
const starts = new Set(draft.display.layout.rows.slice(1).map((r) => r[0]));
|
|
@@ -126,7 +131,7 @@ export function setFormValue(view: FormView, current: FormRow, raw: string | boo
|
|
|
126
131
|
rows.push([]);
|
|
127
132
|
rows[rows.length - 1]!.push(item);
|
|
128
133
|
}
|
|
129
|
-
draft.display.layout = { mode: 'explicit', rows };
|
|
134
|
+
draft.display.layout = { ...draft.display.layout, mode: 'explicit', rows };
|
|
130
135
|
}
|
|
131
136
|
else if (current.key.startsWith('fit:')) {
|
|
132
137
|
const [, id, key] = current.key.split(':');
|
|
@@ -148,7 +153,12 @@ export function setFormValue(view: FormView, current: FormRow, raw: string | boo
|
|
|
148
153
|
}
|
|
149
154
|
else
|
|
150
155
|
write(draft.display, spec.key, value);
|
|
156
|
+
const ids = alignmentConflicts(draft.display);
|
|
151
157
|
if (!isDraft(draft)) {
|
|
158
|
+
if (ids.length) {
|
|
159
|
+
setMessage(view, 'message', localizedText('alignment.references', { ids: ids.join(', ') }));
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
152
162
|
setMessage(view, "message", localizedText("native.lib.client.forms.invalid_value_check_thresholds_text_and_width_constraints"));
|
|
153
163
|
return false;
|
|
154
164
|
}
|
|
@@ -157,6 +167,10 @@ export function setFormValue(view: FormView, current: FormRow, raw: string | boo
|
|
|
157
167
|
}
|
|
158
168
|
export function adjustForm(view: FormView, current: FormRow, delta: -1 | 1): boolean {
|
|
159
169
|
const spec = current.spec;
|
|
170
|
+
if ((GRADIENT_KEYS as readonly string[]).includes(spec.key)) {
|
|
171
|
+
const choices = ['off', ...Object.keys(GRADIENT_PRESETS)], index = choices.indexOf(gradientName(current.valueRaw));
|
|
172
|
+
return setFormValue(view, current, choices[(index + delta + choices.length) % choices.length]!);
|
|
173
|
+
}
|
|
160
174
|
if (spec.kind === 'boolean')
|
|
161
175
|
return setFormValue(view, current, !current.valueRaw);
|
|
162
176
|
else if (spec.kind === 'choice') {
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/gradients.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
/** Presets are expanded into portable colors; saved gradients do not depend on a preset registry. */
|
|
3
|
+
import type { EditorField, GradientDraft } from '../generated-contracts.ts';
|
|
4
|
+
export const GRADIENT_PRESETS = {
|
|
5
|
+
ocean: ['#22d3ee', '#3b82f6'],
|
|
6
|
+
sunset: ['#fb923c', '#f472b6', '#a78bfa'],
|
|
7
|
+
aurora: ['#34d399', '#22d3ee', '#a78bfa'],
|
|
8
|
+
} as const;
|
|
9
|
+
export const GRADIENT_KEYS = ['foreground_gradient', 'background_gradient'] as const;
|
|
10
|
+
export const GRADIENT_DEFAULTS = { foreground_gradient: null, background_gradient: null };
|
|
11
|
+
export const GRADIENT_FIELDS: EditorField[] = GRADIENT_KEYS.map(key => ({
|
|
12
|
+
key, label: key === 'foreground_gradient' ? 'Foreground gradient' : 'Powerline background gradient',
|
|
13
|
+
group: 'Item colors', kind: 'text', choices: [], minimum: 0, maximum: 256, nullable: true,
|
|
14
|
+
}));
|
|
15
|
+
export function validGradient(value: unknown): value is GradientDraft | null {
|
|
16
|
+
return value === null || Array.isArray(value) && value.length >= 2 && value.length <= 5 &&
|
|
17
|
+
[...value].every(color => typeof color === 'string' && /^#[0-9a-f]{6}$/iu.test(color));
|
|
18
|
+
}
|
|
19
|
+
export function parseGradient(value: unknown): GradientDraft | null {
|
|
20
|
+
if (value === null || value === 'off' || value === 'inherit' || value === 'none') return null;
|
|
21
|
+
if (typeof value === 'string') value = Object.hasOwn(GRADIENT_PRESETS, value)
|
|
22
|
+
? [...GRADIENT_PRESETS[value as keyof typeof GRADIENT_PRESETS]] : value.split(',').map(color => color.trim());
|
|
23
|
+
if (!validGradient(value)) throw new Error('gradients.invalid');
|
|
24
|
+
return value?.map(color => color.toLowerCase()) ?? null;
|
|
25
|
+
}
|
|
26
|
+
export function gradientName(value: unknown): string {
|
|
27
|
+
if (value == null) return 'off';
|
|
28
|
+
return Object.entries(GRADIENT_PRESETS).find(([, colors]) => JSON.stringify(colors) === JSON.stringify(value))?.[0] ?? String(value);
|
|
29
|
+
}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/group-manager.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import type { Editor } from './draft.ts';
|
|
4
4
|
import type { GroupDraft, Scope } from '../generated-contracts.ts';
|
|
5
5
|
import type { TextKey } from './text-input.ts';
|
|
6
|
-
import { t, type Language } from '../i18n/index.ts';
|
|
6
|
+
import { t, text, renderMessage, type LocalizedText, type Language } from '../i18n/index.ts';
|
|
7
|
+
import { AlignmentReferenceError } from './alignments.ts';
|
|
7
8
|
import { editGroup, groupScope, type GroupEdit } from './groups.ts';
|
|
8
9
|
import { newInstance } from './instances.ts';
|
|
9
10
|
import { isDraft } from '../backend.ts';
|
|
@@ -12,6 +13,7 @@ import { wrapText } from '../../ui/text.ts';
|
|
|
12
13
|
export interface GroupManager {
|
|
13
14
|
scope: Scope; page: 'list' | 'actions' | 'form'; cursor: number; selected: string | null;
|
|
14
15
|
first: string; last: string; primary: string; linked: boolean; shared: boolean; error: boolean;
|
|
16
|
+
errorMessage?: LocalizedText;
|
|
15
17
|
}
|
|
16
18
|
export function openGroups(e: Editor): void {
|
|
17
19
|
e.groupManager = { scope: e.detail?.scope ?? (e.page === 'subagents' ? 'subagent' : 'main'), page: 'list', cursor: 0, selected: null,
|
|
@@ -35,7 +37,7 @@ function apply(e: Editor, edit: GroupEdit): void {
|
|
|
35
37
|
if (!isDraft({ ...e.draft, display })) throw new Error('invalid');
|
|
36
38
|
e.draft = { ...e.draft, display }; e.order[m.scope] = groupScope(display, m.scope).instances.map(n => n.id);
|
|
37
39
|
m.page = 'list'; m.cursor = 0; m.error = false;
|
|
38
|
-
} catch { m.error = true; }
|
|
40
|
+
} catch (error) { m.error = true; m.errorMessage = error instanceof AlignmentReferenceError ? text('alignment.references', { ids: error.ids.join(', ') }) : undefined; }
|
|
39
41
|
}
|
|
40
42
|
export function groupsKey(e: Editor, event: TextKey): null {
|
|
41
43
|
const m = e.groupManager!;
|
|
@@ -96,7 +98,7 @@ export function groupsView(e: Editor, language: Language, width: number, height:
|
|
|
96
98
|
: m.page === 'actions' ? actions.map(tr)
|
|
97
99
|
: [tr('first') + ': ' + label(m.first), tr('last') + ': ' + label(m.last), tr('primary') + ': ' + label(m.primary),
|
|
98
100
|
tr('linked') + ': ' + t('values.' + (m.linked ? 'on' : 'off'), language), tr('shared') + ': ' + t('values.' + (m.shared ? 'on' : 'off'), language), tr('apply')];
|
|
99
|
-
const note = wrapText([tr(m.error ? 'invalid' : 'help')], width), capacity = Math.max(1, height - Math.min(2, note.length));
|
|
101
|
+
const note = wrapText([m.error && m.errorMessage ? renderMessage(m.errorMessage, language) : tr(m.error ? 'invalid' : 'help')], width), capacity = Math.max(1, height - Math.min(2, note.length));
|
|
100
102
|
const start = Math.max(0, m.cursor - capacity + 1);
|
|
101
103
|
return [...values.slice(start, start + capacity).map((text, i) => ({ text: (start + i === m.cursor ? '› ' : ' ') + text, selected: start + i === m.cursor })), ...note.slice(0, Math.max(0, height - Math.min(capacity, values.length))).map(text => ({ text }))];
|
|
102
104
|
}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/groups.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
2
|
/** Pure grouping rules shared by configuration services and both editors. */
|
|
3
3
|
import type { DisplayDraft, GroupDraft, InstanceDraft, LayoutDraft, Scope } from '../generated-contracts.ts';
|
|
4
|
+
import { requireAlignments } from './alignments.ts';
|
|
4
5
|
|
|
5
6
|
const object = (v: unknown): v is Record<string, unknown> => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
6
7
|
const id = (v: unknown): v is string => typeof v === 'string' && /^[A-Za-z0-9][A-Za-z0-9_-]{0,95}$/.test(v);
|
|
@@ -85,5 +86,6 @@ export function editGroup(original: DisplayDraft, scope: Scope, edit: GroupEdit,
|
|
|
85
86
|
} else invalid();
|
|
86
87
|
}
|
|
87
88
|
if (!validGroups(target.groups, target.instances, scope === 'main' ? display.layout : undefined)) invalid();
|
|
89
|
+
if (scope === 'main') requireAlignments(display);
|
|
88
90
|
return display;
|
|
89
91
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import type { Draft, ImportChange, Scope } from '../generated-contracts.ts';
|
|
3
|
+
import { text, t } from '../i18n/index.ts';
|
|
4
|
+
const clone = <T>(value: T): T => JSON.parse(JSON.stringify(value)) as T;
|
|
5
|
+
const object = (value: unknown): value is Record<string, unknown> => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
6
|
+
const scalarCompare = (a: string, b: string) => a < b ? -1 : a > b ? 1 : 0;
|
|
7
|
+
const canonical = (value: unknown): string => Array.isArray(value) ? '[' + value.map(canonical).join(',') + ']' : object(value) ? '{' + Object.keys(value).sort(scalarCompare).map(key => JSON.stringify(key) + ':' + canonical(value[key])).join(',') + '}' : JSON.stringify(value);
|
|
8
|
+
|
|
9
|
+
export const SECTIONS = ['main', 'subagent', 'formatting', 'layout', 'language', 'host'] as const;
|
|
10
|
+
export const KINDS = ['add', 'remove', 'enable', 'disable', 'reorder', 'change'] as const;
|
|
11
|
+
|
|
12
|
+
function fieldMessage(path: string[]) {
|
|
13
|
+
if (path.includes('groups')) return text('composition.groups.title');
|
|
14
|
+
if (path.includes('source')) return text('sources.title');
|
|
15
|
+
let key: string;
|
|
16
|
+
if (path.includes('options')) {
|
|
17
|
+
const tail = path.slice(path.indexOf('options') + 1), name = tail.at(-1) ?? 'overrides';
|
|
18
|
+
key = name === 'overrides' ? 'review.overrides' : 'fields.item.' + name + '.label';
|
|
19
|
+
} else if (path[0] === 'host') key = 'review.fields.' + path.at(-1);
|
|
20
|
+
else if (path.length === 2 && ['use_colors', 'palette', 'directory_style', 'separator_style', 'scope_labels', 'layout'].includes(path[1]!)) key = 'review.fields.' + path[1];
|
|
21
|
+
else if (path.join('.') === 'display.subagents.enabled') key = 'review.fields.subagents_enabled';
|
|
22
|
+
else key = 'fields.global.' + path.slice(1).join('.') + '.label';
|
|
23
|
+
return t(key) === key ? text('review.field', { path: path.join('.') }) : text(key);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function differences(before: Draft, after: Draft): ImportChange[] {
|
|
27
|
+
const changes: ImportChange[] = [];
|
|
28
|
+
function add(section: ImportChange['section'], kind: ImportChange['kind'], scope: Scope | null, identifier: string | null,
|
|
29
|
+
path: string[], old: unknown, next: unknown, typeId?: string) {
|
|
30
|
+
let label = text('review.component', { item: identifier || path.join('.') });
|
|
31
|
+
if (identifier && typeId) {
|
|
32
|
+
const item = text(`items.${scope}.${typeId}.label`);
|
|
33
|
+
label = ['enable', 'disable', 'add', 'remove'].includes(kind) ? text('review.' + kind, { item }) : text('review.item_field', { item, field: fieldMessage(path) });
|
|
34
|
+
} else if (kind === 'reorder') label = text('review.reorder');
|
|
35
|
+
else if (kind === 'change') label = fieldMessage(path);
|
|
36
|
+
changes.push({ section, kind, scope, item_id: identifier, path, before: clone(old), after: clone(next), label });
|
|
37
|
+
}
|
|
38
|
+
function walk(old: unknown, next: unknown, path: string[], section: ImportChange['section'], scope: Scope | null = null, identifier: string | null = null, typeId?: string) {
|
|
39
|
+
if (canonical(old) === canonical(next)) return;
|
|
40
|
+
if (object(old) && object(next)) {
|
|
41
|
+
for (const key of [...new Set([...Object.keys(old), ...Object.keys(next)])].sort(scalarCompare)) {
|
|
42
|
+
walk(old[key] ?? null, next[key] ?? null, [...path, key], section, scope, identifier, typeId);
|
|
43
|
+
}
|
|
44
|
+
} else add(section, 'change', scope, identifier, path, old, next, typeId);
|
|
45
|
+
}
|
|
46
|
+
const old = before.display, next = after.display;
|
|
47
|
+
for (const scope of ['main', 'subagent'] as const) {
|
|
48
|
+
const left = scope === 'main' ? old : old.subagents, right = scope === 'main' ? next : next.subagents;
|
|
49
|
+
const root = scope === 'main' ? ['display'] : ['display', 'subagents'];
|
|
50
|
+
const a = new Map(left.instances.map(node => [node.id, node])), b = new Map(right.instances.map(node => [node.id, node]));
|
|
51
|
+
for (const id of new Set([...a.keys(), ...b.keys()])) {
|
|
52
|
+
const previous = a.get(id), following = b.get(id), node = following ?? previous!;
|
|
53
|
+
const path = [...root, 'instances', id];
|
|
54
|
+
if (!previous || !following) { add(scope, following ? 'add' : 'remove', scope, id, path, previous ?? null, following ?? null, node.type_id); continue; }
|
|
55
|
+
if (previous.enabled !== following.enabled) add(scope, following.enabled ? 'enable' : 'disable', scope, id, [...path, 'enabled'], previous.enabled, following.enabled, node.type_id);
|
|
56
|
+
for (const key of ['type_id', 'options', 'text', 'source'] as const) walk(previous[key] ?? null, following[key] ?? null, [...path, key], key === 'options' ? 'formatting' : scope, scope, id, node.type_id);
|
|
57
|
+
}
|
|
58
|
+
const leftOrder = [...a.keys()].filter(id => b.has(id)), rightOrder = [...b.keys()].filter(id => a.has(id));
|
|
59
|
+
if (canonical(leftOrder) !== canonical(rightOrder)) add(scope, 'reorder', scope, null, [...root, 'instances'], leftOrder, rightOrder);
|
|
60
|
+
}
|
|
61
|
+
for (const key of Object.keys(old).filter(key => !['schema_version', 'instances', 'subagents', 'layout', 'statusline_language', 'metrics'].includes(key)).sort(scalarCompare)) {
|
|
62
|
+
walk(old[key as keyof typeof old], next[key as keyof typeof next], ['display', key], 'formatting');
|
|
63
|
+
}
|
|
64
|
+
for (const key of Object.keys(old.subagents).filter(key => key !== 'instances').sort(scalarCompare)) {
|
|
65
|
+
walk(old.subagents[key as keyof typeof old.subagents], next.subagents[key as keyof typeof next.subagents], ['display', 'subagents', key], 'subagent');
|
|
66
|
+
}
|
|
67
|
+
walk(old.metrics, next.metrics, ['display', 'metrics'], 'main');
|
|
68
|
+
walk(old.layout, next.layout, ['display', 'layout'], 'layout');
|
|
69
|
+
walk(old.statusline_language, next.statusline_language, ['display', 'statusline_language'], 'language');
|
|
70
|
+
walk(before.host, after.host, ['host'], 'host');
|
|
71
|
+
return changes.sort((a, b) => SECTIONS.indexOf(a.section) - SECTIONS.indexOf(b.section));
|
|
72
|
+
}
|