@tablation/crew 0.64.0 → 0.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +78 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -13027,6 +13027,62 @@ function configuredRepos(text, route, base) {
|
|
|
13027
13027
|
const dir = m.get("dir");
|
|
13028
13028
|
return dir ? [{ name: basename7(String(dir)), dir: expandDir(String(dir), base) }] : [];
|
|
13029
13029
|
}
|
|
13030
|
+
function routeSetsHooks(text, route, name) {
|
|
13031
|
+
const m = routeMapOf(parseDocument(text), route);
|
|
13032
|
+
const repos = m.get("repos", true);
|
|
13033
|
+
let target = m;
|
|
13034
|
+
if (isMap(repos)) target = repos.get(name, true);
|
|
13035
|
+
if (!isMap(target)) return false;
|
|
13036
|
+
const hooks = target.get("hooks", true);
|
|
13037
|
+
return isMap(hooks) && hooks.items.length > 0;
|
|
13038
|
+
}
|
|
13039
|
+
function listRepoRows(i) {
|
|
13040
|
+
const checkouts = configuredRepos(i.text, i.route, i.base);
|
|
13041
|
+
const claimed = /* @__PURE__ */ new Set();
|
|
13042
|
+
const hooksSourceOf = (c) => i.exists(c.dir) && i.repoHasHooks(c.dir) ? "repo" : routeSetsHooks(i.text, i.route, c.name) ? "route" : "none";
|
|
13043
|
+
const originFor = (c, remote) => {
|
|
13044
|
+
const o = i.originOf(c.dir) ?? null;
|
|
13045
|
+
if (!o) return null;
|
|
13046
|
+
return remote !== null && normalizeRemote(o) === normalizeRemote(remote) ? null : o;
|
|
13047
|
+
};
|
|
13048
|
+
const rows = [];
|
|
13049
|
+
const names = i.resolved?.repoNames ?? {};
|
|
13050
|
+
const remotes = i.resolved?.repoRemotes ?? {};
|
|
13051
|
+
for (const [id, name] of Object.entries(names)) {
|
|
13052
|
+
const remote = remotes[id] ?? null;
|
|
13053
|
+
const want = normalizeRemote(remote);
|
|
13054
|
+
let idx = checkouts.findIndex((c2, n) => !claimed.has(n) && want !== void 0 && normalizeRemote(i.originOf(c2.dir)) === want);
|
|
13055
|
+
if (idx < 0) idx = checkouts.findIndex((c2, n) => !claimed.has(n) && c2.name === name);
|
|
13056
|
+
const c = idx >= 0 ? checkouts[idx] : void 0;
|
|
13057
|
+
if (idx >= 0) claimed.add(idx);
|
|
13058
|
+
rows.push({
|
|
13059
|
+
name,
|
|
13060
|
+
remote,
|
|
13061
|
+
repoRowId: id,
|
|
13062
|
+
attached: c !== void 0,
|
|
13063
|
+
dir: c?.dir ?? null,
|
|
13064
|
+
exists: c ? i.exists(c.dir) : false,
|
|
13065
|
+
origin: c ? originFor(c, remote) : null,
|
|
13066
|
+
matchedRow: c ? name : null,
|
|
13067
|
+
hooksSource: c ? hooksSourceOf(c) : "none"
|
|
13068
|
+
});
|
|
13069
|
+
}
|
|
13070
|
+
checkouts.forEach((c, n) => {
|
|
13071
|
+
if (claimed.has(n)) return;
|
|
13072
|
+
rows.push({
|
|
13073
|
+
name: c.name,
|
|
13074
|
+
remote: null,
|
|
13075
|
+
repoRowId: null,
|
|
13076
|
+
attached: true,
|
|
13077
|
+
dir: c.dir,
|
|
13078
|
+
exists: i.exists(c.dir),
|
|
13079
|
+
origin: originFor(c, null),
|
|
13080
|
+
matchedRow: null,
|
|
13081
|
+
hooksSource: hooksSourceOf(c)
|
|
13082
|
+
});
|
|
13083
|
+
});
|
|
13084
|
+
return rows;
|
|
13085
|
+
}
|
|
13030
13086
|
function planRepoAdd(i) {
|
|
13031
13087
|
const doc = parseDocument(i.text);
|
|
13032
13088
|
if (doc.errors.length > 0) throw new ReposError(`config is not valid YAML \u2014 ${doc.errors[0].message}`);
|
|
@@ -15416,7 +15472,7 @@ function usage() {
|
|
|
15416
15472
|
crew repos add [ROUTE] [NAME] [PATH] attach a local checkout to a route in crew.yaml (--dry-run previews)
|
|
15417
15473
|
crew repos clone [ROUTE] NAME clone a Repos row's remote into the route directory and attach it (--dir PATH, --dry-run, --json)
|
|
15418
15474
|
crew repos hooks [ROUTE] NAME suggest test/build hooks for a checkout (--agent, --write route|repo, --recipes, --json)
|
|
15419
|
-
crew repos list ROUTE the checkouts a route has, with the tracker's Repos row each matches
|
|
15475
|
+
crew repos list ROUTE the checkouts a route has, with the tracker's Repos row each matches (--json: every Repos row too)
|
|
15420
15476
|
crew logbook list [route] recent Agent Log entries, filterable by --role/--ticket
|
|
15421
15477
|
crew logbook show [route] ID [--prompt] one entry; --prompt reconstructs and verifies its prompt
|
|
15422
15478
|
crew passengers [route] sync Host Passengers containers/tunnels once; what the passengers unit invokes
|
|
@@ -17104,7 +17160,7 @@ ${changed2.map((c) => ` - ${c}
|
|
|
17104
17160
|
case "repos": {
|
|
17105
17161
|
const sub = positional[1];
|
|
17106
17162
|
const usage2 = () => {
|
|
17107
|
-
process.stderr.write("crew repos add [workspace/project] [name] [path] [--name N] [--project P] [--dry-run] [--no-create]\ncrew repos clone [workspace/project] <name> [--dir PATH] [--dry-run] [--json]\ncrew repos list <workspace/project
|
|
17163
|
+
process.stderr.write("crew repos add [workspace/project] [name] [path] [--name N] [--project P] [--dry-run] [--no-create]\ncrew repos clone [workspace/project] <name> [--dir PATH] [--dry-run] [--json]\ncrew repos list <workspace/project> [--json]\ncrew repos hooks [workspace/project] <name> [--suggest] [--agent] [--write route|repo] [--recipes ID,ID] [--json]\n");
|
|
17108
17164
|
process.exit(2);
|
|
17109
17165
|
};
|
|
17110
17166
|
if (sub !== "add" && sub !== "list" && sub !== "clone" && sub !== "hooks") usage2();
|
|
@@ -17254,6 +17310,26 @@ ${changed2.map((c) => ` - ${c}
|
|
|
17254
17310
|
const base = dirname19(cfg.configFile);
|
|
17255
17311
|
try {
|
|
17256
17312
|
if (sub === "list") {
|
|
17313
|
+
if (flag("json")) {
|
|
17314
|
+
const rows = listRepoRows({
|
|
17315
|
+
text,
|
|
17316
|
+
route: routeName,
|
|
17317
|
+
base,
|
|
17318
|
+
resolved: resolvedRemotes,
|
|
17319
|
+
originOf,
|
|
17320
|
+
exists: (d) => existsSync31(d),
|
|
17321
|
+
repoHasHooks: (d) => REPO_CONFIG_FILENAMES.some((f) => {
|
|
17322
|
+
try {
|
|
17323
|
+
return Object.keys(parseRepoConfig(readFileSync25(resolvePath(d, f), "utf8"), f).hooks).length > 0;
|
|
17324
|
+
} catch {
|
|
17325
|
+
return false;
|
|
17326
|
+
}
|
|
17327
|
+
})
|
|
17328
|
+
});
|
|
17329
|
+
process.stdout.write(`${JSON.stringify({ route: routeName, repos: rows })}
|
|
17330
|
+
`);
|
|
17331
|
+
break;
|
|
17332
|
+
}
|
|
17257
17333
|
const repos = configuredRepos(text, routeName, base);
|
|
17258
17334
|
if (repos.length === 0) process.stdout.write(`route ${routeName} has no checkout configured \u2014 \`crew repos add ${routeName} <path>\`
|
|
17259
17335
|
`);
|
package/package.json
CHANGED