barndog 0.1.1 → 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 +8 -7
- 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 +13 -3
- 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
|
@@ -1,39 +1,58 @@
|
|
|
1
|
-
import { homedir } from "node:os";
|
|
2
1
|
import { readSettings } from "../config/settings.js";
|
|
3
2
|
import { CliError } from "../errors.js";
|
|
4
3
|
import { readCredentials } from "../features/auth/credentials.js";
|
|
5
|
-
import { LOCAL_ORIGIN } from "../features/
|
|
6
|
-
|
|
4
|
+
import { LOCAL_ORIGIN } from "../features/workspace/overlay.js";
|
|
5
|
+
/** Every `skills changes …` and `hooks changes …` command. */
|
|
6
|
+
const CHANGES_COMMANDS = /^(?:skills|hooks) changes(?: |$)/;
|
|
7
|
+
/**
|
|
8
|
+
* Commands that need a BarnDog server, matched against the command's words
|
|
9
|
+
* without the program name: `auth status`, `skills fork`, `github pulls list`.
|
|
10
|
+
* `src/tests/patterns.test.ts` checks that each still matches a real command.
|
|
11
|
+
*
|
|
12
|
+
* @internal Exported for its table test in `src/tests/patterns.test.ts`.
|
|
13
|
+
*/
|
|
14
|
+
export const cloudOnlyCommands = [
|
|
7
15
|
/^login$/,
|
|
8
16
|
/^auth status$/,
|
|
9
17
|
/^whoami$/,
|
|
10
18
|
/^open$/,
|
|
11
|
-
/^people( |$)/,
|
|
12
|
-
/^github( |$)/,
|
|
13
|
-
|
|
14
|
-
/^(skills|mcp|hooks) (fork|promote)$/,
|
|
15
|
-
/^mcp (create|update)$/,
|
|
19
|
+
/^people(?: |$)/,
|
|
20
|
+
/^github(?: |$)/,
|
|
21
|
+
CHANGES_COMMANDS,
|
|
22
|
+
/^(?:skills|mcp|hooks) (?:fork|promote)$/,
|
|
23
|
+
/^mcp (?:create|update)$/,
|
|
16
24
|
];
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Commands that need published versions and reviews, which a local folder lacks.
|
|
27
|
+
*
|
|
28
|
+
* @internal Exported for its table test in `src/tests/patterns.test.ts`.
|
|
29
|
+
*/
|
|
30
|
+
export const reviewCommands = [
|
|
31
|
+
/^(?:pull|push|resolve)$/,
|
|
32
|
+
/^(?:skills|hooks) (?:pull|push|create|versions|show|diff)$/,
|
|
20
33
|
/^mcp versions$/,
|
|
21
34
|
];
|
|
22
35
|
/** The setup this machine runs on, when that setup limits what commands can do. */
|
|
23
|
-
export async function currentSetupMode(
|
|
36
|
+
export async function currentSetupMode(runtime) {
|
|
37
|
+
const { home } = runtime;
|
|
24
38
|
const settings = await readSettings(home).catch(() => null);
|
|
25
|
-
if (settings
|
|
39
|
+
if (!settings || settings.connection) {
|
|
26
40
|
return undefined;
|
|
27
|
-
|
|
41
|
+
}
|
|
42
|
+
if (settings.gitWorkspace) {
|
|
28
43
|
return "git";
|
|
44
|
+
}
|
|
29
45
|
return settings.localWorkspace ? "local" : undefined;
|
|
30
46
|
}
|
|
31
47
|
/** What a command needs that this setup lacks; undefined when it can run. */
|
|
32
48
|
export function commandNeeds(command, mode) {
|
|
33
|
-
if (
|
|
49
|
+
if (cloudOnlyCommands.some((pattern) => pattern.test(command))) {
|
|
34
50
|
return "cloud";
|
|
35
|
-
|
|
51
|
+
}
|
|
52
|
+
if (mode === "local" &&
|
|
53
|
+
reviewCommands.some((pattern) => pattern.test(command))) {
|
|
36
54
|
return "shared";
|
|
55
|
+
}
|
|
37
56
|
return undefined;
|
|
38
57
|
}
|
|
39
58
|
export const needText = (need) => need === "cloud" ? "a Cloud Workspace" : "a Git repo or Cloud Workspace";
|
|
@@ -47,41 +66,50 @@ const why = {
|
|
|
47
66
|
open: "opens the BarnDog Cloud Workspace in your browser",
|
|
48
67
|
};
|
|
49
68
|
/** Stops commands the current setup can't run, before they prompt or reach a server. */
|
|
50
|
-
export async function assertCommandAvailable(path, options
|
|
69
|
+
export async function assertCommandAvailable(path, options, runtime) {
|
|
70
|
+
const { home } = runtime;
|
|
51
71
|
const settings = await readSettings(home).catch(() => null);
|
|
52
72
|
if (path.join(" ") === "logout" && !settings) {
|
|
53
|
-
if (!(await readCredentials(
|
|
73
|
+
if (!(await readCredentials(runtime)).selectedServer) {
|
|
54
74
|
throw new CliError("You aren't signed in.");
|
|
75
|
+
}
|
|
55
76
|
return;
|
|
56
77
|
}
|
|
57
|
-
if (settings
|
|
78
|
+
if (!settings || settings.connection) {
|
|
58
79
|
return;
|
|
80
|
+
}
|
|
59
81
|
const git = settings.gitWorkspace;
|
|
60
82
|
const folder = settings.localWorkspace?.path;
|
|
61
|
-
if (!git && !folder)
|
|
83
|
+
if (!git && !folder) {
|
|
62
84
|
return;
|
|
85
|
+
}
|
|
63
86
|
const command = path.join(" ");
|
|
64
87
|
const where = git
|
|
65
88
|
? `a Git repo (${git.url})`
|
|
66
89
|
: `a folder on this machine (${folder})`;
|
|
67
90
|
if (command === "logout") {
|
|
68
|
-
const { selectedServer } = await readCredentials(
|
|
69
|
-
if (!selectedServer)
|
|
91
|
+
const { selectedServer } = await readCredentials(runtime);
|
|
92
|
+
if (!selectedServer) {
|
|
70
93
|
throw new CliError(`You aren't signed in. This machine keeps its assets in ${where}, so it doesn't need a sign-in.`);
|
|
94
|
+
}
|
|
71
95
|
return;
|
|
72
96
|
}
|
|
73
|
-
if (git &&
|
|
97
|
+
if (git && CHANGES_COMMANDS.test(command)) {
|
|
74
98
|
throw new CliError(`Reviews happen as pull requests on your Git host, because this machine keeps its assets in ${where}.`, "barndog status");
|
|
99
|
+
}
|
|
75
100
|
// An explicit server is how local assets get promoted without switching.
|
|
76
|
-
if (command === "login" && options.server)
|
|
101
|
+
if (command === "login" && options.server) {
|
|
77
102
|
return;
|
|
78
|
-
|
|
103
|
+
}
|
|
104
|
+
if (command.endsWith(" promote") && options.origin === LOCAL_ORIGIN) {
|
|
79
105
|
return;
|
|
106
|
+
}
|
|
80
107
|
const needs = commandNeeds(command, git ? "git" : "local");
|
|
81
108
|
if (needs === "cloud") {
|
|
82
109
|
const action = why[command] ?? "needs a BarnDog Cloud Workspace";
|
|
83
110
|
throw new CliError(`\`barndog ${command}\` ${action}, but this machine keeps its assets in ${where}.${git ? "" : " Your local assets stay active if you switch."}`, "barndog init --server <url>");
|
|
84
111
|
}
|
|
85
|
-
if (needs === "shared")
|
|
112
|
+
if (needs === "shared") {
|
|
86
113
|
throw new CliError(`\`barndog ${command}\` works with shared versions and reviews, which assets in a local folder don't have. Edit them directly in ${folder}, then sync.`, "barndog sync");
|
|
114
|
+
}
|
|
87
115
|
}
|