sideby 0.16.1 → 0.18.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 +7 -3
- package/ai-tasks.json +90 -0
- package/dist/build.json +1 -1
- package/dist/src/cli/commands.d.ts +25 -1
- package/dist/src/cli/commands.js +802 -15
- package/dist/src/cli/json-schemas.js +252 -1
- package/dist/src/cli/main.js +143 -4
- package/dist/src/core/after-install.d.ts +54 -0
- package/dist/src/core/after-install.js +78 -0
- package/dist/src/core/ask.d.ts +222 -0
- package/dist/src/core/ask.js +465 -0
- package/dist/src/core/attachments.d.ts +50 -0
- package/dist/src/core/attachments.js +442 -0
- package/dist/src/core/autostart.d.ts +118 -0
- package/dist/src/core/autostart.js +302 -0
- package/dist/src/core/brand-mark.d.ts +49 -11
- package/dist/src/core/brand-mark.js +116 -38
- package/dist/src/core/config.d.ts +102 -0
- package/dist/src/core/config.js +289 -11
- package/dist/src/core/desktop-app.d.ts +1 -1
- package/dist/src/core/desktop-app.js +2 -2
- package/dist/src/core/edit-settings.d.ts +24 -0
- package/dist/src/core/edit-settings.js +97 -0
- package/dist/src/core/handoff-brief.d.ts +4 -2
- package/dist/src/core/handoff-brief.js +6 -1
- package/dist/src/core/handoff-chain.d.ts +24 -0
- package/dist/src/core/handoff-chain.js +2 -0
- package/dist/src/core/handoff-run.d.ts +4 -3
- package/dist/src/core/handoff-run.js +14 -9
- package/dist/src/core/launch.d.ts +17 -4
- package/dist/src/core/launch.js +32 -24
- package/dist/src/core/local-build.d.ts +17 -5
- package/dist/src/core/local-build.js +61 -23
- package/dist/src/core/lock.d.ts +30 -0
- package/dist/src/core/lock.js +143 -0
- package/dist/src/core/probe.d.ts +78 -0
- package/dist/src/core/probe.js +127 -0
- package/dist/src/core/quota-levels.d.ts +6 -1
- package/dist/src/core/quota-levels.js +16 -5
- package/dist/src/core/same-login.d.ts +9 -4
- package/dist/src/core/same-login.js +9 -4
- package/dist/src/core/secret-file.d.ts +26 -0
- package/dist/src/core/secret-file.js +126 -7
- package/dist/src/core/task-spec.d.ts +95 -0
- package/dist/src/core/task-spec.js +209 -0
- package/dist/src/core/terminal.d.ts +93 -0
- package/dist/src/core/terminal.js +376 -0
- package/dist/src/core/update.d.ts +34 -12
- package/dist/src/core/update.js +96 -84
- package/dist/src/desktop/icon.js +12 -15
- package/dist/src/families/claude/ai-task.d.ts +8 -0
- package/dist/src/families/claude/ai-task.js +38 -0
- package/dist/src/families/claude/handoff-hook.js +4 -4
- package/dist/src/families/claude/index.js +6 -0
- package/dist/src/families/claude/quota-cache.d.ts +24 -7
- package/dist/src/families/claude/quota-cache.js +72 -21
- package/dist/src/families/codex/handoff-hook.js +4 -4
- package/dist/src/families/codex/index.js +16 -0
- package/dist/src/families/codex/login-key.d.ts +8 -0
- package/dist/src/families/codex/login-key.js +33 -0
- package/dist/src/families/grok/handoff-hook.js +4 -4
- package/dist/src/families/grok/index.js +4 -0
- package/dist/src/families/login-keys.d.ts +6 -0
- package/dist/src/families/login-keys.js +6 -0
- package/dist/src/families/pi/index.js +5 -0
- package/dist/src/handoff/hook.js +51 -30
- package/dist/src/handoff/levels.d.ts +24 -0
- package/dist/src/handoff/levels.js +70 -0
- package/dist/src/handoff/messages.d.ts +6 -3
- package/dist/src/handoff/messages.js +20 -7
- package/dist/src/handoff/reader.d.ts +6 -3
- package/dist/src/menubar/agent.d.ts +3 -0
- package/dist/src/menubar/agent.js +21 -0
- package/dist/src/menubar/script.d.ts +8 -0
- package/dist/src/menubar/script.js +457 -0
- package/dist/src/menubar/snapshot.d.ts +115 -0
- package/dist/src/menubar/snapshot.js +255 -0
- package/dist/src/menubar/strings.d.ts +87 -0
- package/dist/src/menubar/strings.js +88 -0
- package/dist/src/panel/background.js +15 -21
- package/dist/src/panel/handler.d.ts +41 -2
- package/dist/src/panel/handler.js +394 -10
- package/dist/src/panel/i18n.d.ts +205 -2
- package/dist/src/panel/i18n.js +441 -35
- package/dist/src/panel/page-logic.d.ts +301 -0
- package/dist/src/panel/page-logic.js +532 -0
- package/dist/src/panel/page-script.js +1135 -185
- package/dist/src/panel/page-styles.js +111 -32
- package/dist/src/panel/page.d.ts +12 -0
- package/dist/src/panel/page.js +7 -0
- package/dist/src/panel/server.d.ts +16 -2
- package/dist/src/panel/server.js +41 -13
- package/dist/src/plugins/check.d.ts +47 -0
- package/dist/src/plugins/check.js +544 -0
- package/dist/src/plugins/scaffold.d.ts +21 -0
- package/dist/src/plugins/scaffold.js +123 -0
- package/dist/src/quota/statusline-tap.js +1 -1
- package/dist/src/runtime.d.ts +19 -1
- package/dist/src/runtime.js +53 -14
- package/dist/src/types.d.ts +33 -0
- package/package.json +4 -3
- package/schemas/ask-choices.json +168 -0
- package/schemas/ask-print.json +87 -0
- package/schemas/ask.json +180 -0
- package/schemas/autostart.json +165 -0
- package/schemas/config-get.json +132 -0
- package/schemas/config-set.json +107 -0
- package/schemas/config.json +90 -7
- package/schemas/edit.json +119 -0
- package/schemas/error.json +4 -0
- package/schemas/families.json +4 -0
- package/schemas/key.json +93 -0
- package/schemas/list.json +4 -0
- package/schemas/local.json +1 -1
- package/schemas/menubar-snapshot.json +646 -0
- package/schemas/menubar-start.json +112 -0
- package/schemas/menubar.json +165 -0
- package/schemas/plugins-check.json +113 -0
- package/schemas/plugins-new.json +87 -0
- package/schemas/terminal.json +152 -0
- package/schemas/try.json +109 -0
- package/schemas/update.json +4 -0
- package/skills/sideby/SKILL.md +16 -6
- package/skills/sideby/references/accounts.md +1 -1
- package/skills/sideby/references/ai-tasks.md +126 -0
- package/skills/sideby/references/handoff.md +3 -1
- package/skills/sideby/references/panel.md +20 -0
- package/skills/sideby/references/update.md +1 -1
|
@@ -21,6 +21,7 @@ export interface HandoffSettings {
|
|
|
21
21
|
sameFamily: boolean;
|
|
22
22
|
prepareAt: number;
|
|
23
23
|
threshold: number;
|
|
24
|
+
adaptive: boolean;
|
|
24
25
|
waitIfResetWithinMinutes: number;
|
|
25
26
|
countdownSeconds: number;
|
|
26
27
|
crossOrganization: string[];
|
|
@@ -31,6 +32,20 @@ export interface HandoffSettings {
|
|
|
31
32
|
}
|
|
32
33
|
export declare const ConfigSchema: Type.TObject<{
|
|
33
34
|
$schema: Type.TOptional<Type.TString>;
|
|
35
|
+
panel: Type.TOptional<Type.TObject<{
|
|
36
|
+
theme: Type.TOptional<Type.TString>;
|
|
37
|
+
language: Type.TOptional<Type.TString>;
|
|
38
|
+
}>>;
|
|
39
|
+
menubar: Type.TOptional<Type.TObject<{
|
|
40
|
+
hotkey: Type.TOptional<Type.TString>;
|
|
41
|
+
}>>;
|
|
42
|
+
terminal: Type.TOptional<Type.TObject<{
|
|
43
|
+
preferred: Type.TOptional<Type.TString>;
|
|
44
|
+
custom: Type.TOptional<Type.TString>;
|
|
45
|
+
}>>;
|
|
46
|
+
ask: Type.TOptional<Type.TObject<{
|
|
47
|
+
account: Type.TOptional<Type.TString>;
|
|
48
|
+
}>>;
|
|
34
49
|
accounts: Type.TOptional<Type.TRecord<"^.*$", Type.TObject<{
|
|
35
50
|
args: Type.TOptional<Type.TArray<Type.TString>>;
|
|
36
51
|
}>>>;
|
|
@@ -54,6 +69,7 @@ export declare const ConfigSchema: Type.TObject<{
|
|
|
54
69
|
sameFamily: Type.TOptional<Type.TBoolean>;
|
|
55
70
|
prepareAt: Type.TOptional<Type.TInteger>;
|
|
56
71
|
threshold: Type.TOptional<Type.TInteger>;
|
|
72
|
+
adaptive: Type.TOptional<Type.TBoolean>;
|
|
57
73
|
waitIfResetWithinMinutes: Type.TOptional<Type.TInteger>;
|
|
58
74
|
countdownSeconds: Type.TOptional<Type.TInteger>;
|
|
59
75
|
crossOrganization: Type.TOptional<Type.TArray<Type.TString>>;
|
|
@@ -172,4 +188,90 @@ export declare function removeConfigAlias(file: string, alias: string): Promise<
|
|
|
172
188
|
status: 'removed' | 'absent';
|
|
173
189
|
aliases: Record<string, AliasValue>;
|
|
174
190
|
}>;
|
|
191
|
+
export declare function editConfigTerminal(file: string, patch: {
|
|
192
|
+
preferred?: string;
|
|
193
|
+
custom?: string;
|
|
194
|
+
}): Promise<{
|
|
195
|
+
changed: boolean;
|
|
196
|
+
before: {
|
|
197
|
+
preferred?: string | undefined;
|
|
198
|
+
custom?: string | undefined;
|
|
199
|
+
} | undefined;
|
|
200
|
+
after: {
|
|
201
|
+
preferred?: string | undefined;
|
|
202
|
+
custom?: string | undefined;
|
|
203
|
+
} | undefined;
|
|
204
|
+
}>;
|
|
205
|
+
export declare function editConfigAsk(file: string, account?: string): Promise<{
|
|
206
|
+
changed: boolean;
|
|
207
|
+
before: {
|
|
208
|
+
account?: string | undefined;
|
|
209
|
+
} | undefined;
|
|
210
|
+
after: {
|
|
211
|
+
account?: string | undefined;
|
|
212
|
+
} | undefined;
|
|
213
|
+
}>;
|
|
214
|
+
export type PanelConfig = NonNullable<Config['panel']>;
|
|
215
|
+
/**
|
|
216
|
+
* The Panel's theme and language (spec §3.29): a value sets the key, null removes it (back to the default), and an
|
|
217
|
+
* empty `panel` goes away with it (see `editConfigKey` for how the file is written).
|
|
218
|
+
*/
|
|
219
|
+
export declare function editConfigPanel(file: string, patch: {
|
|
220
|
+
theme?: PanelConfig['theme'] | null;
|
|
221
|
+
language?: PanelConfig['language'] | null;
|
|
222
|
+
}, opts?: {
|
|
223
|
+
dryRun?: boolean;
|
|
224
|
+
}): Promise<{
|
|
225
|
+
changed: boolean;
|
|
226
|
+
before: PanelConfig | undefined;
|
|
227
|
+
after: PanelConfig | undefined;
|
|
228
|
+
}>;
|
|
229
|
+
export interface SettableKey {
|
|
230
|
+
/** Dot path; `<…>` marks a part the user fills in (`accounts.<family>:<name>.args`). */
|
|
231
|
+
key: string;
|
|
232
|
+
/** One line on what it does. */
|
|
233
|
+
meaning: string;
|
|
234
|
+
/** The values it takes, in words. */
|
|
235
|
+
takes: string;
|
|
236
|
+
/** The current value of a key without `<…>`; absent when not set. */
|
|
237
|
+
value?: unknown;
|
|
238
|
+
/** For a key with `<…>`: the keys set now and their values. */
|
|
239
|
+
entries?: {
|
|
240
|
+
key: string;
|
|
241
|
+
value: unknown;
|
|
242
|
+
}[];
|
|
243
|
+
}
|
|
244
|
+
/** Every key `sideby config set` takes, with its meaning and current value, in schema order. */
|
|
245
|
+
export declare function settableKeys(config: Config): SettableKey[];
|
|
246
|
+
/** Splits and checks a dot path; refuses what `config` may not read or change. */
|
|
247
|
+
export declare function configKeyPath(key: string): string[];
|
|
248
|
+
/** The path of `key`, what it does and the values it takes; refuses what `config` may not read or change. */
|
|
249
|
+
export declare function describeConfigKey(key: string): {
|
|
250
|
+
path: string[];
|
|
251
|
+
meaning: string;
|
|
252
|
+
takes: string;
|
|
253
|
+
};
|
|
254
|
+
/** A value from the command line: JSON when it parses (90, true, ["a"]), else the text itself. */
|
|
255
|
+
export declare function parseConfigValue(text: string): unknown;
|
|
256
|
+
/** `sideby config get [key]`: the value at `key` (undefined when not set). */
|
|
257
|
+
export declare function configGet(file: string, key: string): Promise<{
|
|
258
|
+
key: string;
|
|
259
|
+
value: unknown;
|
|
260
|
+
}>;
|
|
261
|
+
export interface ConfigChange {
|
|
262
|
+
key: string;
|
|
263
|
+
before: unknown;
|
|
264
|
+
after: unknown;
|
|
265
|
+
changed: boolean;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* `sideby config set|unset` (spec §3.29): sets `key` to `value`, or removes it when `value` is undefined (and parents
|
|
269
|
+
* left empty with it). The whole result must match the schema; `accounts.<ref>.args` takes only what `argsProblem`
|
|
270
|
+
* accepts (the model and effort arguments, as `sideby model`), and without `argsProblem` it is refused. Written as
|
|
271
|
+
* every other config change (see `editConfigKey`); `dryRun` shows the change without writing.
|
|
272
|
+
*/
|
|
273
|
+
export declare function editConfigPath(file: string, key: string, value: unknown, opts?: {
|
|
274
|
+
dryRun?: boolean;
|
|
275
|
+
argsProblem?: (ref: string, args: string[]) => string | null;
|
|
276
|
+
}): Promise<ConfigChange>;
|
|
175
277
|
export {};
|
package/dist/src/core/config.js
CHANGED
|
@@ -55,7 +55,10 @@ const HandoffSchema = Type.Object({
|
|
|
55
55
|
description: 'Also hand off to an account of the same family (cc001 → cc002). The kind vendors are most likely to act on. Off by default.',
|
|
56
56
|
})),
|
|
57
57
|
prepareAt: Percent('Quota Pressure at which the session starts keeping a Handoff Brief (default 80).'),
|
|
58
|
-
threshold: Percent('Quota Pressure at which the Handoff begins (default 95).'),
|
|
58
|
+
threshold: Percent('Quota Pressure at which the Handoff begins (default 95). With `adaptive`, a window uses it until the run has measured a turn of it.'),
|
|
59
|
+
adaptive: Type.Optional(Type.Boolean({
|
|
60
|
+
description: 'Hand over by each window’s own pace: when it has less room left than 1.5 times its largest recent turn, between `prepareAt` and 99 (default true; ADR-0032). False uses `threshold` for every window.',
|
|
61
|
+
})),
|
|
59
62
|
waitIfResetWithinMinutes: Type.Optional(Type.Integer({
|
|
60
63
|
minimum: 0,
|
|
61
64
|
description: 'Stay and wait when the full window resets within this many minutes (default 30; 0 never waits).',
|
|
@@ -68,15 +71,51 @@ const HandoffSchema = Type.Object({
|
|
|
68
71
|
description: 'Accounts (ref or short command) that may take over from an account of another organization.',
|
|
69
72
|
})),
|
|
70
73
|
families: Type.Optional(Type.Record(Type.String(), Type.Object({
|
|
71
|
-
policy: Type.Optional(Type.Union([Type.Literal('pressure'), Type.Literal('order')]
|
|
72
|
-
|
|
74
|
+
policy: Type.Optional(Type.Union([Type.Literal('pressure'), Type.Literal('order')], {
|
|
75
|
+
description: '`pressure` picks the account with the most Quota left; `order` follows `order`.',
|
|
76
|
+
})),
|
|
77
|
+
order: Type.Optional(Type.Array(Type.String(), { description: 'Accounts (ref or short command) to try, in order.' })),
|
|
73
78
|
}, { additionalProperties: false }), {
|
|
74
79
|
description: 'Handoff Order per family the session starts in: `pressure` (default) or an `order` list.',
|
|
75
80
|
})),
|
|
76
81
|
}, { additionalProperties: false });
|
|
77
82
|
export const ConfigSchema = Type.Object({
|
|
78
83
|
$schema: Type.Optional(Type.String()),
|
|
79
|
-
|
|
84
|
+
panel: Type.Optional(Type.Object({
|
|
85
|
+
theme: Type.Optional(Type.String({
|
|
86
|
+
enum: ['system', 'light', 'dark'],
|
|
87
|
+
description: 'Panel colours: follow the system (default), always light, or always dark.',
|
|
88
|
+
})),
|
|
89
|
+
language: Type.Optional(Type.String({
|
|
90
|
+
enum: ['auto', 'en', 'zh'],
|
|
91
|
+
description: "Panel language: the browser's (default), English, or Chinese.",
|
|
92
|
+
})),
|
|
93
|
+
}, { additionalProperties: false, description: 'How the Panel looks (spec §3.29).' })),
|
|
94
|
+
menubar: Type.Optional(Type.Object({
|
|
95
|
+
hotkey: Type.Optional(Type.String({
|
|
96
|
+
pattern: '^(off|((ctrl|opt|cmd|shift)\\+)+[a-z0-9])$',
|
|
97
|
+
description: 'The shortcut that opens the menu bar item from anywhere, such as `opt+cmd+s` (default), or `off`.',
|
|
98
|
+
})),
|
|
99
|
+
}, { additionalProperties: false, description: 'The Menu Bar Item on macOS (spec §3.31).' })),
|
|
100
|
+
terminal: Type.Optional(Type.Object({
|
|
101
|
+
preferred: Type.Optional(Type.String({
|
|
102
|
+
enum: ['terminal', 'iterm2', 'ghostty', 'orca', 'wezterm', 'kitty', 'alacritty', 'custom'],
|
|
103
|
+
description: 'The terminal sideby opens for AI Tasks; without it sideby picks the one you use.',
|
|
104
|
+
})),
|
|
105
|
+
custom: Type.Optional(Type.String({
|
|
106
|
+
description: 'Your own launch command for `preferred: custom`, with `{cwd}` and `{cmd}` placeholders.',
|
|
107
|
+
})),
|
|
108
|
+
}, { additionalProperties: false, description: 'The terminal AI Tasks open in (spec §3.28).' })),
|
|
109
|
+
ask: Type.Optional(Type.Object({
|
|
110
|
+
account: Type.Optional(Type.String({
|
|
111
|
+
description: 'The account AI Tasks start (`<family>:<name>` or a short command); sideby picks one without it.',
|
|
112
|
+
})),
|
|
113
|
+
}, { additionalProperties: false, description: 'AI Tasks (spec §3.28).' })),
|
|
114
|
+
accounts: Type.Optional(Type.Record(Type.String(), Type.Object({
|
|
115
|
+
args: Type.Optional(Type.Array(Type.String(), {
|
|
116
|
+
description: 'Host arguments sideby starts the account with; `sideby config` and `sideby model` set only the model and effort ones.',
|
|
117
|
+
})),
|
|
118
|
+
}, { additionalProperties: false }), { description: 'Per-Account settings keyed by `<family>:<name>`.' })),
|
|
80
119
|
aliases: Type.Optional(Type.Record(Type.String({ pattern: '^[A-Za-z_][A-Za-z0-9_-]*$' }), AliasSchema, {
|
|
81
120
|
description: 'Short shell function names created by `sideby shell-init`, mapped to an Account ref or to `{ account, args }`.',
|
|
82
121
|
})),
|
|
@@ -85,7 +124,9 @@ export const ConfigSchema = Type.Object({
|
|
|
85
124
|
plugins: Type.Optional(Type.Record(Type.String(), Type.Record(Type.String(), Type.Unknown()), {
|
|
86
125
|
description: 'Per-Plugin settings; `enabled: false` turns a Plugin off.',
|
|
87
126
|
})),
|
|
88
|
-
extraSharedItems: Type.Optional(Type.Record(Type.String(), Type.Array(SharedItemSchema)
|
|
127
|
+
extraSharedItems: Type.Optional(Type.Record(Type.String(), Type.Array(SharedItemSchema), {
|
|
128
|
+
description: 'Per family, more items each account shares with the main account: `{ path, mode }` with a relative path.',
|
|
129
|
+
})),
|
|
89
130
|
accountTitle: Type.Optional(Type.Boolean({
|
|
90
131
|
description: 'Set the terminal title to `[<short command or account>]` when sideby starts an Account, and keep Hosts that allow it (Codex) from replacing it. Off by default.',
|
|
91
132
|
})),
|
|
@@ -127,8 +168,8 @@ export const ConfigSchema = Type.Object({
|
|
|
127
168
|
})),
|
|
128
169
|
}, { additionalProperties: false, description: 'Quota that sideby asks for (spec §3.26, ADR-0025).' })),
|
|
129
170
|
shellInitFile: Type.Optional(Type.Object({
|
|
130
|
-
zsh: Type.Optional(Type.String({ minLength: 1 })),
|
|
131
|
-
bash: Type.Optional(Type.String({ minLength: 1 })),
|
|
171
|
+
zsh: Type.Optional(Type.String({ minLength: 1, description: 'The file for zsh.' })),
|
|
172
|
+
bash: Type.Optional(Type.String({ minLength: 1, description: 'The file for bash.' })),
|
|
132
173
|
}, {
|
|
133
174
|
additionalProperties: false,
|
|
134
175
|
description: 'Absolute or `~/` paths of files sideby rewrites with the `sideby shell-init <shell>` output whenever it adds an Account or an alias; source the file from your shell rc.',
|
|
@@ -142,6 +183,7 @@ export function handoffSettings(config) {
|
|
|
142
183
|
sameFamily: h.sameFamily ?? false,
|
|
143
184
|
prepareAt: h.prepareAt ?? 80,
|
|
144
185
|
threshold: h.threshold ?? 95,
|
|
186
|
+
adaptive: h.adaptive ?? true,
|
|
145
187
|
waitIfResetWithinMinutes: h.waitIfResetWithinMinutes ?? 30,
|
|
146
188
|
countdownSeconds: h.countdownSeconds ?? 10,
|
|
147
189
|
crossOrganization: [...(h.crossOrganization ?? [])],
|
|
@@ -191,8 +233,8 @@ async function configTarget(file) {
|
|
|
191
233
|
return (await lstatOrNull(file))?.isSymbolicLink() ? ((await realpathOrNull(file)) ?? file) : file;
|
|
192
234
|
}
|
|
193
235
|
/**
|
|
194
|
-
* Re-reads the config file, lets `edit` change one top-level `key` (sideby writes
|
|
195
|
-
* `
|
|
236
|
+
* Re-reads the config file, lets `edit` change one top-level `key` (the keys sideby writes are listed in spec §3.10;
|
|
237
|
+
* `sideby config set|unset` may change any but plugin settings, §3.29), and an `edit` that returns undefined removes it, and writes the result: every other key and their order kept (with `$schema`), 2-space JSON
|
|
196
238
|
* with a trailing newline, atomically, keeping the file's mode (0600 for a new file). Refuses, without writing, a
|
|
197
239
|
* file that is not valid JSON or not a valid config, a result that is not a valid config, or a file that changed
|
|
198
240
|
* while sideby wrote it. `edit` returns null to leave the file alone; `dryRun` returns the change without writing.
|
|
@@ -233,8 +275,18 @@ async function editConfigKey(file, key, retry, edit, opts = {}) {
|
|
|
233
275
|
: { ...data, [key]: after };
|
|
234
276
|
if (after === undefined)
|
|
235
277
|
delete next[key];
|
|
236
|
-
if (!Value.Check(ConfigSchema, next))
|
|
237
|
-
|
|
278
|
+
if (!Value.Check(ConfigSchema, next)) {
|
|
279
|
+
const first = [...Value.Errors(ConfigSchema, next)][0];
|
|
280
|
+
const where = (first?.instancePath ?? '').replace(/^\//, '').split('/').join('.') || key;
|
|
281
|
+
throw new ConfigError(`${where} ${first?.message ?? 'is invalid'}, so nothing was changed; \`sideby config get\` lists the keys and the values they take`, { code: 'bad-value' });
|
|
282
|
+
}
|
|
283
|
+
for (const alias of Object.keys(next.aliases ?? {})) {
|
|
284
|
+
const problem = aliasProblem(alias);
|
|
285
|
+
if (problem)
|
|
286
|
+
throw new ConfigError(`alias "${alias}" ${problem} (it becomes a shell function name); pick another name`, {
|
|
287
|
+
code: 'bad-value',
|
|
288
|
+
});
|
|
289
|
+
}
|
|
238
290
|
const h = handoffSettings(next);
|
|
239
291
|
if (h.prepareAt >= h.threshold)
|
|
240
292
|
throw new ConfigError(`handoff.prepareAt must be lower than handoff.threshold; fix them in ${file} and ${retry} again`);
|
|
@@ -346,3 +398,229 @@ export async function removeConfigAlias(file, alias) {
|
|
|
346
398
|
});
|
|
347
399
|
return { status, aliases };
|
|
348
400
|
}
|
|
401
|
+
export function editConfigTerminal(file, patch) {
|
|
402
|
+
return editConfigKey(file, 'terminal', 'run `sideby terminal`', (current) => {
|
|
403
|
+
const next = { ...current, ...patch };
|
|
404
|
+
for (const key of ['preferred', 'custom'])
|
|
405
|
+
if (next[key] === undefined)
|
|
406
|
+
delete next[key];
|
|
407
|
+
return Object.keys(next).length ? next : undefined;
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
export function editConfigAsk(file, account) {
|
|
411
|
+
return editConfigKey(file, 'ask', 'run `sideby ask`', () => (account ? { account } : undefined));
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* The Panel's theme and language (spec §3.29): a value sets the key, null removes it (back to the default), and an
|
|
415
|
+
* empty `panel` goes away with it (see `editConfigKey` for how the file is written).
|
|
416
|
+
*/
|
|
417
|
+
export function editConfigPanel(file, patch, opts = {}) {
|
|
418
|
+
return editConfigKey(file, 'panel', 'change the setting', (current) => {
|
|
419
|
+
const next = { ...current };
|
|
420
|
+
for (const k of ['theme', 'language'])
|
|
421
|
+
if (patch[k] === null)
|
|
422
|
+
delete next[k];
|
|
423
|
+
else if (patch[k] !== undefined)
|
|
424
|
+
next[k] = patch[k];
|
|
425
|
+
return Object.keys(next).length ? next : undefined;
|
|
426
|
+
}, opts);
|
|
427
|
+
}
|
|
428
|
+
/** The name shown for a key the user picks, per record in the schema. */
|
|
429
|
+
const PLACEHOLDERS = {
|
|
430
|
+
accounts: '<family>:<name>',
|
|
431
|
+
aliases: '<short>',
|
|
432
|
+
plugins: '<plugin>',
|
|
433
|
+
extraSharedItems: '<family>',
|
|
434
|
+
'handoff.families': '<family>',
|
|
435
|
+
'display.accounts': '<family>',
|
|
436
|
+
'display.pinned': '<family>',
|
|
437
|
+
'quota.check': '<family>',
|
|
438
|
+
};
|
|
439
|
+
const BAD_SEGMENT = new Set(['__proto__', 'constructor', 'prototype']);
|
|
440
|
+
function takes(node) {
|
|
441
|
+
if (node.anyOf) {
|
|
442
|
+
const consts = node.anyOf.filter((n) => n.const !== undefined).map((n) => String(n.const));
|
|
443
|
+
if (consts.length === node.anyOf.length)
|
|
444
|
+
return `one of: ${consts.join(', ')}`;
|
|
445
|
+
return 'an account ref (`<family>:<name>`), or JSON {"account": …, "args": […]}';
|
|
446
|
+
}
|
|
447
|
+
if (node.enum)
|
|
448
|
+
return `one of: ${node.enum.join(', ')}`;
|
|
449
|
+
if (node.type === 'boolean')
|
|
450
|
+
return 'true or false';
|
|
451
|
+
if (node.type === 'integer')
|
|
452
|
+
return node.maximum !== undefined
|
|
453
|
+
? `a whole number from ${node.minimum ?? 0} to ${node.maximum}`
|
|
454
|
+
: `a whole number, ${node.minimum ?? 0} or more`;
|
|
455
|
+
if (node.type === 'array')
|
|
456
|
+
return node.items?.type === 'string' ? 'a JSON list of text, such as ["a","b"]' : 'a JSON list';
|
|
457
|
+
if (node.type === 'string')
|
|
458
|
+
return 'text';
|
|
459
|
+
return 'a JSON object';
|
|
460
|
+
}
|
|
461
|
+
/** Every key `sideby config set` takes, with its meaning and current value, in schema order. */
|
|
462
|
+
export function settableKeys(config) {
|
|
463
|
+
const out = [];
|
|
464
|
+
const walk = (node, path, meaning) => {
|
|
465
|
+
const key = path.join('.');
|
|
466
|
+
const here = node.description ?? meaning;
|
|
467
|
+
if (node.properties) {
|
|
468
|
+
for (const [name, child] of Object.entries(node.properties))
|
|
469
|
+
if (name !== '$schema')
|
|
470
|
+
walk(child, [...path, name], here);
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
const pattern = node.patternProperties && Object.values(node.patternProperties)[0];
|
|
474
|
+
if (pattern) {
|
|
475
|
+
const holder = PLACEHOLDERS[key] ?? '<name>';
|
|
476
|
+
if (key === 'plugins') {
|
|
477
|
+
walk({
|
|
478
|
+
type: 'boolean',
|
|
479
|
+
description: 'false turns the plugin off; its own settings are not changed here.',
|
|
480
|
+
}, [...path, holder, 'enabled'], here);
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
if (pattern.properties)
|
|
484
|
+
return walk(pattern, [...path, holder], here);
|
|
485
|
+
return leaf(pattern, [...path, holder], here);
|
|
486
|
+
}
|
|
487
|
+
leaf(node, path, here);
|
|
488
|
+
};
|
|
489
|
+
const leaf = (node, path, meaning) => {
|
|
490
|
+
const key = path.join('.');
|
|
491
|
+
const item = { key, meaning: node.description ?? meaning, takes: takes(node) };
|
|
492
|
+
const holder = path.findIndex((p) => p.startsWith('<'));
|
|
493
|
+
if (holder < 0) {
|
|
494
|
+
const v = getIn(config, path);
|
|
495
|
+
if (v !== undefined)
|
|
496
|
+
item.value = v;
|
|
497
|
+
}
|
|
498
|
+
else {
|
|
499
|
+
const entries = [];
|
|
500
|
+
const parent = getIn(config, path.slice(0, holder));
|
|
501
|
+
if (parent && typeof parent === 'object')
|
|
502
|
+
for (const name of Object.keys(parent)) {
|
|
503
|
+
const concrete = [...path.slice(0, holder), name, ...path.slice(holder + 1)];
|
|
504
|
+
const v = getIn(config, concrete);
|
|
505
|
+
if (v !== undefined)
|
|
506
|
+
entries.push({ key: concrete.join('.'), value: v });
|
|
507
|
+
}
|
|
508
|
+
if (entries.length)
|
|
509
|
+
item.entries = entries;
|
|
510
|
+
}
|
|
511
|
+
out.push(item);
|
|
512
|
+
};
|
|
513
|
+
walk(ConfigSchema, [], '');
|
|
514
|
+
return out;
|
|
515
|
+
}
|
|
516
|
+
function getIn(value, path) {
|
|
517
|
+
let at = value;
|
|
518
|
+
for (const seg of path) {
|
|
519
|
+
if (!at || typeof at !== 'object' || Array.isArray(at) || !Object.hasOwn(at, seg))
|
|
520
|
+
return undefined;
|
|
521
|
+
at = at[seg];
|
|
522
|
+
}
|
|
523
|
+
return at;
|
|
524
|
+
}
|
|
525
|
+
/** Splits and checks a dot path; refuses what `config` may not read or change. */
|
|
526
|
+
export function configKeyPath(key) {
|
|
527
|
+
return describeConfigKey(key).path;
|
|
528
|
+
}
|
|
529
|
+
/** The path of `key`, what it does and the values it takes; refuses what `config` may not read or change. */
|
|
530
|
+
export function describeConfigKey(key) {
|
|
531
|
+
const path = key.split('.');
|
|
532
|
+
const list = '`sideby config get` lists the keys you can use';
|
|
533
|
+
if (!key || path.some((p) => !p || BAD_SEGMENT.has(p)))
|
|
534
|
+
throw new ConfigError(`"${key}" is not a config key; ${list}`, { code: 'bad-key' });
|
|
535
|
+
if (path[0] === '$schema')
|
|
536
|
+
throw new ConfigError(`$schema is for editors and is not a setting; ${list}`, { code: 'bad-key' });
|
|
537
|
+
if (path[0] === 'plugins' && !(path.length === 3 && path[2] === 'enabled'))
|
|
538
|
+
throw new ConfigError(`a plugin's own settings may hold secrets, so \`sideby config\` does not read or change them (only plugins.<plugin>.enabled); edit them in the config file`, { code: 'plugin-config' });
|
|
539
|
+
let node = ConfigSchema;
|
|
540
|
+
let meaning = '';
|
|
541
|
+
for (const seg of path) {
|
|
542
|
+
const n = node;
|
|
543
|
+
if (!n)
|
|
544
|
+
break;
|
|
545
|
+
const holder = n.anyOf ?? [n];
|
|
546
|
+
node = undefined;
|
|
547
|
+
for (const h of holder) {
|
|
548
|
+
if (h.properties?.[seg])
|
|
549
|
+
node = h.properties[seg];
|
|
550
|
+
else if (h.patternProperties) {
|
|
551
|
+
const [re, child] = Object.entries(h.patternProperties)[0];
|
|
552
|
+
if (new RegExp(re).test(seg))
|
|
553
|
+
node = child;
|
|
554
|
+
}
|
|
555
|
+
if (node)
|
|
556
|
+
break;
|
|
557
|
+
}
|
|
558
|
+
if (node?.description)
|
|
559
|
+
meaning = node.description;
|
|
560
|
+
}
|
|
561
|
+
if (!node)
|
|
562
|
+
throw new ConfigError(`"${key}" is not a config key; ${list}`, { code: 'bad-key' });
|
|
563
|
+
if (path[0] === 'plugins')
|
|
564
|
+
return { path, meaning: 'false turns the plugin off.', takes: 'true or false' };
|
|
565
|
+
return { path, meaning, takes: takes(node) };
|
|
566
|
+
}
|
|
567
|
+
/** A value from the command line: JSON when it parses (90, true, ["a"]), else the text itself. */
|
|
568
|
+
export function parseConfigValue(text) {
|
|
569
|
+
try {
|
|
570
|
+
return JSON.parse(text);
|
|
571
|
+
}
|
|
572
|
+
catch {
|
|
573
|
+
return text;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
/** `sideby config get [key]`: the value at `key` (undefined when not set). */
|
|
577
|
+
export async function configGet(file, key) {
|
|
578
|
+
const path = configKeyPath(key);
|
|
579
|
+
return { key, value: getIn(await loadConfig(file), path) };
|
|
580
|
+
}
|
|
581
|
+
function setIn(value, path, next, key) {
|
|
582
|
+
const [seg, ...rest] = path;
|
|
583
|
+
if (seg === undefined)
|
|
584
|
+
return next;
|
|
585
|
+
if (value !== undefined && (typeof value !== 'object' || value === null || Array.isArray(value)))
|
|
586
|
+
throw new ConfigError(`${key} cannot be set inside a value that is not an object; set the part before it as a whole (JSON), or unset it first`, { code: 'bad-key' });
|
|
587
|
+
const obj = { ...value };
|
|
588
|
+
const child = setIn(obj[seg], rest, next, key);
|
|
589
|
+
if (child === undefined || (rest.length && isEmptyObject(child) && next === undefined))
|
|
590
|
+
delete obj[seg];
|
|
591
|
+
else
|
|
592
|
+
obj[seg] = child;
|
|
593
|
+
return obj;
|
|
594
|
+
}
|
|
595
|
+
const isEmptyObject = (v) => typeof v === 'object' && v !== null && !Array.isArray(v) && Object.keys(v).length === 0;
|
|
596
|
+
/**
|
|
597
|
+
* `sideby config set|unset` (spec §3.29): sets `key` to `value`, or removes it when `value` is undefined (and parents
|
|
598
|
+
* left empty with it). The whole result must match the schema; `accounts.<ref>.args` takes only what `argsProblem`
|
|
599
|
+
* accepts (the model and effort arguments, as `sideby model`), and without `argsProblem` it is refused. Written as
|
|
600
|
+
* every other config change (see `editConfigKey`); `dryRun` shows the change without writing.
|
|
601
|
+
*/
|
|
602
|
+
export async function editConfigPath(file, key, value, opts = {}) {
|
|
603
|
+
const path = configKeyPath(key);
|
|
604
|
+
if (path[0] === 'plugins' && value !== undefined && typeof value !== 'boolean')
|
|
605
|
+
throw new ConfigError(`${key} takes true or false`, { code: 'bad-value' });
|
|
606
|
+
const top = path[0];
|
|
607
|
+
const r = await editConfigKey(file, top, 'run the command', (current) => {
|
|
608
|
+
const next = setIn(current, path.slice(1), value, key);
|
|
609
|
+
const result = path.length === 1 ? next : isEmptyObject(next) ? undefined : next;
|
|
610
|
+
if (top === 'accounts')
|
|
611
|
+
checkAccountArgs(current, result, opts.argsProblem);
|
|
612
|
+
return result;
|
|
613
|
+
}, opts);
|
|
614
|
+
const inner = path.slice(1);
|
|
615
|
+
return { key, before: getIn(r.before, inner), after: getIn(r.after, inner), changed: r.changed };
|
|
616
|
+
}
|
|
617
|
+
function checkAccountArgs(before, after, argsProblem) {
|
|
618
|
+
for (const [ref, entry] of Object.entries(after ?? {})) {
|
|
619
|
+
const args = entry.args;
|
|
620
|
+
if (!args || JSON.stringify(args) === JSON.stringify(before?.[ref]?.args))
|
|
621
|
+
continue;
|
|
622
|
+
const problem = argsProblem ? argsProblem(ref, args) : 'sideby cannot check these arguments here';
|
|
623
|
+
if (problem)
|
|
624
|
+
throw new ConfigError(`accounts.${ref}.args: ${problem}. \`sideby config\` sets only the model and effort arguments, as \`sideby model ${ref}\` does; other host arguments go in a short command (\`sideby alias add <short> ${ref} -- <args>\`)`, { code: 'bad-value' });
|
|
625
|
+
}
|
|
626
|
+
}
|
|
@@ -112,4 +112,4 @@ export declare function withDesktopApps<T extends {
|
|
|
112
112
|
* Account. Results are named `app-data/<path>` and are not counted in `shared`. The App Data is the repair boundary:
|
|
113
113
|
* a fix may only add a missing link inside it or sync a file's `key` there, never replace a real file.
|
|
114
114
|
*/
|
|
115
|
-
export declare function checkAppData(plugins: readonly LoadedPlugin[], home: string, account: Account): Promise<CheckResult[]>;
|
|
115
|
+
export declare function checkAppData(plugins: readonly LoadedPlugin[], home: string, account: Account, force?: boolean): Promise<CheckResult[]>;
|
|
@@ -369,7 +369,7 @@ export async function withDesktopApps(rt, accounts, statuses) {
|
|
|
369
369
|
* Account. Results are named `app-data/<path>` and are not counted in `shared`. The App Data is the repair boundary:
|
|
370
370
|
* a fix may only add a missing link inside it or sync a file's `key` there, never replace a real file.
|
|
371
371
|
*/
|
|
372
|
-
export async function checkAppData(plugins, home, account) {
|
|
372
|
+
export async function checkAppData(plugins, home, account, force = false) {
|
|
373
373
|
if (account.isMain || account.kind === 'api')
|
|
374
374
|
return [];
|
|
375
375
|
const def = desktopAppOf(plugins, account.family);
|
|
@@ -383,7 +383,7 @@ export async function checkAppData(plugins, home, account) {
|
|
|
383
383
|
const item = { path: f.path, mode: 'link' };
|
|
384
384
|
const mainPath = join(home, f.mainPath);
|
|
385
385
|
const p = join(dir, item.path);
|
|
386
|
-
const ctx = { account, item, mainPath, accountPath: p, accountDir: dir, force
|
|
386
|
+
const ctx = { account, item, mainPath, accountPath: p, accountDir: dir, force };
|
|
387
387
|
let res = await checkItem(ctx);
|
|
388
388
|
// The Desktop App writes its own file when the Main Account had none at first open, and replaces the link when
|
|
389
389
|
// it saves its preferences: not the user's doing, and a new link would be replaced again. With a `key`, only
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Runtime } from '../runtime.ts';
|
|
2
|
+
import type { FamilyDef } from '../types.ts';
|
|
3
|
+
export interface EditSettingsResult {
|
|
4
|
+
schemaVersion: 1;
|
|
5
|
+
ref: string;
|
|
6
|
+
family: string;
|
|
7
|
+
/** The file as the Family names it, such as `settings.json`. */
|
|
8
|
+
file: string;
|
|
9
|
+
/** The file inside the account directory. */
|
|
10
|
+
path: string;
|
|
11
|
+
/** Where the file really is, only when `path` is a link. */
|
|
12
|
+
target?: string;
|
|
13
|
+
/** Other Accounts of the Family whose settings file is this same file. */
|
|
14
|
+
sharedWith: string[];
|
|
15
|
+
/** False with `--path`, which only says where the file is. */
|
|
16
|
+
opened: boolean;
|
|
17
|
+
/** The program and arguments that opened it. */
|
|
18
|
+
command?: string[];
|
|
19
|
+
}
|
|
20
|
+
/** The Family's settings file when it names a relative path that stays inside the account directory. */
|
|
21
|
+
export declare function hostSettingsFile(def: Pick<FamilyDef, 'settingsFile'> | undefined): string | undefined;
|
|
22
|
+
export declare function editSettings(rt: Runtime, ref: string, opts?: {
|
|
23
|
+
open?: boolean;
|
|
24
|
+
}): Promise<EditSettingsResult>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Opens an Account's Host settings file in the user's editor (spec §3.30, ADR-0033). sideby reads none of the file:
|
|
2
|
+
// it checks that the file is there and, for a link, where it really is and which Accounts share it. Every program
|
|
3
|
+
// it runs goes through `DesktopDeps.exec`, so tests start nothing.
|
|
4
|
+
import { realpath } from 'node:fs/promises';
|
|
5
|
+
import { isAbsolute, join } from 'node:path';
|
|
6
|
+
import { depsFor } from './desktop-app.js';
|
|
7
|
+
import { UserError } from './errors.js';
|
|
8
|
+
import { lstatOrNull } from './fs-safe.js';
|
|
9
|
+
/** The Family's settings file when it names a relative path that stays inside the account directory. */
|
|
10
|
+
export function hostSettingsFile(def) {
|
|
11
|
+
const f = def?.settingsFile;
|
|
12
|
+
if (typeof f !== 'string' || !f || isAbsolute(f) || f.split(/[\\/]/).includes('..'))
|
|
13
|
+
return undefined;
|
|
14
|
+
return f;
|
|
15
|
+
}
|
|
16
|
+
async function realOrNull(path) {
|
|
17
|
+
try {
|
|
18
|
+
return await realpath(path);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export async function editSettings(rt, ref, opts = {}) {
|
|
25
|
+
const account = await rt.resolve(ref);
|
|
26
|
+
const def = rt.families.get(account.family);
|
|
27
|
+
const file = hostSettingsFile(def);
|
|
28
|
+
if (!file)
|
|
29
|
+
throw new UserError(`${account.ref}: ${def?.title ?? account.family} names no settings file; its folder is ${account.dir}`, { code: 'no-settings-file' });
|
|
30
|
+
const path = join(account.dir, file);
|
|
31
|
+
const real = await realOrNull(path);
|
|
32
|
+
if (!real) {
|
|
33
|
+
const link = await lstatOrNull(path);
|
|
34
|
+
throw new UserError(link?.isSymbolicLink()
|
|
35
|
+
? `${path} links to a file that is not there; run \`sideby doctor ${account.ref}\` to see what it should point to`
|
|
36
|
+
: `${account.ref} has no ${file} yet (${path}); \`sideby doctor ${account.ref} --fix\` links the main account's when they share it, or create the file in your editor`, { code: 'settings-missing' });
|
|
37
|
+
}
|
|
38
|
+
const sharedWith = [];
|
|
39
|
+
for (const other of await rt.accounts()) {
|
|
40
|
+
if (other.family !== account.family || other.ref === account.ref)
|
|
41
|
+
continue;
|
|
42
|
+
if ((await realOrNull(join(other.dir, file))) === real)
|
|
43
|
+
sharedWith.push(other.ref);
|
|
44
|
+
}
|
|
45
|
+
const base = {
|
|
46
|
+
schemaVersion: 1,
|
|
47
|
+
ref: account.ref,
|
|
48
|
+
family: account.family,
|
|
49
|
+
file,
|
|
50
|
+
path,
|
|
51
|
+
...(real !== path && (await lstatOrNull(path))?.isSymbolicLink() ? { target: real } : {}),
|
|
52
|
+
sharedWith,
|
|
53
|
+
};
|
|
54
|
+
if (opts.open === false)
|
|
55
|
+
return { ...base, opened: false };
|
|
56
|
+
return { ...base, opened: true, command: await openWithDefault(rt, real) };
|
|
57
|
+
}
|
|
58
|
+
/** Opens `file` with the system's default program; returns the command, or throws what to do instead. */
|
|
59
|
+
async function openWithDefault(rt, file) {
|
|
60
|
+
const deps = depsFor(rt);
|
|
61
|
+
const yourself = `open ${file} in your editor yourself`;
|
|
62
|
+
if (deps.platform === 'darwin') {
|
|
63
|
+
const r = await deps.exec('/usr/bin/open', ['-t', file]);
|
|
64
|
+
if (r.code !== 0)
|
|
65
|
+
throw new UserError(`macOS could not open the file; ${yourself}`, { code: 'open-failed' });
|
|
66
|
+
return ['/usr/bin/open', '-t', file];
|
|
67
|
+
}
|
|
68
|
+
if (deps.platform === 'linux' && deps.wslMount) {
|
|
69
|
+
const w = await deps.exec('wslpath', ['-w', file]);
|
|
70
|
+
const win = w.stdout.trim();
|
|
71
|
+
if (w.code !== 0 || !win)
|
|
72
|
+
throw new UserError(`wslpath could not name the file for Windows; ${yourself}`, { code: 'open-failed' });
|
|
73
|
+
// `start` hands the file to its Windows default program; explorer.exe opens one only now and then. cmd reads
|
|
74
|
+
// these characters itself, so a path with one is left to the user.
|
|
75
|
+
if (/[&|<>^%"]/.test(win))
|
|
76
|
+
throw new UserError(`the path has a character cmd.exe reads itself; ${yourself}`, {
|
|
77
|
+
code: 'open-failed',
|
|
78
|
+
});
|
|
79
|
+
const cmd = `${deps.wslMount}/c/Windows/System32/cmd.exe`;
|
|
80
|
+
const args = ['/c', 'start', '', win];
|
|
81
|
+
const r = await deps.exec(cmd, args);
|
|
82
|
+
if (r.code !== 0)
|
|
83
|
+
throw new UserError(`Windows could not open the file; ${yourself}`, { code: 'open-failed' });
|
|
84
|
+
return [cmd, ...args];
|
|
85
|
+
}
|
|
86
|
+
if (deps.platform === 'linux') {
|
|
87
|
+
const r = await deps.exec('xdg-open', [file]);
|
|
88
|
+
if (r.code !== 0)
|
|
89
|
+
throw new UserError(`xdg-open could not open the file; install xdg-utils, or ${yourself}`, {
|
|
90
|
+
code: 'open-failed',
|
|
91
|
+
});
|
|
92
|
+
return ['xdg-open', file];
|
|
93
|
+
}
|
|
94
|
+
throw new UserError(`sideby cannot open files on ${deps.platform} yet; ${yourself}`, {
|
|
95
|
+
code: 'open-failed',
|
|
96
|
+
});
|
|
97
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReadyFile } from './handoff-chain.ts';
|
|
2
2
|
/** Branch, uncommitted files and `git diff --stat`, as Markdown; '' outside a git work tree. Never commits or stashes. */
|
|
3
3
|
export declare function gitSection(cwd: string): Promise<string>;
|
|
4
4
|
export declare const ASSEMBLED_NOTE = "> Put together by sideby from the previous session\u2019s records, without a model; it may be incomplete. Check the repository before continuing.";
|
|
5
|
+
export declare const UNFINISHED_NOTE = "> The previous session did not finish the brief above. sideby added what it found in the session\u2019s records below.";
|
|
5
6
|
/**
|
|
6
7
|
* Writes the final Brief to `target` (mode 600) and says where it came from: the user's or the session's Brief
|
|
7
|
-
* named in `ready`, the session's Brief already at `target`, else `assembled`, plus the repository state.
|
|
8
|
+
* named in `ready`, the session's Brief already at `target`, else `assembled`, plus the repository state. A session's
|
|
9
|
+
* Brief without `BRIEF_DONE` is kept, with `assembled` added under it (ADR-0032).
|
|
8
10
|
*/
|
|
9
11
|
export declare function finishBrief(opts: {
|
|
10
12
|
target: string;
|