@solidnumber/cli 2.11.18 → 2.11.20
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/README.md +1 -1
- package/dist/client.d.ts +38 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +66 -0
- package/dist/client.js.map +1 -0
- package/dist/commands/apply.d.ts +18 -0
- package/dist/commands/apply.d.ts.map +1 -0
- package/dist/commands/apply.js +149 -0
- package/dist/commands/apply.js.map +1 -0
- package/dist/commands/signal.d.ts +16 -1
- package/dist/commands/signal.d.ts.map +1 -1
- package/dist/commands/signal.js +126 -27
- package/dist/commands/signal.js.map +1 -1
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/lib/api-client.d.ts +20 -3
- package/dist/lib/api-client.d.ts.map +1 -1
- package/dist/lib/api-client.js +56 -7
- package/dist/lib/api-client.js.map +1 -1
- package/dist/lib/apply/engine.d.ts +87 -0
- package/dist/lib/apply/engine.d.ts.map +1 -0
- package/dist/lib/apply/engine.js +277 -0
- package/dist/lib/apply/engine.js.map +1 -0
- package/dist/lib/apply/registry.d.ts +32 -0
- package/dist/lib/apply/registry.d.ts.map +1 -0
- package/dist/lib/apply/registry.js +54 -0
- package/dist/lib/apply/registry.js.map +1 -0
- package/dist/lib/esm-import.d.ts +2 -0
- package/dist/lib/esm-import.d.ts.map +1 -0
- package/dist/lib/esm-import.js +23 -0
- package/dist/lib/esm-import.js.map +1 -0
- package/dist/lib/lighthouse-runner.d.ts.map +1 -1
- package/dist/lib/lighthouse-runner.js +4 -35
- package/dist/lib/lighthouse-runner.js.map +1 -1
- package/package.json +10 -7
- package/platform-docs/llms.txt +6 -5
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Run an AI-powered business from your terminal.
|
|
4
4
|
<!-- AUTO-NUMBERS: do not edit by hand; updated by scripts/sync-marketing-numbers.ts -->
|
|
5
|
-
|
|
5
|
+
123 top-level commands, 700+ subcommands, 54 industries, 14 user-facing AI agents (plus 102 background workers). One CLI.
|
|
6
6
|
|
|
7
7
|
**v2.11** — outbound voice (`solid voice call` / `solid voice text` /
|
|
8
8
|
`solid voice translate`) + universal `solid agent dispatch <verb>` +
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ReconcileOptions, ReconcileReport } from './lib/apply/engine';
|
|
2
|
+
export interface SolidClientOptions {
|
|
3
|
+
/** API key (sk_…) or JWT. Sets SOLID_API_KEY for the process. */
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
/** Tenant to operate on. Sets SOLID_COMPANY_ID for the process. */
|
|
6
|
+
companyId?: number | string;
|
|
7
|
+
/** Base URL. Only honored if set before the api-client module loaded — prefer the SOLID_API_URL env var. */
|
|
8
|
+
apiUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DispatchOptions {
|
|
11
|
+
/** Required for write verbs — the equivalent of clicking Confirm in the UI. */
|
|
12
|
+
confirm?: boolean;
|
|
13
|
+
/** Typed-phrase confirmation for WRITE_FINANCIAL / IRREVERSIBLE verbs. */
|
|
14
|
+
typedPhrase?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface SolidClient {
|
|
17
|
+
get<T = unknown>(url: string): Promise<T>;
|
|
18
|
+
post<T = unknown>(url: string, body?: unknown): Promise<T>;
|
|
19
|
+
put<T = unknown>(url: string, body?: unknown): Promise<T>;
|
|
20
|
+
patch<T = unknown>(url: string, body?: unknown): Promise<T>;
|
|
21
|
+
del<T = unknown>(url: string): Promise<T>;
|
|
22
|
+
/** Invoke any platform verb (the universal capability surface). */
|
|
23
|
+
dispatch<T = unknown>(verb: string, args?: Record<string, unknown>, opts?: DispatchOptions): Promise<T>;
|
|
24
|
+
/** List the available platform verbs. */
|
|
25
|
+
listVerbs<T = unknown>(): Promise<T>;
|
|
26
|
+
/** Reconcile a YAML/JSON manifest (or pre-parsed resources) to desired state. */
|
|
27
|
+
apply(manifest: string, opts?: ReconcileOptions): Promise<ReconcileReport>;
|
|
28
|
+
/** Poll the company event stream once. */
|
|
29
|
+
signalTail<T = unknown>(opts?: {
|
|
30
|
+
topic?: string;
|
|
31
|
+
sinceId?: number;
|
|
32
|
+
limit?: number;
|
|
33
|
+
}): Promise<T>;
|
|
34
|
+
/** Resource kinds `apply` understands. */
|
|
35
|
+
applyKinds(): string[];
|
|
36
|
+
}
|
|
37
|
+
export declare function createSolidClient(options?: SolidClientOptions): SolidClient;
|
|
38
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAqBA,OAAO,EAA4B,gBAAgB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGjG,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,4GAA4G;IAC5G,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1C,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3D,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1D,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5D,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1C,mEAAmE;IACnE,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACxG,yCAAyC;IACzC,SAAS,CAAC,CAAC,GAAG,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IACrC,iFAAiF;IACjF,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC3E,0CAA0C;IAC1C,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACjG,0CAA0C;IAC1C,UAAU,IAAI,MAAM,EAAE,CAAC;CACxB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,kBAAuB,GAAG,WAAW,CAyC/E"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSolidClient = createSolidClient;
|
|
4
|
+
/**
|
|
5
|
+
* @solidnumber/cli/client — programmatic capability surface.
|
|
6
|
+
*
|
|
7
|
+
* Embed the Solid# platform in another Node program instead of shelling out to
|
|
8
|
+
* the `solid` binary or re-implementing against raw HTTP. This wraps the same
|
|
9
|
+
* api-client the CLI uses, so you inherit idempotency keys, token refresh, the
|
|
10
|
+
* typed error envelope, dry-run, and agent headers — and adds the high-level
|
|
11
|
+
* capabilities (verb dispatch + declarative apply) on top.
|
|
12
|
+
*
|
|
13
|
+
* import { createSolidClient } from '@solidnumber/cli/client';
|
|
14
|
+
* const solid = createSolidClient({ apiKey: process.env.SOLID_API_KEY });
|
|
15
|
+
* await solid.dispatch('crm_lead_promote', { contact_id: 1 });
|
|
16
|
+
* const report = await solid.apply(fs.readFileSync('infra.yaml', 'utf8'));
|
|
17
|
+
*
|
|
18
|
+
* Auth resolves exactly like the CLI: SOLID_API_KEY (or an existing
|
|
19
|
+
* `solid auth login` session), SOLID_COMPANY_ID, SOLID_API_URL. Passing
|
|
20
|
+
* `apiKey`/`companyId` here sets those for the process. Note: `apiUrl` is read
|
|
21
|
+
* once when the api-client module first loads, so to target a non-default host
|
|
22
|
+
* set SOLID_API_URL in the environment BEFORE importing this module.
|
|
23
|
+
*/
|
|
24
|
+
const api_client_1 = require("./lib/api-client");
|
|
25
|
+
const engine_1 = require("./lib/apply/engine");
|
|
26
|
+
const registry_1 = require("./lib/apply/registry");
|
|
27
|
+
function createSolidClient(options = {}) {
|
|
28
|
+
if (options.apiKey)
|
|
29
|
+
process.env.SOLID_API_KEY = options.apiKey;
|
|
30
|
+
if (options.companyId !== undefined && options.companyId !== null) {
|
|
31
|
+
process.env.SOLID_COMPANY_ID = String(options.companyId);
|
|
32
|
+
}
|
|
33
|
+
if (options.apiUrl && !process.env.SOLID_API_URL)
|
|
34
|
+
process.env.SOLID_API_URL = options.apiUrl;
|
|
35
|
+
return {
|
|
36
|
+
async get(url) { return (await api_client_1.apiClient.get(url)).data; },
|
|
37
|
+
async post(url, body) { return (await api_client_1.apiClient.post(url, body)).data; },
|
|
38
|
+
async put(url, body) { return (await api_client_1.apiClient.put(url, body)).data; },
|
|
39
|
+
async patch(url, body) { return (await api_client_1.apiClient.patch(url, body)).data; },
|
|
40
|
+
async del(url) { return (await api_client_1.apiClient.delete(url)).data; },
|
|
41
|
+
async dispatch(verb, args = {}, opts = {}) {
|
|
42
|
+
const res = await api_client_1.apiClient.post('/api/v1/ada/cli-dispatch', {
|
|
43
|
+
verb,
|
|
44
|
+
args,
|
|
45
|
+
confirm: !!opts.confirm,
|
|
46
|
+
typed_phrase: opts.typedPhrase ?? null,
|
|
47
|
+
});
|
|
48
|
+
return res.data;
|
|
49
|
+
},
|
|
50
|
+
async listVerbs() { return (await api_client_1.apiClient.get('/api/v1/agent/verbs')).data; },
|
|
51
|
+
async apply(manifest, opts = {}) {
|
|
52
|
+
const resources = (0, engine_1.parseManifest)(manifest);
|
|
53
|
+
// apiClient satisfies the ApplyClient surface (get/post/put/patch/delete
|
|
54
|
+
// with idempotency-key options), so the reconcile inherits idempotency.
|
|
55
|
+
return (0, engine_1.reconcile)(api_client_1.apiClient, resources, opts);
|
|
56
|
+
},
|
|
57
|
+
async signalTail(opts = {}) {
|
|
58
|
+
const qs = new URLSearchParams({ topic: opts.topic ?? 'agent.any', limit: String(opts.limit ?? 50) });
|
|
59
|
+
if (opts.sinceId !== undefined)
|
|
60
|
+
qs.set('since_id', String(opts.sinceId));
|
|
61
|
+
return (await api_client_1.apiClient.get(`/api/v1/signal/tail?${qs.toString()}`)).data;
|
|
62
|
+
},
|
|
63
|
+
applyKinds() { return (0, registry_1.knownKinds)(); },
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;AA0DA,8CAyCC;AAnGD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iDAA6C;AAC7C,+CAAiG;AACjG,mDAAkD;AAoClD,SAAgB,iBAAiB,CAAC,UAA8B,EAAE;IAChE,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,CAAC,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desired-state reconcile (GitOps for a tenant).
|
|
3
|
+
*
|
|
4
|
+
* Reads a YAML/JSON manifest of desired resources and converges the company
|
|
5
|
+
* to it: creates what's missing, updates what drifted, leaves matches alone,
|
|
6
|
+
* and (with --prune) deletes managed resources absent from the manifest.
|
|
7
|
+
* Idempotent: re-applying an unchanged manifest is all no-ops. The whole point
|
|
8
|
+
* is that a SYSTEM can declare its state in a file and reconcile it repeatedly
|
|
9
|
+
* — CI, GitOps, an agent — instead of issuing imperative one-off mutations.
|
|
10
|
+
*
|
|
11
|
+
* solid apply infra.yaml
|
|
12
|
+
* solid apply infra.yaml --dry-run # plan only, no writes
|
|
13
|
+
* solid apply infra.yaml --prune --yes # also delete unmanaged resources
|
|
14
|
+
* solid apply --kinds # list supported kinds
|
|
15
|
+
*/
|
|
16
|
+
import { Command } from 'commander';
|
|
17
|
+
export declare const applyCommand: Command;
|
|
18
|
+
//# sourceMappingURL=apply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/commands/apply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuBpC,eAAO,MAAM,YAAY,SA+GrB,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.applyCommand = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* solid apply — declarative desired-state reconcile (GitOps for a tenant).
|
|
9
|
+
*
|
|
10
|
+
* Reads a YAML/JSON manifest of desired resources and converges the company
|
|
11
|
+
* to it: creates what's missing, updates what drifted, leaves matches alone,
|
|
12
|
+
* and (with --prune) deletes managed resources absent from the manifest.
|
|
13
|
+
* Idempotent: re-applying an unchanged manifest is all no-ops. The whole point
|
|
14
|
+
* is that a SYSTEM can declare its state in a file and reconcile it repeatedly
|
|
15
|
+
* — CI, GitOps, an agent — instead of issuing imperative one-off mutations.
|
|
16
|
+
*
|
|
17
|
+
* solid apply infra.yaml
|
|
18
|
+
* solid apply infra.yaml --dry-run # plan only, no writes
|
|
19
|
+
* solid apply infra.yaml --prune --yes # also delete unmanaged resources
|
|
20
|
+
* solid apply --kinds # list supported kinds
|
|
21
|
+
*/
|
|
22
|
+
const commander_1 = require("commander");
|
|
23
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
24
|
+
const node_fs_1 = require("node:fs");
|
|
25
|
+
const api_client_1 = require("../lib/api-client");
|
|
26
|
+
const json_output_1 = require("../lib/json-output");
|
|
27
|
+
const command_kit_1 = require("../lib/command-kit");
|
|
28
|
+
const dry_run_1 = require("../lib/dry-run");
|
|
29
|
+
const engine_1 = require("../lib/apply/engine");
|
|
30
|
+
const registry_1 = require("../lib/apply/registry");
|
|
31
|
+
const ICON = {
|
|
32
|
+
create: chalk_1.default.green('+ create'),
|
|
33
|
+
update: chalk_1.default.yellow('~ update'),
|
|
34
|
+
noop: chalk_1.default.dim('= unchanged'),
|
|
35
|
+
prune: chalk_1.default.red('- prune'),
|
|
36
|
+
unsupported: chalk_1.default.magenta('! immutable'),
|
|
37
|
+
};
|
|
38
|
+
exports.applyCommand = new commander_1.Command('apply')
|
|
39
|
+
.description('Reconcile the company to a declarative manifest (create/update/prune)')
|
|
40
|
+
.argument('[file]', 'Manifest file (YAML or JSON). Use "-" for stdin.')
|
|
41
|
+
.option('--dry-run', 'Show the plan without making any changes')
|
|
42
|
+
.option('--prune', 'Delete managed resources that are absent from the manifest')
|
|
43
|
+
.option('--yes', 'Skip the confirmation prompt (required for --prune in non-interactive use)')
|
|
44
|
+
.option('--json', 'Machine-readable plan/result')
|
|
45
|
+
.option('--kinds', 'List the resource kinds apply supports, then exit')
|
|
46
|
+
.action(async (file, options) => {
|
|
47
|
+
if (options.kinds) {
|
|
48
|
+
const kinds = (0, registry_1.knownKinds)();
|
|
49
|
+
if ((0, json_output_1.isJsonOutput)(options))
|
|
50
|
+
return void (0, json_output_1.emitJson)({ kinds });
|
|
51
|
+
console.log(chalk_1.default.bold('Supported kinds:'));
|
|
52
|
+
for (const k of kinds)
|
|
53
|
+
console.log(` ${k}`);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
(0, command_kit_1.requireCompanyContext)();
|
|
57
|
+
if (!file) {
|
|
58
|
+
console.error(chalk_1.default.red('Missing manifest file. Usage: solid apply <file> (or "-" for stdin).'));
|
|
59
|
+
process.exit(2);
|
|
60
|
+
}
|
|
61
|
+
let text;
|
|
62
|
+
try {
|
|
63
|
+
text = file === '-' ? (0, node_fs_1.readFileSync)(0, 'utf8') : (0, node_fs_1.readFileSync)(file, 'utf8');
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
console.error(chalk_1.default.red(`Cannot read manifest: ${e instanceof Error ? e.message : String(e)}`));
|
|
67
|
+
process.exit(2);
|
|
68
|
+
}
|
|
69
|
+
let resources;
|
|
70
|
+
try {
|
|
71
|
+
resources = (0, engine_1.parseManifest)(text);
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
console.error(chalk_1.default.red(`Invalid manifest: ${e instanceof Error ? e.message : String(e)}`));
|
|
75
|
+
process.exit(2);
|
|
76
|
+
}
|
|
77
|
+
if (resources.length === 0) {
|
|
78
|
+
console.error(chalk_1.default.yellow('Manifest declares no resources.'));
|
|
79
|
+
process.exit(0);
|
|
80
|
+
}
|
|
81
|
+
const dryRun = !!options.dryRun || (0, dry_run_1.isDryRun)();
|
|
82
|
+
// Group by kind so we fetch each collection's current state once.
|
|
83
|
+
const byKind = new Map();
|
|
84
|
+
for (const r of resources) {
|
|
85
|
+
const arr = byKind.get(r.kind) ?? [];
|
|
86
|
+
arr.push(r);
|
|
87
|
+
byKind.set(r.kind, arr);
|
|
88
|
+
}
|
|
89
|
+
const allActions = [];
|
|
90
|
+
const planByKind = [];
|
|
91
|
+
try {
|
|
92
|
+
for (const [kind, desired] of byKind) {
|
|
93
|
+
const recon = (0, registry_1.reconcilerFor)(kind); // parseManifest already validated
|
|
94
|
+
const resp = await api_client_1.apiClient.get(recon.list);
|
|
95
|
+
const current = (0, engine_1.extractList)(resp.data, recon);
|
|
96
|
+
const actions = (0, engine_1.planKind)(recon, desired, current, { prune: options.prune });
|
|
97
|
+
planByKind.push({ kind, actions });
|
|
98
|
+
allActions.push(...actions);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
const err = (0, api_client_1.handleApiError)(e);
|
|
103
|
+
if ((0, json_output_1.isJsonOutput)(options)) {
|
|
104
|
+
(0, json_output_1.emitJson)({ error: err.message });
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
console.error(chalk_1.default.red(`Failed to read current state: ${err.message}`));
|
|
108
|
+
process.exit(1);
|
|
109
|
+
}
|
|
110
|
+
const changes = allActions.filter((a) => a.action === 'create' || a.action === 'update' || a.action === 'prune');
|
|
111
|
+
const prunes = allActions.filter((a) => a.action === 'prune');
|
|
112
|
+
// Confirm destructive prunes before any write (unless --yes / --dry-run / --json).
|
|
113
|
+
if (!dryRun && prunes.length > 0 && !options.yes && !(0, json_output_1.isJsonOutput)(options)) {
|
|
114
|
+
const ok = await (0, command_kit_1.confirm)(`Prune ${prunes.length} resource(s)? This deletes them.`);
|
|
115
|
+
if (!ok) {
|
|
116
|
+
console.error(chalk_1.default.yellow('Aborted.'));
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (!dryRun && prunes.length > 0 && !options.yes && (0, json_output_1.isJsonOutput)(options)) {
|
|
121
|
+
(0, json_output_1.emitJson)({ error: 'Refusing to prune without --yes in non-interactive/json mode', prunes: prunes.length });
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
const results = [];
|
|
125
|
+
for (const { kind, actions } of planByKind) {
|
|
126
|
+
const recon = (0, registry_1.reconcilerFor)(kind);
|
|
127
|
+
results.push(...(await (0, engine_1.executePlan)(api_client_1.apiClient, recon, actions, dryRun)));
|
|
128
|
+
}
|
|
129
|
+
const counts = (0, engine_1.tallyResults)(results);
|
|
130
|
+
if ((0, json_output_1.isJsonOutput)(options)) {
|
|
131
|
+
return void (0, json_output_1.emitJson)({ dryRun, counts, actions: results });
|
|
132
|
+
}
|
|
133
|
+
for (const r of results) {
|
|
134
|
+
const tag = ICON[r.action] ?? r.action;
|
|
135
|
+
const suffix = r.status === 'failed' ? chalk_1.default.red(` FAILED: ${r.error}`)
|
|
136
|
+
: r.reason ? chalk_1.default.dim(` (${r.reason})`) : '';
|
|
137
|
+
console.log(` ${tag} ${chalk_1.default.cyan(r.kind)}/${r.identity}${suffix}`);
|
|
138
|
+
}
|
|
139
|
+
const verb = dryRun ? 'Plan' : 'Applied';
|
|
140
|
+
console.log(`\n${chalk_1.default.bold(verb)}: ${counts.create} to create, ${counts.update} to update, ` +
|
|
141
|
+
`${counts.noop} unchanged, ${counts.prune} to prune` +
|
|
142
|
+
(counts.failed ? chalk_1.default.red(`, ${counts.failed} failed`) : '') +
|
|
143
|
+
(counts.unsupported ? chalk_1.default.magenta(`, ${counts.unsupported} immutable`) : ''));
|
|
144
|
+
if (dryRun && changes.length > 0)
|
|
145
|
+
console.log(chalk_1.default.dim('Run without --dry-run to apply.'));
|
|
146
|
+
if (counts.failed > 0)
|
|
147
|
+
process.exit(1);
|
|
148
|
+
});
|
|
149
|
+
//# sourceMappingURL=apply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/commands/apply.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,yCAAoC;AACpC,kDAA0B;AAC1B,qCAAuC;AACvC,kDAA8D;AAC9D,oDAA4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AAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,GAAG,MAAM,EAAE,CAAC,CAAC;IACxE,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACzC,OAAO,CAAC,GAAG,CACT,KAAK,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,MAAM,eAAe,MAAM,CAAC,MAAM,cAAc;QACjF,GAAG,MAAM,CAAC,IAAI,eAAe,MAAM,CAAC,KAAK,WAAW;QACpD,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,eAAK,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,MAAM,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7D,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,eAAK,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC,WAAW,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAC/E,CAAC;IACF,IAAI,MAAM,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC,CAAC;IAC5F,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC,CAAC,CAAC"}
|
|
@@ -9,9 +9,24 @@
|
|
|
9
9
|
* internally. SIGINT stops. Good for dev / debug.
|
|
10
10
|
* solid signal watch --topic ask.any --json
|
|
11
11
|
* → each event as a JSON line (ndjson). Pipe-friendly for agents.
|
|
12
|
+
* solid signal stream --topic ask.any
|
|
13
|
+
* → hold ONE connection open; the server pushes events as they happen
|
|
14
|
+
* (SSE). ndjson when piped. Falls back to polling on older backends.
|
|
12
15
|
*
|
|
13
|
-
*
|
|
16
|
+
* `tail`/`watch` poll; `stream` is server-push (SSE) — a reactive system reads
|
|
17
|
+
* one stream instead of running its own poll loop.
|
|
14
18
|
*/
|
|
15
19
|
import { Command } from 'commander';
|
|
20
|
+
/**
|
|
21
|
+
* Drain complete SSE event blocks (`...\n\n`) from a buffer. Pure + exported
|
|
22
|
+
* so the wire parser is unit-tested without a socket. Returns the parsed event
|
|
23
|
+
* objects (only those that look like signals — i.e. carry an `id`, so the
|
|
24
|
+
* `ready` prelude and `: keepalive` heartbeats are skipped) and the leftover
|
|
25
|
+
* partial block to carry into the next chunk.
|
|
26
|
+
*/
|
|
27
|
+
export declare function drainSSE(buffer: string): {
|
|
28
|
+
events: Array<Record<string, unknown>>;
|
|
29
|
+
rest: string;
|
|
30
|
+
};
|
|
16
31
|
export declare const signalCommand: Command;
|
|
17
32
|
//# sourceMappingURL=signal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../src/commands/signal.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../src/commands/signal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuCpC;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAqBjG;AA6CD,eAAO,MAAM,aAAa,SACuD,CAAC"}
|
package/dist/commands/signal.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.signalCommand = void 0;
|
|
7
|
+
exports.drainSSE = drainSSE;
|
|
7
8
|
/**
|
|
8
9
|
* `solid signal` — agent-facing event stream.
|
|
9
10
|
*
|
|
@@ -15,8 +16,12 @@ exports.signalCommand = void 0;
|
|
|
15
16
|
* internally. SIGINT stops. Good for dev / debug.
|
|
16
17
|
* solid signal watch --topic ask.any --json
|
|
17
18
|
* → each event as a JSON line (ndjson). Pipe-friendly for agents.
|
|
19
|
+
* solid signal stream --topic ask.any
|
|
20
|
+
* → hold ONE connection open; the server pushes events as they happen
|
|
21
|
+
* (SSE). ndjson when piped. Falls back to polling on older backends.
|
|
18
22
|
*
|
|
19
|
-
*
|
|
23
|
+
* `tail`/`watch` poll; `stream` is server-push (SSE) — a reactive system reads
|
|
24
|
+
* one stream instead of running its own poll loop.
|
|
20
25
|
*/
|
|
21
26
|
const commander_1 = require("commander");
|
|
22
27
|
const chalk_1 = __importDefault(require("chalk"));
|
|
@@ -38,6 +43,80 @@ function _printEvent(e) {
|
|
|
38
43
|
if (e.resource_id)
|
|
39
44
|
console.log(` ${chalk_1.default.dim('resource:')} ${e.resource_type}/${e.resource_id}`);
|
|
40
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Drain complete SSE event blocks (`...\n\n`) from a buffer. Pure + exported
|
|
48
|
+
* so the wire parser is unit-tested without a socket. Returns the parsed event
|
|
49
|
+
* objects (only those that look like signals — i.e. carry an `id`, so the
|
|
50
|
+
* `ready` prelude and `: keepalive` heartbeats are skipped) and the leftover
|
|
51
|
+
* partial block to carry into the next chunk.
|
|
52
|
+
*/
|
|
53
|
+
function drainSSE(buffer) {
|
|
54
|
+
const events = [];
|
|
55
|
+
let rest = buffer;
|
|
56
|
+
let idx;
|
|
57
|
+
while ((idx = rest.indexOf('\n\n')) !== -1) {
|
|
58
|
+
const block = rest.slice(0, idx);
|
|
59
|
+
rest = rest.slice(idx + 2);
|
|
60
|
+
const data = block
|
|
61
|
+
.split('\n')
|
|
62
|
+
.filter((l) => l.startsWith('data:'))
|
|
63
|
+
.map((l) => l.slice(5).trim())
|
|
64
|
+
.join('\n');
|
|
65
|
+
if (!data)
|
|
66
|
+
continue; // comment / heartbeat / event-line only
|
|
67
|
+
try {
|
|
68
|
+
const obj = JSON.parse(data);
|
|
69
|
+
if (obj && typeof obj === 'object' && 'id' in obj)
|
|
70
|
+
events.push(obj);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
// ignore malformed frame — never let one bad line kill the stream
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return { events, rest };
|
|
77
|
+
}
|
|
78
|
+
function consumeSSE(stream, onEvent) {
|
|
79
|
+
return new Promise((resolve, reject) => {
|
|
80
|
+
let buf = '';
|
|
81
|
+
stream.on('data', (chunk) => {
|
|
82
|
+
buf += chunk.toString();
|
|
83
|
+
const { events, rest } = drainSSE(buf);
|
|
84
|
+
buf = rest;
|
|
85
|
+
for (const ev of events)
|
|
86
|
+
onEvent(ev);
|
|
87
|
+
});
|
|
88
|
+
stream.on('end', () => resolve());
|
|
89
|
+
stream.on('error', reject);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/** Long-running poll loop over /signal/tail. Shared by `watch` and by `stream`'s
|
|
93
|
+
* fallback when the backend has no SSE endpoint. Runs until the process is killed. */
|
|
94
|
+
async function pollLoop(opts) {
|
|
95
|
+
const intervalMs = Math.max(2, parseInt(opts.interval, 10) || 10) * 1000;
|
|
96
|
+
let cursor = opts.since ? parseInt(opts.since, 10) : null;
|
|
97
|
+
while (true) {
|
|
98
|
+
try {
|
|
99
|
+
const qs = new URLSearchParams({ topic: opts.topic, limit: String(opts.limit) });
|
|
100
|
+
if (cursor !== null)
|
|
101
|
+
qs.set('since_id', String(cursor));
|
|
102
|
+
const res = await api_client_1.apiClient.get(`/api/v1/signal/tail?${qs.toString()}`);
|
|
103
|
+
cursor = res.data.next_cursor;
|
|
104
|
+
if (opts.json) {
|
|
105
|
+
for (const ev of res.data.events)
|
|
106
|
+
process.stdout.write(JSON.stringify(ev) + '\n');
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
res.data.events.forEach(_printEvent);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch (e) {
|
|
113
|
+
const msg = (0, api_client_1.handleApiError)(e).message;
|
|
114
|
+
if (!opts.json)
|
|
115
|
+
console.error(chalk_1.default.dim(` (poll error: ${msg})`));
|
|
116
|
+
}
|
|
117
|
+
await sleep(intervalMs);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
41
120
|
exports.signalCommand = new commander_1.Command('signal')
|
|
42
121
|
.description('Agent-facing event stream — sense what happened on this company');
|
|
43
122
|
exports.signalCommand
|
|
@@ -104,36 +183,56 @@ exports.signalCommand
|
|
|
104
183
|
.option('--json', 'Emit ndjson (one JSON object per line)')
|
|
105
184
|
.action(async (opts) => {
|
|
106
185
|
requireAuth();
|
|
107
|
-
const intervalMs = Math.max(2, parseInt(opts.interval, 10) || 10) * 1000;
|
|
108
|
-
let cursor = null;
|
|
109
186
|
if (!opts.json) {
|
|
110
187
|
console.error(chalk_1.default.dim(` watching ${opts.topic} every ${opts.interval}s (Ctrl+C to stop)`));
|
|
111
188
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
189
|
+
await pollLoop({ topic: opts.topic, limit: String(opts.limit), interval: String(opts.interval), json: !!opts.json });
|
|
190
|
+
});
|
|
191
|
+
exports.signalCommand
|
|
192
|
+
.command('stream')
|
|
193
|
+
.description('Hold one connection open and receive events as the server PUSHES them (SSE)')
|
|
194
|
+
.option('--topic <topic>', 'Topic to stream', 'agent.any')
|
|
195
|
+
.option('--since <id>', 'Start after this event id', '')
|
|
196
|
+
.option('--json', 'Emit ndjson (one JSON object per line) — the default when piped')
|
|
197
|
+
.option('--no-fallback', 'Fail instead of falling back to polling on an older backend')
|
|
198
|
+
.action(async (opts) => {
|
|
199
|
+
requireAuth();
|
|
200
|
+
// ndjson by default for non-TTY consumers (agents, pipes); pretty on a TTY.
|
|
201
|
+
const asJson = !!opts.json || !process.stdout.isTTY;
|
|
202
|
+
const qs = new URLSearchParams({ topic: opts.topic });
|
|
203
|
+
if (opts.since)
|
|
204
|
+
qs.set('since_id', String(opts.since));
|
|
205
|
+
let stream;
|
|
206
|
+
try {
|
|
207
|
+
const res = await api_client_1.apiClient.get(`/api/v1/signal/stream?${qs.toString()}`, { responseType: 'stream' });
|
|
208
|
+
stream = res.data;
|
|
209
|
+
}
|
|
210
|
+
catch (e) {
|
|
211
|
+
const err = (0, api_client_1.handleApiError)(e);
|
|
212
|
+
// Graceful degradation: a backend without the SSE endpoint (404) still
|
|
213
|
+
// serves /signal/tail, so fall back to polling unless --no-fallback.
|
|
214
|
+
if (err.status === 404 && opts.fallback !== false) {
|
|
215
|
+
if (!asJson)
|
|
216
|
+
console.error(chalk_1.default.dim(' server has no push endpoint — falling back to polling'));
|
|
217
|
+
await pollLoop({ topic: opts.topic, limit: '100', interval: '5', json: asJson, since: opts.since || undefined });
|
|
218
|
+
return;
|
|
135
219
|
}
|
|
136
|
-
|
|
220
|
+
console.error(chalk_1.default.red(err.message));
|
|
221
|
+
process.exit(1);
|
|
222
|
+
}
|
|
223
|
+
if (!asJson)
|
|
224
|
+
console.error(chalk_1.default.dim(` streaming ${opts.topic} — server-pushed (Ctrl+C to stop)`));
|
|
225
|
+
try {
|
|
226
|
+
await consumeSSE(stream, (ev) => {
|
|
227
|
+
if (asJson)
|
|
228
|
+
process.stdout.write(JSON.stringify(ev) + '\n');
|
|
229
|
+
else
|
|
230
|
+
_printEvent(ev);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
catch (e) {
|
|
234
|
+
console.error(chalk_1.default.red(` stream error: ${e instanceof Error ? e.message : String(e)}`));
|
|
235
|
+
process.exit(1);
|
|
137
236
|
}
|
|
138
237
|
});
|
|
139
238
|
//# sourceMappingURL=signal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal.js","sourceRoot":"","sources":["../../src/commands/signal.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"signal.js","sourceRoot":"","sources":["../../src/commands/signal.ts"],"names":[],"mappings":";;;;;;AAgEA,4BAqBC;AArFD;;;;;;;;;;;;;;;;;GAiBG;AACH,yCAAoC;AACpC,kDAA0B;AAC1B,kDAA8D;AAC9D,0CAAuC;AAEvC,SAAS,WAAW;IAClB,IAAI,CAAC,eAAM,CAAC,UAAU,EAAE,EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC,CAAC;QACjE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/C,CAAC;AAkBD,SAAS,WAAW,CAAC,CAAiC;IACpD,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9C,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,KAAK,eAAK,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,eAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,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AK,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,CAAC,MAAM;QAAE,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,eAAe,IAAI,CAAC,KAAK,mCAAmC,CAAC,CAAC,CAAC;IACpG,IAAI,CAAC;QACH,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE;YAC9B,IAAI,MAAM;gBAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;;gBACvD,WAAW,CAAC,EAAE,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,mBAAmB,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -141,6 +141,7 @@ const insights_1 = require("./commands/insights");
|
|
|
141
141
|
const llms_1 = require("./commands/llms");
|
|
142
142
|
const accounting_1 = require("./commands/accounting");
|
|
143
143
|
const webhooks_1 = require("./commands/webhooks");
|
|
144
|
+
const apply_1 = require("./commands/apply");
|
|
144
145
|
const support_1 = require("./commands/support");
|
|
145
146
|
const export_1 = require("./commands/export");
|
|
146
147
|
const billing_1 = require("./commands/billing");
|
|
@@ -193,11 +194,22 @@ const mcp_1 = require("./commands/mcp");
|
|
|
193
194
|
const doctor_1 = require("./commands/doctor");
|
|
194
195
|
const graph_1 = require("./commands/graph");
|
|
195
196
|
const ui_1 = require("./lib/ui");
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
197
|
+
const esm_import_1 = require("./lib/esm-import");
|
|
198
|
+
// Check for updates (non-blocking, best-effort). update-notifier v7 is
|
|
199
|
+
// ESM-only, so load it through importESM (see lib/esm-import) rather than a
|
|
200
|
+
// static import that tsc would lower to require() — that throws
|
|
201
|
+
// ERR_REQUIRE_ESM on Node < 20.19 and would crash every command at startup.
|
|
202
|
+
void (async () => {
|
|
203
|
+
try {
|
|
204
|
+
const { default: updateNotifier } = await (0, esm_import_1.importESM)('update-notifier');
|
|
205
|
+
updateNotifier({ pkg, updateCheckInterval: 1000 * 60 * 60 * 4 }).notify({
|
|
206
|
+
message: `Update available: {currentVersion} → {latestVersion}\nRun {updateCommand} to update`,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
// Update check is non-essential — never let it break the CLI.
|
|
211
|
+
}
|
|
212
|
+
})();
|
|
201
213
|
const program = new commander_1.Command();
|
|
202
214
|
// Implicit-tenant warning (see note near the top of this file). preAction
|
|
203
215
|
// runs only for a matched command action, so this never races ahead of an
|
|
@@ -539,6 +551,7 @@ program.addCommand(insights_1.insightsCommand);
|
|
|
539
551
|
// Integrations & Operations
|
|
540
552
|
program.addCommand(accounting_1.accountingCommand);
|
|
541
553
|
program.addCommand(webhooks_1.webhooksCommand);
|
|
554
|
+
program.addCommand(apply_1.applyCommand);
|
|
542
555
|
program.addCommand(support_1.supportCommand);
|
|
543
556
|
program.addCommand(export_1.exportCommand);
|
|
544
557
|
program.addCommand(billing_1.billingCommand);
|