@fbincon/claude-code-statusline 3.9.2 → 3.10.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 +78 -78
- package/candidate.json +267 -229
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.js +8 -4
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/command.js +7 -18
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/command.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/input.d.ts +5 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/input.js +36 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/input.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js +2 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup.js +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/preview.js +2 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/preview.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +6 -5
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js +17 -3
- 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 +27 -6
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/backend.ts +10 -7
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +10 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts +6 -2
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/color-manager.ts +177 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/diagnosis-view.ts +123 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts +5 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/explanation.ts +2 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/gradients.ts +10 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/preview-settings.ts +8 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/setup.ts +7 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/themes.ts +40 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts +13 -14
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/generated-locales.ts +504 -6
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/presentation.ts +3 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +21 -17
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +9 -3
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/help.ts +4 -2
- 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 +6 -5
- package/node_modules/@fbincon/statusline-core/dist/src/config/display.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.d.ts +16 -7
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js +7 -10
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js +9 -7
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/color-manager.d.ts +23 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/color-manager.js +153 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/color-manager.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/diagnosis-view.d.ts +29 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/diagnosis-view.js +107 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/diagnosis-view.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.d.ts +5 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js +5 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/explanation.js +3 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/explanation.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/gradients.d.ts +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/gradients.js +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/gradients.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/preview-settings.d.ts +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/preview-settings.js +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/preview-settings.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/setup.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/setup.js +17 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/setup.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/themes.d.ts +17 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/themes.js +30 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/themes.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.d.ts +498 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +504 -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/release.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.d.ts +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.js +12 -13
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/diagnose.js +1 -1
- 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 +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/gradients.js +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/gradients.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/groups.js +5 -2
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/groups.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js +3 -3
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.d.ts +4 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js +2 -2
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.d.ts +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.js +8 -8
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.d.ts +11 -52
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.js +48 -7
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/sample-scenarios.d.ts +6 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/sample-scenarios.js +38 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/sample-scenarios.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.d.ts +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js +14 -17
- 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 +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.js +19 -1
- 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 +84 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +84 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +84 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +84 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +84 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +84 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/diagnostic-files.js +3 -2
- package/node_modules/@fbincon/statusline-platform/dist/src/diagnostic-files.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js +12 -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 +8 -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 +5 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js +8 -5
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js +32 -4
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/setup.d.ts +2 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/setup.js +7 -5
- package/node_modules/@fbincon/statusline-tui/dist/src/setup.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/state.d.ts +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js +43 -3
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import { isScenario } from './editor/preview-settings.ts';
|
|
2
3
|
import { validAlignments } from './editor/alignments.ts';
|
|
3
4
|
import { GRADIENT_KEYS, validGradient } from './editor/gradients.ts';
|
|
4
5
|
import { validCostRateOptions } from './editor/cost-rate.ts';
|
|
5
6
|
import { validGroups } from './editor/groups.ts';
|
|
6
7
|
import { INDICATOR_KEYS, validIndicatorOptions } from './editor/indicators.ts';
|
|
7
|
-
import { SAMPLE_REASONS, EXPLAIN_REASONS, LAYOUT_REASONS, EVIDENCE_STATUSES } from './generated-contracts.ts';
|
|
8
|
+
import { STYLE_REASONS, SAMPLE_REASONS, EXPLAIN_REASONS, LAYOUT_REASONS, EVIDENCE_STATUSES } from './generated-contracts.ts';
|
|
8
9
|
import { text as localizedText } from './i18n/index.ts';
|
|
9
10
|
/** Protocol parsing only. Host calls stay in the hooks entry for static analysis. */
|
|
10
11
|
import {
|
|
@@ -175,7 +176,7 @@ export function isDraft(value: unknown): value is Draft {
|
|
|
175
176
|
)
|
|
176
177
|
return false;
|
|
177
178
|
if (
|
|
178
|
-
d.schema_version !==
|
|
179
|
+
d.schema_version !== 16 ||
|
|
179
180
|
!object(d.powerline) || !exact(d.powerline, POWERLINE_FIELDS.map(f => f.key.slice(10))) ||
|
|
180
181
|
!POWERLINE_FIELDS.every(f => f.kind === 'boolean' ? typeof (d.powerline as Record<string, unknown>)[f.key.slice(10)] === 'boolean' :
|
|
181
182
|
(f.choices as readonly unknown[]).includes((d.powerline as Record<string, unknown>)[f.key.slice(10)])) ||
|
|
@@ -490,7 +491,7 @@ export function parseResponse<O extends Operation>(
|
|
|
490
491
|
} else if (operation === 'explain') {
|
|
491
492
|
if (!exact(result,['sample','scope','width','actual_availability','preview','instances']) || result.sample!==true ||
|
|
492
493
|
!['main','subagent'].includes(String(result.scope)) || !Number.isInteger(result.width) || Number(result.width)<2 || Number(result.width)>10000 || result.actual_availability!=='not_observed' ||
|
|
493
|
-
!object(result.preview) || result.preview.sample!==true || !Array.isArray(result.preview.main) || !Array.isArray(result.preview.subagents) ||
|
|
494
|
+
!object(result.preview) || result.preview.scenario!==undefined&&!isScenario(result.preview.scenario) || result.preview.sample!==true || !Array.isArray(result.preview.main) || !Array.isArray(result.preview.subagents) ||
|
|
494
495
|
![...result.preview.main,...result.preview.subagents].every(row=>Array.isArray(row)&&row.every(isSpan)) ||
|
|
495
496
|
!Array.isArray(result.instances) || result.instances.length>10000) fail();
|
|
496
497
|
const ids=new Set<string>();
|
|
@@ -498,13 +499,13 @@ export function parseResponse<O extends Operation>(
|
|
|
498
499
|
if(!object(item)||!exact(item,['id','type_id','enabled','reasons','samples'])||!text(item.id)||ids.has(item.id)||!text(item.type_id)||typeof item.enabled!=='boolean'||!Array.isArray(item.reasons)||!Array.isArray(item.samples)) fail();
|
|
499
500
|
ids.add(item.id as string);
|
|
500
501
|
if(!item.reasons.every((reason:unknown)=>object(reason)&&exact(reason,['code','origin'])&&EXPLAIN_REASONS.includes(reason.code as typeof EXPLAIN_REASONS[number])&&['configuration','local_configuration','host_capability','unknown'].includes(String(reason.origin)))) fail();
|
|
501
|
-
if(!item.samples.every((row:unknown)=>object(row)&&exact(row,['row_id','outcome','truncated'])&&text(row.row_id)&&SAMPLE_REASONS.includes(row.outcome as typeof SAMPLE_REASONS[number])&&typeof row.truncated==='boolean')) fail();
|
|
502
|
+
if(!item.samples.every((row:unknown)=>object(row)&&exact(row,['row_id','outcome','truncated',...(row.style_reasons!==undefined?['style_reasons']:[])])&&text(row.row_id)&&SAMPLE_REASONS.includes(row.outcome as typeof SAMPLE_REASONS[number])&&typeof row.truncated==='boolean'&&validStyleReasons(row.style_reasons))) fail();
|
|
502
503
|
}
|
|
503
|
-
} else if (operation === 'diagnose') {
|
|
504
|
+
} else if (operation === 'diagnose'||operation==='diagnose_file') {
|
|
504
505
|
if (!isDiagnosis(result)) fail();
|
|
505
506
|
} else if (operation === 'preview') {
|
|
506
507
|
if (
|
|
507
|
-
result.sample !== true ||
|
|
508
|
+
result.sample !== true || result.scenario!==undefined&&!isScenario(result.scenario) ||
|
|
508
509
|
!Array.isArray(result.main) ||
|
|
509
510
|
!Array.isArray(result.subagents) ||
|
|
510
511
|
![...result.main, ...result.subagents].every(
|
|
@@ -588,7 +589,7 @@ function isDiagnosis(value: Record<string, unknown>): boolean {
|
|
|
588
589
|
ids.add(item.id);
|
|
589
590
|
return item.reasons.every((reason: unknown) => object(reason) && exact(reason,['code','origin']) && EXPLAIN_REASONS.includes(reason.code as typeof EXPLAIN_REASONS[number]) && ['configuration','local_configuration','host_capability','unknown'].includes(String(reason.origin))) &&
|
|
590
591
|
item.evidence.every((e: unknown) => object(e) && exact(e,['source','scope','status','observed_at','freshness','fields']) && text(e.source) && text(e.scope) && EVIDENCE_STATUSES.includes(e.status as typeof EVIDENCE_STATUSES[number]) && stamp(e.observed_at) && ['current','stale','unknown','newer_than_input'].includes(String(e.freshness)) && Array.isArray(e.fields) && e.fields.every((f: unknown) => object(f) && exact(f,['path','status']) && text(f.path) && ['observed','not_observed','invalid_field'].includes(String(f.status)))) &&
|
|
591
|
-
item.rows.every((row: unknown) => object(row) && exact(row,['row_id','outcome','truncated']) && text(row.row_id) && LAYOUT_REASONS.includes(row.outcome as typeof LAYOUT_REASONS[number]) && typeof row.truncated === 'boolean');
|
|
592
|
+
item.rows.every((row: unknown) => object(row) && exact(row,['row_id','outcome','truncated',...(row.style_reasons!==undefined?['style_reasons']:[])]) && text(row.row_id) && LAYOUT_REASONS.includes(row.outcome as typeof LAYOUT_REASONS[number]) && typeof row.truncated === 'boolean');
|
|
592
593
|
})) return false;
|
|
593
594
|
const tree = value.host_fields.worktree, cache = value.host_fields.cache_miss;
|
|
594
595
|
return exact(value.host_fields,['worktree','cache_miss']) && object(tree) && exact(tree,['session_name','git_name','selected_source']) && nullable(tree.session_name) && nullable(tree.git_name) && [null,'worktree.name','workspace.git_worktree'].includes(tree.selected_source as string | null) &&
|
|
@@ -603,3 +604,5 @@ export function spanColor(span: Span, channel: 'foreground' | 'background' = 'fo
|
|
|
603
604
|
return `ansi256(${Number(color.value)})`;
|
|
604
605
|
return undefined;
|
|
605
606
|
}
|
|
607
|
+
|
|
608
|
+
function validStyleReasons(value:unknown):boolean {return value===undefined||Array.isArray(value)&&value.every(r=>object(r)&&exact(r,['code','owner_id'])&&STYLE_REASONS.includes(r.code as typeof STYLE_REASONS[number])&&(r.owner_id===null||text(r.owner_id)));}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { openDiagnosis, diagnosisKey } from '../editor/diagnosis-view.ts';
|
|
2
|
+
import { openColors, colorsKey } from '../editor/color-manager.ts';
|
|
3
|
+
import { SCENARIO_IDS, PREVIEW_WIDTHS, cyclePreview } from '../editor/preview-settings.ts';
|
|
1
4
|
import { openAlignments, alignmentsKey } from '../editor/alignment-manager.ts';
|
|
2
5
|
import { openGroups, groupsKey } from '../editor/group-manager.ts';
|
|
3
6
|
import { openSources, sourcesKey } from '../editor/source-manager.ts';
|
|
@@ -17,7 +20,7 @@ import { formSelection, pageSelection } from '../editor/navigation.ts';
|
|
|
17
20
|
import { guidanceLines } from '../editor/guidance.ts';
|
|
18
21
|
import { navigateReview } from '../editor/import-review.ts';
|
|
19
22
|
|
|
20
|
-
export type Effect = 'save' | 'finish' | 'close' | 'reload' | 'reconcile' | 'retry' | 'applyPreferences' | 'transfer' | 'previewBackground' | 'uiLanguage' | 'reviewPreview' | 'explain' | 'profiles' | 'sources' | null;
|
|
23
|
+
export type Effect = 'diagnoseFile' | 'save' | 'finish' | 'close' | 'reload' | 'reconcile' | 'retry' | 'applyPreferences' | 'transfer' | 'previewBackground' | 'uiLanguage' | 'reviewPreview' | 'explain' | 'profiles' | 'sources' | null;
|
|
21
24
|
|
|
22
25
|
export function cancelInput(view: View): void {
|
|
23
26
|
const input = view.input, e = view.editor;
|
|
@@ -39,6 +42,9 @@ export function handleKey(view: View, event: NativeKeyEvent, columns: number, ro
|
|
|
39
42
|
if (e) e.setSaveState(view.uncertain ? 'unknown' : view.busy ? 'pending' : 'idle');
|
|
40
43
|
if (!e || view.busy) return null;
|
|
41
44
|
if (event.overflow) { setMessage(view, 'message', localizedText('input.overflow')); return null; }
|
|
45
|
+
if(e.diagnosis)return diagnosisKey(e,event);
|
|
46
|
+
if(e.colors)return colorsKey(e,event,view.language ?? 'en');
|
|
47
|
+
if(event.ctrl&&key.toLowerCase()==='l'&&!view.input&&!e.sources&&!e.profiles&&!e.groupManager&&!e.alignmentManager&&!e.quick&&!e.review&&!e.explanation){openDiagnosis(e);return null;}
|
|
42
48
|
if (e.alignmentManager) return alignmentsKey(e,event);
|
|
43
49
|
if (e.groupManager) return groupsKey(e, event);
|
|
44
50
|
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; }
|
|
@@ -50,6 +56,7 @@ export function handleKey(view: View, event: NativeKeyEvent, columns: number, ro
|
|
|
50
56
|
return null;
|
|
51
57
|
}
|
|
52
58
|
if (event.text && (!view.input || view.input.kind === 'category')) return null;
|
|
59
|
+
if(event.ctrl&&['v','w','n'].includes(key.toLowerCase())&&!view.input){if(key.toLowerCase()==='v'){e.previewScenario=cyclePreview(SCENARIO_IDS,e.previewScenario,1);e.previewOffset=0;}else if(key.toLowerCase()==='w')e.previewWidth=cyclePreview(PREVIEW_WIDTHS,e.previewWidth as typeof PREVIEW_WIDTHS[number],1);else {const scope=e.quick?.previewScope??e.review?.previewScope??(e.page==='subagents'?'subagent':'main');e.previewOffset=(e.previewOffset+1)%Math.max(1,view.preview?.[scope==='main'?'main':'subagents'].length??0);}return null;}
|
|
53
60
|
if(e.explanation) { if(!explanationKey(e.explanation,event.ctrl && key.toLowerCase()==='g'?'cancel':event.ctrl||event.meta?'':key,Math.max(1,rows-10))) e.explanation=null; return null; }
|
|
54
61
|
if (e.quick) return controlQuick(e,event.ctrl && key.toLowerCase()==='g' ? 'cancel' : event.ctrl || event.meta ? '' : key);
|
|
55
62
|
if (event.ctrl && key.toLowerCase()==='p' && !view.input && !e.detail && !e.adding && !e.review && !view.uncertain) {
|
|
@@ -206,6 +213,8 @@ export function handleKey(view: View, event: NativeKeyEvent, columns: number, ro
|
|
|
206
213
|
return isSettings && e.setting === 'preview-background' ? 'previewBackground' : isSettings && e.setting === 'ui-language' ? 'uiLanguage' : null;
|
|
207
214
|
} else if (key === 'return' || key === ' ' || key === 'space') {
|
|
208
215
|
if (!isSettings) { if(!e.toggle(scope, selected))setMessage(view,"message",e.compositionError); }
|
|
216
|
+
else if(e.setting==='diagnose-file'){openDiagnosis(e);return null;}
|
|
217
|
+
else if(openColors(e,e.setting))return null;
|
|
209
218
|
else if (e.setting === 'row-alignment') { openAlignments(e); return null; }
|
|
210
219
|
else if (e.setting === 'component-groups') { openGroups(e); return null; }
|
|
211
220
|
else if (e.setting === 'sources') {openSources(e);return 'sources';}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SCENARIO_IDS, PREVIEW_WIDTHS, cyclePreview } from '../editor/preview-settings.ts';
|
|
1
2
|
import { setMessage, failureMessage } from '../i18n/messages.ts';
|
|
2
3
|
import { text as localizedText } from '../i18n/index.ts';
|
|
3
4
|
import type { View } from '../session.ts';
|
|
@@ -15,7 +16,7 @@ export interface SettingRow {
|
|
|
15
16
|
|
|
16
17
|
export function settingRows(view: View): SettingRow[] {
|
|
17
18
|
const e = view.editor!;
|
|
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.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},...(!e.adding?[{key:'diagnose-file',label:'Diagnose input file',group:'Item format',value:'Enter',editable:true}]:[]), ...formRows(view)];
|
|
19
20
|
if (e.page === 'layout') {
|
|
20
21
|
const fields = formRows(view);
|
|
21
22
|
if (!e.draft.display.instances.length) return fields;
|
|
@@ -100,7 +101,8 @@ export function settingRows(view: View): SettingRow[] {
|
|
|
100
101
|
rows.splice(appearanceEnd, 0, ...fields.filter(row => row.group === 'Appearance'));
|
|
101
102
|
rows.push(...fields.filter(row => row.group !== 'Appearance'));
|
|
102
103
|
rows.push(
|
|
103
|
-
{
|
|
104
|
+
{key:'preview-scenario',label:'Sample scenario',group:'Preview',value:e.previewScenario,editable:true},
|
|
105
|
+
{key:'preview-width',label:'Preview width',group:'Preview',value:e.previewWidth,editable:true}, {key:'diagnose-file',label:'Diagnose input file',group:'Presets / portable files',value:'Enter',editable:true}, { key: 'ui-language', label: 'Interface language (saved immediately)', group: 'Interface', value: LANGUAGE_NAMES[view.language ?? 'en'], editable: true },
|
|
104
106
|
{ key: 'component-groups', label: 'Component groups', group: 'Presets / portable files', value: 'Enter', editable: true },
|
|
105
107
|
{ key: 'sources', label: 'Data sources', group: 'Presets / portable files', value: 'Enter', editable: true },
|
|
106
108
|
{ key: 'profiles', label: 'Display schemes and projects', group: 'Presets / portable files', value: 'Enter', editable: true },
|
|
@@ -124,6 +126,8 @@ export function settingRows(view: View): SettingRow[] {
|
|
|
124
126
|
|
|
125
127
|
export function adjustSetting(view: View, delta: -1 | 1): void {
|
|
126
128
|
const e = view.editor!;
|
|
129
|
+
if(e.setting==='preview-scenario'){e.previewScenario=cyclePreview(SCENARIO_IDS,e.previewScenario,delta);e.previewOffset=0;return;}
|
|
130
|
+
if(e.setting==='preview-width'){e.previewWidth=cyclePreview(PREVIEW_WIDTHS,e.previewWidth as typeof PREVIEW_WIDTHS[number],delta);return;}
|
|
127
131
|
if (!e.canMutateDraft() && !['ui-language','preview-background'].includes(e.setting) && !e.setting.startsWith('host-')) { setMessage(view, 'message', e.compositionError);return; }
|
|
128
132
|
const d = e.draft.display;
|
|
129
133
|
const form = formRows(view).find((row) => row.key === e.setting);
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/color-manager.ts
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import type { Draft, Scope, Span } from '../generated-contracts.ts';
|
|
3
|
+
import type { Editor } from './draft.ts';
|
|
4
|
+
import { copyDraft } from './draft.ts';
|
|
5
|
+
import { THEME_IDS, ANSI_ROLES, ANSI_BLOCKS, themeDefinition } from './themes.ts';
|
|
6
|
+
import { GRADIENT_PRESETS, GRADIENT_SURFACES, parseGradient, gradientName } from './gradients.ts';
|
|
7
|
+
import { normalizeColor, validColor } from './appearance.ts';
|
|
8
|
+
import { inputKey, inputView, textInput, type TextInput, type TextKey } from './text-input.ts';
|
|
9
|
+
import { t, type Language } from '../i18n/index.ts';
|
|
10
|
+
export interface ColorManager {
|
|
11
|
+
kind: 'theme' | 'solid' | 'gradient';
|
|
12
|
+
key: string;
|
|
13
|
+
scope: Scope;
|
|
14
|
+
id: string;
|
|
15
|
+
cursor: number;
|
|
16
|
+
candidate: string | string[] | null;
|
|
17
|
+
generation: number;
|
|
18
|
+
input: TextInput | null;
|
|
19
|
+
editing: number | null;
|
|
20
|
+
error: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface Choice {
|
|
23
|
+
id: string;
|
|
24
|
+
label: string;
|
|
25
|
+
value?: string | string[] | null;
|
|
26
|
+
colors?: readonly string[];
|
|
27
|
+
surface?: string;
|
|
28
|
+
}
|
|
29
|
+
export function openColors(e: Editor, key: string): boolean {
|
|
30
|
+
if (!['field:theme', 'item:foreground', 'item:background', 'item:foreground_gradient', 'item:background_gradient'].includes(key))
|
|
31
|
+
return false;
|
|
32
|
+
if (!e.canMutateDraft())
|
|
33
|
+
return true;
|
|
34
|
+
const kind = key === 'field:theme' ? 'theme' : key.endsWith('_gradient') ? 'gradient' : 'solid';
|
|
35
|
+
const detail = e.detail, node = detail ? e.instance(detail.scope, detail.id) : null;
|
|
36
|
+
const value = kind === 'theme' ? e.draft.display.theme : node?.options[key.slice(5) as 'foreground'] ?? null;
|
|
37
|
+
e.colors = { kind, key, scope: detail?.scope ?? 'main', id: detail?.id ?? '', cursor: 0, candidate: Array.isArray(value) ? [...value] : value, generation: e.mutationGeneration, input: null, editing: null, error: false };
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
function choices(e: Editor, language: Language): Choice[] {
|
|
41
|
+
const m = e.colors!, tr = (key: string) => t('colors.' + key, language);
|
|
42
|
+
let rows: Choice[];
|
|
43
|
+
if (m.kind === 'theme')
|
|
44
|
+
rows = THEME_IDS.map(id => ({ id, label: t('values.' + id, language), value: id, colors: id === 'terminal' ? (e.draft.display.separator_style === 'powerline' ? ANSI_BLOCKS : ANSI_ROLES).map(value => 'ansi:' + value) : e.draft.display.separator_style === 'powerline' ? themeDefinition(id).backgrounds : themeDefinition(id).foreground, surface: themeDefinition(id).surface }));
|
|
45
|
+
else if (m.kind === 'solid') {
|
|
46
|
+
const definition = themeDefinition(e.draft.display.theme);
|
|
47
|
+
const values = [...new Set([...definition.foreground, ...definition.backgrounds])];
|
|
48
|
+
rows = [{ id: 'inherit', label: tr('inherit'), value: null }, { id: 'default', label: tr('default'), value: 'default' },
|
|
49
|
+
...Array.from({ length: 16 }, (_, i) => ({ id: 'ansi:' + i, label: 'ANSI ' + i, value: 'ansi:' + i, colors: ['ansi:' + i] })),
|
|
50
|
+
...values.map(color => ({ id: color, label: color, value: color, colors: [color] })), { id: 'custom', label: tr('custom') }];
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
rows = [{ id: 'off', label: tr('off'), value: null }, ...Object.entries(GRADIENT_PRESETS).map(([id, colors]) => ({ id, label: t('gradients.preset.' + id, language), value: [...colors], colors, surface: GRADIENT_SURFACES[id as keyof typeof GRADIENT_PRESETS] })),
|
|
54
|
+
{ id: 'custom', label: tr('custom') }, { id: 'reverse', label: tr('reverse') },
|
|
55
|
+
...(Array.isArray(m.candidate) ? m.candidate.map((color, i) => ({ id: 'stop:' + i, label: tr('stop') + ' ' + (i + 1) + ' ' + color, colors: [color] })) : []),
|
|
56
|
+
{ id: 'add', label: tr('add') }, { id: 'remove', label: tr('remove') }];
|
|
57
|
+
}
|
|
58
|
+
return [...rows, { id: 'apply', label: tr('apply') }, { id: 'cancel', label: tr('cancel') }];
|
|
59
|
+
}
|
|
60
|
+
export function colorDraft(e: Editor): Draft {
|
|
61
|
+
const m = e.colors;
|
|
62
|
+
if (!m)
|
|
63
|
+
return e.draft;
|
|
64
|
+
const draft = copyDraft(e.draft);
|
|
65
|
+
if (m.kind === 'theme')
|
|
66
|
+
draft.display.theme = m.candidate as Draft['display']['theme'];
|
|
67
|
+
else {
|
|
68
|
+
const node = (m.scope === 'main' ? draft.display.instances : draft.display.subagents.instances).find(n => n.id === m.id);
|
|
69
|
+
if (node)
|
|
70
|
+
(node.options as unknown as Record<string, unknown>)[m.key.slice(5)] = Array.isArray(m.candidate) ? [...m.candidate] : m.candidate;
|
|
71
|
+
}
|
|
72
|
+
return draft;
|
|
73
|
+
}
|
|
74
|
+
export function colorsKey(e: Editor, event: TextKey, language: Language): null {
|
|
75
|
+
const m = e.colors!, key = event.key;
|
|
76
|
+
if ((e.saveState !== 'idle' || m.generation !== e.mutationGeneration) && !(key === 'escape' || event.ctrl && key.toLowerCase() === 'g' || ['up', 'down', 'home', 'end', 'pageup', 'pagedown'].includes(key))) {
|
|
77
|
+
e.canMutateDraft(m.generation);
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
if (m.input) {
|
|
81
|
+
if (key === 'escape' || event.ctrl && key.toLowerCase() === 'g') {
|
|
82
|
+
m.input = null;
|
|
83
|
+
m.error = false;
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
if (key === 'return' && !event.text && !event.paste) {
|
|
87
|
+
try {
|
|
88
|
+
if (m.kind === 'gradient' && m.editing === null)
|
|
89
|
+
m.candidate = parseGradient(m.input.value);
|
|
90
|
+
else if (m.kind === 'gradient') {
|
|
91
|
+
if (!/^#[0-9a-f]{6}$/iu.test(m.input.value))
|
|
92
|
+
throw new Error();
|
|
93
|
+
(m.candidate as string[])[m.editing!] = m.input.value.toLowerCase();
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const value = m.input.value === 'inherit' ? null : m.input.value;
|
|
97
|
+
if (!validColor(value))
|
|
98
|
+
throw new Error();
|
|
99
|
+
m.candidate = normalizeColor(value) as string | null;
|
|
100
|
+
}
|
|
101
|
+
m.input = null;
|
|
102
|
+
m.error = false;
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
m.error = true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const result = inputKey(m.input.value, m.input, event, 256);
|
|
110
|
+
m.input = result.state;
|
|
111
|
+
m.error = !!result.error;
|
|
112
|
+
}
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
if (event.text || event.paste || event.meta || event.overflow)
|
|
116
|
+
return null;
|
|
117
|
+
if (key === 'escape' || event.ctrl && key.toLowerCase() === 'g') {
|
|
118
|
+
e.colors = null;
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
const rows = choices(e, language);
|
|
122
|
+
if (['up', 'down', 'pageup', 'pagedown', 'tab'].includes(key))
|
|
123
|
+
m.cursor = Math.max(0, Math.min(rows.length - 1, m.cursor + (key === 'up' ? -1 : key === 'pageup' ? -5 : key === 'pagedown' ? 5 : 1)));
|
|
124
|
+
if (key === 'home')
|
|
125
|
+
m.cursor = 0;
|
|
126
|
+
if (key === 'end')
|
|
127
|
+
m.cursor = rows.length - 1;
|
|
128
|
+
const selected = rows[m.cursor]!;
|
|
129
|
+
if (event.ctrl && key.toLowerCase() === 's' || key === 'return' && selected.id === 'apply') {
|
|
130
|
+
if (e.canMutateDraft(m.generation)) {
|
|
131
|
+
e.draft = colorDraft(e);
|
|
132
|
+
e.colors = null;
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
if (event.ctrl)
|
|
137
|
+
return null;
|
|
138
|
+
if (key === 'return' || key === 'left' || key === 'right') {
|
|
139
|
+
if (selected.id === 'cancel') {
|
|
140
|
+
e.colors = null;
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
if (Object.hasOwn(selected, 'value'))
|
|
144
|
+
m.candidate = Array.isArray(selected.value) ? [...selected.value] : selected.value!;
|
|
145
|
+
else if (selected.id === 'custom' || selected.id.startsWith('stop:')) {
|
|
146
|
+
m.editing = selected.id.startsWith('stop:') ? Number(selected.id.slice(5)) : null;
|
|
147
|
+
m.input = textInput(m.editing === null ? (m.kind === 'gradient' ? gradientName(m.candidate) : m.candidate === null ? 'inherit' : String(m.candidate)) : (m.candidate as string[])[m.editing]!);
|
|
148
|
+
}
|
|
149
|
+
else if (selected.id === 'reverse' && Array.isArray(m.candidate))
|
|
150
|
+
m.candidate.reverse();
|
|
151
|
+
else if (selected.id === 'add') {
|
|
152
|
+
if (!Array.isArray(m.candidate))
|
|
153
|
+
m.candidate = [...GRADIENT_PRESETS.ocean];
|
|
154
|
+
else if (m.candidate.length < 5)
|
|
155
|
+
m.candidate.push(m.candidate.at(-1)!);
|
|
156
|
+
}
|
|
157
|
+
else if (selected.id === 'remove' && Array.isArray(m.candidate) && m.candidate.length > 2)
|
|
158
|
+
m.candidate.pop();
|
|
159
|
+
m.error = false;
|
|
160
|
+
}
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
const plain = (text: string): Span => ({ text, bold: false, foreground: null, background: null });
|
|
164
|
+
export function colorsView(e: Editor, language: Language, width: number, height: number): {
|
|
165
|
+
spans: Span[];
|
|
166
|
+
selected: boolean;
|
|
167
|
+
}[] {
|
|
168
|
+
const m = e.colors!, tr = (key: string) => t('colors.' + key, language);
|
|
169
|
+
if (m.input)
|
|
170
|
+
return [{ spans: [plain(tr('input'))], selected: false }, { spans: [plain(inputView(m.input, width))], selected: true }, { spans: [plain(m.error ? tr('invalid') : tr('input_help'))], selected: false }];
|
|
171
|
+
const rows = choices(e, language), capacity = Math.max(1, height - 2), start = Math.floor(m.cursor / capacity) * capacity;
|
|
172
|
+
return [{ spans: [plain(tr('help'))], selected: false }, ...rows.slice(start, start + capacity).map((row, index) => {
|
|
173
|
+
const selected = start + index === m.cursor;
|
|
174
|
+
const spans = [plain(selected ? '› ' : ' '), ...(row.colors ?? []).map(color => ({ ...plain('██'), foreground: color.startsWith('ansi:') ? { kind: 'ansi' as const, value: Number(color.slice(5)) } : { kind: 'rgb' as const, value: color } })), plain(' ' + row.label + (row.surface ? ' · ' + tr((m.kind === 'theme' ? 'theme_surface_' : 'surface_') + row.surface) : ''))];
|
|
175
|
+
return { spans, selected };
|
|
176
|
+
}), { spans: [plain(`${m.cursor + 1}/${rows.length} · ${e.saveState !== 'idle' || m.generation !== e.mutationGeneration ? t('editor.save_locked', language) : m.error ? tr('invalid') : tr('draft_only')}`)], selected: false }];
|
|
177
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import type { DiagnoseResult, Scope } from '../generated-contracts.ts';
|
|
3
|
+
import type { Editor } from './draft.ts';
|
|
4
|
+
import { copyDraft } from './draft.ts';
|
|
5
|
+
import { inputKey, inputView, textInput, type TextInput, type TextKey } from './text-input.ts';
|
|
6
|
+
import { t, type Language } from '../i18n/index.ts';
|
|
7
|
+
import { wrapText } from '../../ui/text.ts';
|
|
8
|
+
import { targetLabel } from './profile-manager.ts';
|
|
9
|
+
export interface DiagnosisView {
|
|
10
|
+
path: string;
|
|
11
|
+
scope: Scope;
|
|
12
|
+
observedAt: string;
|
|
13
|
+
includeLocal: boolean;
|
|
14
|
+
cursor: number;
|
|
15
|
+
input: TextInput | null;
|
|
16
|
+
result: DiagnoseResult | null;
|
|
17
|
+
error: string;
|
|
18
|
+
scroll: number;
|
|
19
|
+
busy: boolean;
|
|
20
|
+
report: boolean;
|
|
21
|
+
generation: number;
|
|
22
|
+
}
|
|
23
|
+
export function openDiagnosis(e: Editor): void { e.diagnosis = { path: '', scope: e.detail?.scope ?? (e.page === 'subagents' ? 'subagent' : 'main'), observedAt: '', includeLocal: false, cursor: 0, input: null, result: null, error: '', scroll: 0, busy: false, report: false, generation: 0 }; }
|
|
24
|
+
export function diagnosisRequest(e: Editor, width: number) { const v = e.diagnosis!; return { draft: copyDraft(e.draft), path: v.path, scope: v.scope, width, observed_at: v.observedAt || null, include_local: v.includeLocal }; }
|
|
25
|
+
export function diagnosisKey(e: Editor, event: TextKey): 'diagnoseFile' | null {
|
|
26
|
+
const v = e.diagnosis!, key = event.key, cancel = key === 'escape' || event.ctrl && key.toLowerCase() === 'g';
|
|
27
|
+
if (v.input) {
|
|
28
|
+
if (cancel) {
|
|
29
|
+
v.input = null;
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
if (key === 'return' && !event.text && !event.paste) {
|
|
33
|
+
v.generation++;
|
|
34
|
+
if (v.cursor === 0)
|
|
35
|
+
v.path = v.input.value;
|
|
36
|
+
else
|
|
37
|
+
v.observedAt = v.input.value;
|
|
38
|
+
v.input = null;
|
|
39
|
+
v.error = '';
|
|
40
|
+
}
|
|
41
|
+
else
|
|
42
|
+
v.input = inputKey(v.input.value, v.input, event, v.cursor === 0 ? 4096 : 128).state;
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
if (event.text || event.paste || event.meta)
|
|
46
|
+
return null;
|
|
47
|
+
if (cancel) {
|
|
48
|
+
if (v.report) {
|
|
49
|
+
v.report = false;
|
|
50
|
+
v.generation++;
|
|
51
|
+
}
|
|
52
|
+
else
|
|
53
|
+
e.diagnosis = null;
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
if (v.report) {
|
|
57
|
+
if (key === 'up' || key === 'pageup')
|
|
58
|
+
v.scroll = Math.max(0, v.scroll - (key === 'up' ? 1 : 8));
|
|
59
|
+
if (key === 'down' || key === 'pagedown')
|
|
60
|
+
v.scroll += key === 'down' ? 1 : 8;
|
|
61
|
+
if (key === 'home')
|
|
62
|
+
v.scroll = 0;
|
|
63
|
+
if (key === 'end')
|
|
64
|
+
v.scroll = 1000000;
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
if (event.ctrl)
|
|
68
|
+
return null;
|
|
69
|
+
if (['up', 'down', 'tab'].includes(key))
|
|
70
|
+
v.cursor = Math.max(0, Math.min(6, v.cursor + (key === 'up' ? -1 : 1)));
|
|
71
|
+
if (key === 'home')
|
|
72
|
+
v.cursor = 0;
|
|
73
|
+
if (key === 'end')
|
|
74
|
+
v.cursor = 6;
|
|
75
|
+
if (['return', 'left', 'right'].includes(key)) {
|
|
76
|
+
if (v.cursor === 0 || v.cursor === 2) {
|
|
77
|
+
v.generation++;
|
|
78
|
+
v.input = textInput(v.cursor === 0 ? v.path : v.observedAt);
|
|
79
|
+
}
|
|
80
|
+
if (v.cursor === 1) {
|
|
81
|
+
v.generation++;
|
|
82
|
+
v.scope = v.scope === 'main' ? 'subagent' : 'main';
|
|
83
|
+
}
|
|
84
|
+
if (v.cursor === 3) {
|
|
85
|
+
v.generation++;
|
|
86
|
+
v.includeLocal = !v.includeLocal;
|
|
87
|
+
}
|
|
88
|
+
if (v.cursor === 4 && !v.busy) {
|
|
89
|
+
v.generation++;
|
|
90
|
+
return 'diagnoseFile';
|
|
91
|
+
}
|
|
92
|
+
if (v.cursor === 5 && v.result)
|
|
93
|
+
v.report = true;
|
|
94
|
+
if (v.cursor === 6)
|
|
95
|
+
e.diagnosis = null;
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
export function diagnosisLines(e: Editor, language: Language, width: number): string[] {
|
|
100
|
+
const v = e.diagnosis!, r = v.result, tr = (key: string, params: Record<string, unknown> = {}) => t('diagnose.' + key, language, params);
|
|
101
|
+
if (!v.report || !r)
|
|
102
|
+
return wrapText([t('diagnosis.target', language, { target: targetLabel(e, language) }),
|
|
103
|
+
...[t('diagnosis.path', language) + ': ' + v.path, t('diagnosis.scope', language) + ': ' + v.scope, t('diagnosis.time', language) + ': ' + (v.observedAt || tr('unknown')), t('diagnosis.local', language) + ': ' + t('values.' + (v.includeLocal ? 'on' : 'off'), language), t(v.busy ? 'diagnosis.busy' : 'diagnosis.run', language), t('diagnosis.previous', language), t('colors.cancel', language)].map((line, i) => (i === v.cursor ? '› ' : ' ') + line),
|
|
104
|
+
...(v.input ? [inputView(v.input, width)] : []), v.error, t('diagnosis.help', language)], width);
|
|
105
|
+
const lines = [t('diagnosis.title', language), t('diagnosis.target', language, { target: targetLabel(e, language) }), tr('source', { value: r.source }), tr('times', { input: r.observed_at ?? tr('unknown'), now: r.diagnosed_at }), t(r.include_local ? 'diagnosis.with_local' : 'diagnosis.input_only', language), tr('identity', { session: r.session_id ?? tr('unknown'), prompt: r.prompt_id ?? tr('unknown') }), tr('output', { width: r.width }), ...r.output.map(row => row.spans.map(s => s.text).join(''))];
|
|
106
|
+
for (const item of r.instances) {
|
|
107
|
+
lines.push('', e.instanceLabel(r.scope, item.id, language) + ' (' + item.id + ')');
|
|
108
|
+
for (const reason of item.reasons)
|
|
109
|
+
lines.push(t('explain.reason.' + reason.code, language));
|
|
110
|
+
for (const evidence of item.evidence) {
|
|
111
|
+
lines.push(tr('evidence', { source: evidence.source, scope: evidence.scope, status: tr('status.' + evidence.status), time: evidence.observed_at ?? tr('unknown'), freshness: tr('freshness.' + evidence.freshness) }));
|
|
112
|
+
for (const field of evidence.fields)
|
|
113
|
+
lines.push(field.path + ': ' + tr('status.' + field.status));
|
|
114
|
+
}
|
|
115
|
+
for (const row of item.rows) {
|
|
116
|
+
lines.push(row.row_id + ': ' + tr('layout.' + row.outcome) + (row.truncated ? ' · ' + tr('layout.truncated') : ''));
|
|
117
|
+
for (const reason of row.style_reasons ?? [])
|
|
118
|
+
lines.push(t('explain.style.' + reason.code, language) + (reason.owner_id ? ' (' + reason.owner_id + ')' : ''));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
lines.push('', tr('limits'));
|
|
122
|
+
return wrapText(lines, width);
|
|
123
|
+
}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts
CHANGED
|
@@ -46,6 +46,9 @@ export class Editor {
|
|
|
46
46
|
draft: Draft;
|
|
47
47
|
baseline: ReadResult;
|
|
48
48
|
page: Page = 'main';
|
|
49
|
+
previewScenario: import('./preview-settings.js').PreviewScenario = 'normal';
|
|
50
|
+
previewWidth = 'auto';
|
|
51
|
+
previewOffset = 0;
|
|
49
52
|
advanced = false;
|
|
50
53
|
adding = false;
|
|
51
54
|
pickerSaved: {search:string;category:string;selected:string} | null = null;
|
|
@@ -53,6 +56,8 @@ export class Editor {
|
|
|
53
56
|
guidanceScroll: number | null = null;
|
|
54
57
|
review: ReviewState | null = null;
|
|
55
58
|
quick: QuickSetup | null = null;
|
|
59
|
+
diagnosis: import('./diagnosis-view.js').DiagnosisView | null = null;
|
|
60
|
+
colors: import('./color-manager.js').ColorManager | null = null;
|
|
56
61
|
explanation: ExplanationView | null = null;
|
|
57
62
|
profiles: ProfileManager | null = null;
|
|
58
63
|
sources: SourceManager | null = null;
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/explanation.ts
CHANGED
|
@@ -18,7 +18,7 @@ export function explanationLines(editor:Editor,language:Language,width:number):
|
|
|
18
18
|
const view=editor.explanation!;
|
|
19
19
|
const tr=(key:string,params:Record<string,unknown>={})=>t('explain.'+key,language,params);
|
|
20
20
|
const item=view.result?.instances.find(item=>item.id===view.id);
|
|
21
|
-
const lines=[tr('sample'),editor.instanceLabel(view.scope,view.id,language)+' ('+view.id+')'];
|
|
21
|
+
const lines=[tr('sample')+' · '+t('preview.scenario.'+(view.result?.preview.scenario??editor.previewScenario),language),editor.instanceLabel(view.scope,view.id,language)+' ('+view.id+')'];
|
|
22
22
|
if(!item) return wrapText([...lines,view.error||tr('loading')],width);
|
|
23
23
|
for(const [heading,origins] of [['configuration',['configuration']],['requirements',['local_configuration','host_capability','unknown']]] as const) {
|
|
24
24
|
lines.push('',tr(heading));
|
|
@@ -29,6 +29,7 @@ export function explanationLines(editor:Editor,language:Language,width:number):
|
|
|
29
29
|
for(const sample of item.samples) {
|
|
30
30
|
lines.push(tr('row.'+sample.row_id)+': '+tr('reason.'+sample.outcome));
|
|
31
31
|
if(sample.truncated) lines.push(tr('reason.sample_truncated'));
|
|
32
|
+
for(const reason of sample.style_reasons??[])lines.push(tr('style.'+reason.code)+(reason.owner_id?' ('+reason.owner_id+')':''));
|
|
32
33
|
}
|
|
33
34
|
lines.push('',tr('panel_note'));
|
|
34
35
|
return wrapText(lines,width);
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/gradients.ts
CHANGED
|
@@ -5,6 +5,14 @@ export const GRADIENT_PRESETS = {
|
|
|
5
5
|
ocean: ['#22d3ee', '#3b82f6'],
|
|
6
6
|
sunset: ['#fb923c', '#f472b6', '#a78bfa'],
|
|
7
7
|
aurora: ['#34d399', '#22d3ee', '#a78bfa'],
|
|
8
|
+
glacier: ['#67e8f9', '#60a5fa', '#818cf8'],
|
|
9
|
+
lagoon: ['#0c4a6e', '#164e63', '#1e3a8a'],
|
|
10
|
+
flame: ['#fbbf24', '#f97316', '#ef4444'],
|
|
11
|
+
copper: ['#7c2d12', '#78350f', '#831843'],
|
|
12
|
+
steel: ['#94a3b8', '#b8c4d1', '#cbd5e1'],
|
|
13
|
+
sage: ['#304c40', '#405647', '#455663'],
|
|
14
|
+
petal: ['#fbcfe8', '#e9d5ff', '#dbeafe'],
|
|
15
|
+
twilight: ['#c4b5fd', '#f9a8d4', '#fdba74'],
|
|
8
16
|
} as const;
|
|
9
17
|
export const GRADIENT_KEYS = ['foreground_gradient', 'background_gradient'] as const;
|
|
10
18
|
export const GRADIENT_DEFAULTS = { foreground_gradient: null, background_gradient: null };
|
|
@@ -27,3 +35,5 @@ export function gradientName(value: unknown): string {
|
|
|
27
35
|
if (value == null) return 'off';
|
|
28
36
|
return Object.entries(GRADIENT_PRESETS).find(([, colors]) => JSON.stringify(colors) === JSON.stringify(value))?.[0] ?? String(value);
|
|
29
37
|
}
|
|
38
|
+
|
|
39
|
+
export const GRADIENT_SURFACES: Record<keyof typeof GRADIENT_PRESETS, 'dark' | 'light'> = {ocean:'dark',sunset:'dark',aurora:'dark',glacier:'dark',lagoon:'light',flame:'dark',copper:'light',steel:'dark',sage:'light',petal:'dark',twilight:'dark'};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
/** Session-only controls; never part of a display draft or portable file. */
|
|
3
|
+
export const SCENARIO_IDS = ['normal', 'warning', 'critical', 'zero', 'missing', 'source-stale', 'source-failed', 'long-content', 'git-clean', 'git-modified', 'git-conflicted', 'no-agents', 'few-agents', 'many-agents'] as const;
|
|
4
|
+
export type PreviewScenario = typeof SCENARIO_IDS[number];
|
|
5
|
+
export const PREVIEW_WIDTHS = ['auto', '40', '80', '120'] as const;
|
|
6
|
+
export function isScenario(value: unknown): value is PreviewScenario { return typeof value === 'string' && (SCENARIO_IDS as readonly string[]).includes(value); }
|
|
7
|
+
export function previewWidth(available: number, requested: string): number { return Math.max(2, Math.min(available, requested === 'auto' ? available : Number(requested))); }
|
|
8
|
+
export function cyclePreview<T>(values: readonly T[], value: T, delta: number): T { return values[(values.indexOf(value) + delta + values.length) % values.length]!; }
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/setup.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import { SCENARIO_IDS, PREVIEW_WIDTHS, cyclePreview, type PreviewScenario } from './preview-settings.ts';
|
|
2
3
|
import type { Draft } from '../generated-contracts.ts';
|
|
3
4
|
import { LANGUAGES, type Language, type LocalizedText } from '../i18n/index.ts';
|
|
4
5
|
import { copyDraft } from './draft.ts';
|
|
@@ -17,6 +18,9 @@ export type SetupEffect = 'cancel' | 'interrupt' | 'preset' | 'language' | 'save
|
|
|
17
18
|
/** The wizard holds only drafts; effects are executed by its CLI/TUI adapters. */
|
|
18
19
|
export class SetupState {
|
|
19
20
|
phase: 'checks' | 'choice' | 'quick' | 'review' = 'checks';
|
|
21
|
+
previewScenario:PreviewScenario='normal';
|
|
22
|
+
previewWidth='auto';
|
|
23
|
+
previewOffset=0;
|
|
20
24
|
selected = 0;
|
|
21
25
|
scroll = 0;
|
|
22
26
|
quick: QuickSetup | null = null;
|
|
@@ -25,6 +29,9 @@ export class SetupState {
|
|
|
25
29
|
constructor(readonly facts: SetupFacts, public language: Language) { this.candidate = facts.draft ? copyDraft(facts.draft) : null; }
|
|
26
30
|
receive(draft: Draft): void { receivePreset(this.quick!, draft); }
|
|
27
31
|
key(key: string): SetupEffect {
|
|
32
|
+
if(key==='preview-scenario'){this.previewScenario=cyclePreview(SCENARIO_IDS,this.previewScenario,1);this.previewOffset=0;return null;}
|
|
33
|
+
if(key==='preview-width'){this.previewWidth=cyclePreview(PREVIEW_WIDTHS,this.previewWidth as typeof PREVIEW_WIDTHS[number],1);return null;}
|
|
34
|
+
if(key==='preview-next'){this.previewOffset++;return null;}
|
|
28
35
|
if (key === 'interrupt') return 'interrupt';
|
|
29
36
|
if (key === 'escape' || key === 'cancel') return 'cancel';
|
|
30
37
|
if (key === 'l') { this.language = LANGUAGES[(LANGUAGES.indexOf(this.language) + 1) % LANGUAGES.length]!; return 'language'; }
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
/** One registry for persisted identities, selectors and production paint. */
|
|
3
|
+
export const THEME_IDS = ['classic', 'dark', 'light', 'terminal', 'ocean', 'ember', 'slate', 'blossom'] as const;
|
|
4
|
+
export type ThemeId = typeof THEME_IDS[number];
|
|
5
|
+
export const THEME_ROLES = ['model', 'directory', 'branch', 'percentage', 'tokens', 'timer'] as const;
|
|
6
|
+
export const ANSI_ROLES = [3, 2, 5, 3, 5, 6] as const;
|
|
7
|
+
export const ANSI_BLOCKS = [4, 2, 5, 3, 1, 6] as const;
|
|
8
|
+
export interface ThemeDefinition {
|
|
9
|
+
surface: 'dark' | 'light' | 'terminal';
|
|
10
|
+
foreground: readonly string[];
|
|
11
|
+
backgrounds: readonly string[];
|
|
12
|
+
blockText: string;
|
|
13
|
+
separator: string;
|
|
14
|
+
warning: string;
|
|
15
|
+
critical: string;
|
|
16
|
+
}
|
|
17
|
+
const dark: ThemeDefinition = {
|
|
18
|
+
surface: 'dark', foreground: ['#f6e2b7', '#abdfa7', '#c8a9ee', '#f2b590', '#e990a9', '#8ed3d3'],
|
|
19
|
+
backgrounds: ['#3c3548', '#234337', '#3d3155', '#543720', '#542b3c', '#1f4148'],
|
|
20
|
+
blockText: '#f4f5f7', separator: '#aab2bd', warning: '#f2b550', critical: '#f28686',
|
|
21
|
+
};
|
|
22
|
+
export const THEMES: Readonly<Record<ThemeId, ThemeDefinition>> = {
|
|
23
|
+
classic: dark, dark, terminal: { ...dark, surface: 'terminal' },
|
|
24
|
+
light: { surface: 'light', foreground: ['#664515', '#205727', '#633487', '#864511', '#93284a', '#126168'],
|
|
25
|
+
backgrounds: ['#eee1c4', '#d6ecd4', '#e7dcf2', '#f5dfce', '#f4d8e1', '#d1ecec'],
|
|
26
|
+
blockText: '#202630', separator: '#58616b', warning: '#805000', critical: '#a02020' },
|
|
27
|
+
ocean: { surface: 'dark', foreground: ['#7dd3fc', '#5eead4', '#a5b4fc', '#67e8f9', '#93c5fd', '#99f6e4'],
|
|
28
|
+
backgrounds: ['#173b56', '#16443f', '#303e68', '#164956', '#243f64', '#214844'],
|
|
29
|
+
blockText: '#f0f9ff', separator: '#94b9cc', warning: '#fbbf24', critical: '#fca5a5' },
|
|
30
|
+
ember: { surface: 'dark', foreground: ['#fcd34d', '#fdba74', '#fda4af', '#fed7aa', '#f9a8d4', '#fde68a'],
|
|
31
|
+
backgrounds: ['#4d3620', '#542f21', '#502b39', '#493b24', '#4e2d46', '#454023'],
|
|
32
|
+
blockText: '#fff7ed', separator: '#c9aa96', warning: '#fcd34d', critical: '#fca5a5' },
|
|
33
|
+
slate: { surface: 'dark', foreground: ['#cbd5e1', '#b4c7ba', '#c8bfd5', '#cfbea7', '#d0b8c0', '#adc8cb'],
|
|
34
|
+
backgrounds: ['#303b49', '#304239', '#3d3749', '#493d30', '#48353e', '#2d4145'],
|
|
35
|
+
blockText: '#f1f5f9', separator: '#94a3b8', warning: '#e8c584', critical: '#e9a4a7' },
|
|
36
|
+
blossom: { surface: 'light', foreground: ['#67416d', '#42654f', '#604987', '#8a4c61', '#765049', '#3d6471'],
|
|
37
|
+
backgrounds: ['#eddaec', '#dcebdd', '#e4dcf2', '#f5dce6', '#efdfd7', '#d8eaf0'],
|
|
38
|
+
blockText: '#302633', separator: '#786c80', warning: '#825300', critical: '#a52c4c' },
|
|
39
|
+
};
|
|
40
|
+
export function themeDefinition(id: string): ThemeDefinition { return THEMES[id as ThemeId] ?? THEMES.classic; }
|