barndog 0.1.0 → 0.2.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/README.md +11 -10
- package/dist/cli.js +11 -7
- package/dist/commands/add.js +33 -21
- package/dist/commands/arguments.js +12 -0
- package/dist/commands/asset-install.js +160 -0
- package/dist/commands/asset-list.js +121 -0
- package/dist/commands/asset-share.js +94 -0
- package/dist/commands/auth.js +4 -0
- package/dist/commands/availability.js +54 -26
- package/dist/commands/capabilities.js +71 -415
- package/dist/commands/collaboration.js +194 -110
- package/dist/commands/environment.js +18 -411
- package/dist/commands/github.js +200 -0
- package/dist/commands/helpers.js +39 -0
- package/dist/commands/hooks.js +87 -0
- package/dist/commands/init.js +4 -2
- package/dist/commands/knowledge.js +73 -0
- package/dist/commands/mcp.js +62 -0
- package/dist/commands/origin.js +21 -23
- package/dist/commands/people.js +51 -0
- package/dist/commands/sets.js +141 -0
- package/dist/commands/status.js +34 -24
- package/dist/commands/sync.js +11 -4
- package/dist/commands/workspace.js +33 -19
- package/dist/config/environment.js +13 -27
- package/dist/config/paths.js +62 -0
- package/dist/config/selection.js +30 -0
- package/dist/config/settings.js +97 -108
- package/dist/config/state.js +57 -57
- package/dist/entry/knowledge-startup.js +32 -0
- package/dist/entry/mcp-launch.js +71 -0
- package/dist/entry/opencode-plugin.js +62 -0
- package/dist/{features/git-workspace/startup.js → entry/workspace-startup.js} +7 -2
- package/dist/errors.js +198 -55
- package/dist/features/asset-kinds/index.js +120 -0
- package/dist/features/asset-selection/index.js +51 -19
- package/dist/features/auth/credentials.js +80 -47
- package/dist/features/auth/session.js +80 -45
- package/dist/features/auth/transport.js +66 -15
- package/dist/features/catalog/index.js +32 -61
- package/dist/features/collaboration/api.js +160 -0
- package/dist/features/collaboration/index.js +321 -233
- package/dist/features/collaboration/remote.js +35 -115
- package/dist/features/collaboration/results.js +2 -0
- package/dist/features/collaboration/workspace-git.js +233 -149
- package/dist/features/collaboration/workspace-github.js +117 -54
- package/dist/features/collaboration/workspace-store.js +140 -100
- package/dist/features/collaboration/workspace.js +257 -172
- package/dist/features/discovery/index.js +68 -57
- package/dist/features/doctor/index.js +32 -24
- package/dist/features/environment/auto-sync.js +28 -27
- package/dist/features/environment/names.js +67 -47
- package/dist/features/environment/operations.js +321 -228
- package/dist/features/environment/own-entries.js +89 -0
- package/dist/features/environment/settle-names.js +91 -0
- package/dist/features/environment/stage.js +178 -0
- package/dist/features/environment/sync.js +113 -484
- package/dist/features/environment/transaction.js +179 -147
- package/dist/features/environment/writes.js +196 -0
- package/dist/features/github/account.js +25 -0
- package/dist/features/github/connections.js +119 -0
- package/dist/features/github/pulls.js +118 -0
- package/dist/features/hooks/adapt.js +32 -25
- package/dist/features/hooks/catalog.js +28 -0
- package/dist/features/hooks/compatibility.js +49 -0
- package/dist/features/hooks/divergence.js +9 -6
- package/dist/features/hooks/test.js +74 -49
- package/dist/features/hooks/types.js +1 -0
- package/dist/features/imports/discover.js +134 -61
- package/dist/features/imports/folder.js +48 -14
- package/dist/features/imports/local.js +113 -134
- package/dist/features/imports/remote.js +44 -25
- package/dist/features/inspection/index.js +17 -17
- package/dist/features/inventory/index.js +99 -110
- package/dist/features/knowledge/index.js +69 -49
- package/dist/features/mcps/catalog.js +31 -0
- package/dist/features/mcps/import.js +316 -0
- package/dist/features/mcps/index.js +98 -49
- package/dist/features/migration/migrate.js +263 -0
- package/dist/features/{git-workspace → migration}/move.js +165 -109
- package/dist/features/migration/promote.js +24 -0
- package/dist/features/native/adapters.js +53 -94
- package/dist/features/native/configuration.js +128 -82
- package/dist/features/native/hook-shell.js +55 -0
- package/dist/features/native/plugin-module.js +56 -0
- package/dist/features/onboarding/environment.js +67 -34
- package/dist/features/onboarding/setup.js +43 -40
- package/dist/features/repositories/context.js +30 -13
- package/dist/features/server/catalog.js +58 -0
- package/dist/features/server/client.js +13 -0
- package/dist/features/server/connection.js +37 -0
- package/dist/features/server/origin.js +74 -0
- package/dist/features/server/pages.js +24 -0
- package/dist/features/skills/catalog.js +42 -0
- package/dist/features/workspace/assets.js +57 -0
- package/dist/features/workspace/cloud-source.js +34 -0
- package/dist/features/workspace/directory.js +38 -0
- package/dist/features/{git-workspace → workspace}/format.js +114 -51
- package/dist/features/workspace/git.js +214 -0
- package/dist/features/workspace/installed.js +92 -0
- package/dist/features/{git-workspace → workspace}/overlay.js +43 -23
- package/dist/features/workspace/packages.js +160 -0
- package/dist/features/{git-workspace → workspace}/publish.js +120 -64
- package/dist/features/workspace/repo-source.js +192 -0
- package/dist/features/{git-workspace → workspace}/setup.js +60 -42
- package/dist/features/{git-workspace → workspace}/snapshot.js +53 -18
- package/dist/features/workspace/source.js +1 -0
- package/dist/features/workspace/tree.js +52 -0
- package/dist/features/workspace/workspace-source.js +27 -0
- package/dist/harnesses/claude.js +23 -1
- package/dist/harnesses/codex.js +57 -1
- package/dist/harnesses/cursor.js +22 -1
- package/dist/harnesses/detect.js +6 -50
- package/dist/harnesses/formats.js +45 -0
- package/dist/harnesses/opencode.js +111 -0
- package/dist/harnesses/registry.js +35 -2
- package/dist/platform.js +375 -0
- package/dist/program.js +225 -54
- package/dist/runtime.js +1 -0
- package/dist/shared/cli-error.js +22 -0
- package/dist/shared/constants.js +32 -0
- package/dist/shared/files.js +72 -0
- package/dist/shared/lock.js +49 -0
- package/dist/shared/lookup.js +11 -0
- package/dist/shared/patterns.js +94 -0
- package/dist/shared/shell.js +22 -0
- package/dist/shared/values.js +26 -0
- package/dist/ui/add-asset.js +41 -400
- package/dist/ui/add-hook.js +213 -0
- package/dist/ui/add-mcp.js +107 -0
- package/dist/ui/add-prompts.js +47 -0
- package/dist/ui/add-skills.js +115 -0
- package/dist/ui/asset-list.js +31 -13
- package/dist/ui/assets.js +33 -44
- package/dist/ui/auth.js +43 -33
- package/dist/ui/clash.js +11 -6
- package/dist/ui/collaboration.js +116 -44
- package/dist/ui/connection.js +10 -4
- package/dist/ui/decision-error.js +24 -0
- package/dist/ui/environment-onboarding.js +35 -13
- package/dist/ui/format.js +66 -18
- package/dist/ui/hook-compatibility.js +14 -6
- package/dist/ui/mcp.js +28 -3
- package/dist/ui/move.js +10 -5
- package/dist/ui/onboarding.js +113 -73
- package/dist/ui/options.js +9 -0
- package/dist/ui/output.js +106 -43
- package/dist/ui/pick.js +45 -33
- package/dist/ui/scope-install.js +15 -7
- package/dist/ui/selection.js +15 -11
- package/dist/ui/theme.js +37 -14
- package/dist/version.js +6 -3
- package/package.json +24 -11
- package/dist/features/capabilities/index.js +0 -106
- package/dist/features/collaboration/domain.js +0 -90
- package/dist/features/environment/cloud-source.js +0 -27
- package/dist/features/environment/installed.js +0 -124
- package/dist/features/environment/packages.js +0 -120
- package/dist/features/environment/remote.js +0 -71
- package/dist/features/environment/workspace-source.js +0 -19
- package/dist/features/git-hosts/index.js +0 -148
- package/dist/features/git-workspace/assets.js +0 -71
- package/dist/features/git-workspace/git.js +0 -135
- package/dist/features/git-workspace/migrate.js +0 -188
- package/dist/features/git-workspace/source.js +0 -159
- package/dist/features/imports/mcp.js +0 -219
- package/dist/features/knowledge/startup.js +0 -25
- package/dist/features/native/mcp-launch.js +0 -57
- package/dist/features/skills/install.js +0 -25
- package/dist/features/skills/remote.js +0 -177
- package/dist/features/skills/sync.js +0 -121
- package/dist/features/skills/validation.js +0 -34
- /package/dist/features/environment/{source.js → events.js} +0 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/** `barndog hooks add`: brings Hooks from a repository into the local workspace. */
|
|
2
|
+
import { GIT_MODE } from "../features/workspace/snapshot.js";
|
|
3
|
+
import { basename } from "node:path";
|
|
4
|
+
import { CliError } from "../errors.js";
|
|
5
|
+
import { adapters, hookHarnesses, isHookHarness, } from "../harnesses/registry.js";
|
|
6
|
+
import { buildHookPackage, discoverHooks, plainCommand, } from "../features/imports/discover.js";
|
|
7
|
+
import { adaptHook, toolNames } from "../features/hooks/adapt.js";
|
|
8
|
+
import { folderDivergence } from "../features/hooks/divergence.js";
|
|
9
|
+
import { LOCAL_ORIGIN } from "../features/workspace/overlay.js";
|
|
10
|
+
import { saveImported } from "../features/imports/local.js";
|
|
11
|
+
import { assertSourceExists, plainFolder } from "../features/imports/folder.js";
|
|
12
|
+
import { fetchRemote, parseLocation } from "../features/imports/remote.js";
|
|
13
|
+
import { bold, dim, ok, warn } from "./format.js";
|
|
14
|
+
import { setYamlName, slugify } from "../shared/patterns.js";
|
|
15
|
+
import { only } from "../shared/lookup.js";
|
|
16
|
+
import { assertDistinctNames, finish, folderLabel, notFound, onlyChosen, updateMode, } from "./add-asset.js";
|
|
17
|
+
/** Scripts with no settings anywhere: the person says which tools and events run them. */
|
|
18
|
+
async function pickHookPlan(draft, executable, context) {
|
|
19
|
+
const { prompts } = context;
|
|
20
|
+
// Choices made for one coding tool start out selected for the next.
|
|
21
|
+
const carried = new Map();
|
|
22
|
+
const chosen = (await prompts.chooseMany("Which coding tools should this Hook support?", hookHarnesses.map((h) => ({ name: adapters[h].name, value: h })))).filter(isHookHarness);
|
|
23
|
+
const plan = {};
|
|
24
|
+
for (const harness of chosen) {
|
|
25
|
+
const known = adapters[harness].hooks.events;
|
|
26
|
+
const events = await prompts.chooseMany(`${adapters[harness].name}: which events should run it?`, known.map(({ name }) => ({
|
|
27
|
+
name,
|
|
28
|
+
value: name,
|
|
29
|
+
checked: carried.has(name.toLowerCase()),
|
|
30
|
+
})));
|
|
31
|
+
const drafts = [];
|
|
32
|
+
for (const event of events) {
|
|
33
|
+
const script = only(draft.scripts) ??
|
|
34
|
+
(await prompts.chooseOne(`${adapters[harness].name} ${event}: which script?`, draft.scripts.map((s) => ({ name: s, value: s })), carried.get(event.toLowerCase())?.script));
|
|
35
|
+
const hint = known.find((e) => e.name === event)?.matcher;
|
|
36
|
+
const matcher = hint
|
|
37
|
+
? (await prompts.text(`${event} matcher (${hint})`, "")).trim() ||
|
|
38
|
+
undefined
|
|
39
|
+
: undefined;
|
|
40
|
+
const picked = {
|
|
41
|
+
event,
|
|
42
|
+
matcher,
|
|
43
|
+
script,
|
|
44
|
+
command: plainCommand(script, executable(script)),
|
|
45
|
+
};
|
|
46
|
+
drafts.push(picked);
|
|
47
|
+
carried.set(event.toLowerCase(), picked);
|
|
48
|
+
}
|
|
49
|
+
if (drafts.length) {
|
|
50
|
+
plan[harness] = drafts;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return plan;
|
|
54
|
+
}
|
|
55
|
+
/** The packaged Hooks to add: named by `--only`, all of them, or ticked in a picker. */
|
|
56
|
+
async function choosePackages(packages, url, options, context) {
|
|
57
|
+
let chosen = packages;
|
|
58
|
+
if (options.only?.length) {
|
|
59
|
+
chosen = onlyChosen(packages, options.only, { url, kind: "hook" });
|
|
60
|
+
}
|
|
61
|
+
else if (packages.length > 1 && !options.all) {
|
|
62
|
+
if (!context.interactive) {
|
|
63
|
+
throw new CliError(`${url} has ${packages.length} Hooks: ${packages.map((p) => p.name).join(", ")}.`, `barndog hooks add ${url} --only <name>`);
|
|
64
|
+
}
|
|
65
|
+
const picked = await context.prompts.chooseMany("Which Hooks do you want?", packages.map((p) => ({
|
|
66
|
+
name: `${p.name} ${dim(folderLabel(p.root))}`,
|
|
67
|
+
value: p.root,
|
|
68
|
+
short: p.name,
|
|
69
|
+
description: `Description: ${p.description}`,
|
|
70
|
+
})));
|
|
71
|
+
chosen = packages.filter((p) => picked.includes(p.root));
|
|
72
|
+
}
|
|
73
|
+
if (!chosen.length) {
|
|
74
|
+
throw new CliError("No Hooks were chosen, so nothing was added.");
|
|
75
|
+
}
|
|
76
|
+
assertDistinctNames(chosen, { url, kind: "hook" });
|
|
77
|
+
if (options.as && chosen.length !== 1) {
|
|
78
|
+
throw new CliError("--as renames one Hook, so choose exactly one.");
|
|
79
|
+
}
|
|
80
|
+
return chosen;
|
|
81
|
+
}
|
|
82
|
+
/** Says which of this machine's coding tools a new Hook leaves out, with one prompt for all. */
|
|
83
|
+
async function reportCoverage(name, folder, context) {
|
|
84
|
+
const divergence = await folderDivergence(folder);
|
|
85
|
+
if (divergence) {
|
|
86
|
+
context.write(`${warn("!")} ${divergence}`);
|
|
87
|
+
}
|
|
88
|
+
const { written, targets, prompt } = await adaptHook(name, LOCAL_ORIGIN, undefined, context.runtime);
|
|
89
|
+
if (!prompt) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
context.write(`${warn("!")} ${bold(name)} was written for ${toolNames(written)}. It won't run in ${toolNames(targets, "or")}: BarnDog doesn't adapt Hooks between coding tools.`);
|
|
93
|
+
context.write(dim(" An AI agent can check whether it can be adapted. Give it this:"));
|
|
94
|
+
context.write("");
|
|
95
|
+
context.write(prompt);
|
|
96
|
+
context.write("");
|
|
97
|
+
context.write(dim(` Print it again: barndog hooks adapt ${name} --origin ${LOCAL_ORIGIN}`));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* `hooks add <url>`: copies a Hook package, or a draft built from harness
|
|
101
|
+
* settings, into the local workspace.
|
|
102
|
+
*/
|
|
103
|
+
export async function addHook(url, options, context) {
|
|
104
|
+
assertSourceExists(url, context.runtime);
|
|
105
|
+
if (await plainFolder(url, context.runtime)) {
|
|
106
|
+
throw new CliError(`${url} isn't a Git repo, and Hooks can only be added from one for now.`, "git init, commit the Hook, then run barndog hooks add again");
|
|
107
|
+
}
|
|
108
|
+
const location = parseLocation(url);
|
|
109
|
+
const fallback = slugify(basename(url.replace(/\/$/, "").replace(/\.git$/, ""))) || "hook";
|
|
110
|
+
await fetchRemote(location, { allowPrompt: true }, async (remote) => {
|
|
111
|
+
const { candidates, skipped } = discoverHooks(remote, fallback);
|
|
112
|
+
for (const skip of skipped) {
|
|
113
|
+
context.write(`${warn("!")} ${skip.path}: ${skip.reason}`);
|
|
114
|
+
}
|
|
115
|
+
const packages = candidates.flatMap((c) => c.type === "package" ? [c] : []);
|
|
116
|
+
if (packages.length) {
|
|
117
|
+
const chosen = await choosePackages(packages, url, options, context);
|
|
118
|
+
const mode = await updateMode(options, context);
|
|
119
|
+
for (const candidate of chosen) {
|
|
120
|
+
const name = options.as ?? candidate.name;
|
|
121
|
+
const entries = candidate.entries.map((entry) => entry.path === "hook.yaml" && name !== candidate.name
|
|
122
|
+
? {
|
|
123
|
+
...entry,
|
|
124
|
+
data: Buffer.from(setYamlName(entry.data.toString("utf8"), name)),
|
|
125
|
+
}
|
|
126
|
+
: entry);
|
|
127
|
+
const saved = await saveImported({ kind: "hook", name, entries, mode, remote, root: candidate.root }, context.runtime);
|
|
128
|
+
context.write(`${ok("✔")} Added ${bold(name)}`);
|
|
129
|
+
await reportCoverage(name, saved.path, context);
|
|
130
|
+
}
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const [candidate] = candidates.flatMap((c) => c.type === "draft" ? [c] : []);
|
|
134
|
+
if (!candidate) {
|
|
135
|
+
throw notFound(remote, url, "Hook");
|
|
136
|
+
}
|
|
137
|
+
// A draft is built from loose scripts and settings, so it has no name to choose by.
|
|
138
|
+
if (options.only?.length) {
|
|
139
|
+
throw new CliError(`${url} has no packaged Hooks to choose from, only scripts and settings to build one from.`, `barndog hooks add ${url}`);
|
|
140
|
+
}
|
|
141
|
+
const mode = await updateMode(options, context);
|
|
142
|
+
const modes = new Map(remote.snapshot.entries.map((e) => [e.path, e.mode]));
|
|
143
|
+
const executable = (script) => modes.get(script) === GIT_MODE.executable;
|
|
144
|
+
// Settings the author shipped answer every question, and no other tool is offered.
|
|
145
|
+
const written = hookHarnesses.filter((h) => candidate.implementations[h]?.length);
|
|
146
|
+
let plan;
|
|
147
|
+
if (written.length) {
|
|
148
|
+
const chosen = context.interactive && written.length > 1
|
|
149
|
+
? (await context.prompts.chooseMany("Which coding tools should this Hook support?", written.map((h) => ({
|
|
150
|
+
name: `${adapters[h].name} ${dim(`found in this ${remote.path ? "folder" : "repo"}`)}`,
|
|
151
|
+
short: adapters[h].name,
|
|
152
|
+
value: h,
|
|
153
|
+
checked: true,
|
|
154
|
+
})))).filter(isHookHarness)
|
|
155
|
+
: written;
|
|
156
|
+
const { implementations } = candidate;
|
|
157
|
+
plan = Object.fromEntries(chosen.map((h) => [h, implementations[h] ?? []]));
|
|
158
|
+
}
|
|
159
|
+
else if (context.interactive) {
|
|
160
|
+
plan = await pickHookPlan(candidate, executable, context);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
throw new CliError("These scripts need events chosen for each coding tool. Run this in a terminal to choose them.");
|
|
164
|
+
}
|
|
165
|
+
if (!Object.values(plan).some((events) => events?.length)) {
|
|
166
|
+
throw new CliError("No events were chosen, so nothing was added.");
|
|
167
|
+
}
|
|
168
|
+
const name = options.as ??
|
|
169
|
+
(context.interactive
|
|
170
|
+
? (await context.prompts.text("Hook name", candidate.name)).trim()
|
|
171
|
+
: candidate.name);
|
|
172
|
+
const description = options.description ??
|
|
173
|
+
(context.interactive
|
|
174
|
+
? (await context.prompts.text("What does it do?", `Hook from ${remote.url}`)).trim()
|
|
175
|
+
: `Hook from ${remote.url}`);
|
|
176
|
+
const built = buildHookPackage(remote, {
|
|
177
|
+
name,
|
|
178
|
+
description,
|
|
179
|
+
implementations: plan,
|
|
180
|
+
});
|
|
181
|
+
context.write(dim("These commands will run on this machine:"));
|
|
182
|
+
for (const [harness, events] of Object.entries(plan)) {
|
|
183
|
+
for (const event of events ?? []) {
|
|
184
|
+
context.write(dim(` ${harness} ${event.event}${event.matcher ? ` (${event.matcher})` : ""} ${event.script}`));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (context.interactive &&
|
|
188
|
+
!(await context.prompts.yes("Add this Hook?"))) {
|
|
189
|
+
throw new CliError("Nothing was added.");
|
|
190
|
+
}
|
|
191
|
+
const saved = await saveImported({
|
|
192
|
+
kind: "hook",
|
|
193
|
+
name,
|
|
194
|
+
entries: built.entries,
|
|
195
|
+
mode,
|
|
196
|
+
remote,
|
|
197
|
+
root: built.root,
|
|
198
|
+
files: built.files,
|
|
199
|
+
}, context.runtime);
|
|
200
|
+
context.write(`${ok("✔")} Added ${bold(name)}`);
|
|
201
|
+
for (const harness of hookHarnesses) {
|
|
202
|
+
const { trustNote } = adapters[harness].hooks;
|
|
203
|
+
if (trustNote && plan[harness]?.length) {
|
|
204
|
+
context.write(dim(trustNote));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// Scripts placed by hand were given their tools on purpose.
|
|
208
|
+
if (written.length) {
|
|
209
|
+
await reportCoverage(name, saved.path, context);
|
|
210
|
+
}
|
|
211
|
+
}, context.runtime);
|
|
212
|
+
await finish(context);
|
|
213
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/** `barndog mcp add`: brings MCP servers from JSON or a coding tool into the local workspace. */
|
|
2
|
+
import { localPath } from "../platform.js";
|
|
3
|
+
import { CliError } from "../errors.js";
|
|
4
|
+
import { addMcpServers, conflictingEntries, convertServer, harnessServers, parseMcpText, } from "../features/mcps/import.js";
|
|
5
|
+
import { readFile } from "node:fs/promises";
|
|
6
|
+
import { bold, dim, ok, warn } from "./format.js";
|
|
7
|
+
async function serversToAdd(name, options, context) {
|
|
8
|
+
if (options.config) {
|
|
9
|
+
return parseMcpText(options.config, name);
|
|
10
|
+
}
|
|
11
|
+
if (options.file) {
|
|
12
|
+
return parseMcpText(await readFile(localPath(options.file, context.runtime), "utf8"), name);
|
|
13
|
+
}
|
|
14
|
+
const fromHarness = async () => {
|
|
15
|
+
const all = (await harnessServers(context.runtime)).filter((s) => !options.from || s.harness === options.from);
|
|
16
|
+
const matching = name ? all.filter((s) => s.name === name) : all;
|
|
17
|
+
const listed = (servers) => servers.map((s) => `${s.name} (${s.label})`).join(", ");
|
|
18
|
+
if (!matching.length) {
|
|
19
|
+
throw new CliError(name && all.length
|
|
20
|
+
? `No MCP server named ${name} in your coding tools. They have ${listed(all)}.`
|
|
21
|
+
: "No MCP servers found in your coding tools that BarnDog doesn't already manage.");
|
|
22
|
+
}
|
|
23
|
+
if (name && matching.length === 1) {
|
|
24
|
+
return matching;
|
|
25
|
+
}
|
|
26
|
+
if (!context.interactive) {
|
|
27
|
+
throw new CliError(matching.length === 1
|
|
28
|
+
? `Name the MCP server to add: ${listed(matching)}.`
|
|
29
|
+
: `Several servers match: ${listed(matching)}.`, "barndog mcp add <name> --from <harness>");
|
|
30
|
+
}
|
|
31
|
+
const picked = await context.prompts.chooseMany("Which MCP servers do you want to add?", matching.map((s, i) => ({
|
|
32
|
+
name: `${s.name} ${dim(s.label)}`,
|
|
33
|
+
value: String(i),
|
|
34
|
+
})));
|
|
35
|
+
return picked.flatMap((i) => matching[Number(i)] ?? []);
|
|
36
|
+
};
|
|
37
|
+
if (options.from) {
|
|
38
|
+
return fromHarness();
|
|
39
|
+
}
|
|
40
|
+
if (!context.interactive) {
|
|
41
|
+
if (process.stdin.isTTY) {
|
|
42
|
+
throw new CliError("Pass the configuration with --config, --file or --from, or pipe it in.", "barndog mcp add --file <path>");
|
|
43
|
+
}
|
|
44
|
+
let text = "";
|
|
45
|
+
for await (const chunk of process.stdin) {
|
|
46
|
+
text += chunk;
|
|
47
|
+
}
|
|
48
|
+
return parseMcpText(text, name);
|
|
49
|
+
}
|
|
50
|
+
const source = await context.prompts.chooseOne("Where's the configuration?", [
|
|
51
|
+
{ name: "Paste JSON", value: "paste" },
|
|
52
|
+
{ name: "One of my coding tools", value: "harness" },
|
|
53
|
+
]);
|
|
54
|
+
return source === "paste"
|
|
55
|
+
? parseMcpText(await context.prompts.paste(), name)
|
|
56
|
+
: fromHarness();
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* `mcp add`: imports MCP servers from a harness's configuration or pasted JSON
|
|
60
|
+
* into the local workspace.
|
|
61
|
+
*/
|
|
62
|
+
export async function addMcp(name, options, context) {
|
|
63
|
+
// `--json` is the global output flag, so this catches the old spelling.
|
|
64
|
+
if (name?.trimStart().startsWith("{")) {
|
|
65
|
+
throw new CliError("That looks like the configuration, not a name.", "barndog mcp add <name> --config '<json>'");
|
|
66
|
+
}
|
|
67
|
+
const imported = await serversToAdd(name, options, context);
|
|
68
|
+
const oauth = new Set();
|
|
69
|
+
for (const { name: server, server: raw } of imported) {
|
|
70
|
+
if (options.oauth ||
|
|
71
|
+
(context.interactive &&
|
|
72
|
+
(raw.url || raw.httpUrl) &&
|
|
73
|
+
!raw.headers &&
|
|
74
|
+
!raw.http_headers &&
|
|
75
|
+
!raw.env_http_headers &&
|
|
76
|
+
!raw.bearer_token_env_var &&
|
|
77
|
+
(await context.prompts.yes(`Does ${server} sign in through a browser (OAuth)?`, false)))) {
|
|
78
|
+
oauth.add(server);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const servers = imported.map((server) => convertServer(server, options.description, oauth.has(server.name)));
|
|
82
|
+
if (!servers.length) {
|
|
83
|
+
throw new CliError("No MCP servers were chosen, so nothing was added.");
|
|
84
|
+
}
|
|
85
|
+
let replace = options.replace;
|
|
86
|
+
const conflicts = (await Promise.all(servers.map((s) => conflictingEntries(s.name, context.runtime)))).flat();
|
|
87
|
+
if (conflicts.length && !replace && context.interactive) {
|
|
88
|
+
context.write("These entries will be replaced by BarnDog-managed ones. A backup of each file is kept:");
|
|
89
|
+
for (const conflict of conflicts) {
|
|
90
|
+
context.write(dim(` ${conflict.file}`));
|
|
91
|
+
}
|
|
92
|
+
replace = await context.prompts.yes("Replace them?");
|
|
93
|
+
if (!replace) {
|
|
94
|
+
throw new CliError("Nothing was added.");
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const result = await addMcpServers(servers, { replace }, context.runtime);
|
|
98
|
+
for (const added of result.added) {
|
|
99
|
+
context.write(`${ok("✔")} Added ${bold(added)}`);
|
|
100
|
+
}
|
|
101
|
+
for (const note of result.notes) {
|
|
102
|
+
context.write(`${warn("!")} ${note}`);
|
|
103
|
+
}
|
|
104
|
+
for (const backup of result.backups) {
|
|
105
|
+
context.write(dim(`Backup: ${backup}`));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** The questions the add commands ask in a terminal; tests supply their own answers. */
|
|
2
|
+
import checkbox from "@inquirer/checkbox";
|
|
3
|
+
import confirm from "@inquirer/confirm";
|
|
4
|
+
import input from "@inquirer/input";
|
|
5
|
+
import select from "@inquirer/select";
|
|
6
|
+
import { createInterface } from "node:readline";
|
|
7
|
+
import { dim } from "./format.js";
|
|
8
|
+
import { checkboxTheme, promptTheme } from "./theme.js";
|
|
9
|
+
/** Reads pasted lines until they form complete JSON, so nobody has to press Ctrl+D. */
|
|
10
|
+
function pasteJson(write) {
|
|
11
|
+
write(dim("Paste the JSON. It's read as soon as it's complete."));
|
|
12
|
+
return new Promise((resolve) => {
|
|
13
|
+
const lines = [];
|
|
14
|
+
const reader = createInterface({ input: process.stdin });
|
|
15
|
+
reader.on("line", (line) => {
|
|
16
|
+
lines.push(line);
|
|
17
|
+
try {
|
|
18
|
+
JSON.parse(lines.join("\n"));
|
|
19
|
+
reader.close();
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// Not complete yet.
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
reader.on("close", () => resolve(lines.join("\n")));
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export const terminalPrompts = (write) => ({
|
|
29
|
+
chooseMany: (message, choices) => checkbox({
|
|
30
|
+
message,
|
|
31
|
+
choices,
|
|
32
|
+
pageSize: 12,
|
|
33
|
+
loop: false,
|
|
34
|
+
theme: checkboxTheme,
|
|
35
|
+
}),
|
|
36
|
+
chooseOne: (message, choices, fallback) => select({
|
|
37
|
+
message,
|
|
38
|
+
choices,
|
|
39
|
+
default: fallback,
|
|
40
|
+
pageSize: 12,
|
|
41
|
+
loop: false,
|
|
42
|
+
theme: promptTheme,
|
|
43
|
+
}),
|
|
44
|
+
text: (message, fallback) => input({ message, default: fallback, theme: promptTheme }),
|
|
45
|
+
yes: (message, fallback = true) => confirm({ message, default: fallback, theme: promptTheme }),
|
|
46
|
+
paste: () => pasteJson(write),
|
|
47
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { CliError } from "../errors.js";
|
|
3
|
+
import { discoverSkills, } from "../features/imports/discover.js";
|
|
4
|
+
import { renamedSkill, saveImported } from "../features/imports/local.js";
|
|
5
|
+
import { assertSourceExists, plainFolder, readFolder, removeImported, } from "../features/imports/folder.js";
|
|
6
|
+
import { fetchRemote, parseLocation, } from "../features/imports/remote.js";
|
|
7
|
+
import { bold, dim, ok, warn } from "./format.js";
|
|
8
|
+
import { defined } from "../shared/lookup.js";
|
|
9
|
+
import { finish, folderLabel, assertDistinctNames, notFound, onlyChosen, updateMode, } from "./add-asset.js";
|
|
10
|
+
/** Stops two copies of a Skill from claiming the same name, saying which folders hold them. */
|
|
11
|
+
/** A plain folder is read in place; everything else is fetched with Git. */
|
|
12
|
+
async function withSkillSource(source, folder, runtime, use) {
|
|
13
|
+
if (folder) {
|
|
14
|
+
return use(await readFolder(folder, runtime));
|
|
15
|
+
}
|
|
16
|
+
return fetchRemote(parseLocation(source), { allowPrompt: true }, use, runtime);
|
|
17
|
+
}
|
|
18
|
+
function assertFolderOptions(options, folder) {
|
|
19
|
+
if (!folder && (options.copy || options.move)) {
|
|
20
|
+
throw new CliError(`--${options.copy ? "copy" : "move"} only applies when adding from a local folder.`);
|
|
21
|
+
}
|
|
22
|
+
if (folder && options.updates && options.updates !== "fork") {
|
|
23
|
+
throw new CliError("A plain folder has no history to update from, so --updates doesn't apply.", "barndog skills add <folder> --copy");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function folderTransfer(count, options, context) {
|
|
27
|
+
if (options.move) {
|
|
28
|
+
return "move";
|
|
29
|
+
}
|
|
30
|
+
if (options.copy || !context.interactive) {
|
|
31
|
+
return "copy";
|
|
32
|
+
}
|
|
33
|
+
return context.prompts.chooseOne(`Copy or move ${count === 1 ? "it" : "them"} into your workspace?`, [
|
|
34
|
+
{
|
|
35
|
+
name: "Copy",
|
|
36
|
+
value: "copy",
|
|
37
|
+
description: "Leaves the original where it is. Later edits to it won't carry over.",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "Move",
|
|
41
|
+
value: "move",
|
|
42
|
+
description: "Deletes the imported files from the original folder once they're in your workspace.",
|
|
43
|
+
},
|
|
44
|
+
], "copy");
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* `skills add <url>`: copies Skills from a repository, a harness folder or a
|
|
48
|
+
* plain folder into the local workspace.
|
|
49
|
+
*/
|
|
50
|
+
export async function addSkills(url, options, context) {
|
|
51
|
+
assertSourceExists(url, context.runtime);
|
|
52
|
+
const folder = await plainFolder(url, context.runtime);
|
|
53
|
+
assertFolderOptions(options, folder);
|
|
54
|
+
await withSkillSource(url, folder, context.runtime, async (remote) => {
|
|
55
|
+
const { skills, skipped } = discoverSkills(remote);
|
|
56
|
+
for (const skip of skipped) {
|
|
57
|
+
context.write(`${warn("!")} ${skip.path}: ${skip.reason}`);
|
|
58
|
+
}
|
|
59
|
+
if (!skills.length) {
|
|
60
|
+
throw notFound(remote, url, "Skill");
|
|
61
|
+
}
|
|
62
|
+
const repeated = (name) => skills.filter((s) => s.name === name).length > 1;
|
|
63
|
+
const distinctName = (s) => repeated(s.name) ? `${s.name} (${folderLabel(s.root)})` : s.name;
|
|
64
|
+
let chosen = skills;
|
|
65
|
+
const { only } = options;
|
|
66
|
+
if (only?.length) {
|
|
67
|
+
chosen = onlyChosen(skills, only, { url, kind: "skill" });
|
|
68
|
+
}
|
|
69
|
+
else if (skills.length > 1 && !options.all) {
|
|
70
|
+
if (!context.interactive) {
|
|
71
|
+
throw new CliError(`${url} has ${skills.length} Skills: ${skills.map(distinctName).join(", ")}.`, "barndog skills add <url> --only <name or folder>");
|
|
72
|
+
}
|
|
73
|
+
const picked = await context.prompts.chooseMany("Which Skills do you want?", skills.map((s) => ({
|
|
74
|
+
name: `${s.name} ${dim(folderLabel(s.root))}`,
|
|
75
|
+
value: s.root,
|
|
76
|
+
short: distinctName(s),
|
|
77
|
+
description: `Description: ${s.description}`,
|
|
78
|
+
})));
|
|
79
|
+
chosen = skills.filter((s) => picked.includes(s.root));
|
|
80
|
+
}
|
|
81
|
+
if (!chosen.length) {
|
|
82
|
+
throw new CliError("No Skills were chosen, so nothing was added.");
|
|
83
|
+
}
|
|
84
|
+
assertDistinctNames(chosen, { url, kind: "skill" });
|
|
85
|
+
if (options.as && chosen.length !== 1) {
|
|
86
|
+
throw new CliError("--as renames one Skill, so choose exactly one.");
|
|
87
|
+
}
|
|
88
|
+
const transfer = folder
|
|
89
|
+
? await folderTransfer(chosen.length, options, context)
|
|
90
|
+
: null;
|
|
91
|
+
const mode = folder ? "fork" : await updateMode(options, context);
|
|
92
|
+
for (const skill of chosen) {
|
|
93
|
+
const name = options.as ?? skill.name;
|
|
94
|
+
await saveImported({
|
|
95
|
+
kind: "skill",
|
|
96
|
+
name,
|
|
97
|
+
entries: renamedSkill(skill, name),
|
|
98
|
+
mode,
|
|
99
|
+
remote,
|
|
100
|
+
root: skill.root,
|
|
101
|
+
}, context.runtime);
|
|
102
|
+
if (transfer !== "move") {
|
|
103
|
+
context.write(`${ok("✔")} Added ${bold(name)}`);
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
const original = join(defined(folder, "Only a local folder can be moved"), skill.root);
|
|
107
|
+
const gone = await removeImported(original, skill.entries);
|
|
108
|
+
context.write(`${ok("✔")} Moved ${bold(name)} into your workspace`);
|
|
109
|
+
if (!gone) {
|
|
110
|
+
context.write(dim(` ${original} has other files, so it was left in place.`));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
await finish(context);
|
|
115
|
+
}
|
package/dist/ui/asset-list.js
CHANGED
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
import { InvalidArgumentError } from "commander";
|
|
2
|
-
import { originLabel } from "../features/
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { originLabel } from "../features/server/origin.js";
|
|
3
|
+
import { positiveInteger } from "./options.js";
|
|
4
|
+
import { CliError } from "../errors.js";
|
|
5
|
+
/** BarnDog catalog pagination permits at most one hundred results. */
|
|
6
|
+
const MAX_PAGE_SIZE = 100;
|
|
7
|
+
/** Show twenty catalog results per page by default. */
|
|
8
|
+
const DEFAULT_PAGE_SIZE = 20;
|
|
9
|
+
/**
|
|
10
|
+
* Adds origin, paging and optional search flags to a Commander command,
|
|
11
|
+
* mutating and returning it.
|
|
12
|
+
*/
|
|
8
13
|
export function assetListOptions(command, withSearch = true) {
|
|
9
|
-
if (withSearch)
|
|
14
|
+
if (withSearch) {
|
|
10
15
|
command.option("--search <keywords>", "Search names, descriptions and origins");
|
|
16
|
+
}
|
|
11
17
|
return pageOptions(command.option("--origin <origin>", "Filter by scope, such as org, team/engineering, repo/web-app or dev/john"));
|
|
12
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Adds positive page and limit flags to a command; defaults are page 1 and 20
|
|
21
|
+
* rows, with a 100-row maximum.
|
|
22
|
+
*/
|
|
13
23
|
export function pageOptions(command) {
|
|
14
|
-
return command
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
return command
|
|
25
|
+
.option("--page <number>", "Results page", positiveInteger, 1)
|
|
26
|
+
.option("--limit <number>", "Results per page (maximum 100)", (value) => {
|
|
27
|
+
const count = positiveInteger(value);
|
|
28
|
+
if (count > MAX_PAGE_SIZE) {
|
|
17
29
|
throw new InvalidArgumentError("Use at most 100 results per page");
|
|
30
|
+
}
|
|
18
31
|
return count;
|
|
19
|
-
},
|
|
32
|
+
}, DEFAULT_PAGE_SIZE);
|
|
20
33
|
}
|
|
21
34
|
/** Rows that match the search words and origin, in display order. */
|
|
22
35
|
export function filterAssets(rows, options) {
|
|
@@ -36,11 +49,16 @@ export function filterAssets(rows, options) {
|
|
|
36
49
|
(a.origin.slug ?? "").localeCompare(b.origin.slug ?? "") ||
|
|
37
50
|
a.id.localeCompare(b.id));
|
|
38
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Filters and slices rows using one-based paging, returning totals and at least
|
|
54
|
+
* one page even for empty results.
|
|
55
|
+
*/
|
|
39
56
|
export function assetPage(rows, options) {
|
|
40
57
|
const filtered = filterAssets(rows, options);
|
|
41
58
|
const start = (options.page - 1) * options.limit;
|
|
42
|
-
if (!Number.isSafeInteger(start))
|
|
43
|
-
throw new
|
|
59
|
+
if (!Number.isSafeInteger(start)) {
|
|
60
|
+
throw new CliError("That --page number is too large. Use a smaller one.");
|
|
61
|
+
}
|
|
44
62
|
return {
|
|
45
63
|
rows: filtered.slice(start, start + options.limit),
|
|
46
64
|
total: filtered.length,
|
package/dist/ui/assets.js
CHANGED
|
@@ -2,35 +2,15 @@ import { adapters } from "../harnesses/registry.js";
|
|
|
2
2
|
import { assetPage } from "./asset-list.js";
|
|
3
3
|
import { displayPath } from "./output.js";
|
|
4
4
|
import { badge, bold, clean, dim, hint, ok, originLabel, plural, section, table, } from "./format.js";
|
|
5
|
-
export const kindLabels = {
|
|
6
|
-
skill: {
|
|
7
|
-
group: "skills",
|
|
8
|
-
one: "Skill",
|
|
9
|
-
a: "a Skill",
|
|
10
|
-
many: "Skills",
|
|
11
|
-
title: "Skills",
|
|
12
|
-
},
|
|
13
|
-
mcp: {
|
|
14
|
-
group: "mcp",
|
|
15
|
-
one: "MCP server",
|
|
16
|
-
a: "an MCP server",
|
|
17
|
-
many: "MCP servers",
|
|
18
|
-
title: "MCP servers",
|
|
19
|
-
},
|
|
20
|
-
hook: {
|
|
21
|
-
group: "hooks",
|
|
22
|
-
one: "Hook",
|
|
23
|
-
a: "a Hook",
|
|
24
|
-
many: "Hooks",
|
|
25
|
-
title: "Hooks",
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
5
|
export const harnessNames = (harnesses) => harnesses.map((h) => adapters[h].name).join(", ");
|
|
29
|
-
const listGroup = (state) => state === "available"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
6
|
+
const listGroup = (state) => state === "available" || state === "disabled" ? state : "installed";
|
|
7
|
+
/** Outdated assets look pending and modified ones look clashed. */
|
|
8
|
+
function badgeState(state) {
|
|
9
|
+
if (state === "outdated") {
|
|
10
|
+
return "pending";
|
|
11
|
+
}
|
|
12
|
+
return state === "modified" ? "clash" : state;
|
|
13
|
+
}
|
|
34
14
|
/** Installed first, then disabled, then available; no filter means all three. */
|
|
35
15
|
export function assetListing(items, rows, filter) {
|
|
36
16
|
const onMachine = new Set(items.map((item) => item.id));
|
|
@@ -65,10 +45,11 @@ const stateLabel = {
|
|
|
65
45
|
removing: "pending removal",
|
|
66
46
|
};
|
|
67
47
|
/** One table of what is selected and installed, with an optional path listing. */
|
|
68
|
-
export function renderInventory(items, options
|
|
48
|
+
export function renderInventory(items, options) {
|
|
69
49
|
const output = [];
|
|
70
|
-
if (options.heading)
|
|
50
|
+
if (options.heading) {
|
|
71
51
|
output.push(`${section(options.heading)} ${dim(`(${items.length})`)}`);
|
|
52
|
+
}
|
|
72
53
|
output.push(...table(items.map((item) => [
|
|
73
54
|
bold(item.installedName) +
|
|
74
55
|
(item.installedName !== item.name ? dim(" (renamed)") : ""),
|
|
@@ -77,45 +58,53 @@ export function renderInventory(items, options = {}) {
|
|
|
77
58
|
dim(item.harnesses.length
|
|
78
59
|
? item.harnesses.map((h) => adapters[h].name).join(", ")
|
|
79
60
|
: "—"),
|
|
80
|
-
badge(item.state
|
|
81
|
-
? "pending"
|
|
82
|
-
: item.state === "modified"
|
|
83
|
-
? "clash"
|
|
84
|
-
: item.state, stateLabel[item.state]),
|
|
61
|
+
badge(badgeState(item.state), stateLabel[item.state]),
|
|
85
62
|
]), { header: ["Name", "Origin", "Via", "Installed in", "State"], flex: 2 }));
|
|
86
|
-
if (options.paths)
|
|
63
|
+
if (options.paths) {
|
|
87
64
|
for (const item of items) {
|
|
88
|
-
if (!item.paths.length)
|
|
65
|
+
if (!item.paths.length) {
|
|
89
66
|
continue;
|
|
67
|
+
}
|
|
90
68
|
output.push("", ` ${bold(item.installedName)}${item.installedName !== item.name ? dim(` · published as ${item.name}`) : ""}`);
|
|
91
|
-
for (const path of item.paths)
|
|
92
|
-
output.push(dim(` ${displayPath(path)}`));
|
|
69
|
+
for (const path of item.paths) {
|
|
70
|
+
output.push(dim(` ${displayPath(path, options.runtime)}`));
|
|
71
|
+
}
|
|
93
72
|
}
|
|
73
|
+
}
|
|
94
74
|
return output;
|
|
95
75
|
}
|
|
96
76
|
/** Follow-up advice for states that need action. */
|
|
97
77
|
export function inventoryHints(items) {
|
|
98
78
|
const output = [];
|
|
99
79
|
const count = (state) => items.filter((item) => item.state === state).length;
|
|
100
|
-
if (count("pending") || count("outdated") || count("removing"))
|
|
80
|
+
if (count("pending") || count("outdated") || count("removing")) {
|
|
101
81
|
output.push(hint("barndog sync", "Next") +
|
|
102
82
|
dim(` to apply ${plural(count("pending") + count("outdated") + count("removing"), "pending change")}`));
|
|
103
|
-
|
|
83
|
+
}
|
|
84
|
+
if (count("modified")) {
|
|
104
85
|
output.push(hint("barndog doctor", "Fix") +
|
|
105
86
|
dim(` to restore ${plural(count("modified"), "hand-edited asset")}`));
|
|
106
|
-
|
|
87
|
+
}
|
|
88
|
+
if (count("clash")) {
|
|
107
89
|
output.push(hint("barndog sync", "Fix") +
|
|
108
90
|
dim(" in a terminal to choose how to resolve name clashes"));
|
|
91
|
+
}
|
|
109
92
|
return output;
|
|
110
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Returns a filtered catalog table and paging hints, marking selected IDs; does
|
|
96
|
+
* not write output.
|
|
97
|
+
*/
|
|
111
98
|
export function renderCatalog(rows, options, command, installedIds) {
|
|
112
99
|
const page = assetPage(rows, options);
|
|
113
|
-
if (!page.total)
|
|
100
|
+
if (!page.total) {
|
|
114
101
|
return [dim("No matching assets.")];
|
|
115
|
-
|
|
102
|
+
}
|
|
103
|
+
if (!page.rows.length) {
|
|
116
104
|
return [
|
|
117
105
|
`Page ${options.page} is empty. Choose a page from 1 to ${page.pages}.`,
|
|
118
106
|
];
|
|
107
|
+
}
|
|
119
108
|
// Only Cloud has version numbers; local and Git assets are identified by a hash.
|
|
120
109
|
const versioned = page.rows.some((row) => row.version.label === undefined);
|
|
121
110
|
const output = table(page.rows.map((row) => [
|