@chatlychat/cli 0.4.1 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/auth.d.ts +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +40 -3
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/init.d.ts +29 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +176 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/integrations.d.ts +27 -0
- package/dist/commands/integrations.d.ts.map +1 -1
- package/dist/commands/integrations.js +133 -3
- package/dist/commands/integrations.js.map +1 -1
- package/dist/commands/platform-as-code.d.ts +54 -0
- package/dist/commands/platform-as-code.d.ts.map +1 -0
- package/dist/commands/platform-as-code.js +185 -0
- package/dist/commands/platform-as-code.js.map +1 -0
- package/dist/commands/workspace-as-code.d.ts +65 -11
- package/dist/commands/workspace-as-code.d.ts.map +1 -1
- package/dist/commands/workspace-as-code.js +35 -177
- package/dist/commands/workspace-as-code.js.map +1 -1
- package/dist/help.d.ts +1 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +30 -1
- package/dist/help.js.map +1 -1
- package/dist/init/shared.d.ts +61 -0
- package/dist/init/shared.d.ts.map +1 -0
- package/dist/init/shared.js +110 -0
- package/dist/init/shared.js.map +1 -0
- package/dist/init/templates.d.ts +29 -0
- package/dist/init/templates.d.ts.map +1 -0
- package/dist/init/templates.js +362 -0
- package/dist/init/templates.js.map +1 -0
- package/dist/pac/platform-document.d.ts +65 -0
- package/dist/pac/platform-document.d.ts.map +1 -0
- package/dist/pac/platform-document.js +149 -0
- package/dist/pac/platform-document.js.map +1 -0
- package/dist/pac/platform-live.d.ts +65 -0
- package/dist/pac/platform-live.d.ts.map +1 -0
- package/dist/pac/platform-live.js +263 -0
- package/dist/pac/platform-live.js.map +1 -0
- package/dist/pac/platform-resources.d.ts +141 -0
- package/dist/pac/platform-resources.d.ts.map +1 -0
- package/dist/pac/platform-resources.js +509 -0
- package/dist/pac/platform-resources.js.map +1 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +23 -2
- package/dist/run.js.map +1 -1
- package/dist/wac/apply.d.ts.map +1 -1
- package/dist/wac/apply.js +52 -15
- package/dist/wac/apply.js.map +1 -1
- package/dist/wac/diff-warnings.d.ts +35 -0
- package/dist/wac/diff-warnings.d.ts.map +1 -0
- package/dist/wac/diff-warnings.js +87 -0
- package/dist/wac/diff-warnings.js.map +1 -0
- package/dist/wac/diff.d.ts +40 -70
- package/dist/wac/diff.d.ts.map +1 -1
- package/dist/wac/diff.js +90 -91
- package/dist/wac/diff.js.map +1 -1
- package/dist/wac/document-key.d.ts +30 -0
- package/dist/wac/document-key.d.ts.map +1 -0
- package/dist/wac/document-key.js +80 -0
- package/dist/wac/document-key.js.map +1 -0
- package/dist/wac/document.d.ts +75 -65
- package/dist/wac/document.d.ts.map +1 -1
- package/dist/wac/document.js +60 -46
- package/dist/wac/document.js.map +1 -1
- package/dist/wac/execute.d.ts +25 -0
- package/dist/wac/execute.d.ts.map +1 -0
- package/dist/wac/execute.js +126 -0
- package/dist/wac/execute.js.map +1 -0
- package/dist/wac/load.d.ts +15 -0
- package/dist/wac/load.d.ts.map +1 -0
- package/dist/wac/load.js +91 -0
- package/dist/wac/load.js.map +1 -0
- package/dist/wac/resource-def.d.ts +85 -1
- package/dist/wac/resource-def.d.ts.map +1 -1
- package/dist/wac/resource-def.js +4 -0
- package/dist/wac/resource-def.js.map +1 -1
- package/dist/wac/values.d.ts +7 -0
- package/dist/wac/values.d.ts.map +1 -1
- package/dist/wac/values.js +16 -0
- package/dist/wac/values.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chatly platform plan` / `chatly platform apply` — the Platform API as a
|
|
3
|
+
* file (CHT-F04).
|
|
4
|
+
*
|
|
5
|
+
* The same engine as `chatly plan` / `chatly apply` over a different surface:
|
|
6
|
+
* `/v1/platform/*`, authenticated with a `cp_` platform credential, describing
|
|
7
|
+
* SEVERAL tenants at once. Everything that is not specific to that surface is
|
|
8
|
+
* shared and lives in `wac/` — the loader, the parser, the differ, the
|
|
9
|
+
* renderer and the executor. What is here is the wiring, and the three things
|
|
10
|
+
* that are different:
|
|
11
|
+
*
|
|
12
|
+
* - **The table.** `pac/platform-resources.ts`: six resource types, every
|
|
13
|
+
* path read off a handler. Channel config, IDV mode, business hours and
|
|
14
|
+
* routing are the `settings` row (one per workspace, merge-compared);
|
|
15
|
+
* login links are refused by name with the reason. Read that file's
|
|
16
|
+
* header before adding a row.
|
|
17
|
+
* - **The reader.** `pac/platform-live.ts`: it reads only the tenants the
|
|
18
|
+
* document names, because a platform document is a SUBSET of what a
|
|
19
|
+
* credential owns and an unmentioned tenant is not drift.
|
|
20
|
+
* - **The guard.** `platform.prefix` against `GET /v1/platform/whoami`, and
|
|
21
|
+
* it runs before any other read on `plan` as well as `apply`.
|
|
22
|
+
*
|
|
23
|
+
* ═══ READ-BACK VERIFICATION ═══════════════════════════════════════════════
|
|
24
|
+
*
|
|
25
|
+
* CHT-F04 asked for `--dry-run` and "read-back verification", in the shape
|
|
26
|
+
* Forumulate's `publish` prints "everything matches". `plan` IS the dry run —
|
|
27
|
+
* it issues GETs only — so there is no separate flag for it. `apply` does the
|
|
28
|
+
* verification: after its writes it re-reads the live surface and re-plans,
|
|
29
|
+
* and it exits non-zero unless every item the document describes is `noop`.
|
|
30
|
+
* That is the check a pipeline can trust, because it is computed from what
|
|
31
|
+
* the server SAYS after the write rather than from the status codes the
|
|
32
|
+
* writes returned — a 201 from a route that stripped half the body is
|
|
33
|
+
* exactly what it catches.
|
|
34
|
+
*/
|
|
35
|
+
import { bool } from '../args.js';
|
|
36
|
+
import { printJson } from '../output.js';
|
|
37
|
+
import { PLATFORM_DEFAULT_FILES, PLATFORM_SCHEMA } from '../pac/platform-document.js';
|
|
38
|
+
import { readPlatformLive } from '../pac/platform-live.js';
|
|
39
|
+
import { platformResourceDef } from '../pac/platform-resources.js';
|
|
40
|
+
import { renderOutcomes } from '../wac/apply.js';
|
|
41
|
+
import { buildPlan, tally } from '../wac/diff.js';
|
|
42
|
+
import { execute } from '../wac/execute.js';
|
|
43
|
+
import { loadFrom } from '../wac/load.js';
|
|
44
|
+
import { planFooter, planForJson, renderPlan } from '../wac/render.js';
|
|
45
|
+
const DOCS_URL = 'https://chatlychat.com/docs/sdk-cli#platform-as-code';
|
|
46
|
+
const USAGE = 'Usage: chatly platform plan|apply [--file chatly.platform.json] [--prune] [--json]\n' +
|
|
47
|
+
'Authenticate with a cp_ platform credential (--key or CHATLY_API_KEY), not a ck_ key.\n' +
|
|
48
|
+
`A worked example: ${DOCS_URL}\n`;
|
|
49
|
+
export function loadPlatformDocument(args, env = process.env) {
|
|
50
|
+
return loadFrom(args, env, {
|
|
51
|
+
defaultFiles: PLATFORM_DEFAULT_FILES,
|
|
52
|
+
schema: PLATFORM_SCHEMA,
|
|
53
|
+
docsUrl: DOCS_URL,
|
|
54
|
+
command: 'platform plan',
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* `platform.prefix` in the document, against the credential's own prefix.
|
|
59
|
+
*
|
|
60
|
+
* A GET, so it does not spend `plan`'s no-writes property. It runs before
|
|
61
|
+
* the live read for the reason `workspace-as-code.ts` records: a guard placed
|
|
62
|
+
* second lets a staging document compute a whole plan against production
|
|
63
|
+
* before refusing, and on `apply` the same ordering would write first.
|
|
64
|
+
*/
|
|
65
|
+
async function prefixGuard(chatly, doc) {
|
|
66
|
+
if (doc.guard === undefined) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
const me = await chatly.request('GET', '/v1/platform/whoami');
|
|
70
|
+
if (me.prefix === doc.guard) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
return (`Refusing to run: the document says \`"platform": { "prefix": "${doc.guard}" }\` and this ` +
|
|
74
|
+
`credential's prefix is ${typeof me.prefix === 'string' ? me.prefix : '(none reported)'}.\n` +
|
|
75
|
+
'Point --key / CHATLY_API_KEY at the right platform credential, or remove the `platform` ' +
|
|
76
|
+
'block if this document is meant to be portable.');
|
|
77
|
+
}
|
|
78
|
+
/** Read the live surface and plan against it, with the reader's warnings. */
|
|
79
|
+
async function planAgainstLive(chatly, doc, writeOnly) {
|
|
80
|
+
const { live, warnings } = await readPlatformLive(chatly, doc);
|
|
81
|
+
/*
|
|
82
|
+
* The adoption shape: children naming a tenant the document does not
|
|
83
|
+
* declare. Its live row is resolvable but not planned — see
|
|
84
|
+
* `PlanOptions.referenced`.
|
|
85
|
+
*/
|
|
86
|
+
const workspacesDef = platformResourceDef('workspaces');
|
|
87
|
+
const declaresWorkspaces = doc.sections.some((s) => s.def.type === 'workspaces');
|
|
88
|
+
const referenced = declaresWorkspaces || workspacesDef === undefined
|
|
89
|
+
? []
|
|
90
|
+
: [{ def: workspacesDef, section: live.get('workspaces') ?? { rows: [] } }];
|
|
91
|
+
const built = buildPlan(doc, live, { writeOnly, referenced });
|
|
92
|
+
return { ...built, warnings: [...warnings, ...built.warnings] };
|
|
93
|
+
}
|
|
94
|
+
export async function plan(chatly, args) {
|
|
95
|
+
const doc = loadPlatformDocument(args);
|
|
96
|
+
const guard = await prefixGuard(chatly, doc);
|
|
97
|
+
if (guard !== undefined) {
|
|
98
|
+
process.stderr.write(`${guard}\n`);
|
|
99
|
+
return 1;
|
|
100
|
+
}
|
|
101
|
+
const built = await planAgainstLive(chatly, doc, bool(args.flags, 'write-only'));
|
|
102
|
+
const opts = { prune: bool(args.flags, 'prune'), pruneUnsafe: built.pruneUnsafe };
|
|
103
|
+
if (bool(args.flags, 'json')) {
|
|
104
|
+
printJson(planForJson(built));
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
process.stdout.write(renderPlan(built, opts));
|
|
108
|
+
process.stdout.write(planFooter(built, opts));
|
|
109
|
+
}
|
|
110
|
+
// `--exit-code` means what it means on `chatly plan`: 2 for drift, so CI
|
|
111
|
+
// can tell "the platform no longer matches the repo" from "the call failed".
|
|
112
|
+
if (bool(args.flags, 'exit-code')) {
|
|
113
|
+
const counts = tally(built);
|
|
114
|
+
return counts.create + counts.update + counts.blocked > 0 ? 2 : 0;
|
|
115
|
+
}
|
|
116
|
+
return built.items.some((i) => i.action === 'blocked') ? 1 : 0;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* What the re-read found that does not match the document.
|
|
120
|
+
*
|
|
121
|
+
* `orphan` is excluded: an orphan is a live row the document does not
|
|
122
|
+
* mention, which `apply` without `--prune` deliberately keeps, and failing
|
|
123
|
+
* verification for it would make the default `apply` fail every time. Under
|
|
124
|
+
* `--prune` a surviving orphan IS a mismatch, because the run was asked to
|
|
125
|
+
* remove it.
|
|
126
|
+
*/
|
|
127
|
+
export function unverified(after, prune) {
|
|
128
|
+
return after.items
|
|
129
|
+
.filter((i) => i.action !== 'noop' && (i.action !== 'orphan' || prune))
|
|
130
|
+
.map((i) => `${i.type}/${i.key}: ${i.action}${i.reason === undefined ? '' : ` — ${i.reason}`}`);
|
|
131
|
+
}
|
|
132
|
+
export async function apply(chatly, args) {
|
|
133
|
+
const doc = loadPlatformDocument(args);
|
|
134
|
+
const guard = await prefixGuard(chatly, doc);
|
|
135
|
+
if (guard !== undefined) {
|
|
136
|
+
process.stderr.write(`${guard}\n`);
|
|
137
|
+
return 1;
|
|
138
|
+
}
|
|
139
|
+
const writeOnly = bool(args.flags, 'write-only');
|
|
140
|
+
const json = bool(args.flags, 'json');
|
|
141
|
+
const built = await planAgainstLive(chatly, doc, writeOnly);
|
|
142
|
+
const opts = {
|
|
143
|
+
prune: bool(args.flags, 'prune'),
|
|
144
|
+
pruneUnsafe: built.pruneUnsafe,
|
|
145
|
+
writeOnly,
|
|
146
|
+
};
|
|
147
|
+
if (!json) {
|
|
148
|
+
process.stdout.write(renderPlan(built, opts));
|
|
149
|
+
process.stdout.write('\nApplying…\n\n');
|
|
150
|
+
}
|
|
151
|
+
const outcomes = await execute(chatly, built, opts, platformResourceDef);
|
|
152
|
+
/* Read-back verification: re-read, re-plan, and require every row to match. */
|
|
153
|
+
const after = await planAgainstLive(chatly, doc, writeOnly);
|
|
154
|
+
const mismatches = unverified(after, opts.prune);
|
|
155
|
+
if (json) {
|
|
156
|
+
printJson({
|
|
157
|
+
outcomes,
|
|
158
|
+
warnings: built.warnings,
|
|
159
|
+
verified: mismatches.length === 0,
|
|
160
|
+
mismatches,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
process.stdout.write(renderOutcomes(outcomes));
|
|
165
|
+
process.stdout.write(mismatches.length === 0
|
|
166
|
+
? '\nRead back: everything matches the document.\n'
|
|
167
|
+
: `\nRead back: ${String(mismatches.length)} item(s) still differ from the document:\n` +
|
|
168
|
+
mismatches.map((m) => ` ${m}\n`).join(''));
|
|
169
|
+
}
|
|
170
|
+
const failed = outcomes.some((o) => o.state === 'failed' || o.state === 'skipped');
|
|
171
|
+
return failed || mismatches.length > 0 ? 1 : 0;
|
|
172
|
+
}
|
|
173
|
+
/** `chatly platform <plan|apply>`. */
|
|
174
|
+
export async function platform(chatly, args) {
|
|
175
|
+
const sub = args.path[1];
|
|
176
|
+
if (sub === 'plan') {
|
|
177
|
+
return plan(chatly, args);
|
|
178
|
+
}
|
|
179
|
+
if (sub === 'apply') {
|
|
180
|
+
return apply(chatly, args);
|
|
181
|
+
}
|
|
182
|
+
process.stderr.write(sub === undefined ? USAGE : `Unknown subcommand "platform ${sub}".\n${USAGE}`);
|
|
183
|
+
return 2;
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=platform-as-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-as-code.js","sourceRoot":"","sources":["../../src/commands/platform-as-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EAAE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C,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;IACnF,OAAO,MAAM,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC;AAED,sCAAsC;AACtC,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,MAAoB,EAAE,IAAgB;IACnE,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzB,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC;IACD,IAAI,GAAG,KAAK,OAAO,EAAE,CAAC;QACpB,OAAO,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,gCAAgC,GAAG,OAAO,KAAK,EAAE,CAC9E,CAAC;IACF,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -1,8 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chatly plan` and `chatly apply` — the workspace as a file.
|
|
3
|
+
*
|
|
4
|
+
* ═══ THE ASK ══════════════════════════════════════════════════════════════
|
|
5
|
+
*
|
|
6
|
+
* From the integrator who prompted it: "We wrote ~600 lines to idempotently
|
|
7
|
+
* upsert tools, bots, routes, cards and channel config. Offer a declarative
|
|
8
|
+
* `chatly.yaml` with `chatly plan` / `chatly apply` (diff, then apply; never
|
|
9
|
+
* deletes unless told). This is the single biggest DX win for teams that run
|
|
10
|
+
* more than one environment."
|
|
11
|
+
*
|
|
12
|
+
* A CLI rather than a Terraform provider, deliberately. A provider is a
|
|
13
|
+
* second artifact to version, publish, document and keep in step with 142
|
|
14
|
+
* routes, and this CLI is already on npm as `@chatlychat/cli` with a release
|
|
15
|
+
* pipeline. The provider is the better answer for somebody whose whole
|
|
16
|
+
* platform is Terraform; it is not the better answer for the next six months.
|
|
17
|
+
*
|
|
18
|
+
* ═══ THE CONTRACT ═════════════════════════════════════════════════════════
|
|
19
|
+
*
|
|
20
|
+
* plan reads the live workspace, prints a diff, WRITES NOTHING. Not one
|
|
21
|
+
* POST, not one PATCH. `wac.spec.ts` drives the whole path through
|
|
22
|
+
* a recording transport and fails if a single non-GET is issued —
|
|
23
|
+
* and asserts the GETs it did make, so a plan that silently stopped
|
|
24
|
+
* reading cannot pass the same test.
|
|
25
|
+
* apply makes the plan's changes. A resource on the server and absent
|
|
26
|
+
* from the document is REPORTED AND LEFT ALONE; `--prune` is the
|
|
27
|
+
* only thing that deletes, and there is no way to set it in the
|
|
28
|
+
* file. Default safe, as asked.
|
|
29
|
+
*
|
|
30
|
+
* ═══ YAML ═════════════════════════════════════════════════════════════════
|
|
31
|
+
*
|
|
32
|
+
* This reads JSON. `yaml` is in the lockfile only as a transitive
|
|
33
|
+
* devDependency of `lint-staged`, which is not reachable from `apps/cli` and
|
|
34
|
+
* would not ship with the published package either way, and CLAUDE.md §2
|
|
35
|
+
* forbids adding a dependency without explicit approval. A hand-rolled YAML
|
|
36
|
+
* subset was considered and rejected: indentation, quoting, anchors and
|
|
37
|
+
* multi-line scalars are exactly the surface where a parser that is 95%
|
|
38
|
+
* right produces a document that means something other than it says, which
|
|
39
|
+
* is worse than one that will not load.
|
|
40
|
+
*
|
|
41
|
+
* So a `.yaml` path is refused with the one-line conversion rather than
|
|
42
|
+
* half-parsed, and `--file -` reads stdin, which makes any converter a pipe.
|
|
43
|
+
* The documented filename stays `chatly.yaml` in the integrator's words and
|
|
44
|
+
* `chatly.json` in this implementation; when YAML is approved, `wac/load.ts`
|
|
45
|
+
* is the only file that changes — and it is shared with
|
|
46
|
+
* `chatly platform plan`, so both documents gain it at once.
|
|
47
|
+
*
|
|
48
|
+
* ═══ THE PLATFORM DOCUMENT ════════════════════════════════════════════════
|
|
49
|
+
*
|
|
50
|
+
* `chatly platform plan` / `apply` (CHT-F04) is the same engine over the
|
|
51
|
+
* `/v1/platform/*` surface and a `cp_` credential — `commands/platform-as-code.ts`
|
|
52
|
+
* and `pac/`. Everything in `wac/` is shared: this file is the workspace's
|
|
53
|
+
* reader and command wiring, and nothing more.
|
|
54
|
+
*/
|
|
1
55
|
import { type ParsedArgs } from '../args.js';
|
|
2
|
-
import { type
|
|
3
|
-
import { type LiveSection, type Plan } from '../wac/diff.js';
|
|
56
|
+
import { type LiveSection } from '../wac/diff.js';
|
|
4
57
|
import { type WacDocument } from '../wac/document.js';
|
|
5
58
|
import type { ChatlyClient } from '@chatlychat/sdk-node';
|
|
59
|
+
/**
|
|
60
|
+
* The document, read and validated. The loader itself is `wac/load.ts`.
|
|
61
|
+
*
|
|
62
|
+
* Re-exported from here because this is where it has always lived and
|
|
63
|
+
* `chatly platform plan` needs the same loader with a different default
|
|
64
|
+
* filename — see that file's header for why it is not imported across command
|
|
65
|
+
* modules.
|
|
66
|
+
*/
|
|
6
67
|
export declare function loadDocument(args: ParsedArgs, env?: NodeJS.ProcessEnv): WacDocument;
|
|
7
68
|
/**
|
|
8
69
|
* The live rows for every type the document mentions, and nothing else.
|
|
@@ -15,13 +76,6 @@ export declare function loadDocument(args: ParsedArgs, env?: NodeJS.ProcessEnv):
|
|
|
15
76
|
export declare function readLive(chatly: ChatlyClient, doc: WacDocument): Promise<Map<string, LiveSection>>;
|
|
16
77
|
export declare function plan(chatly: ChatlyClient, args: ParsedArgs): Promise<number>;
|
|
17
78
|
export declare function apply(chatly: ChatlyClient, args: ParsedArgs): Promise<number>;
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
* Exported so `wac.spec.ts` can drive it with a scripted transport and assert
|
|
22
|
-
* on the requests that went over the wire — the shape CLAUDE.md insists on
|
|
23
|
-
* ("assert on the request, not the canned response"), since a fake transport
|
|
24
|
-
* that echoes whatever the caller sent agrees with the bug.
|
|
25
|
-
*/
|
|
26
|
-
export declare function execute(chatly: ChatlyClient, built: Plan, opts: ApplyOptions): Promise<ReadonlyArray<ApplyOutcome>>;
|
|
79
|
+
/** Re-exported: it moved to `wac/execute.ts` so `chatly platform apply` shares it. */
|
|
80
|
+
export { execute } from '../wac/execute.js';
|
|
27
81
|
//# sourceMappingURL=workspace-as-code.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-as-code.d.ts","sourceRoot":"","sources":["../../src/commands/workspace-as-code.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workspace-as-code.d.ts","sourceRoot":"","sources":["../../src/commands/workspace-as-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAGnD,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMxE,OAAO,KAAK,EAAE,YAAY,EAAQ,MAAM,sBAAsB,CAAC;AAmB/D;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,WAAW,CAOhG;AAID;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAgCnC;AAID,wBAAsB,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CA2ClF;AA8BD,wBAAsB,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CA+BnF;AAED,sFAAsF;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -41,15 +41,24 @@
|
|
|
41
41
|
* So a `.yaml` path is refused with the one-line conversion rather than
|
|
42
42
|
* half-parsed, and `--file -` reads stdin, which makes any converter a pipe.
|
|
43
43
|
* The documented filename stays `chatly.yaml` in the integrator's words and
|
|
44
|
-
* `chatly.json` in this implementation; when YAML is approved, `
|
|
45
|
-
* is the only
|
|
44
|
+
* `chatly.json` in this implementation; when YAML is approved, `wac/load.ts`
|
|
45
|
+
* is the only file that changes — and it is shared with
|
|
46
|
+
* `chatly platform plan`, so both documents gain it at once.
|
|
47
|
+
*
|
|
48
|
+
* ═══ THE PLATFORM DOCUMENT ════════════════════════════════════════════════
|
|
49
|
+
*
|
|
50
|
+
* `chatly platform plan` / `apply` (CHT-F04) is the same engine over the
|
|
51
|
+
* `/v1/platform/*` surface and a `cp_` credential — `commands/platform-as-code.ts`
|
|
52
|
+
* and `pac/`. Everything in `wac/` is shared: this file is the workspace's
|
|
53
|
+
* reader and command wiring, and nothing more.
|
|
46
54
|
*/
|
|
47
|
-
import {
|
|
48
|
-
import { bool, str } from '../args.js';
|
|
55
|
+
import { bool } from '../args.js';
|
|
49
56
|
import { printJson } from '../output.js';
|
|
50
|
-
import {
|
|
57
|
+
import { renderOutcomes } from '../wac/apply.js';
|
|
51
58
|
import { buildPlan, tally } from '../wac/diff.js';
|
|
52
|
-
import {
|
|
59
|
+
import { WORKSPACE_SCHEMA } from '../wac/document.js';
|
|
60
|
+
import { execute } from '../wac/execute.js';
|
|
61
|
+
import { loadFrom } from '../wac/load.js';
|
|
53
62
|
import { planFooter, planForJson, renderPlan } from '../wac/render.js';
|
|
54
63
|
import { resourceDef } from '../wac/resources.js';
|
|
55
64
|
/** Looked for in order when `--file` is absent. */
|
|
@@ -66,61 +75,21 @@ const DEFAULT_FILES = ['chatly.json', 'chatly.yaml', 'chatly.yml'];
|
|
|
66
75
|
*/
|
|
67
76
|
const EXEMPT_LIST_CAP = 200;
|
|
68
77
|
/* ── Loading ──────────────────────────────────────────────────────────── */
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
function findDefault() {
|
|
79
|
-
for (const candidate of DEFAULT_FILES) {
|
|
80
|
-
try {
|
|
81
|
-
readFileSync(candidate, 'utf8');
|
|
82
|
-
return candidate;
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
throw new Error('No document found. Looked for chatly.json, chatly.yaml and chatly.yml in this ' +
|
|
89
|
-
'directory.\nPass one with --file, or --file - to read stdin.\n' +
|
|
90
|
-
'There is a worked example at https://chatlychat.com/docs/sdk-cli#workspace-as-code');
|
|
91
|
-
}
|
|
78
|
+
/**
|
|
79
|
+
* The document, read and validated. The loader itself is `wac/load.ts`.
|
|
80
|
+
*
|
|
81
|
+
* Re-exported from here because this is where it has always lived and
|
|
82
|
+
* `chatly platform plan` needs the same loader with a different default
|
|
83
|
+
* filename — see that file's header for why it is not imported across command
|
|
84
|
+
* modules.
|
|
85
|
+
*/
|
|
92
86
|
export function loadDocument(args, env = process.env) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
* The second half of that test catches a YAML document passed under a
|
|
100
|
-
* `.json` name or through stdin, which is the shape of the mistake
|
|
101
|
-
* somebody makes once. A YAML file handed to `JSON.parse` fails with
|
|
102
|
-
* "Unexpected token v", which sends the reader looking for a syntax error
|
|
103
|
-
* in their own file rather than at the one sentence they need.
|
|
104
|
-
*/
|
|
105
|
-
throw new Error(`${path} looks like YAML, and this CLI reads JSON.\n\n` +
|
|
106
|
-
'YAML needs a parser, and adding a dependency to a published CLI is a decision this\n' +
|
|
107
|
-
'repo does not make casually (CLAUDE.md §2) — `yaml` is in the monorepo lockfile only\n' +
|
|
108
|
-
'as a transitive devDependency of lint-staged, so it is not something we already ship.\n' +
|
|
109
|
-
'A 95%-right hand-rolled YAML subset is worse than no YAML: it loads a document that\n' +
|
|
110
|
-
'means something other than what it says.\n\n' +
|
|
111
|
-
'Convert it and pipe it:\n' +
|
|
112
|
-
` npx js-yaml ${path} | chatly plan --file -\n` +
|
|
113
|
-
' python3 -c "import sys,yaml,json;json.dump(yaml.safe_load(sys.stdin),sys.stdout)" \\\n' +
|
|
114
|
-
` < ${path} | chatly plan --file -`);
|
|
115
|
-
}
|
|
116
|
-
let parsed;
|
|
117
|
-
try {
|
|
118
|
-
parsed = JSON.parse(raw);
|
|
119
|
-
}
|
|
120
|
-
catch (err) {
|
|
121
|
-
throw new Error(`${path} is not valid JSON: ${err instanceof Error ? err.message : '?'}`);
|
|
122
|
-
}
|
|
123
|
-
return parseDocument(parsed, env);
|
|
87
|
+
return loadFrom(args, env, {
|
|
88
|
+
defaultFiles: DEFAULT_FILES,
|
|
89
|
+
schema: WORKSPACE_SCHEMA,
|
|
90
|
+
docsUrl: 'https://chatlychat.com/docs/sdk-cli#workspace-as-code',
|
|
91
|
+
command: 'plan',
|
|
92
|
+
});
|
|
124
93
|
}
|
|
125
94
|
/* ── Reading the live workspace ───────────────────────────────────────── */
|
|
126
95
|
/**
|
|
@@ -218,14 +187,14 @@ export async function plan(chatly, args) {
|
|
|
218
187
|
* `whoami` is a GET, so this does not spend the no-writes property.
|
|
219
188
|
*/
|
|
220
189
|
async function workspaceGuard(chatly, doc) {
|
|
221
|
-
if (doc.
|
|
190
|
+
if (doc.guard === undefined) {
|
|
222
191
|
return undefined;
|
|
223
192
|
}
|
|
224
193
|
const me = await chatly.whoami();
|
|
225
|
-
if (me.workspaceId === doc.
|
|
194
|
+
if (me.workspaceId === doc.guard) {
|
|
226
195
|
return undefined;
|
|
227
196
|
}
|
|
228
|
-
return (`Refusing to run: the document says \`"workspace": "${doc.
|
|
197
|
+
return (`Refusing to run: the document says \`"workspace": "${doc.guard}"\` and this key ` +
|
|
229
198
|
`belongs to ${me.workspaceId}.\n` +
|
|
230
199
|
'Either point --key / CHATLY_API_KEY at the right workspace, or remove the `workspace` ' +
|
|
231
200
|
'line if this document is meant to be portable.');
|
|
@@ -252,7 +221,7 @@ export async function apply(chatly, args) {
|
|
|
252
221
|
process.stdout.write(renderPlan(built, opts));
|
|
253
222
|
process.stdout.write('\nApplying…\n\n');
|
|
254
223
|
}
|
|
255
|
-
const outcomes = await execute(chatly, built, opts);
|
|
224
|
+
const outcomes = await execute(chatly, built, opts, resourceDef);
|
|
256
225
|
if (bool(args.flags, 'json')) {
|
|
257
226
|
printJson({ outcomes, warnings: built.warnings });
|
|
258
227
|
}
|
|
@@ -261,117 +230,6 @@ export async function apply(chatly, args) {
|
|
|
261
230
|
}
|
|
262
231
|
return outcomes.some((o) => o.state === 'failed' || o.state === 'skipped') ? 1 : 0;
|
|
263
232
|
}
|
|
264
|
-
/**
|
|
265
|
-
|
|
266
|
-
*
|
|
267
|
-
* Exported so `wac.spec.ts` can drive it with a scripted transport and assert
|
|
268
|
-
* on the requests that went over the wire — the shape CLAUDE.md insists on
|
|
269
|
-
* ("assert on the request, not the canned response"), since a fake transport
|
|
270
|
-
* that echoes whatever the caller sent agrees with the bug.
|
|
271
|
-
*/
|
|
272
|
-
export async function execute(chatly, built, opts) {
|
|
273
|
-
const outcomes = [];
|
|
274
|
-
/** `type/key` → the id a create in THIS run returned. */
|
|
275
|
-
const refIds = new Map();
|
|
276
|
-
/** `type/key` that failed, so its dependents are skipped not attempted. */
|
|
277
|
-
const failed = new Set();
|
|
278
|
-
for (const item of built.items) {
|
|
279
|
-
const def = resourceDef(item.type);
|
|
280
|
-
if (def === undefined) {
|
|
281
|
-
continue;
|
|
282
|
-
}
|
|
283
|
-
const address = `${item.type}/${item.key}`;
|
|
284
|
-
if (item.action === 'noop') {
|
|
285
|
-
continue;
|
|
286
|
-
}
|
|
287
|
-
if (item.action === 'blocked') {
|
|
288
|
-
outcomes.push({ ...base(item), state: 'skipped', detail: item.reason, secrets: [] });
|
|
289
|
-
continue;
|
|
290
|
-
}
|
|
291
|
-
const blocker = item.dependsOn.find((d) => failed.has(d));
|
|
292
|
-
if (blocker !== undefined) {
|
|
293
|
-
outcomes.push({
|
|
294
|
-
...base(item),
|
|
295
|
-
state: 'skipped',
|
|
296
|
-
detail: `${blocker} failed above, and this names it. Attempting it anyway would produce a ` +
|
|
297
|
-
'second error about a missing id that points at the wrong thing.',
|
|
298
|
-
secrets: [],
|
|
299
|
-
});
|
|
300
|
-
failed.add(address);
|
|
301
|
-
continue;
|
|
302
|
-
}
|
|
303
|
-
const ops = writesFor(def, item, refIds, opts);
|
|
304
|
-
if (ops.length === 0) {
|
|
305
|
-
outcomes.push({
|
|
306
|
-
...base(item),
|
|
307
|
-
state: 'kept',
|
|
308
|
-
detail: item.action === 'orphan'
|
|
309
|
-
? opts.prune
|
|
310
|
-
? def.remove === null
|
|
311
|
-
? (def.removeBlocked ?? 'no DELETE route.')
|
|
312
|
-
: 'this type cannot be pruned safely on this run (see the warnings)'
|
|
313
|
-
: '`--prune` would delete it'
|
|
314
|
-
: undefined,
|
|
315
|
-
secrets: [],
|
|
316
|
-
});
|
|
317
|
-
continue;
|
|
318
|
-
}
|
|
319
|
-
const secrets = [];
|
|
320
|
-
let ok = true;
|
|
321
|
-
for (const op of ops) {
|
|
322
|
-
try {
|
|
323
|
-
const response = await chatly.request(op.method, op.path, op.body === undefined ? {} : { body: op.body });
|
|
324
|
-
secrets.push(...harvestSecrets(def, item, response));
|
|
325
|
-
const id = idOf(response, def);
|
|
326
|
-
if (id !== undefined) {
|
|
327
|
-
refIds.set(address, id);
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
catch (err) {
|
|
331
|
-
ok = false;
|
|
332
|
-
failed.add(address);
|
|
333
|
-
outcomes.push({
|
|
334
|
-
...base(item),
|
|
335
|
-
state: 'failed',
|
|
336
|
-
detail: `${op.method} ${op.path} — ${err instanceof Error ? err.message : String(err)}`,
|
|
337
|
-
secrets,
|
|
338
|
-
});
|
|
339
|
-
break;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
if (ok) {
|
|
343
|
-
outcomes.push({ ...base(item), state: 'applied', detail: undefined, secrets });
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
return outcomes;
|
|
347
|
-
}
|
|
348
|
-
function base(item) {
|
|
349
|
-
return { type: item.type, key: item.key, action: item.action };
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* The id out of a write response, for a reference a later section needs.
|
|
353
|
-
*
|
|
354
|
-
* Two levels, because `POST /v1/customer-cards` answers
|
|
355
|
-
* `{ card: { id }, secret }` rather than the card itself — the same envelope
|
|
356
|
-
* quirk that makes the secret sweep two levels deep.
|
|
357
|
-
*/
|
|
358
|
-
function idOf(response, def) {
|
|
359
|
-
if (typeof response !== 'object' || response === null) {
|
|
360
|
-
return undefined;
|
|
361
|
-
}
|
|
362
|
-
const top = response;
|
|
363
|
-
const direct = top[def.idField];
|
|
364
|
-
if (typeof direct === 'string' && direct.length > 0) {
|
|
365
|
-
return direct;
|
|
366
|
-
}
|
|
367
|
-
for (const value of Object.values(top)) {
|
|
368
|
-
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
369
|
-
const nested = value[def.idField];
|
|
370
|
-
if (typeof nested === 'string' && nested.length > 0) {
|
|
371
|
-
return nested;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
return undefined;
|
|
376
|
-
}
|
|
233
|
+
/** Re-exported: it moved to `wac/execute.ts` so `chatly platform apply` shares it. */
|
|
234
|
+
export { execute } from '../wac/execute.js';
|
|
377
235
|
//# sourceMappingURL=workspace-as-code.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-as-code.js","sour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,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;QAC9B,yEAAyE;QACzE,qEAAqE;QACrE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QAC9C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IACjE,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;QAC7B,SAAS,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IACpD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrF,CAAC;AAED,sFAAsF;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/help.d.ts
CHANGED
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* The convention the spec relies on: a command line starts with exactly two
|
|
23
23
|
* spaces and its first word is the command group.
|
|
24
24
|
*/
|
|
25
|
-
export declare const HELP = "chatly \u2014 the Chatly command line\n\nUSAGE\n chatly <command> [subcommand] [flags]\n\nAUTH\n login Store an API key in ~/.config/chatly/config.json (0600)\n logout Remove the stored key\n whoami Which workspace this key belongs to, and its scopes\n\nCONVERSATIONS\n conversations list Open conversations, newest first\n conversations get <id> One conversation\n conversations messages <id> The thread\n conversations send <id> <body>\n Reply as the key's machine identity\n conversations unattended Open with no agent reply yet\n conversations mood <id> Sentiment over the thread\n conversations return-to-bot <id> <bot-id>\n Give an open thread back to an assistant\n\nCONTACTS\n contacts list People in this workspace\n contacts get <id>\n contacts upsert --email --name --external-id --phone\n contacts tag <id> <tag> Add a tag\n contacts journey <id> Timeline: conversations, events, tickets\n contacts cards <id> Customer-card data for this person\n\nTICKETS\n tickets list --status --queue\n tickets get <id>\n tickets comments <id>\n tickets queues\n tickets lineage <id> Merge and split history\n tickets time <id> Time logged\n tickets status-history <id>\n\nKNOWLEDGE + SEARCH\n search <query> Across contacts, conversations, messages, tickets, KB\n kb articles Help-centre articles\n kb article <slug>\n kb collections\n\nEVENTS\n events track <contact-id> <name>\n Fire a CDP event. --prop key=value, repeatable\n events list --contact-id\n\nBOTS + EXTERNAL AGENTS\n bots list | get <id>\n bots create --body. type:\"external\" answers with a secret, ONCE\n bots update <id> --body\n bots update-external <id> --body. webhookUrl, timeoutSeconds, fallbackMessage\n bots rotate-secret <id> New signing secret, shown once. Hard cut, or\n --activate-at <ISO instant> (\u2264168h) keeps the old\n one signing until then\n bots deliveries <id> The push ledger. --status pending|delivered|failed|dead\n bots delivery <id> <delivery-id>\n One delivery, with the exact signed payload\n bots redeliver <id> <delivery-id>\n Queue the recorded payload again, from attempt 0\n bots test-delivery <id> Sign and POST a rehearsal payload; prints the response\n\nROUTING + AUTOMATION\n bot-routes list | fields | create | update <id> | delete <id>\n bot-routes resolve Dry-run the table. --body with a hypothetical visitor\n triggers list | get <id> | upsert | delete <id>\n brands list | get <id> | create | update <id> | delete <id>\n macros list | get <id> | create | update <id> | delete <id>\n email-templates templates | get <kind> | set <kind> | reset <kind>\n knowledge-gaps list | triage <id>\n\nINTEGRATIONS\n webhooks deliveries --status\n webhooks delivery <id>\n webhooks redeliver <id>\n webhooks endpoints Subscriptions, not traffic\n webhooks events The subscribable event catalogue\n webhooks schema-versions\n webhooks create --url --event (repeatable). Answers with whsec_, once\n webhooks pin <id> <version>\n customer-cards list | create | update <id> | delete <id>\n customer-cards rotate-secret <id>\n Update your endpoint BEFORE calling this\n docs-sources list | providers | discover | create | update <id> | delete <id>\n docs-sources sync <id> --full re-reads every page\n docs-sources subscribe <id> A refusal is a success: read the response\n channels list | get <id> | adapters | create | update <id>\n channels rotate-secret <id>\n\nDEVELOPING AGAINST WEBHOOKS AND AGENTS\n listen Tail this workspace's webhook deliveries and POST\n each one to a local URL. Registers nothing\n --forward-to <url> where to POST (omit to print only)\n --secret <whsec_\u2026> sign the forwarded request\n --endpoint <id> one subscription's traffic only\n --event <name> repeatable; filters client-side\n --status <s> pending | delivered | failed | dead\n --replay <n> forward the n newest rows first\n --interval <seconds> poll interval, default 2\n listen --bot <id> Tail one external agent's push deliveries instead,\n the same ledger as 'bots deliveries'. Same flags, except:\n --secret <chsec_\u2026> the AGENT's secret, not whsec_\n --event <kind> message | transfer (agent.message too)\n Forwards the payload itself, with the five\n x-chatly-* headers a real delivery carries\n listen --relay Receive LIVE tool calls, card fetches and canvas steps\n on localhost and answer them. Takes PRODUCTION traffic\n for the ids named, so they are required:\n --tool <id> | --card <id> | --canvas <channelId>\n --forward-to <url> required; each call's path is appended\n --secret <s> or <id>=<s>, repeatable; re-signs\n Detaches after 10 minutes idle, or on Ctrl-C. The\n dashboard shows a banner for as long as it is attached\n\nWORKSPACE AS CODE\n plan Diff chatly.json against the live workspace. Reads only\n apply Make the plan's changes. Never deletes unless told\n --file <path> the document (- for stdin). Default: ./chatly.json\n --prune also delete what the document omits\n --write-only also send fields that cannot be read back\n --exit-code plan only: exit 2 when there is drift\n\nAI\n ai providers | quota\n ai add-provider BYOK. --body\n ai test-provider <key>\n ai tools | create-tool | update-tool <id> | delete-tool <id>\n ai tone | set-tone | generate-tone <sample>\n\nREPORTS\n reports overview --days\n reports agents Means, not percentiles\n reports conversations-by-day\n reports sources | response-times | voice\n reports attribution <dim> One of ten dimensions; an unknown one is refused\n reports cohorts --weeks, NOT --days\n reports themes --date. A daily snapshot; there is no regenerate\n reports theme-conversations <theme-id>\n reports teams | labels | sla\n --from --to --days --group-by\n\nBILLING\n billing summary | plans | invoices\n billing usage <event-type> One meter over a window. --from --to\n billing usage-daily <event-type>\n Dense: one row per UTC day, zeros included\n billing usage-monthly --month\n\nWORKSPACE\n workspace settings\n workspace labels | inboxes | skills\n workspace team-members <team-id>\n workspace key-scopes What a key may be granted\n\nRAW\n api <METHOD> <path> Any route, with auth, idempotency and retries\n chatly api GET /v1/feature-flags\n chatly api POST /v1/macros --body '{\"name\":\"Refund\"}'\n\nGLOBAL FLAGS\n --json Raw API response instead of a table\n --all Follow pagination to the end (list commands)\n --limit <n> Page size\n --cursor <c> Start from a cursor\n --key <ck_\u2026> Override the stored key for this call\n --api-url <url> Point at another Chatly environment\n --help, --version\n\nDocs: https://chatlychat.com/docs/sdk-cli\n";
|
|
25
|
+
export declare const HELP = "chatly \u2014 the Chatly command line\n\nUSAGE\n chatly <command> [subcommand] [flags]\n\nAUTH\n login Store an API key in ~/.config/chatly/config.json (0600)\n logout Remove the stored key\n whoami Which workspace this key belongs to, and its scopes\n (a cp_ credential: scopes, expiry and guardrails)\n\nCONVERSATIONS\n conversations list Open conversations, newest first\n conversations get <id> One conversation\n conversations messages <id> The thread\n conversations send <id> <body>\n Reply as the key's machine identity\n conversations unattended Open with no agent reply yet\n conversations mood <id> Sentiment over the thread\n conversations return-to-bot <id> <bot-id>\n Give an open thread back to an assistant\n\nCONTACTS\n contacts list People in this workspace\n contacts get <id>\n contacts upsert --email --name --external-id --phone\n contacts tag <id> <tag> Add a tag\n contacts journey <id> Timeline: conversations, events, tickets\n contacts cards <id> Customer-card data for this person\n\nTICKETS\n tickets list --status --queue\n tickets get <id>\n tickets comments <id>\n tickets queues\n tickets lineage <id> Merge and split history\n tickets time <id> Time logged\n tickets status-history <id>\n\nKNOWLEDGE + SEARCH\n search <query> Across contacts, conversations, messages, tickets, KB\n kb articles Help-centre articles\n kb article <slug>\n kb collections\n\nEVENTS\n events track <contact-id> <name>\n Fire a CDP event. --prop key=value, repeatable\n events list --contact-id\n\nBOTS + EXTERNAL AGENTS\n bots list | get <id>\n bots create --body. type:\"external\" answers with a secret, ONCE\n bots update <id> --body\n bots update-external <id> --body. webhookUrl, timeoutSeconds, fallbackMessage\n bots rotate-secret <id> New signing secret, shown once. Hard cut, or\n --activate-at <ISO instant> (\u2264168h) keeps the old\n one signing until then\n bots deliveries <id> The push ledger. --status pending|delivered|failed|dead\n bots delivery <id> <delivery-id>\n One delivery, with the exact signed payload\n bots redeliver <id> <delivery-id>\n Queue the recorded payload again, from attempt 0\n bots test-delivery <id> Sign and POST a rehearsal payload; prints the response\n\nROUTING + AUTOMATION\n bot-routes list | fields | create | update <id> | delete <id>\n bot-routes resolve Dry-run the table. --body with a hypothetical visitor\n triggers list | get <id> | upsert | delete <id>\n brands list | get <id> | create | update <id> | delete <id>\n macros list | get <id> | create | update <id> | delete <id>\n email-templates templates | get <kind> | set <kind> | reset <kind>\n knowledge-gaps list | triage <id>\n\nINTEGRATIONS\n webhooks deliveries --status --endpoint --trace <ulid> (X-Chatly-Trace)\n webhooks delivery <id>\n webhooks redeliver <id>\n webhooks endpoints Subscriptions, not traffic\n webhooks events The subscribable event catalogue\n webhooks schema-versions\n webhooks create --url --event (repeatable). Answers with whsec_, once\n webhooks pin <id> <version>\n customer-cards list | create | update <id> | delete <id>\n customer-cards rotate-secret <id>\n Update your endpoint BEFORE calling this\n docs-sources list | providers | discover | create | update <id> | delete <id>\n docs-sources sync <id> --full re-reads every page\n docs-sources subscribe <id> A refusal is a success: read the response\n channels list | get <id> | adapters | create | update <id>\n channels rotate-secret <id>\n channels brand <id> --url <brand.json> | --file/--body to apply; neither reads back\n\nDATA RIGHTS\n privacy executor-key Mint the credential a privacy platform registers.\n Answers with the executor URL, the workspace id\n and the secret \u2014 shown ONCE. The key carries\n exactly privacy:execute and reaches nothing but\n /v1/privacy/*\n privacy lookup --body <json> resolve a person to a subjectId\n privacy request --body <json> file one; caseId is the replay key\n privacy status <id> Read a request back\n privacy cancel <id> Withdraw one that has not run\n\nDEVELOPING AGAINST WEBHOOKS AND AGENTS\n listen Tail this workspace's webhook deliveries and POST\n each one to a local URL. Registers nothing\n --forward-to <url> where to POST (omit to print only)\n --secret <whsec_\u2026> sign the forwarded request\n --endpoint <id> one subscription's traffic only\n --event <name> repeatable; filters client-side\n --status <s> pending | delivered | failed | dead\n --replay <n> forward the n newest rows first\n --interval <seconds> poll interval, default 2\n listen --bot <id> Tail one external agent's push deliveries instead,\n the same ledger as 'bots deliveries'. Same flags, except:\n --secret <chsec_\u2026> the AGENT's secret, not whsec_\n --event <kind> message | transfer (agent.message too)\n Forwards the payload itself, with the five\n x-chatly-* headers a real delivery carries\n listen --relay Receive LIVE tool calls, card fetches and canvas steps\n on localhost and answer them. Takes PRODUCTION traffic\n for the ids named, so they are required:\n --tool <id> | --card <id> | --canvas <channelId>\n --forward-to <url> required; each call's path is appended\n --secret <s> or <id>=<s>, repeatable; re-signs\n Detaches after 10 minutes idle, or on Ctrl-C. The\n dashboard shows a banner for as long as it is attached\n\nWORKSPACE AS CODE\n plan Diff chatly.json against the live workspace. Reads only\n apply Make the plan's changes. Never deletes unless told\n --file <path> the document (- for stdin). Default: ./chatly.json\n --prune also delete what the document omits\n --write-only also send fields that cannot be read back\n --exit-code plan only: exit 2 when there is drift\n platform plan The same over /v1/platform/* with a cp_ credential:\n platform apply workspaces, users, apiKeys, botCredentials,\n knowledgeSources and settings (business hours,\n routing, widget channel) across many tenants.\n Default file: ./chatly.platform.json. Same flags.\n apply re-reads afterwards and exits 1 unless\n everything matches the document\n\nINSTALL\n init next|remix|astro|express\n Scaffold the widget into this project for a web channel:\n identity route, launcher or snippet, CSP sources\n (chatly.csp.mjs) and a privacy table. Never overwrites\n --public-id <id> which web channel (needed if several)\n --identity hmac|atlas default hmac (atlas: next, remix)\n --dir <path> default . --dry-run --force\n\nAI\n ai providers | quota\n ai add-provider BYOK. --body\n ai test-provider <key>\n ai tools | create-tool | update-tool <id> | delete-tool <id>\n ai tone | set-tone | generate-tone <sample>\n\nREPORTS\n reports overview --days\n reports agents Means, not percentiles\n reports conversations-by-day\n reports sources | response-times | voice\n reports attribution <dim> One of ten dimensions; an unknown one is refused\n reports cohorts --weeks, NOT --days\n reports themes --date. A daily snapshot; there is no regenerate\n reports theme-conversations <theme-id>\n reports teams | labels | sla\n --from --to --days --group-by\n\nBILLING\n billing summary | plans | invoices\n billing usage <event-type> One meter over a window. --from --to\n billing usage-daily <event-type>\n Dense: one row per UTC day, zeros included\n billing usage-monthly --month\n\nWORKSPACE\n workspace settings\n workspace labels | inboxes | skills\n workspace team-members <team-id>\n workspace key-scopes What a key may be granted\n\nRAW\n api <METHOD> <path> Any route, with auth, idempotency and retries\n chatly api GET /v1/feature-flags\n chatly api POST /v1/macros --body '{\"name\":\"Refund\"}'\n\nGLOBAL FLAGS\n --json Raw API response instead of a table\n --all Follow pagination to the end (list commands)\n --limit <n> Page size\n --cursor <c> Start from a cursor\n --key <ck_\u2026> Override the stored key for this call\n --api-url <url> Point at another Chatly environment\n --help, --version\n\nDocs: https://chatlychat.com/docs/sdk-cli\n";
|
|
26
26
|
//# sourceMappingURL=help.d.ts.map
|
package/dist/help.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,IAAI,wiUAwMhB,CAAC"}
|