@solidnumber/cli 2.11.18 → 2.12.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.
Files changed (51) hide show
  1. package/README.md +9 -1
  2. package/dist/client.d.ts +38 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/client.js +66 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/commands/apply.d.ts +18 -0
  7. package/dist/commands/apply.d.ts.map +1 -0
  8. package/dist/commands/apply.js +149 -0
  9. package/dist/commands/apply.js.map +1 -0
  10. package/dist/commands/context.d.ts.map +1 -1
  11. package/dist/commands/context.js +8 -0
  12. package/dist/commands/context.js.map +1 -1
  13. package/dist/commands/embed.d.ts +8 -0
  14. package/dist/commands/embed.d.ts.map +1 -0
  15. package/dist/commands/embed.js +103 -0
  16. package/dist/commands/embed.js.map +1 -0
  17. package/dist/commands/signal.d.ts +16 -1
  18. package/dist/commands/signal.d.ts.map +1 -1
  19. package/dist/commands/signal.js +126 -27
  20. package/dist/commands/signal.js.map +1 -1
  21. package/dist/index.js +20 -5
  22. package/dist/index.js.map +1 -1
  23. package/dist/lib/api-client.d.ts +20 -3
  24. package/dist/lib/api-client.d.ts.map +1 -1
  25. package/dist/lib/api-client.js +56 -7
  26. package/dist/lib/api-client.js.map +1 -1
  27. package/dist/lib/apply/engine.d.ts +87 -0
  28. package/dist/lib/apply/engine.d.ts.map +1 -0
  29. package/dist/lib/apply/engine.js +277 -0
  30. package/dist/lib/apply/engine.js.map +1 -0
  31. package/dist/lib/apply/registry.d.ts +33 -0
  32. package/dist/lib/apply/registry.d.ts.map +1 -0
  33. package/dist/lib/apply/registry.js +93 -0
  34. package/dist/lib/apply/registry.js.map +1 -0
  35. package/dist/lib/commerce-skill.d.ts +5 -0
  36. package/dist/lib/commerce-skill.d.ts.map +1 -0
  37. package/dist/lib/commerce-skill.js +111 -0
  38. package/dist/lib/commerce-skill.js.map +1 -0
  39. package/dist/lib/embed-snippets.d.ts +36 -0
  40. package/dist/lib/embed-snippets.d.ts.map +1 -0
  41. package/dist/lib/embed-snippets.js +137 -0
  42. package/dist/lib/embed-snippets.js.map +1 -0
  43. package/dist/lib/esm-import.d.ts +2 -0
  44. package/dist/lib/esm-import.d.ts.map +1 -0
  45. package/dist/lib/esm-import.js +23 -0
  46. package/dist/lib/esm-import.js.map +1 -0
  47. package/dist/lib/lighthouse-runner.d.ts.map +1 -1
  48. package/dist/lib/lighthouse-runner.js +4 -35
  49. package/dist/lib/lighthouse-runner.js.map +1 -1
  50. package/package.json +10 -7
  51. package/platform-docs/llms.txt +7 -5
@@ -0,0 +1,277 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.parseManifest = parseManifest;
37
+ exports.extractList = extractList;
38
+ exports.specMatches = specMatches;
39
+ exports.planKind = planKind;
40
+ exports.actionIdempotencyKey = actionIdempotencyKey;
41
+ exports.tallyResults = tallyResults;
42
+ exports.reconcile = reconcile;
43
+ exports.executePlan = executePlan;
44
+ /**
45
+ * `solid apply` engine — declarative desired-state reconcile.
46
+ *
47
+ * Parse a manifest into resources, fetch current state per kind, compute a
48
+ * plan (create / update / noop / prune), then execute it. The planning core
49
+ * (parseManifest, specMatches, planKind, extractList) is pure so it's unit
50
+ * tested without HTTP; executePlan does the writes through a minimal client.
51
+ */
52
+ const yaml = __importStar(require("js-yaml"));
53
+ const node_crypto_1 = require("node:crypto");
54
+ const registry_1 = require("./registry");
55
+ /**
56
+ * Parse a manifest string (YAML or JSON) into normalized desired resources.
57
+ * Accepts: a single resource, a top-level array, `{ resources: [...] }`, and
58
+ * multi-document YAML. Each resource may be `{ kind, spec }`, k8s-style
59
+ * `{ kind, metadata, spec }`, or `{ kind, ...fields }` (fields become spec).
60
+ * `metadata.identity` (or a top-level `identity`) overrides the kind default.
61
+ */
62
+ function parseManifest(text) {
63
+ const docs = [];
64
+ // loadAll handles both single- and multi-document YAML; JSON is valid YAML.
65
+ yaml.loadAll(text, (d) => { if (d !== null && d !== undefined)
66
+ docs.push(d); });
67
+ const raw = [];
68
+ for (const doc of docs) {
69
+ if (Array.isArray(doc))
70
+ raw.push(...doc);
71
+ else if (doc && typeof doc === 'object' && Array.isArray(doc.resources)) {
72
+ raw.push(...doc.resources);
73
+ }
74
+ else
75
+ raw.push(doc);
76
+ }
77
+ return raw.map((r, i) => normalizeResource(r, i));
78
+ }
79
+ function normalizeResource(r, index) {
80
+ if (!r || typeof r !== 'object') {
81
+ throw new Error(`Manifest entry #${index + 1} is not an object`);
82
+ }
83
+ const obj = r;
84
+ const kind = String(obj.kind || '').trim();
85
+ if (!kind)
86
+ throw new Error(`Manifest entry #${index + 1} is missing "kind"`);
87
+ const recon = (0, registry_1.reconcilerFor)(kind);
88
+ if (!recon) {
89
+ throw new Error(`Unknown kind "${kind}" (known: see \`solid apply --kinds\`)`);
90
+ }
91
+ const metadata = (obj.metadata && typeof obj.metadata === 'object' ? obj.metadata : {});
92
+ // spec source: explicit `spec`, else all fields except kind/metadata.
93
+ let spec;
94
+ if (obj.spec && typeof obj.spec === 'object') {
95
+ spec = { ...obj.spec };
96
+ }
97
+ else {
98
+ spec = { ...obj };
99
+ delete spec.kind;
100
+ delete spec.metadata;
101
+ delete spec.identity;
102
+ }
103
+ const identityField = String(obj.identity || metadata.identity || recon.identity);
104
+ const identityValue = spec[identityField] ?? metadata.name;
105
+ if (identityValue === undefined || identityValue === null || identityValue === '') {
106
+ throw new Error(`${kind} entry #${index + 1} has no identity — set spec.${identityField} (or metadata.name)`);
107
+ }
108
+ return { kind, identity: String(identityValue), spec };
109
+ }
110
+ /** Pull the resource array out of a list response, tolerating common shapes. */
111
+ function extractList(resp, recon) {
112
+ if (Array.isArray(resp))
113
+ return resp;
114
+ if (!resp || typeof resp !== 'object')
115
+ return [];
116
+ const o = resp;
117
+ const candidates = [recon.listKey, 'items', 'results', 'data', `${recon.kind}s`].filter(Boolean);
118
+ for (const key of candidates) {
119
+ if (Array.isArray(o[key]))
120
+ return o[key];
121
+ }
122
+ return [];
123
+ }
124
+ /**
125
+ * True when every field declared in `desired` already equals the value on the
126
+ * current server item (subset semantics — unmanaged server fields are ignored).
127
+ */
128
+ function specMatches(desired, current) {
129
+ for (const [k, v] of Object.entries(desired)) {
130
+ if (!deepEqual(v, current[k]))
131
+ return false;
132
+ }
133
+ return true;
134
+ }
135
+ function deepEqual(a, b) {
136
+ if (a === b)
137
+ return true;
138
+ if (a === null || b === null || typeof a !== typeof b)
139
+ return false;
140
+ if (typeof a !== 'object')
141
+ return false;
142
+ if (Array.isArray(a) || Array.isArray(b)) {
143
+ if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length)
144
+ return false;
145
+ return a.every((x, i) => deepEqual(x, b[i]));
146
+ }
147
+ const ao = a;
148
+ const bo = b;
149
+ const keys = Object.keys(ao);
150
+ if (keys.length !== Object.keys(bo).length)
151
+ return false;
152
+ return keys.every((k) => deepEqual(ao[k], bo[k]));
153
+ }
154
+ /**
155
+ * Compute the reconcile plan for one kind. Pure — given the desired resources
156
+ * and the current server items, returns the ordered list of actions.
157
+ */
158
+ function planKind(recon, desired, current, opts = {}) {
159
+ const currentByIdentity = new Map();
160
+ for (const item of current) {
161
+ const idv = item[recon.identity];
162
+ if (idv !== undefined && idv !== null)
163
+ currentByIdentity.set(String(idv), item);
164
+ }
165
+ const actions = [];
166
+ const seen = new Set();
167
+ for (const d of desired) {
168
+ seen.add(d.identity);
169
+ const existing = currentByIdentity.get(d.identity);
170
+ if (!existing) {
171
+ actions.push({ kind: d.kind, identity: d.identity, action: 'create', spec: d.spec });
172
+ continue;
173
+ }
174
+ if (specMatches(d.spec, existing)) {
175
+ actions.push({ kind: d.kind, identity: d.identity, action: 'noop', id: existing[recon.idField] });
176
+ }
177
+ else if (recon.updateMethod === null) {
178
+ actions.push({
179
+ kind: d.kind, identity: d.identity, action: 'unsupported',
180
+ reason: `${d.kind} is immutable — delete and recreate to change`,
181
+ id: existing[recon.idField],
182
+ });
183
+ }
184
+ else {
185
+ actions.push({ kind: d.kind, identity: d.identity, action: 'update', id: existing[recon.idField], spec: d.spec });
186
+ }
187
+ }
188
+ if (opts.prune) {
189
+ for (const [idv, item] of currentByIdentity) {
190
+ if (!seen.has(idv)) {
191
+ actions.push({ kind: recon.kind, identity: idv, action: 'prune', id: item[recon.idField] });
192
+ }
193
+ }
194
+ }
195
+ return actions;
196
+ }
197
+ /** Stable idempotency key for a resource action, derived from its content. */
198
+ function actionIdempotencyKey(a) {
199
+ const h = (0, node_crypto_1.createHash)('sha256')
200
+ .update(`${a.action}:${a.kind}:${a.identity}:${JSON.stringify(a.spec ?? {})}`)
201
+ .digest('hex')
202
+ .slice(0, 32);
203
+ return `apply-${h}`;
204
+ }
205
+ /** Count results by action (+ failed) for a summary line. */
206
+ function tallyResults(results) {
207
+ const c = { create: 0, update: 0, noop: 0, prune: 0, unsupported: 0, failed: 0 };
208
+ for (const r of results) {
209
+ if (r.status === 'failed')
210
+ c.failed++;
211
+ if (r.action in c)
212
+ c[r.action]++;
213
+ }
214
+ return c;
215
+ }
216
+ /**
217
+ * Reconcile a set of desired resources end-to-end: group by kind, fetch current
218
+ * state, plan, execute. Pure orchestration with NO prompting — the interactive
219
+ * prune confirmation lives in the `apply` command, not here, so this is safe to
220
+ * call programmatically (the @solidnumber/cli/client facade uses it). Unknown
221
+ * kinds are skipped (parseManifest already validates when used via the CLI).
222
+ */
223
+ async function reconcile(client, resources, opts = {}) {
224
+ const byKind = new Map();
225
+ for (const r of resources) {
226
+ const arr = byKind.get(r.kind) ?? [];
227
+ arr.push(r);
228
+ byKind.set(r.kind, arr);
229
+ }
230
+ const results = [];
231
+ for (const [kind, desired] of byKind) {
232
+ const recon = (0, registry_1.reconcilerFor)(kind);
233
+ if (!recon)
234
+ continue;
235
+ const resp = await client.get(recon.list);
236
+ const current = extractList(resp.data, recon);
237
+ const actions = planKind(recon, desired, current, { prune: opts.prune });
238
+ results.push(...(await executePlan(client, recon, actions, !!opts.dryRun)));
239
+ }
240
+ return { dryRun: !!opts.dryRun, results, counts: tallyResults(results) };
241
+ }
242
+ /** Execute a plan. `dryRun` returns the plan annotated as skipped, no writes. */
243
+ async function executePlan(client, recon, actions, dryRun) {
244
+ const results = [];
245
+ for (const a of actions) {
246
+ if (a.action === 'noop' || a.action === 'unsupported') {
247
+ results.push({ ...a, status: 'skipped' });
248
+ continue;
249
+ }
250
+ if (dryRun) {
251
+ results.push({ ...a, status: 'skipped' });
252
+ continue;
253
+ }
254
+ const key = actionIdempotencyKey(a);
255
+ const item = recon.itemPath.replace('{id}', String(a.id));
256
+ try {
257
+ if (a.action === 'create') {
258
+ await client.post(recon.create, a.spec, { idempotencyKey: key });
259
+ }
260
+ else if (a.action === 'update') {
261
+ if (recon.updateMethod === 'put')
262
+ await client.put(item, a.spec, { idempotencyKey: key });
263
+ else
264
+ await client.patch(item, a.spec, { idempotencyKey: key });
265
+ }
266
+ else if (a.action === 'prune') {
267
+ await client.delete(item, { idempotencyKey: key });
268
+ }
269
+ results.push({ ...a, status: 'done' });
270
+ }
271
+ catch (e) {
272
+ results.push({ ...a, status: 'failed', error: e instanceof Error ? e.message : String(e) });
273
+ }
274
+ }
275
+ return results;
276
+ }
277
+ //# sourceMappingURL=engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.js","sourceRoot":"","sources":["../../../src/lib/apply/engine.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,sCAcC;AAsCD,kCASC;AAMD,kCAKC;AAqBD,4BA4CC;AAGD,oDAMC;AAQD,oCAOC;AASD,8BAqBC;AAGD,kCAiCC;AA1RD;;;;;;;GAOG;AACH,8CAAgC;AAChC,6CAAyC;AACzC,yCAAuD;AAsCvD;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,IAAY;IACxC,MAAM,IAAI,GAAc,EAAE,CAAC;IAC3B,4EAA4E;IAC5E,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS;QAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhF,MAAM,GAAG,GAAc,EAAE,CAAC;IAC1B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;aACpC,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAE,GAA+B,C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MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC9F,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Reconciler registry for `solid apply` — maps a declarative manifest `kind`
3
+ * to the REST shape needed to reconcile it (list current, create, update,
4
+ * delete one). Adding a kind = one entry here; the engine stays generic.
5
+ *
6
+ * Endpoints below are taken verbatim from the matching CLI command files
7
+ * (commands/products.ts, crm.ts, webhooks.ts, pages.ts, site.ts, domains.ts,
8
+ * forms.ts / lib/api-client.ts) so they track the real API.
9
+ * A kind with `updateMethod: null` is immutable (create/delete only) — on
10
+ * drift the engine reports it rather than silently mutating.
11
+ */
12
+ export interface Reconciler {
13
+ /** Manifest `kind` this entry handles. */
14
+ kind: string;
15
+ /** Spec field that uniquely identifies a resource within the company. */
16
+ identity: string;
17
+ /** GET collection (list current state). */
18
+ list: string;
19
+ /** POST collection (create). */
20
+ create: string;
21
+ /** Path template for one item; `{id}` is substituted. Used for update/delete. */
22
+ itemPath: string;
23
+ /** HTTP verb for an in-place update, or null when the resource is immutable. */
24
+ updateMethod: 'patch' | 'put' | null;
25
+ /** Field on a fetched server item that holds its id (default `id`). */
26
+ idField: string;
27
+ /** Key in the list response holding the array, when not auto-detectable. */
28
+ listKey?: string;
29
+ }
30
+ export declare const RECONCILERS: Record<string, Reconciler>;
31
+ export declare function reconcilerFor(kind: string): Reconciler | undefined;
32
+ export declare function knownKinds(): string[];
33
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/lib/apply/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,UAAU;IACzB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,YAAY,EAAE,OAAO,GAAG,KAAK,GAAG,IAAI,CAAC;IACrC,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAgFlD,CAAC;AAEF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAElE;AAED,wBAAgB,UAAU,IAAI,MAAM,EAAE,CAErC"}
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RECONCILERS = void 0;
4
+ exports.reconcilerFor = reconcilerFor;
5
+ exports.knownKinds = knownKinds;
6
+ exports.RECONCILERS = {
7
+ product: {
8
+ kind: 'product',
9
+ identity: 'sku',
10
+ list: '/api/v1/products/',
11
+ create: '/api/v1/products/',
12
+ itemPath: '/api/v1/products/{id}',
13
+ updateMethod: 'patch',
14
+ idField: 'id',
15
+ listKey: 'products',
16
+ },
17
+ contact: {
18
+ kind: 'contact',
19
+ identity: 'email',
20
+ list: '/api/v1/crm/contacts',
21
+ create: '/api/v1/crm/contacts',
22
+ itemPath: '/api/v1/crm/contacts/{id}',
23
+ updateMethod: 'patch',
24
+ idField: 'id',
25
+ listKey: 'contacts',
26
+ },
27
+ deal: {
28
+ kind: 'deal',
29
+ identity: 'name',
30
+ list: '/api/v1/crm/deals',
31
+ create: '/api/v1/crm/deals',
32
+ itemPath: '/api/v1/crm/deals/{id}',
33
+ updateMethod: 'patch',
34
+ idField: 'id',
35
+ listKey: 'deals',
36
+ },
37
+ webhook: {
38
+ kind: 'webhook',
39
+ identity: 'url',
40
+ list: '/api/v1/developer/webhooks',
41
+ create: '/api/v1/developer/webhooks',
42
+ itemPath: '/api/v1/developer/webhooks/{id}',
43
+ updateMethod: null, // webhooks are immutable — recreate to change
44
+ idField: 'id',
45
+ listKey: 'webhooks',
46
+ },
47
+ page: {
48
+ kind: 'page',
49
+ identity: 'slug',
50
+ list: '/api/v1/cms/pages',
51
+ create: '/api/v1/cms/pages',
52
+ itemPath: '/api/v1/cms/pages/{id}',
53
+ updateMethod: 'patch',
54
+ idField: 'id',
55
+ listKey: 'pages',
56
+ },
57
+ site: {
58
+ kind: 'site',
59
+ identity: 'slug',
60
+ list: '/api/v1/sites',
61
+ create: '/api/v1/sites',
62
+ itemPath: '/api/v1/sites/{id}',
63
+ updateMethod: null, // no in-place site update endpoint — recreate to change
64
+ idField: 'id',
65
+ listKey: 'sites',
66
+ },
67
+ domain: {
68
+ kind: 'domain',
69
+ identity: 'domain',
70
+ list: '/api/v1/domains/custom', // returns a bare array
71
+ create: '/api/v1/domains/custom',
72
+ itemPath: '/api/v1/domains/custom/{id}',
73
+ updateMethod: null, // domains are verify-then-live — recreate to change
74
+ idField: 'id',
75
+ },
76
+ survey: {
77
+ kind: 'survey',
78
+ identity: 'title',
79
+ list: '/api/v1/surveys',
80
+ create: '/api/v1/surveys/create',
81
+ itemPath: '/api/v1/surveys/{id}',
82
+ updateMethod: 'put',
83
+ idField: 'id',
84
+ listKey: 'surveys',
85
+ },
86
+ };
87
+ function reconcilerFor(kind) {
88
+ return exports.RECONCILERS[kind] || exports.RECONCILERS[kind.toLowerCase()];
89
+ }
90
+ function knownKinds() {
91
+ return Object.keys(exports.RECONCILERS).sort();
92
+ }
93
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/lib/apply/registry.ts"],"names":[],"mappings":";;;AAgHA,sCAEC;AAED,gCAEC;AAxFY,QAAA,WAAW,GAA+B;IACrD,OAAO,EAAE;QACP,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,mBAAmB;QACzB,MAAM,EAAE,mBAAmB;QAC3B,QAAQ,EAAE,uBAAuB;QACjC,YAAY,EAAE,OAAO;QACrB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,UAAU;KACpB;IACD,OAAO,EAAE;QACP,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE,sBAAsB;QAC5B,MAAM,EAAE,sBAAsB;QAC9B,QAAQ,EAAE,2BAA2B;QACrC,YAAY,EAAE,OAAO;QACrB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,UAAU;KACpB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,MAAM;QAChB,IAAI,EAAE,mBAAmB;QACzB,MAAM,EAAE,mBAAmB;QAC3B,QAAQ,EAAE,wBAAwB;QAClC,YAAY,EAAE,OAAO;QACrB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,OAAO;KACjB;IACD,OAAO,EAAE;QACP,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,4BAA4B;QAClC,MAAM,EAAE,4BAA4B;QACpC,QAAQ,EAAE,iCAAiC;QAC3C,YAAY,EAAE,IAAI,EAAE,8CAA8C;QAClE,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,UAAU;KACpB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,MAAM;QAChB,IAAI,EAAE,mBAAmB;QACzB,MAAM,EAAE,mBAAmB;QAC3B,QAAQ,EAAE,wBAAwB;QAClC,YAAY,EAAE,OAAO;QACrB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,OAAO;KACjB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,MAAM;QAChB,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,eAAe;QACvB,QAAQ,EAAE,oBAAoB;QAC9B,YAAY,EAAE,IAAI,EAAE,wDAAwD;QAC5E,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,OAAO;KACjB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,wBAAwB,EAAE,uBAAuB;QACvD,MAAM,EAAE,wBAAwB;QAChC,QAAQ,EAAE,6BAA6B;QACvC,YAAY,EAAE,IAAI,EAAE,oDAAoD;QACxE,OAAO,EAAE,IAAI;KACd;IACD,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE,wBAAwB;QAChC,QAAQ,EAAE,sBAAsB;QAChC,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,SAAS;KACnB;CACF,CAAC;AAEF,SAAgB,aAAa,CAAC,IAAY;IACxC,OAAO,mBAAW,CAAC,IAAI,CAAC,IAAI,mBAAW,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,SAAgB,UAAU;IACxB,OAAO,MAAM,CAAC,IAAI,CAAC,mBAAW,CAAC,CAAC,IAAI,EAAE,CAAC;AACzC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const COMMERCE_SKILL_DIRNAME = "solid-commerce";
2
+ export declare const COMMERCE_SKILL_CONTENT = "---\nname: solid-commerce\ndescription: Wire generated websites to the Solid# backend \u2014 live contact forms (CRM + lead scoring), AI chat widget, payment-link checkout, declarative publish. Use whenever building or editing a website in this directory.\n---\n\n# Solid# Commerce Wiring\n\nThis directory is bound to a Solid# company (`.solid/manifest.json`). Every\nform, chat bubble, or payment button you generate can be REAL \u2014 backed by the\ncompany's CRM, AI agents, and payment links \u2014 instead of dead markup. Prefer\nwiring to inventing placeholders.\n\n## Contact / lead forms\n\nNever emit a `<form>` that goes nowhere. Wire it to a Solid# lead form \u2014\nsubmissions create CRM contacts, score the lead, and trigger follow-up:\n\n1. Find a form id: `solid forms list` (or the company context shelves).\n2. Emit the snippet: `solid embed form <id>` (add `--react` for a component).\n3. Or hand-wire: POST `{ data: {<fields>}, attribution: {referrer, url} }`\n to `<api>/api/v1/public/forms/<id>/submit` (public, no auth).\n\n## AI chat widget\n\nOne script tag gives the site a live AI agent trained on this company:\n\n`solid embed chat <integration_id>` (ids: `solid chat-widgets list`)\n\n## Payments\n\nPayment links render processor-hosted checkout pages \u2014 the site only needs a\nlink. `solid embed paylink <link_id> --label \"Pay deposit\"`. Creating links\nmoves money-adjacent state: the human approves it (typed phrase when asked).\n\n## Publish\n\nDeclarative, one file for the whole surface (pages, site, domain, survey,\nproducts): write `site.yaml`, then\n\n`solid apply site.yaml --dry-run` \u2192 `solid apply site.yaml` \u2192 `solid publish --all`\n\nPages go live on the company's subdomain immediately; custom domains need\n`solid domains verify <id>` after DNS is set. Format reference:\n`solid apply --kinds` and Owners-Manual/45-Developer-CLI/APPLY-DECLARATIVE-MANIFESTS.md.\n\n## Rules\n\n- Stay inside this directory \u2014 context and writes are scoped to THIS company.\n- Don't hardcode company ids; the CLI session carries the binding.\n- Financial actions (payment links, charges) always preview first; the human\n types the approval phrase. Never compose that phrase yourself.\n";
3
+ /** Write the skill into <baseDir>/.claude/skills/solid-commerce/SKILL.md. */
4
+ export declare function installCommerceSkill(baseDir: string): string;
5
+ //# sourceMappingURL=commerce-skill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commerce-skill.d.ts","sourceRoot":"","sources":["../../src/lib/commerce-skill.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,sBAAsB,mBAAmB,CAAC;AAEvD,eAAO,MAAM,sBAAsB,ysEAmDlC,CAAC;AAEF,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAM5D"}
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.COMMERCE_SKILL_CONTENT = exports.COMMERCE_SKILL_DIRNAME = void 0;
37
+ exports.installCommerceSkill = installCommerceSkill;
38
+ /**
39
+ * The solid-commerce Claude Code skill — installed into a tenant-bound
40
+ * directory's `.claude/skills/` by `solid context --claude` (both ladder and
41
+ * legacy-full modes). Teaches a coding agent to wire the sites it generates
42
+ * to the company's REAL backend instead of emitting dead markup.
43
+ *
44
+ * Role-2 boundary: callers reach this only after requireTenantManifest /
45
+ * tenantManifestForHook has passed, so the skill can never land in $HOME or
46
+ * the platform monorepo (CLAUDE-CONTEXT-CANONICAL-TRUTH.md).
47
+ */
48
+ const fs = __importStar(require("fs"));
49
+ const path = __importStar(require("path"));
50
+ exports.COMMERCE_SKILL_DIRNAME = 'solid-commerce';
51
+ exports.COMMERCE_SKILL_CONTENT = `---
52
+ name: solid-commerce
53
+ description: Wire generated websites to the Solid# backend — live contact forms (CRM + lead scoring), AI chat widget, payment-link checkout, declarative publish. Use whenever building or editing a website in this directory.
54
+ ---
55
+
56
+ # Solid# Commerce Wiring
57
+
58
+ This directory is bound to a Solid# company (\`.solid/manifest.json\`). Every
59
+ form, chat bubble, or payment button you generate can be REAL — backed by the
60
+ company's CRM, AI agents, and payment links — instead of dead markup. Prefer
61
+ wiring to inventing placeholders.
62
+
63
+ ## Contact / lead forms
64
+
65
+ Never emit a \`<form>\` that goes nowhere. Wire it to a Solid# lead form —
66
+ submissions create CRM contacts, score the lead, and trigger follow-up:
67
+
68
+ 1. Find a form id: \`solid forms list\` (or the company context shelves).
69
+ 2. Emit the snippet: \`solid embed form <id>\` (add \`--react\` for a component).
70
+ 3. Or hand-wire: POST \`{ data: {<fields>}, attribution: {referrer, url} }\`
71
+ to \`<api>/api/v1/public/forms/<id>/submit\` (public, no auth).
72
+
73
+ ## AI chat widget
74
+
75
+ One script tag gives the site a live AI agent trained on this company:
76
+
77
+ \`solid embed chat <integration_id>\` (ids: \`solid chat-widgets list\`)
78
+
79
+ ## Payments
80
+
81
+ Payment links render processor-hosted checkout pages — the site only needs a
82
+ link. \`solid embed paylink <link_id> --label "Pay deposit"\`. Creating links
83
+ moves money-adjacent state: the human approves it (typed phrase when asked).
84
+
85
+ ## Publish
86
+
87
+ Declarative, one file for the whole surface (pages, site, domain, survey,
88
+ products): write \`site.yaml\`, then
89
+
90
+ \`solid apply site.yaml --dry-run\` → \`solid apply site.yaml\` → \`solid publish --all\`
91
+
92
+ Pages go live on the company's subdomain immediately; custom domains need
93
+ \`solid domains verify <id>\` after DNS is set. Format reference:
94
+ \`solid apply --kinds\` and Owners-Manual/45-Developer-CLI/APPLY-DECLARATIVE-MANIFESTS.md.
95
+
96
+ ## Rules
97
+
98
+ - Stay inside this directory — context and writes are scoped to THIS company.
99
+ - Don't hardcode company ids; the CLI session carries the binding.
100
+ - Financial actions (payment links, charges) always preview first; the human
101
+ types the approval phrase. Never compose that phrase yourself.
102
+ `;
103
+ /** Write the skill into <baseDir>/.claude/skills/solid-commerce/SKILL.md. */
104
+ function installCommerceSkill(baseDir) {
105
+ const skillDir = path.join(baseDir, '.claude', 'skills', exports.COMMERCE_SKILL_DIRNAME);
106
+ fs.mkdirSync(skillDir, { recursive: true });
107
+ const skillPath = path.join(skillDir, 'SKILL.md');
108
+ fs.writeFileSync(skillPath, exports.COMMERCE_SKILL_CONTENT);
109
+ return skillPath;
110
+ }
111
+ //# sourceMappingURL=commerce-skill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commerce-skill.js","sourceRoot":"","sources":["../../src/lib/commerce-skill.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,oDAMC;AA3ED;;;;;;;;;GASG;AACH,uCAAyB;AACzB,2CAA6B;AAEhB,QAAA,sBAAsB,GAAG,gBAAgB,CAAC;AAE1C,QAAA,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDrC,CAAC;AAEF,6EAA6E;AAC7E,SAAgB,oBAAoB,CAAC,OAAe;IAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,8BAAsB,CAAC,CAAC;IACjF,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAClD,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,8BAAsB,CAAC,CAAC;IACpD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Embed snippet builders — pure string generation for `solid embed`.
3
+ *
4
+ * Each builder emits ready-to-paste markup that points an external (often
5
+ * AI-generated) website at the real Solid# backend: the chat widget script,
6
+ * a lead form wired to the public submit endpoint (contact + lead score +
7
+ * drip on submit), and a payment-link button. No HTTP here — the command
8
+ * fetches whatever live data a snippet needs and passes it in, so these are
9
+ * unit-testable and usable from the programmatic client.
10
+ */
11
+ export interface FormField {
12
+ name: string;
13
+ label?: string;
14
+ type?: string;
15
+ required?: boolean;
16
+ options?: string[];
17
+ }
18
+ export interface FormConfig {
19
+ id: number;
20
+ title?: string;
21
+ subtitle?: string;
22
+ fields?: FormField[];
23
+ submit_button_text?: string;
24
+ }
25
+ /** Chat widget — one script tag, config resolves server-side by integration id. */
26
+ export declare function chatEmbedSnippet(apiBase: string, integrationId: string | number): string;
27
+ /**
28
+ * Lead form — plain HTML + vanilla JS POSTing `{ data, attribution }` to the
29
+ * public submit endpoint. Submissions create/score CRM contacts server-side.
30
+ */
31
+ export declare function formEmbedSnippet(apiBase: string, form: FormConfig): string;
32
+ /** React flavor of the lead form — drop into any Next.js / React site. */
33
+ export declare function formEmbedSnippetReact(apiBase: string, form: FormConfig): string;
34
+ /** Payment link — checkout happens on the processor-hosted page. */
35
+ export declare function paylinkEmbedSnippet(checkoutUrl: string, label?: string): string;
36
+ //# sourceMappingURL=embed-snippets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embed-snippets.d.ts","sourceRoot":"","sources":["../../src/lib/embed-snippets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAYD,mFAAmF;AACnF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAGxF;AAcD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAwC1E;AAED,0EAA0E;AAC1E,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CA8C/E;AAED,oEAAoE;AACpE,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,SAAY,GAAG,MAAM,CAElF"}