barndog 0.2.1 → 0.2.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.
Files changed (53) hide show
  1. package/README.md +19 -0
  2. package/dist/cli.js +27 -1
  3. package/dist/commands/asset-list.js +5 -1
  4. package/dist/commands/harnesses.js +32 -2
  5. package/dist/commands/mcp-env.js +130 -41
  6. package/dist/commands/sets.js +13 -2
  7. package/dist/commands/uninstall.js +62 -0
  8. package/dist/config/paths.js +2 -0
  9. package/dist/entry/update-check.js +15 -0
  10. package/dist/features/adoption/adopt.js +31 -30
  11. package/dist/features/auth/session.js +22 -0
  12. package/dist/features/collaboration/workspace-store.js +2 -1
  13. package/dist/features/doctor/index.js +25 -8
  14. package/dist/features/environment/events.js +8 -1
  15. package/dist/features/environment/kept-values.js +68 -0
  16. package/dist/features/environment/moves.js +17 -1
  17. package/dist/features/environment/stage.js +20 -20
  18. package/dist/features/environment/sync.js +2 -2
  19. package/dist/features/inventory/index.js +45 -2
  20. package/dist/features/mcps/import.js +36 -15
  21. package/dist/features/mcps/index.js +12 -2
  22. package/dist/features/mcps/values.js +108 -20
  23. package/dist/features/migration/migrate.js +15 -0
  24. package/dist/features/migration/move.js +34 -9
  25. package/dist/features/native/adapters.js +1 -2
  26. package/dist/features/native/hook-shell.js +11 -0
  27. package/dist/features/secrets/index.js +94 -29
  28. package/dist/features/uninstall/index.js +126 -0
  29. package/dist/features/uninstall/leave.js +152 -0
  30. package/dist/features/uninstall/survey.js +103 -0
  31. package/dist/features/update-check/index.js +108 -0
  32. package/dist/features/workspace/format.js +6 -1
  33. package/dist/harnesses/claude.js +1 -1
  34. package/dist/harnesses/codex.js +46 -22
  35. package/dist/harnesses/cursor.js +1 -1
  36. package/dist/harnesses/opencode.js +1 -1
  37. package/dist/harnesses/read-renamed-variables.js +141 -0
  38. package/dist/harnesses/renamed-variables.js +99 -0
  39. package/dist/platform.js +12 -1
  40. package/dist/program.js +21 -9
  41. package/dist/ui/add-mcp.js +22 -16
  42. package/dist/ui/adopt.js +11 -6
  43. package/dist/ui/connection.js +2 -0
  44. package/dist/ui/harness-picker.js +7 -2
  45. package/dist/ui/mcp.js +89 -23
  46. package/dist/ui/move.js +2 -1
  47. package/dist/ui/output.js +33 -8
  48. package/dist/ui/secret-input.js +9 -0
  49. package/dist/ui/uninstall.js +174 -0
  50. package/dist/ui/update.js +10 -0
  51. package/dist/version.js +2 -2
  52. package/package.json +1 -1
  53. package/dist/entry/mcp-launch.js +0 -71
@@ -0,0 +1,10 @@
1
+ import { bold, dim } from "./format.js";
2
+ export function renderUpdateNotice(update) {
3
+ const install = `npm install -g barndog@${update.tag}`;
4
+ return [
5
+ "",
6
+ `A new BarnDog CLI is available: ${update.current} → ${bold(update.version)}`,
7
+ // Sync brings the registrations in each tool in line with the new version.
8
+ `${dim("Next:")} ${bold(install)}, then ${bold("barndog sync")}`,
9
+ ];
10
+ }
package/dist/version.js CHANGED
@@ -2,13 +2,13 @@ import { readFileSync } from "node:fs";
2
2
  import { z } from "zod";
3
3
  import { defaultServer } from "./config/build.js";
4
4
  /** The package version, read from package.json beside dist/ so it can't drift. */
5
- const version = z
5
+ export const cliVersion = z
6
6
  .object({ version: z.string() })
7
7
  .parse(JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"))).version;
8
8
  /** What `barndog --version` prints: enough to tell builds apart in a support report. */
9
9
  export function versionReport(platform) {
10
10
  return [
11
- `barndog ${version}`,
11
+ `barndog ${cliVersion}`,
12
12
  `Node.js ${process.version} on ${platform} ${process.arch}`,
13
13
  `Default server ${defaultServer}`,
14
14
  ].join("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "barndog",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "barndog": "dist/cli.js"
@@ -1,71 +0,0 @@
1
- import { homedir } from "node:os";
2
- import crossSpawn from "cross-spawn";
3
- import { isWindows, stopProcessTree } from "../platform.js";
4
- import { mcpDefinitionSchema } from "@barndog-ai/api-contract";
5
- import { CliError } from "../errors.js";
6
- /** Allow two seconds for the MCP child to exit before forcing shutdown. */
7
- const MCP_SHUTDOWN_GRACE_MS = 2000;
8
- // This process runs only when the native harness starts a selected stdio MCP.
9
- // Definitions contain references, never credential values. No shell is involved.
10
- try {
11
- const definition = mcpDefinitionSchema.parse(JSON.parse(Buffer.from(process.argv[2] ?? "", "base64url").toString("utf8")));
12
- if (definition.transport !== "stdio") {
13
- throw new Error("A stdio configuration is required");
14
- }
15
- const runtime = {
16
- home: homedir(),
17
- cwd: process.cwd(),
18
- env: { ...process.env },
19
- platform: process.platform,
20
- };
21
- const env = { ...runtime.env };
22
- for (const [name, reference] of Object.entries(definition.environment)) {
23
- if (!runtime.env[reference.secretRef]) {
24
- throw new CliError(`${reference.secretRef} isn't set in your environment. Set it, then restart your coding tool.`);
25
- }
26
- env[name] = runtime.env[reference.secretRef];
27
- }
28
- // cross-spawn finds the command on PATH and also starts Windows .cmd shims
29
- // (such as npx) with safely quoted arguments.
30
- const child = crossSpawn(definition.command, definition.args, {
31
- env,
32
- stdio: "inherit",
33
- detached: !isWindows(runtime.platform),
34
- cwd: runtime.cwd,
35
- windowsHide: true,
36
- });
37
- for (const signal of ["SIGINT", "SIGTERM"]) {
38
- process.on(signal, () => {
39
- const { pid } = child;
40
- if (!pid) {
41
- return;
42
- }
43
- try {
44
- stopProcessTree(child, runtime, signal);
45
- const timer = setTimeout(() => {
46
- try {
47
- stopProcessTree(child, runtime);
48
- }
49
- catch {
50
- /* exited */
51
- }
52
- }, MCP_SHUTDOWN_GRACE_MS);
53
- timer.unref();
54
- }
55
- catch {
56
- /* already exited */
57
- }
58
- });
59
- }
60
- child.once("error", () => {
61
- console.error("Unable to start the configured MCP command");
62
- process.exitCode = 1;
63
- });
64
- child.once("exit", (code) => {
65
- process.exitCode = code ?? 1;
66
- });
67
- }
68
- catch (error) {
69
- console.error(error instanceof Error ? error.message : "Invalid MCP configuration.");
70
- process.exitCode = 1;
71
- }