@rbbtsn0w/adg 0.5.0-beta.4 → 0.5.0-beta.6
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 -2
- package/dist/bin/adg.js +6 -2
- package/dist/src/agents/antigravity.js +4 -1
- package/dist/src/agents/base.js +71 -23
- package/dist/src/agents/claude.js +31 -5
- package/dist/src/cli/handlers.js +45 -3
- package/dist/src/cli/index.js +17 -1
- package/dist/src/commands/cache.js +54 -0
- package/dist/src/commands/install.js +81 -57
- package/dist/src/commands/link.js +13 -9
- package/dist/src/commands/list.js +4 -1
- package/dist/src/commands/marketplace.js +8 -1
- package/dist/src/commands/migrate.js +73 -6
- package/dist/src/commands/projection.js +6 -0
- package/dist/src/commands/remove.js +11 -2
- package/dist/src/commands/select-components.js +2 -1
- package/dist/src/commands/state.js +18 -12
- package/dist/src/commands/sync.js +13 -9
- package/dist/src/commands/update.js +34 -36
- package/dist/src/fsutil.js +15 -2
- package/dist/src/lock.js +10 -6
- package/dist/src/manifest.js +52 -3
- package/dist/src/materialize.js +176 -0
- package/dist/src/paths.js +27 -1
- package/dist/src/render/json.js +2 -1
- package/dist/src/render/plugins.js +1 -1
- package/dist/src/self-update.js +9 -1
- package/dist/src/sources.js +35 -2
- package/dist/src/telemetry.js +9 -0
- package/dist/src/types.js +51 -1
- package/dist/src/update-check.js +3 -1
- package/docs/agents-spec.md +23 -12
- package/docs/cli-json.md +2 -1
- package/package.json +1 -1
- package/schemas/adg-plugin.schema.json +23 -0
- package/schemas/plugin-lock.schema.json +10 -5
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { existsSync, renameSync, rmSync } from "node:fs";
|
|
3
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
4
|
+
import { copyPluginDir, ensureDir, toPosix, writeJson } from "./fsutil.js";
|
|
5
|
+
import { ADG_MANIFEST_PATH } from "./manifest.js";
|
|
6
|
+
import { mcpConfigPath } from "./mcp.js";
|
|
7
|
+
import { packageFilter } from "./package.js";
|
|
8
|
+
const META_RE = /^(README|LICEN[CS]E|CHANGELOG|NOTICE)(\..+)?$/i;
|
|
9
|
+
function normalizeRelative(path) {
|
|
10
|
+
return path.replace(/^\.?[/\\]/, "").replaceAll("\\", "/").replace(/\/+$/, "");
|
|
11
|
+
}
|
|
12
|
+
function pathWithin(relPath, root) {
|
|
13
|
+
return relPath === root || relPath.startsWith(`${root}/`);
|
|
14
|
+
}
|
|
15
|
+
function declaredPaths(manifest, component) {
|
|
16
|
+
const value = component === "mcp" ? mcpConfigPath(manifest) : manifest[component];
|
|
17
|
+
if (!value)
|
|
18
|
+
return [];
|
|
19
|
+
return (Array.isArray(value) ? value : [value]).map(normalizeRelative).filter(Boolean);
|
|
20
|
+
}
|
|
21
|
+
function selectedSkillPaths(manifest, names) {
|
|
22
|
+
const declared = manifest.skills;
|
|
23
|
+
if (Array.isArray(declared)) {
|
|
24
|
+
const wanted = new Set(names);
|
|
25
|
+
const selected = declared
|
|
26
|
+
.map(normalizeRelative)
|
|
27
|
+
.filter((path) => wanted.has(basename(path)));
|
|
28
|
+
const found = new Set(selected.map((path) => basename(path)));
|
|
29
|
+
const missing = names.filter((name) => !found.has(name));
|
|
30
|
+
if (missing.length > 0)
|
|
31
|
+
throw new Error(`selected skill(s) not declared: ${missing.join(", ")}`);
|
|
32
|
+
return selected;
|
|
33
|
+
}
|
|
34
|
+
const root = normalizeRelative(declared ?? "./skills/");
|
|
35
|
+
return names.map((name) => `${root}/${name}`);
|
|
36
|
+
}
|
|
37
|
+
/** The universal manifest that truthfully describes the effective installation. */
|
|
38
|
+
export function applySelectionToManifest(manifest, selection) {
|
|
39
|
+
const effective = structuredClone(manifest);
|
|
40
|
+
if (!selection)
|
|
41
|
+
return effective;
|
|
42
|
+
const selected = new Set(selection.components);
|
|
43
|
+
if (!selected.has("skills"))
|
|
44
|
+
delete effective.skills;
|
|
45
|
+
else if (selection.skills)
|
|
46
|
+
effective.skills = selectedSkillPaths(manifest, selection.skills).map((path) => `./${path}`);
|
|
47
|
+
if (!selected.has("agents"))
|
|
48
|
+
delete effective.agents;
|
|
49
|
+
if (!selected.has("commands"))
|
|
50
|
+
delete effective.commands;
|
|
51
|
+
if (!selected.has("hooks"))
|
|
52
|
+
delete effective.hooks;
|
|
53
|
+
if (!selected.has("apps"))
|
|
54
|
+
delete effective.apps;
|
|
55
|
+
if (!selected.has("mcp"))
|
|
56
|
+
delete effective.mcpServers;
|
|
57
|
+
return effective;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Allow only files that belong to the effective selection. The canonical
|
|
61
|
+
* manifest is generated separately, so authored `.agents` and vendor adapter
|
|
62
|
+
* projections are never copied from the full source snapshot.
|
|
63
|
+
*/
|
|
64
|
+
export function effectivePackageFilter(manifest, selection) {
|
|
65
|
+
const selected = new Set(selection?.components ?? ["skills", "agents", "commands", "mcp", "hooks", "apps"]);
|
|
66
|
+
const roots = [];
|
|
67
|
+
for (const component of selected) {
|
|
68
|
+
if (component === "skills" && selection?.skills)
|
|
69
|
+
roots.push(...selectedSkillPaths(manifest, selection.skills));
|
|
70
|
+
else
|
|
71
|
+
roots.push(...declaredPaths(manifest, component));
|
|
72
|
+
}
|
|
73
|
+
return (rawPath) => {
|
|
74
|
+
if (rawPath === "")
|
|
75
|
+
return true;
|
|
76
|
+
const relPath = toPosix(rawPath);
|
|
77
|
+
if (relPath === ".agents" || relPath === ADG_MANIFEST_PATH)
|
|
78
|
+
return true;
|
|
79
|
+
if (relPath.startsWith("../") || relPath === "..")
|
|
80
|
+
return false;
|
|
81
|
+
if (!relPath.includes("/") && META_RE.test(relPath))
|
|
82
|
+
return true;
|
|
83
|
+
return roots.some((root) => pathWithin(relPath, root) || root.startsWith(`${relPath}/`));
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** Build an effective plugin in a staging directory, then atomically replace it. */
|
|
87
|
+
export function materializePlugin(opts) {
|
|
88
|
+
const destination = resolve(opts.destination);
|
|
89
|
+
const parent = dirname(destination);
|
|
90
|
+
const token = randomUUID();
|
|
91
|
+
const staging = join(parent, `.${basename(destination)}.adg-staging-${token}`);
|
|
92
|
+
const backup = join(parent, `.${basename(destination)}.adg-backup-${token}`);
|
|
93
|
+
const effectiveManifest = applySelectionToManifest(opts.manifest, opts.selection);
|
|
94
|
+
ensureDir(parent);
|
|
95
|
+
if (opts.selection) {
|
|
96
|
+
const requiredPaths = [];
|
|
97
|
+
for (const component of opts.selection.components) {
|
|
98
|
+
if (component === "skills" && opts.selection.skills)
|
|
99
|
+
requiredPaths.push(...selectedSkillPaths(opts.manifest, opts.selection.skills));
|
|
100
|
+
else
|
|
101
|
+
requiredPaths.push(...declaredPaths(opts.manifest, component));
|
|
102
|
+
}
|
|
103
|
+
const missing = requiredPaths.filter((path) => !existsSync(join(opts.source, path)));
|
|
104
|
+
if (missing.length > 0)
|
|
105
|
+
throw new Error(`selected payload path(s) not found: ${missing.join(", ")}`);
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
copyPluginDir(opts.source, staging, effectivePackageFilter(opts.manifest, opts.selection));
|
|
109
|
+
writeJson(join(staging, ADG_MANIFEST_PATH), effectiveManifest);
|
|
110
|
+
opts.build(staging, effectiveManifest);
|
|
111
|
+
if (existsSync(destination))
|
|
112
|
+
renameSync(destination, backup);
|
|
113
|
+
try {
|
|
114
|
+
renameSync(staging, destination);
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
if (existsSync(backup))
|
|
118
|
+
renameSync(backup, destination);
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
rmSync(backup, { recursive: true, force: true });
|
|
122
|
+
return effectiveManifest;
|
|
123
|
+
}
|
|
124
|
+
finally {
|
|
125
|
+
rmSync(staging, { recursive: true, force: true });
|
|
126
|
+
if (existsSync(backup) && !existsSync(destination))
|
|
127
|
+
renameSync(backup, destination);
|
|
128
|
+
else
|
|
129
|
+
rmSync(backup, { recursive: true, force: true });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Atomically expose a new complete source snapshot for a callback. If building
|
|
134
|
+
* the effective installation fails, restore the previous cache as part of the
|
|
135
|
+
* same transaction.
|
|
136
|
+
*/
|
|
137
|
+
export function withPluginSourceCache(source, cacheDir, manifest, use) {
|
|
138
|
+
const target = resolve(cacheDir);
|
|
139
|
+
if (resolve(source) === target)
|
|
140
|
+
return use(target);
|
|
141
|
+
const parent = dirname(target);
|
|
142
|
+
const token = randomUUID();
|
|
143
|
+
const staging = join(parent, `.${basename(target)}.adg-cache-${token}`);
|
|
144
|
+
const backup = join(parent, `.${basename(target)}.adg-cache-backup-${token}`);
|
|
145
|
+
ensureDir(parent);
|
|
146
|
+
let committed = false;
|
|
147
|
+
let hadPrevious = false;
|
|
148
|
+
let promoted = false;
|
|
149
|
+
try {
|
|
150
|
+
copyPluginDir(source, staging, packageFilter(manifest, { includeProjections: false }));
|
|
151
|
+
if (existsSync(target)) {
|
|
152
|
+
renameSync(target, backup);
|
|
153
|
+
hadPrevious = true;
|
|
154
|
+
}
|
|
155
|
+
renameSync(staging, target);
|
|
156
|
+
promoted = true;
|
|
157
|
+
const result = use(target);
|
|
158
|
+
committed = true;
|
|
159
|
+
rmSync(backup, { recursive: true, force: true });
|
|
160
|
+
return result;
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
if (promoted)
|
|
164
|
+
rmSync(target, { recursive: true, force: true });
|
|
165
|
+
if (hadPrevious && existsSync(backup))
|
|
166
|
+
renameSync(backup, target);
|
|
167
|
+
throw error;
|
|
168
|
+
}
|
|
169
|
+
finally {
|
|
170
|
+
rmSync(staging, { recursive: true, force: true });
|
|
171
|
+
if (!committed && hadPrevious && existsSync(backup) && !existsSync(target))
|
|
172
|
+
renameSync(backup, target);
|
|
173
|
+
if (committed)
|
|
174
|
+
rmSync(backup, { recursive: true, force: true });
|
|
175
|
+
}
|
|
176
|
+
}
|
package/dist/src/paths.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
2
3
|
import { homedir } from "node:os";
|
|
3
|
-
import { basename, dirname, join, relative } from "node:path";
|
|
4
|
+
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
4
5
|
export const LOCK_FILENAME = ".plugin-lock.json";
|
|
5
6
|
export const MARKETPLACE_FILENAME = "marketplace.json";
|
|
6
7
|
/**
|
|
@@ -51,6 +52,31 @@ export function lockPath(pluginsDir) {
|
|
|
51
52
|
export function marketplacePath(pluginsDir) {
|
|
52
53
|
return join(pluginsDir, MARKETPLACE_FILENAME);
|
|
53
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Internal full-source cache for a plugin store. The runtime-facing
|
|
57
|
+
* `pluginsDir` contains only effective installations; complete source payloads
|
|
58
|
+
* live in the sibling cache tree and are never registered with an agent.
|
|
59
|
+
*/
|
|
60
|
+
export function pluginCacheRoot(pluginsDir) {
|
|
61
|
+
const storeId = createHash("sha1").update(resolve(pluginsDir).split("\\").join("/")).digest("hex").slice(0, 12);
|
|
62
|
+
return join(dirname(pluginsDir), "cache", "plugins", storeId);
|
|
63
|
+
}
|
|
64
|
+
/** One replaceable full-source snapshot per installed plugin. */
|
|
65
|
+
export function pluginSourceCacheDir(pluginsDir, name) {
|
|
66
|
+
return join(pluginCacheRoot(pluginsDir), name);
|
|
67
|
+
}
|
|
68
|
+
/** Resolve a complete payload for rebuilding, falling back to a live local source. */
|
|
69
|
+
export function pluginRematerializationSource(pluginsDir, name, origin) {
|
|
70
|
+
const cache = pluginSourceCacheDir(pluginsDir, name);
|
|
71
|
+
if (existsSync(cache))
|
|
72
|
+
return cache;
|
|
73
|
+
if (origin.type === "local") {
|
|
74
|
+
const localPath = resolve(pluginsDir, origin.path);
|
|
75
|
+
if (existsSync(localPath))
|
|
76
|
+
return localPath;
|
|
77
|
+
}
|
|
78
|
+
throw new Error(`source cache missing for "${name}"; run \`adg plugins update\` or re-add the plugin`);
|
|
79
|
+
}
|
|
54
80
|
/** True when `pluginsDir` has the canonical `<root>/.agents/plugins` shape. */
|
|
55
81
|
export function isCanonicalPluginsDir(pluginsDir) {
|
|
56
82
|
return basename(pluginsDir) === "plugins" && basename(dirname(pluginsDir)) === ".agents";
|
package/dist/src/render/json.js
CHANGED
|
@@ -20,7 +20,8 @@ export function pluginsListJson(plugins, pluginsDir) {
|
|
|
20
20
|
name: plugin.name,
|
|
21
21
|
version: plugin.version,
|
|
22
22
|
source: plugin.origin,
|
|
23
|
-
|
|
23
|
+
sourceHash: plugin.sourceHash,
|
|
24
|
+
installedHash: plugin.installedHash,
|
|
24
25
|
installedAt: plugin.installedAt,
|
|
25
26
|
updatedAt: plugin.updatedAt,
|
|
26
27
|
path: installedPluginDir(pluginsDir, plugin.name, plugin.origin),
|
|
@@ -69,7 +69,7 @@ export function renderPluginList(plugins, pluginsDir, opts = {}) {
|
|
|
69
69
|
const name = ui.name(r.label.padEnd(nameW));
|
|
70
70
|
const path = ui.meta(ellipsizeStart(r.path, pathW).padEnd(pathW));
|
|
71
71
|
out.push(`${name} ${path} ${ui.meta("Agents:")} ${r.agents}`);
|
|
72
|
-
const provenance = `[${r.p.origin.type}] ${(r.p.
|
|
72
|
+
const provenance = `[${r.p.origin.type}] ${(r.p.installedHash ?? "").slice(0, 19)}${partial}`;
|
|
73
73
|
out.push(ui.meta(` ${[provenance, ...r.counts].join(" ")}`));
|
|
74
74
|
if (opts.verbose)
|
|
75
75
|
out.push(...renderContents(r.p.contents, 4));
|
package/dist/src/self-update.js
CHANGED
|
@@ -26,8 +26,16 @@ export function selfUpdateCommand(beta, npmBin = "npm") {
|
|
|
26
26
|
args: ["install", "-g", `${PACKAGE_NAME}@${selfUpdateTarget(beta)}`],
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
+
export function selfUpdateSpawnOptions(platform = process.platform) {
|
|
30
|
+
return { stdio: "inherit", shell: platform === "win32" };
|
|
31
|
+
}
|
|
29
32
|
export function selfUpdateHint(latestVersion) {
|
|
30
|
-
|
|
33
|
+
const channel = prereleaseChannel(latestVersion);
|
|
34
|
+
if (channel === "beta")
|
|
35
|
+
return "adg update --beta";
|
|
36
|
+
if (channel)
|
|
37
|
+
return `npm install -g ${PACKAGE_NAME}@${latestVersion}`;
|
|
38
|
+
return "adg update";
|
|
31
39
|
}
|
|
32
40
|
export const SELF_UPDATE_USAGE = `adg update — upgrade the ADG CLI
|
|
33
41
|
|
package/dist/src/sources.js
CHANGED
|
@@ -6,6 +6,31 @@ import { SpanKind, SpanStatusCode } from "@opentelemetry/api";
|
|
|
6
6
|
import { getTracer, sanitizeArgs } from "./telemetry.js";
|
|
7
7
|
const GH_SHORTHAND = /^([\w.-]+)\/([\w.-]+?)(?:@(.+))?$/;
|
|
8
8
|
const GH_URL = /^(?:https?:\/\/github\.com\/|git@github\.com:)([\w.-]+)\/([\w.-]+?)(?:\.git)?(?:@(.+))?$/;
|
|
9
|
+
const GH_BLOB_URL = /^(?:https?:\/\/github\.com\/)([\w.-]+)\/([\w.-]+?)(?:\.git)?\/(?:blob|tree)\/([^/]+)\/(.+)$/;
|
|
10
|
+
function stripKnownManifestSuffix(path) {
|
|
11
|
+
const normalized = path.replace(/\\/g, "/");
|
|
12
|
+
const suffixes = [
|
|
13
|
+
".agents/.plugin.json",
|
|
14
|
+
".claude-plugin/plugin.json",
|
|
15
|
+
".codex-plugin/plugin.json",
|
|
16
|
+
".adg-plugin/plugin.json",
|
|
17
|
+
];
|
|
18
|
+
for (const suffix of suffixes) {
|
|
19
|
+
if (normalized === suffix)
|
|
20
|
+
return "";
|
|
21
|
+
if (normalized.endsWith(`/${suffix}`))
|
|
22
|
+
return normalized.slice(0, -(suffix.length + 1));
|
|
23
|
+
}
|
|
24
|
+
return normalized;
|
|
25
|
+
}
|
|
26
|
+
function decodeGitHubUrlPart(value) {
|
|
27
|
+
try {
|
|
28
|
+
return decodeURIComponent(value);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
9
34
|
/**
|
|
10
35
|
* Parse an install spec into a local directory or a GitHub source.
|
|
11
36
|
*
|
|
@@ -15,12 +40,20 @@ const GH_URL = /^(?:https?:\/\/github\.com\/|git@github\.com:)([\w.-]+)\/([\w.-]
|
|
|
15
40
|
export function parseSource(spec) {
|
|
16
41
|
if (existsSync(spec))
|
|
17
42
|
return { kind: "local", dir: spec };
|
|
18
|
-
const
|
|
43
|
+
const clean = spec.replace(/[?#].*$/, "");
|
|
44
|
+
const blob = clean.match(GH_BLOB_URL);
|
|
45
|
+
if (blob) {
|
|
46
|
+
const [, owner, repo, ref, path] = blob;
|
|
47
|
+
const decodedRef = decodeGitHubUrlPart(ref);
|
|
48
|
+
const decodedPath = decodeGitHubUrlPart(path);
|
|
49
|
+
return { ...gh(owner, repo, decodedRef), path: stripKnownManifestSuffix(decodedPath) };
|
|
50
|
+
}
|
|
51
|
+
const url = clean.match(GH_URL);
|
|
19
52
|
if (url) {
|
|
20
53
|
const [, owner, repo, ref] = url;
|
|
21
54
|
return gh(owner, repo, ref);
|
|
22
55
|
}
|
|
23
|
-
const short =
|
|
56
|
+
const short = clean.match(GH_SHORTHAND);
|
|
24
57
|
if (short) {
|
|
25
58
|
const [, owner, repo, ref] = short;
|
|
26
59
|
return gh(owner, repo, ref);
|
package/dist/src/telemetry.js
CHANGED
|
@@ -74,3 +74,12 @@ export function sanitizeArgs(args) {
|
|
|
74
74
|
return arg;
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
+
/** Record a privacy-safe event without allowing telemetry to affect CLI behavior. */
|
|
78
|
+
export function recordTelemetryEvent(name, attributes, span = opentelemetry.trace.getActiveSpan()) {
|
|
79
|
+
try {
|
|
80
|
+
span?.addEvent(name, attributes);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
// Telemetry must never change CLI behavior.
|
|
84
|
+
}
|
|
85
|
+
}
|
package/dist/src/types.js
CHANGED
|
@@ -2,9 +2,59 @@
|
|
|
2
2
|
* ADG type definitions mirroring the JSON Schemas under ../schemas.
|
|
3
3
|
*/
|
|
4
4
|
export const ADG_SCHEMA_VERSION = "adg.plugin/v1";
|
|
5
|
-
export const LOCK_VERSION =
|
|
5
|
+
export const LOCK_VERSION = 3;
|
|
6
6
|
/** The component categories a plugin can expose. */
|
|
7
7
|
export const COMPONENT_TYPES = ["skills", "agents", "commands", "mcp", "hooks", "apps"];
|
|
8
|
+
/** Canonicalize user intent without adding derived component dependencies. */
|
|
9
|
+
export function normalizePluginSelection(selection) {
|
|
10
|
+
if (!selection)
|
|
11
|
+
return undefined;
|
|
12
|
+
const components = new Set(selection.components);
|
|
13
|
+
if (selection.skills !== undefined)
|
|
14
|
+
components.add("skills");
|
|
15
|
+
return {
|
|
16
|
+
components: COMPONENT_TYPES.filter((component) => components.has(component)),
|
|
17
|
+
...(selection.skills !== undefined ? { skills: [...new Set(selection.skills)].sort() } : {}),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** Expand mandatory component/skill requirements to a stable closure. */
|
|
21
|
+
export function resolveSelectionDependencies(manifest, selection) {
|
|
22
|
+
const normalized = normalizePluginSelection(selection);
|
|
23
|
+
if (!normalized)
|
|
24
|
+
return undefined;
|
|
25
|
+
const components = new Set(normalized.components);
|
|
26
|
+
let skills = normalized.skills ? new Set(normalized.skills) : undefined;
|
|
27
|
+
let changed = true;
|
|
28
|
+
while (changed) {
|
|
29
|
+
changed = false;
|
|
30
|
+
for (const component of [...components]) {
|
|
31
|
+
const requirement = manifest.selectionDependencies?.[component];
|
|
32
|
+
for (const required of requirement?.components ?? []) {
|
|
33
|
+
if (!components.has(required)) {
|
|
34
|
+
components.add(required);
|
|
35
|
+
changed = true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
for (const skill of requirement?.skills ?? []) {
|
|
39
|
+
if (!components.has("skills")) {
|
|
40
|
+
components.add("skills");
|
|
41
|
+
skills = new Set();
|
|
42
|
+
changed = true;
|
|
43
|
+
}
|
|
44
|
+
// `skills === undefined` means the user selected every skill, which
|
|
45
|
+
// already contains any required skill and must remain unrestricted.
|
|
46
|
+
if (skills && !skills.has(skill)) {
|
|
47
|
+
skills.add(skill);
|
|
48
|
+
changed = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
components: COMPONENT_TYPES.filter((component) => components.has(component)),
|
|
55
|
+
...(skills ? { skills: [...skills].sort() } : {}),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
8
58
|
export function pluginState(entry) {
|
|
9
59
|
return entry?.state ?? "enabled";
|
|
10
60
|
}
|
package/dist/src/update-check.js
CHANGED
|
@@ -158,7 +158,9 @@ export function checkForUpdate(currentVersion, env = process.env, refresh = sche
|
|
|
158
158
|
}
|
|
159
159
|
/** Format an update notice for display on stderr. */
|
|
160
160
|
export function formatUpdateNotice(currentVersion, latestVersion) {
|
|
161
|
+
const channel = prereleaseChannel(latestVersion);
|
|
162
|
+
const npmTarget = channel ? latestVersion : "latest";
|
|
161
163
|
return (`\n Update available: ${currentVersion} → ${latestVersion}\n` +
|
|
162
164
|
` Run: ${selfUpdateHint(latestVersion)}\n` +
|
|
163
|
-
` npm: npm install -g ${PACKAGE_NAME}@${
|
|
165
|
+
` npm: npm install -g ${PACKAGE_NAME}@${npmTarget}\n`);
|
|
164
166
|
}
|
package/docs/agents-spec.md
CHANGED
|
@@ -82,10 +82,12 @@ are ADG-internal conventions, not declared in the manifest.
|
|
|
82
82
|
|
|
83
83
|
## 3. Packaging — manifest-driven allowlist
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
ADG first stores the complete declared payload in an internal source cache, then
|
|
86
|
+
materializes an **effective installation** into the runtime-facing plugins
|
|
87
|
+
directory. The effective installation contains only the selected components and
|
|
88
|
+
skills; unselected conventional directories such as `hooks/` do not exist for an
|
|
89
|
+
agent to auto-load. Authoring files (`src/`, `test/`, docs, CI config, …) never
|
|
90
|
+
enter either packaged view.
|
|
89
91
|
|
|
90
92
|
The packaged file set (`src/package.ts:packagedRoots` / `packageFilter`) is:
|
|
91
93
|
|
|
@@ -93,13 +95,23 @@ The packaged file set (`src/package.ts:packagedRoots` / `packageFilter`) is:
|
|
|
93
95
|
- the top-level path segment of every declared component pointer
|
|
94
96
|
(`skills`/`commands`/`agents`/`mcpServers`/`hooks`/`apps`);
|
|
95
97
|
- canonical metadata at the root: `README*`, `LICENSE*`, `CHANGELOG*`, `NOTICE*`;
|
|
96
|
-
-
|
|
97
|
-
|
|
98
|
+
- runtime projections are never copied from the source cache; ADG regenerates
|
|
99
|
+
`.claude-plugin/`, `.codex-plugin/`, and Antigravity files in staging.
|
|
98
100
|
|
|
99
|
-
The
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
The lock records two hashes: `sourceHash` covers the complete cached payload and
|
|
102
|
+
`installedHash` covers the effective selection. Runtime projections are excluded
|
|
103
|
+
from both hashes so re-adapting does not churn content identity.
|
|
104
|
+
|
|
105
|
+
The cache is scoped by a stable store id under the store's sibling
|
|
106
|
+
`cache/plugins/` tree. `adg plugins cache status` reports its contents,
|
|
107
|
+
`cache prune` removes orphan snapshots, and `cache clean --force` removes all
|
|
108
|
+
snapshots. A missing remote snapshot must be restored with `plugins update` or
|
|
109
|
+
`plugins add`; a still-available local source is used directly as fallback.
|
|
110
|
+
|
|
111
|
+
When one selected component requires another component or a bootstrap skill, the
|
|
112
|
+
source manifest declares that closure with `selectionDependencies`. ADG expands
|
|
113
|
+
the selection before copying or hashing, so the lock, effective manifest, and
|
|
114
|
+
physical payload all describe the same installation.
|
|
103
115
|
|
|
104
116
|
A plugin needing finer exclusion *within* a component directory SHOULD use git's
|
|
105
117
|
native `.gitattributes export-ignore` rather than a bespoke ignore format.
|
|
@@ -125,7 +137,7 @@ a human or generated by an agent. Beyond JSON-schema validity it SHOULD enforce:
|
|
|
125
137
|
## 5. Migration from `.adg-plugin/`
|
|
126
138
|
|
|
127
139
|
1. Move `.adg-plugin/plugin.json` → `.agents/.plugin.json` (content unchanged).
|
|
128
|
-
2. Run `adg plugins update` so lock `
|
|
140
|
+
2. Run `adg plugins update` so lock `sourceHash` and `installedHash` values reflect the new layout.
|
|
129
141
|
3. `adg plugins validate` to confirm. (Re-run `adg plugins adapt` only if you
|
|
130
142
|
commit projections for a native registry.)
|
|
131
143
|
|
|
@@ -301,4 +313,3 @@ When support for a new agent runtime is needed:
|
|
|
301
313
|
4. **Update cross-agent matrices** (§8–§11) to include the new agent column.
|
|
302
314
|
5. **Add hook event support** in [`src/hooks.ts`](../src/hooks.ts) `SUPPORTED_EVENTS`.
|
|
303
315
|
6. **Test** via `adg plugins adapt --target <agent>` and `adg plugins validate`.
|
|
304
|
-
|
package/docs/cli-json.md
CHANGED
|
@@ -34,7 +34,8 @@ Shape:
|
|
|
34
34
|
"name": "apple-skills",
|
|
35
35
|
"version": "1.13.2",
|
|
36
36
|
"source": { "type": "github", "repo": "RbBtSn0w/apple-skills" },
|
|
37
|
-
"
|
|
37
|
+
"sourceHash": "sha256-...",
|
|
38
|
+
"installedHash": "sha256-...",
|
|
38
39
|
"installedAt": "2026-06-26T00:00:00.000Z",
|
|
39
40
|
"updatedAt": "2026-06-26T00:00:00.000Z",
|
|
40
41
|
"path": "/absolute/path/to/.agents/plugins/RbBtSn0w__apple-skills/apple-skills",
|
package/package.json
CHANGED
|
@@ -66,6 +66,29 @@
|
|
|
66
66
|
"additionalProperties": false
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
|
+
"selectionDependencies": {
|
|
70
|
+
"type": "object",
|
|
71
|
+
"description": "Mandatory payload closure for each selected component.",
|
|
72
|
+
"additionalProperties": false,
|
|
73
|
+
"patternProperties": {
|
|
74
|
+
"^(skills|agents|commands|mcp|hooks|apps)$": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"additionalProperties": false,
|
|
77
|
+
"properties": {
|
|
78
|
+
"components": {
|
|
79
|
+
"type": "array",
|
|
80
|
+
"items": { "enum": ["skills", "agents", "commands", "mcp", "hooks", "apps"] },
|
|
81
|
+
"uniqueItems": true
|
|
82
|
+
},
|
|
83
|
+
"skills": {
|
|
84
|
+
"type": "array",
|
|
85
|
+
"items": { "type": "string" },
|
|
86
|
+
"uniqueItems": true
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
69
92
|
"strict": {
|
|
70
93
|
"type": "boolean",
|
|
71
94
|
"description": "When true, only skills listed in the manifest are exposed; when false, the skills directory is auto-scanned.",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"required": ["version", "plugins"],
|
|
8
8
|
"additionalProperties": false,
|
|
9
9
|
"properties": {
|
|
10
|
-
"version": { "type": "integer", "description": "Lock file format version.", "const":
|
|
10
|
+
"version": { "type": "integer", "description": "Lock file format version.", "const": 3 },
|
|
11
11
|
"plugins": {
|
|
12
12
|
"type": "object",
|
|
13
13
|
"additionalProperties": { "$ref": "#/$defs/lockEntry" }
|
|
@@ -20,14 +20,19 @@
|
|
|
20
20
|
"$defs": {
|
|
21
21
|
"lockEntry": {
|
|
22
22
|
"type": "object",
|
|
23
|
-
"required": ["origin", "version", "
|
|
23
|
+
"required": ["origin", "version", "sourceHash", "installedHash", "installedAt", "updatedAt"],
|
|
24
24
|
"additionalProperties": false,
|
|
25
25
|
"properties": {
|
|
26
26
|
"origin": { "$ref": "#/$defs/source" },
|
|
27
27
|
"version": { "type": "string" },
|
|
28
|
-
"
|
|
28
|
+
"sourceHash": {
|
|
29
29
|
"type": "string",
|
|
30
|
-
"description": "
|
|
30
|
+
"description": "Digest of the complete cached source payload.",
|
|
31
|
+
"pattern": "^[a-z0-9]+-[0-9a-f]+$"
|
|
32
|
+
},
|
|
33
|
+
"installedHash": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "Digest of the effective runtime installation.",
|
|
31
36
|
"pattern": "^[a-z0-9]+-[0-9a-f]+$"
|
|
32
37
|
},
|
|
33
38
|
"installedAt": { "type": "string", "format": "date-time" },
|
|
@@ -42,7 +47,7 @@
|
|
|
42
47
|
},
|
|
43
48
|
"selection": {
|
|
44
49
|
"type": "object",
|
|
45
|
-
"description": "Partial-install selection: which components/skills
|
|
50
|
+
"description": "Partial-install selection: which components/skills are physically materialized and exposed. Absent = install everything.",
|
|
46
51
|
"required": ["components"],
|
|
47
52
|
"additionalProperties": false,
|
|
48
53
|
"properties": {
|