@vibesdotdev/plugins 0.0.0-stage → 1.0.0-rc.1
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/LICENSE +18 -0
- package/README.md +54 -2
- package/VIBES.md +165 -0
- package/dist/ai/index.d.ts +4 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +3 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/plugin.impl.cloud.d.ts +4 -0
- package/dist/ai/plugin.impl.cloud.d.ts.map +1 -0
- package/dist/ai/plugin.impl.cloud.js +32 -0
- package/dist/ai/plugin.impl.cloud.js.map +1 -0
- package/dist/ai/plugin.impl.consumer.d.ts +7 -0
- package/dist/ai/plugin.impl.consumer.d.ts.map +1 -0
- package/dist/ai/plugin.impl.consumer.js +222 -0
- package/dist/ai/plugin.impl.consumer.js.map +1 -0
- package/dist/auth/consumer.plugin.d.ts +3 -0
- package/dist/auth/consumer.plugin.d.ts.map +1 -0
- package/dist/auth/consumer.plugin.js +105 -0
- package/dist/auth/consumer.plugin.js.map +1 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +2 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/plugin.d.ts +4 -0
- package/dist/auth/plugin.d.ts.map +1 -0
- package/dist/auth/plugin.js +33 -0
- package/dist/auth/plugin.js.map +1 -0
- package/dist/automation/consumer.plugin.d.ts +3 -0
- package/dist/automation/consumer.plugin.d.ts.map +1 -0
- package/dist/automation/consumer.plugin.js +92 -0
- package/dist/automation/consumer.plugin.js.map +1 -0
- package/dist/automation/index.d.ts +2 -0
- package/dist/automation/index.d.ts.map +1 -0
- package/dist/automation/index.js +2 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/automation/plugin.d.ts +4 -0
- package/dist/automation/plugin.d.ts.map +1 -0
- package/dist/automation/plugin.js +30 -0
- package/dist/automation/plugin.js.map +1 -0
- package/dist/bun/host.d.ts +44 -0
- package/dist/bun/host.d.ts.map +1 -0
- package/dist/bun/host.js +71 -0
- package/dist/bun/host.js.map +1 -0
- package/dist/cli/child-failure.d.ts +37 -0
- package/dist/cli/child-failure.d.ts.map +1 -0
- package/dist/cli/child-failure.js +86 -0
- package/dist/cli/child-failure.js.map +1 -0
- package/dist/cli/context.d.ts +12 -0
- package/dist/cli/context.d.ts.map +1 -0
- package/dist/cli/context.js +11 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/execution.d.ts +10 -0
- package/dist/cli/execution.d.ts.map +1 -0
- package/dist/cli/execution.js +20 -0
- package/dist/cli/execution.js.map +1 -0
- package/dist/cli/failure-facts.d.ts +16 -0
- package/dist/cli/failure-facts.d.ts.map +1 -0
- package/dist/cli/failure-facts.js +39 -0
- package/dist/cli/failure-facts.js.map +1 -0
- package/dist/cli/package-manager.consumer.d.ts +106 -0
- package/dist/cli/package-manager.consumer.d.ts.map +1 -0
- package/dist/cli/package-manager.consumer.js +258 -0
- package/dist/cli/package-manager.consumer.js.map +1 -0
- package/dist/cli/plugin.d.ts +9 -0
- package/dist/cli/plugin.d.ts.map +1 -0
- package/dist/cli/plugin.js +34 -0
- package/dist/cli/plugin.js.map +1 -0
- package/dist/cli/plugins.add.cli-command.descriptor.d.ts +36 -0
- package/dist/cli/plugins.add.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/plugins.add.cli-command.descriptor.js +31 -0
- package/dist/cli/plugins.add.cli-command.descriptor.js.map +1 -0
- package/dist/cli/plugins.add.cli-command.impl.consumer.d.ts +63 -0
- package/dist/cli/plugins.add.cli-command.impl.consumer.d.ts.map +1 -0
- package/dist/cli/plugins.add.cli-command.impl.consumer.js +206 -0
- package/dist/cli/plugins.add.cli-command.impl.consumer.js.map +1 -0
- package/dist/cli/plugins.cli-group.descriptor.d.ts +4 -0
- package/dist/cli/plugins.cli-group.descriptor.d.ts.map +1 -0
- package/dist/cli/plugins.cli-group.descriptor.js +10 -0
- package/dist/cli/plugins.cli-group.descriptor.js.map +1 -0
- package/dist/cli/plugins.host.cli-command.descriptor.d.ts +31 -0
- package/dist/cli/plugins.host.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/plugins.host.cli-command.descriptor.js +37 -0
- package/dist/cli/plugins.host.cli-command.descriptor.js.map +1 -0
- package/dist/cli/plugins.host.cli-command.impl.consumer.d.ts +29 -0
- package/dist/cli/plugins.host.cli-command.impl.consumer.d.ts.map +1 -0
- package/dist/cli/plugins.host.cli-command.impl.consumer.js +109 -0
- package/dist/cli/plugins.host.cli-command.impl.consumer.js.map +1 -0
- package/dist/cli/plugins.link.cli-command.descriptor.d.ts +35 -0
- package/dist/cli/plugins.link.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/plugins.link.cli-command.descriptor.js +32 -0
- package/dist/cli/plugins.link.cli-command.descriptor.js.map +1 -0
- package/dist/cli/plugins.link.cli-command.impl.consumer.d.ts +31 -0
- package/dist/cli/plugins.link.cli-command.impl.consumer.d.ts.map +1 -0
- package/dist/cli/plugins.link.cli-command.impl.consumer.js +104 -0
- package/dist/cli/plugins.link.cli-command.impl.consumer.js.map +1 -0
- package/dist/cli/plugins.list.cli-command.descriptor.d.ts +26 -0
- package/dist/cli/plugins.list.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/plugins.list.cli-command.descriptor.js +22 -0
- package/dist/cli/plugins.list.cli-command.descriptor.js.map +1 -0
- package/dist/cli/plugins.list.cli-command.impl.consumer.d.ts +116 -0
- package/dist/cli/plugins.list.cli-command.impl.consumer.d.ts.map +1 -0
- package/dist/cli/plugins.list.cli-command.impl.consumer.js +343 -0
- package/dist/cli/plugins.list.cli-command.impl.consumer.js.map +1 -0
- package/dist/cli/plugins.remove.cli-command.descriptor.d.ts +31 -0
- package/dist/cli/plugins.remove.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/plugins.remove.cli-command.descriptor.js +26 -0
- package/dist/cli/plugins.remove.cli-command.descriptor.js.map +1 -0
- package/dist/cli/plugins.remove.cli-command.impl.consumer.d.ts +30 -0
- package/dist/cli/plugins.remove.cli-command.impl.consumer.d.ts.map +1 -0
- package/dist/cli/plugins.remove.cli-command.impl.consumer.js +80 -0
- package/dist/cli/plugins.remove.cli-command.impl.consumer.js.map +1 -0
- package/dist/cli/plugins.unlink.cli-command.descriptor.d.ts +31 -0
- package/dist/cli/plugins.unlink.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/plugins.unlink.cli-command.descriptor.js +21 -0
- package/dist/cli/plugins.unlink.cli-command.descriptor.js.map +1 -0
- package/dist/cli/plugins.unlink.cli-command.impl.consumer.d.ts +76 -0
- package/dist/cli/plugins.unlink.cli-command.impl.consumer.d.ts.map +1 -0
- package/dist/cli/plugins.unlink.cli-command.impl.consumer.js +190 -0
- package/dist/cli/plugins.unlink.cli-command.impl.consumer.js.map +1 -0
- package/dist/cli/registry-sign-in.consumer.d.ts +80 -0
- package/dist/cli/registry-sign-in.consumer.d.ts.map +1 -0
- package/dist/cli/registry-sign-in.consumer.js +199 -0
- package/dist/cli/registry-sign-in.consumer.js.map +1 -0
- package/dist/cli/roll.d.ts +230 -0
- package/dist/cli/roll.d.ts.map +1 -0
- package/dist/cli/roll.js +569 -0
- package/dist/cli/roll.js.map +1 -0
- package/dist/cli/schemas/context.d.ts +10 -0
- package/dist/cli/schemas/context.d.ts.map +1 -0
- package/dist/cli/schemas/context.js +3 -0
- package/dist/cli/schemas/context.js.map +1 -0
- package/dist/cli/schemas/scopes.d.ts +37 -0
- package/dist/cli/schemas/scopes.d.ts.map +1 -0
- package/dist/cli/schemas/scopes.js +11 -0
- package/dist/cli/schemas/scopes.js.map +1 -0
- package/dist/cli/schemas/unlink.d.ts +18 -0
- package/dist/cli/schemas/unlink.d.ts.map +1 -0
- package/dist/cli/schemas/unlink.js +3 -0
- package/dist/cli/schemas/unlink.js.map +1 -0
- package/dist/cli/schemas/update.d.ts +77 -0
- package/dist/cli/schemas/update.d.ts.map +1 -0
- package/dist/cli/schemas/update.js +3 -0
- package/dist/cli/schemas/update.js.map +1 -0
- package/dist/cli/scopes.d.ts +50 -0
- package/dist/cli/scopes.d.ts.map +1 -0
- package/dist/cli/scopes.js +90 -0
- package/dist/cli/scopes.js.map +1 -0
- package/dist/cli/seed.d.ts +232 -0
- package/dist/cli/seed.d.ts.map +1 -0
- package/dist/cli/seed.js +590 -0
- package/dist/cli/seed.js.map +1 -0
- package/dist/cli/self-update.d.ts +120 -0
- package/dist/cli/self-update.d.ts.map +1 -0
- package/dist/cli/self-update.js +274 -0
- package/dist/cli/self-update.js.map +1 -0
- package/dist/cli/update.cli-command.descriptor.d.ts +62 -0
- package/dist/cli/update.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/update.cli-command.descriptor.js +49 -0
- package/dist/cli/update.cli-command.descriptor.js.map +1 -0
- package/dist/cli/update.cli-command.impl.consumer.d.ts +178 -0
- package/dist/cli/update.cli-command.impl.consumer.d.ts.map +1 -0
- package/dist/cli/update.cli-command.impl.consumer.js +750 -0
- package/dist/cli/update.cli-command.impl.consumer.js.map +1 -0
- package/dist/comms/consumer.plugin.d.ts +3 -0
- package/dist/comms/consumer.plugin.d.ts.map +1 -0
- package/dist/comms/consumer.plugin.js +108 -0
- package/dist/comms/consumer.plugin.js.map +1 -0
- package/dist/comms/index.d.ts +2 -0
- package/dist/comms/index.d.ts.map +1 -0
- package/dist/comms/index.js +2 -0
- package/dist/comms/index.js.map +1 -0
- package/dist/comms/plugin.d.ts +4 -0
- package/dist/comms/plugin.d.ts.map +1 -0
- package/dist/comms/plugin.js +30 -0
- package/dist/comms/plugin.js.map +1 -0
- package/dist/consumer.d.ts +3 -0
- package/dist/consumer.d.ts.map +1 -0
- package/dist/consumer.js +3 -0
- package/dist/consumer.js.map +1 -0
- package/dist/consumer.plugin.d.ts +63 -0
- package/dist/consumer.plugin.d.ts.map +1 -0
- package/dist/consumer.plugin.js +89 -0
- package/dist/consumer.plugin.js.map +1 -0
- package/dist/core/consumer.plugin.d.ts +4 -0
- package/dist/core/consumer.plugin.d.ts.map +1 -0
- package/dist/core/consumer.plugin.js +364 -0
- package/dist/core/consumer.plugin.js.map +1 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +2 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/optional-member.d.ts +11 -0
- package/dist/core/optional-member.d.ts.map +1 -0
- package/dist/core/optional-member.js +68 -0
- package/dist/core/optional-member.js.map +1 -0
- package/dist/core/optional-plugin.d.ts +40 -0
- package/dist/core/optional-plugin.d.ts.map +1 -0
- package/dist/core/optional-plugin.js +107 -0
- package/dist/core/optional-plugin.js.map +1 -0
- package/dist/core/plugin.d.ts +10 -0
- package/dist/core/plugin.d.ts.map +1 -0
- package/dist/core/plugin.js +64 -0
- package/dist/core/plugin.js.map +1 -0
- package/dist/core/setup-requirements.descriptors.d.ts +7 -0
- package/dist/core/setup-requirements.descriptors.d.ts.map +1 -0
- package/dist/core/setup-requirements.descriptors.js +117 -0
- package/dist/core/setup-requirements.descriptors.js.map +1 -0
- package/dist/data/consumer.plugin.d.ts +3 -0
- package/dist/data/consumer.plugin.d.ts.map +1 -0
- package/dist/data/consumer.plugin.js +99 -0
- package/dist/data/consumer.plugin.js.map +1 -0
- package/dist/data/index.d.ts +2 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +2 -0
- package/dist/data/index.js.map +1 -0
- package/dist/data/plugin.d.ts +4 -0
- package/dist/data/plugin.d.ts.map +1 -0
- package/dist/data/plugin.js +37 -0
- package/dist/data/plugin.js.map +1 -0
- package/dist/devtools/consumer.plugin.d.ts +3 -0
- package/dist/devtools/consumer.plugin.d.ts.map +1 -0
- package/dist/devtools/consumer.plugin.js +323 -0
- package/dist/devtools/consumer.plugin.js.map +1 -0
- package/dist/devtools/index.d.ts +2 -0
- package/dist/devtools/index.d.ts.map +1 -0
- package/dist/devtools/index.js +2 -0
- package/dist/devtools/index.js.map +1 -0
- package/dist/devtools/plugin.d.ts +4 -0
- package/dist/devtools/plugin.d.ts.map +1 -0
- package/dist/devtools/plugin.js +34 -0
- package/dist/devtools/plugin.js.map +1 -0
- package/dist/filesystem/index.d.ts +2 -0
- package/dist/filesystem/index.d.ts.map +1 -0
- package/dist/filesystem/index.js +2 -0
- package/dist/filesystem/index.js.map +1 -0
- package/dist/filesystem/plugin.d.ts +4 -0
- package/dist/filesystem/plugin.d.ts.map +1 -0
- package/dist/filesystem/plugin.js +21 -0
- package/dist/filesystem/plugin.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +7 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +16 -0
- package/dist/plugin.js.map +1 -0
- package/dist/schemas/ai.d.ts +119 -0
- package/dist/schemas/ai.d.ts.map +1 -0
- package/dist/schemas/ai.js +84 -0
- package/dist/schemas/ai.js.map +1 -0
- package/dist/schemas/auth.d.ts +15 -0
- package/dist/schemas/auth.d.ts.map +1 -0
- package/dist/schemas/auth.js +19 -0
- package/dist/schemas/auth.js.map +1 -0
- package/dist/schemas/automation.d.ts +66 -0
- package/dist/schemas/automation.d.ts.map +1 -0
- package/dist/schemas/automation.js +36 -0
- package/dist/schemas/automation.js.map +1 -0
- package/dist/schemas/comms.d.ts +13 -0
- package/dist/schemas/comms.d.ts.map +1 -0
- package/dist/schemas/comms.js +27 -0
- package/dist/schemas/comms.js.map +1 -0
- package/dist/schemas/core.d.ts +102 -0
- package/dist/schemas/core.d.ts.map +1 -0
- package/dist/schemas/core.js +124 -0
- package/dist/schemas/core.js.map +1 -0
- package/dist/schemas/data.d.ts +13 -0
- package/dist/schemas/data.d.ts.map +1 -0
- package/dist/schemas/data.js +25 -0
- package/dist/schemas/data.js.map +1 -0
- package/dist/schemas/devtools.d.ts +33 -0
- package/dist/schemas/devtools.d.ts.map +1 -0
- package/dist/schemas/devtools.js +56 -0
- package/dist/schemas/devtools.js.map +1 -0
- package/dist/schemas/family.d.ts +11 -0
- package/dist/schemas/family.d.ts.map +1 -0
- package/dist/schemas/family.js +21 -0
- package/dist/schemas/family.js.map +1 -0
- package/dist/schemas/filesystem.d.ts +25 -0
- package/dist/schemas/filesystem.d.ts.map +1 -0
- package/dist/schemas/filesystem.js +24 -0
- package/dist/schemas/filesystem.js.map +1 -0
- package/dist/schemas/host.d.ts +10 -0
- package/dist/schemas/host.d.ts.map +1 -0
- package/dist/schemas/host.js +2 -0
- package/dist/schemas/host.js.map +1 -0
- package/dist/schemas/optional-member.d.ts +67 -0
- package/dist/schemas/optional-member.d.ts.map +1 -0
- package/dist/schemas/optional-member.js +31 -0
- package/dist/schemas/optional-member.js.map +1 -0
- package/dist/schemas/roll.d.ts +47 -0
- package/dist/schemas/roll.d.ts.map +1 -0
- package/dist/schemas/roll.js +18 -0
- package/dist/schemas/roll.js.map +1 -0
- package/dist/schemas/tui.d.ts +33 -0
- package/dist/schemas/tui.d.ts.map +1 -0
- package/dist/schemas/tui.js +95 -0
- package/dist/schemas/tui.js.map +1 -0
- package/dist/schemas/ui.d.ts +15 -0
- package/dist/schemas/ui.d.ts.map +1 -0
- package/dist/schemas/ui.js +45 -0
- package/dist/schemas/ui.js.map +1 -0
- package/dist/tui/code-sessions-tui-plugin-shim.d.ts +7 -0
- package/dist/tui/code-sessions-tui-plugin-shim.d.ts.map +1 -0
- package/dist/tui/code-sessions-tui-plugin-shim.js +2 -0
- package/dist/tui/code-sessions-tui-plugin-shim.js.map +1 -0
- package/dist/tui/index.d.ts +8 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +8 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/plugin.d.ts +53 -0
- package/dist/tui/plugin.d.ts.map +1 -0
- package/dist/tui/plugin.js +350 -0
- package/dist/tui/plugin.js.map +1 -0
- package/dist/ui/consumer.plugin.d.ts +3 -0
- package/dist/ui/consumer.plugin.d.ts.map +1 -0
- package/dist/ui/consumer.plugin.js +75 -0
- package/dist/ui/consumer.plugin.js.map +1 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +2 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/plugin.d.ts +4 -0
- package/dist/ui/plugin.d.ts.map +1 -0
- package/dist/ui/plugin.js +35 -0
- package/dist/ui/plugin.js.map +1 -0
- package/host-start.mjs +39 -0
- package/host.mjs +24 -0
- package/package.json +437 -4
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vibes update --self` — replace the executable, verified, in place.
|
|
3
|
+
*
|
|
4
|
+
* ### Ordering is a correctness property, not a preference (plan §5.1)
|
|
5
|
+
*
|
|
6
|
+
* SELF FIRST, then the graph, then ONE roll. The draft rolled bodies after the
|
|
7
|
+
* lock digest changed and replaced the binary afterwards, which re-stales
|
|
8
|
+
* every body it had just rolled: the executable freshness nerve fires on the
|
|
9
|
+
* new inode, so a body restarted before the swap is stale the moment the swap
|
|
10
|
+
* lands. Two rolls, one of them wasted, and a `pm status` Build column that
|
|
11
|
+
* reads `STALE` right after a successful update. `runSelfUpdate` therefore
|
|
12
|
+
* returns before any graph work and the caller performs exactly one census
|
|
13
|
+
* roll at the end.
|
|
14
|
+
*
|
|
15
|
+
* ### Install target
|
|
16
|
+
*
|
|
17
|
+
* `~/.local/bin/vibes` on POSIX; `%LOCALAPPDATA%\vibes\bin\vibes.exe` on
|
|
18
|
+
* Windows. These are `cli-bin/scripts/build.ts` `getLocalInstallTarget()` and
|
|
19
|
+
* `install.ps1`'s destination — the same two paths the installer writes, so
|
|
20
|
+
* `--self` replaces the file the user actually runs rather than inventing a
|
|
21
|
+
* third location.
|
|
22
|
+
*
|
|
23
|
+
* ### Verification
|
|
24
|
+
*
|
|
25
|
+
* `downloads/cli/latest.json` names the artifact, its version and its sha256.
|
|
26
|
+
* Every outcome reports that digest — including `already current` and
|
|
27
|
+
* `--dry-run` — so an operator can compare it against `SHA256SUMS.txt`
|
|
28
|
+
* before authorising a real replacement.
|
|
29
|
+
* The download goes to a temp file NEXT TO the target (same filesystem, so the
|
|
30
|
+
* final step is a real atomic `rename`), is hashed, and is compared before
|
|
31
|
+
* anything is moved. A digest mismatch leaves the running binary untouched and
|
|
32
|
+
* deletes the temp file. Replacing a running executable by `rename` is the one
|
|
33
|
+
* safe form: the old inode stays alive for the current process, and every
|
|
34
|
+
* subsequent exec gets the new file.
|
|
35
|
+
*/
|
|
36
|
+
import { type RuntimeRef } from '@vibesdotdev/kernel';
|
|
37
|
+
import { z } from 'zod/v4';
|
|
38
|
+
export interface SelfInstallTarget {
|
|
39
|
+
dir: string;
|
|
40
|
+
path: string;
|
|
41
|
+
/** How the path is written in docs and installer output. */
|
|
42
|
+
label: string;
|
|
43
|
+
}
|
|
44
|
+
/** Mirrors `cli-bin/scripts/build.ts` `getLocalInstallTarget()` exactly. */
|
|
45
|
+
export declare function selfInstallTarget(platform: string, env: {
|
|
46
|
+
LOCALAPPDATA?: string | undefined;
|
|
47
|
+
}, home: string): SelfInstallTarget;
|
|
48
|
+
/** One verifiable asset; every field is parsed on its own, so one bad entry never hides the good ones. */
|
|
49
|
+
declare const LatestManifestAssetSchema: z.ZodObject<{
|
|
50
|
+
platform: z.ZodString;
|
|
51
|
+
arch: z.ZodString;
|
|
52
|
+
url: z.ZodString;
|
|
53
|
+
sha256: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
54
|
+
size: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
export type LatestManifestAsset = z.infer<typeof LatestManifestAssetSchema>;
|
|
57
|
+
export interface LatestManifest {
|
|
58
|
+
version: string;
|
|
59
|
+
assets: LatestManifestAsset[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Parse `latest.json` defensively — a release artifact is untrusted input.
|
|
63
|
+
* Refusals: `self-update-manifest-invalid` (not JSON, or no version) and
|
|
64
|
+
* `self-update-manifest-no-assets` (no entry carries a real sha256).
|
|
65
|
+
*/
|
|
66
|
+
export declare function parseLatestManifest(text: string): LatestManifest;
|
|
67
|
+
/** The reason `selectAsset` refuses with when the release does not build this platform. */
|
|
68
|
+
export declare const SELF_UPDATE_NO_ASSET = "self-update-no-asset";
|
|
69
|
+
export declare function selectAsset(manifest: LatestManifest, platform: string, arch: string): LatestManifestAsset;
|
|
70
|
+
/** One parsed release version: `MAJOR.MINOR.PATCH`, prerelease identifiers, build metadata ignored. */
|
|
71
|
+
interface ReleaseVersion {
|
|
72
|
+
readonly core: readonly [number, number, number];
|
|
73
|
+
readonly prerelease: readonly string[];
|
|
74
|
+
}
|
|
75
|
+
/** A release version, or `null` when the text is not one (a source build reports `unknown` or `dev`). */
|
|
76
|
+
export declare function parseReleaseVersion(text: string): ReleaseVersion | null;
|
|
77
|
+
/** SemVer precedence: negative when `left` is older, zero when equal, positive when newer. A release outranks its candidates. */
|
|
78
|
+
export declare function compareReleaseVersions(left: ReleaseVersion, right: ReleaseVersion): number;
|
|
79
|
+
/** What fetches a release file: ambient `fetch` by default, always handed the lifecycle's signal. */
|
|
80
|
+
export type SelfUpdateFetch = (url: string, init: {
|
|
81
|
+
signal: AbortSignal;
|
|
82
|
+
}) => Promise<Response>;
|
|
83
|
+
/** The default deadline on each release request (manifest, then binary). */
|
|
84
|
+
export declare const SELF_UPDATE_FETCH_TIMEOUT_MS = 120000;
|
|
85
|
+
export interface SelfUpdateOptions {
|
|
86
|
+
/** The runtime whose filesystem writes the binary and whose lifecycle owns (and bounds) every request. */
|
|
87
|
+
runtime: RuntimeRef;
|
|
88
|
+
/** URL of the release manifest. */
|
|
89
|
+
manifestUrl: string;
|
|
90
|
+
currentVersion: string;
|
|
91
|
+
target: SelfInstallTarget;
|
|
92
|
+
/** Host platform/arch, from the runtime's captured host facts. */
|
|
93
|
+
platform: string;
|
|
94
|
+
arch: string;
|
|
95
|
+
dryRun?: boolean;
|
|
96
|
+
fetchImpl?: SelfUpdateFetch;
|
|
97
|
+
/** Deadline on each request; defaults to {@link SELF_UPDATE_FETCH_TIMEOUT_MS}. */
|
|
98
|
+
timeoutMs?: number;
|
|
99
|
+
/** Install a published release older than the running one (refused by default). */
|
|
100
|
+
allowDowngrade?: boolean;
|
|
101
|
+
}
|
|
102
|
+
export interface SelfUpdateResult {
|
|
103
|
+
/** `true` when the binary on disk was replaced by this call. */
|
|
104
|
+
replaced: boolean;
|
|
105
|
+
fromVersion: string;
|
|
106
|
+
toVersion: string;
|
|
107
|
+
target: SelfInstallTarget;
|
|
108
|
+
sha256?: string;
|
|
109
|
+
/** Why nothing was replaced, when `replaced` is false. */
|
|
110
|
+
note?: string;
|
|
111
|
+
}
|
|
112
|
+
/** The asset to compare against when nothing is replaced: only "this release does not build here" is absence. */
|
|
113
|
+
export declare function publishedAsset(manifest: LatestManifest, platform: string, arch: string): LatestManifestAsset | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Download, verify and atomically install the current release. Returns without
|
|
116
|
+
* touching the disk when the running version already matches.
|
|
117
|
+
*/
|
|
118
|
+
export declare function runSelfUpdate(options: SelfUpdateOptions): Promise<SelfUpdateResult>;
|
|
119
|
+
export {};
|
|
120
|
+
//# sourceMappingURL=self-update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"self-update.d.ts","sourceRoot":"","sources":["../../src/cli/self-update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAIH,OAAO,EAAkD,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtG,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,MAAM,WAAW,iBAAiB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,KAAK,EAAE,MAAM,CAAC;CACd;AAUD,4EAA4E;AAC5E,wB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4B,SAAU,CAAC;AAEpD,MAAM,WAAW,iBAAiB;IACjC,0GAA0G;IAC1G,OAAO,EAAE,UAAU,CAAC;IACpB,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mFAAmF;IACnF,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAChC,gEAAgE;IAChE,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAyCD,iHAAiH;AACjH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAKxH;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA8DzF"}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vibes update --self` — replace the executable, verified, in place.
|
|
3
|
+
*
|
|
4
|
+
* ### Ordering is a correctness property, not a preference (plan §5.1)
|
|
5
|
+
*
|
|
6
|
+
* SELF FIRST, then the graph, then ONE roll. The draft rolled bodies after the
|
|
7
|
+
* lock digest changed and replaced the binary afterwards, which re-stales
|
|
8
|
+
* every body it had just rolled: the executable freshness nerve fires on the
|
|
9
|
+
* new inode, so a body restarted before the swap is stale the moment the swap
|
|
10
|
+
* lands. Two rolls, one of them wasted, and a `pm status` Build column that
|
|
11
|
+
* reads `STALE` right after a successful update. `runSelfUpdate` therefore
|
|
12
|
+
* returns before any graph work and the caller performs exactly one census
|
|
13
|
+
* roll at the end.
|
|
14
|
+
*
|
|
15
|
+
* ### Install target
|
|
16
|
+
*
|
|
17
|
+
* `~/.local/bin/vibes` on POSIX; `%LOCALAPPDATA%\vibes\bin\vibes.exe` on
|
|
18
|
+
* Windows. These are `cli-bin/scripts/build.ts` `getLocalInstallTarget()` and
|
|
19
|
+
* `install.ps1`'s destination — the same two paths the installer writes, so
|
|
20
|
+
* `--self` replaces the file the user actually runs rather than inventing a
|
|
21
|
+
* third location.
|
|
22
|
+
*
|
|
23
|
+
* ### Verification
|
|
24
|
+
*
|
|
25
|
+
* `downloads/cli/latest.json` names the artifact, its version and its sha256.
|
|
26
|
+
* Every outcome reports that digest — including `already current` and
|
|
27
|
+
* `--dry-run` — so an operator can compare it against `SHA256SUMS.txt`
|
|
28
|
+
* before authorising a real replacement.
|
|
29
|
+
* The download goes to a temp file NEXT TO the target (same filesystem, so the
|
|
30
|
+
* final step is a real atomic `rename`), is hashed, and is compared before
|
|
31
|
+
* anything is moved. A digest mismatch leaves the running binary untouched and
|
|
32
|
+
* deletes the temp file. Replacing a running executable by `rename` is the one
|
|
33
|
+
* safe form: the old inode stays alive for the current process, and every
|
|
34
|
+
* subsequent exec gets the new file.
|
|
35
|
+
*/
|
|
36
|
+
import { chmodChecked } from '@vibesdotdev/filesystem/core';
|
|
37
|
+
import { resolveFileSystemAdapter } from '@vibesdotdev/filesystem/client/resolve-adapter';
|
|
38
|
+
import { CapabilityError, settleNow } from '@vibesdotdev/kernel';
|
|
39
|
+
import { redactCredentials, urlRedactions } from '@vibesdotdev/shared/utils';
|
|
40
|
+
import { z } from 'zod/v4';
|
|
41
|
+
/** Join path segments with one separator; the target's platform is declared, never the running host's. */
|
|
42
|
+
function joinFor(separator, ...segments) {
|
|
43
|
+
return segments
|
|
44
|
+
.map((segment, index) => (index === 0 ? segment.replace(/[\\/]+$/, '') : segment.replace(/^[\\/]+|[\\/]+$/g, '')))
|
|
45
|
+
.filter((segment, index) => index === 0 || segment.length > 0)
|
|
46
|
+
.join(separator);
|
|
47
|
+
}
|
|
48
|
+
/** Mirrors `cli-bin/scripts/build.ts` `getLocalInstallTarget()` exactly. */
|
|
49
|
+
export function selfInstallTarget(platform, env, home) {
|
|
50
|
+
if (platform === 'win32') {
|
|
51
|
+
const base = env.LOCALAPPDATA || joinFor('\\', home, 'AppData', 'Local');
|
|
52
|
+
const dir = joinFor('\\', base, 'vibes', 'bin');
|
|
53
|
+
return { dir, path: joinFor('\\', dir, 'vibes.exe'), label: '%LOCALAPPDATA%\\vibes\\bin\\vibes.exe' };
|
|
54
|
+
}
|
|
55
|
+
const dir = joinFor('/', home, '.local', 'bin');
|
|
56
|
+
return { dir, path: joinFor('/', dir, 'vibes'), label: '~/.local/bin/vibes' };
|
|
57
|
+
}
|
|
58
|
+
/** One verifiable asset; every field is parsed on its own, so one bad entry never hides the good ones. */
|
|
59
|
+
const LatestManifestAssetSchema = z.object({
|
|
60
|
+
platform: z.string(),
|
|
61
|
+
arch: z.string(),
|
|
62
|
+
url: z.string(),
|
|
63
|
+
sha256: z.string().regex(/^[0-9a-f]{64}$/i).transform((digest) => digest.toLowerCase()),
|
|
64
|
+
size: z.number().optional().catch(undefined)
|
|
65
|
+
});
|
|
66
|
+
const LatestManifestEnvelopeSchema = z.object({
|
|
67
|
+
version: z.string().trim().min(1),
|
|
68
|
+
assets: z.array(z.unknown()).catch([])
|
|
69
|
+
});
|
|
70
|
+
/** The manifest's typed refusal: `reason` names what was wrong, never the release's text. */
|
|
71
|
+
function manifestRefusal(message, reason, cause) {
|
|
72
|
+
if (cause === null)
|
|
73
|
+
return new CapabilityError(message, 'INVALID_INPUT', { reason, retryable: false });
|
|
74
|
+
return new CapabilityError(message, 'INVALID_INPUT', { reason, retryable: false, cause });
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Parse `latest.json` defensively — a release artifact is untrusted input.
|
|
78
|
+
* Refusals: `self-update-manifest-invalid` (not JSON, or no version) and
|
|
79
|
+
* `self-update-manifest-no-assets` (no entry carries a real sha256).
|
|
80
|
+
*/
|
|
81
|
+
export function parseLatestManifest(text) {
|
|
82
|
+
const json = settleNow(() => JSON.parse(text));
|
|
83
|
+
if (!json.ok)
|
|
84
|
+
throw manifestRefusal('latest.json is not JSON', 'self-update-manifest-invalid', json.cause);
|
|
85
|
+
const envelope = LatestManifestEnvelopeSchema.safeParse(json.value);
|
|
86
|
+
if (!envelope.success)
|
|
87
|
+
throw manifestRefusal('latest.json has no version', 'self-update-manifest-invalid', envelope.error);
|
|
88
|
+
const parsed = [];
|
|
89
|
+
for (const entry of envelope.data.assets) {
|
|
90
|
+
const asset = LatestManifestAssetSchema.safeParse(entry);
|
|
91
|
+
if (asset.success)
|
|
92
|
+
parsed.push(asset.data);
|
|
93
|
+
}
|
|
94
|
+
if (parsed.length === 0)
|
|
95
|
+
throw manifestRefusal('latest.json lists no verifiable assets', 'self-update-manifest-no-assets', null);
|
|
96
|
+
return { version: envelope.data.version, assets: parsed };
|
|
97
|
+
}
|
|
98
|
+
/** The reason `selectAsset` refuses with when the release does not build this platform. */
|
|
99
|
+
export const SELF_UPDATE_NO_ASSET = 'self-update-no-asset';
|
|
100
|
+
export function selectAsset(manifest, platform, arch) {
|
|
101
|
+
const asset = manifest.assets.find((candidate) => candidate.platform === platform && candidate.arch === arch);
|
|
102
|
+
if (!asset) {
|
|
103
|
+
throw new CapabilityError(`latest.json ${manifest.version} has no asset for ${platform}/${arch} ` +
|
|
104
|
+
`(has ${manifest.assets.map((a) => `${a.platform}/${a.arch}`).join(', ')})`, 'NOT_FOUND', { reason: SELF_UPDATE_NO_ASSET, retryable: false, details: { platform, arch } });
|
|
105
|
+
}
|
|
106
|
+
return asset;
|
|
107
|
+
}
|
|
108
|
+
const RELEASE_VERSION = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
109
|
+
/** A release version, or `null` when the text is not one (a source build reports `unknown` or `dev`). */
|
|
110
|
+
export function parseReleaseVersion(text) {
|
|
111
|
+
const match = RELEASE_VERSION.exec(text.trim());
|
|
112
|
+
if (!match)
|
|
113
|
+
return null;
|
|
114
|
+
return {
|
|
115
|
+
core: [Number(match[1]), Number(match[2]), Number(match[3])],
|
|
116
|
+
prerelease: match[4] === undefined ? [] : match[4].split('.')
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/** One prerelease identifier against another (SemVer §11.4): numeric below alphanumeric, numbers by value. */
|
|
120
|
+
function compareIdentifier(left, right) {
|
|
121
|
+
const leftNumeric = /^\d+$/.test(left);
|
|
122
|
+
const rightNumeric = /^\d+$/.test(right);
|
|
123
|
+
if (leftNumeric && rightNumeric)
|
|
124
|
+
return Math.sign(Number(left) - Number(right));
|
|
125
|
+
if (leftNumeric !== rightNumeric)
|
|
126
|
+
return leftNumeric ? -1 : 1;
|
|
127
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
128
|
+
}
|
|
129
|
+
/** SemVer precedence: negative when `left` is older, zero when equal, positive when newer. A release outranks its candidates. */
|
|
130
|
+
export function compareReleaseVersions(left, right) {
|
|
131
|
+
for (let index = 0; index < 3; index++) {
|
|
132
|
+
const delta = Math.sign(left.core[index] - right.core[index]);
|
|
133
|
+
if (delta !== 0)
|
|
134
|
+
return delta;
|
|
135
|
+
}
|
|
136
|
+
if (left.prerelease.length === 0 || right.prerelease.length === 0) {
|
|
137
|
+
return Math.sign(right.prerelease.length - left.prerelease.length);
|
|
138
|
+
}
|
|
139
|
+
const shared = Math.min(left.prerelease.length, right.prerelease.length);
|
|
140
|
+
for (let index = 0; index < shared; index++) {
|
|
141
|
+
const delta = compareIdentifier(left.prerelease[index], right.prerelease[index]);
|
|
142
|
+
if (delta !== 0)
|
|
143
|
+
return delta;
|
|
144
|
+
}
|
|
145
|
+
return Math.sign(left.prerelease.length - right.prerelease.length);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Refuse a published version older than the running one (`self-update-downgrade`)
|
|
149
|
+
* unless the caller allowed it. A published version that is not a release
|
|
150
|
+
* version refuses `self-update-manifest-invalid`; a running version that is not
|
|
151
|
+
* one (a source build) cannot be older and is not compared.
|
|
152
|
+
*/
|
|
153
|
+
function refuseDowngrade(currentVersion, publishedVersion, allowDowngrade) {
|
|
154
|
+
const published = parseReleaseVersion(publishedVersion);
|
|
155
|
+
if (!published)
|
|
156
|
+
throw manifestRefusal(`latest.json version '${publishedVersion}' is not a release version`, 'self-update-manifest-invalid', null);
|
|
157
|
+
const current = parseReleaseVersion(currentVersion);
|
|
158
|
+
if (!current || allowDowngrade || compareReleaseVersions(published, current) >= 0)
|
|
159
|
+
return;
|
|
160
|
+
throw new CapabilityError(`The published release ${publishedVersion} is older than the running ${currentVersion}; nothing was replaced.`, 'CONFLICT', {
|
|
161
|
+
reason: 'self-update-downgrade',
|
|
162
|
+
retryable: false,
|
|
163
|
+
details: { currentVersion, publishedVersion },
|
|
164
|
+
recoveryHint: 'Pass --allow-downgrade to install the older release on purpose.'
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/** The default deadline on each release request (manifest, then binary). */
|
|
168
|
+
export const SELF_UPDATE_FETCH_TIMEOUT_MS = 120_000;
|
|
169
|
+
/** `url` as it may be printed: userinfo and query values (a presigned signature) removed. */
|
|
170
|
+
function printableUrl(url) {
|
|
171
|
+
return redactCredentials(url, urlRedactions(url).filter((value) => value !== url && !URL.canParse(value)));
|
|
172
|
+
}
|
|
173
|
+
async function sha256Of(bytes) {
|
|
174
|
+
const digest = new Uint8Array(await crypto.subtle.digest('SHA-256', bytes.slice()));
|
|
175
|
+
return Array.from(digest, (byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* One release request, owned by the runtime's lifecycle and bounded by a
|
|
179
|
+
* declared deadline: a stalled CDN rejects `TIMEOUT wait-timeout`, and a
|
|
180
|
+
* disposed runtime aborts it. A non-OK answer refuses typed.
|
|
181
|
+
*/
|
|
182
|
+
async function fetchRelease(options, url, what, consume) {
|
|
183
|
+
const fetchImpl = options.fetchImpl ?? ((target, init) => fetch(target, init));
|
|
184
|
+
const timeoutMs = options.timeoutMs ?? SELF_UPDATE_FETCH_TIMEOUT_MS;
|
|
185
|
+
return options.runtime.lifecycle.wait(async (signal) => {
|
|
186
|
+
const response = await fetchImpl(url, { signal });
|
|
187
|
+
if (!response.ok) {
|
|
188
|
+
throw new CapabilityError(`GET ${printableUrl(url)} — ${response.status}`, 'UNAVAILABLE', {
|
|
189
|
+
reason: 'self-update-fetch-failed',
|
|
190
|
+
retryable: response.status >= 500,
|
|
191
|
+
details: { what, status: response.status }
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
return consume(response);
|
|
195
|
+
}, {
|
|
196
|
+
timeoutMs,
|
|
197
|
+
reason: `self-update-${what}`
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
/** The asset to compare against when nothing is replaced: only "this release does not build here" is absence. */
|
|
201
|
+
export function publishedAsset(manifest, platform, arch) {
|
|
202
|
+
const selected = settleNow(() => selectAsset(manifest, platform, arch));
|
|
203
|
+
if (selected.ok)
|
|
204
|
+
return selected.value;
|
|
205
|
+
if (selected.cause instanceof CapabilityError && selected.cause.reason === SELF_UPDATE_NO_ASSET)
|
|
206
|
+
return undefined;
|
|
207
|
+
throw selected.cause;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Download, verify and atomically install the current release. Returns without
|
|
211
|
+
* touching the disk when the running version already matches.
|
|
212
|
+
*/
|
|
213
|
+
export async function runSelfUpdate(options) {
|
|
214
|
+
const target = options.target;
|
|
215
|
+
const manifest = parseLatestManifest(await fetchRelease(options, options.manifestUrl, 'manifest', response => response.text()));
|
|
216
|
+
if (manifest.version === options.currentVersion) {
|
|
217
|
+
// STILL NAME THE DIGEST. A run that answers "already current" without
|
|
218
|
+
// saying WHICH release it compared against is indistinguishable from one
|
|
219
|
+
// that never read the manifest, and an operator reconciling an install
|
|
220
|
+
// against `SHA256SUMS.txt` is left with nothing to compare. A platform
|
|
221
|
+
// this release does not build is not an error when nothing is replaced.
|
|
222
|
+
const published = publishedAsset(manifest, options.platform, options.arch);
|
|
223
|
+
const current = {
|
|
224
|
+
replaced: false,
|
|
225
|
+
fromVersion: options.currentVersion,
|
|
226
|
+
toVersion: manifest.version,
|
|
227
|
+
target,
|
|
228
|
+
note: 'already current'
|
|
229
|
+
};
|
|
230
|
+
if (published)
|
|
231
|
+
current.sha256 = published.sha256;
|
|
232
|
+
return current;
|
|
233
|
+
}
|
|
234
|
+
refuseDowngrade(options.currentVersion, manifest.version, options.allowDowngrade === true);
|
|
235
|
+
const asset = selectAsset(manifest, options.platform, options.arch);
|
|
236
|
+
if (options.dryRun) {
|
|
237
|
+
return {
|
|
238
|
+
replaced: false,
|
|
239
|
+
fromVersion: options.currentVersion,
|
|
240
|
+
toVersion: manifest.version,
|
|
241
|
+
target,
|
|
242
|
+
sha256: asset.sha256,
|
|
243
|
+
note: `would download ${printableUrl(asset.url)} and replace ${target.label}`
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
const filesystem = await resolveFileSystemAdapter(options.runtime, { binding: false });
|
|
247
|
+
await filesystem.mkdir(target.dir, { recursive: true });
|
|
248
|
+
// Same directory as the target so the final step is a real atomic rename.
|
|
249
|
+
const temporary = `${target.path}.download-${crypto.randomUUID()}`;
|
|
250
|
+
try {
|
|
251
|
+
const bytes = new Uint8Array(await fetchRelease(options, asset.url, 'binary', response => response.arrayBuffer()));
|
|
252
|
+
const digest = await sha256Of(bytes);
|
|
253
|
+
if (digest !== asset.sha256) {
|
|
254
|
+
throw new CapabilityError(`sha256 mismatch for ${printableUrl(asset.url)}: expected ${asset.sha256}, downloaded ${digest}. ` +
|
|
255
|
+
'The running binary was NOT replaced.', 'INVALID_INPUT', { reason: 'self-update-digest-mismatch', retryable: false, details: { expected: asset.sha256, actual: digest } });
|
|
256
|
+
}
|
|
257
|
+
await filesystem.writeFile(temporary, bytes);
|
|
258
|
+
// Refuse before replacement if the selected adapter cannot preserve executable permissions.
|
|
259
|
+
await chmodChecked(filesystem, temporary, 0o755);
|
|
260
|
+
await filesystem.rename(temporary, target.path);
|
|
261
|
+
return {
|
|
262
|
+
replaced: true,
|
|
263
|
+
fromVersion: options.currentVersion,
|
|
264
|
+
toVersion: manifest.version,
|
|
265
|
+
target,
|
|
266
|
+
sha256: digest
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
finally {
|
|
270
|
+
if (await filesystem.exists(temporary))
|
|
271
|
+
await filesystem.remove(temporary);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
//# sourceMappingURL=self-update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"self-update.js","sourceRoot":"","sources":["../../src/cli/self-update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,SAAS,EAAuC,MAAM,qBAAqB,CAAC;AACtG,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAS3B,0GAA0G;AAC1G,SAAS,OAAO,CAAC,SAAqB,EAAE,GAAG,QAAkB;IAC5D,OAAO,QAAQ;SACb,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,E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AAE,MAAM,EAAE,6BAA6B,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAChH,CAAC;QACH,CAAC;QACD,MAAM,UAAU,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC7C,4FAA4F;QAC5F,MAAM,YAAY,CAAC,UAAU,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACjD,MAAM,UAAU,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAChD,OAAO;YACN,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,OAAO,CAAC,cAAc;YACnC,SAAS,EAAE,QAAQ,CAAC,OAAO;YAC3B,MAAM;YACN,MAAM,EAAE,MAAM;SACd,CAAC;IACH,CAAC;YAAS,CAAC;QACV,IAAI,MAAM,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC;YAAE,MAAM,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC5E,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vibes update` — the repair kernel's other half.
|
|
3
|
+
*
|
|
4
|
+
* Top-level, not `vibes plugins update`, because it is the command a user runs
|
|
5
|
+
* when nothing else works: it seeds or repairs the scope manifests, installs,
|
|
6
|
+
* verifies through the shipping path, and rolls the bodies that are still
|
|
7
|
+
* executing the previous graph. `group: 'update'` is registered at the root
|
|
8
|
+
* through the CLI surface's root-fallback list.
|
|
9
|
+
*
|
|
10
|
+
* `--json` is NOT declared here: it is a program-level global cloned into every
|
|
11
|
+
* command, and the impl reads the resulting `cli/output-format` context.
|
|
12
|
+
*/
|
|
13
|
+
declare const _default: {
|
|
14
|
+
readonly id: "update";
|
|
15
|
+
readonly kind: "cli/command";
|
|
16
|
+
readonly name: "update";
|
|
17
|
+
readonly description: "Update plugins in the global and workspace scopes, then roll running bodies";
|
|
18
|
+
readonly group: "update";
|
|
19
|
+
readonly surfaces: ["cli"];
|
|
20
|
+
readonly hardware: ["consumer"];
|
|
21
|
+
readonly requiredContext: ["cli/ui", "cli/output-format"];
|
|
22
|
+
readonly effects: {
|
|
23
|
+
readonly homeWrite: "required";
|
|
24
|
+
};
|
|
25
|
+
readonly options: [{
|
|
26
|
+
readonly flags: "--global";
|
|
27
|
+
readonly description: "Update the global scope ($VIBES_HOME) only";
|
|
28
|
+
}, {
|
|
29
|
+
readonly flags: "--workspace";
|
|
30
|
+
readonly description: "Update the current workspace scope only";
|
|
31
|
+
}, {
|
|
32
|
+
readonly flags: "--latest";
|
|
33
|
+
readonly description: "Take the newest matching versions, not the locked ones";
|
|
34
|
+
}, {
|
|
35
|
+
readonly flags: "--repair";
|
|
36
|
+
readonly description: "Rewrite a fossil or foreign scope manifest, backing it up first";
|
|
37
|
+
}, {
|
|
38
|
+
readonly flags: "--self";
|
|
39
|
+
readonly description: "Replace the vibes executable itself, first";
|
|
40
|
+
}, {
|
|
41
|
+
readonly flags: "--allow-downgrade";
|
|
42
|
+
readonly description: "With --self, install a published release older than the running one";
|
|
43
|
+
}, {
|
|
44
|
+
readonly flags: "--mirror <url>";
|
|
45
|
+
readonly description: "Release mirror for --self (the base holding latest.json; the installer calls it VIBES_MIRROR)";
|
|
46
|
+
}, {
|
|
47
|
+
readonly flags: "--dry-run";
|
|
48
|
+
readonly description: "Report every action without performing it";
|
|
49
|
+
}, {
|
|
50
|
+
readonly flags: "--no-roll";
|
|
51
|
+
readonly description: "Skip restarting running bodies";
|
|
52
|
+
}];
|
|
53
|
+
readonly examples: [{
|
|
54
|
+
readonly command: "vibes update --global";
|
|
55
|
+
readonly description: "Update the machine-wide plugin scope";
|
|
56
|
+
}, {
|
|
57
|
+
readonly command: "vibes update --repair --global";
|
|
58
|
+
readonly description: "Repair a fossil ~/.vibes/package.json, keeping a dated backup";
|
|
59
|
+
}];
|
|
60
|
+
};
|
|
61
|
+
export default _default;
|
|
62
|
+
//# sourceMappingURL=update.cli-command.descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.cli-command.descriptor.d.ts","sourceRoot":"","sources":["../../src/cli/update.cli-command.descriptor.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACH,wBAkCG"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createRuntimeAsset } from '@vibesdotdev/kernel';
|
|
2
|
+
/**
|
|
3
|
+
* `vibes update` — the repair kernel's other half.
|
|
4
|
+
*
|
|
5
|
+
* Top-level, not `vibes plugins update`, because it is the command a user runs
|
|
6
|
+
* when nothing else works: it seeds or repairs the scope manifests, installs,
|
|
7
|
+
* verifies through the shipping path, and rolls the bodies that are still
|
|
8
|
+
* executing the previous graph. `group: 'update'` is registered at the root
|
|
9
|
+
* through the CLI surface's root-fallback list.
|
|
10
|
+
*
|
|
11
|
+
* `--json` is NOT declared here: it is a program-level global cloned into every
|
|
12
|
+
* command, and the impl reads the resulting `cli/output-format` context.
|
|
13
|
+
*/
|
|
14
|
+
export default createRuntimeAsset({
|
|
15
|
+
id: 'update',
|
|
16
|
+
kind: 'cli/command',
|
|
17
|
+
name: 'update',
|
|
18
|
+
description: 'Update plugins in the global and workspace scopes, then roll running bodies',
|
|
19
|
+
group: 'update',
|
|
20
|
+
surfaces: ['cli'],
|
|
21
|
+
hardware: ['consumer'],
|
|
22
|
+
requiredContext: ['cli/ui', 'cli/output-format'],
|
|
23
|
+
effects: { homeWrite: 'required' },
|
|
24
|
+
options: [
|
|
25
|
+
{ flags: '--global', description: 'Update the global scope ($VIBES_HOME) only' },
|
|
26
|
+
{ flags: '--workspace', description: 'Update the current workspace scope only' },
|
|
27
|
+
{ flags: '--latest', description: 'Take the newest matching versions, not the locked ones' },
|
|
28
|
+
{
|
|
29
|
+
flags: '--repair',
|
|
30
|
+
description: 'Rewrite a fossil or foreign scope manifest, backing it up first'
|
|
31
|
+
},
|
|
32
|
+
{ flags: '--self', description: 'Replace the vibes executable itself, first' },
|
|
33
|
+
{ flags: '--allow-downgrade', description: 'With --self, install a published release older than the running one' },
|
|
34
|
+
{
|
|
35
|
+
flags: '--mirror <url>',
|
|
36
|
+
description: 'Release mirror for --self (the base holding latest.json; the installer calls it VIBES_MIRROR)'
|
|
37
|
+
},
|
|
38
|
+
{ flags: '--dry-run', description: 'Report every action without performing it' },
|
|
39
|
+
{ flags: '--no-roll', description: 'Skip restarting running bodies' }
|
|
40
|
+
],
|
|
41
|
+
examples: [
|
|
42
|
+
{ command: 'vibes update --global', description: 'Update the machine-wide plugin scope' },
|
|
43
|
+
{
|
|
44
|
+
command: 'vibes update --repair --global',
|
|
45
|
+
description: 'Repair a fossil ~/.vibes/package.json, keeping a dated backup'
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=update.cli-command.descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.cli-command.descriptor.js","sourceRoot":"","sources":["../../src/cli/update.cli-command.descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,eAAe,kBAAkB,CAAC;IACjC,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,6EAA6E;IAC1F,KAAK,EAAE,QAAQ;IACf,QAAQ,EAAE,CAAC,KAAK,CAAC;IACjB,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,eAAe,EAAE,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IAChD,OAAO,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;IAClC,OAAO,EAAE;QACR,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAA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