@fbincon/claude-code-statusline 3.9.2 → 3.11.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 +79 -78
- package/candidate.json +347 -256
- 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/help.js +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.d.ts +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js +4 -3
- 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/main.js +5 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/management/inspection.d.ts +8 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/inspection.js +147 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/inspection.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.d.ts +14 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.js +2 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.d.ts +15 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.js +90 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-worker-entry.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-worker-entry.js +33 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-worker-entry.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review.d.ts +5 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review.js +44 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/service.d.ts +4 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/service.js +10 -3
- package/node_modules/@fbincon/statusline-cli/dist/src/management/service.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/tasks/command.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.js +11 -4
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/view.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/view.js +25 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/view.js.map +1 -0
- 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 +40 -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 +103 -57
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/backend.ts +13 -7
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +13 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts +7 -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 +7 -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/package-manager.ts +314 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/package-validation.ts +43 -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/task-viewer.ts +319 -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 +86 -15
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/generated-locales.ts +834 -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 +24 -17
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +11 -3
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/help.ts +5 -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 +89 -8
- 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 +14 -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 +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js +7 -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/package-manager.d.ts +41 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/package-manager.js +281 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/package-manager.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/package-validation.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/package-validation.js +42 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/package-validation.js.map +1 -0
- 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/task-viewer.d.ts +46 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/task-viewer.js +279 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/task-viewer.js.map +1 -0
- 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 +828 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +834 -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 +139 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +139 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +139 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +139 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +139 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +139 -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-platform/dist/src/review-worker.d.ts +4 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/review-worker.js +22 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/review-worker.js.map +1 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js +22 -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 +12 -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 +9 -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 +9 -6
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/session.d.ts +3 -2
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js +53 -7
- 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 +62 -3
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/task-viewer.d.ts +6 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/task-viewer.js +34 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/task-viewer.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import type { PackageStatus, PackageReviewJob, PackageReviewRequest, Operation, ResultFor } from '../generated-contracts.ts';
|
|
3
|
+
import { t, text, renderMessage, type Language, type LocalizedText } from '../i18n/index.ts';
|
|
4
|
+
import { inputKey, inputView, textInput, type TextInput, type TextKey } from './text-input.ts';
|
|
5
|
+
import { wrapText } from '../../ui/text.ts';
|
|
6
|
+
import { BackendError } from '../backend.ts';
|
|
7
|
+
interface Row {
|
|
8
|
+
key: string;
|
|
9
|
+
text: string;
|
|
10
|
+
action?: PackageReviewRequest['action'];
|
|
11
|
+
backup?: string;
|
|
12
|
+
selected?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface PackageManager {
|
|
15
|
+
owner: string;
|
|
16
|
+
status: PackageStatus | null;
|
|
17
|
+
job: PackageReviewJob | null;
|
|
18
|
+
prefix: string;
|
|
19
|
+
target: string;
|
|
20
|
+
channel: 'latest' | 'beta' | null;
|
|
21
|
+
offset: number;
|
|
22
|
+
selected: string;
|
|
23
|
+
scroll: number;
|
|
24
|
+
rows: Row[];
|
|
25
|
+
capacity: number;
|
|
26
|
+
input: TextInput | null;
|
|
27
|
+
editing: 'prefix' | 'target' | null;
|
|
28
|
+
message: LocalizedText | string | null;
|
|
29
|
+
effect: 'load' | 'start' | 'status' | 'cancel' | 'close' | null;
|
|
30
|
+
action: PackageReviewRequest['action'];
|
|
31
|
+
backup: string | null;
|
|
32
|
+
busy: boolean;
|
|
33
|
+
closed: boolean;
|
|
34
|
+
generation: number;
|
|
35
|
+
}
|
|
36
|
+
export function packageManager(): PackageManager {
|
|
37
|
+
return { owner: 'viewer-' + Date.now().toString(36) + '-' + Math.random().toString(36).slice(2), status: null, job: null,
|
|
38
|
+
prefix: '', target: '', channel: null, offset: 0, selected: 'prefix', scroll: 0, rows: [], capacity: 1, input: null, editing: null, message: null,
|
|
39
|
+
effect: 'load', action: 'check', backup: null, busy: false, closed: false, generation: 0 };
|
|
40
|
+
}
|
|
41
|
+
export interface PackageBackend {
|
|
42
|
+
request<O extends Operation>(operation: O, payload?: unknown): ResultFor<O> | Promise<ResultFor<O>>;
|
|
43
|
+
}
|
|
44
|
+
export async function closePackage(view: PackageManager, backend: PackageBackend): Promise<void> {
|
|
45
|
+
view.closed = true;
|
|
46
|
+
view.generation++;
|
|
47
|
+
const job = view.job;
|
|
48
|
+
if (job)
|
|
49
|
+
try {
|
|
50
|
+
await backend.request('package_review_cancel', { id: job.id, owner: view.owner });
|
|
51
|
+
}
|
|
52
|
+
catch { /* Worker deadlines still bound a disconnected view. */ }
|
|
53
|
+
}
|
|
54
|
+
export async function performPackage(view: PackageManager, backend: PackageBackend): Promise<void> {
|
|
55
|
+
const effect = view.effect;
|
|
56
|
+
if (!effect || view.busy)
|
|
57
|
+
return;
|
|
58
|
+
view.effect = null;
|
|
59
|
+
if (effect === 'close') {
|
|
60
|
+
await closePackage(view, backend);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
view.busy = true;
|
|
64
|
+
const generation = view.generation;
|
|
65
|
+
try {
|
|
66
|
+
if (effect === 'load') {
|
|
67
|
+
if (view.job && view.prefix && view.job.request.prefix !== view.prefix) {
|
|
68
|
+
const cancelled = await backend.request('package_review_cancel', { id: view.job.id, owner: view.owner });
|
|
69
|
+
if (view.closed || generation !== view.generation)
|
|
70
|
+
return;
|
|
71
|
+
if (cancelled.state !== 'cancelled') {
|
|
72
|
+
view.job = cancelled;
|
|
73
|
+
view.message = text('package.ui.cancel_requested');
|
|
74
|
+
view.selected = 'message';
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
view.job = null;
|
|
78
|
+
}
|
|
79
|
+
const status = await backend.request('package_status', { prefix: view.prefix || null, offset: view.offset });
|
|
80
|
+
if (view.closed || generation !== view.generation)
|
|
81
|
+
return;
|
|
82
|
+
if (view.job && status.revision !== view.job.request.expected_revision) {
|
|
83
|
+
view.job = { ...view.job, state: 'failed', review: null, error: 'conflict' };
|
|
84
|
+
view.message = text('package.ui.changed');
|
|
85
|
+
view.selected = 'message';
|
|
86
|
+
}
|
|
87
|
+
view.status = status;
|
|
88
|
+
view.prefix = status.prefix ?? view.prefix;
|
|
89
|
+
}
|
|
90
|
+
else if (effect === 'start') {
|
|
91
|
+
if (!view.status?.prefix)
|
|
92
|
+
throw new BackendError('prefix', text('package.reason_prefix'));
|
|
93
|
+
if (view.job?.state === 'running')
|
|
94
|
+
return;
|
|
95
|
+
const previous = view.job;
|
|
96
|
+
let target = view.action === 'recover-package' ? view.status.pending?.version ?? view.target : view.target || null;
|
|
97
|
+
let integrity: string | null = null;
|
|
98
|
+
if (view.action === 'update' && previous?.state === 'complete' && previous.request.action === 'check' && previous.request.expected_revision === view.status.revision && previous.review &&
|
|
99
|
+
(!target || target === previous.review.target) && (!view.channel || view.channel === previous.review.channel || !!target)) {
|
|
100
|
+
target = previous.review.target;
|
|
101
|
+
integrity = previous.review.integrity;
|
|
102
|
+
}
|
|
103
|
+
const request: PackageReviewRequest = { action: view.action, prefix: view.status.prefix, expected_revision: view.status.revision,
|
|
104
|
+
target: view.action === 'restore-config' ? null : target, channel: !target && ['check', 'update'].includes(view.action) ? view.channel : null,
|
|
105
|
+
backup_id: view.action === 'restore-config' ? view.backup : null, expected_integrity: integrity };
|
|
106
|
+
if (previous) {
|
|
107
|
+
const cancelled = await backend.request('package_review_cancel', { id: previous.id, owner: view.owner });
|
|
108
|
+
if (view.closed || generation !== view.generation)
|
|
109
|
+
return;
|
|
110
|
+
if (cancelled.state !== 'cancelled') {
|
|
111
|
+
view.job = cancelled;
|
|
112
|
+
view.message = text('package.ui.cancel_requested');
|
|
113
|
+
view.selected = 'message';
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
view.job = null;
|
|
117
|
+
}
|
|
118
|
+
const job = await backend.request('package_review_start', { request, owner: view.owner });
|
|
119
|
+
if (view.closed || generation !== view.generation) {
|
|
120
|
+
await backend.request('package_review_cancel', { id: job.id, owner: view.owner });
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
view.job = job;
|
|
124
|
+
view.message = null;
|
|
125
|
+
view.selected = 'job';
|
|
126
|
+
}
|
|
127
|
+
else if (view.job) {
|
|
128
|
+
const job = await backend.request(effect === 'cancel' ? 'package_review_cancel' : 'package_review_status', { id: view.job.id, owner: view.owner });
|
|
129
|
+
if (view.closed || generation !== view.generation)
|
|
130
|
+
return;
|
|
131
|
+
const cancelled = effect === 'cancel' && job.state === 'cancelled';
|
|
132
|
+
view.job = cancelled ? null : job;
|
|
133
|
+
view.message = effect === 'cancel' ? text(cancelled ? 'package.cancelled' : 'package.ui.cancel_requested') : null;
|
|
134
|
+
if (effect === 'cancel')
|
|
135
|
+
view.selected = 'message';
|
|
136
|
+
else if (job.state !== 'running') {
|
|
137
|
+
view.selected = job.review ? 'verification' : job.error ? 'job-error' : 'job';
|
|
138
|
+
view.scroll = Math.max(0, view.rows.findIndex(row => row.key === 'job'));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
if (!view.closed && generation === view.generation) {
|
|
144
|
+
view.message = error instanceof BackendError && error.localization ? error.localization : text('package.reason_io_error');
|
|
145
|
+
view.selected = 'message';
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
if (generation === view.generation)
|
|
150
|
+
view.busy = false;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
export function packageView(view: PackageManager, language: Language, width: number, height: number): Row[] {
|
|
154
|
+
const tr = (key: string, params: Record<string, unknown> = {}) => t(key, language, params), rows: Row[] = [];
|
|
155
|
+
const add = (key: string, value: string, action?: Row['action'], backup?: string) => wrapText([value.replace(/[\p{Cc}\p{Cs}]/gu, '')], Math.max(2, width - 2)).forEach((line, index) => rows.push({ key: index ? key + ':' + index : key, text: line, ...(action ? { action } : {}), ...(backup ? { backup } : {}) }));
|
|
156
|
+
const status = view.status;
|
|
157
|
+
add('notice', tr('package.ui.readonly'));
|
|
158
|
+
if (status)
|
|
159
|
+
add('current', tr('package.ui.current', { value: status.current ?? tr('task.unknown') }));
|
|
160
|
+
add('prefix', tr('package.ui.prefix', { value: view.editing === 'prefix' && view.input ? inputView(view.input, Math.max(2, width - 12)) : view.prefix || tr('task.unknown') }));
|
|
161
|
+
if (!status)
|
|
162
|
+
add('loading', tr(view.busy ? 'profiles.loading' : 'task.unknown'));
|
|
163
|
+
else {
|
|
164
|
+
add('entry', tr('package.ui.entry', { value: status.entry ?? tr('task.unknown') }));
|
|
165
|
+
add('config', tr('package.ui.config', { value: status.config_dir }));
|
|
166
|
+
add('previous', tr('package.ui.previous', { value: status.previous ?? tr('task.unknown') }));
|
|
167
|
+
add('observed-channel', tr('package.ui.channel', { value: status.channel ?? tr('task.unknown') }));
|
|
168
|
+
add('runtime', `Node ${status.node_version} · Claude ${status.host ?? tr('task.unknown')}`);
|
|
169
|
+
status.reasons.forEach(reason => add('reason:' + reason, t('package.reason_' + reason, language, {}, reason)));
|
|
170
|
+
add('target', tr('package.ui.target', { value: view.editing === 'target' && view.input ? inputView(view.input, Math.max(2, width - 12)) : view.target || tr('package.ui.default_target') }));
|
|
171
|
+
add('channel', tr('package.ui.channel', { value: view.channel ?? tr('package.ui.inherit') }));
|
|
172
|
+
for (const action of ['check', 'update', 'rollback', 'recover-package'] as const)
|
|
173
|
+
add(action, 'Enter · ' + tr('package.ui.' + action), action);
|
|
174
|
+
if (status.pending)
|
|
175
|
+
add('pending', tr('package.ui.pending', { id: status.pending.id, stage: tr('package.ui.stage_' + status.pending.stage), running: status.pending.running ? tr('task.value.running') : tr('task.unknown') }));
|
|
176
|
+
for (const record of status.history) {
|
|
177
|
+
add('backup:' + record.id, `${record.id} · ${record.version ?? '—'} · ${tr('package.ui.stage_' + record.stage)} · ${tr('package.ui.backup_' + record.backup)}`, record.backup === 'verified' ? 'restore-config' : undefined, record.id);
|
|
178
|
+
}
|
|
179
|
+
if (status.total > 16) {
|
|
180
|
+
add('previous-page', tr('package.ui.previous_page'));
|
|
181
|
+
add('next-page', tr('package.ui.next_page'));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
const job = view.job;
|
|
185
|
+
if (job) {
|
|
186
|
+
add('job', tr('package.ui.job', { id: job.id, state: tr('package.ui.state_' + job.state) }));
|
|
187
|
+
if (job.error)
|
|
188
|
+
add('job-error', t('package.reason_' + job.error, language, {}, job.error));
|
|
189
|
+
if (job.review) {
|
|
190
|
+
const review = job.review;
|
|
191
|
+
add('verification', tr(review.action === 'restore-config' ? 'package.ui.restore_review' : review.artifact_verified ? 'package.ui.verified' : 'package.ui.unverified'));
|
|
192
|
+
add('review-target', `${review.current ?? '—'} → ${review.target ?? '—'}`);
|
|
193
|
+
add('review-config', tr('package.ui.config', { value: review.config_dir }));
|
|
194
|
+
if (review.registry)
|
|
195
|
+
add('registry', review.registry);
|
|
196
|
+
if (review.integrity)
|
|
197
|
+
add('integrity', review.integrity);
|
|
198
|
+
if (review.node_engine)
|
|
199
|
+
add('engine', 'Node ' + review.node_engine);
|
|
200
|
+
review.reasons.forEach(reason => add('review-reason:' + reason, t('package.reason_' + reason, language, {}, reason)));
|
|
201
|
+
review.configuration_conflicts.forEach(file => add('conflict:' + file, file));
|
|
202
|
+
review.files.forEach(file => add('restore:' + file, file));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (view.message)
|
|
206
|
+
add('message', renderMessage(view.message, language));
|
|
207
|
+
let index = rows.findIndex(row => row.key === view.selected);
|
|
208
|
+
if (index < 0)
|
|
209
|
+
index = 0;
|
|
210
|
+
view.rows = rows;
|
|
211
|
+
view.selected = rows[index]?.key ?? '';
|
|
212
|
+
view.capacity = Math.max(1, height);
|
|
213
|
+
view.scroll = Math.max(0, Math.min(view.scroll, index, Math.max(0, rows.length - view.capacity)));
|
|
214
|
+
if (index >= view.scroll + view.capacity)
|
|
215
|
+
view.scroll = index - view.capacity + 1;
|
|
216
|
+
return rows.slice(view.scroll, view.scroll + view.capacity).map(row => ({ ...row, text: (row.key === view.selected ? '› ' : ' ') + row.text, selected: row.key === view.selected }));
|
|
217
|
+
}
|
|
218
|
+
export function packageKey(view: PackageManager, event: TextKey): 'packages' | null {
|
|
219
|
+
const key = event.key === 'return' ? 'enter' : event.key, cancel = !event.text && !event.paste && (key === 'escape' || event.ctrl && key.toLowerCase() === 'g');
|
|
220
|
+
if (view.input && view.editing) {
|
|
221
|
+
if (cancel) {
|
|
222
|
+
view.input = null;
|
|
223
|
+
view.editing = null;
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
if (!event.text && !event.paste && key === 'enter') {
|
|
227
|
+
const field = view.editing;
|
|
228
|
+
view[field] = view.input.value;
|
|
229
|
+
view.input = null;
|
|
230
|
+
view.editing = null;
|
|
231
|
+
if (field === 'prefix')
|
|
232
|
+
view.status = null;
|
|
233
|
+
if (field === 'target' && view.job) {
|
|
234
|
+
view.effect = 'cancel';
|
|
235
|
+
return 'packages';
|
|
236
|
+
}
|
|
237
|
+
if (field === 'prefix') {
|
|
238
|
+
view.offset = 0;
|
|
239
|
+
view.effect = 'load';
|
|
240
|
+
return 'packages';
|
|
241
|
+
}
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
const result = inputKey(view.input.value, view.input, event, view.editing === 'prefix' ? 4096 : 100);
|
|
245
|
+
view.input = result.state;
|
|
246
|
+
if (result.error)
|
|
247
|
+
view.message = text('input.' + result.error, { limit: view.editing === 'prefix' ? 4096 : 100 });
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
if (event.text || event.paste || event.meta)
|
|
251
|
+
return null;
|
|
252
|
+
if (cancel || !event.ctrl && key.toLowerCase() === 'q') {
|
|
253
|
+
view.effect = 'close';
|
|
254
|
+
return 'packages';
|
|
255
|
+
}
|
|
256
|
+
if (event.ctrl || view.busy)
|
|
257
|
+
return null;
|
|
258
|
+
if (key.toLowerCase() === 'r') {
|
|
259
|
+
view.effect = view.job ? 'status' : 'load';
|
|
260
|
+
return 'packages';
|
|
261
|
+
}
|
|
262
|
+
if (key.toLowerCase() === 'l') {
|
|
263
|
+
view.effect = 'load';
|
|
264
|
+
return 'packages';
|
|
265
|
+
}
|
|
266
|
+
if (key.toLowerCase() === 'c' && view.job) {
|
|
267
|
+
view.effect = 'cancel';
|
|
268
|
+
return 'packages';
|
|
269
|
+
}
|
|
270
|
+
let index = Math.max(0, view.rows.findIndex(row => row.key === view.selected));
|
|
271
|
+
if (key === 'up')
|
|
272
|
+
index--;
|
|
273
|
+
if (key === 'down')
|
|
274
|
+
index++;
|
|
275
|
+
if (key === 'pageup')
|
|
276
|
+
index -= view.capacity;
|
|
277
|
+
if (key === 'pagedown')
|
|
278
|
+
index += view.capacity;
|
|
279
|
+
if (key === 'home')
|
|
280
|
+
index = 0;
|
|
281
|
+
if (key === 'end')
|
|
282
|
+
index = view.rows.length - 1;
|
|
283
|
+
view.selected = view.rows[Math.max(0, Math.min(index, view.rows.length - 1))]?.key ?? '';
|
|
284
|
+
if (key !== 'enter')
|
|
285
|
+
return null;
|
|
286
|
+
const selectedKey = view.selected.replace(/:\d+$/u, '');
|
|
287
|
+
if (selectedKey === 'prefix' || selectedKey === 'target') {
|
|
288
|
+
view.editing = selectedKey;
|
|
289
|
+
view.input = textInput(view[view.editing]);
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
if (selectedKey === 'channel') {
|
|
293
|
+
const channels = [null, 'latest', 'beta'] as const;
|
|
294
|
+
view.channel = channels[(channels.indexOf(view.channel) + 1) % 3]!;
|
|
295
|
+
if (view.job) {
|
|
296
|
+
view.effect = 'cancel';
|
|
297
|
+
return 'packages';
|
|
298
|
+
}
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
if (['next-page', 'previous-page'].includes(selectedKey)) {
|
|
302
|
+
view.offset = Math.max(0, Math.min(view.offset + (selectedKey === 'next-page' ? 16 : -16), Math.max(0, Math.floor(((view.status?.total ?? 1) - 1) / 16) * 16)));
|
|
303
|
+
view.effect = 'load';
|
|
304
|
+
return 'packages';
|
|
305
|
+
}
|
|
306
|
+
const selected = view.rows.find(row => row.key === view.selected);
|
|
307
|
+
if (selected?.action) {
|
|
308
|
+
view.action = selected.action;
|
|
309
|
+
view.backup = selected.backup ?? null;
|
|
310
|
+
view.effect = 'start';
|
|
311
|
+
return 'packages';
|
|
312
|
+
}
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import type { PackageReviewRequest } from '../generated-contracts.ts';
|
|
3
|
+
const object = (value: unknown): value is Record<string, unknown> => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
4
|
+
const string = (value: unknown): value is string => typeof value === 'string' && value.length <= 8192 && !/[\p{Cc}\p{Cs}]/u.test(value);
|
|
5
|
+
const nullable = (value: unknown) => value === null || string(value);
|
|
6
|
+
const exact = (value: Record<string, unknown>, keys: string[]) => Object.keys(value).sort().join(',') === keys.sort().join(',');
|
|
7
|
+
const strings = (value: unknown) => Array.isArray(value) && value.length <= 128 && value.every(string);
|
|
8
|
+
const channel = (value: unknown) => value === null || value === 'latest' || value === 'beta';
|
|
9
|
+
export function isPackageRequest(value: unknown): value is PackageReviewRequest {
|
|
10
|
+
return object(value) && exact(value, ['action', 'prefix', 'expected_revision', 'target', 'channel', 'backup_id', 'expected_integrity']) &&
|
|
11
|
+
['check', 'update', 'rollback', 'recover-package', 'restore-config'].includes(String(value.action)) && string(value.prefix) && !!value.prefix &&
|
|
12
|
+
typeof value.expected_revision === 'string' && /^[0-9a-f]{64}$/u.test(value.expected_revision) && nullable(value.target) &&
|
|
13
|
+
(value.target === null || /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u.test(String(value.target))) && channel(value.channel) &&
|
|
14
|
+
nullable(value.backup_id) && (value.backup_id === null || /^pkg-[0-9a-f-]{36}$/u.test(String(value.backup_id))) &&
|
|
15
|
+
nullable(value.expected_integrity) && (value.expected_integrity === null || /^sha512-[A-Za-z0-9+/]{86}==$/u.test(String(value.expected_integrity))) &&
|
|
16
|
+
!(value.target && value.channel) &&
|
|
17
|
+
(value.action !== 'restore-config' || !!value.backup_id && value.target === null && value.channel === null) &&
|
|
18
|
+
(['check', 'update'].includes(String(value.action)) || value.channel === null);
|
|
19
|
+
}
|
|
20
|
+
function history(value: unknown): boolean {
|
|
21
|
+
return object(value) && exact(value, ['id', 'version', 'created', 'stage', 'backup', 'running']) && string(value.id) && nullable(value.version) &&
|
|
22
|
+
nullable(value.created) && string(value.stage) && ['verified', 'missing', 'invalid'].includes(String(value.backup)) && typeof value.running === 'boolean';
|
|
23
|
+
}
|
|
24
|
+
function review(value: unknown): boolean {
|
|
25
|
+
return object(value) && exact(value, ['action', 'current', 'target', 'prefix', 'entry', 'config_dir', 'channel', 'registry', 'integrity', 'node_engine', 'host', 'artifact_verified', 'compatible', 'reasons', 'configuration_conflicts', 'backup_id', 'files']) &&
|
|
26
|
+
['check', 'update', 'rollback', 'recover-package', 'restore-config'].includes(String(value.action)) &&
|
|
27
|
+
['current', 'target', 'entry', 'registry', 'integrity', 'node_engine', 'host', 'backup_id'].every(key => nullable(value[key])) &&
|
|
28
|
+
string(value.prefix) && string(value.config_dir) && channel(value.channel) && typeof value.artifact_verified === 'boolean' && typeof value.compatible === 'boolean' &&
|
|
29
|
+
strings(value.reasons) && strings(value.configuration_conflicts) && strings(value.files);
|
|
30
|
+
}
|
|
31
|
+
export function isPackageResult(operation: string, value: unknown): boolean {
|
|
32
|
+
if (!object(value) || value.version !== 1)
|
|
33
|
+
return false;
|
|
34
|
+
if (operation === 'package_status')
|
|
35
|
+
return exact(value, ['version', 'backend_version', 'captured_at', 'revision', 'prefix', 'entry', 'config_dir', 'current', 'previous', 'channel', 'node_version', 'host', 'compatible', 'reasons', 'pending', 'history', 'offset', 'total']) &&
|
|
36
|
+
['backend_version', 'captured_at', 'revision', 'config_dir', 'node_version'].every(key => string(value[key])) && /^[0-9a-f]{64}$/u.test(String(value.revision)) &&
|
|
37
|
+
['prefix', 'entry', 'current', 'previous', 'host'].every(key => nullable(value[key])) && channel(value.channel) && typeof value.compatible === 'boolean' && strings(value.reasons) &&
|
|
38
|
+
(value.pending === null || history(value.pending)) && Array.isArray(value.history) && value.history.length <= 16 && value.history.every(history) &&
|
|
39
|
+
Number.isSafeInteger(value.offset) && Number(value.offset) >= 0 && Number.isSafeInteger(value.total) && Number(value.total) >= 0;
|
|
40
|
+
return exact(value, ['version', 'id', 'owner', 'state', 'started_at', 'finished_at', 'request', 'review', 'error']) &&
|
|
41
|
+
['id', 'owner', 'started_at'].every(key => string(value[key])) && ['running', 'complete', 'failed', 'cancelled'].includes(String(value.state)) &&
|
|
42
|
+
nullable(value.finished_at) && nullable(value.error) && isPackageRequest(value.request) && (value.review === null || review(value.review));
|
|
43
|
+
}
|
|
@@ -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'; }
|