@fbincon/claude-code-statusline 3.8.0 → 3.9.1
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 +92 -80
- package/candidate.json +336 -254
- 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/help.js +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/help.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/management/integration.js +12 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/management/integration.js.map +1 -1
- 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/ui/protocol.d.ts +437 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js +27 -7
- 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 +86 -20
- 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 +240 -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 +28 -88
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +31 -25
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +13 -6
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/help.ts +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/surface.ts +16 -13
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/components/preview.ts +9 -5
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/components/section.ts +11 -7
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/components/shortcuts.ts +5 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/frame.ts +72 -0
- 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 +234 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +240 -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.js +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.js.map +1 -1
- 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/resources/i18n/locales/en.json +40 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +40 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +40 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +40 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +40 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +40 -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 +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/session.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 +3 -3
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
|
+
}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/import-review.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
-
import type { ImportReviewResult, Scope } from '../generated-contracts.ts';
|
|
2
|
+
import type { Draft, ImportReviewResult, Scope } from '../generated-contracts.ts';
|
|
3
|
+
import { IMPORT_FIELDS, selectImport, type ImportField } from './import-selection.ts';
|
|
4
|
+
import { differences } from './import-differences.ts';
|
|
3
5
|
import type { Language } from '../i18n/index.ts';
|
|
4
6
|
import { renderMessage, t } from '../i18n/index.ts';
|
|
5
7
|
import { wrapText } from '../../ui/text.ts';
|
|
@@ -11,17 +13,25 @@ export interface ReviewState {
|
|
|
11
13
|
expanded: string[];
|
|
12
14
|
scroll: number;
|
|
13
15
|
previewScope: Scope;
|
|
16
|
+
base?: Draft;
|
|
17
|
+
incoming?: ImportReviewResult;
|
|
18
|
+
choosing?: boolean;
|
|
19
|
+
selection?: ImportField[];
|
|
20
|
+
cursor?: number;
|
|
14
21
|
}
|
|
15
22
|
export interface ReviewRow { text: string; section: string; heading: boolean }
|
|
16
23
|
export function sections(review: ReviewState): string[] {
|
|
17
24
|
return REVIEW_SECTIONS.filter(section => review.result.changes.some(change => change.section === section));
|
|
18
25
|
}
|
|
19
|
-
export function createReview(result: ImportReviewResult): ReviewState {
|
|
26
|
+
export function createReview(result: ImportReviewResult, base?: Draft): ReviewState {
|
|
20
27
|
const review: ReviewState = {result, selected:'', expanded:[], scroll:0, previewScope:'main'};
|
|
28
|
+
if (base) Object.assign(review, { base: JSON.parse(JSON.stringify(base)), incoming: result, selection: [], cursor: 0 });
|
|
21
29
|
review.selected = sections(review)[0] ?? '';
|
|
22
30
|
return review;
|
|
23
31
|
}
|
|
24
32
|
export function reviewRows(review: ReviewState, language: Language, width: number): ReviewRow[] {
|
|
33
|
+
if (review.choosing) return IMPORT_FIELDS.map((key, index) => ({ heading: true, section: key,
|
|
34
|
+
text: `${review.cursor === index ? '› ' : ' '}[${review.selection?.includes(key) ? 'x' : ' '}] ${selectionLabel(key, language)}` }));
|
|
25
35
|
const rows: ReviewRow[] = [];
|
|
26
36
|
for (const section of sections(review)) {
|
|
27
37
|
const changes = review.result.changes.filter(change => change.section === section);
|
|
@@ -36,6 +46,32 @@ export function reviewRows(review: ReviewState, language: Language, width: numbe
|
|
|
36
46
|
return rows.length ? rows : [{text:t('review.empty', language),section:'',heading:false}];
|
|
37
47
|
}
|
|
38
48
|
export function navigateReview(review: ReviewState, key: string, language: Language, width: number, capacity: number): void {
|
|
49
|
+
if (review.base && review.incoming && key.toLowerCase() === 's') {
|
|
50
|
+
review.choosing = true; review.scroll = 0; review.cursor = 0; review.selected = IMPORT_FIELDS[0];
|
|
51
|
+
updateSelection(review); return;
|
|
52
|
+
}
|
|
53
|
+
if (review.base && review.incoming && key.toLowerCase() === 'f') {
|
|
54
|
+
review.choosing = false; review.result = review.incoming; review.selected = sections(review)[0] ?? ''; review.scroll = 0; return;
|
|
55
|
+
}
|
|
56
|
+
if (review.choosing) {
|
|
57
|
+
let cursor = review.cursor ?? 0;
|
|
58
|
+
if (key === 'up') cursor--;
|
|
59
|
+
if (key === 'down') cursor++;
|
|
60
|
+
if (key === 'home') cursor = 0;
|
|
61
|
+
if (key === 'end') cursor = IMPORT_FIELDS.length - 1;
|
|
62
|
+
if (key === 'pageup') cursor -= capacity;
|
|
63
|
+
if (key === 'pagedown') cursor += capacity;
|
|
64
|
+
review.cursor = Math.max(0, Math.min(IMPORT_FIELDS.length - 1, cursor));
|
|
65
|
+
review.selected = IMPORT_FIELDS[review.cursor]!;
|
|
66
|
+
if (key === 'space' || key === ' ') {
|
|
67
|
+
const field = IMPORT_FIELDS[review.cursor]!, values = review.selection ?? [];
|
|
68
|
+
review.selection = values.includes(field) ? values.filter(v => v !== field) : [...values, field]; updateSelection(review);
|
|
69
|
+
}
|
|
70
|
+
if (key === 'return' || key === 'enter') { review.choosing = false; review.selected = sections(review)[0] ?? ''; review.scroll = 0; }
|
|
71
|
+
else review.scroll = Math.max(0, Math.min(review.scroll, review.cursor));
|
|
72
|
+
if (review.choosing && review.cursor >= review.scroll + capacity) review.scroll = review.cursor - capacity + 1;
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
39
75
|
const groups = sections(review);
|
|
40
76
|
let follow = false;
|
|
41
77
|
if (key === 'up' || key === 'down') {
|
|
@@ -53,3 +89,14 @@ export function navigateReview(review: ReviewState, key: string, language: Langu
|
|
|
53
89
|
if (follow) review.scroll = Math.max(0, rows.findIndex(row => row.heading && row.section === review.selected));
|
|
54
90
|
review.scroll = Math.max(0, Math.min(Math.max(0, rows.length - capacity), review.scroll));
|
|
55
91
|
}
|
|
92
|
+
|
|
93
|
+
function updateSelection(review: ReviewState): void {
|
|
94
|
+
const draft = selectImport(review.base!, review.incoming!.draft, review.selection ?? []);
|
|
95
|
+
review.result = { draft, changes: differences(review.base!, draft) };
|
|
96
|
+
}
|
|
97
|
+
function selectionLabel(key: ImportField, language: Language): string {
|
|
98
|
+
if (key === 'main' || key === 'subagent') return t('review.selection.' + key, language);
|
|
99
|
+
if (key === 'formatting.thresholds') return t('review.selection.thresholds', language);
|
|
100
|
+
const message = ['use_colors','palette','directory_style','separator_style','scope_labels'].includes(key) ? 'review.fields.' + key : 'fields.global.' + key + '.label';
|
|
101
|
+
return t(message, language);
|
|
102
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
/** Frozen selection vocabulary. New display fields require an explicit selection decision. */
|
|
3
|
+
import type { Draft } from '../generated-contracts.ts';
|
|
4
|
+
|
|
5
|
+
export const IMPORT_FIELDS = [
|
|
6
|
+
'main', 'subagent', 'use_colors', 'palette', 'theme', 'directory_style', 'separator_style', 'scope_labels',
|
|
7
|
+
'powerline_glyph', 'powerline.padding', 'powerline.separator', 'powerline.start_cap', 'powerline.end_cap', 'powerline.color_mode',
|
|
8
|
+
'statusline_language', 'formatting.model_name', 'formatting.number_format', 'formatting.labels', 'formatting.icons',
|
|
9
|
+
'formatting.allowance', 'formatting.reset_format', 'formatting.reset_timezone', 'formatting.thresholds',
|
|
10
|
+
] as const;
|
|
11
|
+
export type ImportField = typeof IMPORT_FIELDS[number];
|
|
12
|
+
export function importSelection(value: unknown): ImportField[] {
|
|
13
|
+
if (!Array.isArray(value) || value.some(key => !IMPORT_FIELDS.includes(key)) || new Set(value).size !== value.length)
|
|
14
|
+
throw new Error('review.selection.invalid');
|
|
15
|
+
return IMPORT_FIELDS.filter(key => value.includes(key));
|
|
16
|
+
}
|
|
17
|
+
const copy = <T>(value: T): T => JSON.parse(JSON.stringify(value)) as T;
|
|
18
|
+
|
|
19
|
+
/** Inputs have already passed full schema/reference validation. Scopes own independent ID namespaces. */
|
|
20
|
+
export function selectImport(base: Draft, incoming: Draft, requested: unknown): Draft {
|
|
21
|
+
const selection = importSelection(requested), result = copy(base), source = copy(incoming.display);
|
|
22
|
+
// Only imported scopes lose local bindings; retained scopes remain untouched.
|
|
23
|
+
for (const area of [source, source.subagents]) for (const node of area.instances)
|
|
24
|
+
if (node.source) node.source.binding = null;
|
|
25
|
+
for (const key of selection) {
|
|
26
|
+
if (key === 'main') {
|
|
27
|
+
result.display.instances = source.instances; result.display.groups = source.groups;
|
|
28
|
+
result.display.layout = source.layout; result.display.metrics = source.metrics;
|
|
29
|
+
} else if (key === 'subagent') result.display.subagents = source.subagents;
|
|
30
|
+
else {
|
|
31
|
+
const parts = key.split('.');
|
|
32
|
+
let target = result.display as unknown as Record<string, unknown>, origin = source as unknown as Record<string, unknown>;
|
|
33
|
+
for (const part of parts.slice(0, -1)) { target = target[part] as Record<string, unknown>; origin = origin[part] as Record<string, unknown>; }
|
|
34
|
+
target[parts.at(-1)!] = origin[parts.at(-1)!];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import { createReview, navigateReview } from './import-review.ts';
|
|
3
|
+
import { differences } from './import-differences.ts';
|
|
2
4
|
import type { ConfigTarget, DisplayDraft, Operation, ProfilesResult, ResultFor } from '../generated-contracts.ts';
|
|
3
5
|
import { t, text, type Language, type LocalizedText } from '../i18n/index.ts';
|
|
4
6
|
import type { Editor } from './draft.ts';
|
|
@@ -6,10 +8,10 @@ import { inputKey, inputView, textInput, type TextInput, type TextKey } from './
|
|
|
6
8
|
import { wrapText } from '../../ui/text.ts';
|
|
7
9
|
import { BackendError } from '../backend.ts';
|
|
8
10
|
|
|
9
|
-
type Action = 'edit' | 'activate' | 'save' | 'save_bind' | 'rename' | 'delete' | 'bind' | 'unbind' | 'import' | 'export';
|
|
11
|
+
type Action = 'edit' | 'activate' | 'save' | 'save_bind' | 'rename' | 'delete' | 'bind' | 'unbind' | 'import' | 'reuse' | 'export';
|
|
10
12
|
type Switch = { target: ConfigTarget; display?: DisplayDraft };
|
|
11
13
|
type Effect = { kind: 'load' } | { kind: 'switch'; next: Switch; save: boolean } |
|
|
12
|
-
{ kind: 'mutation'; payload: Record<string, unknown> } | { kind: 'import'; path: string } |
|
|
14
|
+
{ kind: 'mutation'; payload: Record<string, unknown> } | { kind: 'import'; path: string } | { kind: 'reuse'; path: string } |
|
|
13
15
|
{ kind: 'export'; path: string; name: string; display: DisplayDraft; overwrite: boolean };
|
|
14
16
|
export interface ProfileManager {
|
|
15
17
|
library: ProfilesResult | null;
|
|
@@ -49,7 +51,7 @@ function entries(m: ProfileManager): { key: string; label: string; raw?: boolean
|
|
|
49
51
|
if (m.page === 'actions') return ['edit','activate','rename','delete','bind','export'].map(key => ({ key, label: 'profiles.action.' + key }));
|
|
50
52
|
return [{ key: 'user', label: 'profiles.user' }, ...(m.library?.profiles ?? []).map(p => ({ key: p.id, label: p.name, raw: true })),
|
|
51
53
|
...(m.library?.bindings ?? []).map(b=>({key:'binding:'+b.root,label:b.root+' → '+(m.library!.profiles.find(p=>p.id===b.profile_id)?.name ?? b.profile_id),raw:true})),
|
|
52
|
-
...['save','save_bind','import','unbind'].map(key => ({ key: 'action:' + key, label: 'profiles.action.' + key }))];
|
|
54
|
+
...['save','save_bind','import','unbind','reuse'].map(key => ({ key: 'action:' + key, label: 'profiles.action.' + key }))];
|
|
53
55
|
}
|
|
54
56
|
function startForm(e: Editor, action: Action): void {
|
|
55
57
|
const m = e.profiles!, profile = m.library?.profiles.find(p => p.id === m.selected), project = e.baseline.configuration;
|
|
@@ -67,7 +69,7 @@ function submitForm(e: Editor): void {
|
|
|
67
69
|
const m = e.profiles!, values = Object.fromEntries(m.fields.map(f => [f.key, f.input.value]));
|
|
68
70
|
const profile = m.library?.profiles.find(p => p.id === m.selected);
|
|
69
71
|
if (m.fields.some(f => !f.input.value.trim())) { m.message = text('profiles.required'); return; }
|
|
70
|
-
if (m.action === 'import') { m.effect = { kind:
|
|
72
|
+
if (m.action === 'import' || m.action === 'reuse') { m.effect = { kind: m.action, path: values.path! }; return; }
|
|
71
73
|
if (m.action === 'export' && profile) {
|
|
72
74
|
m.confirmation = { kind: 'export', path: values.path!, name: profile.name, display: profile.display, overwrite: false };
|
|
73
75
|
} else {
|
|
@@ -181,8 +183,15 @@ export async function performProfileAction(e: Editor, backend: ProfileBackend):
|
|
|
181
183
|
if (effect.next.display) e.replaceDraft({ ...current.draft, display: JSON.parse(JSON.stringify(effect.next.display)) as DisplayDraft });
|
|
182
184
|
e.profiles = null; return;
|
|
183
185
|
}
|
|
184
|
-
if (effect.kind === 'import') {
|
|
186
|
+
if (effect.kind === 'import' || effect.kind === 'reuse') {
|
|
187
|
+
const original = JSON.stringify(e.draft);
|
|
185
188
|
const result = await backend.request('profile_import', { path: effect.path });
|
|
189
|
+
if (effect.kind === 'reuse') {
|
|
190
|
+
if (JSON.stringify(e.draft) !== original || e.profiles !== m) throw new BackendError('stale_import', text('review.stale'));
|
|
191
|
+
const draft = { display: result.display, host: e.draft.host };
|
|
192
|
+
e.review = createReview({ draft, changes: differences(e.draft, draft) }, e.draft);
|
|
193
|
+
navigateReview(e.review, 's', 'en', 80, 20); e.profiles = null; return;
|
|
194
|
+
}
|
|
186
195
|
m.candidate = result.display; startForm(e, 'save'); m.fields[0]!.input = textInput(result.name);
|
|
187
196
|
m.message = text('profiles.import_review'); return;
|
|
188
197
|
}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
-
export const PROTOCOL_VERSION =
|
|
2
|
+
export const PROTOCOL_VERSION = 24 as const;
|
|
3
3
|
export const ITEM_DEFAULTS = {"label": null, "icon": null, "priority": 50, "max_width": null, "formatting": {}, "foreground": null, "background": null, "visibility": "always", "visibility_threshold": 70};
|
|
4
4
|
export const VISIBILITY_ITEMS = {"main": {"git": "git-dirty", "git-changes": "git-dirty", "active-agents": "nonzero", "task-progress": "nonzero", "context-used": "used-at-least", "context-remaining": "used-at-least", "five-hour-limit": "used-at-least", "weekly-limit": "used-at-least", "spend-limit": "used-at-least"}, "subagent": {"context-used": "used-at-least", "context-remaining": "used-at-least"}} as const;
|
|
5
5
|
export const GUIDANCE_KEYS = {"source_kinds": ["configuration", "official_input", "local_git", "local_system", "transcript", "local_state", "lifecycle", "native_timing", "live_metrics", "telemetry"], "scopes": ["main", "main_context", "session", "all_sessions", "task", "subagent", "subagent_context", "repository", "local", "latest_request"], "requirements": ["observed_field", "subagent_rows", "agent_context", "configured_effort", "agent_effort_optional", "git_repository", "git_upstream", "git_base", "pull_request", "worktree_session", "usage_records", "task_observation", "native_timing", "complete_waits", "live_metrics", "owned_agents", "checklist_events", "tool_events", "complete_stream", "request_coverage", "existing_telemetry", "gateway", "gateway_284", "valid_window", "warm_cache", "fast_mode", "thinking", "agent_mode", "vim_mode", "context_observation", "cost_rate"]} as const;
|
|
@@ -600,7 +600,10 @@ export interface FormattingDraft {
|
|
|
600
600
|
reset_timezone: "local" | "UTC";
|
|
601
601
|
thresholds: ThresholdDraft;
|
|
602
602
|
}
|
|
603
|
+
export type GradientDraft = string[];
|
|
603
604
|
export interface ItemOptionsDraft {
|
|
605
|
+
foreground_gradient?: GradientDraft | null;
|
|
606
|
+
background_gradient?: GradientDraft | null;
|
|
604
607
|
presentation?: "numeric" | "bar";
|
|
605
608
|
bar_width?: number;
|
|
606
609
|
cost_rate_basis?: 'session' | 'api';
|
|
@@ -627,7 +630,10 @@ export interface InstanceDraft {
|
|
|
627
630
|
export interface GroupDraft {
|
|
628
631
|
id: string; member_ids: string[]; primary_id: string; link_visibility: boolean; shared_powerline: boolean;
|
|
629
632
|
}
|
|
633
|
+
export interface AlignmentRef { kind: 'instance' | 'group'; id: string }
|
|
634
|
+
export interface AlignmentDraft { id: string; columns: AlignmentRef[][] }
|
|
630
635
|
export interface LayoutDraft {
|
|
636
|
+
alignments?: AlignmentDraft[];
|
|
631
637
|
mode: "auto" | "explicit";
|
|
632
638
|
rows: string[][];
|
|
633
639
|
}
|
|
@@ -652,7 +658,7 @@ export interface PowerlineDraft {
|
|
|
652
658
|
}
|
|
653
659
|
export interface DisplayDraft {
|
|
654
660
|
groups: GroupDraft[];
|
|
655
|
-
schema_version:
|
|
661
|
+
schema_version: 15;
|
|
656
662
|
statusline_language: StatuslineLanguage;
|
|
657
663
|
instances: InstanceDraft[];
|
|
658
664
|
use_colors: boolean;
|
|
@@ -748,7 +754,7 @@ export interface PreviewResult {
|
|
|
748
754
|
}
|
|
749
755
|
export const SAMPLE_REASONS = ['sample_group_hidden','sample_visible','sample_empty','sample_condition_hidden','sample_truncated','sample_priority_omitted','sample_width_omitted','sample_row_hidden','sample_spacer'] as const;
|
|
750
756
|
export type SampleReason = typeof SAMPLE_REASONS[number];
|
|
751
|
-
export const EXPLAIN_REASONS = ['cost_rate_session','cost_rate_api','indicator_bar','source_bound','source_unbound','configured_on','configured_off','scope_disabled','installation_owned','installation_absent','installation_foreign','installation_unknown','unknown_host_version','host_supported','unsupported_host','host_requirement_unknown','collector_unknown','native_timing_on','native_timing_off','live_metrics_on','live_metrics_off','actual_not_observed'] as const;
|
|
757
|
+
export const EXPLAIN_REASONS = ['alignment_active','alignment_collapsed','cost_rate_session','cost_rate_api','indicator_bar','source_bound','source_unbound','configured_on','configured_off','scope_disabled','installation_owned','installation_absent','installation_foreign','installation_unknown','unknown_host_version','host_supported','unsupported_host','host_requirement_unknown','collector_unknown','native_timing_on','native_timing_off','live_metrics_on','live_metrics_off','actual_not_observed'] as const;
|
|
752
758
|
export interface ExplainReason { code: string; origin: 'configuration' | 'local_configuration' | 'host_capability' | 'unknown'; }
|
|
753
759
|
export interface InstanceSample { row_id: string; outcome: SampleReason; truncated: boolean; }
|
|
754
760
|
export interface ExplainInstance {
|