@fbincon/claude-code-statusline 3.12.0 → 3.13.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 +82 -79
- package/candidate.json +216 -165
- package/node_modules/@fbincon/statusline-cli/dist/src/config/arguments.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/arguments.js +9 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/arguments.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/commands.js +23 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/commands.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.js +7 -3
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/reuse.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/reuse.js +62 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/reuse.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/structural-review.d.ts +5 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/structural-review.js +45 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/structural-review.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +3 -3
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js +14 -0
- 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 +7 -3
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/backend.ts +4 -0
- 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 +8 -5
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/alignment-manager.ts +2 -2
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/change-review.ts +109 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/color-manager.ts +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts +70 -21
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/forms.ts +2 -9
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/group-manager.ts +2 -3
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/groups.ts +2 -2
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/history.ts +33 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/reuse-manager.ts +150 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/reuse.ts +96 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/source-compatibility.ts +7 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/source-manager.ts +12 -5
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/structure.ts +30 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts +10 -3
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/en.ts +72 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/ja.ts +72 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/ko.ts +72 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/zh-CN.ts +72 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/zh-HK.ts +72 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/zh-TW.ts +72 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +30 -24
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +4 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/help.ts +3 -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/contracts/ui.d.ts +32 -3
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js +2 -2
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/alignment-manager.js +2 -2
- package/node_modules/@fbincon/statusline-core/dist/src/editor/alignment-manager.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js +6 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/change-review.d.ts +32 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/change-review.js +155 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/change-review.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/color-manager.js +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/color-manager.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.d.ts +17 -3
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js +114 -23
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/forms.js +2 -10
- package/node_modules/@fbincon/statusline-core/dist/src/editor/forms.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/group-manager.js +2 -5
- package/node_modules/@fbincon/statusline-core/dist/src/editor/group-manager.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/groups.d.ts +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/groups.js +2 -2
- package/node_modules/@fbincon/statusline-core/dist/src/editor/groups.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/history.d.ts +22 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/history.js +37 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/history.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/reuse-manager.d.ts +39 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/reuse-manager.js +271 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/reuse-manager.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/reuse.d.ts +6 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/reuse.js +135 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/reuse.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/source-compatibility.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/source-compatibility.js +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/source-compatibility.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.js +12 -5
- package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/structure.d.ts +16 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/structure.js +28 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/structure.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.d.ts +426 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +432 -6
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.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/resources/i18n/locales/en.json +72 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +72 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +72 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +72 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +72 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +72 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js +6 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js +3 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js +16 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/session.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 +35 -9
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -1
- package/package.json +2 -2
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/history.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
/** Session-only snapshots. These are host state, never presentation props or disk data. */
|
|
3
|
+
import type { Draft } from '../generated-contracts.ts';
|
|
4
|
+
import type { LocalizedText } from '../i18n/index.ts';
|
|
5
|
+
|
|
6
|
+
export const HISTORY_STEPS = 100;
|
|
7
|
+
export const HISTORY_BYTES = 16 * 1024 * 1024;
|
|
8
|
+
export interface HistoryEntry { draft: Draft; label: LocalizedText; bytes: number }
|
|
9
|
+
export interface DraftHistory { undo: HistoryEntry[]; redo: HistoryEntry[]; trimmed: boolean }
|
|
10
|
+
export const emptyHistory = (): DraftHistory => ({ undo: [], redo: [], trimmed: false });
|
|
11
|
+
export const clone = <T>(value: T): T => JSON.parse(JSON.stringify(value)) as T;
|
|
12
|
+
export function semantic(value: unknown): string {
|
|
13
|
+
if (Array.isArray(value)) return '[' + value.map(semantic).join(',') + ']';
|
|
14
|
+
if (value !== null && typeof value === 'object') return '{' + Object.keys(value).sort().map(key => JSON.stringify(key) + ':' + semantic((value as Record<string, unknown>)[key])).join(',') + '}';
|
|
15
|
+
return JSON.stringify(value);
|
|
16
|
+
}
|
|
17
|
+
/** Count UTF-8 without depending on Node or a host-specific TextEncoder. */
|
|
18
|
+
export function snapshot(draft: Draft, label: LocalizedText): HistoryEntry {
|
|
19
|
+
const raw = JSON.stringify(draft); let bytes = 0;
|
|
20
|
+
for (const c of raw) { const n = c.codePointAt(0)!; bytes += n < 128 ? 1 : n < 2048 ? 2 : n < 65536 ? 3 : 4; }
|
|
21
|
+
return { draft: clone(draft), label: clone(label), bytes };
|
|
22
|
+
}
|
|
23
|
+
export function boundHistory(history: DraftHistory): void {
|
|
24
|
+
let bytes = [...history.undo, ...history.redo].reduce((sum, entry) => sum + entry.bytes, 0);
|
|
25
|
+
while (history.undo.length + history.redo.length > HISTORY_STEPS || bytes > HISTORY_BYTES) {
|
|
26
|
+
const removed = history.undo.length ? history.undo.shift() : history.redo.shift();
|
|
27
|
+
if (!removed) break;
|
|
28
|
+
bytes -= removed.bytes; history.trimmed = true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function remember(history: DraftHistory, before: Draft, label: LocalizedText): void {
|
|
32
|
+
history.redo = []; history.undo.push(snapshot(before, label)); boundHistory(history);
|
|
33
|
+
}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/reuse-manager.ts
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import type { Draft, ProfilesResult, ReuseRequest, ReuseReviewResult, Scope } from '../generated-contracts.ts';
|
|
3
|
+
import type { Editor } from './draft.ts';
|
|
4
|
+
import type { ReviewBackend } from './change-review.ts';
|
|
5
|
+
import { targetIdentity } from './change-review.ts';
|
|
6
|
+
import { clip } from '../unicode.ts';
|
|
7
|
+
import { clone } from './history.ts';
|
|
8
|
+
import { STYLE_FIELDS, styleFields, reuseDraft } from './reuse.ts';
|
|
9
|
+
import { createReview, navigateReview, reviewRows, type ReviewState } from './import-review.ts';
|
|
10
|
+
import { newInstance } from './instances.ts';
|
|
11
|
+
import { openSources } from './source-manager.ts';
|
|
12
|
+
import { inputKey, inputView, textInput, type TextInput, type TextKey } from './text-input.ts';
|
|
13
|
+
import { text, t, renderMessage, type Language, type LocalizedText } from '../i18n/index.ts';
|
|
14
|
+
|
|
15
|
+
export interface ReuseManager {
|
|
16
|
+
kind: 'style' | 'groups'; page: 'source' | 'path' | 'profiles' | 'select' | 'fields' | 'review' | 'complete';
|
|
17
|
+
generation: number; target: string; scope: Scope; fromScope: Scope; destination: string; incoming: Draft; local: boolean;
|
|
18
|
+
from: string; groups: string[]; fields: string[]; references: 'review' | 'expand' | 'exclude'; explicit: boolean;
|
|
19
|
+
cursor: number; scroll: number; details: boolean; input: TextInput; profileFile: boolean; library: ProfilesResult | null;
|
|
20
|
+
result: ReuseReviewResult | null; review: ReviewState | null; message: LocalizedText | null; effect: 'file' | 'profiles' | null;
|
|
21
|
+
}
|
|
22
|
+
export function openReuse(e: Editor, kind: ReuseManager['kind']): void {
|
|
23
|
+
const scope = e.detail?.scope ?? (e.page === 'subagents' ? 'subagent' : 'main');
|
|
24
|
+
e.reuse = { kind, page: 'source', generation: e.mutationGeneration, target: targetIdentity(e.baseline), scope, fromScope: scope, destination: e.detail?.id ?? e.selected[scope],
|
|
25
|
+
incoming: clone(e.draft), local: true, from: '', groups: [], fields: [], references: 'review', explicit: false, cursor: 0, scroll: 0, details: false,
|
|
26
|
+
input: textInput('statusline.json'), profileFile: false, library: null, result: null, review: null, message: null, effect: null };
|
|
27
|
+
}
|
|
28
|
+
function source(e: Editor) { const m=e.reuse!; return m.fromScope === 'main' ? m.incoming.display : m.incoming.display.subagents; }
|
|
29
|
+
function request(m: ReuseManager): ReuseRequest {
|
|
30
|
+
return m.kind === 'style' ? { kind:'style',scope:m.scope,from_scope:m.fromScope,from_id:m.from,to_ids:[m.destination],fields:[...m.fields] }
|
|
31
|
+
: {kind:'groups',scope:m.scope,group_ids:[...m.groups],references:m.references,explicit:m.explicit};
|
|
32
|
+
}
|
|
33
|
+
function refresh(e: Editor): void {
|
|
34
|
+
const m=e.reuse!;
|
|
35
|
+
try {
|
|
36
|
+
m.result = reuseDraft(e.draft,m.incoming,request(m),()=>newInstance('text',[]).id,e.description.catalog,m.local);
|
|
37
|
+
m.review = createReview(m.result); m.details = m.result.blocked.length > 0; m.scroll=0; m.message = m.result.blocked.length ? text(m.result.blocked[0]!) : null;
|
|
38
|
+
} catch (error) { m.result=null;m.review=null;m.message=text(error instanceof Error && error.message==='reuse.incompatible'?'reuse.incompatible':'reuse.invalid'); }
|
|
39
|
+
}
|
|
40
|
+
function reviewCapacity(m: ReuseManager,height:number):number {
|
|
41
|
+
const headers=1+Number(height>=4)+Number(m.kind==='style'&&height>=5)+Number(m.kind==='groups'&&height>=6)+Number(m.kind==='groups'&&height>=7);
|
|
42
|
+
return Math.max(1,height-headers-1);
|
|
43
|
+
}
|
|
44
|
+
function rows(e: Editor, language: Language): string[] {
|
|
45
|
+
const m=e.reuse!,tr=(key:string)=>t('reuse.'+key,language);
|
|
46
|
+
if(m.page==='source')return ['current','portable','profile_file','profiles'].map(tr);
|
|
47
|
+
if(m.page==='profiles')return m.library?.profiles.map(p=>p.name)??[];
|
|
48
|
+
if(m.page==='complete')return [tr('accepted'),...(m.result?.unresolved.map(u=>`${u.id} · ${u.hint} · ${tr('unbound')}`)??[]),tr('bind_help')];
|
|
49
|
+
if(m.page==='select'){
|
|
50
|
+
const values=m.kind==='style'?source(e).instances.filter(n=>n.type_id!=='spacer').map(n=>`${n.id} · ${n.options.label??t('items.'+m.fromScope+'.'+n.type_id+'.label',language)}`)
|
|
51
|
+
:source(e).groups.map(g=>`[${m.groups.includes(g.id)?'x':' '}] ${g.id} · ${g.member_ids.join(', ')}`);
|
|
52
|
+
return [tr('scope')+': '+m.fromScope,...values,...(m.kind==='groups'?[tr('review')]:[])];
|
|
53
|
+
}
|
|
54
|
+
if(m.page==='fields'){
|
|
55
|
+
const origin=source(e).instances.find(n=>n.id===m.from),destination=e.instance(m.scope,m.destination);
|
|
56
|
+
const available=origin&&destination?styleFields(origin,m.fromScope,e.description.catalog).filter(f=>styleFields(destination,m.scope,e.description.catalog).includes(f)):[];
|
|
57
|
+
return [...STYLE_FIELDS.map(f=>`[${m.fields.includes(f)?'x':' '}] ${t('reuse.field.'+f,language)}${available.includes(f)?'':' · '+tr('unsupported')}`),tr('review')];
|
|
58
|
+
}
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
export function reuseKey(e: Editor,event:TextKey,language:Language,width:number,height:number):'reuse'|'sources'|null {
|
|
62
|
+
const m=e.reuse!,key=event.key==='enter'?'return':event.key;
|
|
63
|
+
if(event.overflow)return null;
|
|
64
|
+
if(!event.text&&!event.paste&&(key==='escape'||event.ctrl&&key.toLowerCase()==='g')){e.reuse=null;return null;}
|
|
65
|
+
if(m.page==='path'){
|
|
66
|
+
if(key==='return'&&!event.text&&!event.paste){m.effect='file';return 'reuse';}
|
|
67
|
+
m.input=inputKey(m.input.value,m.input,event,4096).state;return null;
|
|
68
|
+
}
|
|
69
|
+
if(event.text||event.paste||event.ctrl||event.meta)return null;
|
|
70
|
+
if(key.toLowerCase()==='q'){e.reuse=null;return null;}
|
|
71
|
+
if(m.page==='complete'){if(key.toLowerCase()==='b'){e.reuse=null;openSources(e);return 'sources';}const total=rows(e,language).length;if(['up','down','pageup','pagedown','home','end'].includes(key))m.cursor=Math.max(0,Math.min(total-1,key==='home'?0:key==='end'?total-1:m.cursor+(key==='up'?-1:key==='down'?1:key==='pageup'?-Math.max(1,height-3):Math.max(1,height-3))));return null;}
|
|
72
|
+
if(m.generation!==e.mutationGeneration||m.target!==targetIdentity(e.baseline)||!e.canMutateDraft()){m.message=text('history.stale');return null;}
|
|
73
|
+
if(m.page==='review'){
|
|
74
|
+
if(key==='tab'&&m.kind==='groups'){m.details=!m.details;m.scroll=0;return null;}
|
|
75
|
+
if(m.details&&['up','down','pageup','pagedown','home','end'].includes(key)) {const capacity=reviewCapacity(m,height),maximum=Math.max(0,detailRows(m,language).length-capacity);m.scroll=Math.max(0,Math.min(maximum,key==='home'?0:key==='end'?maximum:m.scroll+(key==='up'?-1:key==='down'?1:key==='pageup'?-capacity:capacity)));return null;}
|
|
76
|
+
if(key.toLowerCase()==='a'){
|
|
77
|
+
if(m.result&&!m.result.blocked.length&&e.commitDraft(m.result.draft,text('reuse.action'))){m.page='complete';m.cursor=0;m.scroll=0;}
|
|
78
|
+
}else if(key.toLowerCase()==='x'&&m.kind==='groups'){m.references=m.references==='review'?'expand':m.references==='expand'?'exclude':'review';refresh(e);}
|
|
79
|
+
else if(key.toLowerCase()==='l'&&m.kind==='groups'){m.explicit=!m.explicit;refresh(e);}
|
|
80
|
+
else if(key==='backspace'){m.page=m.kind==='style'?'fields':'select';m.cursor=0;}
|
|
81
|
+
else if(m.review)navigateReview(m.review,key,language,width,reviewCapacity(m,height));
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
const values=rows(e,language),length=values.length;
|
|
85
|
+
if(['up','down','pageup','pagedown','home','end'].includes(key))m.cursor=Math.max(0,Math.min(length-1,key==='home'?0:key==='end'?length-1:m.cursor+(key==='up'?-1:key==='down'?1:key==='pageup'?-Math.max(1,height-3):Math.max(1,height-3))));
|
|
86
|
+
if(!['return',' ','space','left','right'].includes(key))return null;
|
|
87
|
+
if(m.page==='source'){
|
|
88
|
+
if(m.cursor===0){m.page='select';m.cursor=0;}
|
|
89
|
+
else if(m.cursor===3){m.effect='profiles';return 'reuse';}
|
|
90
|
+
else {m.profileFile=m.cursor===2;m.page='path';}
|
|
91
|
+
}else if(m.page==='profiles'){
|
|
92
|
+
const profile=m.library?.profiles[m.cursor];if(profile){m.incoming={display:clone(profile.display),host:clone(e.draft.host)};m.local=false;m.page='select';m.cursor=0;}
|
|
93
|
+
}else if(m.page==='select'){
|
|
94
|
+
if(m.cursor===0){m.fromScope=m.fromScope==='main'?'subagent':'main';if(m.kind==='groups'){m.scope=m.fromScope;m.groups=[];}return null;}
|
|
95
|
+
if(m.kind==='style'){
|
|
96
|
+
const node=source(e).instances.filter(n=>n.type_id!=='spacer')[m.cursor-1];
|
|
97
|
+
if(node){m.from=node.id;const destination=e.instance(m.scope,m.destination);m.fields=destination?STYLE_FIELDS.slice(0,6).filter(f=>styleFields(node,m.fromScope,e.description.catalog).includes(f)&&styleFields(destination,m.scope,e.description.catalog).includes(f)):[];m.page='fields';m.cursor=0;}
|
|
98
|
+
}else{
|
|
99
|
+
const group=source(e).groups[m.cursor-1];
|
|
100
|
+
if(group)m.groups=m.groups.includes(group.id)?m.groups.filter(id=>id!==group.id):[...m.groups,group.id];
|
|
101
|
+
else if(m.groups.length){refresh(e);m.page='review';m.cursor=0;}
|
|
102
|
+
}
|
|
103
|
+
}else if(m.page==='fields'){
|
|
104
|
+
const field=STYLE_FIELDS[m.cursor];
|
|
105
|
+
if(!field){refresh(e);m.page='review';m.cursor=0;}
|
|
106
|
+
else {const origin=source(e).instances.find(n=>n.id===m.from)!,destination=e.instance(m.scope,m.destination);if(destination&&styleFields(origin,m.fromScope,e.description.catalog).includes(field)&&styleFields(destination,m.scope,e.description.catalog).includes(field))m.fields=m.fields.includes(field)?m.fields.filter(f=>f!==field):[...m.fields,field];else m.message=text('reuse.incompatible');}
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
function detailRows(m:ReuseManager,language:Language):{text:string;heading:boolean;section:string}[]{
|
|
111
|
+
const tr=(key:string)=>t('reuse.'+key,language);
|
|
112
|
+
return [
|
|
113
|
+
...(m.kind==='groups'?[
|
|
114
|
+
{text:tr(m.references)+' · '+tr('reference_policy'),heading:false,section:''},
|
|
115
|
+
{text:t('values.'+(m.explicit?'on':'off'),language)+': '+tr('layout'),heading:false,section:''}
|
|
116
|
+
]:[]),
|
|
117
|
+
...(m.result?.dependencies.map(id=>({text:tr('dependency')+': '+id,heading:false,section:''}))??[]),
|
|
118
|
+
...Object.entries(m.result?.mappings??{}).flatMap(([kind,map])=>Object.entries(map).map(([a,b])=>({text:kind+': '+a+' → '+b,heading:false,section:''}))),
|
|
119
|
+
...(m.result?.unresolved.map(u=>({text:tr('unbound')+': '+u.id+' · '+u.hint,heading:false,section:''}))??[])
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
export function reuseView(e:Editor,language:Language,width:number,height:number):{text:string;selected?:boolean}[]{
|
|
123
|
+
const m=e.reuse!,tr=(key:string)=>t('reuse.'+key,language),header=tr(m.kind==='style'?'style':'groups');
|
|
124
|
+
if(m.page==='path')return [{text:header},{text:tr('path')},{text:inputView({...m.input},width)},{text:tr('path_help')}].slice(0,height).map(row=>({...row,text:clip(row.text,width)}));
|
|
125
|
+
if(m.page==='review'){
|
|
126
|
+
const capacity=reviewCapacity(m,height),review=m.review;
|
|
127
|
+
const values=m.details?detailRows(m,language):review?reviewRows(review,language,width):[];
|
|
128
|
+
const offset=m.details?Math.max(0,Math.min(m.scroll,values.length-capacity)):Math.max(0,Math.min(review?.scroll??0,values.length-capacity));
|
|
129
|
+
return [{text:header},...(height>=4?[{text:m.message?renderMessage(m.message,language):tr('draft_only')}]:[]),
|
|
130
|
+
...(m.kind==='groups'&&height>=6?[{text:tr(m.references)+' · '+tr('reference_policy')}]:[]),
|
|
131
|
+
...(m.kind==='groups'&&height>=7?[{text:t('values.'+(m.explicit?'on':'off'),language)+': '+tr('layout')}]:[]),
|
|
132
|
+
...(m.kind==='style'&&height>=5?[{text:tr('scope')+': '+m.fromScope+' · '+m.from+' → '+m.destination}]:[]),
|
|
133
|
+
...values.slice(offset,offset+capacity).map(r=>({text:r.text,selected:r.heading&&r.section===review?.selected})),{text:tr(m.kind==='groups'?'review_groups_help':'review_style_help')}].slice(0,height).map(row=>({...row,text:clip(row.text,width)}));
|
|
134
|
+
}
|
|
135
|
+
const values=rows(e,language),capacity=Math.max(1,height-3);let start=Math.max(0,Math.min(m.scroll,m.cursor));if(m.cursor>=start+capacity)start=m.cursor-capacity+1;
|
|
136
|
+
return [{text:header},{text:m.message?renderMessage(m.message,language):tr('help')},...values.slice(start,start+capacity).map((value,index)=>({text:(start+index===m.cursor?'› ':' ')+value,selected:start+index===m.cursor})),{text:tr('cancel_help')}].slice(0,height).map(row=>({...row,text:clip(row.text,width)}));
|
|
137
|
+
}
|
|
138
|
+
export async function performReuse(e:Editor,backend:ReviewBackend):Promise<void>{
|
|
139
|
+
const m=e.reuse,effect=m?.effect;if(!m||!effect)return;m.effect=null;
|
|
140
|
+
try{
|
|
141
|
+
if(!e.canMutateDraft(m.generation)||m.target!==targetIdentity(e.baseline))throw new Error('history.stale');
|
|
142
|
+
if(effect==='profiles'){
|
|
143
|
+
const library=await backend.request('profiles_read',{});if(e.reuse!==m||m.generation!==e.mutationGeneration)return;m.library=library;m.page='profiles';m.cursor=0;
|
|
144
|
+
}else{
|
|
145
|
+
const incoming=m.profileFile?{display:(await backend.request('profile_import',{path:m.input.value})).display,host:clone(e.draft.host)}:(await backend.request('review_import',{draft:e.draft,path:m.input.value})).draft;
|
|
146
|
+
if(e.reuse!==m||m.generation!==e.mutationGeneration)return;m.incoming=clone(incoming);m.local=false;m.page='select';m.cursor=0;m.groups=[];
|
|
147
|
+
}
|
|
148
|
+
m.message=null;
|
|
149
|
+
}catch(error){if(e.reuse===m)m.message=text('history.failed',{detail:error instanceof Error?error.message:String(error)});}
|
|
150
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
/** Pure style selection and whole-group reference closure, shared by all frontends. */
|
|
3
|
+
import type { CatalogItem, Draft, InstanceDraft, ReuseRequest, ReuseReviewResult, Scope } from '../generated-contracts.ts';
|
|
4
|
+
import { FORMAT_CHOICES } from '../generated-contracts.ts';
|
|
5
|
+
import { clone } from './history.ts';
|
|
6
|
+
import { supportedFormats } from './appearance.ts';
|
|
7
|
+
import { alignmentUnits, refKey } from './alignments.ts';
|
|
8
|
+
import { isDraft } from '../backend.ts';
|
|
9
|
+
import { differences } from './import-differences.ts';
|
|
10
|
+
|
|
11
|
+
export const STYLE_FIELDS = ['foreground', 'background', 'foreground_gradient', 'background_gradient', 'label', 'icon', ...Object.keys(FORMAT_CHOICES).map(key => 'formatting.' + key)];
|
|
12
|
+
const area = (draft: Draft, scope: Scope) => scope === 'main' ? draft.display : draft.display.subagents;
|
|
13
|
+
export function styleFields(node: InstanceDraft, scope: Scope, catalog: readonly CatalogItem[] = []): string[] {
|
|
14
|
+
if (node.type_id === 'spacer') return [];
|
|
15
|
+
const formats = supportedFormats(scope, node.type_id, catalog.find(c => c.scope === scope && c.id === node.type_id)?.capabilities);
|
|
16
|
+
return STYLE_FIELDS.filter(field => !field.startsWith('formatting.') || formats.includes(field.slice(11)));
|
|
17
|
+
}
|
|
18
|
+
export function reuseRequest(value: unknown): ReuseRequest {
|
|
19
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) throw new Error('reuse.invalid');
|
|
20
|
+
const r = value as Record<string, unknown>, ids = (v: unknown): v is string[] => Array.isArray(v) && v.length <= 10000 && v.every(id => typeof id === 'string' && /^[A-Za-z0-9][A-Za-z0-9_-]{0,95}$/u.test(id)) && new Set(v).size === v.length;
|
|
21
|
+
const keys = r.kind === 'style' ? ['kind','scope','from_scope','from_id','to_ids','fields'] : ['kind','scope','group_ids','references','explicit'];
|
|
22
|
+
if (Object.keys(r).length !== keys.length || keys.some(key => !Object.hasOwn(r,key)) || !['main','subagent'].includes(String(r.scope))) throw new Error('reuse.invalid');
|
|
23
|
+
if (r.kind === 'style') {
|
|
24
|
+
if (!['main','subagent'].includes(String(r.from_scope)) || !ids([r.from_id]) || !ids(r.to_ids) || !r.to_ids.length || !Array.isArray(r.fields) || r.fields.some(f => !STYLE_FIELDS.includes(String(f))) || new Set(r.fields).size !== r.fields.length) throw new Error('reuse.invalid');
|
|
25
|
+
} else if (r.kind !== 'groups' || !ids(r.group_ids) || !r.group_ids.length || !['review','expand','exclude'].includes(String(r.references)) || typeof r.explicit !== 'boolean') throw new Error('reuse.invalid');
|
|
26
|
+
return clone(value as ReuseRequest);
|
|
27
|
+
}
|
|
28
|
+
export function reuseDraft(base: Draft, incoming: Draft, raw: ReuseRequest, nextId: () => string, catalog: readonly CatalogItem[] = [], local = false): ReuseReviewResult {
|
|
29
|
+
const request = reuseRequest(raw), draft = clone(base), source = area(incoming, request.kind === 'style' ? request.from_scope : request.scope), target = area(draft, request.scope);
|
|
30
|
+
const mappings: ReuseReviewResult['mappings'] = { instances: {}, groups: {}, alignments: {} }, dependencies: string[] = [], blocked: string[] = [];
|
|
31
|
+
if (request.kind === 'style') {
|
|
32
|
+
const origin = source.instances.find(n => n.id === request.from_id);
|
|
33
|
+
if (!origin) throw new Error('reuse.invalid');
|
|
34
|
+
for (const id of request.to_ids) {
|
|
35
|
+
const destination = target.instances.find(n => n.id === id);
|
|
36
|
+
if (!destination || request.fields.some(field => !styleFields(origin, request.from_scope, catalog).includes(field) || !styleFields(destination, request.scope, catalog).includes(field))) throw new Error('reuse.incompatible');
|
|
37
|
+
for (const field of request.fields) {
|
|
38
|
+
const formatting = field.startsWith('formatting.'), key = formatting ? field.slice(11) : field;
|
|
39
|
+
const from = (formatting ? origin.options.formatting : origin.options) as unknown as Record<string, unknown>;
|
|
40
|
+
const to = (formatting ? destination.options.formatting : destination.options) as unknown as Record<string, unknown>;
|
|
41
|
+
if (Object.hasOwn(from,key)) to[key] = clone(from[key]); else delete to[key];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
const selected = new Set<string>(), selectedGroups = new Set(request.group_ids);
|
|
46
|
+
const addGroup = (id: string) => { const group = source.groups.find(g => g.id === id); if (!group) throw new Error('reuse.invalid'); selectedGroups.add(id); group.member_ids.forEach(member => selected.add(member)); };
|
|
47
|
+
request.group_ids.forEach(addGroup);
|
|
48
|
+
const alignments = request.scope === 'main' ? incoming.display.layout.alignments ?? [] : [];
|
|
49
|
+
const included = (ref: { kind: string; id: string }) => ref.kind === 'group' ? selectedGroups.has(ref.id) : selected.has(ref.id);
|
|
50
|
+
let growing = true;
|
|
51
|
+
while (growing) {
|
|
52
|
+
growing = false;
|
|
53
|
+
for (const a of alignments.filter(a => a.columns.flat().some(included))) for (const ref of a.columns.flat().filter(ref => !included(ref))) {
|
|
54
|
+
const dependency = refKey(ref); if (!dependencies.includes(dependency)) dependencies.push(dependency);
|
|
55
|
+
if (request.references === 'expand') {
|
|
56
|
+
if (ref.kind === 'group') addGroup(ref.id);
|
|
57
|
+
else { const group = source.groups.find(g => g.member_ids.includes(ref.id)); if (group) addGroup(group.id); else selected.add(ref.id); }
|
|
58
|
+
growing = true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (request.references !== 'expand') break;
|
|
62
|
+
}
|
|
63
|
+
const retained = alignments.filter(a => a.columns.flat().some(included) && a.columns.flat().every(included));
|
|
64
|
+
if (dependencies.length && request.references === 'review') blocked.push('reuse.references');
|
|
65
|
+
// Alignment side is part of the relationship: retain each necessary row spacer.
|
|
66
|
+
if (request.scope === 'main') for (const unit of alignmentUnits(incoming.display.layout, source.instances, source.groups)) {
|
|
67
|
+
if (unit.side === 'right' && included(unit.ref)) {
|
|
68
|
+
const spacer = incoming.display.layout.rows[unit.row]!.find(id => source.instances.find(n => n.id === id)?.type_id === 'spacer');
|
|
69
|
+
if (spacer) selected.add(spacer);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const nodes = source.instances.filter(n => selected.has(n.id));
|
|
73
|
+
if (nodes.length !== selected.size) throw new Error('reuse.invalid');
|
|
74
|
+
const occupied = new Set([...target.instances.map(n => n.id), ...target.groups.map(g => g.id), ...(draft.display.layout.alignments ?? []).map(a => a.id)]);
|
|
75
|
+
const fresh = () => { for (let i = 0; i < 100; i++) { const id = nextId(); if (/^[A-Za-z0-9][A-Za-z0-9_-]{0,95}$/u.test(id) && !occupied.has(id)) { occupied.add(id); return id; } } throw new Error('reuse.invalid'); };
|
|
76
|
+
for (const node of nodes) mappings.instances[node.id] = fresh();
|
|
77
|
+
for (const id of selectedGroups) mappings.groups[id] = fresh();
|
|
78
|
+
for (const a of retained) mappings.alignments[a.id] = fresh();
|
|
79
|
+
const copies = nodes.map(node => ({ ...clone(node), id: mappings.instances[node.id]!, ...(node.source && !local ? { source: { binding: null, hint: node.source.hint } } : {}) }));
|
|
80
|
+
target.instances.push(...copies);
|
|
81
|
+
target.groups.push(...source.groups.filter(g => selectedGroups.has(g.id)).map(g => ({ ...clone(g), id: mappings.groups[g.id]!, primary_id: mappings.instances[g.primary_id]!, member_ids: g.member_ids.map(id => mappings.instances[id]!) })));
|
|
82
|
+
if (request.scope === 'main') {
|
|
83
|
+
const layout = draft.display.layout, importedRows = (incoming.display.layout.mode === 'explicit' ? incoming.display.layout.rows : [nodes.map(n => n.id)]).map(row => row.filter(id => selected.has(id)).map(id => mappings.instances[id]!)).filter(row => row.length);
|
|
84
|
+
const needsExplicit = importedRows.length > 1 || retained.length > 0 || nodes.some(n => n.type_id === 'spacer');
|
|
85
|
+
if (layout.mode === 'auto' && needsExplicit) {
|
|
86
|
+
if (!request.explicit) blocked.push('reuse.explicit');
|
|
87
|
+
layout.mode = 'explicit'; layout.rows = base.display.instances.length ? [base.display.instances.map(n => n.id)] : [];
|
|
88
|
+
}
|
|
89
|
+
if (layout.mode === 'explicit') layout.rows.push(...importedRows);
|
|
90
|
+
if (retained.length) layout.alignments = [...(layout.alignments ?? []), ...retained.map(a => ({ id: mappings.alignments[a.id]!, columns: a.columns.map(column => column.map(ref => ({ kind: ref.kind, id: mappings[ref.kind === 'group' ? 'groups' : 'instances'][ref.id]! }))) }))];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (!blocked.length && !isDraft(draft)) blocked.push('reuse.incompatible');
|
|
94
|
+
const unresolved = (['main','subagent'] as const).flatMap(scope => area(draft, scope).instances.filter(n => n.source && !n.source.binding && Object.values(mappings.instances).includes(n.id)).map(n => ({ scope, id: n.id, hint: n.source!.hint })));
|
|
95
|
+
return { draft: blocked.length ? clone(base) : draft, changes: blocked.length ? [] : differences(base, draft), mappings, dependencies, unresolved, blocked };
|
|
96
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import type { InstanceDraft, SourceContext, SourceDefinition } from '../generated-contracts.ts';
|
|
3
|
+
/** Matching a local source never authorizes it or collects an observation. */
|
|
4
|
+
export function compatibleSource(node: InstanceDraft, source: SourceDefinition, context: SourceContext | null): boolean {
|
|
5
|
+
if (node.type_id === 'external-value' ? !['json','command'].includes(source.kind) : !['github-pr','github-ci'].includes(node.type_id) || source.kind !== 'github') return false;
|
|
6
|
+
return (['project','session','agent'] as const).every(key => source.scope[key] === null || source.scope[key] === context?.[key]);
|
|
7
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import { clone } from './history.ts';
|
|
3
|
+
import { compatibleSource } from './source-compatibility.ts';
|
|
2
4
|
import { sourceSummary, sourceReviewLines } from './source-summary.ts';
|
|
3
5
|
import type { Operation, ResultFor, SourcesResult, SourceDefinition, SourceContext, SourceJob, SourceReview, SourceInspection, BindingReview, Scope } from '../generated-contracts.ts';
|
|
4
6
|
import type { Editor } from './draft.ts';
|
|
@@ -49,7 +51,7 @@ function actions(editor: Editor): Action[] { return ['edit', 'review', ...(sourc
|
|
|
49
51
|
function targets(editor: Editor) {
|
|
50
52
|
const s = source(editor);
|
|
51
53
|
return (['main', 'subagent'] as const).flatMap(scope => (scope === 'main' ? editor.draft.display.instances : editor.draft.display.subagents.instances)
|
|
52
|
-
.filter(node => external.includes(node.type_id) && (s
|
|
54
|
+
.filter(node => external.includes(node.type_id) && (!s || compatibleSource(node, s, editor.sources!.context)) && (editor.sources!.page !== 'unbind' || editor.sources!.library?.bindings.some(binding => binding.source_id === s?.id && binding.id === node.source?.binding))).map(node => ({ scope, id: node.id })));
|
|
53
55
|
}
|
|
54
56
|
function form(editor: Editor, kind: SourceDefinition['kind'], editing = false): void {
|
|
55
57
|
const m = editor.sources!, s = editing ? source(editor) : undefined, settings = s?.settings ?? {};
|
|
@@ -155,7 +157,9 @@ export function sourcesKey(editor: Editor, event: TextKey): 'sources' | null {
|
|
|
155
157
|
const target = targets(editor)[m.cursor];
|
|
156
158
|
const node = target && editor.instance(target.scope, target.id);
|
|
157
159
|
if (node?.source) {
|
|
158
|
-
|
|
160
|
+
const draft = clone(editor.draft);
|
|
161
|
+
(target!.scope === 'main' ? draft.display : draft.display.subagents).instances.find(n => n.id === target!.id)!.source = { ...node.source, binding: null };
|
|
162
|
+
editor.commitDraft(draft);
|
|
159
163
|
m.message = text('sources.bound');
|
|
160
164
|
m.page = 'list';
|
|
161
165
|
m.cursor = 0;
|
|
@@ -253,8 +257,11 @@ export async function performSourceAction(editor: Editor, backend: SourceBackend
|
|
|
253
257
|
if (effect === 'bind' && m.target && result.binding) {
|
|
254
258
|
if (!editor.canMutateDraft(generation) || editor.sources !== m) { m.message=editor.compositionError;return; }
|
|
255
259
|
const node = editor.instance(m.target.scope, m.target.id);
|
|
256
|
-
if (node)
|
|
257
|
-
|
|
260
|
+
if (node) {
|
|
261
|
+
const draft = clone(editor.draft);
|
|
262
|
+
(m.target.scope === 'main' ? draft.display : draft.display.subagents).instances.find(n => n.id === m.target!.id)!.source = result.binding;
|
|
263
|
+
editor.commitDraft(draft);
|
|
264
|
+
}
|
|
258
265
|
m.message = text('sources.bound');
|
|
259
266
|
}
|
|
260
267
|
else
|
|
@@ -323,5 +330,5 @@ export function sourcesView(editor: Editor, language: Language, width: number, h
|
|
|
323
330
|
return [...fixed, ...entries.slice(start, start + capacity)];
|
|
324
331
|
}
|
|
325
332
|
|
|
326
|
-
export function draftBindings(editor:Editor):string[]{return [...new Set([
|
|
333
|
+
export function draftBindings(editor:Editor):string[]{return [...new Set([editor.draft,editor.baseline.draft,...editor.history.undo.map(e=>e.draft),...editor.history.redo.map(e=>e.draft)].flatMap(d=>[...d.display.instances,...d.display.subagents.instances].flatMap(n=>n.source?.binding?[n.source.binding]:[])))];}
|
|
327
334
|
export async function closeSourceDraft(editor:Editor,backend:SourceBackend):Promise<void>{if(editor.sourceDraftRegistered){await backend.request('source_draft',{owner:editor.sourceDraftOwner,bindings:[],close:true});editor.sourceDraftRegistered=false;}}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/structure.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
/** A structural edit is staged with reference repairs; persisted validation stays strict. */
|
|
3
|
+
import type { AlignmentDraft, Draft, ImportChange } from '../generated-contracts.ts';
|
|
4
|
+
import { alignmentUnits, refKey, validAlignments } from './alignments.ts';
|
|
5
|
+
import { isDraft } from '../backend.ts';
|
|
6
|
+
import { clone, semantic } from './history.ts';
|
|
7
|
+
import { differences } from './import-differences.ts';
|
|
8
|
+
|
|
9
|
+
export interface AlignmentRepair { id: string; before: AlignmentDraft; after: AlignmentDraft | null }
|
|
10
|
+
export interface StructureProposal {
|
|
11
|
+
generation: number; target: string; base: Draft; draft: Draft; repairs: AlignmentRepair[]; changes: ImportChange[];
|
|
12
|
+
}
|
|
13
|
+
export function repairStructure(base: Draft, proposed: Draft): Omit<StructureProposal, 'generation' | 'target'> {
|
|
14
|
+
const draft = clone(proposed), d = draft.display, originals = d.layout.alignments ?? [];
|
|
15
|
+
const units = new Set(alignmentUnits(d.layout, d.instances, d.groups).map(unit => refKey(unit.ref)));
|
|
16
|
+
const candidates = originals.map(value => ({ before: value, after: { ...clone(value), columns: value.columns.map(column => column.filter(ref => units.has(refKey(ref)))).filter(column => column.length >= 2) } }));
|
|
17
|
+
// Give unchanged, individually valid relationships priority over repaired ones.
|
|
18
|
+
const stable = candidates.filter(({ before, after }) => semantic(before) === semantic(after) && validAlignments([after], d.layout, d.instances, d.groups));
|
|
19
|
+
const accepted: AlignmentDraft[] = [], kept = new Map<string, AlignmentDraft>();
|
|
20
|
+
for (const { after } of [...stable, ...candidates.filter(c => !stable.includes(c))]) {
|
|
21
|
+
if (after.columns.length && validAlignments([...accepted, after], d.layout, d.instances, d.groups)) { accepted.push(after); kept.set(after.id, after); }
|
|
22
|
+
}
|
|
23
|
+
if (d.layout.alignments !== undefined) d.layout.alignments = originals.flatMap(a => kept.has(a.id) ? [kept.get(a.id)!] : []);
|
|
24
|
+
const repairs = originals.flatMap(before => {
|
|
25
|
+
const after = kept.get(before.id) ?? null;
|
|
26
|
+
return semantic(before) === semantic(after) ? [] : [{ id: before.id, before: clone(before), after: clone(after) }];
|
|
27
|
+
});
|
|
28
|
+
if (!isDraft(draft)) throw new Error('composition.invalid');
|
|
29
|
+
return { base: clone(base), draft, repairs, changes: differences(base, draft) };
|
|
30
|
+
}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
-
export const PROTOCOL_VERSION =
|
|
2
|
+
export const PROTOCOL_VERSION = 29 as const;
|
|
3
3
|
export const ITEM_DEFAULTS = {"label": null, "icon": null, "priority": 50, "max_width": null, "formatting": {}, "foreground": null, "background": null, "visibility": "always", "visibility_threshold": 70};
|
|
4
4
|
export const VISIBILITY_ITEMS = {"main": {"git": "git-dirty", "git-changes": "git-dirty", "active-agents": "nonzero", "task-progress": "nonzero", "context-used": "used-at-least", "context-remaining": "used-at-least", "five-hour-limit": "used-at-least", "weekly-limit": "used-at-least", "spend-limit": "used-at-least"}, "subagent": {"context-used": "used-at-least", "context-remaining": "used-at-least"}} as const;
|
|
5
5
|
export const GUIDANCE_KEYS = {"source_kinds": ["configuration", "official_input", "local_git", "local_system", "transcript", "local_state", "lifecycle", "native_timing", "live_metrics", "telemetry"], "scopes": ["main", "main_context", "session", "all_sessions", "task", "subagent", "subagent_context", "repository", "local", "latest_request"], "requirements": ["observed_field", "subagent_rows", "agent_context", "configured_effort", "agent_effort_optional", "git_repository", "git_upstream", "git_base", "pull_request", "worktree_session", "usage_records", "task_observation", "native_timing", "complete_waits", "live_metrics", "owned_agents", "checklist_events", "tool_events", "complete_stream", "request_coverage", "existing_telemetry", "gateway", "gateway_284", "valid_window", "warm_cache", "fast_mode", "thinking", "agent_mode", "vim_mode", "context_observation", "cost_rate"]} as const;
|
|
@@ -504,7 +504,7 @@ export const SEPARATORSTYLE_VALUES = ["classic", "compact", "powerline"] as cons
|
|
|
504
504
|
export const SCOPELABELS_VALUES = ["off", "when-subagents", "always"] as const;
|
|
505
505
|
export const STATUSLINELANGUAGE_VALUES = ["en", "zh-CN", "zh-TW", "zh-HK", "ja", "ko"] as const;
|
|
506
506
|
export const UNAVAILABLEREASON_VALUES = ["not_observed", "unsupported_host", "unknown_host_version", "source_unavailable", "condition_not_met", "runtime_disabled", "native_timing_disabled", "wait_coverage_missing", "stale", "incomplete", "ambiguous_owner", "observed_only", "missing_stream", "synthetic_response", "abnormal_clock", "inconsistent_request", "request_join_unavailable"] as const;
|
|
507
|
-
export const OPERATIONS = ['package_execute_start', 'package_execute_detach', 'package_execute_status', 'package_cleanup_review', 'package_cleanup_apply', 'source_inspect', 'source_bindings_review', 'source_bindings_cleanup', 'source_draft', 'package_status', 'package_review_start', 'package_review_status', 'package_review_cancel', 'sources_read', 'sources_apply', 'source_review', 'source_context', 'source_refresh', 'source_status', 'source_release', 'source_cancel', 'source_diagnose', 'describe', 'read', 'preview', 'apply', 'import', 'export', 'preset', 'read_ui_preferences', 'set_ui_language', 'review_import', 'explain', 'diagnose', 'diagnose_file', 'profiles_read', 'profiles_apply', 'profile_import', 'profile_export', 'task_details'] as const;
|
|
507
|
+
export const OPERATIONS = ['review_reuse', 'package_execute_start', 'package_execute_detach', 'package_execute_status', 'package_cleanup_review', 'package_cleanup_apply', 'source_inspect', 'source_bindings_review', 'source_bindings_cleanup', 'source_draft', 'package_status', 'package_review_start', 'package_review_status', 'package_review_cancel', 'sources_read', 'sources_apply', 'source_review', 'source_context', 'source_refresh', 'source_status', 'source_release', 'source_cancel', 'source_diagnose', 'describe', 'read', 'preview', 'apply', 'import', 'export', 'preset', 'read_ui_preferences', 'set_ui_language', 'review_import', 'explain', 'diagnose', 'diagnose_file', 'profiles_read', 'profiles_apply', 'profile_import', 'profile_export', 'task_details'] as const;
|
|
508
508
|
export type Operation = typeof OPERATIONS[number];
|
|
509
509
|
export interface ItemGuidance {
|
|
510
510
|
source_kinds: string[];
|
|
@@ -1005,6 +1005,12 @@ export interface ImportReviewResult {
|
|
|
1005
1005
|
draft: Draft;
|
|
1006
1006
|
changes: ImportChange[];
|
|
1007
1007
|
}
|
|
1008
|
+
export type ReuseRequest = { kind: 'style'; scope: Scope; from_scope: Scope; from_id: string; to_ids: string[]; fields: string[] }
|
|
1009
|
+
| { kind: 'groups'; scope: Scope; group_ids: string[]; references: 'review' | 'expand' | 'exclude'; explicit: boolean };
|
|
1010
|
+
export interface ReuseReviewResult extends ImportReviewResult {
|
|
1011
|
+
mappings: { instances: Record<string, string>; groups: Record<string, string>; alignments: Record<string, string> };
|
|
1012
|
+
dependencies: string[]; unresolved: { scope: Scope; id: string; hint: string }[]; blocked: string[];
|
|
1013
|
+
}
|
|
1008
1014
|
export interface ExportResult {
|
|
1009
1015
|
path: string;
|
|
1010
1016
|
}
|
|
@@ -1061,6 +1067,7 @@ export interface ResultMap {
|
|
|
1061
1067
|
apply: ApplyResult;
|
|
1062
1068
|
import: TransferResult;
|
|
1063
1069
|
review_import: ImportReviewResult;
|
|
1070
|
+
review_reuse: ReuseReviewResult;
|
|
1064
1071
|
export: ExportResult;
|
|
1065
1072
|
preset: TransferResult;
|
|
1066
1073
|
read_ui_preferences: UiPreferencesResult;
|
|
@@ -1077,5 +1084,5 @@ export interface Request {
|
|
|
1077
1084
|
operation: Operation;
|
|
1078
1085
|
payload: unknown;
|
|
1079
1086
|
}
|
|
1080
|
-
export type Result = PackageExecution | PackageCleanupReview | PackageStatus | PackageReviewJob | DiagnoseResult | ExplainResult | PreviewResult | UiPreferencesResult | ReadResult | TransferResult | ImportReviewResult | ExportResult | DescribeResult | ApplyResult | ProfilesResult | ProfileImportResult | TaskDetails;
|
|
1087
|
+
export type Result = ReuseReviewResult | PackageExecution | PackageCleanupReview | PackageStatus | PackageReviewJob | DiagnoseResult | ExplainResult | PreviewResult | UiPreferencesResult | ReadResult | TransferResult | ImportReviewResult | ExportResult | DescribeResult | ApplyResult | ProfilesResult | ProfileImportResult | TaskDetails;
|
|
1081
1088
|
export type Response = { protocol_version: typeof PROTOCOL_VERSION; result: Result } | { protocol_version: typeof PROTOCOL_VERSION; error: ProtocolError };
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/en.ts
CHANGED
|
@@ -2216,5 +2216,76 @@ export const MESSAGES = {
|
|
|
2216
2216
|
"package.ui.result_na": "not applicable",
|
|
2217
2217
|
"sources.scope_all": "any / shared",
|
|
2218
2218
|
"package.ui.control": "Retained manager: {executable} · {entry}",
|
|
2219
|
-
"package.ui.control_help": "Keep this entry. Open it with Node and configure --config-dir {directory} to revisit after a downgrade."
|
|
2219
|
+
"package.ui.control_help": "Keep this entry. Open it with Node and configure --config-dir {directory} to revisit after a downgrade.",
|
|
2220
|
+
"history.title": "Changes and history",
|
|
2221
|
+
"history.edit": "Edit draft",
|
|
2222
|
+
"history.replace": "Replace draft",
|
|
2223
|
+
"history.structure": "Review structural edit",
|
|
2224
|
+
"history.stale": "This review is outdated. Close it and review the current draft again.",
|
|
2225
|
+
"history.retry_ready": "Reviewed revision adopted. Save to retry.",
|
|
2226
|
+
"history.retry_blocked": "Compare current configuration first. Target and installation must match, and the save outcome must be known.",
|
|
2227
|
+
"history.export_path": "Export draft to a new file:",
|
|
2228
|
+
"history.confirm_discard": "Discard the entire draft and its history, then reload the latest configuration? Enter confirms; Esc cancels.",
|
|
2229
|
+
"history.repairs": "Affected alignments: {ids}",
|
|
2230
|
+
"history.counts": "Undo: {undo} · Redo: {redo}",
|
|
2231
|
+
"history.comparison.0": "Baseline → draft",
|
|
2232
|
+
"history.comparison.1": "Baseline → current file",
|
|
2233
|
+
"history.comparison.2": "Current file → draft",
|
|
2234
|
+
"history.structure_help": "A accept · Enter details · Q cancel",
|
|
2235
|
+
"history.help": "U undo · R redo · C compare · Tab comparison · E export · L discard/reload · K keep draft/retry · Q back",
|
|
2236
|
+
"history.trimmed": "Oldest history entries were removed at the session limit.",
|
|
2237
|
+
"history.exported": "Draft exported. Live configuration is unchanged.",
|
|
2238
|
+
"history.failed": "Could not complete the action: {detail}",
|
|
2239
|
+
"history.undo_redo": "Undo / redo",
|
|
2240
|
+
"reuse.style": "Copy / paste visual style",
|
|
2241
|
+
"reuse.groups": "Reuse complete groups",
|
|
2242
|
+
"reuse.action": "Reuse configuration",
|
|
2243
|
+
"reuse.invalid": "Invalid reuse selection or references.",
|
|
2244
|
+
"reuse.incompatible": "Selected fields, source or layout are incompatible with the destination.",
|
|
2245
|
+
"reuse.references": "Outside references require an explicit expand or exclude decision.",
|
|
2246
|
+
"reuse.explicit": "Explicit rows are required. Choose layout conversion to continue.",
|
|
2247
|
+
"reuse.current": "Current draft",
|
|
2248
|
+
"reuse.portable": "Portable configuration file",
|
|
2249
|
+
"reuse.profile_file": "Exported profile file",
|
|
2250
|
+
"reuse.profiles": "Saved profiles",
|
|
2251
|
+
"reuse.accepted": "Applied to draft. Save separately.",
|
|
2252
|
+
"reuse.unbound": "Not bound locally",
|
|
2253
|
+
"reuse.bind_help": "B bind local sources · Q back",
|
|
2254
|
+
"reuse.scope": "Source scope",
|
|
2255
|
+
"reuse.review": "Review selected changes",
|
|
2256
|
+
"reuse.unsupported": "Unsupported for this destination",
|
|
2257
|
+
"reuse.path": "Source file path:",
|
|
2258
|
+
"reuse.path_help": "Enter read · Esc cancel",
|
|
2259
|
+
"reuse.draft_only": "Candidate only; configuration and authorization are unchanged.",
|
|
2260
|
+
"reuse.layout": "Allow explicit layout conversion",
|
|
2261
|
+
"reuse.expand": "Expand dependencies",
|
|
2262
|
+
"reuse.exclude": "Exclude outside alignments",
|
|
2263
|
+
"reuse.help": "Select a source, then review before applying.",
|
|
2264
|
+
"reuse.cancel_help": "Enter select · Space toggle · Esc cancel",
|
|
2265
|
+
"reuse.review_groups_help": "A accept · X references · L layout conversion · Backspace edit · Q cancel · Tab IDs / differences",
|
|
2266
|
+
"reuse.review_style_help": "A accept · Enter details · Backspace fields · Q cancel",
|
|
2267
|
+
"settings.change-history": "Changes and history",
|
|
2268
|
+
"settings.reuse-style": "Copy / paste visual style",
|
|
2269
|
+
"settings.reuse-groups": "Reuse complete groups",
|
|
2270
|
+
"ui.actions.change-history": "Changes and history",
|
|
2271
|
+
"ui.actions.reuse-style": "Copy / paste visual style",
|
|
2272
|
+
"ui.actions.reuse-groups": "Reuse complete groups",
|
|
2273
|
+
"ui.hints.undo_redo": "Undo / redo",
|
|
2274
|
+
"ui.hints.changes": "Changes and history",
|
|
2275
|
+
"reuse.field.foreground": "Foreground (inherit/default/ansi:N/#RRGGBB)",
|
|
2276
|
+
"reuse.field.background": "Background (inherit/default/ansi:N/#RRGGBB)",
|
|
2277
|
+
"reuse.field.foreground_gradient": "Foreground gradient",
|
|
2278
|
+
"reuse.field.background_gradient": "Powerline background gradient",
|
|
2279
|
+
"reuse.field.label": "Label (inherit = default)",
|
|
2280
|
+
"reuse.field.icon": "Icon (inherit = default)",
|
|
2281
|
+
"reuse.field.formatting.model_name": "Model Name",
|
|
2282
|
+
"reuse.field.formatting.number_format": "Number Format",
|
|
2283
|
+
"reuse.field.formatting.labels": "Labels",
|
|
2284
|
+
"reuse.field.formatting.icons": "Icons",
|
|
2285
|
+
"reuse.field.formatting.allowance": "Allowance",
|
|
2286
|
+
"reuse.field.formatting.reset_format": "Reset Format",
|
|
2287
|
+
"reuse.field.formatting.reset_timezone": "Reset Timezone",
|
|
2288
|
+
"history.input_help": "Enter read · Esc cancel",
|
|
2289
|
+
"reuse.dependency": "Outside dependency",
|
|
2290
|
+
"reuse.reference_policy": "Reference handling"
|
|
2220
2291
|
} as const;
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/ja.ts
CHANGED
|
@@ -2216,5 +2216,76 @@ export const MESSAGES = {
|
|
|
2216
2216
|
"package.ui.result_na": "対象外",
|
|
2217
2217
|
"sources.scope_all": "すべて/共有",
|
|
2218
2218
|
"package.ui.control": "保持する管理入口: {executable} · {entry}",
|
|
2219
|
-
"package.ui.control_help": "この入口を保持してください。ダウングレード後は Node で開き、configure --config-dir {directory} を渡して再確認できます。"
|
|
2219
|
+
"package.ui.control_help": "この入口を保持してください。ダウングレード後は Node で開き、configure --config-dir {directory} を渡して再確認できます。",
|
|
2220
|
+
"history.title": "変更と履歴",
|
|
2221
|
+
"history.edit": "下書きを編集",
|
|
2222
|
+
"history.replace": "下書きを置換",
|
|
2223
|
+
"history.structure": "構造変更を確認",
|
|
2224
|
+
"history.stale": "この確認は古くなりました。閉じて現在の下書きを確認してください。",
|
|
2225
|
+
"history.retry_ready": "確認したリビジョンを採用しました。保存して再試行してください。",
|
|
2226
|
+
"history.retry_blocked": "現在の設定を比較してください。対象とインストールが一致し、保存結果が確定している必要があります。",
|
|
2227
|
+
"history.export_path": "下書きの新しい出力先:",
|
|
2228
|
+
"history.confirm_discard": "下書きと履歴をすべて破棄し、最新設定を読み込みますか?Enter で確認、Esc でキャンセル。",
|
|
2229
|
+
"history.repairs": "影響を受ける整列:{ids}",
|
|
2230
|
+
"history.counts": "元に戻す:{undo} · やり直し:{redo}",
|
|
2231
|
+
"history.comparison.0": "基準 → 下書き",
|
|
2232
|
+
"history.comparison.1": "基準 → 現在のファイル",
|
|
2233
|
+
"history.comparison.2": "現在のファイル → 下書き",
|
|
2234
|
+
"history.structure_help": "A 適用 · Enter 詳細 · Q 中止",
|
|
2235
|
+
"history.help": "U 元に戻す · R やり直す · C 比較 · Tab 切替 · E 出力 · L 破棄/再読込 · K 下書き保持/再試行 · Q 戻る",
|
|
2236
|
+
"history.trimmed": "履歴の上限に達したため、古い項目を削除しました。",
|
|
2237
|
+
"history.exported": "下書きを出力しました。現在の設定は変更されていません。",
|
|
2238
|
+
"history.failed": "操作を完了できませんでした:{detail}",
|
|
2239
|
+
"history.undo_redo": "元に戻す/やり直し",
|
|
2240
|
+
"reuse.style": "表示スタイルをコピー/貼り付け",
|
|
2241
|
+
"reuse.groups": "グループ全体を再利用",
|
|
2242
|
+
"reuse.action": "設定を再利用",
|
|
2243
|
+
"reuse.invalid": "再利用の選択または参照が無効です。",
|
|
2244
|
+
"reuse.incompatible": "選択した項目、入力元、配置は対象と互換性がありません。",
|
|
2245
|
+
"reuse.references": "範囲外の参照を含めるか除外するか選択してください。",
|
|
2246
|
+
"reuse.explicit": "明示的な行配置が必要です。配置の変換を選択してください。",
|
|
2247
|
+
"reuse.current": "現在の下書き",
|
|
2248
|
+
"reuse.portable": "ポータブル設定ファイル",
|
|
2249
|
+
"reuse.profile_file": "エクスポートしたプロファイル",
|
|
2250
|
+
"reuse.profiles": "保存済みプロファイル",
|
|
2251
|
+
"reuse.accepted": "下書きに適用しました。別途保存してください。",
|
|
2252
|
+
"reuse.unbound": "ローカル入力元は未接続",
|
|
2253
|
+
"reuse.bind_help": "B ローカル入力元を接続 · Q 戻る",
|
|
2254
|
+
"reuse.scope": "入力元の範囲",
|
|
2255
|
+
"reuse.review": "選択した変更を確認",
|
|
2256
|
+
"reuse.unsupported": "この対象では非対応",
|
|
2257
|
+
"reuse.path": "入力元のファイルパス:",
|
|
2258
|
+
"reuse.path_help": "Enter 読込 · Esc 中止",
|
|
2259
|
+
"reuse.draft_only": "候補の下書きです。設定と権限は変更されていません。",
|
|
2260
|
+
"reuse.layout": "明示的な配置への変換を許可",
|
|
2261
|
+
"reuse.expand": "依存関係を含める",
|
|
2262
|
+
"reuse.exclude": "範囲外の整列を除外",
|
|
2263
|
+
"reuse.help": "入力元を選択し、確認してから適用してください。",
|
|
2264
|
+
"reuse.cancel_help": "Enter 選択 · Space 切替 · Esc 中止",
|
|
2265
|
+
"reuse.review_groups_help": "A 適用 · X 参照 · L 配置変換 · Backspace 編集 · Q 中止 · Tab ID/差分",
|
|
2266
|
+
"reuse.review_style_help": "A 適用 · Enter 詳細 · Backspace 項目 · Q 中止",
|
|
2267
|
+
"settings.change-history": "変更と履歴",
|
|
2268
|
+
"settings.reuse-style": "表示スタイルをコピー/貼り付け",
|
|
2269
|
+
"settings.reuse-groups": "グループ全体を再利用",
|
|
2270
|
+
"ui.actions.change-history": "変更と履歴",
|
|
2271
|
+
"ui.actions.reuse-style": "表示スタイルをコピー/貼り付け",
|
|
2272
|
+
"ui.actions.reuse-groups": "グループ全体を再利用",
|
|
2273
|
+
"ui.hints.undo_redo": "元に戻す/やり直し",
|
|
2274
|
+
"ui.hints.changes": "変更と履歴",
|
|
2275
|
+
"reuse.field.foreground": "前景色(inherit/default/ansi:N/#RRGGBB)",
|
|
2276
|
+
"reuse.field.background": "背景色(inherit/default/ansi:N/#RRGGBB)",
|
|
2277
|
+
"reuse.field.foreground_gradient": "前景グラデーション",
|
|
2278
|
+
"reuse.field.background_gradient": "Powerline 背景グラデーション",
|
|
2279
|
+
"reuse.field.label": "ラベル(継承=既定)",
|
|
2280
|
+
"reuse.field.icon": "アイコン(継承=既定)",
|
|
2281
|
+
"reuse.field.formatting.model_name": "モデル名",
|
|
2282
|
+
"reuse.field.formatting.number_format": "数値書式",
|
|
2283
|
+
"reuse.field.formatting.labels": "ラベル",
|
|
2284
|
+
"reuse.field.formatting.icons": "アイコン",
|
|
2285
|
+
"reuse.field.formatting.allowance": "利用枠",
|
|
2286
|
+
"reuse.field.formatting.reset_format": "リセット表示形式",
|
|
2287
|
+
"reuse.field.formatting.reset_timezone": "リセットのタイムゾーン",
|
|
2288
|
+
"history.input_help": "Enter 読込 · Esc 中止",
|
|
2289
|
+
"reuse.dependency": "範囲外の依存関係",
|
|
2290
|
+
"reuse.reference_policy": "外部参照の処理"
|
|
2220
2291
|
} as const;
|