@rbbtsn0w/adg 0.11.0 → 0.11.1-dev.pr200.c6ce45e

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 (59) hide show
  1. package/README.md +131 -73
  2. package/dist/src/agents/antigravity.js +218 -45
  3. package/dist/src/agents/base.js +1 -1
  4. package/dist/src/agents/claude.js +98 -38
  5. package/dist/src/agents/codex.js +32 -42
  6. package/dist/src/cli/core-plugin-handlers.js +3 -3
  7. package/dist/src/cli/handlers.js +171 -39
  8. package/dist/src/cli/index.js +23 -14
  9. package/dist/src/cli/review-update.js +80 -0
  10. package/dist/src/commands/install/default-dsl.js +1 -1
  11. package/dist/src/commands/install/discovery.js +3 -1
  12. package/dist/src/commands/install/install-one.js +41 -31
  13. package/dist/src/commands/install.js +59 -24
  14. package/dist/src/commands/marketplace.js +171 -115
  15. package/dist/src/commands/migrate.js +2 -2
  16. package/dist/src/commands/projection.js +3 -1
  17. package/dist/src/commands/remove.js +10 -0
  18. package/dist/src/commands/review-executables.js +106 -0
  19. package/dist/src/commands/select-agents.js +2 -2
  20. package/dist/src/commands/select-components.js +2 -2
  21. package/dist/src/commands/select-plugins.js +15 -2
  22. package/dist/src/commands/select-scope.js +3 -4
  23. package/dist/src/commands/source-upgrade.js +552 -0
  24. package/dist/src/commands/state.js +3 -1
  25. package/dist/src/commands/status.js +1 -0
  26. package/dist/src/commands/update.js +3 -1
  27. package/dist/src/lock.js +13 -5
  28. package/dist/src/migration-transaction.js +1011 -0
  29. package/dist/src/native-retry.js +329 -0
  30. package/dist/src/process-identity.js +88 -0
  31. package/dist/src/render/plugins.js +149 -27
  32. package/dist/src/render/ui.js +4 -4
  33. package/dist/src/source-history.js +194 -0
  34. package/dist/src/source-intent.js +7 -0
  35. package/dist/src/store-mutex.js +179 -0
  36. package/dist/src/types.js +1 -1
  37. package/dist/src/update-executables.js +193 -0
  38. package/dist/src/upgrade-plan.js +378 -0
  39. package/docs/agents/antigravity.md +5 -0
  40. package/docs/agents-spec.md +10 -0
  41. package/docs/branching-and-release.md +369 -55
  42. package/docs/cli-json.md +9 -0
  43. package/docs/marketing/README.md +211 -0
  44. package/docs/marketing/assets.json +228 -0
  45. package/docs/marketing/capture.json +130 -0
  46. package/docs/marketing/live-readiness.json +353 -0
  47. package/docs/marketing/posts.en.md +94 -0
  48. package/docs/marketing/posts.zh-CN.md +67 -0
  49. package/docs/marketing/production.md +210 -0
  50. package/docs/marketing/source/timeline.json +29 -0
  51. package/docs/marketing/source/workflow-01.svg +16 -0
  52. package/docs/marketing/source/workflow-02.svg +14 -0
  53. package/docs/marketing/source/workflow-03.svg +19 -0
  54. package/docs/marketing/source/workflow-poster.svg +32 -0
  55. package/docs/marketing/transcript.md +48 -0
  56. package/docs/plugin-update-semantics.md +53 -10
  57. package/docs/plugin-upgrade-migrations.md +349 -0
  58. package/package.json +14 -10
  59. package/schemas/plugin-lock.schema.json +78 -1
@@ -3,6 +3,7 @@ import { relative } from "node:path";
3
3
  import { ADAPTER_TARGETS } from "../adapters/index.js";
4
4
  import { installPlugin } from "./install.js";
5
5
  import { resolvePluginSourceSnapshot } from "../source-cache.js";
6
+ import { preservedSelection, requestedSelectionKnown } from "../source-history.js";
6
7
  /**
7
8
  * Shared selection for the projection verbs (link / unlink / sync). Resolve which
8
9
  * installed plugins to act on: the named subset (validated against the store), or
@@ -42,7 +43,8 @@ export function rematerializeInstalled(pluginsDir, plugins) {
42
43
  pluginsDir,
43
44
  origin: plugin.origin,
44
45
  resolvedRevision: plugin.resolvedRevision,
45
- selection: plugin.selection,
46
+ selection: preservedSelection(pluginsDir, plugin.name, plugin),
47
+ selectionKnown: requestedSelectionKnown(plugin),
46
48
  targets: [...ADAPTER_TARGETS],
47
49
  forceMaterialize: true,
48
50
  }));
@@ -1,3 +1,4 @@
1
+ import { sourceIntent } from "../source-intent.js";
1
2
  import { existsSync, lstatSync, readdirSync, readlinkSync, rmdirSync, rmSync } from "node:fs";
2
3
  import { basename, dirname, join, resolve } from "node:path";
3
4
  import { claudeSkillsDir, lockPath, marketplacePath, pluginCacheRoot, pluginDir, pluginSourceCacheDir } from "../paths.js";
@@ -64,6 +65,15 @@ export function removePlugin(opts) {
64
65
  if (existsSync(cacheRoot) && readdirSync(cacheRoot).length === 0)
65
66
  rmSync(cacheRoot, { recursive: true, force: true });
66
67
  }
68
+ const origin = lock.plugins[name]?.origin;
69
+ if (origin?.type === "github") {
70
+ const intent = sourceIntent(lock, origin.repo, origin.ref);
71
+ if (intent) {
72
+ intent.roots = intent.roots.filter((root) => root !== name);
73
+ if (!intent.excluded.includes(name))
74
+ intent.excluded.push(name);
75
+ }
76
+ }
67
77
  const removedFromLock = removeEntry(lock, name);
68
78
  if (removedFromLock)
69
79
  writeLock(lockFile, lock);
@@ -0,0 +1,106 @@
1
+ import { createHash } from "node:crypto";
2
+ import { existsSync } from "node:fs";
3
+ import { pluginContents } from "../components.js";
4
+ import { readManifest } from "../manifest.js";
5
+ import { pluginSourceCacheDir } from "../paths.js";
6
+ import { COMPONENT_TYPES, resolveSelectionDependencies, } from "../types.js";
7
+ import { executableInventory } from "../update-executables.js";
8
+ import { contentHash } from "./install/install-one.js";
9
+ import { requestedSelectionKnown, verifiedInstalledPayload } from "../source-history.js";
10
+ export class UpdateCancelled extends Error {
11
+ partial;
12
+ }
13
+ export function verifiedSource(pluginsDir, name, entry) {
14
+ const cached = pluginSourceCacheDir(pluginsDir, name);
15
+ try {
16
+ if (existsSync(cached) && contentHash(cached, readManifest(cached)) === entry.sourceHash)
17
+ return cached;
18
+ }
19
+ catch { /* Damaged source metadata is unavailable evidence; the update can rebuild it. */ }
20
+ return undefined;
21
+ }
22
+ /** Selections are shared across projections. Ask once per effective service or hook file. */
23
+ export async function reviewExecutables(pluginsDir, intent, candidates, targets, review) {
24
+ const permissions = [];
25
+ const selections = new Map();
26
+ const blockers = [];
27
+ for (const { name, candidate, selection, old } of candidates) {
28
+ const effective = resolveSelectionDependencies(candidate.manifest, selection);
29
+ const proposed = executableInventory(candidate.dir, candidate.manifest, effective, targets);
30
+ if (!proposed.length)
31
+ continue;
32
+ const selectionKnown = old && requestedSelectionKnown(old);
33
+ // Complete source bytes establish permission only with a known requested policy.
34
+ const previous = old && ((selectionKnown ? verifiedSource(pluginsDir, name, old) : undefined)
35
+ ?? verifiedInstalledPayload(pluginsDir, name, old));
36
+ const prior = previous
37
+ ? executableInventory(previous, readManifest(previous), selectionKnown ? resolveSelectionDependencies(readManifest(previous), old?.selection) : undefined, targets)
38
+ : [];
39
+ const approved = new Set(prior.map((entry) => entry.id));
40
+ const groups = new Map();
41
+ for (const entry of proposed) {
42
+ const group = entry.component + ":" + entry.member;
43
+ const entries = groups.get(group) ?? [];
44
+ entries.push(entry);
45
+ groups.set(group, entries);
46
+ }
47
+ for (const entries of groups.values()) {
48
+ if (entries.every((entry) => approved.has(entry.id)))
49
+ continue;
50
+ const first = entries[0];
51
+ const hash = createHash("sha256")
52
+ .update(JSON.stringify(entries.map((entry) => entry.id).sort()))
53
+ .digest("hex");
54
+ permissions.push({
55
+ key: name + ":" + hash,
56
+ name,
57
+ component: first.component,
58
+ member: first.member,
59
+ label: name +
60
+ " / " +
61
+ [...new Set(entries.filter((entry) => !approved.has(entry.id)).map((entry) => entry.label))].join(", "),
62
+ previouslyEnabled: prior.some((entry) => entry.component === first.component && (first.component === "hooks" || entry.member === first.member)),
63
+ });
64
+ }
65
+ }
66
+ const unknown = permissions.filter((item) => intent.executableDecisions?.[item.key] === undefined);
67
+ if (unknown.length) {
68
+ if (!review)
69
+ return { selections, blockers: unknown.map((item) => "Approval required: " + item.label), reviewed: false };
70
+ const answer = await review({ source: intent.source, history: [], executable: unknown });
71
+ if (!answer)
72
+ throw new UpdateCancelled();
73
+ intent.executableDecisions ??= {};
74
+ for (const item of unknown)
75
+ intent.executableDecisions[item.key] = answer.allow.includes(item.key);
76
+ }
77
+ for (const { name, candidate, selection } of candidates) {
78
+ const denied = permissions.filter((item) => item.name === name && !intent.executableDecisions?.[item.key]);
79
+ if (!denied.length)
80
+ continue;
81
+ // Replacing an existing live handler/service with a denied revision would
82
+ // remove a capability the user already relies on. Preserve the old group.
83
+ if (denied.some((item) => item.previouslyEnabled)) {
84
+ blockers.push("The existing installation was kept because this update changes " +
85
+ denied.map((item) => item.label).join(", ") +
86
+ ".");
87
+ continue;
88
+ }
89
+ const denyHooks = denied.some((item) => item.component === "hooks");
90
+ const servers = denied.filter((item) => item.component === "mcp").map((item) => item.member);
91
+ const filtered = {
92
+ ...selection,
93
+ components: (selection?.components ?? [...COMPONENT_TYPES]).filter((component) => component !== "hooks" || !denyHooks),
94
+ };
95
+ if (servers.length)
96
+ filtered.mcp = (selection?.mcp ?? pluginContents(candidate.dir, candidate.manifest).mcp).filter((server) => !servers.includes(server));
97
+ const checked = resolveSelectionDependencies(candidate.manifest, filtered);
98
+ if (executableInventory(candidate.dir, candidate.manifest, checked, targets).some((item) => (denyHooks && item.component === "hooks") || (item.component === "mcp" && servers.includes(item.member)))) {
99
+ blockers.push(name + " requires a declined executable component. The current installation was kept.");
100
+ }
101
+ else {
102
+ selections.set(name, filtered);
103
+ }
104
+ }
105
+ return { selections, blockers, reviewed: permissions.length > 0 };
106
+ }
@@ -1,3 +1,4 @@
1
+ import { UpdateCancelled } from "./source-upgrade.js";
1
2
  import * as p from "@clack/prompts";
2
3
  import pc from "picocolors";
3
4
  import { allAgents, detectedAgents } from "../agents/index.js";
@@ -33,8 +34,7 @@ export async function selectTargetsInteractive() {
33
34
  required: true,
34
35
  });
35
36
  if (p.isCancel(selected)) {
36
- p.cancel("Installation cancelled");
37
- process.exit(0);
37
+ throw new UpdateCancelled("Installation cancelled");
38
38
  }
39
39
  return selected;
40
40
  }
@@ -1,10 +1,10 @@
1
+ import { UpdateCancelled } from "./source-upgrade.js";
1
2
  import * as p from "@clack/prompts";
2
3
  import pc from "picocolors";
3
4
  import { multiselectSkills } from "./multiselect-skills.js";
4
5
  function cancelled(value) {
5
6
  if (p.isCancel(value)) {
6
- p.cancel("Installation cancelled");
7
- process.exit(0);
7
+ throw new UpdateCancelled("Installation cancelled");
8
8
  }
9
9
  return false;
10
10
  }
@@ -1,11 +1,25 @@
1
1
  import * as p from "@clack/prompts";
2
2
  import pc from "picocolors";
3
+ import { UpdateCancelled } from "./source-upgrade.js";
4
+ export const FOLLOW_ALL_PLUGINS = ":follow-all";
3
5
  /**
4
6
  * Interactive multiselect for choosing which plugins to install from a source
5
7
  * that holds several. Mirrors the skills install flow. Native (reverse-adapted)
6
8
  * plugins are flagged so the user knows they came from a Claude/Codex manifest.
7
9
  */
8
10
  export async function selectPluginsInteractive(choices) {
11
+ const subscription = await p.select({
12
+ message: "Choose how this source is followed",
13
+ options: [
14
+ { value: "selected", label: "Choose plugins", hint: "update selected plugins; do not automatically add future plugins" },
15
+ { value: "all", label: "Follow all plugins", hint: "install every current plugin and subscribe to future additions" },
16
+ ],
17
+ initialValue: "selected",
18
+ });
19
+ if (p.isCancel(subscription))
20
+ throw new UpdateCancelled("Installation cancelled");
21
+ if (subscription === "all")
22
+ return [FOLLOW_ALL_PLUGINS];
9
23
  const selected = await p.multiselect({
10
24
  message: `Select plugins to install ${pc.dim("(space to toggle)")}`,
11
25
  options: choices.map((c) => ({
@@ -18,8 +32,7 @@ export async function selectPluginsInteractive(choices) {
18
32
  required: true,
19
33
  });
20
34
  if (p.isCancel(selected)) {
21
- p.cancel("Installation cancelled");
22
- process.exit(0);
35
+ throw new UpdateCancelled("Installation cancelled");
23
36
  }
24
37
  return selected;
25
38
  }
@@ -1,3 +1,4 @@
1
+ import { UpdateCancelled } from "./source-upgrade.js";
1
2
  import * as p from "@clack/prompts";
2
3
  /**
3
4
  * Ask whether to install into the project (.agents/plugins) or globally
@@ -13,8 +14,7 @@ export async function selectScopeInteractive() {
13
14
  ],
14
15
  });
15
16
  if (p.isCancel(scope)) {
16
- p.cancel("Installation cancelled");
17
- process.exit(0);
17
+ throw new UpdateCancelled("Installation cancelled");
18
18
  }
19
19
  return scope;
20
20
  }
@@ -33,8 +33,7 @@ export async function selectUpdateScopeInteractive() {
33
33
  ],
34
34
  });
35
35
  if (p.isCancel(scope)) {
36
- p.cancel("Cancelled");
37
- process.exit(0);
36
+ throw new UpdateCancelled("Installation cancelled");
38
37
  }
39
38
  return scope;
40
39
  }