@fbincon/claude-code-statusline 3.7.0 → 3.8.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 +81 -79
- package/candidate.json +195 -113
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/observations.js +5 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/observations.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js +6 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/doctor.js +20 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/doctor.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js +14 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/management/arguments.d.ts +17 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/arguments.js +56 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/arguments.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/bootstrap.d.ts +7 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/bootstrap.js +69 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/bootstrap.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/configuration.d.ts +10 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/configuration.js +123 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/configuration.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/first-entry.d.ts +20 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/first-entry.js +170 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/first-entry.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/integration-runner.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/integration-runner.js +51 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/integration-runner.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/integration.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/integration.js +23 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/integration.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.js +62 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/service.d.ts +18 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/service.js +319 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/service.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/store.d.ts +53 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/store.js +117 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/store.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/worker-entry.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/worker-entry.js +13 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/worker-entry.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/git.js +9 -10
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/git.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/usage-index.js +2 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/usage-index.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/context.js +4 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/context.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/providers.js +6 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/providers.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +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/lib/i18n/generated-locales.ts +348 -6
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +4 -4
- 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/i18n/generated-locales.d.ts +342 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +348 -6
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.d.ts +27 -0
- package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.js +77 -0
- package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/management/package.d.ts +41 -0
- package/node_modules/@fbincon/statusline-core/dist/src/management/package.js +15 -0
- package/node_modules/@fbincon/statusline-core/dist/src/management/package.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/release.d.ts +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/release.js +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/git.d.ts +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/git.js +1 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/en.json +58 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +58 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +58 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +58 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +58 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +58 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/command.d.ts +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/command.js +1 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/command.js.map +1 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/files.d.ts +1 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/files.js +5 -5
- package/node_modules/@fbincon/statusline-platform/dist/src/files.js.map +1 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/git.d.ts +31 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/git.js +180 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/git.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/npm.d.ts +44 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/npm.js +229 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/npm.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/package-copy.d.ts +4 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/package-copy.js +49 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/package-copy.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/remove-tree.d.ts +2 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/remove-tree.js +51 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/remove-tree.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/source-process.d.ts +4 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/source-process.js +24 -2
- package/node_modules/@fbincon/statusline-platform/dist/src/source-process.js.map +1 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/capabilities.d.ts +12 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/capabilities.js +20 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/capabilities.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/session.d.ts +3 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/session.js +5 -2
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/session.js.map +1 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.d.ts +3 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.js +20 -3
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.js.map +1 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-environment.d.ts +3 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-environment.js +5 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-environment.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js +6 -7
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/setup.d.ts +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/setup.js +6 -4
- package/node_modules/@fbincon/statusline-tui/dist/src/setup.js.map +1 -1
- package/package.json +47 -1
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { CONFIG_FORMATS } from '@fbincon/statusline-core/management/compatibility';
|
|
4
|
+
import { PackageError } from '@fbincon/statusline-core/management/package';
|
|
5
|
+
import { readJson } from '@fbincon/statusline-core/json-read';
|
|
6
|
+
import { integer } from '@fbincon/statusline-core/json';
|
|
7
|
+
import { validateDisplay } from '@fbincon/statusline-core/config/display';
|
|
8
|
+
import { validateProfiles } from '@fbincon/statusline-core/config/profiles';
|
|
9
|
+
import { registry } from '@fbincon/statusline-core/extensions/model';
|
|
10
|
+
import { parseNative, parseFeature, parseRuntime } from '@fbincon/statusline-core/config/backend-preferences';
|
|
11
|
+
import { resolveLanguage } from '@fbincon/statusline-core/i18n/registry';
|
|
12
|
+
import { safeTarget } from '../integration/paths.js';
|
|
13
|
+
import { BINDING_FILE } from '../integration/ownership.js';
|
|
14
|
+
import { hash, readRegular } from '../recovery/journal.js';
|
|
15
|
+
import { atomicWrite } from '@fbincon/statusline-platform/files';
|
|
16
|
+
import { decodeUtf8 } from '@fbincon/statusline-platform/utf8';
|
|
17
|
+
export const CONFIG_FILES = [...Object.keys(CONFIG_FORMATS), 'settings.json', BINDING_FILE];
|
|
18
|
+
export function configurationBytes(directory) {
|
|
19
|
+
const result = {};
|
|
20
|
+
let size = 0;
|
|
21
|
+
for (const name of CONFIG_FILES) {
|
|
22
|
+
const path = join(directory, name);
|
|
23
|
+
safeTarget(directory, path);
|
|
24
|
+
try {
|
|
25
|
+
const stat = fs.lstatSync(path);
|
|
26
|
+
if (!stat.isFile() || stat.size > 32 * 1024 * 1024)
|
|
27
|
+
throw new PackageError('configuration');
|
|
28
|
+
result[name] = fs.readFileSync(path);
|
|
29
|
+
size += result[name].length;
|
|
30
|
+
if (size > 64 * 1024 * 1024)
|
|
31
|
+
throw new PackageError('configuration');
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
if (error.code === 'ENOENT')
|
|
35
|
+
result[name] = null;
|
|
36
|
+
else
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
export const configurationHashes = (bytes) => Object.fromEntries(CONFIG_FILES.map(name => [name, hash(bytes[name] ?? null)]));
|
|
43
|
+
export function assertConfiguration(directory, expected) {
|
|
44
|
+
const actual = configurationHashes(configurationBytes(directory));
|
|
45
|
+
if (CONFIG_FILES.some(name => actual[name] !== expected[name]))
|
|
46
|
+
throw new PackageError('conflict');
|
|
47
|
+
}
|
|
48
|
+
export function configurationCompatibility(bytes, target) {
|
|
49
|
+
const reasons = [];
|
|
50
|
+
for (const [name, format] of Object.entries(CONFIG_FORMATS)) {
|
|
51
|
+
const raw = bytes[name];
|
|
52
|
+
if (raw === null || raw === undefined)
|
|
53
|
+
continue;
|
|
54
|
+
try {
|
|
55
|
+
const value = readJson(decodeUtf8(raw), { duplicate() { throw new Error('duplicate'); } });
|
|
56
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
57
|
+
throw new Error();
|
|
58
|
+
const version = Number(integer(format === 'profiles' || format === 'sources' ? value.version : value.schema_version));
|
|
59
|
+
const [minimum, maximum] = target.read[format];
|
|
60
|
+
if (version < minimum || version > maximum)
|
|
61
|
+
throw new Error();
|
|
62
|
+
if (format === 'display')
|
|
63
|
+
validateDisplay(value);
|
|
64
|
+
if (format === 'profiles') {
|
|
65
|
+
validateProfiles(value);
|
|
66
|
+
for (const profile of value.profiles) {
|
|
67
|
+
const schema = Number(integer(profile.display.schema_version));
|
|
68
|
+
if (schema < target.read.display[0] || schema > target.read.display[1])
|
|
69
|
+
throw new Error();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (format === 'sources')
|
|
73
|
+
registry(value);
|
|
74
|
+
if (format === 'native_preferences')
|
|
75
|
+
parseNative(decodeUtf8(raw));
|
|
76
|
+
if (format === 'external_preferences')
|
|
77
|
+
parseFeature(decodeUtf8(raw));
|
|
78
|
+
if (format === 'runtime_preferences')
|
|
79
|
+
parseRuntime(decodeUtf8(raw));
|
|
80
|
+
if (format === 'ui_preferences' && !resolveLanguage(value.ui_language))
|
|
81
|
+
throw new Error();
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
reasons.push(name);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return reasons;
|
|
88
|
+
}
|
|
89
|
+
export function saveSnapshot(directory, transaction, bytes) {
|
|
90
|
+
const hashes = configurationHashes(bytes);
|
|
91
|
+
for (const name of CONFIG_FILES) {
|
|
92
|
+
const raw = bytes[name];
|
|
93
|
+
if (raw === null || raw === undefined)
|
|
94
|
+
continue;
|
|
95
|
+
const path = join(transaction, 'snapshot', name);
|
|
96
|
+
safeTarget(directory, path);
|
|
97
|
+
atomicWrite(path, raw);
|
|
98
|
+
}
|
|
99
|
+
return hashes;
|
|
100
|
+
}
|
|
101
|
+
export function readSnapshot(directory, transaction, hashes) {
|
|
102
|
+
if (!hashes || Object.keys(hashes).sort().join('\0') !== [...CONFIG_FILES].sort().join('\0'))
|
|
103
|
+
throw new PackageError('backup');
|
|
104
|
+
const bytes = {};
|
|
105
|
+
for (const name of CONFIG_FILES) {
|
|
106
|
+
if (hashes[name] === null) {
|
|
107
|
+
bytes[name] = null;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const path = join(transaction, 'snapshot', name);
|
|
111
|
+
safeTarget(directory, path);
|
|
112
|
+
try {
|
|
113
|
+
bytes[name] = readRegular(path);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
throw new PackageError('backup');
|
|
117
|
+
}
|
|
118
|
+
if (hash(bytes[name]) !== hashes[name])
|
|
119
|
+
throw new PackageError('backup');
|
|
120
|
+
}
|
|
121
|
+
return bytes;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../src/management/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAA6B,MAAM,mDAAmD,CAAC;AAC9G,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AAC9G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I,IAAI,YAAY,EAAE,CAAC;QAC9B,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;YACnB,SAAS;QACb,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;QACjD,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC5B,IAAI,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;QACD,MAAM,CAAC;YACH,MAAM,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAE,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC;YACnC,MAAM,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Language } from '@fbincon/statusline-core/i18n/messages';
|
|
2
|
+
import { type PackageIdentity } from '@fbincon/statusline-core/management/package';
|
|
3
|
+
import { Npm } from '@fbincon/statusline-platform/npm';
|
|
4
|
+
export declare function entryOptions(args: readonly string[]): {
|
|
5
|
+
prefix?: string;
|
|
6
|
+
dryRun: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function confirmPackage(language: Language, output: (value: string) => void, signal?: AbortSignal): Promise<boolean>;
|
|
9
|
+
export interface FirstEntryOptions {
|
|
10
|
+
configDir: string;
|
|
11
|
+
language: Language;
|
|
12
|
+
stdout: (value: string) => void;
|
|
13
|
+
stderr: (value: string) => void;
|
|
14
|
+
tty?: boolean;
|
|
15
|
+
origin?: string | null;
|
|
16
|
+
npm?: Npm;
|
|
17
|
+
confirm?: () => Promise<boolean>;
|
|
18
|
+
handoff?: (identity: PackageIdentity) => Promise<number>;
|
|
19
|
+
}
|
|
20
|
+
export declare function firstEntry(args: readonly string[], options: FirstEntryOptions): Promise<number>;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { spawn } from 'node:child_process';
|
|
5
|
+
import { createInterface } from 'node:readline/promises';
|
|
6
|
+
import { t } from '@fbincon/statusline-core/i18n/messages';
|
|
7
|
+
import { VERSION, PACKAGE_NAME } from '@fbincon/statusline-core/release';
|
|
8
|
+
import { supportedNode } from '@fbincon/statusline-core/node-runtime';
|
|
9
|
+
import { PackageError, entryAction } from '@fbincon/statusline-core/management/package';
|
|
10
|
+
import { Npm, productRoot, productIdentity, writablePrefix, within } from '@fbincon/statusline-platform/npm';
|
|
11
|
+
import { lock } from '@fbincon/statusline-platform/files';
|
|
12
|
+
import { sameLaunchEntry, which } from '@fbincon/statusline-platform/commands';
|
|
13
|
+
import { ArgumentError, optionToken } from '../config/arguments.js';
|
|
14
|
+
import { createPrefix, pendingPath, startOperation, saveOperation, recordInstallation, finishOperation, observeOperation } from './store.js';
|
|
15
|
+
import { previousBinding } from '../integration/ownership.js';
|
|
16
|
+
import { createStorage } from '../config/storage.js';
|
|
17
|
+
export function entryOptions(args) {
|
|
18
|
+
const result = { dryRun: false }, seen = new Set();
|
|
19
|
+
for (let i = 0; i < args.length; i++) {
|
|
20
|
+
const [name] = args[i].split('=');
|
|
21
|
+
if (seen.has(name))
|
|
22
|
+
throw new ArgumentError('duplicate ' + name);
|
|
23
|
+
seen.add(name);
|
|
24
|
+
if (name === '--dry-run' && args[i] === name) {
|
|
25
|
+
result.dryRun = true;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (!['--prefix', '--config-dir'].includes(name))
|
|
29
|
+
throw new ArgumentError('unrecognized arguments: ' + args[i]);
|
|
30
|
+
const value = args[i].includes('=') ? args[i].slice(name.length + 1) : args[++i];
|
|
31
|
+
if (!value || optionToken(value) || /[\0\r\n]/u.test(value))
|
|
32
|
+
throw new ArgumentError(name + ' requires a path');
|
|
33
|
+
if (name === '--prefix')
|
|
34
|
+
result.prefix = value;
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
export async function confirmPackage(language, output, signal) {
|
|
39
|
+
output(t('package.confirm', language) + ' ');
|
|
40
|
+
const reader = createInterface({ input: process.stdin, output: process.stdout, terminal: false });
|
|
41
|
+
const closed = new AbortController();
|
|
42
|
+
reader.once('close', () => closed.abort());
|
|
43
|
+
try {
|
|
44
|
+
return /^(?:y|yes)$/iu.test((await reader.question('', { signal: signal ? AbortSignal.any([signal, closed.signal]) : closed.signal })).trim());
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
reader.close();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export async function firstEntry(args, options) {
|
|
54
|
+
const flags = entryOptions(args), { language, stdout, stderr, configDir } = options;
|
|
55
|
+
if (!(options.tty ?? (process.stdin.isTTY && process.stdout.isTTY)) && !flags.dryRun) {
|
|
56
|
+
stderr(t('package.tty', language) + '\n');
|
|
57
|
+
return 2;
|
|
58
|
+
}
|
|
59
|
+
let stage = 'review', release;
|
|
60
|
+
const controller = new AbortController(), cancel = () => controller.abort();
|
|
61
|
+
process.on('SIGINT', cancel);
|
|
62
|
+
process.on('SIGTERM', cancel);
|
|
63
|
+
try {
|
|
64
|
+
if (!supportedNode(process.versions.node))
|
|
65
|
+
throw new PackageError('runtime');
|
|
66
|
+
const origin = options.origin === undefined ? productRoot(fileURLToPath(import.meta.url)) : options.origin;
|
|
67
|
+
if (!origin || productIdentity(origin)?.version !== VERSION)
|
|
68
|
+
throw new PackageError('development');
|
|
69
|
+
const npm = options.npm ?? new Npm(process.env, undefined, undefined, controller.signal), layout = await npm.layout(flags.prefix);
|
|
70
|
+
const before = productIdentity(layout.root, layout.prefix), action = entryAction(before, VERSION);
|
|
71
|
+
if (within(configDir, layout.root))
|
|
72
|
+
throw new PackageError('prefix');
|
|
73
|
+
if (action === 'version_conflict') {
|
|
74
|
+
stdout(JSON.stringify({ installed: before.version, target: VERSION, prefix: layout.prefix }, null, 2) + '\n');
|
|
75
|
+
throw new PackageError('version_conflict');
|
|
76
|
+
}
|
|
77
|
+
const pathEntry = which('claude-statusline');
|
|
78
|
+
const previous = previousBinding(configDir, createStorage());
|
|
79
|
+
const priorRoot = previous?.args.length === 1 ? productRoot(previous.args[0]) : null;
|
|
80
|
+
const inferredPrefix = (root) => dirname(dirname(dirname(process.platform === 'win32' ? root : dirname(root))));
|
|
81
|
+
for (const root of [origin, priorRoot])
|
|
82
|
+
if (!flags.prefix && root && !within(root, layout.cache)) {
|
|
83
|
+
const prefix = inferredPrefix(root), expected = join(prefix, process.platform === 'win32' ? 'node_modules' : 'lib/node_modules', PACKAGE_NAME);
|
|
84
|
+
if (root === expected && root !== layout.root)
|
|
85
|
+
throw new PackageError('prefix_ambiguous');
|
|
86
|
+
}
|
|
87
|
+
if (!flags.prefix && pathEntry && !sameLaunchEntry(pathEntry, { executable: process.execPath, args: [join(layout.root, 'node_modules/@fbincon/statusline-cli/dist/src/entry.js')] }))
|
|
88
|
+
throw new PackageError('prefix_ambiguous');
|
|
89
|
+
if (fs.existsSync(pendingPath(layout.prefix)))
|
|
90
|
+
throw new PackageError('pending');
|
|
91
|
+
if (!before)
|
|
92
|
+
writablePrefix(layout.prefix);
|
|
93
|
+
stdout(t('package.review', language, { action: t('package.action_' + action, language), name: PACKAGE_NAME, version: VERSION, prefix: layout.prefix, node: process.execPath, npm: layout.npmVersion, npm_entry: npm.entry, entry: join(layout.root, 'node_modules/@fbincon/statusline-cli/dist/src/entry.js'), config_dir: configDir, registry: layout.registry }) + '\n');
|
|
94
|
+
if (flags.dryRun)
|
|
95
|
+
return 0;
|
|
96
|
+
const approved = await (options.confirm?.() ?? confirmPackage(language, stdout, controller.signal));
|
|
97
|
+
if (controller.signal.aborted)
|
|
98
|
+
throw new PackageError('interrupted');
|
|
99
|
+
if (!approved) {
|
|
100
|
+
stdout(t('package.cancelled', language) + '\n');
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
const handoff = async (installed) => {
|
|
104
|
+
stdout(t('package.verified', language, { prefix: layout.prefix }) + '\n');
|
|
105
|
+
if (options.handoff)
|
|
106
|
+
return options.handoff(installed);
|
|
107
|
+
return new Promise((resolve, reject) => {
|
|
108
|
+
const child = spawn(process.execPath, [installed.entry, '--language', language, 'setup', '--config-dir', configDir], { stdio: 'inherit', shell: false });
|
|
109
|
+
const stop = () => child.kill('SIGTERM');
|
|
110
|
+
controller.signal.addEventListener('abort', stop, { once: true });
|
|
111
|
+
child.once('error', reject);
|
|
112
|
+
child.once('exit', code => { controller.signal.removeEventListener('abort', stop); resolve(code ?? 2); });
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
if (before) {
|
|
116
|
+
await npm.verify(before, layout.bin);
|
|
117
|
+
if (JSON.stringify(productIdentity(layout.root, layout.prefix)) !== JSON.stringify(before))
|
|
118
|
+
throw new PackageError('conflict');
|
|
119
|
+
stage = 'package_verified';
|
|
120
|
+
return await handoff(before);
|
|
121
|
+
}
|
|
122
|
+
createPrefix(layout.prefix);
|
|
123
|
+
release = lock(join(layout.prefix, '.claude-statusline-install.lock'), true);
|
|
124
|
+
if (JSON.stringify(productIdentity(layout.root, layout.prefix)) !== JSON.stringify(before) || fs.existsSync(pendingPath(layout.prefix)))
|
|
125
|
+
throw new PackageError('conflict');
|
|
126
|
+
const operation = startOperation(configDir, layout.prefix, VERSION, layout.registry, before);
|
|
127
|
+
npm.onProcess = observeOperation(operation);
|
|
128
|
+
try {
|
|
129
|
+
if (!before) {
|
|
130
|
+
stage = 'installing';
|
|
131
|
+
operation.stage = 'installing';
|
|
132
|
+
saveOperation(operation);
|
|
133
|
+
await npm.install(VERSION, layout);
|
|
134
|
+
}
|
|
135
|
+
const installed = productIdentity(layout.root, layout.prefix);
|
|
136
|
+
if (!installed || installed.version !== VERSION)
|
|
137
|
+
throw new PackageError('identity');
|
|
138
|
+
await npm.verify(installed, layout.bin);
|
|
139
|
+
operation.after = { ...installed, registry: layout.registry };
|
|
140
|
+
stage = 'package_verified';
|
|
141
|
+
operation.stage = 'package_verified';
|
|
142
|
+
saveOperation(operation);
|
|
143
|
+
recordInstallation(operation);
|
|
144
|
+
finishOperation(operation);
|
|
145
|
+
release();
|
|
146
|
+
release = undefined;
|
|
147
|
+
return await handoff(installed);
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
if (operation.stage !== 'complete') {
|
|
151
|
+
operation.stage = 'uncertain';
|
|
152
|
+
saveOperation(operation);
|
|
153
|
+
}
|
|
154
|
+
throw error;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
const reason = error instanceof PackageError ? error.code : 'io_error';
|
|
159
|
+
stderr(t('package.failure', language, { reason: t('package.reason_' + reason, language) }) + '\n');
|
|
160
|
+
if (stage !== 'review')
|
|
161
|
+
stderr(t('package.partial', language, { stage }) + '\n');
|
|
162
|
+
return reason === 'interrupted' ? 130 : 2;
|
|
163
|
+
}
|
|
164
|
+
finally {
|
|
165
|
+
release?.();
|
|
166
|
+
process.off('SIGINT', cancel);
|
|
167
|
+
process.off('SIGTERM', cancel);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=first-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-entry.js","sourceRoot":"","sources":["../../../src/management/first-entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,KAA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C;QAC7D,OAAO,MAAM,KAAK,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;YACO,CAAC;QACL,OAAO,EAAE,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
// This process loads only the target package's native adapter. Do not import
|
|
10
|
+
// the transaction runner's platform modules here (Windows cannot unload Koffi).
|
|
11
|
+
import * as fs from 'node:fs';
|
|
12
|
+
import { join } from 'node:path';
|
|
13
|
+
import { pathToFileURL } from 'node:url';
|
|
14
|
+
import { createHash } from 'node:crypto';
|
|
15
|
+
const [requestPath, receipt] = process.argv.slice(2);
|
|
16
|
+
const request = JSON.parse(fs.readFileSync(requestPath, 'utf8'));
|
|
17
|
+
const load = (path) => import(__rewriteRelativeImportExtension(pathToFileURL(join(request.root, 'node_modules/@fbincon/statusline-cli/dist/src', path + '.js')).href));
|
|
18
|
+
try {
|
|
19
|
+
const [{ install, installContext }, { doctor }, { safeTarget }] = await Promise.all([load('integration/install'), load('integration/doctor'), load('integration/paths')]);
|
|
20
|
+
const guard = () => {
|
|
21
|
+
for (const [name, expected] of Object.entries(request.hashes)) {
|
|
22
|
+
const path = join(request.configDir, name);
|
|
23
|
+
safeTarget(request.configDir, path);
|
|
24
|
+
let hash = null;
|
|
25
|
+
try {
|
|
26
|
+
const stat = fs.lstatSync(path);
|
|
27
|
+
if (!stat.isFile() || stat.size > 32 * 1024 * 1024)
|
|
28
|
+
throw new Error('Invalid configuration file');
|
|
29
|
+
hash = createHash('sha256').update(fs.readFileSync(path)).digest('hex');
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (error.code !== 'ENOENT')
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
if (hash !== expected)
|
|
36
|
+
throw new Error('Configuration changed after review');
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
guard();
|
|
40
|
+
const context = installContext(request.configDir, { executable: process.execPath, args: [request.entry] }, request.host);
|
|
41
|
+
const result = install(context, { dryRun: request.dryRun, beforeCommit: guard });
|
|
42
|
+
const diagnostics = request.dryRun ? [] : doctor(context);
|
|
43
|
+
const valid = !result.failed && !diagnostics.some((row) => row.level === 'ERROR');
|
|
44
|
+
fs.writeFileSync(receipt, JSON.stringify({ valid, result, diagnostics }) + '\n', { mode: 0o600 });
|
|
45
|
+
process.exitCode = valid ? 0 : 2;
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
fs.writeFileSync(receipt, JSON.stringify({ valid: false, error: 'integration_failed' }) + '\n', { mode: 0o600 });
|
|
49
|
+
process.exitCode = 2;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=integration-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-runner.js","sourceRoot":"","sources":["../../../src/management/integration-runner.ts"],"names":[],"mappings":";;;;;;;;AAAA,6EAA6E;AAC7E,gFAAgF;AAChF,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW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E,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACnG,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC;AACD,MAAM,CAAC;IACH,EAAE,CAAC,aAAa,CAAC,OAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAClH,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type PackageIdentity } from '@fbincon/statusline-core/management/package';
|
|
2
|
+
import { type ConfigHashes } from './configuration.js';
|
|
3
|
+
export declare function refreshIntegration(root: string, identity: PackageIdentity, configDir: string, host: readonly number[] | null, hashes: ConfigHashes, workspace: string, dryRun: boolean, environment: NodeJS.ProcessEnv, signal?: AbortSignal, onProcess?: (pid: number | null) => void): Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { randomUUID } from 'node:crypto';
|
|
5
|
+
import { runSourceProcess } from '@fbincon/statusline-platform/source-process';
|
|
6
|
+
import { removeTree } from '@fbincon/statusline-platform/remove-tree';
|
|
7
|
+
import { PackageError } from '@fbincon/statusline-core/management/package';
|
|
8
|
+
export async function refreshIntegration(root, identity, configDir, host, hashes, workspace, dryRun, environment, signal, onProcess) {
|
|
9
|
+
const id = randomUUID(), request = join(workspace, id + '-request.json'), receipt = join(workspace, id + '-result.json');
|
|
10
|
+
fs.writeFileSync(request, JSON.stringify({ root, entry: identity.entry, configDir, host, hashes, dryRun }), { mode: 0o600 });
|
|
11
|
+
try {
|
|
12
|
+
const result = await runSourceProcess({ executable: process.execPath, args: [fileURLToPath(new URL('./integration-runner.js', import.meta.url)), request, receipt], cwd: workspace, input: '', timeoutMs: 180000, environment, signal, onProcess });
|
|
13
|
+
if (result.reason === 'cancelled')
|
|
14
|
+
throw new PackageError('interrupted');
|
|
15
|
+
if (result.reason !== 'completed' || !JSON.parse(fs.readFileSync(receipt, 'utf8')).valid)
|
|
16
|
+
throw new PackageError('integration_failed');
|
|
17
|
+
}
|
|
18
|
+
finally {
|
|
19
|
+
removeTree(request);
|
|
20
|
+
removeTree(receipt);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.js","sourceRoot":"","sources":["../../../src/management/integration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,YAAY,EAAwB,MAAM,6CAA6C,CAAC;AAEjG,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAY,EAAE,QAAyB,EAAE,SAAiB,EAAE,IAA8B,EAAE,MAAoB,EAAE,SAAiB,EAAE,MAAe,EAAE,WAA8B,EAAE,MAAoB,EAAE,SAAwC;IACzR,MAAM,EAAE,GAAG,UAAU,EAAE,EAAE,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,EAAE,GAAG,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,EAAE,GAAG,cAAc,CAAC,CAAC;IACzH,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7H,IAAI,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,yBAAyB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;QACpP,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW;YAC7B,MAAM,IAAI,YAAY,CAAC,aAAa,CAAC,CAAC;QAC1C,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK;YACpF,MAAM,IAAI,YAAY,CAAC,oBAAoB,CAAC,CAAC;IACrD,CAAC;YACO,CAAC;QACL,UAAU,CAAC,OAAO,CAAC,CAAC;QACpB,UAAU,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type Language } from '@fbincon/statusline-core/i18n/messages';
|
|
2
|
+
import type { ManagementOptions } from './arguments.js';
|
|
3
|
+
export declare function restoreConfiguration(flags: ManagementOptions, configDir: string, prefix: string, language: Language, stdout: (value: string) => void, confirm?: () => Promise<boolean>, signal?: AbortSignal): Promise<number>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { join, dirname } from 'node:path';
|
|
2
|
+
import { PackageError } from '@fbincon/statusline-core/management/package';
|
|
3
|
+
import { compatibility } from '@fbincon/statusline-core/management/compatibility';
|
|
4
|
+
import { readOperation, operationPath } from './store.js';
|
|
5
|
+
import { configurationBytes, configurationHashes, assertConfiguration, configurationCompatibility, readSnapshot } from './configuration.js';
|
|
6
|
+
import { assertClear } from '../recovery/journal.js';
|
|
7
|
+
import { commit } from '../recovery/files.js';
|
|
8
|
+
import { createStorage, artifact, jsonBytes, readSettings } from '../config/storage.js';
|
|
9
|
+
import { validateDisplay, defaultDisplay } from '@fbincon/statusline-core/config/display';
|
|
10
|
+
import { validateProfiles, emptyProfiles } from '@fbincon/statusline-core/config/profiles';
|
|
11
|
+
import { readJson } from '@fbincon/statusline-core/json-read';
|
|
12
|
+
import { decodeUtf8 } from '@fbincon/statusline-platform/utf8';
|
|
13
|
+
import { ConfigurationService } from '../config/service.js';
|
|
14
|
+
import { profileRowsSettings } from '../config/profiles.js';
|
|
15
|
+
import { previousBinding } from '../integration/ownership.js';
|
|
16
|
+
import { detectClaudeVersion } from '@fbincon/statusline-platform/commands';
|
|
17
|
+
import { t } from '@fbincon/statusline-core/i18n/messages';
|
|
18
|
+
import { confirmPackage } from './first-entry.js';
|
|
19
|
+
import { equalSettings } from '@fbincon/statusline-core/json-equality';
|
|
20
|
+
export async function restoreConfiguration(flags, configDir, prefix, language, stdout, confirm, signal) {
|
|
21
|
+
const operation = readOperation(configDir, prefix, flags.restoreConfig), current = configurationBytes(configDir), hashes = configurationHashes(current);
|
|
22
|
+
if (!operation.snapshot || !operation.before)
|
|
23
|
+
throw new PackageError('backup');
|
|
24
|
+
const backup = readSnapshot(configDir, dirname(operationPath(operation)), operation.snapshot);
|
|
25
|
+
const declared = compatibility(operation.beforeCompatibility, operation.before.version);
|
|
26
|
+
if (configurationCompatibility(backup, declared).length)
|
|
27
|
+
throw new PackageError('backup');
|
|
28
|
+
const names = ['claude-statusline.json', 'claude-statusline-profiles.json'];
|
|
29
|
+
const proposed = { ...current, ...Object.fromEntries(names.map(name => [name, backup[name] ?? null])) };
|
|
30
|
+
// Product preferences and execution grants always remain current. The target
|
|
31
|
+
// rollback will recheck all of them before replacing the package.
|
|
32
|
+
const display = backup[names[0]] ? validateDisplay(readJson(decodeUtf8(backup[names[0]]))) : defaultDisplay();
|
|
33
|
+
const profiles = backup[names[1]] ? validateProfiles(readJson(decodeUtf8(backup[names[1]]))) : emptyProfiles();
|
|
34
|
+
const io = createStorage(), binding = previousBinding(configDir, io);
|
|
35
|
+
const changes = names.filter(name => current[name] === null ? proposed[name] !== null : proposed[name] === null || !current[name].equals(proposed[name])).map(name => ({ ...artifact(join(configDir, name), current[name] ?? null), desired: proposed[name] ?? null }));
|
|
36
|
+
if (binding) {
|
|
37
|
+
const service = new ConfigurationService({ configDir, launch: binding, hostVersion: detectClaudeVersion }, io), [settings, raw] = readSettings(configDir, io);
|
|
38
|
+
const updated = profileRowsSettings(service, settings, display, profiles);
|
|
39
|
+
if (!equalSettings(settings, updated))
|
|
40
|
+
changes.push({ ...artifact(join(configDir, 'settings.json'), raw), desired: jsonBytes(updated) });
|
|
41
|
+
}
|
|
42
|
+
const review = { schema_version: 1, action: 'restore-config', backup_id: operation.id, source_version: operation.before.version, prefix, files: changes.map(change => ({ path: change.path, current: hashes[change.name] ?? null, backup: operation.snapshot[change.name] ?? null })), preserved: ['source_authorization', 'runtime_preferences', 'editor_preferences', 'unrelated_claude_settings'] };
|
|
43
|
+
if (!flags.json)
|
|
44
|
+
stdout(t('management.restore_review', language) + '\n');
|
|
45
|
+
stdout(JSON.stringify(review, null, 2) + '\n');
|
|
46
|
+
if (flags.dryRun)
|
|
47
|
+
return 0;
|
|
48
|
+
if (!flags.yes && !await (confirm?.() ?? confirmPackage(language, stdout, signal)))
|
|
49
|
+
return 0;
|
|
50
|
+
if (signal?.aborted)
|
|
51
|
+
throw new PackageError('interrupted');
|
|
52
|
+
const backupDir = io.lock(configDir, () => {
|
|
53
|
+
assertClear(configDir);
|
|
54
|
+
assertConfiguration(configDir, hashes);
|
|
55
|
+
// Verify the immutable source once more while holding the revision lock.
|
|
56
|
+
readSnapshot(configDir, dirname(operationPath(operation)), operation.snapshot);
|
|
57
|
+
return commit(configDir, 'package-config-restore', changes, io);
|
|
58
|
+
});
|
|
59
|
+
stdout(t('management.restored', language, { backup: backupDir ?? '-' }) + '\n');
|
|
60
|
+
return 0;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=restore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restore.js","sourceRoot":"","sources":["../../../src/management/restore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC5I,OAAO,EAAe,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EA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AM,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC/C,IAAI,KAAK,CAAC,MAAM;QACZ,OAAO,CAAC,CAAC;IACb,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,IAAI,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9E,OAAO,CAAC,CAAC;IACb,IAAI,MAAM,EAAE,OAAO;QACf,MAAM,IAAI,YAAY,CAAC,aAAa,CAAC,CAAC;IAC1C,MAAM,SAAS,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE;QACtC,WAAW,CAAC,SAAS,CAAC,CAAC;QACvB,mBAAmB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QACvC,yEAAyE;QACzE,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,QAAS,CAAC,CAAC;QAChF,OAAO,MAAM,CAAC,SAAS,EAAE,wBAAwB,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,CAAC,CAAC,qBAAqB,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,SAAS,IAAI,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IAChF,OAAO,CAAC,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Npm } from '@fbincon/statusline-platform/npm';
|
|
2
|
+
import { type ManagementOptions } from './arguments.js';
|
|
3
|
+
import { type PackageOperation } from './store.js';
|
|
4
|
+
import { refreshIntegration } from './integration.js';
|
|
5
|
+
export interface ManagementEnvironment {
|
|
6
|
+
origin: string;
|
|
7
|
+
stdout: (text: string) => void;
|
|
8
|
+
stderr: (text: string) => void;
|
|
9
|
+
environment?: NodeJS.ProcessEnv;
|
|
10
|
+
tty?: boolean;
|
|
11
|
+
npm?: Npm;
|
|
12
|
+
confirm?: () => Promise<boolean>;
|
|
13
|
+
host?: () => readonly number[] | null;
|
|
14
|
+
integrate?: typeof refreshIntegration;
|
|
15
|
+
checkpoint?: (stage: string, operation: PackageOperation) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function mutationAuthorized(flags: ManagementOptions, tty: boolean): void;
|
|
18
|
+
export declare function manage(argv: readonly string[], options: ManagementEnvironment): Promise<number>;
|