barndog 0.2.2 → 0.2.3
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 +2 -0
- package/dist/cli.js +2 -2
- package/dist/commands/add.js +4 -2
- package/dist/commands/asset-install.js +7 -3
- package/dist/commands/asset-share.js +15 -3
- package/dist/commands/capabilities.js +23 -5
- package/dist/commands/collaboration.js +9 -3
- package/dist/commands/harnesses.js +1 -1
- package/dist/commands/hooks.js +16 -1
- package/dist/commands/mcp-env.js +39 -12
- package/dist/commands/mcp.js +13 -3
- package/dist/commands/origin.js +7 -4
- package/dist/commands/sets.js +3 -3
- package/dist/commands/status.js +3 -1
- package/dist/commands/sync.js +1 -1
- package/dist/commands/uninstall.js +4 -2
- package/dist/commands/workspace.js +19 -0
- package/dist/config/state.js +19 -0
- package/dist/errors.js +4 -0
- package/dist/features/adoption/adopt.js +18 -1
- package/dist/features/adoption/scan.js +5 -0
- package/dist/features/asset-kinds/url-query.js +26 -0
- package/dist/features/doctor/check.js +1 -0
- package/dist/features/doctor/grouped.js +127 -0
- package/dist/features/doctor/index.js +18 -33
- package/dist/features/environment/events.js +10 -0
- package/dist/features/environment/kept-value-events.js +40 -0
- package/dist/features/environment/mcp-records.js +57 -0
- package/dist/features/environment/stage.js +12 -8
- package/dist/features/environment/sync.js +11 -1
- package/dist/features/environment/writes.js +25 -27
- package/dist/features/hooks/compatibility.js +37 -17
- package/dist/features/hooks/test.js +2 -2
- package/dist/features/inventory/hook-matrix.js +14 -0
- package/dist/features/inventory/hook-readiness.js +47 -0
- package/dist/features/inventory/index.js +9 -1
- package/dist/features/inventory/show.js +10 -2
- package/dist/features/mcps/import.js +40 -8
- package/dist/features/mcps/index.js +23 -10
- package/dist/features/mcps/values.js +71 -21
- package/dist/features/migration/move.js +4 -0
- package/dist/features/migration/promote.js +1 -0
- package/dist/features/native/adapters.js +4 -44
- package/dist/features/native/requirements.js +98 -0
- package/dist/features/secrets/index.js +4 -3
- package/dist/features/uninstall/index.js +1 -1
- package/dist/features/workspace/cloud-source.js +38 -4
- package/dist/program.js +4 -1
- package/dist/ui/add-hook.js +2 -2
- package/dist/ui/add-mcp.js +37 -5
- package/dist/ui/add-skills.js +2 -2
- package/dist/ui/adopt.js +80 -14
- package/dist/ui/assets.js +15 -2
- package/dist/ui/collaboration.js +5 -3
- package/dist/ui/format.js +81 -2
- package/dist/ui/hook-compatibility.js +176 -22
- package/dist/ui/mcp.js +98 -19
- package/dist/ui/move.js +1 -1
- package/dist/ui/onboarding.js +11 -2
- package/dist/ui/output.js +96 -42
- package/dist/ui/package-details.js +7 -2
- package/dist/ui/pick.js +20 -6
- package/dist/ui/selection.js +1 -1
- package/dist/ui/uninstall.js +14 -2
- package/dist/ui/variable-problems.js +23 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@ Set up your AI coding environment once, and have it show up in Claude Code, Code
|
|
|
4
4
|
|
|
5
5
|
`barndog` is the command-line tool for [BarnDog](https://barndog.dev). It installs Skills, MCP servers, Hooks, and knowledge into the coding agents you already use, keeps them up to date, and lets you improve them like code. It works the same whether it's just you, a small team, or a whole organization; only where the assets live changes.
|
|
6
6
|
|
|
7
|
+
<img width="1832" height="1080" alt="yurii — -zsh — 139×39 (Window) 2026-11-24 12 03 AM" src="https://github.com/user-attachments/assets/e8454b86-b017-430b-b7dc-caa454bd675c" />
|
|
8
|
+
|
|
7
9
|
Currently supported harnesses:
|
|
8
10
|
|
|
9
11
|
- Claude Code
|
package/dist/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ import { assertCommandAvailable, currentSetupMode, } from "./commands/availabili
|
|
|
6
6
|
import { captureRuntime, createProgram } from "./program.js";
|
|
7
7
|
import { renderError, renderJsonError } from "./ui/output.js";
|
|
8
8
|
import { json } from "./ui/format.js";
|
|
9
|
-
import { CliError, NothingToDoError } from "./errors.js";
|
|
9
|
+
import { CliError, NothingToDoError, promptCancelled } from "./errors.js";
|
|
10
10
|
import { updateCheck } from "./features/update-check/index.js";
|
|
11
11
|
import { renderUpdateNotice } from "./ui/update.js";
|
|
12
12
|
import { cliVersion } from "./version.js";
|
|
@@ -34,7 +34,7 @@ catch (error) {
|
|
|
34
34
|
: error.message.replace(/^error: /, ""))));
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
else if (error
|
|
37
|
+
else if (promptCancelled(error)) {
|
|
38
38
|
const message = "Cancelled. Nothing was changed.";
|
|
39
39
|
console.log(asJson ? json({ message }) : message);
|
|
40
40
|
process.exitCode = 130;
|
package/dist/commands/add.js
CHANGED
|
@@ -96,13 +96,15 @@ export function registerAdd(program, context) {
|
|
|
96
96
|
for (const result of results) {
|
|
97
97
|
context.write(`${result.name}: ${result.changes.length ? `${result.changes.length} file${result.changes.length === 1 ? "" : "s"} changed` : "up to date"}`);
|
|
98
98
|
if (result.changes.length) {
|
|
99
|
-
for (const line of renderCollaboration(result.changes
|
|
99
|
+
for (const line of renderCollaboration(result.changes, {
|
|
100
|
+
runtime: context.runtime,
|
|
101
|
+
})) {
|
|
100
102
|
context.write(line);
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
106
|
if (applied) {
|
|
105
|
-
for (const line of renderSyncOutput(events)) {
|
|
107
|
+
for (const line of renderSyncOutput(events, context.runtime)) {
|
|
106
108
|
context.write(line);
|
|
107
109
|
}
|
|
108
110
|
context.write(`${ok("✔")} Update installed.`);
|
|
@@ -2,7 +2,8 @@ import { Option } from "commander";
|
|
|
2
2
|
import { prefixedName } from "../features/environment/names.js";
|
|
3
3
|
import { runSelection } from "../ui/selection.js";
|
|
4
4
|
import { pickMany, pickOne } from "../ui/pick.js";
|
|
5
|
-
import { bold, clean, ok, ORIGIN_HELP, originLabel } from "../ui/format.js";
|
|
5
|
+
import { bold, clean, dim, ok, ORIGIN_HELP, originLabel, } from "../ui/format.js";
|
|
6
|
+
import { stateBadge } from "../ui/assets.js";
|
|
6
7
|
import { assetKinds } from "../features/asset-kinds/index.js";
|
|
7
8
|
import { addArguments, requireArguments } from "./arguments.js";
|
|
8
9
|
import { ask } from "./asset-share.js";
|
|
@@ -18,7 +19,7 @@ function localCandidates(items, kind, action, origin) {
|
|
|
18
19
|
const localChoice = (item) => ({
|
|
19
20
|
value: item,
|
|
20
21
|
name: item.installedName,
|
|
21
|
-
|
|
22
|
+
columns: [dim(item.origin), stateBadge(item.state)],
|
|
22
23
|
});
|
|
23
24
|
/** `install`: adds assets of one kind to the selection and syncs. */
|
|
24
25
|
export function registerInstall(command, kind, context) {
|
|
@@ -56,7 +57,10 @@ export function registerInstall(command, kind, context) {
|
|
|
56
57
|
.map((row) => ({
|
|
57
58
|
value: row.id,
|
|
58
59
|
name: row.name,
|
|
59
|
-
|
|
60
|
+
columns: [
|
|
61
|
+
dim(originLabel(row.origin)),
|
|
62
|
+
dim(clean(row.version.description)),
|
|
63
|
+
],
|
|
60
64
|
})), {
|
|
61
65
|
empty: inOrigin.length
|
|
62
66
|
? `Every available ${labels.one} is already on this machine.`
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { renderMove } from "../ui/move.js";
|
|
2
|
+
import { confirmSharingUrlQuery } from "../ui/mcp.js";
|
|
2
3
|
import input from "@inquirer/input";
|
|
3
4
|
import { CliError } from "../errors.js";
|
|
4
5
|
import { pickOne } from "../ui/pick.js";
|
|
5
6
|
import { promptTheme } from "../ui/theme.js";
|
|
6
|
-
import { bold, clean, hint, json, ok, ORIGIN_HELP, originLabel, } from "../ui/format.js";
|
|
7
|
+
import { bold, clean, dim, hint, json, ok, ORIGIN_HELP, originLabel, } from "../ui/format.js";
|
|
7
8
|
import { assetKinds } from "../features/asset-kinds/index.js";
|
|
8
9
|
import { requireArguments } from "./arguments.js";
|
|
9
10
|
/** Asks for a value in a terminal, or explains the flag to pass. */
|
|
@@ -37,7 +38,10 @@ export function registerSharing(command, kind, context) {
|
|
|
37
38
|
const row = await pickOne(`Choose ${labels.a} to ${action}`, (await context.searchCatalog(kind)).map((row) => ({
|
|
38
39
|
value: row,
|
|
39
40
|
name: row.name,
|
|
40
|
-
|
|
41
|
+
columns: [
|
|
42
|
+
dim(originLabel(row.origin)),
|
|
43
|
+
dim(clean(row.version.description)),
|
|
44
|
+
],
|
|
41
45
|
})));
|
|
42
46
|
name = row.name;
|
|
43
47
|
origin = originLabel(row.origin);
|
|
@@ -69,7 +73,15 @@ export function registerSharing(command, kind, context) {
|
|
|
69
73
|
outcome: "promoted",
|
|
70
74
|
promotion: await context.fork(input),
|
|
71
75
|
}
|
|
72
|
-
: await context.promote(
|
|
76
|
+
: await context.promote({
|
|
77
|
+
...input,
|
|
78
|
+
confirmUrlQuery: confirmSharingUrlQuery({
|
|
79
|
+
interactive: context.mode.interactive,
|
|
80
|
+
write: context.write,
|
|
81
|
+
// Promoting a local asset shares a copy, as this does.
|
|
82
|
+
fix: `barndog local move ${name} --keep-local --to ${target} --allow-url-query`,
|
|
83
|
+
}),
|
|
84
|
+
});
|
|
73
85
|
if (outcome.outcome === "moved") {
|
|
74
86
|
if (context.mode.json) {
|
|
75
87
|
return context.write(json(outcome.move));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { openBrowser } from "../ui/auth.js";
|
|
2
|
-
import { bad, bold, dim, fields, heading, hint, json, ok, warn, } from "../ui/format.js";
|
|
2
|
+
import { bad, bold, dim, fields, heading, hint, json, labelledLists, ok, plural, table, warn, } from "../ui/format.js";
|
|
3
3
|
import { registerMcp } from "./mcp.js";
|
|
4
4
|
import { registerHooks } from "./hooks.js";
|
|
5
5
|
import { registerKnowledge } from "./knowledge.js";
|
|
@@ -108,29 +108,47 @@ function registerGeneral(program, context) {
|
|
|
108
108
|
.command("doctor")
|
|
109
109
|
.description("Check your setup, session and installed assets, and suggest fixes")
|
|
110
110
|
.action(async () => {
|
|
111
|
-
const checks = await context.doctor();
|
|
111
|
+
const { checks, hooksMissingTools } = await context.doctor();
|
|
112
112
|
if (context.mode.json) {
|
|
113
113
|
return context.write(json(checks));
|
|
114
114
|
}
|
|
115
115
|
context.write(`\n${heading("doctor")}\n`);
|
|
116
116
|
const width = Math.max(...checks.map((c) => c.name.length));
|
|
117
|
+
// Lines under a check start where its detail does.
|
|
118
|
+
const under = ` ${" ".repeat(width)} `;
|
|
117
119
|
for (const check of checks) {
|
|
118
120
|
const mark = checkMarks[check.status];
|
|
119
121
|
context.write(`${mark} ${check.name.padEnd(width)} ${check.status === "ok" ? dim(check.detail) : check.detail}`);
|
|
122
|
+
for (const line of labelledLists(check.rows ?? [], {
|
|
123
|
+
indent: under.length,
|
|
124
|
+
})) {
|
|
125
|
+
context.write(line);
|
|
126
|
+
}
|
|
127
|
+
if (check.table) {
|
|
128
|
+
context.write("");
|
|
129
|
+
for (const line of table(check.table.map(([first = "", ...rest]) => [bold(first), ...rest]), { indent: under.length })) {
|
|
130
|
+
context.write(line);
|
|
131
|
+
}
|
|
132
|
+
context.write("");
|
|
133
|
+
}
|
|
120
134
|
if (check.fix) {
|
|
121
135
|
// A fix in words reads as plain text when a command follows it.
|
|
122
136
|
context.write(check.command
|
|
123
|
-
?
|
|
124
|
-
:
|
|
137
|
+
? `${under}${dim("Fix:")} ${check.fix}`
|
|
138
|
+
: `${under}${hint(check.fix, "Fix")}`);
|
|
125
139
|
}
|
|
126
140
|
if (check.command) {
|
|
127
|
-
context.write(
|
|
141
|
+
context.write(`${under}${dim("Command:")} ${bold(check.command)}`);
|
|
128
142
|
}
|
|
129
143
|
}
|
|
130
144
|
const failed = checks.filter((c) => c.status === "fail").length;
|
|
131
145
|
const warned = checks.filter((c) => c.status === "warn").length;
|
|
132
146
|
context.write("");
|
|
133
147
|
context.write(doctorSummary(failed, warned));
|
|
148
|
+
if (hooksMissingTools) {
|
|
149
|
+
context.write("");
|
|
150
|
+
context.write(`${dim(`Tip: ${plural(hooksMissingTools, "Hook")} ${hooksMissingTools === 1 ? "is" : "are"} written for only some of your tools.`)} ${bold("barndog hooks compatibility --all")}${dim(" to see which")}`);
|
|
151
|
+
}
|
|
134
152
|
if (failed) {
|
|
135
153
|
process.exitCode = 1;
|
|
136
154
|
}
|
|
@@ -11,7 +11,7 @@ import { packageKindList } from "../config/selection.js";
|
|
|
11
11
|
import { pickOne } from "../ui/pick.js";
|
|
12
12
|
import { renderPackageDetails } from "../ui/package-details.js";
|
|
13
13
|
import { resolveOrigin } from "./origin.js";
|
|
14
|
-
import { clean, json, ORIGIN_HELP, originLabel, warn } from "../ui/format.js";
|
|
14
|
+
import { clean, dim, json, ORIGIN_HELP, originLabel, warn, } from "../ui/format.js";
|
|
15
15
|
import { defined } from "../shared/lookup.js";
|
|
16
16
|
import { positiveInteger } from "../ui/options.js";
|
|
17
17
|
function side(value) {
|
|
@@ -27,7 +27,10 @@ function printer(context) {
|
|
|
27
27
|
context.write(json(result));
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
|
-
for (const line of renderCollaboration(result,
|
|
30
|
+
for (const line of renderCollaboration(result, {
|
|
31
|
+
...options,
|
|
32
|
+
runtime: context.runtime,
|
|
33
|
+
})) {
|
|
31
34
|
context.write(line);
|
|
32
35
|
}
|
|
33
36
|
}
|
|
@@ -138,7 +141,10 @@ export function registerCollaboration(program, context, kind) {
|
|
|
138
141
|
const row = await pickOne(`Choose a ${noun}`, rows.map((row) => ({
|
|
139
142
|
value: row,
|
|
140
143
|
name: row.name,
|
|
141
|
-
|
|
144
|
+
columns: [
|
|
145
|
+
dim(originLabel(row.origin)),
|
|
146
|
+
dim(clean(row.version.description)),
|
|
147
|
+
],
|
|
142
148
|
})), { empty: `No ${noun}s are published yet.` });
|
|
143
149
|
return { name: row.name, origin: originLabel(row.origin) };
|
|
144
150
|
};
|
|
@@ -51,7 +51,7 @@ export function registerHarnesses(program, context) {
|
|
|
51
51
|
if (context.mode.json) {
|
|
52
52
|
return context.write(json(result));
|
|
53
53
|
}
|
|
54
|
-
for (const line of renderSyncOutput(result.events)) {
|
|
54
|
+
for (const line of renderSyncOutput(result.events, context.runtime)) {
|
|
55
55
|
context.write(line);
|
|
56
56
|
}
|
|
57
57
|
context.write(managedLine(result.harnesses));
|
package/dist/commands/hooks.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { bad, dim, json, ok, ORIGIN_HELP } from "../ui/format.js";
|
|
2
2
|
import { Option } from "commander";
|
|
3
|
-
import { renderHookCompatibility } from "../ui/hook-compatibility.js";
|
|
3
|
+
import { renderHookCompatibility, renderHookMatrix, } from "../ui/hook-compatibility.js";
|
|
4
|
+
import { CliError } from "../errors.js";
|
|
4
5
|
import { hookHarnesses } from "../harnesses/registry.js";
|
|
5
6
|
import { defined } from "../shared/lookup.js";
|
|
6
7
|
import { positiveInteger } from "../ui/options.js";
|
|
@@ -58,8 +59,22 @@ export function registerHooks(program, context) {
|
|
|
58
59
|
hooks
|
|
59
60
|
.command("compatibility [name]")
|
|
60
61
|
.option("--origin <origin>", ORIGIN_HELP)
|
|
62
|
+
.option("--all", "Show every selected Hook against each coding tool")
|
|
61
63
|
.description("Inspect version-specific declarations and local runtime requirements")
|
|
62
64
|
.action(async (name, options) => {
|
|
65
|
+
if (options.all) {
|
|
66
|
+
if (name || options.origin) {
|
|
67
|
+
throw new CliError("--all shows every selected Hook, so it takes no name or --origin.", "barndog hooks compatibility --all");
|
|
68
|
+
}
|
|
69
|
+
const rows = await context.allHookCompatibility();
|
|
70
|
+
if (context.mode.json) {
|
|
71
|
+
return context.write(json(rows));
|
|
72
|
+
}
|
|
73
|
+
for (const line of renderHookMatrix(rows)) {
|
|
74
|
+
context.write(line);
|
|
75
|
+
}
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
63
78
|
const located = await locate("hook", name, options, "barndog hooks compatibility <name>");
|
|
64
79
|
const result = await context.hookCompatibility(located.name, located.origin);
|
|
65
80
|
if (context.mode.json) {
|
package/dist/commands/mcp-env.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { barndogPaths } from "../config/paths.js";
|
|
2
2
|
import { CliError } from "../errors.js";
|
|
3
3
|
import { readsFrom } from "../features/secrets/index.js";
|
|
4
|
-
import { bold, dim, json, ok, table } from "../ui/format.js";
|
|
4
|
+
import { bold, dim, hint, json, ok, table, warn } from "../ui/format.js";
|
|
5
|
+
import { stateBadge } from "../ui/assets.js";
|
|
5
6
|
import { displayPath, renderSyncOutput } from "../ui/output.js";
|
|
6
7
|
import { pickOne } from "../ui/pick.js";
|
|
7
8
|
import { askSecret, askUseUnassigned, readStdin } from "../ui/secret-input.js";
|
|
@@ -21,13 +22,40 @@ export function registerMcpEnv(mcp, context) {
|
|
|
21
22
|
.description("Keep MCP variable values on this machine, never uploaded, and write them into your coding tools");
|
|
22
23
|
const where = (file) => displayPath(file, context.runtime);
|
|
23
24
|
const report = (message, result, data) => {
|
|
25
|
+
const { notWritten } = result;
|
|
24
26
|
if (context.mode.json) {
|
|
25
|
-
return context.write(json({
|
|
27
|
+
return context.write(json({
|
|
28
|
+
...data,
|
|
29
|
+
file: result.file,
|
|
30
|
+
...(notWritten ? { notWritten } : {}),
|
|
31
|
+
}));
|
|
26
32
|
}
|
|
27
33
|
context.write(`${ok("✔")} ${message}`);
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
// Nothing was synced, so there is no sync summary to show.
|
|
35
|
+
if (!notWritten) {
|
|
36
|
+
for (const line of renderSyncOutput(result.events, context.runtime)) {
|
|
37
|
+
context.write(line);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (notWritten?.because === "disabled") {
|
|
41
|
+
context.write(dim(`${data.server ?? "This server"} is disabled, so your coding tools get the change when you enable it.`));
|
|
30
42
|
}
|
|
43
|
+
if (notWritten?.because === "sync-failed") {
|
|
44
|
+
context.write(`${warn("Your coding tools weren't updated:")} ${notWritten.message}`);
|
|
45
|
+
context.write(dim(`The change is kept; the next ${bold("barndog sync")} writes it into them.`));
|
|
46
|
+
if (notWritten.fix) {
|
|
47
|
+
context.write(hint(notWritten.fix, "Fix"));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
/** Where a kept value is written, or why it isn't. */
|
|
52
|
+
const writtenInto = (row) => {
|
|
53
|
+
if (row.writtenTo.length) {
|
|
54
|
+
return row.writtenTo.map(where).join(", ");
|
|
55
|
+
}
|
|
56
|
+
return dim(row.enabled === false
|
|
57
|
+
? "not written (disabled)"
|
|
58
|
+
: "not written anywhere yet");
|
|
31
59
|
};
|
|
32
60
|
env
|
|
33
61
|
.command("set [server] [variable]")
|
|
@@ -37,7 +65,8 @@ export function registerMcpEnv(mcp, context) {
|
|
|
37
65
|
.addHelpText("after", `
|
|
38
66
|
The value is saved in ~/.barndog/secrets.json, which only you can read, and never leaves this machine.
|
|
39
67
|
Sync then writes it into that server's entry in each coding tool's settings, as the tools store values
|
|
40
|
-
they're given; shared definitions keep only the variable's name.
|
|
68
|
+
they're given; shared definitions keep only the variable's name. A disabled server gets it when you
|
|
69
|
+
enable it, and a sync that can't run leaves it for the next one. With --from, the server reads another
|
|
41
70
|
variable from your environment instead, such as GITHUB_TOKEN for GITHUB_PERSONAL_ACCESS_TOKEN.`)
|
|
42
71
|
.action(async (server, variable, options) => {
|
|
43
72
|
if (options.from && options.stdin) {
|
|
@@ -99,9 +128,7 @@ variable from your environment instead, such as GITHUB_TOKEN for GITHUB_PERSONAL
|
|
|
99
128
|
row.server ? bold(row.server) : dim("not assigned"),
|
|
100
129
|
bold(row.variable),
|
|
101
130
|
describe(row),
|
|
102
|
-
row
|
|
103
|
-
? row.writtenTo.map(where).join(", ")
|
|
104
|
-
: dim("not written anywhere yet"),
|
|
131
|
+
writtenInto(row),
|
|
105
132
|
]), { header: ["Server", "Variable", "Value", "Written into"] })) {
|
|
106
133
|
context.write(line);
|
|
107
134
|
}
|
|
@@ -116,13 +143,13 @@ variable from your environment instead, such as GITHUB_TOKEN for GITHUB_PERSONAL
|
|
|
116
143
|
return { server, variable };
|
|
117
144
|
}
|
|
118
145
|
requireArguments(context, SET_USAGE);
|
|
119
|
-
const servers =
|
|
146
|
+
const servers = await context.recordedMcpServers();
|
|
120
147
|
const item = server
|
|
121
148
|
? servers.find((candidate) => [candidate.installedName, candidate.name, candidate.id].includes(server))
|
|
122
149
|
: await pickOne("Choose an MCP server", servers.map((candidate) => ({
|
|
123
150
|
value: candidate,
|
|
124
151
|
name: candidate.installedName,
|
|
125
|
-
|
|
152
|
+
columns: candidate.enabled ? [] : [stateBadge("disabled")],
|
|
126
153
|
})), { empty: "No MCP servers on this machine." });
|
|
127
154
|
if (!item) {
|
|
128
155
|
throw new CliError(`There's no MCP server called ${server} on this machine.`, "barndog mcp list");
|
|
@@ -131,9 +158,9 @@ variable from your environment instead, such as GITHUB_TOKEN for GITHUB_PERSONAL
|
|
|
131
158
|
return { server: item.installedName, variable };
|
|
132
159
|
}
|
|
133
160
|
const kept = (await context.listKeptValues()).filter((row) => row.assetId === item.id);
|
|
134
|
-
const chosen = await pickOne(`Choose a variable of ${item.installedName}`,
|
|
161
|
+
const chosen = await pickOne(`Choose a variable of ${item.installedName}`, item.variables.map((name) => {
|
|
135
162
|
const row = kept.find((candidate) => candidate.variable === name);
|
|
136
|
-
return { value: name, name,
|
|
163
|
+
return { value: name, name, columns: row ? [dim(describe(row))] : [] };
|
|
137
164
|
}), {
|
|
138
165
|
empty: `BarnDog couldn't find any variables ${item.installedName} uses. Name one: ${SET_USAGE}`,
|
|
139
166
|
});
|
package/dist/commands/mcp.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { json, ok, ORIGIN_HELP } from "../ui/format.js";
|
|
2
|
+
import { confirmSharingUrlQuery } from "../ui/mcp.js";
|
|
2
3
|
import { Option } from "commander";
|
|
3
4
|
import { harnesses } from "../harnesses/registry.js";
|
|
4
5
|
import { defined } from "../shared/lookup.js";
|
|
@@ -14,14 +15,23 @@ export function registerMcp(program, context) {
|
|
|
14
15
|
.description(`${action === "create" ? "Create" : "Publish a new revision of"} an MCP configuration directly`)
|
|
15
16
|
.requiredOption("--origin <origin>", ORIGIN_HELP)
|
|
16
17
|
.requiredOption("--file <file>", "JSON connection definition with secret references")
|
|
17
|
-
.option("--key <key>", "Stable key for exact retries")
|
|
18
|
+
.option("--key <key>", "Stable key for exact retries")
|
|
19
|
+
.option("--allow-url-query", "Publish a URL with query parameters without asking");
|
|
18
20
|
if (action === "update") {
|
|
19
21
|
command.requiredOption("--expected-version <id>", "Inspected configuration version ID");
|
|
20
22
|
}
|
|
21
23
|
command.action(async (name, options) => {
|
|
24
|
+
const { allowUrlQuery, ...rest } = options;
|
|
25
|
+
const confirmUrlQuery = confirmSharingUrlQuery({
|
|
26
|
+
interactive: context.mode.interactive,
|
|
27
|
+
allowed: allowUrlQuery,
|
|
28
|
+
write: context.write,
|
|
29
|
+
fix: `barndog mcp ${action} ${name} --origin ${options.origin} --file ${options.file}${action === "update" ? ` --expected-version ${options.expectedVersion}` : ""} --allow-url-query`,
|
|
30
|
+
});
|
|
31
|
+
const input = { ...rest, name, confirmUrlQuery };
|
|
22
32
|
const result = action === "create"
|
|
23
|
-
? await context.createMcp(
|
|
24
|
-
: await context.updateMcp(
|
|
33
|
+
? await context.createMcp(input)
|
|
34
|
+
: await context.updateMcp(input);
|
|
25
35
|
if (context.mode.json) {
|
|
26
36
|
return context.write(json(result));
|
|
27
37
|
}
|
package/dist/commands/origin.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { assetKinds } from "../features/asset-kinds/index.js";
|
|
2
2
|
import { CliError } from "../errors.js";
|
|
3
3
|
import { pickOne } from "../ui/pick.js";
|
|
4
|
-
import { clean, originLabel } from "../ui/format.js";
|
|
4
|
+
import { clean, dim, originLabel } from "../ui/format.js";
|
|
5
|
+
import { stateBadge } from "../ui/assets.js";
|
|
5
6
|
import { only } from "../shared/lookup.js";
|
|
6
7
|
/**
|
|
7
8
|
* Names are unique only within a scope, so `--origin` picks between scopes
|
|
@@ -27,8 +28,10 @@ export async function resolveOrigin(context, { kind, name, origin, usage, }) {
|
|
|
27
28
|
return pickOne(`${name} exists in several scopes. Which one?`, labels.map((label) => ({
|
|
28
29
|
value: label,
|
|
29
30
|
name: label,
|
|
30
|
-
|
|
31
|
-
.
|
|
31
|
+
columns: [
|
|
32
|
+
dim(clean(rows.find((row) => originLabel(row.origin) === label)?.version
|
|
33
|
+
.description ?? "")),
|
|
34
|
+
],
|
|
32
35
|
})));
|
|
33
36
|
}
|
|
34
37
|
/** Lets the person choose an installed asset when the command was given no name. */
|
|
@@ -40,7 +43,7 @@ export async function pickInstalled(context, kind, usage) {
|
|
|
40
43
|
const item = await pickOne(`Choose a ${assetKinds[kind].one}`, items.map((item) => ({
|
|
41
44
|
value: item,
|
|
42
45
|
name: item.installedName,
|
|
43
|
-
|
|
46
|
+
columns: [dim(item.origin), stateBadge(item.state)],
|
|
44
47
|
})), { empty: `No ${assetKinds[kind].one}s are installed on this machine.` });
|
|
45
48
|
return { name: item.name, origin: item.origin };
|
|
46
49
|
}
|
package/dist/commands/sets.js
CHANGED
|
@@ -4,7 +4,7 @@ import { runSetInstall } from "../ui/scope-install.js";
|
|
|
4
4
|
import { LOCAL_ORIGIN } from "../features/workspace/overlay.js";
|
|
5
5
|
import { runSelection } from "../ui/selection.js";
|
|
6
6
|
import { pickOne } from "../ui/pick.js";
|
|
7
|
-
import { bold, dim, hint, json, ok, originLabel, section, table, } from "../ui/format.js";
|
|
7
|
+
import { bold, dim, off, hint, json, ok, originLabel, section, table, } from "../ui/format.js";
|
|
8
8
|
import { requireArguments } from "./arguments.js";
|
|
9
9
|
const setDescriptions = {
|
|
10
10
|
install: "Subscribe to a scope's shared assets",
|
|
@@ -60,7 +60,7 @@ export function registerSets(program, context) {
|
|
|
60
60
|
: `${subscription.scope.type}/${subscription.scope.id}`),
|
|
61
61
|
scope?.name ?? dim("unavailable"),
|
|
62
62
|
subscription.mode,
|
|
63
|
-
subscription.enabled ? ok("enabled") :
|
|
63
|
+
subscription.enabled ? ok("enabled") : off("disabled"),
|
|
64
64
|
]), { header: ["Scope", "Name", "Mode", "State"] }).join("\n")
|
|
65
65
|
: dim(" None yet."));
|
|
66
66
|
const terms = options.search?.toLowerCase().split(/\s+/).filter(Boolean) ?? [];
|
|
@@ -102,7 +102,7 @@ export function registerSets(program, context) {
|
|
|
102
102
|
.map((scope) => ({
|
|
103
103
|
value: label(scope),
|
|
104
104
|
name: label(scope),
|
|
105
|
-
|
|
105
|
+
columns: [dim(scope.name)],
|
|
106
106
|
})), { empty });
|
|
107
107
|
};
|
|
108
108
|
for (const action of ["install", "remove", "enable", "disable"]) {
|
package/dist/commands/status.js
CHANGED
|
@@ -19,7 +19,9 @@ export function registerStatus(program, context) {
|
|
|
19
19
|
: inventory));
|
|
20
20
|
}
|
|
21
21
|
if ("changes" in working) {
|
|
22
|
-
for (const line of renderCollaboration(working
|
|
22
|
+
for (const line of renderCollaboration(working, {
|
|
23
|
+
runtime: context.runtime,
|
|
24
|
+
})) {
|
|
23
25
|
context.write(line);
|
|
24
26
|
}
|
|
25
27
|
context.write("");
|
package/dist/commands/sync.js
CHANGED
|
@@ -27,7 +27,7 @@ export function registerSync(program, context) {
|
|
|
27
27
|
if (context.mode.json) {
|
|
28
28
|
return context.write(json(events));
|
|
29
29
|
}
|
|
30
|
-
for (const line of renderSyncOutput(events, {
|
|
30
|
+
for (const line of renderSyncOutput(events, context.runtime, {
|
|
31
31
|
title: options.dryRun ? "sync --dry-run" : "sync",
|
|
32
32
|
preview: options.dryRun,
|
|
33
33
|
verbose: options.verbose,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Option } from "commander";
|
|
2
2
|
import { CliError } from "../errors.js";
|
|
3
3
|
import { json } from "../ui/format.js";
|
|
4
|
-
import { askUninstall, confirmUninstall, renderUninstall, renderUninstallPlan, uninstallOptions, } from "../ui/uninstall.js";
|
|
4
|
+
import { askUninstall, confirmUninstall, hasAssets, renderUninstall, renderUninstallPlan, uninstallOptions, } from "../ui/uninstall.js";
|
|
5
5
|
/** Registers `uninstall`. */
|
|
6
6
|
export function registerUninstall(program, context) {
|
|
7
7
|
program
|
|
@@ -16,7 +16,9 @@ export function registerUninstall(program, context) {
|
|
|
16
16
|
.action(async (flags) => {
|
|
17
17
|
const survey = await context.uninstallSurvey();
|
|
18
18
|
const choices = {
|
|
19
|
-
|
|
19
|
+
// With nothing of the developer's installed, there is nothing to choose.
|
|
20
|
+
keepSetup: (flags.keepSetup || (flags.removeAll ? false : undefined)) ??
|
|
21
|
+
(hasAssets(survey) ? undefined : true),
|
|
20
22
|
dropAdopted: flags.dropAdopted,
|
|
21
23
|
removeWorkspace: flags.removeWorkspace,
|
|
22
24
|
force: flags.force,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { bold, dim, heading, json, ok, plural, table, warn, } from "../ui/format.js";
|
|
2
2
|
import { chooseKeepLocal, pickLocalAssets, renderMove } from "../ui/move.js";
|
|
3
|
+
import { confirmSharingUrlQuery } from "../ui/mcp.js";
|
|
3
4
|
import { CliError } from "../errors.js";
|
|
4
5
|
const migrationActionStyles = {
|
|
5
6
|
publish: ok,
|
|
@@ -57,6 +58,7 @@ export function registerWorkspace(program, context) {
|
|
|
57
58
|
.option("--as <name>", "New name, for moving one asset whose name is taken")
|
|
58
59
|
.option("--repo <url>", "Send to this Git repo; this machine stays as it is")
|
|
59
60
|
.option("--server <url>", "Send to this Cloud Workspace; this machine stays as it is")
|
|
61
|
+
.option("--allow-url-query", "Share MCP servers whose URL has query parameters without asking")
|
|
60
62
|
.addHelpText("after", `
|
|
61
63
|
Without names, a terminal lists your local assets to pick from; elsewhere, name them or pass --all.
|
|
62
64
|
|
|
@@ -78,6 +80,23 @@ With --repo or --server this machine stays as it is, so the assets are always co
|
|
|
78
80
|
as: options.as,
|
|
79
81
|
repo: options.repo,
|
|
80
82
|
server: options.server,
|
|
83
|
+
confirmUrlQuery: confirmSharingUrlQuery({
|
|
84
|
+
interactive: context.mode.interactive,
|
|
85
|
+
allowed: options.allowUrlQuery,
|
|
86
|
+
write: context.write,
|
|
87
|
+
fix: [
|
|
88
|
+
"barndog local move",
|
|
89
|
+
chosen?.join(" ") ?? "--all",
|
|
90
|
+
keepLocal ? "--keep-local" : "--no-keep-local",
|
|
91
|
+
...Object.entries({
|
|
92
|
+
to: options.to,
|
|
93
|
+
as: options.as,
|
|
94
|
+
repo: options.repo,
|
|
95
|
+
server: options.server,
|
|
96
|
+
}).flatMap(([flag, value]) => value ? [`--${flag} ${value}`] : []),
|
|
97
|
+
"--allow-url-query",
|
|
98
|
+
].join(" "),
|
|
99
|
+
}),
|
|
81
100
|
});
|
|
82
101
|
if (context.mode.json) {
|
|
83
102
|
return context.write(json(result));
|
package/dist/config/state.js
CHANGED
|
@@ -12,6 +12,23 @@ const linkSchema = z.object({
|
|
|
12
12
|
source: z.string().refine(isAbsolute),
|
|
13
13
|
target: z.string(),
|
|
14
14
|
});
|
|
15
|
+
/**
|
|
16
|
+
* One selected MCP server, enabled or not, as the last sync saw it. Disabling a
|
|
17
|
+
* server removes its native entries, so this is what lets `mcp env` name it and
|
|
18
|
+
* check its variables without asking the workspace.
|
|
19
|
+
*/
|
|
20
|
+
const mcpServerSchema = z.strictObject({
|
|
21
|
+
id: z.string(),
|
|
22
|
+
/** The workspace's name for it. */
|
|
23
|
+
name: z.string(),
|
|
24
|
+
/** The name its coding-tool entries use, after any clash rename. */
|
|
25
|
+
installedName: z.string(),
|
|
26
|
+
/** The published version `variables` were read from. */
|
|
27
|
+
versionId: z.string(),
|
|
28
|
+
/** Every variable its definition refers to. */
|
|
29
|
+
variables: z.array(z.string()),
|
|
30
|
+
enabled: z.boolean(),
|
|
31
|
+
});
|
|
15
32
|
/** The complete persisted installation ownership journal. */
|
|
16
33
|
const stateSchema = z.looseObject({
|
|
17
34
|
version: z.literal(1),
|
|
@@ -31,6 +48,8 @@ const stateSchema = z.looseObject({
|
|
|
31
48
|
fingerprint: z.string(),
|
|
32
49
|
versionId: z.string(),
|
|
33
50
|
})),
|
|
51
|
+
/** Absent until a sync by a CLI that records MCP servers. */
|
|
52
|
+
mcpServers: z.array(mcpServerSchema).optional(),
|
|
34
53
|
});
|
|
35
54
|
/**
|
|
36
55
|
* Reads installation ownership and checks targets against the supplied home;
|
package/dist/errors.js
CHANGED
|
@@ -251,6 +251,10 @@ export function friendlyHint(error) {
|
|
|
251
251
|
const code = serverProblemCode(error);
|
|
252
252
|
return code ? serverProblems[code].fix : undefined;
|
|
253
253
|
}
|
|
254
|
+
/** Inquirer's error name when the person presses Ctrl+C at a prompt. */
|
|
255
|
+
const PROMPT_CLOSED = "ExitPromptError";
|
|
256
|
+
/** Whether the person cancelled a prompt (Ctrl+C), which is a choice, not a failure. */
|
|
257
|
+
export const promptCancelled = (error) => error instanceof Error && error.name === PROMPT_CLOSED;
|
|
254
258
|
/** Turns internal codes and validation errors into something a person can act on. */
|
|
255
259
|
export function friendlyMessage(error) {
|
|
256
260
|
if (!(error instanceof Error)) {
|
|
@@ -18,7 +18,7 @@ import { assetKinds } from "../asset-kinds/index.js";
|
|
|
18
18
|
import { synchronize } from "../environment/sync.js";
|
|
19
19
|
import { locked } from "../environment/transaction.js";
|
|
20
20
|
import { ensureLocalWorkspace } from "../imports/local.js";
|
|
21
|
-
import { keepLiteralValues, literalValues, } from "../mcps/import.js";
|
|
21
|
+
import { keepLiteralValues, literalValues, signInTools, } from "../mcps/import.js";
|
|
22
22
|
import { writePackage } from "../workspace/directory.js";
|
|
23
23
|
import { localRepoSource } from "../workspace/repo-source.js";
|
|
24
24
|
import { copyFingerprint, installed } from "./copies.js";
|
|
@@ -78,6 +78,22 @@ function adoptionNotes(plan, sourceOf, keep) {
|
|
|
78
78
|
values: sources.flatMap((asset) => literalValues(asset.name, sourceOf(asset).literals, keep)),
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
+
/** The adopted MCP servers, once each, under the asset ID their copy got. */
|
|
82
|
+
function adoptedServers(plan, record, sourceOf) {
|
|
83
|
+
const servers = new Map();
|
|
84
|
+
for (const [index, asset] of plan.entries()) {
|
|
85
|
+
const { content } = sourceOf(asset);
|
|
86
|
+
if (content.kind === "mcp") {
|
|
87
|
+
servers.set(asset.source.key, {
|
|
88
|
+
id: defined(record.items[index], "Each planned asset has an item")
|
|
89
|
+
.assetId,
|
|
90
|
+
name: asset.name,
|
|
91
|
+
definition: content.definition,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return [...servers.values()];
|
|
96
|
+
}
|
|
81
97
|
/** Takes over the chosen assets; on any failure, puts back what it changed. */
|
|
82
98
|
export async function adoptNative(keys,
|
|
83
99
|
/** The MCP values BarnDog keeps on this machine (see `mcp env`). */
|
|
@@ -139,6 +155,7 @@ keep, runtime) {
|
|
|
139
155
|
adopted: plan,
|
|
140
156
|
backup: paths.folder,
|
|
141
157
|
...adoptionNotes(plan, sourceOf, keep),
|
|
158
|
+
signIn: await signInTools(adoptedServers(plan, record, sourceOf), runtime),
|
|
142
159
|
events,
|
|
143
160
|
canShare: await hasSharedWorkspace(home),
|
|
144
161
|
};
|