@rness/cli 0.6.0 → 0.6.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/README.md +20 -4
- package/dist/bin/rness.js +1 -1
- package/dist/{chunk-NY3WV7X5.js → chunk-YAIZOFYV.js} +123 -110
- package/dist/chunk-YAIZOFYV.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-NY3WV7X5.js.map +0 -1
package/README.md
CHANGED
|
@@ -147,6 +147,18 @@ its content does.
|
|
|
147
147
|
Exit codes: 0 success, 1 failure, 2 usage — or a refusal without a TTY.
|
|
148
148
|
`RNESS_DEBUG=1` adds stack traces; `RNESS_NO_DELEGATE=1` skips the delegation.
|
|
149
149
|
|
|
150
|
+
## 0.6.1 — hints you can type
|
|
151
|
+
|
|
152
|
+
- Every hint that names a command to run (`not cloned: …`, `run … sync`,
|
|
153
|
+
`run … login`, `… upgrade <version>`) spells rness the way it was
|
|
154
|
+
launched: `npx @rness/cli`, `pnpm dlx @rness/cli`, `yarn dlx @rness/cli`
|
|
155
|
+
(npx on Yarn 1), `bunx @rness/cli`, or `rness` when it was typed directly.
|
|
156
|
+
The next steps of `create` follow the same rule; `--pm`, which chooses what
|
|
157
|
+
`.rness/` installs with, no longer decides them.
|
|
158
|
+
- Under `rness-dev` (`RNESS_NO_DELEGATE=1`), `create` writes its first blocks
|
|
159
|
+
from the sources rather than through the copy it just installed.
|
|
160
|
+
- Blocks are unchanged: no `rness sync` is needed after upgrading.
|
|
161
|
+
|
|
150
162
|
## 0.6.0 — a workspace without GitHub
|
|
151
163
|
|
|
152
164
|
- `rness create <name> --blank` writes `<name>/.rness/` (a `rness.json`
|
|
@@ -317,12 +329,16 @@ To reach it from a workspace elsewhere on the machine, link it once:
|
|
|
317
329
|
ln -s "$PWD/scripts/dev.mjs" ~/.local/bin/rness-dev # from the repository root
|
|
318
330
|
cd ~/somewhere/acme && rness-dev validate
|
|
319
331
|
|
|
320
|
-
`create` is never delegated, so it always runs these sources —
|
|
321
|
-
|
|
332
|
+
`create` is never delegated, so it always runs these sources — the blocks it
|
|
333
|
+
writes at the end included, even once it has installed the pinned copy — and
|
|
334
|
+
it refuses to run inside a workspace, so call it from an empty directory.
|
|
322
335
|
|
|
323
336
|
`pnpm verdaccio` is the other loop: a local registry that serves this build as
|
|
324
337
|
a real package, for what only shows up through an install (`npm create rness`,
|
|
325
|
-
the pinned copy, a version bump).
|
|
326
|
-
|
|
338
|
+
the pinned copy, a version bump). Each `pnpm verdaccio deploy` publishes a
|
|
339
|
+
version of its own — `0.6.1-dev.<time>` for sources at 0.6.0 — so a new
|
|
340
|
+
workspace pins exactly that build and no cache serves an older one under its
|
|
341
|
+
number. To try it in a workspace that exists, run `rness upgrade <version>`
|
|
342
|
+
inside it; the deploy prints the line.
|
|
327
343
|
|
|
328
344
|
Node ≥ 24. MIT.
|
package/dist/bin/rness.js
CHANGED
|
@@ -45,6 +45,75 @@ async function writeFileAtomic(p, text) {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
// src/core/pm.ts
|
|
49
|
+
import { execFile } from "child_process";
|
|
50
|
+
import { promisify } from "util";
|
|
51
|
+
var execFileP = promisify(execFile);
|
|
52
|
+
var PACKAGE_MANAGERS = [
|
|
53
|
+
"npm",
|
|
54
|
+
"pnpm",
|
|
55
|
+
"yarn",
|
|
56
|
+
"bun"
|
|
57
|
+
];
|
|
58
|
+
function isPackageManager(value) {
|
|
59
|
+
return PACKAGE_MANAGERS.includes(value);
|
|
60
|
+
}
|
|
61
|
+
function detectPackageManager(userAgent = process.env["npm_config_user_agent"] ?? "") {
|
|
62
|
+
const name = userAgent.split("/")[0] ?? "";
|
|
63
|
+
return isPackageManager(name) ? name : "npm";
|
|
64
|
+
}
|
|
65
|
+
function firstLine(text) {
|
|
66
|
+
return text.split("\n").find((l) => l.trim() !== "")?.trim() ?? "unknown error";
|
|
67
|
+
}
|
|
68
|
+
async function packageManagerVersion(pm) {
|
|
69
|
+
try {
|
|
70
|
+
const { stdout } = await execFileP(pm, ["--version"]);
|
|
71
|
+
return stdout.trim();
|
|
72
|
+
} catch (e) {
|
|
73
|
+
throw new Error(`${pm} is not available on PATH`, { cause: e });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function rnessRunner(pm, version) {
|
|
77
|
+
if (pm === "pnpm") return "pnpm dlx @rness/cli";
|
|
78
|
+
if (pm === "bun") return "bunx @rness/cli";
|
|
79
|
+
if (pm === "yarn" && Number(version?.split(".")[0]) >= 2)
|
|
80
|
+
return "yarn dlx @rness/cli";
|
|
81
|
+
return "npx @rness/cli";
|
|
82
|
+
}
|
|
83
|
+
function rnessCommand(env = process.env) {
|
|
84
|
+
const agent = env["npm_config_user_agent"] ?? "";
|
|
85
|
+
if (agent === "") return "rness";
|
|
86
|
+
const pm = detectPackageManager(agent);
|
|
87
|
+
const [name, version] = (agent.split(" ")[0] ?? "").split("/");
|
|
88
|
+
return rnessRunner(pm, name === pm ? version ?? null : null);
|
|
89
|
+
}
|
|
90
|
+
var BARE_NPM_CODE = /^npm (error|ERR!) code \S+$/;
|
|
91
|
+
function installErrorLine(stderr) {
|
|
92
|
+
const lines = stderr.split("\n").map((l) => l.trim()).filter((l) => l !== "");
|
|
93
|
+
return lines.find((l) => !BARE_NPM_CODE.test(l)) ?? firstLine(stderr);
|
|
94
|
+
}
|
|
95
|
+
var FROZEN = {
|
|
96
|
+
npm: ["ci"],
|
|
97
|
+
pnpm: ["install", "--frozen-lockfile"],
|
|
98
|
+
yarn: ["install", "--immutable"],
|
|
99
|
+
bun: ["install", "--frozen-lockfile"]
|
|
100
|
+
};
|
|
101
|
+
function frozenArgs(pm) {
|
|
102
|
+
return [...FROZEN[pm]];
|
|
103
|
+
}
|
|
104
|
+
async function installDependencies(pm, dir, opts = {}) {
|
|
105
|
+
const args = opts.frozen === true ? frozenArgs(pm) : ["install"];
|
|
106
|
+
try {
|
|
107
|
+
await execFileP(pm, args, { cwd: dir, maxBuffer: 16 * 1024 * 1024 });
|
|
108
|
+
} catch (e) {
|
|
109
|
+
const err = e;
|
|
110
|
+
throw new Error(
|
|
111
|
+
`${pm} ${args.join(" ")} failed in ${dir}: ${installErrorLine(err.stderr ?? err.message)}`,
|
|
112
|
+
{ cause: e }
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
48
117
|
// src/core/auth.ts
|
|
49
118
|
import { chmod, mkdir, open, readFile as readFile2, rm as rm2, stat } from "fs/promises";
|
|
50
119
|
import { homedir } from "os";
|
|
@@ -298,7 +367,7 @@ async function resolveToken(deps = {}) {
|
|
|
298
367
|
await clearAuth();
|
|
299
368
|
(deps.notify ?? ((l) => process.stderr.write(`${l}
|
|
300
369
|
`)))(
|
|
301
|
-
|
|
370
|
+
`your GitHub login expired; run ${rnessCommand()} login`
|
|
302
371
|
);
|
|
303
372
|
return null;
|
|
304
373
|
}
|
|
@@ -313,7 +382,7 @@ async function resolveToken(deps = {}) {
|
|
|
313
382
|
var DEFAULT_GITHUB_API = "https://api.github.com";
|
|
314
383
|
var MAX_PAGES = 50;
|
|
315
384
|
var PER_PAGE = 100;
|
|
316
|
-
var
|
|
385
|
+
var addLater = () => `; add repositories later with ${rnessCommand()} add <repo>`;
|
|
317
386
|
var NEXT = /<[^>]*>\s*;\s*rel="next"/;
|
|
318
387
|
function isRepository(value) {
|
|
319
388
|
if (value === null || typeof value !== "object") return false;
|
|
@@ -357,12 +426,12 @@ function httpError(page, path) {
|
|
|
357
426
|
return new Error("GitHub rejected the token (401)", { cause });
|
|
358
427
|
if (page.status === 429 || page.status === 403 && (page.headers.get("x-ratelimit-remaining") === "0" || page.headers.has("retry-after"))) {
|
|
359
428
|
return new Error(
|
|
360
|
-
|
|
429
|
+
`GitHub API rate limit reached; set GITHUB_TOKEN or add repositories later with ${rnessCommand()} add`,
|
|
361
430
|
{ cause }
|
|
362
431
|
);
|
|
363
432
|
}
|
|
364
433
|
return new Error(
|
|
365
|
-
`GitHub API answered ${page.status} for ${path}${
|
|
434
|
+
`GitHub API answered ${page.status} for ${path}${addLater()}`,
|
|
366
435
|
{ cause }
|
|
367
436
|
);
|
|
368
437
|
}
|
|
@@ -403,7 +472,7 @@ async function listRepositories(owner, options) {
|
|
|
403
472
|
page = await getPage(url(kind, n), headers, timeoutMs);
|
|
404
473
|
if (page.status === 404) {
|
|
405
474
|
throw new Error(
|
|
406
|
-
`GitHub has no organization or user named "${owner}" (or it is not visible to you)${
|
|
475
|
+
`GitHub has no organization or user named "${owner}" (or it is not visible to you)${addLater()}`,
|
|
407
476
|
{ cause: { status: 404, path: kind.path } }
|
|
408
477
|
);
|
|
409
478
|
}
|
|
@@ -599,10 +668,10 @@ async function githubProvider(apiBase) {
|
|
|
599
668
|
import { spawn } from "child_process";
|
|
600
669
|
|
|
601
670
|
// src/core/git.ts
|
|
602
|
-
import { execFile } from "child_process";
|
|
671
|
+
import { execFile as execFile2 } from "child_process";
|
|
603
672
|
import { dirname as dirname2, resolve } from "path";
|
|
604
|
-
import { promisify } from "util";
|
|
605
|
-
var
|
|
673
|
+
import { promisify as promisify2 } from "util";
|
|
674
|
+
var execFileP2 = promisify2(execFile2);
|
|
606
675
|
var ENV_HELPER = '!f() { test "$1" = get && printf "username=%s\\npassword=%s\\n" "$RNESS_GIT_USERNAME" "$RNESS_GIT_TOKEN"; }; f';
|
|
607
676
|
function withCredentials(credentials) {
|
|
608
677
|
if (credentials === null || credentials === void 0)
|
|
@@ -618,7 +687,7 @@ function withCredentials(credentials) {
|
|
|
618
687
|
async function git(args, cwd, credentials) {
|
|
619
688
|
const auth = withCredentials(credentials);
|
|
620
689
|
try {
|
|
621
|
-
const { stdout } = await
|
|
690
|
+
const { stdout } = await execFileP2("git", [...auth.args, ...args], {
|
|
622
691
|
...cwd === void 0 ? {} : { cwd },
|
|
623
692
|
env: {
|
|
624
693
|
...process.env,
|
|
@@ -709,7 +778,7 @@ var NOT_FOUND = [
|
|
|
709
778
|
/repository .*not found/i,
|
|
710
779
|
/does not appear to be a git repository/i
|
|
711
780
|
];
|
|
712
|
-
function
|
|
781
|
+
function firstLine2(text) {
|
|
713
782
|
return text.split("\n").find((l) => l.trim() !== "")?.trim() ?? "unknown error";
|
|
714
783
|
}
|
|
715
784
|
function classifyProbe(url, exitCode, stderr) {
|
|
@@ -717,10 +786,10 @@ function classifyProbe(url, exitCode, stderr) {
|
|
|
717
786
|
if (AUTH.some((r) => r.test(stderr)))
|
|
718
787
|
return {
|
|
719
788
|
kind: "error",
|
|
720
|
-
message: `cannot access ${url}: ${
|
|
789
|
+
message: `cannot access ${url}: ${firstLine2(stderr)}`
|
|
721
790
|
};
|
|
722
791
|
if (NOT_FOUND.some((r) => r.test(stderr))) return { kind: "not-found" };
|
|
723
|
-
return { kind: "error", message: `cannot reach ${url}: ${
|
|
792
|
+
return { kind: "error", message: `cannot reach ${url}: ${firstLine2(stderr)}` };
|
|
724
793
|
}
|
|
725
794
|
var STDERR_FLUSH_MS = 200;
|
|
726
795
|
async function probeRemote(url, timeoutMs = 6e4, credentials) {
|
|
@@ -1149,7 +1218,7 @@ var GREETING = /^Hi ([^!\s]+)! You've successfully authenticated/m;
|
|
|
1149
1218
|
function parseSshGreeting(stderr) {
|
|
1150
1219
|
return GREETING.exec(stderr)?.[1] ?? null;
|
|
1151
1220
|
}
|
|
1152
|
-
function
|
|
1221
|
+
function firstLine3(text) {
|
|
1153
1222
|
return text.split("\n").find((l) => l.trim() !== "")?.trim() ?? null;
|
|
1154
1223
|
}
|
|
1155
1224
|
var STDERR_FLUSH_MS2 = 200;
|
|
@@ -1189,7 +1258,7 @@ async function detectGithubSsh(opts) {
|
|
|
1189
1258
|
settle(
|
|
1190
1259
|
login !== null ? { ok: true, login } : {
|
|
1191
1260
|
ok: false,
|
|
1192
|
-
reason:
|
|
1261
|
+
reason: firstLine3(stderr2) ?? `ssh exited with code ${code ?? "?"}`
|
|
1193
1262
|
}
|
|
1194
1263
|
);
|
|
1195
1264
|
};
|
|
@@ -1254,7 +1323,7 @@ var INSTEAD_OF_LINES = [
|
|
|
1254
1323
|
' git config --global url."https://github.com/".insteadOf git@github.com:'
|
|
1255
1324
|
];
|
|
1256
1325
|
function httpsFlagLine(spec) {
|
|
1257
|
-
return `or clone this repository over HTTPS:
|
|
1326
|
+
return `or clone this repository over HTTPS: ${rnessCommand()} add ${spec} --https`;
|
|
1258
1327
|
}
|
|
1259
1328
|
|
|
1260
1329
|
// src/core/workspace.ts
|
|
@@ -1916,7 +1985,7 @@ async function syncCommand(opts, deps = {}) {
|
|
|
1916
1985
|
}
|
|
1917
1986
|
if (notCloned.size > 0)
|
|
1918
1987
|
lines.push(
|
|
1919
|
-
`not cloned: ${[...notCloned].join(", ")} (
|
|
1988
|
+
`not cloned: ${[...notCloned].join(", ")} (${rnessCommand()} add <name>, or ${rnessCommand()} sync --all)`
|
|
1920
1989
|
);
|
|
1921
1990
|
const scoped = new Set(
|
|
1922
1991
|
Object.values(manifest.scopes).map((s) => s.path.split("/")[1])
|
|
@@ -1926,7 +1995,7 @@ async function syncCommand(opts, deps = {}) {
|
|
|
1926
1995
|
);
|
|
1927
1996
|
if (undeclared.length > 0)
|
|
1928
1997
|
lines.push(
|
|
1929
|
-
`not in rness.json: ${undeclared.join(", ")} (
|
|
1998
|
+
`not in rness.json: ${undeclared.join(", ")} (${rnessCommand()} add <name> declares it)`
|
|
1930
1999
|
);
|
|
1931
2000
|
if (!await exists(join9(ws.root, "org"))) {
|
|
1932
2001
|
lines.push(["skipped", "blocks (no org/ directory here)"]);
|
|
@@ -1990,7 +2059,9 @@ async function syncCommand(opts, deps = {}) {
|
|
|
1990
2059
|
lines.push(["updated", `${t.label}`]);
|
|
1991
2060
|
}
|
|
1992
2061
|
if (check && differences > 0)
|
|
1993
|
-
problems.push(
|
|
2062
|
+
problems.push(
|
|
2063
|
+
`${differences} block(s) out of date \u2014 run ${rnessCommand()} sync`
|
|
2064
|
+
);
|
|
1994
2065
|
}
|
|
1995
2066
|
return problems.length > 0 ? 1 : 0;
|
|
1996
2067
|
} finally {
|
|
@@ -2230,7 +2301,7 @@ async function contextCommand(opts) {
|
|
|
2230
2301
|
}
|
|
2231
2302
|
|
|
2232
2303
|
// src/version.ts
|
|
2233
|
-
var VERSION = "0.6.
|
|
2304
|
+
var VERSION = "0.6.1";
|
|
2234
2305
|
|
|
2235
2306
|
// src/core/delegate.ts
|
|
2236
2307
|
import { readFile as readFile6 } from "fs/promises";
|
|
@@ -2279,72 +2350,6 @@ async function findDelegate(cwd, ownVersion) {
|
|
|
2279
2350
|
return { entry: join11(pinned.dir, "dist", "index.js"), version, root };
|
|
2280
2351
|
}
|
|
2281
2352
|
|
|
2282
|
-
// src/core/pm.ts
|
|
2283
|
-
import { execFile as execFile2 } from "child_process";
|
|
2284
|
-
import { promisify as promisify2 } from "util";
|
|
2285
|
-
var execFileP2 = promisify2(execFile2);
|
|
2286
|
-
var PACKAGE_MANAGERS = [
|
|
2287
|
-
"npm",
|
|
2288
|
-
"pnpm",
|
|
2289
|
-
"yarn",
|
|
2290
|
-
"bun"
|
|
2291
|
-
];
|
|
2292
|
-
function isPackageManager(value) {
|
|
2293
|
-
return PACKAGE_MANAGERS.includes(value);
|
|
2294
|
-
}
|
|
2295
|
-
function detectPackageManager(userAgent = process.env["npm_config_user_agent"] ?? "") {
|
|
2296
|
-
const name = userAgent.split("/")[0] ?? "";
|
|
2297
|
-
return isPackageManager(name) ? name : "npm";
|
|
2298
|
-
}
|
|
2299
|
-
function firstLine3(text) {
|
|
2300
|
-
return text.split("\n").find((l) => l.trim() !== "")?.trim() ?? "unknown error";
|
|
2301
|
-
}
|
|
2302
|
-
async function packageManagerVersion(pm) {
|
|
2303
|
-
try {
|
|
2304
|
-
const { stdout } = await execFileP2(pm, ["--version"]);
|
|
2305
|
-
return stdout.trim();
|
|
2306
|
-
} catch (e) {
|
|
2307
|
-
throw new Error(`${pm} is not available on PATH`, { cause: e });
|
|
2308
|
-
}
|
|
2309
|
-
}
|
|
2310
|
-
function rnessRunner(pm, version) {
|
|
2311
|
-
if (pm === "pnpm") return "pnpm dlx @rness/cli";
|
|
2312
|
-
if (pm === "bun") return "bunx @rness/cli";
|
|
2313
|
-
if (pm === "yarn" && Number(version?.split(".")[0]) >= 2)
|
|
2314
|
-
return "yarn dlx @rness/cli";
|
|
2315
|
-
return "npx @rness/cli";
|
|
2316
|
-
}
|
|
2317
|
-
async function rnessRunnerFor(pm) {
|
|
2318
|
-
const version = pm === "yarn" ? await packageManagerVersion(pm).catch(() => null) : null;
|
|
2319
|
-
return rnessRunner(pm, version);
|
|
2320
|
-
}
|
|
2321
|
-
var BARE_NPM_CODE = /^npm (error|ERR!) code \S+$/;
|
|
2322
|
-
function installErrorLine(stderr) {
|
|
2323
|
-
const lines = stderr.split("\n").map((l) => l.trim()).filter((l) => l !== "");
|
|
2324
|
-
return lines.find((l) => !BARE_NPM_CODE.test(l)) ?? firstLine3(stderr);
|
|
2325
|
-
}
|
|
2326
|
-
var FROZEN = {
|
|
2327
|
-
npm: ["ci"],
|
|
2328
|
-
pnpm: ["install", "--frozen-lockfile"],
|
|
2329
|
-
yarn: ["install", "--immutable"],
|
|
2330
|
-
bun: ["install", "--frozen-lockfile"]
|
|
2331
|
-
};
|
|
2332
|
-
function frozenArgs(pm) {
|
|
2333
|
-
return [...FROZEN[pm]];
|
|
2334
|
-
}
|
|
2335
|
-
async function installDependencies(pm, dir, opts = {}) {
|
|
2336
|
-
const args = opts.frozen === true ? frozenArgs(pm) : ["install"];
|
|
2337
|
-
try {
|
|
2338
|
-
await execFileP2(pm, args, { cwd: dir, maxBuffer: 16 * 1024 * 1024 });
|
|
2339
|
-
} catch (e) {
|
|
2340
|
-
const err = e;
|
|
2341
|
-
throw new Error(
|
|
2342
|
-
`${pm} ${args.join(" ")} failed in ${dir}: ${installErrorLine(err.stderr ?? err.message)}`,
|
|
2343
|
-
{ cause: e }
|
|
2344
|
-
);
|
|
2345
|
-
}
|
|
2346
|
-
}
|
|
2347
|
-
|
|
2348
2353
|
// src/core/scaffold.ts
|
|
2349
2354
|
import { statSync } from "fs";
|
|
2350
2355
|
import { dirname as dirname4, join as join12 } from "path";
|
|
@@ -2480,8 +2485,8 @@ async function offerSetupGit(opts, terminal, bin, ui) {
|
|
|
2480
2485
|
const changed = await setupGit(process.execPath, bin);
|
|
2481
2486
|
ui.line(
|
|
2482
2487
|
changed ? "updated" : "unchanged",
|
|
2483
|
-
|
|
2484
|
-
|
|
2488
|
+
`git: rness answers for https://github.com (${rnessCommand()} logout undoes it)`,
|
|
2489
|
+
`git now asks rness for your github.com login over HTTPS (${rnessCommand()} logout undoes it)`
|
|
2485
2490
|
);
|
|
2486
2491
|
}
|
|
2487
2492
|
async function loginCommand(opts, deps = {}) {
|
|
@@ -2498,7 +2503,7 @@ async function loginCommand(opts, deps = {}) {
|
|
|
2498
2503
|
if (stored !== null && await resolveToken() !== null) {
|
|
2499
2504
|
ui.line(
|
|
2500
2505
|
"logged in",
|
|
2501
|
-
`as ${stored.login} (github.com);
|
|
2506
|
+
`as ${stored.login} (github.com); ${rnessCommand()} logout to switch`
|
|
2502
2507
|
);
|
|
2503
2508
|
await offerSetupGit(opts, terminal, bin, ui);
|
|
2504
2509
|
if (own) ui.outro("Nothing to do", "idle");
|
|
@@ -2761,7 +2766,7 @@ async function syncPinned(root, shown, fallback) {
|
|
|
2761
2766
|
if (installed === null) {
|
|
2762
2767
|
if (fallback !== void 0) return fallback();
|
|
2763
2768
|
process.stderr.write(
|
|
2764
|
-
`@rness/cli is not installed in ${shown}/.rness; install in .rness/, then
|
|
2769
|
+
`@rness/cli is not installed in ${shown}/.rness; install in .rness/, then ${rnessCommand()} sync
|
|
2765
2770
|
`
|
|
2766
2771
|
);
|
|
2767
2772
|
return 1;
|
|
@@ -2818,8 +2823,8 @@ async function targetProblem(cwd, root, pm) {
|
|
|
2818
2823
|
if (!await exists(root)) return null;
|
|
2819
2824
|
if (await exists(join15(root, ".rness", "rness.json"))) {
|
|
2820
2825
|
if (!await exists(join15(root, ".rness", "node_modules")))
|
|
2821
|
-
return `${shown} holds an rness workspace whose dependencies are not installed; cd ${shown}/.rness && ${pm} install, then
|
|
2822
|
-
return `${shown} already holds an rness workspace (.rness/); run
|
|
2826
|
+
return `${shown} holds an rness workspace whose dependencies are not installed; cd ${shown}/.rness && ${pm} install, then ${rnessCommand()} sync`;
|
|
2827
|
+
return `${shown} already holds an rness workspace (.rness/); run ${rnessCommand()} add inside it to add repositories`;
|
|
2823
2828
|
}
|
|
2824
2829
|
if (!(await stat3(root)).isDirectory()) return `${shown} is not a directory`;
|
|
2825
2830
|
if (!await isEmptyDir(root)) return `${shown} is not empty`;
|
|
@@ -2879,6 +2884,8 @@ async function commitContext(input) {
|
|
|
2879
2884
|
|
|
2880
2885
|
// src/core/sync-blocks.ts
|
|
2881
2886
|
async function syncBlocks(ui, root, shown, inPlace, sshWorks) {
|
|
2887
|
+
if (process.env["RNESS_NO_DELEGATE"] === "1" && inPlace !== void 0)
|
|
2888
|
+
return inPlace();
|
|
2882
2889
|
if (!ui.session)
|
|
2883
2890
|
return ui.step(
|
|
2884
2891
|
{ doing: "syncing the blocks", git: true },
|
|
@@ -2895,7 +2902,7 @@ async function syncBlocks(ui, root, shown, inPlace, sshWorks) {
|
|
|
2895
2902
|
if (result === null) {
|
|
2896
2903
|
if (inPlace !== void 0) return inPlace();
|
|
2897
2904
|
ui.error(
|
|
2898
|
-
`@rness/cli is not installed in ${shown}/.rness; install in .rness/, then
|
|
2905
|
+
`@rness/cli is not installed in ${shown}/.rness; install in .rness/, then ${rnessCommand()} sync`
|
|
2899
2906
|
);
|
|
2900
2907
|
return 1;
|
|
2901
2908
|
}
|
|
@@ -2985,7 +2992,7 @@ async function createBlank(input) {
|
|
|
2985
2992
|
const next = [
|
|
2986
2993
|
`cd ${shown}`,
|
|
2987
2994
|
"# bring a repository in: <owner>/<repo> on GitHub, or any git URL",
|
|
2988
|
-
`${
|
|
2995
|
+
`${rnessCommand()} add <owner>/<repo>`,
|
|
2989
2996
|
'# to share it: set "org" in .rness/rness.json, then push .rness to github.com/<org>/.rness'
|
|
2990
2997
|
];
|
|
2991
2998
|
if (ui.session) {
|
|
@@ -3055,11 +3062,11 @@ async function pickRepositories(input) {
|
|
|
3055
3062
|
listed = listing.repositories;
|
|
3056
3063
|
if (listing.owner === "user")
|
|
3057
3064
|
ui.hint(
|
|
3058
|
-
`only public repositories of ${org} are listed; add private ones later with
|
|
3065
|
+
`only public repositories of ${org} are listed; add private ones later with ${rnessCommand()} add <repo>`
|
|
3059
3066
|
);
|
|
3060
3067
|
else if (!provider.authenticated)
|
|
3061
3068
|
ui.hint(
|
|
3062
|
-
|
|
3069
|
+
`only public repositories are listed; ${rnessCommand()} login lists the private ones you can access`
|
|
3063
3070
|
);
|
|
3064
3071
|
if (listing.truncated)
|
|
3065
3072
|
ui.hint(`listed the first ${MAX_PAGES * PER_PAGE} repositories of ${org}`);
|
|
@@ -3290,7 +3297,6 @@ async function createCommand(opts, deps = {}) {
|
|
|
3290
3297
|
return 2;
|
|
3291
3298
|
}
|
|
3292
3299
|
let pm = opts.pm !== void 0 && isPackageManager(opts.pm) ? opts.pm : detectPackageManager();
|
|
3293
|
-
const launchedWith = pm;
|
|
3294
3300
|
const interactive = opts.yes !== true && terminal.isTty();
|
|
3295
3301
|
const ui = interactive ? await makeUi(terminal) : { ...plainUi };
|
|
3296
3302
|
let sshTest;
|
|
@@ -3523,7 +3529,7 @@ async function createCommand(opts, deps = {}) {
|
|
|
3523
3529
|
const remaining = Object.keys(catalogue.repos).filter(
|
|
3524
3530
|
(name2) => !cloned.has(name2)
|
|
3525
3531
|
);
|
|
3526
|
-
const rness2 =
|
|
3532
|
+
const rness2 = rnessCommand();
|
|
3527
3533
|
const next2 = [
|
|
3528
3534
|
`cd ${shown}`,
|
|
3529
3535
|
// The comment above its command, as the new-workspace note does: a
|
|
@@ -3583,7 +3589,7 @@ ${next2.map((l) => ` ${l}`).join("\n")}
|
|
|
3583
3589
|
url: contextUrl
|
|
3584
3590
|
}) : false;
|
|
3585
3591
|
if (published === null) return cancelled(ui);
|
|
3586
|
-
const rness =
|
|
3592
|
+
const rness = rnessCommand();
|
|
3587
3593
|
const next = [
|
|
3588
3594
|
`cd ${shown}/.rness`,
|
|
3589
3595
|
// What was asked for and did not happen, as the command that retries
|
|
@@ -3597,7 +3603,9 @@ ${next2.map((l) => ` ${l}`).join("\n")}
|
|
|
3597
3603
|
"# or, with the GitHub CLI (gh) installed, in one step:",
|
|
3598
3604
|
`gh repo create ${org}/.rness --private --source . --push`
|
|
3599
3605
|
],
|
|
3600
|
-
|
|
3606
|
+
// How this command was launched (npm when rness was typed directly),
|
|
3607
|
+
// whatever --pm installed with.
|
|
3608
|
+
`# then, for every teammate: ${detectPackageManager()} create rness ${org}`
|
|
3601
3609
|
];
|
|
3602
3610
|
if (ui.session) {
|
|
3603
3611
|
ui.note("Next steps", next);
|
|
@@ -3687,7 +3695,7 @@ async function upgradeCommand(version, opts, terminal = defaultTerminal) {
|
|
|
3687
3695
|
const pin = await readPin(ws.rnessDir);
|
|
3688
3696
|
if (pin === null) {
|
|
3689
3697
|
process.stderr.write(
|
|
3690
|
-
`no @rness/cli entry in ${label}/package.json; add it to devDependencies, then run
|
|
3698
|
+
`no @rness/cli entry in ${label}/package.json; add it to devDependencies, then run ${rnessCommand()} upgrade
|
|
3691
3699
|
`
|
|
3692
3700
|
);
|
|
3693
3701
|
return 1;
|
|
@@ -3708,7 +3716,8 @@ async function upgradeCommand(version, opts, terminal = defaultTerminal) {
|
|
|
3708
3716
|
);
|
|
3709
3717
|
if (target === null) {
|
|
3710
3718
|
process.stderr.write(
|
|
3711
|
-
|
|
3719
|
+
`cannot reach the registry; name the version: ${rnessCommand()} upgrade <version>
|
|
3720
|
+
`
|
|
3712
3721
|
);
|
|
3713
3722
|
return 1;
|
|
3714
3723
|
}
|
|
@@ -3722,7 +3731,7 @@ async function upgradeCommand(version, opts, terminal = defaultTerminal) {
|
|
|
3722
3731
|
const downgrading = EXACT_VERSION.test(pin.spec) && compareVersions(target, pin.spec) < 0;
|
|
3723
3732
|
if (downgrading && version === void 0) {
|
|
3724
3733
|
process.stderr.write(
|
|
3725
|
-
`${label} pins @rness/cli ${pin.spec}, newer than the latest release ${target}; to downgrade:
|
|
3734
|
+
`${label} pins @rness/cli ${pin.spec}, newer than the latest release ${target}; to downgrade: ${rnessCommand()} upgrade ${target}
|
|
3726
3735
|
`
|
|
3727
3736
|
);
|
|
3728
3737
|
return 1;
|
|
@@ -3889,7 +3898,7 @@ async function checkBlocks({
|
|
|
3889
3898
|
note(
|
|
3890
3899
|
t.label,
|
|
3891
3900
|
"no-block",
|
|
3892
|
-
`${t.label}: no rness block yet (run
|
|
3901
|
+
`${t.label}: no rness block yet (run ${rnessCommand()} sync)`
|
|
3893
3902
|
);
|
|
3894
3903
|
continue;
|
|
3895
3904
|
}
|
|
@@ -3911,7 +3920,11 @@ async function checkBlocks({
|
|
|
3911
3920
|
if (isCurrentBlock(lines.slice(found.begin, found.end + 1), fresh2.hash))
|
|
3912
3921
|
note(t.label, "current");
|
|
3913
3922
|
else
|
|
3914
|
-
note(
|
|
3923
|
+
note(
|
|
3924
|
+
t.label,
|
|
3925
|
+
"stale",
|
|
3926
|
+
`${t.label}: stale rness block (run ${rnessCommand()} sync)`
|
|
3927
|
+
);
|
|
3915
3928
|
}
|
|
3916
3929
|
return derive();
|
|
3917
3930
|
}
|
|
@@ -4215,6 +4228,11 @@ export {
|
|
|
4215
4228
|
exists,
|
|
4216
4229
|
readOrNull,
|
|
4217
4230
|
writeFileAtomic,
|
|
4231
|
+
PACKAGE_MANAGERS,
|
|
4232
|
+
isPackageManager,
|
|
4233
|
+
detectPackageManager,
|
|
4234
|
+
packageManagerVersion,
|
|
4235
|
+
installDependencies,
|
|
4218
4236
|
GitHubOAuthProvider,
|
|
4219
4237
|
githubProvider,
|
|
4220
4238
|
DEFAULT_HOST,
|
|
@@ -4259,11 +4277,6 @@ export {
|
|
|
4259
4277
|
contextCommand,
|
|
4260
4278
|
VERSION,
|
|
4261
4279
|
findDelegate,
|
|
4262
|
-
PACKAGE_MANAGERS,
|
|
4263
|
-
isPackageManager,
|
|
4264
|
-
detectPackageManager,
|
|
4265
|
-
packageManagerVersion,
|
|
4266
|
-
installDependencies,
|
|
4267
4280
|
SCAFFOLD_FILES,
|
|
4268
4281
|
scaffoldDir,
|
|
4269
4282
|
copyScaffold,
|
|
@@ -4279,4 +4292,4 @@ export {
|
|
|
4279
4292
|
OWN_COMMANDS,
|
|
4280
4293
|
catchUp
|
|
4281
4294
|
};
|
|
4282
|
-
//# sourceMappingURL=chunk-
|
|
4295
|
+
//# sourceMappingURL=chunk-YAIZOFYV.js.map
|