barndog 0.1.1 → 0.2.1
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 +31 -28
- package/dist/cli.js +11 -7
- package/dist/commands/add.js +34 -21
- package/dist/commands/adopt.js +91 -0
- package/dist/commands/arguments.js +12 -0
- package/dist/commands/asset-install.js +161 -0
- package/dist/commands/asset-list.js +126 -0
- package/dist/commands/asset-share.js +94 -0
- package/dist/commands/auth.js +4 -0
- package/dist/commands/availability.js +72 -27
- package/dist/commands/capabilities.js +79 -417
- package/dist/commands/collaboration.js +212 -108
- package/dist/commands/environment.js +18 -411
- package/dist/commands/github.js +200 -0
- package/dist/commands/harnesses.js +74 -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-env.js +78 -0
- package/dist/commands/mcp.js +64 -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 +36 -25
- package/dist/commands/sync.js +13 -5
- package/dist/commands/workspace.js +75 -23
- package/dist/config/environment.js +13 -27
- package/dist/config/paths.js +81 -0
- package/dist/config/selection.js +30 -0
- package/dist/config/settings.js +99 -108
- package/dist/config/state.js +67 -55
- 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/adoption/adopt.js +234 -0
- package/dist/features/adoption/copies.js +29 -0
- package/dist/features/adoption/originals.js +116 -0
- package/dist/features/adoption/record.js +120 -0
- package/dist/features/adoption/restore.js +28 -0
- package/dist/features/adoption/scan.js +482 -0
- package/dist/features/adoption/undo.js +42 -0
- package/dist/features/asset-kinds/index.js +129 -0
- package/dist/features/asset-selection/index.js +51 -19
- package/dist/features/auth/credentials.js +80 -54
- package/dist/features/auth/session.js +83 -49
- package/dist/features/auth/transport.js +69 -17
- 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 +242 -152
- package/dist/features/collaboration/workspace-github.js +118 -54
- package/dist/features/collaboration/workspace-store.js +157 -97
- package/dist/features/collaboration/workspace.js +278 -173
- package/dist/features/discovery/index.js +68 -57
- package/dist/features/doctor/index.js +56 -26
- package/dist/features/environment/auto-sync.js +28 -27
- package/dist/features/environment/harnesses.js +36 -0
- package/dist/features/environment/moves.js +171 -0
- package/dist/features/environment/names.js +73 -49
- package/dist/features/environment/operations.js +322 -229
- package/dist/features/environment/own-entries.js +89 -0
- package/dist/features/environment/settle-names.js +91 -0
- package/dist/features/environment/stage.js +202 -0
- package/dist/features/environment/sync.js +127 -487
- package/dist/features/environment/transaction.js +179 -147
- package/dist/features/environment/writes.js +243 -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 +55 -0
- package/dist/features/hooks/divergence.js +36 -12
- package/dist/features/hooks/test.js +91 -66
- package/dist/features/hooks/types.js +1 -0
- package/dist/features/imports/discover.js +133 -60
- package/dist/features/imports/folder.js +48 -14
- package/dist/features/imports/local.js +127 -135
- package/dist/features/imports/remote.js +46 -26
- package/dist/features/inspection/index.js +17 -17
- package/dist/features/inventory/index.js +111 -111
- package/dist/features/inventory/show.js +74 -0
- package/dist/features/knowledge/index.js +69 -49
- package/dist/features/mcps/catalog.js +31 -0
- package/dist/features/mcps/import.js +369 -0
- package/dist/features/mcps/index.js +104 -50
- package/dist/features/mcps/values.js +33 -0
- package/dist/features/migration/migrate.js +263 -0
- package/dist/features/migration/move.js +448 -0
- package/dist/features/migration/promote.js +26 -0
- package/dist/features/native/adapters.js +69 -96
- package/dist/features/native/configuration.js +134 -84
- package/dist/features/native/hook-shell.js +55 -0
- package/dist/features/native/plugin-module.js +56 -0
- package/dist/features/native/secret-values.js +74 -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/secrets/index.js +77 -0
- 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 +121 -54
- package/dist/features/workspace/git.js +221 -0
- package/dist/features/workspace/installed.js +92 -0
- package/dist/features/{git-workspace → workspace}/overlay.js +53 -46
- package/dist/features/workspace/packages.js +173 -0
- package/dist/features/{git-workspace → workspace}/publish.js +120 -64
- package/dist/features/workspace/repo-source.js +193 -0
- package/dist/features/{git-workspace → workspace}/setup.js +72 -45
- package/dist/features/{git-workspace → workspace}/snapshot.js +60 -19
- 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 +67 -1
- package/dist/harnesses/cursor.js +22 -1
- package/dist/harnesses/detect.js +6 -50
- package/dist/harnesses/formats.js +52 -0
- package/dist/harnesses/opencode.js +108 -0
- package/dist/harnesses/registry.js +35 -2
- package/dist/platform.js +403 -0
- package/dist/program.js +275 -56
- 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 +107 -0
- package/dist/shared/lock.js +113 -0
- package/dist/shared/lookup.js +11 -0
- package/dist/shared/patterns.js +102 -0
- package/dist/shared/shell.js +20 -0
- package/dist/shared/values.js +26 -0
- package/dist/ui/add-asset.js +41 -400
- package/dist/ui/add-hook.js +219 -0
- package/dist/ui/add-mcp.js +170 -0
- package/dist/ui/add-prompts.js +47 -0
- package/dist/ui/add-skills.js +117 -0
- package/dist/ui/adopt.js +197 -0
- package/dist/ui/asset-list.js +31 -13
- package/dist/ui/assets.js +38 -47
- package/dist/ui/auth.js +45 -34
- package/dist/ui/clash.js +10 -6
- package/dist/ui/collaboration.js +116 -44
- package/dist/ui/connection.js +17 -6
- 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/harness-picker.js +18 -0
- package/dist/ui/hook-compatibility.js +14 -6
- package/dist/ui/mcp.js +28 -3
- package/dist/ui/move.js +57 -6
- package/dist/ui/onboarding.js +148 -95
- package/dist/ui/options.js +9 -0
- package/dist/ui/output.js +108 -43
- package/dist/ui/package-details.js +34 -0
- package/dist/ui/pick.js +45 -33
- package/dist/ui/scope-install.js +18 -7
- package/dist/ui/secret-input.js +19 -0
- package/dist/ui/selection.js +17 -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/move.js +0 -337
- 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,121 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
throw new CliError(`This needs a BarnDog Cloud Workspace. This machine keeps its assets in ${settings.gitWorkspace ? "a Git repo" : "a local folder"}.`, settings.gitWorkspace
|
|
16
|
-
? "barndog migrate --to <server>"
|
|
17
|
-
: "barndog init --server <url>");
|
|
18
|
-
if (!settings || settings.version !== 2 || !settings.connection)
|
|
19
|
-
throw new CliError("This machine isn't connected to a BarnDog workspace.", "barndog init");
|
|
20
|
-
const saved = settings.connection;
|
|
21
|
-
if (expected &&
|
|
22
|
-
(expected.server !== saved.server ||
|
|
23
|
-
expected.organizationId !== saved.organizationId ||
|
|
24
|
-
expected.developerId !== saved.developerId))
|
|
25
|
-
throw new Error("Working copy belongs to another server, organization, or developer");
|
|
26
|
-
const actor = contextSchema.parse((await apiClient(saved.server, home).GET("/v1/context")).data);
|
|
27
|
-
if (actor.organization.id !== saved.organizationId ||
|
|
28
|
-
actor.developer.id !== saved.developerId)
|
|
29
|
-
throw new Error("Authenticated identity does not match the saved connection");
|
|
30
|
-
return saved;
|
|
31
|
-
}
|
|
32
|
-
export function matchesOrigin(origin, selector, conn) {
|
|
33
|
-
if (selector === "local")
|
|
34
|
-
return origin.localOnly === true;
|
|
35
|
-
if (selector === "org")
|
|
36
|
-
return origin.type === "org" && origin.id === conn.organizationId;
|
|
37
|
-
if (selector === "me")
|
|
38
|
-
return origin.type === "dev" && origin.id === conn.developerId;
|
|
39
|
-
const [type, ...rest] = selector.split(/[/:]/);
|
|
40
|
-
const value = rest.join("/");
|
|
41
|
-
return origin.type === type && [origin.id, origin.slug].includes(value);
|
|
42
|
-
}
|
|
43
|
-
export async function selectSkill(name, selector, conn, home = homedir(), kind = "skill") {
|
|
44
|
-
const values = kind === "skill"
|
|
45
|
-
? await catalog(conn, home)
|
|
46
|
-
: await hookCatalog(conn, home);
|
|
1
|
+
import { publishedSkills } from "../skills/catalog.js";
|
|
2
|
+
import { publishedHooks } from "../hooks/catalog.js";
|
|
3
|
+
import { assetNotFound } from "../asset-kinds/index.js";
|
|
4
|
+
import { unpackDownload } from "../workspace/packages.js";
|
|
5
|
+
import { packageApi } from "./api.js";
|
|
6
|
+
import { apiClient } from "../auth/transport.js";
|
|
7
|
+
import { only } from "../../shared/lookup.js";
|
|
8
|
+
import { matchesOrigin } from "../server/origin.js";
|
|
9
|
+
/**
|
|
10
|
+
* The one published Skill or Hook named `name` in the origin `selector`; throws
|
|
11
|
+
* the usual not-found error when none or several match.
|
|
12
|
+
*/
|
|
13
|
+
export async function selectPackage({ name, selector, kind, }, conn, runtime) {
|
|
14
|
+
const values = await packageCatalogs[kind](conn, runtime);
|
|
47
15
|
const matches = values.filter((s) => s.name === name && matchesOrigin(s.origin, selector, conn));
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
export async function selectOrigin(selector, conn, home = homedir()) {
|
|
53
|
-
const scopes = z
|
|
54
|
-
.array(scopeSchema)
|
|
55
|
-
.parse((await apiClient(conn.server, home).GET("/v1/scopes")).data);
|
|
56
|
-
const matches = scopes.filter((s) => matchesOrigin(s, selector, conn));
|
|
57
|
-
if (!matches.length && /^dev[/:]/.test(selector)) {
|
|
58
|
-
const actor = contextSchema.parse((await apiClient(conn.server, home).GET("/v1/context")).data);
|
|
59
|
-
if (actor.developer.role === "organization_admin") {
|
|
60
|
-
const members = z
|
|
61
|
-
.array(memberSchema)
|
|
62
|
-
.parse((await apiClient(conn.server, home).GET("/v1/organization/members"))
|
|
63
|
-
.data);
|
|
64
|
-
for (const member of members) {
|
|
65
|
-
const origin = {
|
|
66
|
-
type: "dev",
|
|
67
|
-
id: member.id,
|
|
68
|
-
slug: member.slug,
|
|
69
|
-
name: member.name,
|
|
70
|
-
canPublish: true,
|
|
71
|
-
};
|
|
72
|
-
if (matchesOrigin(origin, selector, conn))
|
|
73
|
-
matches.push(origin);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
16
|
+
const match = only(matches);
|
|
17
|
+
if (!match) {
|
|
18
|
+
throw assetNotFound(kind, name, selector);
|
|
76
19
|
}
|
|
77
|
-
|
|
78
|
-
throw new CliError(`No scope named ${selector} that you can use.`, "barndog sets list");
|
|
79
|
-
return matches[0];
|
|
20
|
+
return match;
|
|
80
21
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
throw new Error("Missing package body");
|
|
89
|
-
let size = 0;
|
|
90
|
-
const chunks = [];
|
|
91
|
-
for await (const chunk of response.body) {
|
|
92
|
-
size += chunk.length;
|
|
93
|
-
if (size > defaultLimits.compressed)
|
|
94
|
-
throw new Error("PACKAGE_TOO_LARGE");
|
|
95
|
-
chunks.push(chunk);
|
|
96
|
-
}
|
|
97
|
-
return parsePackage(Buffer.concat(chunks), defaultLimits, kind === "hook" ? "hook.yaml" : "SKILL.md");
|
|
22
|
+
/** The package of one published version, checked against that version's commit. */
|
|
23
|
+
export function downloadVersion(version, conn, { runtime, kind }) {
|
|
24
|
+
return unpackDownload(packageApi(kind, conn, runtime).versionPackage(version.id, version.number), { kind, commit: version.commit, subject: "the package" });
|
|
25
|
+
}
|
|
26
|
+
/** The package of a Suggested Change at one revision, checked against its commit. */
|
|
27
|
+
export function downloadChange(change, conn, { runtime, kind }) {
|
|
28
|
+
return unpackDownload(packageApi(kind, conn, runtime).changePackage(change.id, change.revision), { kind, commit: change.commit, subject: "the package" });
|
|
98
29
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
30
|
+
/** The package at the head of a GitHub pull request, checked against that head. */
|
|
31
|
+
export function downloadPull(pull, conn, { runtime, kind }) {
|
|
32
|
+
return unpackDownload(apiClient(conn.server, runtime).GET("/v1/git-connections/{id}/pulls/{number}/package", {
|
|
33
|
+
params: { path: { id: pull.connectionId, number: pull.number } },
|
|
34
|
+
parseAs: "stream",
|
|
35
|
+
}), { kind, commit: pull.head, subject: "the package" });
|
|
103
36
|
}
|
|
104
|
-
export
|
|
105
|
-
|
|
106
|
-
let cursor;
|
|
107
|
-
do {
|
|
108
|
-
const page = listOutputSchema.parse((await client.GET("/v1/skills", {
|
|
109
|
-
params: { query: { limit: 100, cursor } },
|
|
110
|
-
})).data);
|
|
111
|
-
if (page.skills.some((s) => s.organizationId !== conn.organizationId))
|
|
112
|
-
throw new Error("Invalid catalog organization");
|
|
113
|
-
values.push(...page.skills);
|
|
114
|
-
if (page.nextCursor && seen.has(page.nextCursor))
|
|
115
|
-
throw new Error("Invalid catalog pagination");
|
|
116
|
-
if (page.nextCursor)
|
|
117
|
-
seen.add(page.nextCursor);
|
|
118
|
-
cursor = page.nextCursor ?? undefined;
|
|
119
|
-
} while (cursor);
|
|
120
|
-
return values;
|
|
37
|
+
export function getChange(id, conn, runtime, kind) {
|
|
38
|
+
return packageApi(kind, conn, runtime).change(id);
|
|
121
39
|
}
|
|
40
|
+
/** Every published package of a kind that you can see. */
|
|
41
|
+
const packageCatalogs = { skill: publishedSkills, hook: publishedHooks };
|