bkper 5.0.0 → 5.2.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 +16 -0
- package/lib/agent/extensions/bkper-ai-provider.d.ts.map +1 -1
- package/lib/agent/extensions/bkper-ai-provider.js +47 -16
- package/lib/agent/extensions/bkper-ai-provider.js.map +1 -1
- package/lib/agent/extensions/builtins.d.ts.map +1 -1
- package/lib/agent/extensions/builtins.js +10 -2
- package/lib/agent/extensions/builtins.js.map +1 -1
- package/lib/agent/extensions/startup-logo.d.ts +9 -0
- package/lib/agent/extensions/startup-logo.d.ts.map +1 -0
- package/lib/agent/extensions/startup-logo.js +96 -0
- package/lib/agent/extensions/startup-logo.js.map +1 -0
- package/lib/agent/extensions/startup.d.ts.map +1 -1
- package/lib/agent/extensions/startup.js +63 -33
- package/lib/agent/extensions/startup.js.map +1 -1
- package/lib/agent/interactive/prompt-history-store.d.ts +1 -0
- package/lib/agent/interactive/prompt-history-store.d.ts.map +1 -1
- package/lib/agent/interactive/prompt-history-store.js +19 -5
- package/lib/agent/interactive/prompt-history-store.js.map +1 -1
- package/lib/agent/interactive/run-agent-mode.d.ts.map +1 -1
- package/lib/agent/interactive/run-agent-mode.js +5 -2
- package/lib/agent/interactive/run-agent-mode.js.map +1 -1
- package/lib/agent/interactive/settings.d.ts +26 -4
- package/lib/agent/interactive/settings.d.ts.map +1 -1
- package/lib/agent/interactive/settings.js +106 -16
- package/lib/agent/interactive/settings.js.map +1 -1
- package/lib/agent/interactive/themes.d.ts +13 -0
- package/lib/agent/interactive/themes.d.ts.map +1 -0
- package/lib/agent/interactive/themes.js +36 -0
- package/lib/agent/interactive/themes.js.map +1 -0
- package/lib/agent/startup-maintenance.d.ts +7 -4
- package/lib/agent/startup-maintenance.d.ts.map +1 -1
- package/lib/agent/startup-maintenance.js +13 -29
- package/lib/agent/startup-maintenance.js.map +1 -1
- package/lib/agent/system-prompt.d.ts.map +1 -1
- package/lib/agent/system-prompt.js +19 -7
- package/lib/agent/system-prompt.js.map +1 -1
- package/lib/agent/themes/bkper-dark.json +80 -0
- package/lib/agent/themes/bkper-light.json +80 -0
- package/lib/cli.js +6 -2
- package/lib/cli.js.map +1 -1
- package/lib/commands/agent-command.d.ts.map +1 -1
- package/lib/commands/agent-command.js +2 -1
- package/lib/commands/agent-command.js.map +1 -1
- package/lib/commands/upgrade.d.ts.map +1 -1
- package/lib/commands/upgrade.js +2 -3
- package/lib/commands/upgrade.js.map +1 -1
- package/lib/docs/ai/decision-models.md +316 -0
- package/lib/docs/apps/ai.md +120 -88
- package/lib/docs/apps/event-handlers.md +12 -0
- package/lib/docs/apps/overview.md +1 -1
- package/lib/docs/cli/app-management.md +1 -0
- package/lib/docs/index.md +2 -1
- package/lib/docs/sdk/bkper-api-types.md +4 -2
- package/lib/docs/sdk/bkper-js.md +1 -0
- package/lib/upgrade/index.d.ts +5 -4
- package/lib/upgrade/index.d.ts.map +1 -1
- package/lib/upgrade/index.js +3 -2
- package/lib/upgrade/index.js.map +1 -1
- package/lib/upgrade/installation.d.ts +54 -20
- package/lib/upgrade/installation.d.ts.map +1 -1
- package/lib/upgrade/installation.js +222 -122
- package/lib/upgrade/installation.js.map +1 -1
- package/lib/upgrade/update-check.d.ts +69 -0
- package/lib/upgrade/update-check.d.ts.map +1 -0
- package/lib/upgrade/update-check.js +253 -0
- package/lib/upgrade/update-check.js.map +1 -0
- package/lib/upgrade/update-worker.d.ts +2 -0
- package/lib/upgrade/update-worker.d.ts.map +1 -0
- package/lib/upgrade/update-worker.js +6 -0
- package/lib/upgrade/update-worker.js.map +1 -0
- package/lib/upgrade/upgrade.d.ts +11 -28
- package/lib/upgrade/upgrade.d.ts.map +1 -1
- package/lib/upgrade/upgrade.js +49 -96
- package/lib/upgrade/upgrade.js.map +1 -1
- package/package.json +6 -4
|
@@ -7,127 +7,266 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { execSync } from 'child_process';
|
|
11
|
+
import { accessSync, constants, existsSync, readFileSync, realpathSync } from 'fs';
|
|
11
12
|
import { createRequire } from 'module';
|
|
13
|
+
import os from 'os';
|
|
14
|
+
import path from 'path';
|
|
15
|
+
import { fileURLToPath } from 'url';
|
|
12
16
|
const require = createRequire(import.meta.url);
|
|
13
17
|
const pkg = require('../../package.json');
|
|
14
18
|
/** Current installed version of the CLI. */
|
|
15
19
|
export const VERSION = pkg.version;
|
|
16
20
|
/** Package name on npm. */
|
|
17
21
|
const PACKAGE_NAME = 'bkper';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
22
|
+
/** Directory of the running bkper package (the folder holding its package.json). */
|
|
23
|
+
export const PACKAGE_DIR = fileURLToPath(new URL('../../', import.meta.url)).replace(/[\\/]$/, '');
|
|
24
|
+
export function getRuntimeLocation() {
|
|
25
|
+
return {
|
|
26
|
+
packageDir: PACKAGE_DIR,
|
|
27
|
+
entrypoint: process.argv[1],
|
|
28
|
+
execPath: process.execPath,
|
|
29
|
+
isBunRuntime: !!process.versions.bun,
|
|
30
|
+
platform: process.platform,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function readCommandOutput(command) {
|
|
34
|
+
try {
|
|
35
|
+
const output = execSync(command, {
|
|
36
|
+
encoding: 'utf-8',
|
|
37
|
+
timeout: 10000,
|
|
38
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
39
|
+
windowsHide: true,
|
|
40
|
+
}).trim();
|
|
41
|
+
return output || undefined;
|
|
42
|
+
}
|
|
43
|
+
catch (_a) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function isWritable(dir) {
|
|
48
|
+
try {
|
|
49
|
+
accessSync(dir, constants.W_OK);
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
catch (_a) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
40
55
|
}
|
|
41
|
-
function
|
|
42
|
-
return
|
|
56
|
+
function getDefaultSelfUpdateEnvironment() {
|
|
57
|
+
return { homedir: os.homedir(), readCommandOutput, isWritable };
|
|
43
58
|
}
|
|
44
|
-
function
|
|
45
|
-
return
|
|
46
|
-
{ method: 'bun', command: 'bun pm ls -g' },
|
|
47
|
-
{ method: 'npm', command: `npm list -g ${PACKAGE_NAME} --depth=0` },
|
|
48
|
-
{ method: 'yarn', command: 'yarn global list --depth=0' },
|
|
49
|
-
];
|
|
59
|
+
function pathApi(platform) {
|
|
60
|
+
return platform === 'win32' ? path.win32 : path.posix;
|
|
50
61
|
}
|
|
51
62
|
/**
|
|
52
|
-
* Detects
|
|
53
|
-
*
|
|
63
|
+
* Detects the package manager from the location of the running code
|
|
64
|
+
* (same rules as Pi's detectInstallMethod).
|
|
54
65
|
*/
|
|
55
|
-
export function
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
66
|
+
export function detectInstallMethod(location = getRuntimeLocation()) {
|
|
67
|
+
const resolved = `${location.packageDir}/\0${location.execPath}`
|
|
68
|
+
.toLowerCase()
|
|
69
|
+
.replace(/\\/g, '/');
|
|
70
|
+
if (resolved.includes('/pnpm/') || resolved.includes('/.pnpm/')) {
|
|
71
|
+
return 'pnpm';
|
|
72
|
+
}
|
|
73
|
+
if (resolved.includes('/yarn/') || resolved.includes('/.yarn/')) {
|
|
74
|
+
return 'yarn';
|
|
75
|
+
}
|
|
76
|
+
if (location.isBunRuntime || resolved.includes('/install/global/node_modules/')) {
|
|
77
|
+
return 'bun';
|
|
78
|
+
}
|
|
79
|
+
if (resolved.includes('/npm/') || resolved.includes('/node_modules/')) {
|
|
80
|
+
return 'npm';
|
|
71
81
|
}
|
|
72
82
|
return 'unknown';
|
|
73
83
|
}
|
|
74
84
|
/**
|
|
75
|
-
*
|
|
85
|
+
* Infers the npm prefix from a `<prefix>/lib/node_modules/bkper` layout.
|
|
86
|
+
* Windows prefixes look like project installs, so they are never inferred.
|
|
76
87
|
*/
|
|
77
|
-
export function
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
88
|
+
export function inferNpmPrefix(packageDir, platform) {
|
|
89
|
+
if (platform === 'win32') {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
const p = pathApi(platform);
|
|
93
|
+
const root = p.dirname(packageDir);
|
|
94
|
+
if (p.basename(root) !== 'node_modules') {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
const lib = p.dirname(root);
|
|
98
|
+
return p.basename(lib) === 'lib' ? p.dirname(lib) : undefined;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Returns the shell command that installs a version with a package manager.
|
|
102
|
+
*/
|
|
103
|
+
export function getInstallCommand(method, version, npmPrefix) {
|
|
104
|
+
const spec = `${PACKAGE_NAME}@${version}`;
|
|
105
|
+
switch (method) {
|
|
106
|
+
case 'npm':
|
|
107
|
+
return npmPrefix
|
|
108
|
+
? `npm --prefix "${npmPrefix}" install -g ${spec}`
|
|
109
|
+
: `npm install -g ${spec}`;
|
|
110
|
+
case 'pnpm':
|
|
111
|
+
return `pnpm add -g ${spec}`;
|
|
112
|
+
case 'yarn':
|
|
113
|
+
return `yarn global add ${spec}`;
|
|
114
|
+
case 'bun':
|
|
115
|
+
return `bun add -g ${spec}`;
|
|
116
|
+
default:
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function getGlobalRoots(method, location, environment) {
|
|
121
|
+
switch (method) {
|
|
122
|
+
case 'npm': {
|
|
123
|
+
const prefix = inferNpmPrefix(location.packageDir, location.platform);
|
|
124
|
+
const roots = [environment.readCommandOutput('npm root -g')];
|
|
125
|
+
if (prefix) {
|
|
126
|
+
roots.push(path.join(prefix, 'lib', 'node_modules'));
|
|
85
127
|
}
|
|
86
|
-
|
|
87
|
-
|
|
128
|
+
return roots.filter((root) => !!root);
|
|
129
|
+
}
|
|
130
|
+
case 'pnpm': {
|
|
131
|
+
const root = environment.readCommandOutput('pnpm root -g');
|
|
132
|
+
return root ? [root, path.dirname(root)] : [];
|
|
133
|
+
}
|
|
134
|
+
case 'yarn': {
|
|
135
|
+
const dir = environment.readCommandOutput('yarn global dir');
|
|
136
|
+
return dir ? [dir, path.join(dir, 'node_modules')] : [];
|
|
137
|
+
}
|
|
138
|
+
case 'bun': {
|
|
139
|
+
const roots = [path.join(environment.homedir, '.bun', 'install', 'global', 'node_modules')];
|
|
140
|
+
const bunBin = environment.readCommandOutput('bun pm bin -g');
|
|
141
|
+
if (bunBin) {
|
|
142
|
+
roots.push(path.join(path.dirname(bunBin), 'install', 'global', 'node_modules'));
|
|
88
143
|
}
|
|
144
|
+
return roots;
|
|
89
145
|
}
|
|
90
|
-
|
|
91
|
-
|
|
146
|
+
default:
|
|
147
|
+
return [];
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function getComparablePaths(target, platform) {
|
|
151
|
+
const resolved = path.resolve(target);
|
|
152
|
+
if (!existsSync(resolved)) {
|
|
153
|
+
return [];
|
|
154
|
+
}
|
|
155
|
+
const candidates = [resolved];
|
|
156
|
+
try {
|
|
157
|
+
candidates.push(realpathSync(resolved));
|
|
158
|
+
}
|
|
159
|
+
catch (_a) {
|
|
160
|
+
// Keep the unresolved path only
|
|
161
|
+
}
|
|
162
|
+
return [...new Set(candidates.map(c => (platform === 'win32' ? c.toLowerCase() : c)))];
|
|
163
|
+
}
|
|
164
|
+
function getEntrypointPackageDir(entrypoint) {
|
|
165
|
+
if (!entrypoint) {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
let dir = path.dirname(path.resolve(entrypoint));
|
|
169
|
+
while (dir !== path.dirname(dir)) {
|
|
170
|
+
if (existsSync(path.join(dir, 'package.json'))) {
|
|
171
|
+
return dir;
|
|
172
|
+
}
|
|
173
|
+
dir = path.dirname(dir);
|
|
174
|
+
}
|
|
175
|
+
return undefined;
|
|
92
176
|
}
|
|
93
177
|
/**
|
|
94
|
-
*
|
|
178
|
+
* Finds the global root holding the running package, if any, and returns
|
|
179
|
+
* the package.json reached through it (not the symlink-resolved store path).
|
|
95
180
|
*/
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return
|
|
181
|
+
function findManagedPackageJson(roots, location) {
|
|
182
|
+
const packageDirs = [location.packageDir, getEntrypointPackageDir(location.entrypoint)]
|
|
183
|
+
.filter((dir) => !!dir)
|
|
184
|
+
.flatMap(dir => getComparablePaths(dir, location.platform));
|
|
185
|
+
const containingRoots = roots.filter(root => getComparablePaths(root, location.platform).some(normalizedRoot => {
|
|
186
|
+
const prefix = normalizedRoot.endsWith(path.sep)
|
|
187
|
+
? normalizedRoot
|
|
188
|
+
: `${normalizedRoot}${path.sep}`;
|
|
189
|
+
return packageDirs.some(dir => dir.startsWith(prefix));
|
|
190
|
+
}));
|
|
191
|
+
if (containingRoots.length === 0) {
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
for (const root of containingRoots) {
|
|
195
|
+
const packageJsonPath = path.join(root, PACKAGE_NAME, 'package.json');
|
|
196
|
+
if (existsSync(packageJsonPath)) {
|
|
197
|
+
return packageJsonPath;
|
|
113
198
|
}
|
|
199
|
+
}
|
|
200
|
+
return path.join(location.packageDir, 'package.json');
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Decides whether the running copy can safely upgrade itself: it must be
|
|
204
|
+
* inside its package manager's global root and writable. Otherwise returns
|
|
205
|
+
* the manual instruction to show. Never suggests sudo.
|
|
206
|
+
*/
|
|
207
|
+
export function getSelfUpdatePlan(version, location = getRuntimeLocation(), environment = getDefaultSelfUpdateEnvironment()) {
|
|
208
|
+
const method = detectInstallMethod(location);
|
|
209
|
+
const packageDir = location.packageDir;
|
|
210
|
+
const npmPrefix = method === 'npm' ? inferNpmPrefix(packageDir, location.platform) : undefined;
|
|
211
|
+
const command = getInstallCommand(method, version, npmPrefix);
|
|
212
|
+
const manual = (instruction) => ({
|
|
213
|
+
kind: 'manual',
|
|
214
|
+
method,
|
|
215
|
+
packageDir,
|
|
216
|
+
instruction,
|
|
114
217
|
});
|
|
218
|
+
if (!command) {
|
|
219
|
+
return manual(`Update bkper with the package manager, wrapper, or source checkout that provides ${packageDir}.`);
|
|
220
|
+
}
|
|
221
|
+
if (location.platform === 'win32' && method !== 'npm' && method !== 'pnpm') {
|
|
222
|
+
return manual(`Automatic upgrade on Windows supports only npm and pnpm installs. Run: ${command}`);
|
|
223
|
+
}
|
|
224
|
+
const packageJsonPath = findManagedPackageJson(getGlobalRoots(method, location, environment), location);
|
|
225
|
+
if (!packageJsonPath) {
|
|
226
|
+
return manual(`bkper at ${packageDir} is not a global ${method} install. ` +
|
|
227
|
+
`Update it with the package manager, wrapper, or source checkout that provides it.`);
|
|
228
|
+
}
|
|
229
|
+
if (!environment.isWritable(packageDir) || !environment.isWritable(path.dirname(packageDir))) {
|
|
230
|
+
return manual(`The global ${method} install at ${packageDir} is not writable. ` +
|
|
231
|
+
`Update it yourself with: ${command}`);
|
|
232
|
+
}
|
|
233
|
+
return { kind: 'install', method, packageDir, command, packageJsonPath };
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Reads a package version from disk, bypassing the module cache.
|
|
237
|
+
*/
|
|
238
|
+
export function readInstalledVersion(packageJsonPath) {
|
|
239
|
+
try {
|
|
240
|
+
const data = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
241
|
+
return typeof data.version === 'string' ? data.version : undefined;
|
|
242
|
+
}
|
|
243
|
+
catch (_a) {
|
|
244
|
+
return undefined;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Runs an install command synchronously. BKPER_AUTOUPDATE_COMMAND replaces
|
|
249
|
+
* the command (for tests) but never the safety checks that lead here.
|
|
250
|
+
*/
|
|
251
|
+
export function runInstallCommand(command) {
|
|
252
|
+
const effectiveCommand = process.env.BKPER_AUTOUPDATE_COMMAND || command;
|
|
253
|
+
execSync(effectiveCommand, { stdio: 'pipe', timeout: 120000, windowsHide: true });
|
|
115
254
|
}
|
|
116
255
|
/**
|
|
117
256
|
* Fetches the latest published version from the npm registry.
|
|
118
257
|
* Returns null if the fetch fails.
|
|
119
258
|
*/
|
|
120
259
|
export function fetchLatestVersion() {
|
|
121
|
-
return __awaiter(this,
|
|
260
|
+
return __awaiter(this, arguments, void 0, function* (timeoutMs = 5000) {
|
|
122
261
|
var _a;
|
|
123
|
-
const latestVersionOverride =
|
|
262
|
+
const latestVersionOverride = process.env.BKPER_AUTOUPDATE_LATEST_VERSION;
|
|
124
263
|
if (latestVersionOverride) {
|
|
125
264
|
return latestVersionOverride;
|
|
126
265
|
}
|
|
127
266
|
try {
|
|
128
267
|
const response = yield fetch(`https://registry.npmjs.org/${PACKAGE_NAME}/latest`, {
|
|
129
268
|
headers: { Accept: 'application/json' },
|
|
130
|
-
signal: AbortSignal.timeout(
|
|
269
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
131
270
|
});
|
|
132
271
|
if (!response.ok)
|
|
133
272
|
return null;
|
|
@@ -139,43 +278,4 @@ export function fetchLatestVersion() {
|
|
|
139
278
|
}
|
|
140
279
|
});
|
|
141
280
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Returns the shell command to upgrade the CLI for a given install method and version.
|
|
144
|
-
*/
|
|
145
|
-
export function getUpgradeCommand(method, version) {
|
|
146
|
-
switch (method) {
|
|
147
|
-
case 'npm':
|
|
148
|
-
return `npm install -g ${PACKAGE_NAME}@${version}`;
|
|
149
|
-
case 'bun':
|
|
150
|
-
return `bun add -g ${PACKAGE_NAME}@${version}`;
|
|
151
|
-
case 'yarn':
|
|
152
|
-
return `yarn global add ${PACKAGE_NAME}@${version}`;
|
|
153
|
-
default:
|
|
154
|
-
return null;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Executes the upgrade to the specified version using the given install method.
|
|
159
|
-
* Throws if the upgrade command fails.
|
|
160
|
-
*/
|
|
161
|
-
export function executeUpgrade(method, version) {
|
|
162
|
-
const command = getUpgradeCommand(method, version);
|
|
163
|
-
if (!command) {
|
|
164
|
-
throw new Error(`Unable to auto-upgrade: unknown installation method. ` +
|
|
165
|
-
`Please upgrade manually: npm install -g ${PACKAGE_NAME}@${version}`);
|
|
166
|
-
}
|
|
167
|
-
execSync(command, { stdio: 'pipe', timeout: 60000, windowsHide: true });
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Starts the upgrade in a detached background process.
|
|
171
|
-
*/
|
|
172
|
-
export function startDetachedUpgrade(method, version, commandStarter = defaultDetachedCommandStarter) {
|
|
173
|
-
var _a;
|
|
174
|
-
const command = (_a = getUpgradeCommandOverride()) !== null && _a !== void 0 ? _a : getUpgradeCommand(method, version);
|
|
175
|
-
if (!command) {
|
|
176
|
-
throw new Error(`Unable to auto-upgrade: unknown installation method. ` +
|
|
177
|
-
`Please upgrade manually: npm install -g ${PACKAGE_NAME}@${version}`);
|
|
178
|
-
}
|
|
179
|
-
commandStarter(command);
|
|
180
|
-
}
|
|
181
281
|
//# sourceMappingURL=installation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installation.js","sourceRoot":"","sources":["../../src/upgrade/installation.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"installation.js","sourceRoot":"","sources":["../../src/upgrade/installation.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE1C,4CAA4C;AAC5C,MAAM,CAAC,MAAM,OAAO,GAAW,GAAG,CAAC,OAAO,CAAC;AAE3C,2BAA2B;AAC3B,MAAM,YAAY,GAAG,OAAO,CAAC;AAE7B,oFAAoF;AACpF,MAAM,CAAC,MAAM,WAAW,GAAW,aAAa,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CACxF,QAAQ,EACR,EAAE,CACL,CAAC;AAwCF,MAAM,UAAU,kBAAkB;IAC9B,OAAO;QACH,UAAU,EAAE,WAAW;QACvB,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3B,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,YA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;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC7C,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,OAAO,CAAC;IACzE,QAAQ,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;AACtF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAgB,kBAAkB;yDAAC,SAAS,GAAG,IAAI;;QACrD,MAAM,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC;QAC1E,IAAI,qBAAqB,EAAE,CAAC;YACxB,OAAO,qBAAqB,CAAC;QACjC,CAAC;QAED,IAAI,CAAC;YACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,8BAA8B,YAAY,SAAS,EAAE;gBAC9E,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;gBACvC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC;aACzC,CAAC,CAAC;YACH,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAAE,OAAO,IAAI,CAAC;YAC9B,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAyB,CAAC;YAC7D,OAAO,MAAA,IAAI,CAAC,OAAO,mCAAI,IAAI,CAAC;QAChC,CAAC;QAAC,WAAM,CAAC;YACL,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;CAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { SelfUpdatePlan } from './installation.js';
|
|
2
|
+
/** At most one npm check (and install attempt) per installed copy per day. */
|
|
3
|
+
export declare const CHECK_INTERVAL_MS: number;
|
|
4
|
+
export interface InstallRecord {
|
|
5
|
+
version: string;
|
|
6
|
+
status: 'installed' | 'manual' | 'failed';
|
|
7
|
+
instruction?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface UpdateCheckState {
|
|
10
|
+
lastAttemptedAt?: number;
|
|
11
|
+
latestVersion?: string;
|
|
12
|
+
install?: InstallRecord;
|
|
13
|
+
}
|
|
14
|
+
export type UpdateNotice = {
|
|
15
|
+
kind: 'installed';
|
|
16
|
+
current: string;
|
|
17
|
+
latest: string;
|
|
18
|
+
} | {
|
|
19
|
+
kind: 'manual';
|
|
20
|
+
current: string;
|
|
21
|
+
latest: string;
|
|
22
|
+
instruction: string;
|
|
23
|
+
};
|
|
24
|
+
type Env = Record<string, string | undefined>;
|
|
25
|
+
/**
|
|
26
|
+
* Cache file for one installed copy. Copies (e.g. npm and bun) keep separate
|
|
27
|
+
* state so each one only ever updates itself.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getUpdateCachePath(packageDir?: string, configDir?: string): string;
|
|
30
|
+
export declare function isUpdateCheckDisabled(env?: Env): boolean;
|
|
31
|
+
export declare function readUpdateState(cachePath?: string): UpdateCheckState;
|
|
32
|
+
/** Writes the state atomically (temp file + rename). */
|
|
33
|
+
export declare function writeUpdateState(state: UpdateCheckState, cachePath?: string): boolean;
|
|
34
|
+
export interface StartUpdateCheckOptions {
|
|
35
|
+
cachePath?: string;
|
|
36
|
+
now?: number;
|
|
37
|
+
env?: Env;
|
|
38
|
+
spawnWorker?: () => void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Starts the detached update worker when the last attempt is older than a day.
|
|
42
|
+
* Never blocks the running command and never installs in this process.
|
|
43
|
+
*/
|
|
44
|
+
export declare function maybeStartUpdateCheck(options?: StartUpdateCheckOptions): boolean;
|
|
45
|
+
export interface UpdateWorkerDependencies {
|
|
46
|
+
cachePath: string;
|
|
47
|
+
version: string;
|
|
48
|
+
fetchLatestVersion: (timeoutMs: number) => Promise<string | null>;
|
|
49
|
+
getSelfUpdatePlan: (version: string) => SelfUpdatePlan;
|
|
50
|
+
runInstall: (command: string) => void;
|
|
51
|
+
readInstalledVersion: (packageJsonPath: string) => string | undefined;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Detached worker: checks npm and installs a newer version into the running
|
|
55
|
+
* copy only when that copy is a verified, writable global install.
|
|
56
|
+
*/
|
|
57
|
+
export declare function runUpdateWorker(deps?: UpdateWorkerDependencies): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Reads what the running copy should tell the user, based on the cache only.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getUpdateNotice(state: UpdateCheckState, currentVersion?: string): UpdateNotice | undefined;
|
|
62
|
+
export declare function formatUpdateNotice(notice: UpdateNotice): string;
|
|
63
|
+
/**
|
|
64
|
+
* Plain-command hook: prints the fallback warning when the copy cannot
|
|
65
|
+
* update itself, then starts the daily background check.
|
|
66
|
+
*/
|
|
67
|
+
export declare function runCommandUpdateCheck(writeStderr?: (message: string) => void): void;
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=update-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-check.d.ts","sourceRoot":"","sources":["../../src/upgrade/update-check.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,QAAsB,CAAC;AAKrD,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,aAAa,CAAC;CAC3B;AAED,MAAM,MAAM,YAAY,GAClB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,IAAI,EAAE,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