@rness/cli 0.22.1 → 0.22.2
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 +22 -0
- package/dist/bin/rness.js +2 -2
- package/dist/{chunk-PW5RMU2G.js → chunk-A7NX55WK.js} +2 -2
- package/dist/{chunk-OUZQGG6V.js → chunk-DFGZWBBW.js} +187 -127
- package/dist/chunk-DFGZWBBW.js.map +1 -0
- package/dist/{chunk-SX7D5W43.js → chunk-H5E6FMP6.js} +45 -15
- package/dist/chunk-H5E6FMP6.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/{note-MKUG7GOT.js → note-PANYS7DK.js} +3 -3
- package/dist/{summary-5DVUIOJM.js → summary-K5ETHXOX.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-OUZQGG6V.js.map +0 -1
- package/dist/chunk-SX7D5W43.js.map +0 -1
- /package/dist/{chunk-PW5RMU2G.js.map → chunk-A7NX55WK.js.map} +0 -0
- /package/dist/{note-MKUG7GOT.js.map → note-PANYS7DK.js.map} +0 -0
- /package/dist/{summary-5DVUIOJM.js.map → summary-K5ETHXOX.js.map} +0 -0
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
DEFAULT_HOST,
|
|
5
5
|
MAX_PAGES,
|
|
6
6
|
NAME,
|
|
7
|
+
NAME_RULE,
|
|
7
8
|
ORG_NAME,
|
|
8
9
|
PACKAGE_MANAGERS,
|
|
9
10
|
PER_PAGE,
|
|
@@ -42,6 +43,7 @@ import {
|
|
|
42
43
|
documentNumber,
|
|
43
44
|
documentTitle,
|
|
44
45
|
documentsIn,
|
|
46
|
+
entryFor,
|
|
45
47
|
exists,
|
|
46
48
|
findTab,
|
|
47
49
|
findWorkspace,
|
|
@@ -65,6 +67,7 @@ import {
|
|
|
65
67
|
openInBrowser,
|
|
66
68
|
openProvider,
|
|
67
69
|
optionColor,
|
|
70
|
+
orgDirs,
|
|
68
71
|
ownerScope,
|
|
69
72
|
packageManagerVersion,
|
|
70
73
|
paint,
|
|
@@ -102,7 +105,7 @@ import {
|
|
|
102
105
|
workspaceName,
|
|
103
106
|
writeFileAtomic,
|
|
104
107
|
writeManifest
|
|
105
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-DFGZWBBW.js";
|
|
106
109
|
|
|
107
110
|
// src/core/transport.ts
|
|
108
111
|
import { spawn } from "child_process";
|
|
@@ -1455,7 +1458,18 @@ async function askWhatToSync(input) {
|
|
|
1455
1458
|
if (p.isCancel(ok) || ok !== true) return cancelled2();
|
|
1456
1459
|
return [];
|
|
1457
1460
|
}
|
|
1458
|
-
|
|
1461
|
+
function unreadWhy(dir, clones) {
|
|
1462
|
+
const lower = dir.toLowerCase();
|
|
1463
|
+
const step = /^(.+)\.rness-rename$/.exec(dir);
|
|
1464
|
+
if (step !== null)
|
|
1465
|
+
return `left by an interrupted rename: move it back to org/${step[1]}`;
|
|
1466
|
+
if (!NAME.test(lower)) return `not a repository name: ${NAME_RULE}`;
|
|
1467
|
+
if (clones.has(lower))
|
|
1468
|
+
return `names are lowercase, and org/${lower} is another directory`;
|
|
1469
|
+
return `names are lowercase: ${rnessCommand()} add ${lower} renames it org/${lower}`;
|
|
1470
|
+
}
|
|
1471
|
+
async function syncCommand(given, deps = {}) {
|
|
1472
|
+
const opts = given.scope === void 0 ? given : { ...given, scope: given.scope.toLowerCase() };
|
|
1459
1473
|
const terminal = deps.terminal ?? defaultTerminal;
|
|
1460
1474
|
const transport = deps.transport ?? defaultTransport;
|
|
1461
1475
|
let provider = deps.provider;
|
|
@@ -1530,8 +1544,13 @@ async function syncCommand(opts, deps = {}) {
|
|
|
1530
1544
|
if (boards.changed)
|
|
1531
1545
|
ui.hint("rness.json changed: commit it in .rness, for the whole team");
|
|
1532
1546
|
}
|
|
1533
|
-
const clones = await
|
|
1534
|
-
const
|
|
1547
|
+
const { clones, unread } = await orgDirs(ws.root);
|
|
1548
|
+
const misnamed = new Set(
|
|
1549
|
+
unread.map((d) => d.toLowerCase()).filter((n) => Object.hasOwn(manifest.repos, n) && !clones.has(n))
|
|
1550
|
+
);
|
|
1551
|
+
const missing = Object.keys(manifest.repos).filter(
|
|
1552
|
+
(n) => !clones.has(n) && !misnamed.has(n)
|
|
1553
|
+
);
|
|
1535
1554
|
let toClone = new Set(opts.all === true && !check ? missing : []);
|
|
1536
1555
|
if (!check && opts.yes !== true) {
|
|
1537
1556
|
const answer = await askWhatToSync({
|
|
@@ -1572,6 +1591,7 @@ async function syncCommand(opts, deps = {}) {
|
|
|
1572
1591
|
try {
|
|
1573
1592
|
const notCloned = /* @__PURE__ */ new Set();
|
|
1574
1593
|
for (const [name, repo] of Object.entries(manifest.repos)) {
|
|
1594
|
+
if (misnamed.has(name)) continue;
|
|
1575
1595
|
const dir = join6(ws.root, "org", name);
|
|
1576
1596
|
const label = `org/${name}`;
|
|
1577
1597
|
if (!await exists(dir)) {
|
|
@@ -1624,11 +1644,15 @@ async function syncCommand(opts, deps = {}) {
|
|
|
1624
1644
|
lines.push(
|
|
1625
1645
|
`not in rness.json: ${undeclared.join(", ")} (${rnessCommand()} add <name> declares it)`
|
|
1626
1646
|
);
|
|
1647
|
+
for (const d of unread)
|
|
1648
|
+
lines.push(`not read: org/${d} (${unreadWhy(d, clones)})`);
|
|
1627
1649
|
if (!await exists(join6(ws.root, "org"))) {
|
|
1628
1650
|
lines.push(["skipped", "blocks (no org/ directory here)"]);
|
|
1629
1651
|
} else {
|
|
1630
1652
|
let differences = 0;
|
|
1631
1653
|
for (const t of targetsOf(manifest, ws.root, opts.scope)) {
|
|
1654
|
+
const owner = t.label.startsWith("org/") ? t.label.split("/")[1] : void 0;
|
|
1655
|
+
if (owner !== void 0 && misnamed.has(owner)) continue;
|
|
1632
1656
|
if (!await exists(t.dir)) {
|
|
1633
1657
|
const repo = t.label.split("/")[1];
|
|
1634
1658
|
if (!t.label.startsWith("org/") || repo === void 0 || !notCloned.has(repo))
|
|
@@ -1826,10 +1850,11 @@ async function addCommand(spec, opts, deps = {}) {
|
|
|
1826
1850
|
parsed = parseRepoSpec(spec, org, host);
|
|
1827
1851
|
const scopes = (opts.scopes ?? "").split(",").map((s) => s.trim()).filter((s) => s !== "");
|
|
1828
1852
|
const dir = join7(ws.root, "org", parsed.name);
|
|
1829
|
-
const
|
|
1853
|
+
const entry = await entryFor(ws.root, parsed.name);
|
|
1854
|
+
const present = entry !== null;
|
|
1830
1855
|
if (interactive) {
|
|
1831
1856
|
const { confirm, isCancel } = await terminal.prompts();
|
|
1832
|
-
const plan =
|
|
1857
|
+
const plan = entry === null ? `clone ${parsed.url} into org/${parsed.name}` : entry === parsed.name ? `adopt org/${parsed.name}` : `adopt org/${entry}, rename it org/${parsed.name}`;
|
|
1833
1858
|
const ok = await confirm({
|
|
1834
1859
|
message: `${plan}, declare scope "${parsed.name}" in rness.json, then sync?`
|
|
1835
1860
|
});
|
|
@@ -1842,7 +1867,7 @@ async function addCommand(spec, opts, deps = {}) {
|
|
|
1842
1867
|
const chosenHost = host;
|
|
1843
1868
|
let result = await ui.step(
|
|
1844
1869
|
{
|
|
1845
|
-
doing: `${present ? "adopting" : "cloning "} org/${parsed.name}`,
|
|
1870
|
+
doing: `${present ? "adopting" : "cloning "} org/${entry ?? parsed.name}`,
|
|
1846
1871
|
git: true
|
|
1847
1872
|
},
|
|
1848
1873
|
() => addRepository({
|
|
@@ -1855,7 +1880,10 @@ async function addCommand(spec, opts, deps = {}) {
|
|
|
1855
1880
|
scopes,
|
|
1856
1881
|
credentialsFor: () => credentials
|
|
1857
1882
|
}),
|
|
1858
|
-
(r) => [
|
|
1883
|
+
(r) => [
|
|
1884
|
+
r.action,
|
|
1885
|
+
r.renamed === null ? `org/${r.name}` : `org/${r.renamed} as org/${r.name}`
|
|
1886
|
+
]
|
|
1859
1887
|
);
|
|
1860
1888
|
const announced = /* @__PURE__ */ new Set();
|
|
1861
1889
|
printDeclared(ui, result, announced);
|
|
@@ -1926,12 +1954,13 @@ async function contextCommand(opts) {
|
|
|
1926
1954
|
const manifest = await loadManifest(ws.rnessDir);
|
|
1927
1955
|
let scope;
|
|
1928
1956
|
if (opts.scope !== void 0) {
|
|
1929
|
-
|
|
1957
|
+
const wanted = opts.scope.toLowerCase();
|
|
1958
|
+
if (!Object.hasOwn(manifest.scopes, wanted)) {
|
|
1930
1959
|
process.stderr.write(`unknown scope: ${opts.scope}
|
|
1931
1960
|
`);
|
|
1932
1961
|
return 1;
|
|
1933
1962
|
}
|
|
1934
|
-
scope =
|
|
1963
|
+
scope = wanted;
|
|
1935
1964
|
} else {
|
|
1936
1965
|
const rel = relative(ws.root, cwd).split(sep).join(posix.sep);
|
|
1937
1966
|
scope = resolveScope(manifest, rel);
|
|
@@ -4224,11 +4253,12 @@ async function context(cwd, args) {
|
|
|
4224
4253
|
let scope;
|
|
4225
4254
|
if (args["scope"] !== void 0) {
|
|
4226
4255
|
const known = Object.keys(manifest.scopes).sort();
|
|
4227
|
-
|
|
4256
|
+
const wanted = typeof args["scope"] === "string" ? args["scope"].toLowerCase() : null;
|
|
4257
|
+
if (wanted === null || !Object.hasOwn(manifest.scopes, wanted))
|
|
4228
4258
|
return refuse(
|
|
4229
4259
|
`unknown scope ${JSON.stringify(args["scope"])}; known: ${known.length === 0 ? "none" : known.join(", ")}`
|
|
4230
4260
|
);
|
|
4231
|
-
scope =
|
|
4261
|
+
scope = wanted;
|
|
4232
4262
|
} else
|
|
4233
4263
|
scope = resolveScope(
|
|
4234
4264
|
manifest,
|
|
@@ -4449,7 +4479,7 @@ function noteTool(cwd, githubApi) {
|
|
|
4449
4479
|
additionalProperties: false
|
|
4450
4480
|
},
|
|
4451
4481
|
call: (args) => guard(async () => {
|
|
4452
|
-
const { postNote } = await import("./note-
|
|
4482
|
+
const { postNote } = await import("./note-PANYS7DK.js");
|
|
4453
4483
|
const given = (key) => {
|
|
4454
4484
|
const value = args[key];
|
|
4455
4485
|
return typeof value === "string" ? value : void 0;
|
|
@@ -5309,7 +5339,7 @@ function noteCommandOf(parent, state, former) {
|
|
|
5309
5339
|
).addOption(new Option("--github-api <base>").hideHelp()).addOption(new Option("--cwd <dir>").hideHelp()).action(
|
|
5310
5340
|
async (text, opts) => {
|
|
5311
5341
|
if (former !== void 0) formerly(former, "rness note");
|
|
5312
|
-
const { noteCommand } = await import("./note-
|
|
5342
|
+
const { noteCommand } = await import("./note-PANYS7DK.js");
|
|
5313
5343
|
state.code = await noteCommand({
|
|
5314
5344
|
...opts,
|
|
5315
5345
|
...text === void 0 ? {} : { text }
|
|
@@ -5596,4 +5626,4 @@ export {
|
|
|
5596
5626
|
OWN_COMMANDS,
|
|
5597
5627
|
catchUp
|
|
5598
5628
|
};
|
|
5599
|
-
//# sourceMappingURL=chunk-
|
|
5629
|
+
//# sourceMappingURL=chunk-H5E6FMP6.js.map
|