@yagni-app/code-staging 0.0.0 → 0.1.0-staging.1002.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.md +55 -0
- package/README.md +166 -0
- package/dist/branding.d.ts +25 -0
- package/dist/branding.js +27 -0
- package/dist/claudeCompat.d.ts +78 -0
- package/dist/claudeCompat.js +198 -0
- package/dist/cli.d.ts +55 -0
- package/dist/cli.js +326 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.js +28 -0
- package/dist/credentials.d.ts +41 -0
- package/dist/credentials.js +75 -0
- package/dist/distribution.d.ts +15 -0
- package/dist/distribution.js +45 -0
- package/dist/doctor.d.ts +94 -0
- package/dist/doctor.js +343 -0
- package/dist/extension/advisor.d.ts +84 -0
- package/dist/extension/advisor.js +101 -0
- package/dist/extension/askAdvisorTool.d.ts +83 -0
- package/dist/extension/askAdvisorTool.js +188 -0
- package/dist/extension/askYagniTool.d.ts +39 -0
- package/dist/extension/askYagniTool.js +63 -0
- package/dist/extension/bless.d.ts +45 -0
- package/dist/extension/bless.js +74 -0
- package/dist/extension/branding.d.ts +48 -0
- package/dist/extension/branding.js +119 -0
- package/dist/extension/chipEditor.d.ts +117 -0
- package/dist/extension/chipEditor.js +369 -0
- package/dist/extension/config.d.ts +112 -0
- package/dist/extension/config.js +108 -0
- package/dist/extension/costHud.d.ts +73 -0
- package/dist/extension/costHud.js +123 -0
- package/dist/extension/decisionCapture.d.ts +52 -0
- package/dist/extension/decisionCapture.js +66 -0
- package/dist/extension/decisions.d.ts +83 -0
- package/dist/extension/decisions.js +200 -0
- package/dist/extension/diagnostics.d.ts +41 -0
- package/dist/extension/diagnostics.js +110 -0
- package/dist/extension/index.d.ts +116 -0
- package/dist/extension/index.js +388 -0
- package/dist/extension/initDone.d.ts +28 -0
- package/dist/extension/initDone.js +66 -0
- package/dist/extension/initPass.d.ts +152 -0
- package/dist/extension/initPass.js +394 -0
- package/dist/extension/nextWorkTool.d.ts +51 -0
- package/dist/extension/nextWorkTool.js +80 -0
- package/dist/extension/permission.d.ts +91 -0
- package/dist/extension/permission.js +236 -0
- package/dist/extension/pipeline/activity.d.ts +37 -0
- package/dist/extension/pipeline/activity.js +151 -0
- package/dist/extension/pipeline/activityFeed.d.ts +59 -0
- package/dist/extension/pipeline/activityFeed.js +175 -0
- package/dist/extension/pipeline/budget.d.ts +48 -0
- package/dist/extension/pipeline/budget.js +68 -0
- package/dist/extension/pipeline/checkpoint.d.ts +31 -0
- package/dist/extension/pipeline/checkpoint.js +176 -0
- package/dist/extension/pipeline/eval.d.ts +168 -0
- package/dist/extension/pipeline/eval.js +182 -0
- package/dist/extension/pipeline/events.d.ts +56 -0
- package/dist/extension/pipeline/events.js +147 -0
- package/dist/extension/pipeline/findings.d.ts +42 -0
- package/dist/extension/pipeline/findings.js +144 -0
- package/dist/extension/pipeline/finish.d.ts +128 -0
- package/dist/extension/pipeline/finish.js +307 -0
- package/dist/extension/pipeline/goCommand.d.ts +128 -0
- package/dist/extension/pipeline/goCommand.js +972 -0
- package/dist/extension/pipeline/goCompareCommand.d.ts +48 -0
- package/dist/extension/pipeline/goCompareCommand.js +184 -0
- package/dist/extension/pipeline/goFlags.d.ts +40 -0
- package/dist/extension/pipeline/goFlags.js +46 -0
- package/dist/extension/pipeline/goStatusCommands.d.ts +59 -0
- package/dist/extension/pipeline/goStatusCommands.js +188 -0
- package/dist/extension/pipeline/invocation.d.ts +45 -0
- package/dist/extension/pipeline/invocation.js +64 -0
- package/dist/extension/pipeline/orchestrator.d.ts +131 -0
- package/dist/extension/pipeline/orchestrator.js +636 -0
- package/dist/extension/pipeline/personas.d.ts +44 -0
- package/dist/extension/pipeline/personas.js +248 -0
- package/dist/extension/pipeline/resilience.d.ts +85 -0
- package/dist/extension/pipeline/resilience.js +166 -0
- package/dist/extension/pipeline/resume.d.ts +18 -0
- package/dist/extension/pipeline/resume.js +106 -0
- package/dist/extension/pipeline/runRegistry.d.ts +112 -0
- package/dist/extension/pipeline/runRegistry.js +202 -0
- package/dist/extension/pipeline/runSession.d.ts +152 -0
- package/dist/extension/pipeline/runSession.js +167 -0
- package/dist/extension/pipeline/runState.d.ts +158 -0
- package/dist/extension/pipeline/runState.js +264 -0
- package/dist/extension/pipeline/runner.d.ts +79 -0
- package/dist/extension/pipeline/runner.js +298 -0
- package/dist/extension/pipeline/scrubSecrets.d.ts +15 -0
- package/dist/extension/pipeline/scrubSecrets.js +32 -0
- package/dist/extension/pipeline/stages.d.ts +51 -0
- package/dist/extension/pipeline/stages.js +113 -0
- package/dist/extension/pipeline/ticketResolution.d.ts +34 -0
- package/dist/extension/pipeline/ticketResolution.js +75 -0
- package/dist/extension/pipeline/types.d.ts +436 -0
- package/dist/extension/pipeline/types.js +48 -0
- package/dist/extension/pipeline/verify.d.ts +277 -0
- package/dist/extension/pipeline/verify.js +758 -0
- package/dist/extension/pipeline/workspace.d.ts +32 -0
- package/dist/extension/pipeline/workspace.js +73 -0
- package/dist/extension/pipeline/worktree.d.ts +107 -0
- package/dist/extension/pipeline/worktree.js +200 -0
- package/dist/extension/provider.d.ts +11 -0
- package/dist/extension/provider.js +26 -0
- package/dist/extension/recall.d.ts +93 -0
- package/dist/extension/recall.js +187 -0
- package/dist/extension/recordContextTool.d.ts +38 -0
- package/dist/extension/recordContextTool.js +85 -0
- package/dist/extension/recordDecisionTool.d.ts +52 -0
- package/dist/extension/recordDecisionTool.js +102 -0
- package/dist/extension/repoDocs.d.ts +81 -0
- package/dist/extension/repoDocs.js +260 -0
- package/dist/extension/resilientFetch.d.ts +60 -0
- package/dist/extension/resilientFetch.js +133 -0
- package/dist/extension/reviewTool.d.ts +34 -0
- package/dist/extension/reviewTool.js +81 -0
- package/dist/extension/spool.d.ts +92 -0
- package/dist/extension/spool.js +266 -0
- package/dist/extension/stateHome.d.ts +2 -0
- package/dist/extension/stateHome.js +6 -0
- package/dist/extension/subagents.d.ts +135 -0
- package/dist/extension/subagents.js +281 -0
- package/dist/extension/surface.d.ts +10 -0
- package/dist/extension/surface.js +12 -0
- package/dist/extension/todos.d.ts +110 -0
- package/dist/extension/todos.js +217 -0
- package/dist/extension/tokenProvider.d.ts +93 -0
- package/dist/extension/tokenProvider.js +234 -0
- package/dist/launch.d.ts +76 -0
- package/dist/launch.js +111 -0
- package/dist/login.d.ts +45 -0
- package/dist/login.js +142 -0
- package/dist/logout.d.ts +14 -0
- package/dist/logout.js +34 -0
- package/dist/paths.d.ts +31 -0
- package/dist/paths.js +87 -0
- package/dist/piPackage.d.ts +33 -0
- package/dist/piPackage.js +71 -0
- package/dist/profiles.d.ts +80 -0
- package/dist/profiles.js +222 -0
- package/dist/refresh.d.ts +70 -0
- package/dist/refresh.js +117 -0
- package/dist/upgrade.d.ts +97 -0
- package/dist/upgrade.js +284 -0
- package/package.json +39 -3
package/dist/upgrade.js
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `yagni upgrade` + the launch-time update nudge.
|
|
3
|
+
*
|
|
4
|
+
* npm is the only distribution channel, so "upgrade" means re-running the
|
|
5
|
+
* user's own global installer (`npm`/`pnpm`/`bun`, detected from where the
|
|
6
|
+
* running bin lives) against the published package. The nudge follows the
|
|
7
|
+
* desktop updater's posture: it must never cost anybody a launch. It reads
|
|
8
|
+
* only a local cache (`~/.yagni-code/update-check.json`) — zero network
|
|
9
|
+
* before the agent starts — and refreshes that cache in the background while
|
|
10
|
+
* the session runs, so the NEXT launch nudges from fresh data. Every network
|
|
11
|
+
* path fails soft to "say nothing".
|
|
12
|
+
*
|
|
13
|
+
* Set YAGNI_DISABLE_UPDATE_CHECK=1 to silence the nudge and the background
|
|
14
|
+
* check entirely (managed/enterprise environments); an explicit
|
|
15
|
+
* `yagni upgrade` still works there.
|
|
16
|
+
*/
|
|
17
|
+
import { spawn } from "node:child_process";
|
|
18
|
+
import { readFileSync } from "node:fs";
|
|
19
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
20
|
+
import { dirname, join } from "node:path";
|
|
21
|
+
import { fileURLToPath } from "node:url";
|
|
22
|
+
import { credentialsDir } from "./credentials.js";
|
|
23
|
+
import { DISTRIBUTION } from "./distribution.js";
|
|
24
|
+
export const PACKAGE_NAME = DISTRIBUTION.packageName;
|
|
25
|
+
export const UPDATE_CHECK_DISABLE_ENV = "YAGNI_DISABLE_UPDATE_CHECK";
|
|
26
|
+
const DEFAULT_REGISTRY = "https://registry.npmjs.org";
|
|
27
|
+
const FETCH_TIMEOUT_MS = 5_000;
|
|
28
|
+
const SEMVER_RE = /^(0|[1-9]\d{0,5})\.(0|[1-9]\d{0,5})\.(0|[1-9]\d{0,5})(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/;
|
|
29
|
+
const INSTALL_METHODS = ["npm", "pnpm", "bun"];
|
|
30
|
+
/**
|
|
31
|
+
* The CLI's own version, read from this package's package.json. Resolved
|
|
32
|
+
* relative to the module (src/ and dist/ both sit one level below the package
|
|
33
|
+
* root), so it is correct under tsx in tests and in the published tarball.
|
|
34
|
+
*/
|
|
35
|
+
export function currentCliVersion() {
|
|
36
|
+
const pkgPath = join(dirname(fileURLToPath(import.meta.url)), "..", "package.json");
|
|
37
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
38
|
+
return pkg.version ?? "0.0.0";
|
|
39
|
+
}
|
|
40
|
+
/** `"1"`/anything truthy disables; unset, empty, and `"0"` keep checks on. */
|
|
41
|
+
export function updateChecksDisabled(env) {
|
|
42
|
+
const value = env[UPDATE_CHECK_DISABLE_ENV];
|
|
43
|
+
return value !== undefined && value !== "" && value !== "0";
|
|
44
|
+
}
|
|
45
|
+
/** Honors a private-registry override (proxy/mirror setups) like npm does. */
|
|
46
|
+
export function registryUrl(env) {
|
|
47
|
+
const raw = env.npm_config_registry ?? env.NPM_CONFIG_REGISTRY ?? DEFAULT_REGISTRY;
|
|
48
|
+
return raw.replace(/\/+$/, "");
|
|
49
|
+
}
|
|
50
|
+
function parseVersion(value) {
|
|
51
|
+
const match = SEMVER_RE.exec(value);
|
|
52
|
+
if (!match)
|
|
53
|
+
return null;
|
|
54
|
+
const prerelease = [];
|
|
55
|
+
for (const identifier of match[4]?.split(".") ?? []) {
|
|
56
|
+
if (/^\d+$/.test(identifier)) {
|
|
57
|
+
if (identifier.length > 1 && identifier.startsWith("0"))
|
|
58
|
+
return null;
|
|
59
|
+
prerelease.push(Number(identifier));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
prerelease.push(identifier);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return { core: [Number(match[1]), Number(match[2]), Number(match[3])], prerelease };
|
|
66
|
+
}
|
|
67
|
+
function compareVersions(a, b) {
|
|
68
|
+
const parsedA = parseVersion(a);
|
|
69
|
+
const parsedB = parseVersion(b);
|
|
70
|
+
if (!parsedA || !parsedB)
|
|
71
|
+
return null;
|
|
72
|
+
for (let i = 0; i < 3; i += 1) {
|
|
73
|
+
if (parsedA.core[i] !== parsedB.core[i])
|
|
74
|
+
return parsedA.core[i] - parsedB.core[i];
|
|
75
|
+
}
|
|
76
|
+
if (parsedA.prerelease.length === 0 && parsedB.prerelease.length > 0)
|
|
77
|
+
return 1;
|
|
78
|
+
if (parsedB.prerelease.length === 0 && parsedA.prerelease.length > 0)
|
|
79
|
+
return -1;
|
|
80
|
+
const length = Math.max(parsedA.prerelease.length, parsedB.prerelease.length);
|
|
81
|
+
for (let i = 0; i < length; i += 1) {
|
|
82
|
+
const left = parsedA.prerelease[i];
|
|
83
|
+
const right = parsedB.prerelease[i];
|
|
84
|
+
if (left === undefined)
|
|
85
|
+
return -1;
|
|
86
|
+
if (right === undefined)
|
|
87
|
+
return 1;
|
|
88
|
+
if (left === right)
|
|
89
|
+
continue;
|
|
90
|
+
if (typeof left === "number" && typeof right === "number")
|
|
91
|
+
return left - right;
|
|
92
|
+
if (typeof left === "number")
|
|
93
|
+
return -1;
|
|
94
|
+
if (typeof right === "number")
|
|
95
|
+
return 1;
|
|
96
|
+
return left < right ? -1 : 1;
|
|
97
|
+
}
|
|
98
|
+
return 0;
|
|
99
|
+
}
|
|
100
|
+
/** Whether `candidate` is strictly newer than `current`. */
|
|
101
|
+
export function isNewerVersion(current, candidate) {
|
|
102
|
+
const comparison = compareVersions(candidate, current);
|
|
103
|
+
return comparison !== null && comparison > 0;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Extract `dist-tags.latest` from a registry packument. Strict: this string
|
|
107
|
+
* gets printed to the terminal and interpolated into an install command, so
|
|
108
|
+
* anything that is not a plain version is treated as absent.
|
|
109
|
+
*/
|
|
110
|
+
export function parsePublishedVersion(body, tag) {
|
|
111
|
+
if (!body || typeof body !== "object")
|
|
112
|
+
return null;
|
|
113
|
+
const tags = body["dist-tags"];
|
|
114
|
+
if (!tags || typeof tags !== "object")
|
|
115
|
+
return null;
|
|
116
|
+
const version = tags[tag];
|
|
117
|
+
return typeof version === "string" && parseVersion(version) ? version : null;
|
|
118
|
+
}
|
|
119
|
+
export function parseLatestVersion(body) {
|
|
120
|
+
return parsePublishedVersion(body, DISTRIBUTION.updateTag);
|
|
121
|
+
}
|
|
122
|
+
/** One fail-soft registry lookup: the latest published version, or null. */
|
|
123
|
+
export async function fetchLatestVersion(deps = {}) {
|
|
124
|
+
const env = deps.env ?? process.env;
|
|
125
|
+
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
126
|
+
try {
|
|
127
|
+
// Scoped names encode the slash; every registry accepts this form.
|
|
128
|
+
const url = `${registryUrl(env)}/${PACKAGE_NAME.replace("/", "%2f")}`;
|
|
129
|
+
const res = await fetchImpl(url, {
|
|
130
|
+
headers: { accept: "application/vnd.npm.install-v1+json" },
|
|
131
|
+
signal: AbortSignal.timeout(deps.timeoutMs ?? FETCH_TIMEOUT_MS),
|
|
132
|
+
});
|
|
133
|
+
if (!res.ok)
|
|
134
|
+
return null;
|
|
135
|
+
return parsePublishedVersion(await res.json(), DISTRIBUTION.updateTag);
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export function updateCheckCachePath() {
|
|
142
|
+
return join(credentialsDir(), "update-check.json");
|
|
143
|
+
}
|
|
144
|
+
export async function readUpdateCache() {
|
|
145
|
+
try {
|
|
146
|
+
const raw = await readFile(updateCheckCachePath(), "utf8");
|
|
147
|
+
const parsed = JSON.parse(raw);
|
|
148
|
+
if (typeof parsed?.latest !== "string" || !SEMVER_RE.test(parsed.latest))
|
|
149
|
+
return null;
|
|
150
|
+
return { checkedAt: typeof parsed.checkedAt === "string" ? parsed.checkedAt : "", latest: parsed.latest };
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
export async function writeUpdateCache(latest) {
|
|
157
|
+
const path = updateCheckCachePath();
|
|
158
|
+
await mkdir(dirname(path), { recursive: true, mode: 0o700 });
|
|
159
|
+
const cache = { checkedAt: new Date().toISOString(), latest };
|
|
160
|
+
await writeFile(path, `${JSON.stringify(cache, null, 2)}\n`, "utf8");
|
|
161
|
+
}
|
|
162
|
+
/** The one line the nudge is allowed, or null when there is nothing to say. */
|
|
163
|
+
export function updateNudge(current, latest) {
|
|
164
|
+
if (!latest || !isNewerVersion(current, latest))
|
|
165
|
+
return null;
|
|
166
|
+
return `${DISTRIBUTION.displayName} ${latest} is available (you have ${current}). Run \`${DISTRIBUTION.commandName} upgrade\`.`;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Print the (cache-backed) nudge, then kick off the background cache refresh.
|
|
170
|
+
* The caller awaits this function — a local file read — but must NOT await
|
|
171
|
+
* `refresh`; it completes during the session and is fire-and-forget.
|
|
172
|
+
*/
|
|
173
|
+
export async function maybeNudgeAndRefresh(deps) {
|
|
174
|
+
const env = deps.env ?? process.env;
|
|
175
|
+
if (updateChecksDisabled(env))
|
|
176
|
+
return { nudged: false, refresh: Promise.resolve() };
|
|
177
|
+
const log = deps.log ?? ((line) => process.stderr.write(`${line}\n`));
|
|
178
|
+
const cache = await readUpdateCache();
|
|
179
|
+
const nudge = updateNudge(deps.current, cache?.latest);
|
|
180
|
+
if (nudge)
|
|
181
|
+
log(nudge);
|
|
182
|
+
const fetchLatest = deps.fetchLatest ?? (() => fetchLatestVersion({ env }));
|
|
183
|
+
const refresh = fetchLatest()
|
|
184
|
+
.then((latest) => (latest ? writeUpdateCache(latest) : undefined))
|
|
185
|
+
.catch(() => undefined);
|
|
186
|
+
return { nudged: nudge !== null, refresh };
|
|
187
|
+
}
|
|
188
|
+
// ── `yagni upgrade` ─────────────────────────────────────────────────────────
|
|
189
|
+
/**
|
|
190
|
+
* Which global installer owns the running bin, from its (real) path. The
|
|
191
|
+
* heuristic covers the three installers the package supports; `--method` is
|
|
192
|
+
* the escape hatch when a layout defeats it.
|
|
193
|
+
*/
|
|
194
|
+
export function detectInstallMethod(binPath) {
|
|
195
|
+
const normalized = binPath.replaceAll("\\", "/").toLowerCase();
|
|
196
|
+
if (normalized.includes("/.bun/"))
|
|
197
|
+
return "bun";
|
|
198
|
+
if (normalized.includes("pnpm"))
|
|
199
|
+
return "pnpm";
|
|
200
|
+
return "npm";
|
|
201
|
+
}
|
|
202
|
+
const UPGRADE_USAGE = `Usage: ${DISTRIBUTION.commandName} upgrade [version] [--method npm|pnpm|bun]`;
|
|
203
|
+
export function parseUpgradeArgs(args) {
|
|
204
|
+
let target;
|
|
205
|
+
let method;
|
|
206
|
+
for (let i = 0; i < args.length; i++) {
|
|
207
|
+
const arg = args[i];
|
|
208
|
+
let methodValue;
|
|
209
|
+
if (arg === "--method")
|
|
210
|
+
methodValue = args[++i];
|
|
211
|
+
else if (arg.startsWith("--method="))
|
|
212
|
+
methodValue = arg.slice("--method=".length);
|
|
213
|
+
else if (arg.startsWith("-"))
|
|
214
|
+
return { ok: false, error: `Unknown option: ${arg}\n${UPGRADE_USAGE}` };
|
|
215
|
+
if (methodValue !== undefined) {
|
|
216
|
+
if (!INSTALL_METHODS.includes(methodValue)) {
|
|
217
|
+
return { ok: false, error: `Unknown method: ${methodValue}\n${UPGRADE_USAGE}` };
|
|
218
|
+
}
|
|
219
|
+
method = methodValue;
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
if (arg.startsWith("-"))
|
|
223
|
+
continue; // already handled above
|
|
224
|
+
if (target !== undefined)
|
|
225
|
+
return { ok: false, error: `Unexpected argument: ${arg}\n${UPGRADE_USAGE}` };
|
|
226
|
+
const version = arg.replace(/^v/, "");
|
|
227
|
+
if (!SEMVER_RE.test(version)) {
|
|
228
|
+
return { ok: false, error: `Not a version: ${arg} (expected MAJOR.MINOR.PATCH)\n${UPGRADE_USAGE}` };
|
|
229
|
+
}
|
|
230
|
+
target = version;
|
|
231
|
+
}
|
|
232
|
+
return { ok: true, target, method };
|
|
233
|
+
}
|
|
234
|
+
function installArgv(method, target) {
|
|
235
|
+
const spec = `${PACKAGE_NAME}@${target}`;
|
|
236
|
+
return method === "npm" ? ["install", "-g", spec] : ["add", "-g", spec];
|
|
237
|
+
}
|
|
238
|
+
function defaultRunInstall(command, args) {
|
|
239
|
+
return new Promise((resolve) => {
|
|
240
|
+
// npm/pnpm/bun are .cmd shims on Windows; a shell is required to run them.
|
|
241
|
+
const child = spawn(command, args, { stdio: "inherit", shell: process.platform === "win32" });
|
|
242
|
+
child.on("exit", (code) => resolve(code ?? 1));
|
|
243
|
+
child.on("error", (err) => {
|
|
244
|
+
process.stderr.write(`Failed to run ${command}: ${err.message}\n`);
|
|
245
|
+
resolve(1);
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
export async function upgradeCommand(args, deps) {
|
|
250
|
+
const log = deps.log ?? ((line) => process.stdout.write(`${line}\n`));
|
|
251
|
+
const logError = deps.logError ?? ((line) => process.stderr.write(`${line}\n`));
|
|
252
|
+
const parsed = parseUpgradeArgs(args);
|
|
253
|
+
if (!parsed.ok) {
|
|
254
|
+
logError(parsed.error);
|
|
255
|
+
return 1;
|
|
256
|
+
}
|
|
257
|
+
const env = deps.env ?? process.env;
|
|
258
|
+
const method = parsed.method ?? detectInstallMethod(deps.binPath ?? process.argv[1] ?? "");
|
|
259
|
+
const fetchLatest = deps.fetchLatest ?? (() => fetchLatestVersion({ env }));
|
|
260
|
+
const target = parsed.target ?? (await fetchLatest());
|
|
261
|
+
if (!target) {
|
|
262
|
+
logError("Could not reach the npm registry to find the latest version. " +
|
|
263
|
+
`Check your connection, or pass one explicitly: ${DISTRIBUTION.commandName} upgrade <version>`);
|
|
264
|
+
return 1;
|
|
265
|
+
}
|
|
266
|
+
if (target === deps.current) {
|
|
267
|
+
log(`${DISTRIBUTION.displayName} ${target} is already installed.`);
|
|
268
|
+
await writeUpdateCache(target).catch(() => undefined);
|
|
269
|
+
return 0;
|
|
270
|
+
}
|
|
271
|
+
log(`Upgrading ${DISTRIBUTION.displayName} ${deps.current} → ${target} (${method})…`);
|
|
272
|
+
const runInstall = deps.runInstall ?? defaultRunInstall;
|
|
273
|
+
const code = await runInstall(method, installArgv(method, target));
|
|
274
|
+
if (code !== 0) {
|
|
275
|
+
logError(`Upgrade failed (${method} exited ${code}). ` +
|
|
276
|
+
`If it was a permissions error, fix your ${method} global prefix or retry with elevated permissions.`);
|
|
277
|
+
return 1;
|
|
278
|
+
}
|
|
279
|
+
// Keep the nudge honest: the freshly installed version is the known latest.
|
|
280
|
+
await writeUpdateCache(target).catch(() => undefined);
|
|
281
|
+
log(`${DISTRIBUTION.displayName} ${target} installed. Run \`${DISTRIBUTION.commandName} version\` to confirm.`);
|
|
282
|
+
return 0;
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=upgrade.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yagni-app/code-staging",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"license": "
|
|
3
|
+
"version": "0.1.0-staging.1002.1",
|
|
4
|
+
"description": "YAGNI Code: a terminal coding agent that already knows your company. One YAGNI login routes the model and grounds the agent in your team's context.",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
|
+
"author": "YAGNI, Inc. <jack@yagni.app> (https://yagni.app)",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://yagni.app/code",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/YAGNI-App/YAGNI.git",
|
|
14
|
+
"directory": "packages/yagni-code-cli"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"yagni",
|
|
18
|
+
"coding-agent",
|
|
19
|
+
"ai",
|
|
20
|
+
"cli",
|
|
21
|
+
"terminal"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=22.19.0"
|
|
26
|
+
},
|
|
27
|
+
"bin": {
|
|
28
|
+
"yagni-staging": "dist/cli.js"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"!dist/**/*.map"
|
|
33
|
+
],
|
|
34
|
+
"main": "./dist/cli.js",
|
|
35
|
+
"types": "./dist/cli.d.ts",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@earendil-works/pi-coding-agent": "0.83.0",
|
|
38
|
+
"@earendil-works/pi-tui": "0.83.0",
|
|
39
|
+
"typebox": "^1.1.38"
|
|
40
|
+
},
|
|
41
|
+
"yagniSourceSha": "b173c9b46d20c3399724503b72e2d83b65f3dedb"
|
|
6
42
|
}
|