@stigmer/cli 3.19.0 → 3.19.1-dev.20260920100552

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 (106) hide show
  1. package/commands/apply.d.ts.map +1 -1
  2. package/commands/apply.js +42 -100
  3. package/commands/apply.js.map +1 -1
  4. package/commands/validate.js +3 -4
  5. package/commands/validate.js.map +1 -1
  6. package/local/bootstrap.d.ts +1 -2
  7. package/local/bootstrap.d.ts.map +1 -1
  8. package/local/bootstrap.js +13 -41
  9. package/local/bootstrap.js.map +1 -1
  10. package/local/daemon/launch.d.ts +2 -2
  11. package/local/daemon/launch.d.ts.map +1 -1
  12. package/local/daemon/launch.js +2 -2
  13. package/local/daemon/launch.js.map +1 -1
  14. package/local/plugins/defaults.js +2 -2
  15. package/local/plugins/defaults.js.map +1 -1
  16. package/package.json +7 -7
  17. package/registry/index.d.ts +2 -2
  18. package/registry/index.d.ts.map +1 -1
  19. package/registry/index.js +2 -2
  20. package/registry/index.js.map +1 -1
  21. package/registry/metadata.d.ts +9 -0
  22. package/registry/metadata.d.ts.map +1 -1
  23. package/registry/metadata.js +14 -5
  24. package/registry/metadata.js.map +1 -1
  25. package/registry/registry.d.ts +9 -0
  26. package/registry/registry.d.ts.map +1 -1
  27. package/registry/registry.js +16 -1
  28. package/registry/registry.js.map +1 -1
  29. package/registry/verb-support.d.ts.map +1 -1
  30. package/registry/verb-support.js +0 -13
  31. package/registry/verb-support.js.map +1 -1
  32. package/resources/apply/apply.d.ts +11 -12
  33. package/resources/apply/apply.d.ts.map +1 -1
  34. package/resources/apply/apply.js +12 -21
  35. package/resources/apply/apply.js.map +1 -1
  36. package/resources/apply/handlers.js +2 -2
  37. package/resources/apply/handlers.js.map +1 -1
  38. package/resources/delete.d.ts.map +1 -1
  39. package/resources/delete.js +0 -1
  40. package/resources/delete.js.map +1 -1
  41. package/resources/get-bindings.d.ts.map +1 -1
  42. package/resources/get-bindings.js +0 -5
  43. package/resources/get-bindings.js.map +1 -1
  44. package/resources/list.d.ts.map +1 -1
  45. package/resources/list.js +0 -1
  46. package/resources/list.js.map +1 -1
  47. package/resources/validate.d.ts.map +1 -1
  48. package/resources/validate.js +0 -2
  49. package/resources/validate.js.map +1 -1
  50. package/src/commands/apply.ts +35 -150
  51. package/src/commands/validate.ts +2 -4
  52. package/src/local/bootstrap.test.ts +15 -59
  53. package/src/local/bootstrap.ts +12 -53
  54. package/src/local/daemon/launch.ts +4 -4
  55. package/src/local/plugins/defaults.ts +2 -2
  56. package/src/registry/index.ts +7 -1
  57. package/src/registry/metadata.ts +15 -5
  58. package/src/registry/registry.test.ts +1 -7
  59. package/src/registry/registry.ts +17 -1
  60. package/src/registry/verb-support.ts +0 -13
  61. package/src/resources/apply/apply.integration.test.ts +15 -3
  62. package/src/resources/apply/apply.ts +15 -26
  63. package/src/resources/apply/handlers.ts +2 -2
  64. package/src/resources/delete.ts +0 -1
  65. package/src/resources/get-bindings.ts +0 -5
  66. package/src/resources/list.ts +0 -1
  67. package/src/resources/validate.test.ts +0 -1
  68. package/src/resources/validate.ts +0 -2
  69. package/local/seedpack-retire.d.ts +0 -63
  70. package/local/seedpack-retire.d.ts.map +0 -1
  71. package/local/seedpack-retire.js +0 -361
  72. package/local/seedpack-retire.js.map +0 -1
  73. package/resources/apply/declarative.d.ts +0 -106
  74. package/resources/apply/declarative.d.ts.map +0 -1
  75. package/resources/apply/declarative.js +0 -397
  76. package/resources/apply/declarative.js.map +0 -1
  77. package/resources/apply/synth/project-track.d.ts +0 -21
  78. package/resources/apply/synth/project-track.d.ts.map +0 -1
  79. package/resources/apply/synth/project-track.js +0 -102
  80. package/resources/apply/synth/project-track.js.map +0 -1
  81. package/resources/apply/synth/reader.d.ts +0 -18
  82. package/resources/apply/synth/reader.d.ts.map +0 -1
  83. package/resources/apply/synth/reader.js +0 -55
  84. package/resources/apply/synth/reader.js.map +0 -1
  85. package/resources/apply/synth/runtime.d.ts +0 -8
  86. package/resources/apply/synth/runtime.d.ts.map +0 -1
  87. package/resources/apply/synth/runtime.js +0 -32
  88. package/resources/apply/synth/runtime.js.map +0 -1
  89. package/resources/apply/synth/synthesize.d.ts +0 -43
  90. package/resources/apply/synth/synthesize.d.ts.map +0 -1
  91. package/resources/apply/synth/synthesize.js +0 -115
  92. package/resources/apply/synth/synthesize.js.map +0 -1
  93. package/src/local/seedpack-retire.test.ts +0 -499
  94. package/src/local/seedpack-retire.ts +0 -474
  95. package/src/resources/apply/declarative.integration.test.ts +0 -204
  96. package/src/resources/apply/declarative.test.ts +0 -132
  97. package/src/resources/apply/declarative.ts +0 -491
  98. package/src/resources/apply/synth/capstone.integration.test.ts +0 -134
  99. package/src/resources/apply/synth/project-track.integration.test.ts +0 -194
  100. package/src/resources/apply/synth/project-track.ts +0 -126
  101. package/src/resources/apply/synth/reader.test.ts +0 -90
  102. package/src/resources/apply/synth/reader.ts +0 -68
  103. package/src/resources/apply/synth/runtime.test.ts +0 -29
  104. package/src/resources/apply/synth/runtime.ts +0 -39
  105. package/src/resources/apply/synth/synthesize.test.ts +0 -109
  106. package/src/resources/apply/synth/synthesize.ts +0 -161
@@ -1,361 +0,0 @@
1
- // Retiring the seedpack: the one-time removal, on an existing local install,
2
- // of the system content an older release seeded (a `stigmer-seedpack`
3
- // Project in the system org and its member agents, skills, MCP servers and
4
- // workflows). Newer releases seed nothing but the default plugins, so the
5
- // rows have no owner left; `stigmer up` runs this step once and reports
6
- // exactly what it did. This module goes when the Project kind goes.
7
- //
8
- // Shape: the client-side mirror of the server's plugin uninstall
9
- // (GuardMembersUnreferenced then CascadeDeleteMembers in the plugin
10
- // controller). Before anything is deleted, every agent the identity can see
11
- // is read and its spec walked for ApiResourceReferences, the same walk the
12
- // server's ValidateReferences runs; a member some user-authored agent still
13
- // references is KEPT and the report names the referrer, because an
14
- // individual delete never refuses on that ground and a dangling reference
15
- // found at the user's next session is the worse outcome. The one deliberate
16
- // difference from the server's guard, and its reason: the guard refuses the
17
- // whole uninstall and tells the user to detach first; a retire inside `up`
18
- // has no user to ask, so it keeps only what is referenced and removes the
19
- // rest. Members referencing each other are the seedpack's own business and
20
- // never keep anything. A member the default plugins ADOPTED (the bootstrap
21
- // runs first, and the plugin push takes over the system-content row it
22
- // replaces in place, so the seedpack's `assistant` keeps its id and every
23
- // conversation with it) now carries `stigmer.ai/plugin` and is reported as
24
- // such, never deleted: the store says what was adopted, this module keeps
25
- // no list of its own. Deletes run children-first in reference order
26
- // (workflows, agents, skills, MCP servers) through the same SDK calls
27
- // `stigmer delete` binds, so a refusal reaches the user as the server's
28
- // own sentence; the Project row goes last and the marker file with it. A
29
- // failure part-way leaves a Project whose members are still listed, and the
30
- // next `up` converges.
31
- //
32
- // Known limit, shared with the server's guard: a workflow names the agent it
33
- // calls by a DSL string, not a reference, so a user workflow that calls a
34
- // seedpack agent is not seen and not protected.
35
- import { existsSync, rmSync } from "node:fs";
36
- import { join } from "node:path";
37
- import { reflect } from "@bufbuild/protobuf/reflect";
38
- import { AgentSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/api_pb";
39
- import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
40
- import { isNotFound } from "@stigmer/sdk";
41
- import { log } from "../logger.js";
42
- import { defaultRegistry } from "../registry/index.js";
43
- import { DELETE_HANDLERS } from "../resources/delete.js";
44
- import { getterFor } from "../resources/get-bindings.js";
45
- import { SYSTEM_ORG } from "./system-org.js";
46
- /**
47
- * The seedpack Project's slug, as every release before this one wrote it
48
- * (the server derived it from `metadata.name` in the seedpack's manifest).
49
- * Pinned bytes of installs that predate this release.
50
- */
51
- export const SEEDPACK_PROJECT_SLUG = "stigmer-seedpack";
52
- /**
53
- * The marker older releases wrote in the data dir to skip an unchanged
54
- * seedpack. Nothing reads it any more; the retire removes it so a data dir
55
- * carries no trace of a mechanism that no longer exists.
56
- */
57
- export const SEEDPACK_MARKER_FILE = ".seedpack-bootstrapped";
58
- /** The order members are removed in: a referrer before what it references. */
59
- const REMOVAL_ORDER = [
60
- ApiResourceKind.workflow,
61
- ApiResourceKind.agent,
62
- ApiResourceKind.skill,
63
- ApiResourceKind.mcp_server,
64
- ];
65
- const REFERRER_PAGE_SIZE = 100;
66
- /**
67
- * Retire the seedpack Project the system org may hold. Idempotent: no
68
- * Project, no work beyond one read and a stale marker's removal.
69
- */
70
- export async function retireSeedpack(stigmer, options) {
71
- const project = await readProject(stigmer);
72
- if (project === undefined) {
73
- removeMarker(options.markerDir);
74
- return { present: false };
75
- }
76
- const members = (project.members ?? []).map(toMember);
77
- const referrers = await indexReferrers(stigmer, members);
78
- const pluginSlugs = new Map();
79
- const outcomes = [];
80
- for (const member of inRemovalOrder(members)) {
81
- const by = referrers.get(keyOf(member));
82
- if (by !== undefined) {
83
- outcomes.push({ action: "kept-referenced", member, by });
84
- continue;
85
- }
86
- outcomes.push(await removeMember(stigmer, member, pluginSlugs));
87
- }
88
- let projectRemoved = true;
89
- let projectRefusal;
90
- try {
91
- await stigmer.project.delete(project.id);
92
- }
93
- catch (error) {
94
- projectRemoved = false;
95
- projectRefusal = messageOf(error);
96
- log.warn("seedpack project delete refused", { error: projectRefusal });
97
- }
98
- removeMarker(options.markerDir);
99
- return projectRefusal === undefined
100
- ? { present: true, outcomes, projectRemoved }
101
- : { present: true, outcomes, projectRemoved, projectRefusal };
102
- }
103
- /** The report `stigmer up` prints, one block on stderr through `say`. */
104
- export function renderRetireReport(result, say) {
105
- if (!result.present)
106
- return;
107
- const removed = result.outcomes.filter((outcome) => outcome.action === "removed").length;
108
- const adopted = result.outcomes.filter((outcome) => outcome.action === "adopted").length;
109
- const kept = result.outcomes.filter((outcome) => outcome.action === "kept-referenced" ||
110
- outcome.action === "kept-refused");
111
- const tail = [
112
- adopted === 0 ? "" : `${count(adopted, "resource")} now managed by a plugin`,
113
- kept.length === 0 ? "" : `kept ${count(kept.length, "resource")}`,
114
- ].filter((part) => part !== "");
115
- say(`Retired the system content an older release installed: removed ${count(removed, "resource")}` +
116
- (tail.length === 0 ? "." : `, ${tail.join(", ")}.`));
117
- for (const outcome of result.outcomes) {
118
- switch (outcome.action) {
119
- case "removed":
120
- case "already-gone":
121
- break;
122
- case "adopted":
123
- say(` ${describe(outcome.member)} is now managed by plugin '${outcome.byPlugin}'; its instances and conversations continue`);
124
- break;
125
- case "kept-referenced":
126
- say(` kept ${describe(outcome.member)}: referenced by ${outcome.by.join(", ")}`);
127
- break;
128
- case "kept-refused":
129
- say(` kept ${describe(outcome.member)}: ${outcome.reason}`);
130
- break;
131
- default: {
132
- const exhaustive = outcome;
133
- throw new Error(`unhandled outcome ${String(exhaustive)}`);
134
- }
135
- }
136
- }
137
- if (kept.length > 0) {
138
- say(" A kept resource's icon no longer resolves. Once its referrer is edited, remove it with 'stigmer delete <kind> <org>/<slug>'.");
139
- }
140
- if (!result.projectRemoved) {
141
- say(` The '${SEEDPACK_PROJECT_SLUG}' project row could not be removed: ${result.projectRefusal ?? "unknown reason"}. Run 'stigmer up' again to retry.`);
142
- }
143
- }
144
- async function readProject(stigmer) {
145
- try {
146
- const project = await stigmer.project.getByReference({
147
- org: SYSTEM_ORG,
148
- slug: SEEDPACK_PROJECT_SLUG,
149
- });
150
- return { id: project.metadata?.id ?? "", members: project.spec?.members };
151
- }
152
- catch (error) {
153
- if (isNotFound(error))
154
- return undefined;
155
- throw error;
156
- }
157
- }
158
- function toMember(ref) {
159
- // Stored references are absolute, but an empty org can only mean the
160
- // Project's own.
161
- return { kind: ref.kind, org: ref.org || SYSTEM_ORG, slug: ref.slug };
162
- }
163
- function keyOf(member) {
164
- return `${member.kind}:${member.org}/${member.slug}`;
165
- }
166
- function inRemovalOrder(members) {
167
- const ordered = [];
168
- for (const kind of REMOVAL_ORDER) {
169
- ordered.push(...members.filter((member) => member.kind === kind));
170
- }
171
- ordered.push(...members.filter((member) => !REMOVAL_ORDER.includes(member.kind)));
172
- return ordered;
173
- }
174
- /**
175
- * Every member some agent outside the seedpack references, mapped to the
176
- * agents that reference it. Reads each agent in every organization the
177
- * identity sees: the listing is search-backed and carries no spec.
178
- */
179
- async function indexReferrers(stigmer, members) {
180
- const memberKeys = new Set(members.map(keyOf));
181
- const referrers = new Map();
182
- if (memberKeys.size === 0)
183
- return referrers;
184
- const orgs = (await stigmer.organization.findMyOrganizations()).entries
185
- .map((org) => org.metadata?.slug ?? "")
186
- .filter((slug) => slug !== "");
187
- for (const org of orgs) {
188
- for (let page = 1;; page += 1) {
189
- const listing = await stigmer.agent.list({
190
- org,
191
- page: { num: page, size: REFERRER_PAGE_SIZE },
192
- });
193
- for (const entry of listing.entries) {
194
- const self = `${ApiResourceKind.agent}:${entry.org || org}/${entry.slug}`;
195
- if (memberKeys.has(self))
196
- continue;
197
- const agent = await stigmer.agent.get(entry.id);
198
- const label = `agent '${entry.org || org}/${entry.slug}'`;
199
- for (const ref of collectSpecReferences(AgentSchema, agent)) {
200
- const key = `${ref.kind}:${ref.org || org}/${ref.slug}`;
201
- if (!memberKeys.has(key))
202
- continue;
203
- const list = referrers.get(key) ?? [];
204
- if (!list.includes(label))
205
- list.push(label);
206
- referrers.set(key, list);
207
- }
208
- }
209
- if (page >= listing.totalPages)
210
- break;
211
- }
212
- }
213
- return referrers;
214
- }
215
- /**
216
- * The membership label the server stamps on every resource a plugin
217
- * materialises; its value is the plugin's id. Read here, never written: a
218
- * seedpack member carrying it was adopted by a default plugin moments ago.
219
- */
220
- const PLUGIN_LABEL = "stigmer.ai/plugin";
221
- async function removeMember(stigmer, member, pluginSlugs) {
222
- const getter = getterFor(member.kind);
223
- const deleter = DELETE_HANDLERS.get(member.kind);
224
- if (getter === undefined || deleter === undefined) {
225
- return {
226
- action: "kept-refused",
227
- member,
228
- reason: "this CLI has no delete for that kind",
229
- };
230
- }
231
- let id;
232
- try {
233
- const found = await getter(stigmer, {
234
- kind: "ref",
235
- org: member.org,
236
- slug: member.slug,
237
- });
238
- const metadata = found.message.metadata;
239
- id = metadata?.id ?? "";
240
- const pluginId = metadata?.labels?.[PLUGIN_LABEL];
241
- if (pluginId !== undefined && pluginId !== "") {
242
- return {
243
- action: "adopted",
244
- member,
245
- byPlugin: await pluginSlugOf(stigmer, pluginId, pluginSlugs),
246
- };
247
- }
248
- }
249
- catch (error) {
250
- if (isNotFound(error))
251
- return { action: "already-gone", member };
252
- return { action: "kept-refused", member, reason: messageOf(error) };
253
- }
254
- try {
255
- await deleter(stigmer, id, false);
256
- return { action: "removed", member };
257
- }
258
- catch (error) {
259
- if (isNotFound(error))
260
- return { action: "already-gone", member };
261
- return { action: "kept-refused", member, reason: messageOf(error) };
262
- }
263
- }
264
- /** The adopting plugin's slug, read once per id; a plugin row that is gone names itself. */
265
- async function pluginSlugOf(stigmer, pluginId, cache) {
266
- const known = cache.get(pluginId);
267
- if (known !== undefined)
268
- return known;
269
- let slug = pluginId;
270
- try {
271
- slug = (await stigmer.plugin.get(pluginId)).metadata?.slug || pluginId;
272
- }
273
- catch (error) {
274
- if (!isNotFound(error))
275
- throw error;
276
- }
277
- cache.set(pluginId, slug);
278
- return slug;
279
- }
280
- function removeMarker(markerDir) {
281
- const marker = join(markerDir, SEEDPACK_MARKER_FILE);
282
- if (existsSync(marker))
283
- rmSync(marker, { force: true });
284
- }
285
- function describe(member) {
286
- const info = defaultRegistry().getByKind(member.kind);
287
- const noun = info?.singular ?? ApiResourceKind[member.kind] ?? "resource";
288
- return `${noun} '${member.org}/${member.slug}'`;
289
- }
290
- function count(n, noun) {
291
- return `${n} ${noun}${n === 1 ? "" : "s"}`;
292
- }
293
- function messageOf(error) {
294
- return error instanceof Error ? error.message : String(error);
295
- }
296
- // --- The reference walk: every ApiResourceReference in a resource's spec ---
297
- //
298
- // The same traversal the server runs in its ValidateReferences step and its
299
- // plugin uninstall guard (singular, repeated and map-valued message fields,
300
- // recursively), so a reference field added to a spec is seen here without a
301
- // change. Server-internal there and not exported to clients; mirrored here
302
- // for the one client that asks the reverse question.
303
- const API_RESOURCE_REFERENCE_TYPE = "ai.stigmer.commons.apiresource.ApiResourceReference";
304
- function collectSpecReferences(schema, msg) {
305
- const refs = [];
306
- const root = reflect(schema, msg);
307
- const spec = root.fields.find((field) => field.name === "spec" && field.fieldKind === "message");
308
- if (spec === undefined || spec.fieldKind !== "message" || !root.isSet(spec)) {
309
- return refs;
310
- }
311
- walk(root.get(spec), (ref) => {
312
- refs.push({
313
- kind: numberField(ref, "kind"),
314
- slug: stringField(ref, "slug"),
315
- org: stringField(ref, "org"),
316
- });
317
- });
318
- return refs;
319
- }
320
- function walk(msg, fn) {
321
- for (const field of msg.fields) {
322
- if (field.fieldKind === "list") {
323
- if (field.listKind !== "message")
324
- continue;
325
- for (const item of msg.get(field))
326
- visit(item, fn);
327
- }
328
- else if (field.fieldKind === "map") {
329
- if (field.mapKind !== "message")
330
- continue;
331
- for (const [, value] of msg.get(field)) {
332
- visit(value, fn);
333
- }
334
- }
335
- else if (field.fieldKind === "message") {
336
- if (msg.isSet(field))
337
- visit(msg.get(field), fn);
338
- }
339
- }
340
- }
341
- function visit(sub, fn) {
342
- if (sub.desc.typeName === API_RESOURCE_REFERENCE_TYPE)
343
- fn(sub);
344
- else
345
- walk(sub, fn);
346
- }
347
- function stringField(msg, name) {
348
- const field = msg.fields.find((f) => f.name === name);
349
- if (field === undefined)
350
- return "";
351
- const value = msg.get(field);
352
- return typeof value === "string" ? value : "";
353
- }
354
- function numberField(msg, name) {
355
- const field = msg.fields.find((f) => f.name === name);
356
- if (field === undefined)
357
- return 0;
358
- const value = msg.get(field);
359
- return typeof value === "number" ? value : 0;
360
- }
361
- //# sourceMappingURL=seedpack-retire.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"seedpack-retire.js","sourceRoot":"","sources":["../../src/local/seedpack-retire.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,sEAAsE;AACtE,2EAA2E;AAC3E,0EAA0E;AAC1E,wEAAwE;AACxE,oEAAoE;AACpE,EAAE;AACF,iEAAiE;AACjE,oEAAoE;AACpE,4EAA4E;AAC5E,2EAA2E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AAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACtD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACnC,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAChD,CAAC;AAED,SAAS,WAAW,CAAC,GAAmB,EAAE,IAAY;IACpD,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACtD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC"}
@@ -1,106 +0,0 @@
1
- import { type Message } from "@bufbuild/protobuf";
2
- import { type Project } from "@stigmer/protos/ai/stigmer/tenancy/project/v1/api_pb";
3
- import type { Stigmer } from "@stigmer/sdk";
4
- import { CommandResult } from "../../output/index.js";
5
- import { type PushResult } from "../skill.js";
6
- import { type ApplyItem } from "./apply.js";
7
- import type { ApplyHandler, ControllerFn } from "./handlers.js";
8
- /** The detected CLI operation mode (mirrors Go's project.Track). */
9
- export type Track = "atomic" | "declarative" | "project";
10
- export interface DetectResult {
11
- readonly track: Track;
12
- /** Absolute path to stigmer.yaml; undefined for the atomic track. */
13
- readonly configPath?: string;
14
- /** Directory containing stigmer.yaml; undefined for the atomic track. */
15
- readonly configDir?: string;
16
- /** Parsed Project; undefined for the atomic track. */
17
- readonly project?: Project;
18
- }
19
- /**
20
- * Walk up from `startDir` (max 10 levels, matching Go) looking for stigmer.yaml.
21
- * Absent → atomic track. Present-but-invalid → a hard error (the user clearly
22
- * intended a project; help them fix it rather than silently falling back).
23
- * Present with an entry_point → the SDK "project" track (synthesis), which this
24
- * wave does not implement.
25
- */
26
- export declare function detectTrack(startDir: string, maxDepth?: number): DetectResult;
27
- /**
28
- * YAML resource files beside stigmer.yaml: top-level files plus files in
29
- * immediate subdirectories. stigmer.yaml itself is excluded, as are skill
30
- * directories (handled separately) and grouping dirs that hold skills.
31
- */
32
- export declare function scanResourceFiles(projectDir: string): string[];
33
- /**
34
- * Skill directories beside stigmer.yaml: immediate children that contain a
35
- * SKILL.md (flat layout), plus grandchildren under a grouping dir like skills/
36
- * (organized layout). Scanning stops one level deep, matching Go.
37
- */
38
- export declare function scanSkillDirectories(projectDir: string): string[];
39
- /**
40
- * Build ordered apply items from scanned resource files. Project documents are
41
- * skipped (stigmer.yaml is already loaded) and Organization documents are
42
- * skipped with a warning — an organization sits above a project in the resource
43
- * hierarchy and must be applied independently with file mode.
44
- */
45
- export declare function buildDeclarativeItems(files: readonly string[], warn: (line: string) => void): ApplyItem[];
46
- export interface DeclarativeDeps {
47
- /** Raw command-controller accessor (full-proto apply, preserves metadata.id). */
48
- readonly controller: ControllerFn;
49
- /** High-level client for skill push + post-apply MCP discovery. */
50
- readonly stigmer: Stigmer;
51
- /** Resolved organization (already validated non-empty by the caller). */
52
- readonly org: string;
53
- /** Human progress lines (stderr; not a parity surface). */
54
- readonly info: (line: string) => void;
55
- /** Warnings (stderr). */
56
- readonly warn: (line: string) => void;
57
- }
58
- /**
59
- * Apply a declarative project: scan the directory for YAML resources and skill
60
- * directories, marshal each resource, then hand everything to the shared
61
- * reconciler. This adapter's only job is "filesystem → resources + skill
62
- * sources"; the synthesis track has its own adapter ("SDK → resources + skill
63
- * sources") and both converge on {@link reconcileProjectMembers} (DD-009 §6).
64
- */
65
- export declare function applyDeclarative(detect: DetectResult, deps: DeclarativeDeps): Promise<CommandResult>;
66
- /** A resource ready to apply: its handler plus the fully-marshalled message. */
67
- export interface ReconcileResource {
68
- readonly handler: ApplyHandler;
69
- readonly message: Message;
70
- }
71
- /**
72
- * A skill to push as a project member. `local` is a directory beside the
73
- * project (declarative) or resolved from a SkillSynth local path (synthesis);
74
- * `git` is a remote repo cloned on demand (synthesis only — SkillSynth git).
75
- */
76
- export type SkillSource = {
77
- readonly kind: "local";
78
- readonly dir: string;
79
- readonly tag: string;
80
- } | {
81
- readonly kind: "git";
82
- readonly url: string;
83
- readonly ref: string;
84
- readonly subdir: string;
85
- readonly tag: string;
86
- };
87
- /**
88
- * Reconcile a project's membership: push skills first (agents may reference
89
- * them), apply MCP servers and run capability discovery on them, apply the
90
- * remaining resources, collect references to the member-eligible ones, then
91
- * apply the project with that exact member set so the server can reconcile by
92
- * set-difference (orphan pruning is server-side; see S1 in commands/apply.ts).
93
- */
94
- export declare function reconcileProjectMembers(project: Project, resources: readonly ReconcileResource[], skillSources: readonly SkillSource[], deps: DeclarativeDeps): Promise<CommandResult>;
95
- /**
96
- * Push one skill source and return the result. Local sources push directly;
97
- * git sources clone to a temp dir, push from the subdir, then clean up
98
- * (mirrors `commands/push.ts` --git-url and Go's `pushSkillSynth`).
99
- */
100
- export declare function pushSkillSource(client: Stigmer, src: SkillSource, org: string, info: (line: string) => void): Promise<PushResult>;
101
- /** Dry-run: validate every resource without touching the backend. */
102
- export declare function previewDeclarative(detect: DetectResult, deps: Pick<DeclarativeDeps, "controller" | "warn">): {
103
- results: CommandResult[];
104
- summary: CommandResult;
105
- };
106
- //# sourceMappingURL=declarative.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"declarative.d.ts","sourceRoot":"","sources":["../../../src/resources/apply/declarative.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAWpE,OAAO,EAAE,KAAK,OAAO,EAAiB,MAAM,sDAAsD,CAAC;AAGnG,OAAO,KA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