@chatlychat/cli 0.4.1 → 0.5.2

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 (91) hide show
  1. package/dist/commands/auth.d.ts +1 -1
  2. package/dist/commands/auth.d.ts.map +1 -1
  3. package/dist/commands/auth.js +40 -3
  4. package/dist/commands/auth.js.map +1 -1
  5. package/dist/commands/deliveries.d.ts +18 -0
  6. package/dist/commands/deliveries.d.ts.map +1 -0
  7. package/dist/commands/deliveries.js +46 -0
  8. package/dist/commands/deliveries.js.map +1 -0
  9. package/dist/commands/init.d.ts +29 -0
  10. package/dist/commands/init.d.ts.map +1 -0
  11. package/dist/commands/init.js +176 -0
  12. package/dist/commands/init.js.map +1 -0
  13. package/dist/commands/integrations.d.ts +27 -0
  14. package/dist/commands/integrations.d.ts.map +1 -1
  15. package/dist/commands/integrations.js +145 -4
  16. package/dist/commands/integrations.js.map +1 -1
  17. package/dist/commands/platform-as-code.d.ts +54 -0
  18. package/dist/commands/platform-as-code.d.ts.map +1 -0
  19. package/dist/commands/platform-as-code.js +185 -0
  20. package/dist/commands/platform-as-code.js.map +1 -0
  21. package/dist/commands/workspace-as-code.d.ts +52 -11
  22. package/dist/commands/workspace-as-code.d.ts.map +1 -1
  23. package/dist/commands/workspace-as-code.js +70 -189
  24. package/dist/commands/workspace-as-code.js.map +1 -1
  25. package/dist/help.d.ts +1 -1
  26. package/dist/help.d.ts.map +1 -1
  27. package/dist/help.js +36 -1
  28. package/dist/help.js.map +1 -1
  29. package/dist/init/shared.d.ts +61 -0
  30. package/dist/init/shared.d.ts.map +1 -0
  31. package/dist/init/shared.js +110 -0
  32. package/dist/init/shared.js.map +1 -0
  33. package/dist/init/templates.d.ts +29 -0
  34. package/dist/init/templates.d.ts.map +1 -0
  35. package/dist/init/templates.js +362 -0
  36. package/dist/init/templates.js.map +1 -0
  37. package/dist/pac/platform-document.d.ts +65 -0
  38. package/dist/pac/platform-document.d.ts.map +1 -0
  39. package/dist/pac/platform-document.js +149 -0
  40. package/dist/pac/platform-document.js.map +1 -0
  41. package/dist/pac/platform-live.d.ts +65 -0
  42. package/dist/pac/platform-live.d.ts.map +1 -0
  43. package/dist/pac/platform-live.js +263 -0
  44. package/dist/pac/platform-live.js.map +1 -0
  45. package/dist/pac/platform-resources.d.ts +141 -0
  46. package/dist/pac/platform-resources.d.ts.map +1 -0
  47. package/dist/pac/platform-resources.js +509 -0
  48. package/dist/pac/platform-resources.js.map +1 -0
  49. package/dist/run.d.ts.map +1 -1
  50. package/dist/run.js +26 -2
  51. package/dist/run.js.map +1 -1
  52. package/dist/wac/apply.d.ts.map +1 -1
  53. package/dist/wac/apply.js +56 -16
  54. package/dist/wac/apply.js.map +1 -1
  55. package/dist/wac/diff-warnings.d.ts +35 -0
  56. package/dist/wac/diff-warnings.d.ts.map +1 -0
  57. package/dist/wac/diff-warnings.js +88 -0
  58. package/dist/wac/diff-warnings.js.map +1 -0
  59. package/dist/wac/diff.d.ts +40 -70
  60. package/dist/wac/diff.d.ts.map +1 -1
  61. package/dist/wac/diff.js +114 -91
  62. package/dist/wac/diff.js.map +1 -1
  63. package/dist/wac/document-key.d.ts +30 -0
  64. package/dist/wac/document-key.d.ts.map +1 -0
  65. package/dist/wac/document-key.js +87 -0
  66. package/dist/wac/document-key.js.map +1 -0
  67. package/dist/wac/document.d.ts +75 -65
  68. package/dist/wac/document.d.ts.map +1 -1
  69. package/dist/wac/document.js +60 -46
  70. package/dist/wac/document.js.map +1 -1
  71. package/dist/wac/execute.d.ts +25 -0
  72. package/dist/wac/execute.d.ts.map +1 -0
  73. package/dist/wac/execute.js +126 -0
  74. package/dist/wac/execute.js.map +1 -0
  75. package/dist/wac/load.d.ts +17 -0
  76. package/dist/wac/load.d.ts.map +1 -0
  77. package/dist/wac/load.js +92 -0
  78. package/dist/wac/load.js.map +1 -0
  79. package/dist/wac/resource-def.d.ts +89 -1
  80. package/dist/wac/resource-def.d.ts.map +1 -1
  81. package/dist/wac/resource-def.js +4 -0
  82. package/dist/wac/resource-def.js.map +1 -1
  83. package/dist/wac/resources.d.ts +9 -11
  84. package/dist/wac/resources.d.ts.map +1 -1
  85. package/dist/wac/resources.js +93 -27
  86. package/dist/wac/resources.js.map +1 -1
  87. package/dist/wac/values.d.ts +20 -0
  88. package/dist/wac/values.d.ts.map +1 -1
  89. package/dist/wac/values.js +46 -0
  90. package/dist/wac/values.js.map +1 -1
  91. package/package.json +4 -3
@@ -1,69 +1,64 @@
1
+ import type { ResourceDef } from './resource-def.js';
2
+ /** The file format's version. Bumped only for a change that breaks a reader. */
3
+ export declare const DOCUMENT_VERSION = 1;
1
4
  /**
2
- * `chatly.json` — the document, and the only thing in this feature allowed to
3
- * refuse you.
4
- *
5
- * ═══ WHY THERE IS NO zod HERE, AND WHAT TAKES ITS PLACE ══════════════════
6
- *
7
- * This repo validates with zod everywhere and this schema wants it. It is not
8
- * here for one reason: `@chatlychat/cli` is a PUBLISHED package whose
9
- * dependency list is exactly `@chatlychat/sdk-node`, zod is not reachable
10
- * from `apps/cli` (it is in the workspace catalog, but no package here
11
- * declares it, so it is not installed under `apps/cli/node_modules`), and
12
- * CLAUDE.md §2 forbids adding a dependency without explicit approval. Adding
13
- * one to a published CLI is a product decision about what customers install,
14
- * not a tidying-up decision — the same reason `args.ts` is hand-written
15
- * rather than `commander`.
16
- *
17
- * So the checks below are hand-written, and deliberately shaped so the swap
18
- * is mechanical if that approval comes: one `parseDocument` entry point,
19
- * issues collected as `{ path, message }` with a dotted path, and all of them
20
- * reported at once rather than the first. A zod `.strict()` object and
21
- * `ZodError.issues` is a drop-in for the body of this file.
22
- *
23
- * ═══ WHERE STRICTNESS APPLIES, AND WHERE IT DELIBERATELY DOES NOT ════════
5
+ * Which document this is, as data — so there is one parser and not two.
24
6
  *
25
- * CLAUDE.md records the bug twice over: a key the reader has never heard of
26
- * is STRIPPED, so the write answers 200 and did nothing, and `helpProfile` vs
27
- * `profile` cost a complete feature that way. The cure is to refuse the key
28
- * by name and say what the valid ones are. That is done for every part of the
29
- * document whose vocabulary the CLI OWNS:
7
+ * `chatly plan` reads a WORKSPACE document against a `ck_` key and `chatly
8
+ * platform plan` reads a PLATFORM document against a `cp_` credential
9
+ * (CHT-F04). The two differ in their vocabulary (nine resource types against
10
+ * five), their guard (a workspace id against a credential prefix) and their
11
+ * row shape (flat, against rows that name a parent workspace) — and in
12
+ * nothing else. Every rule in this file's header applies to both verbatim:
13
+ * refuse an unknown key by name, refuse a field the server returns and no
14
+ * write accepts, report every issue at once, substitute `${env:…}` and refuse
15
+ * an unset variable.
30
16
  *
31
- * - the top level (`version`, `workspace`, `resources`)
32
- * - the resource-type keys inside `resources`
33
- * - the per-row control keys the CLI invents (`bot:`, which is not an API
34
- * field at all)
35
- * - the natural key, which must be present and a non-empty string
36
- * - any field the API RETURNS and no write path accepts (`unwritable` in
37
- * `resources.ts`) — `triggers.brandId`, `brands.usage`,
38
- * `macros.usageCount` and twenty more. These are the dangerous ones:
39
- * they are spelled correctly, they come back on every read, and zod
40
- * strips them on the way in.
41
- *
42
- * It is NOT done for the rest of a row's fields, and that is a decision
43
- * rather than an omission. `common.ts`'s `bodyFrom` already states the
44
- * position for every write on this CLI: "the body goes to the API exactly as
45
- * written, so the schema in `apps/api` is the only spelling that matters…
46
- * the CLI simply refuses to add a second renaming layer on top." A per-row
47
- * allow-list here would be a second COPY of nine API schemas, in a package
48
- * published on a different cadence, and it would reject a field the API
49
- * shipped yesterday — a gate that fails on correct input is a gate somebody
50
- * switches off.
51
- *
52
- * What replaces it is better evidence than a copied list: `plan` compares the
53
- * fields a row declares against the fields the SERVER returns for rows of
54
- * that type, and warns about one no live row has ever carried. That catches
55
- * `helpProfle` from the server's own vocabulary, with nothing to keep in
56
- * step. Its blind spot — a workspace with no rows of that type yet — is
57
- * reported as such rather than passed off as a clean bill. See `diff.ts`.
17
+ * So the alternative was a second copy of ~200 lines of parse logic in
18
+ * `pac/`, which CLAUDE.md forbids for exactly the reason this surface keeps
19
+ * demonstrating: a rule fixed in one copy and not the other is two systems
20
+ * that disagree while both believe they agree.
58
21
  */
59
- import { type ResourceDef } from './resources.js';
60
- /** The file format's version. Bumped only for a change that breaks a reader. */
61
- export declare const DOCUMENT_VERSION = 1;
22
+ export interface DocumentSchema {
23
+ /** Accepted at the root. Anything else is refused by name. */
24
+ readonly topLevelKeys: ReadonlyArray<string>;
25
+ /** Accepted under `resources`, INCLUDING the keys refused with a reason. */
26
+ readonly resourceKeys: ReadonlyArray<string>;
27
+ /** Parsed in this order, which is dependency order. */
28
+ readonly types: ReadonlyArray<string>;
29
+ readonly def: (type: string) => ResourceDef | undefined;
30
+ /**
31
+ * A resource key that is valid to write and refused to USE, mapped to the
32
+ * reason. `channels` in the workspace document; `widgetChannel`,
33
+ * `businessHours`, `routing` and `loginLinks` in the platform one.
34
+ *
35
+ * Refused by name rather than dropped from `resourceKeys`, because the
36
+ * unknown-key message would otherwise say "channels is not a resource
37
+ * type" — which is wrong, and sends the reader hunting for a spelling
38
+ * mistake instead of reading the reason.
39
+ */
40
+ readonly refusedKeys: Readonly<Record<string, string>>;
41
+ /**
42
+ * Validate the optional guard at the root and return its value.
43
+ *
44
+ * The guard is what stops a staging document reaching production, and the
45
+ * two documents guard on different things: a workspace document names a
46
+ * workspace id, a platform document names its credential's prefix. The
47
+ * COMMAND compares it against a `whoami` read; this only parses it.
48
+ */
49
+ readonly guard: (raw: Record<string, unknown>, issues: Issue[]) => string | undefined;
50
+ }
62
51
  export interface Issue {
63
52
  /** Dotted, and it is the path IN THE FILE: `resources.bots[2].slug`. */
64
53
  readonly path: string;
65
54
  readonly message: string;
66
55
  }
56
+ /** One reference a row makes, by the target's natural key. */
57
+ export interface DocumentRef {
58
+ readonly type: string;
59
+ readonly key: string;
60
+ readonly pathParam?: boolean;
61
+ }
67
62
  export interface DocumentRow {
68
63
  /** The natural key's value, as written. */
69
64
  readonly key: string;
@@ -71,11 +66,12 @@ export interface DocumentRow {
71
66
  readonly path: string;
72
67
  /** The row's API fields, with the CLI's own control keys removed. */
73
68
  readonly body: Readonly<Record<string, unknown>>;
74
- /** `{ botId: { type: 'bots', key: 'support' } }` — resolved by `diff.ts`. */
75
- readonly refs: Readonly<Record<string, {
76
- readonly type: string;
77
- readonly key: string;
78
- }>>;
69
+ /**
70
+ * `{ botId: { type: 'bots', key: 'support' } }` — resolved by `diff.ts`.
71
+ * `pathParam` is copied from the definition's `ResourceRef`: the id fills a
72
+ * route placeholder rather than a body field (CHT-F04's nested routes).
73
+ */
74
+ readonly refs: Readonly<Record<string, DocumentRef>>;
79
75
  /**
80
76
  * Top-level fields whose value came, wholly or partly, from `${env:…}`.
81
77
  * Rendered as the variable's name rather than its value, so a plan can be
@@ -89,8 +85,12 @@ export interface DocumentSection {
89
85
  }
90
86
  export interface WacDocument {
91
87
  readonly version: number;
92
- /** Optional guard: `apply` refuses a workspace that is not this one. */
93
- readonly workspace: string | undefined;
88
+ /**
89
+ * The optional guard value, as the schema defines it: a workspace id for a
90
+ * workspace document, a credential prefix for a platform one. `apply`
91
+ * refuses to run when it does not match what the credential reports.
92
+ */
93
+ readonly guard: string | undefined;
94
94
  /** In `RESOURCES` order — which is dependency order. */
95
95
  readonly sections: ReadonlyArray<DocumentSection>;
96
96
  }
@@ -99,6 +99,16 @@ export declare class DocumentError extends Error {
99
99
  readonly issues: ReadonlyArray<Issue>;
100
100
  constructor(issues: ReadonlyArray<Issue>);
101
101
  }
102
+ /**
103
+ * The workspace document: `chatly.json`, nine resource types, a `ck_` key.
104
+ *
105
+ * A resource whose `keySource` is `'server'` is refused by name (none is, now
106
+ * that channels match on `key`); that refusal is driven by the definition and the message is
107
+ * assembled from the definition's own route and key names, which is richer
108
+ * than a constant string could be. Leaving it where it is also keeps this
109
+ * schema's behaviour byte-identical to what it was before the schema existed.
110
+ */
111
+ export declare const WORKSPACE_SCHEMA: DocumentSchema;
102
112
  /**
103
113
  * Parse and validate. Throws `DocumentError` with every problem it found.
104
114
  *
@@ -106,5 +116,5 @@ export declare class DocumentError extends Error {
106
116
  * injected, which is what lets the spec drive this with a literal object and
107
117
  * no transport at all.
108
118
  */
109
- export declare function parseDocument(raw: unknown, env?: Readonly<Record<string, string | undefined>>): WacDocument;
119
+ export declare function parseDocument(raw: unknown, env?: Readonly<Record<string, string | undefined>>, schema?: DocumentSchema): WacDocument;
110
120
  //# sourceMappingURL=document.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/wac/document.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,OAAO,EAA+B,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE/E,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAyBlC,MAAM,WAAW,KAAK;IACpB,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,2CAA2C;IAC3C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACjD,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IACzF;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,WAAW,CAA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AG,SAAS,CAAC;IACnC,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;CACnD;AAED,gEAAgE;AAChE,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;gBAE1B,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC;CAQhD;AAgGD;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAsB9B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,OAAO,EACZ,GAAG,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAM,EACtD,MAAM,GAAE,cAAiC,GACxC,WAAW,CAwFb"}
@@ -56,6 +56,7 @@
56
56
  * step. Its blind spot — a workspace with no rows of that type yet — is
57
57
  * reported as such rather than passed off as a clean bill. See `diff.ts`.
58
58
  */
59
+ import { keyOf, list } from './document-key.js';
59
60
  import { resourceDef, RESOURCE_TYPES } from './resources.js';
60
61
  /** The file format's version. Bumped only for a change that breaks a reader. */
61
62
  export const DOCUMENT_VERSION = 1;
@@ -93,13 +94,6 @@ export class DocumentError extends Error {
93
94
  function isPlainObject(value) {
94
95
  return typeof value === 'object' && value !== null && !Array.isArray(value);
95
96
  }
96
- /** `a`, `b` and `c` — these go in error messages, so they read as English. */
97
- function list(names) {
98
- if (names.length <= 1) {
99
- return names[0] ?? '(none)';
100
- }
101
- return `${names.slice(0, -1).join(', ')} and ${String(names[names.length - 1])}`;
102
- }
103
97
  /**
104
98
  * Did the author mean one of the valid keys?
105
99
  *
@@ -174,6 +168,37 @@ function interpolate(value, env, missing, used) {
174
168
  }
175
169
  return value;
176
170
  }
171
+ /**
172
+ * The workspace document: `chatly.json`, nine resource types, a `ck_` key.
173
+ *
174
+ * A resource whose `keySource` is `'server'` is refused by name (none is, now
175
+ * that channels match on `key`); that refusal is driven by the definition and the message is
176
+ * assembled from the definition's own route and key names, which is richer
177
+ * than a constant string could be. Leaving it where it is also keeps this
178
+ * schema's behaviour byte-identical to what it was before the schema existed.
179
+ */
180
+ export const WORKSPACE_SCHEMA = {
181
+ topLevelKeys: [...TOP_LEVEL_KEYS],
182
+ resourceKeys: RESOURCE_TYPES,
183
+ types: RESOURCE_TYPES,
184
+ def: resourceDef,
185
+ refusedKeys: {},
186
+ guard: (raw, issues) => {
187
+ const value = raw['workspace'];
188
+ if (value === undefined) {
189
+ return undefined;
190
+ }
191
+ if (typeof value !== 'string' || value.length === 0) {
192
+ issues.push({
193
+ path: 'workspace',
194
+ message: 'must be a workspace id string, or left out. It is a guard: `apply` refuses to run ' +
195
+ 'against any other workspace, which is what stops a staging file reaching production.',
196
+ });
197
+ return undefined;
198
+ }
199
+ return value;
200
+ },
201
+ };
177
202
  /**
178
203
  * Parse and validate. Throws `DocumentError` with every problem it found.
179
204
  *
@@ -181,7 +206,7 @@ function interpolate(value, env, missing, used) {
181
206
  * injected, which is what lets the spec drive this with a literal object and
182
207
  * no transport at all.
183
208
  */
184
- export function parseDocument(raw, env = {}) {
209
+ export function parseDocument(raw, env = {}, schema = WORKSPACE_SCHEMA) {
185
210
  const issues = [];
186
211
  if (!isPlainObject(raw)) {
187
212
  throw new DocumentError([
@@ -192,7 +217,7 @@ export function parseDocument(raw, env = {}) {
192
217
  },
193
218
  ]);
194
219
  }
195
- refuseUnknown(issues, '(root)', Object.keys(raw), [...TOP_LEVEL_KEYS], 'top-level key');
220
+ refuseUnknown(issues, '(root)', Object.keys(raw), schema.topLevelKeys, 'top-level key');
196
221
  const version = raw['version'];
197
222
  if (version === undefined) {
198
223
  issues.push({
@@ -207,33 +232,34 @@ export function parseDocument(raw, env = {}) {
207
232
  `${JSON.stringify(version)}. Upgrade \`@chatlychat/cli\` rather than editing the number.`,
208
233
  });
209
234
  }
210
- const workspaceRaw = raw['workspace'];
211
- let workspace;
212
- if (workspaceRaw !== undefined) {
213
- if (typeof workspaceRaw !== 'string' || workspaceRaw.length === 0) {
214
- issues.push({
215
- path: 'workspace',
216
- message: 'must be a workspace id string, or left out. It is a guard: `apply` refuses to run ' +
217
- 'against any other workspace, which is what stops a staging file reaching production.',
218
- });
219
- }
220
- else {
221
- workspace = workspaceRaw;
222
- }
223
- }
235
+ const guard = schema.guard(raw, issues);
224
236
  const resourcesRaw = raw['resources'];
225
237
  const sections = [];
226
238
  if (resourcesRaw === undefined) {
227
239
  issues.push({
228
240
  path: 'resources',
229
- message: `required. An object keyed by resource type: ${list(RESOURCE_TYPES)}.`,
241
+ message: `required. An object keyed by resource type: ${list(schema.types)}.`,
230
242
  });
231
243
  }
232
244
  else if (!isPlainObject(resourcesRaw)) {
233
245
  issues.push({ path: 'resources', message: 'must be an object keyed by resource type.' });
234
246
  }
235
247
  else {
236
- refuseUnknown(issues, 'resources', Object.keys(resourcesRaw), RESOURCE_TYPES, 'resource type');
248
+ refuseUnknown(issues, 'resources', Object.keys(resourcesRaw), schema.resourceKeys, 'resource type');
249
+ /*
250
+ * A key that is spelled right and cannot be used, refused with the
251
+ * reason. An EMPTY array is allowed through, as the `channels` refusal
252
+ * allows one: a document that carries the key with nothing in it is
253
+ * describing nothing, and failing on it would make a generated file that
254
+ * emits every key impossible to apply.
255
+ */
256
+ for (const [key, reason] of Object.entries(schema.refusedKeys)) {
257
+ const value = resourcesRaw[key];
258
+ if (value === undefined || (Array.isArray(value) && value.length === 0)) {
259
+ continue;
260
+ }
261
+ issues.push({ path: `resources.${key}`, message: reason });
262
+ }
237
263
  /*
238
264
  * Iterated in RESOURCES order, not in the file's key order.
239
265
  *
@@ -241,12 +267,12 @@ export function parseDocument(raw, env = {}) {
241
267
  * run may be about to create — and taking it from the file would make the
242
268
  * result depend on how somebody chose to lay out their document.
243
269
  */
244
- for (const type of RESOURCE_TYPES) {
270
+ for (const type of schema.types) {
245
271
  const value = resourcesRaw[type];
246
272
  if (value === undefined) {
247
273
  continue;
248
274
  }
249
- const def = resourceDef(type);
275
+ const def = schema.def(type);
250
276
  if (def === undefined) {
251
277
  continue;
252
278
  }
@@ -256,7 +282,7 @@ export function parseDocument(raw, env = {}) {
256
282
  if (issues.length > 0) {
257
283
  throw new DocumentError(issues);
258
284
  }
259
- return { version: DOCUMENT_VERSION, workspace, sections };
285
+ return { version: DOCUMENT_VERSION, guard, sections };
260
286
  }
261
287
  function parseSection(issues, def, value, env) {
262
288
  const at = `resources.${def.type}`;
@@ -307,23 +333,8 @@ function parseSection(issues, def, value, env) {
307
333
  issues.push({ path, message: `must be an object, not ${typeof row}.` });
308
334
  continue;
309
335
  }
310
- const keyValue = row[def.naturalKey];
311
- if (typeof keyValue !== 'string' || keyValue.length === 0) {
312
- /*
313
- * The one field this file insists on, and the message says why rather
314
- * than just "required": somebody reading it on a fresh checkout needs
315
- * to know that the uuid they were about to paste is the wrong answer.
316
- */
317
- issues.push({
318
- path: `${path}.${def.naturalKey}`,
319
- message: `every ${def.label} needs \`${def.naturalKey}\`: a non-empty string. It is the ` +
320
- 'natural key this file matches on, so `plan` can tell a create from an update ' +
321
- 'without a server uuid — which does not exist yet in a new environment.' +
322
- (def.keyEnforced
323
- ? ''
324
- : ` Note the database does NOT make \`${def.naturalKey}\` unique for this ` +
325
- 'resource, so this file is the only thing keeping it unique.'),
326
- });
336
+ const keyValue = keyOf(issues, def, row, path);
337
+ if (keyValue === undefined) {
327
338
  continue;
328
339
  }
329
340
  const duplicate = seen.get(keyValue);
@@ -411,7 +422,10 @@ function parseSection(issues, def, value, env) {
411
422
  });
412
423
  continue;
413
424
  }
414
- refs[ref.wire] = { type: ref.type, key: rawValue };
425
+ refs[ref.wire] =
426
+ ref.pathParam === true
427
+ ? { type: ref.type, key: rawValue, pathParam: true }
428
+ : { type: ref.type, key: rawValue };
415
429
  }
416
430
  for (const name of missing) {
417
431
  issues.push({
@@ -1 +1 @@
1
- {"version":3,"file":"document.js","sourceRoot":"","sources":["../../src/wac/document.ts"],"names":[],"mappings":"AAAA;;;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D,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Walking a plan and making its writes — shared by `chatly apply` and
3
+ * `chatly platform apply` (CHT-F04).
4
+ *
5
+ * Moved out of `commands/workspace-as-code.ts` rather than imported from it,
6
+ * so one command module never depends on another. The only thing that differs
7
+ * between the two documents here is which resource table an item's type is
8
+ * looked up in, and that is the `defOf` parameter: the workspace table for
9
+ * a `ck_` key, the platform table for a `cp_` credential. A type absent from
10
+ * the table passed is skipped, never guessed.
11
+ */
12
+ import { type ApplyOptions, type ApplyOutcome } from './apply.js';
13
+ import type { Plan } from './diff.js';
14
+ import type { ResourceDef } from './resource-def.js';
15
+ import type { ChatlyClient } from '@chatlychat/sdk-node';
16
+ /**
17
+ * Walk the plan and do it. Continue on failure; never cascade.
18
+ *
19
+ * Exported so `wac.spec.ts` can drive it with a scripted transport and assert
20
+ * on the requests that went over the wire — the shape CLAUDE.md insists on
21
+ * ("assert on the request, not the canned response"), since a fake transport
22
+ * that echoes whatever the caller sent agrees with the bug.
23
+ */
24
+ export declare function execute(chatly: ChatlyClient, built: Plan, opts: ApplyOptions, defOf: (type: string) => ResourceDef | undefined): Promise<ReadonlyArray<ApplyOutcome>>;
25
+ //# sourceMappingURL=execute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/wac/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,YAAY,EAElB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAC3B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,IAAI,EACX,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,WAAW,GAAG,SAAS,GAC/C,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAqFtC"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Walking a plan and making its writes — shared by `chatly apply` and
3
+ * `chatly platform apply` (CHT-F04).
4
+ *
5
+ * Moved out of `commands/workspace-as-code.ts` rather than imported from it,
6
+ * so one command module never depends on another. The only thing that differs
7
+ * between the two documents here is which resource table an item's type is
8
+ * looked up in, and that is the `defOf` parameter: the workspace table for
9
+ * a `ck_` key, the platform table for a `cp_` credential. A type absent from
10
+ * the table passed is skipped, never guessed.
11
+ */
12
+ import { harvestSecrets, writesFor, } from './apply.js';
13
+ /**
14
+ * Walk the plan and do it. Continue on failure; never cascade.
15
+ *
16
+ * Exported so `wac.spec.ts` can drive it with a scripted transport and assert
17
+ * on the requests that went over the wire — the shape CLAUDE.md insists on
18
+ * ("assert on the request, not the canned response"), since a fake transport
19
+ * that echoes whatever the caller sent agrees with the bug.
20
+ */
21
+ export async function execute(chatly, built, opts, defOf) {
22
+ const outcomes = [];
23
+ /** `type/key` → the id a create in THIS run returned. */
24
+ const refIds = new Map();
25
+ /** `type/key` that failed, so its dependents are skipped not attempted. */
26
+ const failed = new Set();
27
+ for (const item of built.items) {
28
+ const def = defOf(item.type);
29
+ if (def === undefined) {
30
+ continue;
31
+ }
32
+ const address = `${item.type}/${item.key}`;
33
+ if (item.action === 'noop') {
34
+ continue;
35
+ }
36
+ if (item.action === 'blocked') {
37
+ outcomes.push({ ...base(item), state: 'skipped', detail: item.reason, secrets: [] });
38
+ continue;
39
+ }
40
+ const blocker = item.dependsOn.find((d) => failed.has(d));
41
+ if (blocker !== undefined) {
42
+ outcomes.push({
43
+ ...base(item),
44
+ state: 'skipped',
45
+ detail: `${blocker} failed above, and this names it. Attempting it anyway would produce a ` +
46
+ 'second error about a missing id that points at the wrong thing.',
47
+ secrets: [],
48
+ });
49
+ failed.add(address);
50
+ continue;
51
+ }
52
+ const ops = writesFor(def, item, refIds, opts);
53
+ if (ops.length === 0) {
54
+ outcomes.push({
55
+ ...base(item),
56
+ state: 'kept',
57
+ detail: item.action === 'orphan'
58
+ ? opts.prune
59
+ ? def.remove === null
60
+ ? (def.removeBlocked ?? 'no DELETE route.')
61
+ : 'this type cannot be pruned safely on this run (see the warnings)'
62
+ : '`--prune` would delete it'
63
+ : undefined,
64
+ secrets: [],
65
+ });
66
+ continue;
67
+ }
68
+ const secrets = [];
69
+ let ok = true;
70
+ for (const op of ops) {
71
+ try {
72
+ const response = await chatly.request(op.method, op.path, op.body === undefined ? {} : { body: op.body });
73
+ secrets.push(...harvestSecrets(def, item, response));
74
+ const id = idOf(response, def);
75
+ if (id !== undefined) {
76
+ refIds.set(address, id);
77
+ }
78
+ }
79
+ catch (err) {
80
+ ok = false;
81
+ failed.add(address);
82
+ outcomes.push({
83
+ ...base(item),
84
+ state: 'failed',
85
+ detail: `${op.method} ${op.path} — ${err instanceof Error ? err.message : String(err)}`,
86
+ secrets,
87
+ });
88
+ break;
89
+ }
90
+ }
91
+ if (ok) {
92
+ outcomes.push({ ...base(item), state: 'applied', detail: undefined, secrets });
93
+ }
94
+ }
95
+ return outcomes;
96
+ }
97
+ function base(item) {
98
+ return { type: item.type, key: item.key, action: item.action };
99
+ }
100
+ /**
101
+ * The id out of a write response, for a reference a later section needs.
102
+ *
103
+ * Two levels, because `POST /v1/customer-cards` answers
104
+ * `{ card: { id }, secret }` rather than the card itself — the same envelope
105
+ * quirk that makes the secret sweep two levels deep.
106
+ */
107
+ function idOf(response, def) {
108
+ if (typeof response !== 'object' || response === null) {
109
+ return undefined;
110
+ }
111
+ const top = response;
112
+ const direct = top[def.idField];
113
+ if (typeof direct === 'string' && direct.length > 0) {
114
+ return direct;
115
+ }
116
+ for (const value of Object.values(top)) {
117
+ if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
118
+ const nested = value[def.idField];
119
+ if (typeof nested === 'string' && nested.length > 0) {
120
+ return nested;
121
+ }
122
+ }
123
+ }
124
+ return undefined;
125
+ }
126
+ //# sourceMappingURL=execute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/wac/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,cAAc,EACd,SAAS,GAIV,MAAM,YAAY,CAAC;AAMpB;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,MAAoB,EACpB,KAAW,EACX,IAAkB,EAClB,KAAgD;IAEhD,MAAM,QAAQ,GAAmB,EAAE,CAAC;IACpC,yDAAyD;IACzD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,2EAA2E;IAC3E,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IAEjC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAC/B,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,SAAS;QACX,CAAC;QACD,MAAM,OAAO,GAAG,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QAE3C,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YAC3B,SAAS;QACX,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;YACrF,SAAS;QACX,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAA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ACjE,CAAC;AAED;;;;;;GAMG;AACH,SAAS,IAAI,CAAC,QAAiB,EAAE,GAAgB;IAC/C,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,GAAG,GAAG,QAAmC,CAAC;IAChD,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAChC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzE,MAAM,MAAM,GAAI,KAAiC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC/D,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACpD,OAAO,MAAM,CAAC;YAChB,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { type DocumentSchema, type WacDocument } from './document.js';
2
+ import { type ParsedArgs } from '../args.js';
3
+ export interface LoadOptions {
4
+ /** Looked for in order when `--file` is absent. */
5
+ readonly defaultFiles: ReadonlyArray<string>;
6
+ /** Which document this is. See `DocumentSchema`. */
7
+ readonly schema: DocumentSchema;
8
+ /** The worked example this CLI points at when no file is found. */
9
+ readonly docsUrl: string;
10
+ /** `plan` for the workspace document, `platform plan` for the other. */
11
+ readonly command: string;
12
+ }
13
+ /** By extension; anything else (stdin, no extension) by sniffing for a leading `{`. */
14
+ export declare function isYaml(path: string, raw: string): boolean;
15
+ /** Read, parse as JSON or YAML by extension (stdin: by sniffing), validate against the schema. */
16
+ export declare function loadFrom(args: ParsedArgs, env: NodeJS.ProcessEnv, opts: LoadOptions): WacDocument;
17
+ //# sourceMappingURL=load.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/wac/load.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,WAAW;IAC1B,mDAAmD;IACnD,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7C,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AA4BD,uFAAuF;AACvF,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAQzD;AAaD,kGAAkG;AAClG,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,WAAW,GAAG,WAAW,CAcjG"}