@general-input/cli 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.js +463 -46
- package/dist/cli.js.map +1 -1
- package/package.json +7 -5
package/dist/cli.js
CHANGED
|
@@ -2217,17 +2217,17 @@ var require_cipherModes = __commonJS({
|
|
|
2217
2217
|
}
|
|
2218
2218
|
};
|
|
2219
2219
|
modes.gcm.prototype.tableMultiply = function(x) {
|
|
2220
|
-
var
|
|
2220
|
+
var z12 = [0, 0, 0, 0];
|
|
2221
2221
|
for (var i = 0; i < 32; ++i) {
|
|
2222
2222
|
var idx = i / 8 | 0;
|
|
2223
2223
|
var x_i = x[idx] >>> (7 - i % 8) * 4 & 15;
|
|
2224
2224
|
var ah = this._m[i][x_i];
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2225
|
+
z12[0] ^= ah[0];
|
|
2226
|
+
z12[1] ^= ah[1];
|
|
2227
|
+
z12[2] ^= ah[2];
|
|
2228
|
+
z12[3] ^= ah[3];
|
|
2229
2229
|
}
|
|
2230
|
-
return
|
|
2230
|
+
return z12;
|
|
2231
2231
|
};
|
|
2232
2232
|
modes.gcm.prototype.ghash = function(h, y, x) {
|
|
2233
2233
|
y[0] ^= x[0];
|
|
@@ -5972,26 +5972,26 @@ var require_jsbn = __commonJS({
|
|
|
5972
5972
|
function bnpIsEven() {
|
|
5973
5973
|
return (this.t > 0 ? this.data[0] & 1 : this.s) == 0;
|
|
5974
5974
|
}
|
|
5975
|
-
function bnpExp(e,
|
|
5975
|
+
function bnpExp(e, z12) {
|
|
5976
5976
|
if (e > 4294967295 || e < 1) return BigInteger.ONE;
|
|
5977
|
-
var r = nbi(), r2 = nbi(), g =
|
|
5977
|
+
var r = nbi(), r2 = nbi(), g = z12.convert(this), i = nbits(e) - 1;
|
|
5978
5978
|
g.copyTo(r);
|
|
5979
5979
|
while (--i >= 0) {
|
|
5980
|
-
|
|
5981
|
-
if ((e & 1 << i) > 0)
|
|
5980
|
+
z12.sqrTo(r, r2);
|
|
5981
|
+
if ((e & 1 << i) > 0) z12.mulTo(r2, g, r);
|
|
5982
5982
|
else {
|
|
5983
5983
|
var t = r;
|
|
5984
5984
|
r = r2;
|
|
5985
5985
|
r2 = t;
|
|
5986
5986
|
}
|
|
5987
5987
|
}
|
|
5988
|
-
return
|
|
5988
|
+
return z12.revert(r);
|
|
5989
5989
|
}
|
|
5990
5990
|
function bnModPowInt(e, m) {
|
|
5991
|
-
var
|
|
5992
|
-
if (e < 256 || m.isEven())
|
|
5993
|
-
else
|
|
5994
|
-
return this.exp(e,
|
|
5991
|
+
var z12;
|
|
5992
|
+
if (e < 256 || m.isEven()) z12 = new Classic(m);
|
|
5993
|
+
else z12 = new Montgomery(m);
|
|
5994
|
+
return this.exp(e, z12);
|
|
5995
5995
|
}
|
|
5996
5996
|
BigInteger.prototype.copyTo = bnpCopyTo;
|
|
5997
5997
|
BigInteger.prototype.fromInt = bnpFromInt;
|
|
@@ -6049,13 +6049,13 @@ var require_jsbn = __commonJS({
|
|
|
6049
6049
|
if (this.signum() == 0 || b < 2 || b > 36) return "0";
|
|
6050
6050
|
var cs = this.chunkSize(b);
|
|
6051
6051
|
var a = Math.pow(b, cs);
|
|
6052
|
-
var d = nbv(a), y = nbi(),
|
|
6053
|
-
this.divRemTo(d, y,
|
|
6052
|
+
var d = nbv(a), y = nbi(), z12 = nbi(), r = "";
|
|
6053
|
+
this.divRemTo(d, y, z12);
|
|
6054
6054
|
while (y.signum() > 0) {
|
|
6055
|
-
r = (a +
|
|
6056
|
-
y.divRemTo(d, y,
|
|
6055
|
+
r = (a + z12.intValue()).toString(b).substr(1) + r;
|
|
6056
|
+
y.divRemTo(d, y, z12);
|
|
6057
6057
|
}
|
|
6058
|
-
return
|
|
6058
|
+
return z12.intValue().toString(b) + r;
|
|
6059
6059
|
}
|
|
6060
6060
|
function bnpFromRadix(s, b) {
|
|
6061
6061
|
this.fromInt(0);
|
|
@@ -6428,7 +6428,7 @@ var require_jsbn = __commonJS({
|
|
|
6428
6428
|
Barrett.prototype.mulTo = barrettMulTo;
|
|
6429
6429
|
Barrett.prototype.sqrTo = barrettSqrTo;
|
|
6430
6430
|
function bnModPow(e, m) {
|
|
6431
|
-
var i = e.bitLength(), k, r = nbv(1),
|
|
6431
|
+
var i = e.bitLength(), k, r = nbv(1), z12;
|
|
6432
6432
|
if (i <= 0) return r;
|
|
6433
6433
|
else if (i < 18) k = 1;
|
|
6434
6434
|
else if (i < 48) k = 3;
|
|
@@ -6436,19 +6436,19 @@ var require_jsbn = __commonJS({
|
|
|
6436
6436
|
else if (i < 768) k = 5;
|
|
6437
6437
|
else k = 6;
|
|
6438
6438
|
if (i < 8)
|
|
6439
|
-
|
|
6439
|
+
z12 = new Classic(m);
|
|
6440
6440
|
else if (m.isEven())
|
|
6441
|
-
|
|
6441
|
+
z12 = new Barrett(m);
|
|
6442
6442
|
else
|
|
6443
|
-
|
|
6443
|
+
z12 = new Montgomery(m);
|
|
6444
6444
|
var g = new Array(), n = 3, k1 = k - 1, km = (1 << k) - 1;
|
|
6445
|
-
g[1] =
|
|
6445
|
+
g[1] = z12.convert(this);
|
|
6446
6446
|
if (k > 1) {
|
|
6447
6447
|
var g2 = nbi();
|
|
6448
|
-
|
|
6448
|
+
z12.sqrTo(g[1], g2);
|
|
6449
6449
|
while (n <= km) {
|
|
6450
6450
|
g[n] = nbi();
|
|
6451
|
-
|
|
6451
|
+
z12.mulTo(g2, g[n - 2], g[n]);
|
|
6452
6452
|
n += 2;
|
|
6453
6453
|
}
|
|
6454
6454
|
}
|
|
@@ -6474,20 +6474,20 @@ var require_jsbn = __commonJS({
|
|
|
6474
6474
|
is1 = false;
|
|
6475
6475
|
} else {
|
|
6476
6476
|
while (n > 1) {
|
|
6477
|
-
|
|
6478
|
-
|
|
6477
|
+
z12.sqrTo(r, r2);
|
|
6478
|
+
z12.sqrTo(r2, r);
|
|
6479
6479
|
n -= 2;
|
|
6480
6480
|
}
|
|
6481
|
-
if (n > 0)
|
|
6481
|
+
if (n > 0) z12.sqrTo(r, r2);
|
|
6482
6482
|
else {
|
|
6483
6483
|
t = r;
|
|
6484
6484
|
r = r2;
|
|
6485
6485
|
r2 = t;
|
|
6486
6486
|
}
|
|
6487
|
-
|
|
6487
|
+
z12.mulTo(r2, g[w], r);
|
|
6488
6488
|
}
|
|
6489
6489
|
while (j >= 0 && (e.data[j] & 1 << i) == 0) {
|
|
6490
|
-
|
|
6490
|
+
z12.sqrTo(r, r2);
|
|
6491
6491
|
t = r;
|
|
6492
6492
|
r = r2;
|
|
6493
6493
|
r2 = t;
|
|
@@ -6497,7 +6497,7 @@ var require_jsbn = __commonJS({
|
|
|
6497
6497
|
}
|
|
6498
6498
|
}
|
|
6499
6499
|
}
|
|
6500
|
-
return
|
|
6500
|
+
return z12.revert(r);
|
|
6501
6501
|
}
|
|
6502
6502
|
function bnGCD(a) {
|
|
6503
6503
|
var x = this.s < 0 ? this.negate() : this.clone();
|
|
@@ -18288,7 +18288,7 @@ import chalk4 from "chalk";
|
|
|
18288
18288
|
// package.json
|
|
18289
18289
|
var package_default = {
|
|
18290
18290
|
name: "@general-input/cli",
|
|
18291
|
-
version: "0.
|
|
18291
|
+
version: "0.10.0",
|
|
18292
18292
|
type: "module",
|
|
18293
18293
|
description: "The agent-facing CLI for General Input. Authenticate, manage workflows, run bash with operator credentials injected by the cloud.",
|
|
18294
18294
|
license: "SEE LICENSE IN LICENSE",
|
|
@@ -18332,6 +18332,7 @@ var package_default = {
|
|
|
18332
18332
|
"@clack/prompts": "^0.7.0",
|
|
18333
18333
|
chalk: "^5.3.0",
|
|
18334
18334
|
commander: "^12.1.0",
|
|
18335
|
+
semver: "^7.8.0",
|
|
18335
18336
|
tar: "^7.4.3",
|
|
18336
18337
|
zod: "^4.3.6"
|
|
18337
18338
|
},
|
|
@@ -18343,6 +18344,7 @@ var package_default = {
|
|
|
18343
18344
|
"@packages/eslint-config": "workspace:*",
|
|
18344
18345
|
"@packages/typescript-config": "workspace:*",
|
|
18345
18346
|
"@types/node": "^24.12.2",
|
|
18347
|
+
"@types/semver": "^7.7.1",
|
|
18346
18348
|
"@types/tar": "^6.1.13",
|
|
18347
18349
|
eslint: "^9.39.4",
|
|
18348
18350
|
tsup: "^8.3.5",
|
|
@@ -19321,6 +19323,32 @@ var CrmService = class {
|
|
|
19321
19323
|
async deleteCompanies(ids) {
|
|
19322
19324
|
return (await this.crm()).deleteCompanies(ids);
|
|
19323
19325
|
}
|
|
19326
|
+
// ── Sequences (reads + draft CRUD; queueing is dashboard-only) ─────
|
|
19327
|
+
async listSequences(args) {
|
|
19328
|
+
return (await this.crm()).listSequences(args);
|
|
19329
|
+
}
|
|
19330
|
+
async listPersonSequences(personId) {
|
|
19331
|
+
return (await this.crm()).listPersonSequences(personId);
|
|
19332
|
+
}
|
|
19333
|
+
async getSequence(id) {
|
|
19334
|
+
return (await this.crm()).getSequence(id);
|
|
19335
|
+
}
|
|
19336
|
+
async createSequence(personId, body) {
|
|
19337
|
+
return (await this.crm()).createSequence(personId, body);
|
|
19338
|
+
}
|
|
19339
|
+
async updateSequence(id, body) {
|
|
19340
|
+
return (await this.crm()).updateSequence(id, body);
|
|
19341
|
+
}
|
|
19342
|
+
async deleteSequence(id) {
|
|
19343
|
+
await (await this.crm()).deleteSequence(id);
|
|
19344
|
+
}
|
|
19345
|
+
// ── Skills (read-only) ─────────────────────────────────────────────
|
|
19346
|
+
async listSkills() {
|
|
19347
|
+
return (await this.crm()).listSkills();
|
|
19348
|
+
}
|
|
19349
|
+
async getSkill(id) {
|
|
19350
|
+
return (await this.crm()).getSkill(id);
|
|
19351
|
+
}
|
|
19324
19352
|
// ── Employments / contact points ───────────────────────────────────
|
|
19325
19353
|
async addEmployment(personId, body) {
|
|
19326
19354
|
return (await this.crm()).addEmployment(personId, body);
|
|
@@ -19982,6 +20010,54 @@ var CrmApiClient = class {
|
|
|
19982
20010
|
body: { ids }
|
|
19983
20011
|
});
|
|
19984
20012
|
}
|
|
20013
|
+
// ── Sequences (reads + draft CRUD — queueing is dashboard-only) ─────
|
|
20014
|
+
async listSequences(args) {
|
|
20015
|
+
this.http.requireAuthed();
|
|
20016
|
+
const params = new URLSearchParams();
|
|
20017
|
+
if (args.status) params.set("status", args.status);
|
|
20018
|
+
if (args.query) params.set("q", args.query);
|
|
20019
|
+
const queryString = params.toString();
|
|
20020
|
+
return this.http.fetch(
|
|
20021
|
+
`${CRM}/sequences${queryString ? `?${queryString}` : ""}`
|
|
20022
|
+
);
|
|
20023
|
+
}
|
|
20024
|
+
async listPersonSequences(personId) {
|
|
20025
|
+
this.http.requireAuthed();
|
|
20026
|
+
return this.http.fetch(`${CRM}/sequences/people/${enc(personId)}`);
|
|
20027
|
+
}
|
|
20028
|
+
async getSequence(sequenceId) {
|
|
20029
|
+
this.http.requireAuthed();
|
|
20030
|
+
return this.http.fetch(`${CRM}/sequences/${enc(sequenceId)}`);
|
|
20031
|
+
}
|
|
20032
|
+
async createSequence(personId, body) {
|
|
20033
|
+
this.http.requireAuthed();
|
|
20034
|
+
return this.http.fetch(`${CRM}/sequences/people/${enc(personId)}`, {
|
|
20035
|
+
method: "POST",
|
|
20036
|
+
body
|
|
20037
|
+
});
|
|
20038
|
+
}
|
|
20039
|
+
async updateSequence(sequenceId, body) {
|
|
20040
|
+
this.http.requireAuthed();
|
|
20041
|
+
return this.http.fetch(`${CRM}/sequences/${enc(sequenceId)}`, {
|
|
20042
|
+
method: "PUT",
|
|
20043
|
+
body
|
|
20044
|
+
});
|
|
20045
|
+
}
|
|
20046
|
+
async deleteSequence(sequenceId) {
|
|
20047
|
+
this.http.requireAuthed();
|
|
20048
|
+
await this.http.fetch(`${CRM}/sequences/${enc(sequenceId)}`, {
|
|
20049
|
+
method: "DELETE"
|
|
20050
|
+
});
|
|
20051
|
+
}
|
|
20052
|
+
// ── Skills (read-only) ─────────────────────────────────────────────
|
|
20053
|
+
async listSkills() {
|
|
20054
|
+
this.http.requireAuthed();
|
|
20055
|
+
return this.http.fetch(`${CRM}/skills`);
|
|
20056
|
+
}
|
|
20057
|
+
async getSkill(skillId) {
|
|
20058
|
+
this.http.requireAuthed();
|
|
20059
|
+
return this.http.fetch(`${CRM}/skills/${enc(skillId)}`);
|
|
20060
|
+
}
|
|
19985
20061
|
// ── Employments (person sub-records) ───────────────────────────────
|
|
19986
20062
|
async addEmployment(personId, body) {
|
|
19987
20063
|
this.http.requireAuthed();
|
|
@@ -23490,7 +23566,7 @@ import {
|
|
|
23490
23566
|
var geni_default = "---\nname: geni\ndescription: Use the operator's connected services (Slack, Gmail, GitHub, Stripe, anything they've authorized in General Input) to fulfill their request, or build them a saved workflow (scheduled or event-driven automation). Load this whenever the user wants you to take an action on their behalf against an external SaaS account, fetch data from one of their tools, wire something up that crosses service boundaries, or set up a recurring/triggered automation.\n---\n\n# geni\n\n`geni` is a CLI that gives you credentialed access to the operator's\nconnected accounts. The cloud injects their tokens into a fresh bash\nsubprocess as env vars; you write the `curl`, you never see the\nsecret. Run `geni --help` for the full command surface.\n\n## How to talk about geni\n\nTreat geni as a teammate \u2014 the integration specialist who picks the\nright operation and runs the credentialed call. You're the one\nsynthesizing and replying.\n\nIn summaries of multi-step work, credit geni naturally: \"Geni pulled\nthe last 30 days of charges from Stripe; I rolled them into the report\nbelow.\" Skip the credit on trivial single calls; don't manufacture\nteam language (\"with geni's help\u2026\") to fill space. Lowercase `geni`\nin commands; capitalize \"Geni\" when personifying.\n\n## Request flow\n\nDiscovery first. Don't guess URLs, params, or env var names \u2014 the\noperation docs have them.\n\n1. `geni credential list [--service <slug>]` \u2014 find a connected\n credential id. If nothing's connected for the service, run\n `geni integration list -q \"<keyword>\"` to confirm the slug, then\n `geni credential connect <service>` (see \"Connecting a missing\n credential\" below).\n2. `geni integration operations <service> [-q \"<keyword>\"]` \u2014 find\n the operation you need.\n3. `geni integration operation <id> --format markdown` \u2014 read the\n HTTP shape, params, and **exact env var names** this call will set.\n4. `geni exec bash --cred <cred_id> --reason \"<what + why>\" -- '<curl>'`\n\n## Connecting a missing credential\n\n`geni credential connect <service>` opens the integration's\ndashboard page in the operator's browser. Tell the operator to\nfinish the connection there and come back \u2014 then re-run `geni\ncredential list --service <service>` to pick up the new id. Don't\npoll, don't loop. In non-interactive shells, add `--print-url` so\nthe URL prints to stdout instead.\n\n## Env vars\n\nRead the names off the operation docs; never derive them. Two flavors\nemitted per credential:\n\n- **Suffixed**: `<SERVICE>_<FIELD>_<id>` (e.g. `$SLACK_BOT_TOKEN_ABC`,\n `$SALESFORCE_INSTANCE_URL_KG`). The `<id>` is the credential id with\n `cred_` stripped, uppercased. Use these when fanning out across\n multiple credentials of the same service in one call.\n- **Canonical aliases**: well-known SDK names (`$GH_TOKEN`,\n `$SLACK_BOT_TOKEN`, `$OPENAI_API_KEY`, `$STRIPE_API_KEY`, \u2026) for\n tools that hardcode them.\n\nPlus `$PLATFORM_API_KEY` and `$PLATFORM_BASE_URL` on every exec \u2014 use\nthem to call General Input's first-party services (web search, image\ngen, weather, send-email) without `--cred`.\n\n## --reason is per-call\n\nEvery `geni exec bash --cred ...` requires `--reason`. It lands in\nthe operator's audit log and is shown to them. Be specific\n(\"Posting daily digest to #engineering\"), not generic (\"Slack call\").\nRe-state it on every call \u2014 the log is per-call, not per-session.\n\n## Output is scrubbed\n\nstdout and stderr pass through a streaming scrubber that replaces\nevery registered secret with `[REDACTED:credential_<id>]`. Don't try\nto exfiltrate via `echo $TOKEN | base64`; common encodings are\ncaught too. You don't need to see the secret to use it \u2014 the\nsubprocess can.\n\n## Building resources (workflows and apps)\n\n`geni exec bash` is for one-off actions. When the user wants something\nsaved and reusable, build a **resource**. A resource is one of three\ntypes: a `code` **workflow** (deterministic, fixed steps, runs on a\nschedule or trigger), an `agent` **workflow** (LLM-driven, variable-length\ntasks like research or triage), or an `app` (an interactive React mini-app\nwith server-side handlers, like a dashboard or internal tool). An app is\nnot a workflow, so the shared lifecycle lives under `geni resource` and\nthe type-specific tools under `geni workflow` and `geni app`.\n\nYou author the files locally with your own editor; the cloud validates,\nconfigures, publishes, and runs them. This is the same build loop as the\ngeni chat, just on the user's machine with your brain driving it. Same\nloop for all three types; apps add a build step and handler tools (see\n\"Building apps\" below).\n\n**Read the spec first.** `geni resource spec code` (or `agent`) prints\nthe full contract: required files, the runtime API, allowed and\nforbidden patterns. Don't write a single file before reading it.\n\nThe loop:\n\n1. `geni resource create --type code --name \"Daily Digest\"`: creates the\n resource in the cloud and scaffolds its files into the current\n directory, with a `.geni-resource.json` marker so later commands here\n resolve the id automatically.\n2. Edit the files (`workflow.json`, `main.ts`, `package.json`) with your\n normal Read/Write/Edit tools. **Don't run `npm install`, `tsc`, or\n `bun` locally**: `@general-input/core` only resolves server-side, so\n a local compile always fails on the missing module. That's not a real\n error.\n3. `geni resource validate`: server-side spec + wiring + TypeScript\n check. Exit 9 means invalid; fix what it reports and re-run. A green\n validate is the compile gate.\n4. `geni resource config set`: wire what the workflow needs. Find\n credential ids with `geni credential list`; set them with\n `--cred <service>=<credentialId>`. Set consts with `--const k=v`,\n schedules with `--schedule <triggerId>=<cron>`. `geni resource config\nget` shows the current state. Find trigger providers with\n `geni trigger list`.\n5. `geni resource publish --summary \"<one plain sentence>\"`: promote\n your local files to the live version. Required before a test reflects\n your latest edits.\n6. `geni workflow test --payload '{...}'`: run a real cloud test\n execution and wait for the result, output, and logs. Iterate from\n step 2 until it does what the user asked.\n\nWhen a run misbehaves, `geni workflow execution <id> --download` writes\nits full trace to `executions/<id>/` (run.json, logs.txt, input.json, and\nthread.json). For an agent workflow, read `thread.json` to see every step\nthe agent took. Use `--thread` or `--input` to print those inline instead.\n\nUse the same discovery tools as exec: `geni integration operations\n<service>` and `geni integration operation <id>` to learn an API's shape\nbefore you write the `fetch` call in `main.ts`.\n\nFor a poll-triggered workflow, `geni workflow trigger-sample` returns\nlive sample records so you see the exact shape `input` receives before\nwriting `main.ts` (wire the trigger's credential and inputs with\n`config set` first). To test a file-type input, `geni workflow\nstage-input <file>` uploads a local file and prints a `store://` URI to\npass as that field's value in `--payload`.\n\n## Building apps\n\nAn `app` workflow is a React SPA (rendered in the dashboard's iframe)\nthat calls server-side handlers. Create it with `geni resource create\n--type app`; read the contract with `geni resource spec app`. The shared\ncommands work the same (validate, config set for credential slots,\npublish), with these differences:\n\n- The scaffold is a whole Vite project. Edit only `app.json`, `src/App.tsx`,\n `src/pages/*`, your own `src/components/*`, and `handlers/*.ts`. Leave\n the platform-owned files alone.\n- `geni resource publish` builds the app; the result's `build` reports\n whether the Vite build passed. You can't preview the UI from the CLI,\n so drive correctness through handlers and the build.\n- `geni app run-handler <name> --input '{...}'` runs a handler\n against the live app (publish first). `geni app invocations`\n shows recent handler runs, `geni app errors` shows browser\n errors the iframe reported, `geni app build-status` shows the\n build, and `geni app clear-cache` flushes the handler cache.\n\nThe loop: create --type app -> edit handlers + pages -> validate ->\nconfig set (wire credential slots) -> publish (builds) -> app run-handler\nto verify -> tell the user to open it in their dashboard.\n\nWhen it works, tell the user it's in their dashboard, where they can see\nruns and turn its triggers on. Commands accept the workflow id as a\npositional or infer it from the marker in the current directory.\n\n## Exit codes worth knowing\n\n- `0` \u2014 success; `1\u2013125` \u2014 subprocess's own exit (curl, jq, etc.)\n- `4` \u2014 resource not found (bad cred id, slug, operation id)\n- `77` \u2014 server refused to resolve a credential. Don't retry; surface\n to the operator.\n- `78` \u2014 session expired. Tell the operator to run `geni login`.\n\n## Don't\n\n- Don't construct a curl without reading the operation docs first.\n Guessing at URLs and env var names is the most common failure mode.\n- Don't hand-write workflow files before reading `geni resource spec\n<type>`. Don't try to compile or `npm install` them locally; let\n `geni resource validate` be the gate.\n- Use `--json` on list/get commands when you're going to parse the\n output. Table output is for humans.\n";
|
|
23491
23567
|
|
|
23492
23568
|
// src/skills/geni-crm.md
|
|
23493
|
-
var geni_crm_default = '---\nname: geni-crm\ndescription: Read and write the operator\'s General Input CRM from the command line. Load this whenever the user wants you to look something up in their CRM, pull a list of people or companies, check a deal pipeline, find or verify someone\'s email or phone (enrichment), OR change CRM data (create or update people/companies, manage lists and tags, add notes, create and resolve tasks, move deals through stages, log touchpoints). Full read/write access to people, companies, pipelines, deals, lists, tags, notes, tasks, enrichment, and
|
|
23569
|
+
var geni_crm_default = '---\nname: geni-crm\ndescription: Read and write the operator\'s General Input CRM from the command line. Load this whenever the user wants you to look something up in their CRM, pull a list of people or companies, check a deal pipeline, find or verify someone\'s email or phone (enrichment), draft or review email sequences, OR change CRM data (create or update people/companies, manage lists and tags, add notes, create and resolve tasks, move deals through stages, log touchpoints). Full read/write access to people, companies, pipelines, deals, lists, tags, notes, tasks, enrichment, sequence drafts, and the workspace\'s skill playbooks.\n---\n\n# geni crm\n\n`geni crm` reads and writes the operator\'s General Input CRM: the lead database\n(people and companies), deal pipelines and their cards, lists, tags, notes,\ntasks, touchpoints, and custom fields. It is part of the same `geni` CLI, so it\nuses the same session and active workspace. The workspace must have CRM access,\nor these commands return a 403. Run `geni crm --help` for the full surface, and\n`geni crm <noun> --help` for a noun\'s verbs.\n\nThe shape is `geni crm <noun> <verb>`. Each noun is a group: `people`,\n`companies`, `lists`, `tags`, `notes`, `tasks`, `pipelines`, `stages`, `cards`,\n`touchpoints`, `fields`, `employments`, `contact-points`, `sequences`,\n`skills`, `waterfalls`, `enrich`, plus a top-level `search`.\n\n## Finding things, then acting on them\n\nThe same two-step flow as the rest of geni: find an id, then read or write it.\n\n1. Find by name with one query across everything:\n `geni crm search "<text>" [--type person|company|list|pipeline|card]`. Or\n list one kind: `geni crm people "<text>"`, `geni crm companies "<text>"`,\n `geni crm pipelines`, `geni crm lists`, `geni crm tags`, `geni crm tasks`.\n2. Read one record: `geni crm people get <id>`, `geni crm companies get <id>`,\n `geni crm cards get <id>`, `geni crm pipelines get <id>` (add `--board` for\n its cards), `geni crm tasks get <id>`.\n\n## Writing\n\nCreates and updates take the record body as `--json`; the server validates it,\nso a 400 means the body was wrong (read the error and fix the JSON). Run\n`geni crm <noun> <verb> --help` to see the expected fields.\n\n- **Create / update records** (JSON body):\n - `geni crm people create --json \'[{"fullName":"Ada Lovelace","companyName":"Acme","email":"ada@acme.com"}]\'` (batch, find-or-create, deduped). `companies create` mirrors it. A `"created": false` result matched an existing record by identity key (email/LinkedIn; domain for companies) \u2014 the CLI warns on stderr when the matched name differs, e.g. a shared inbox collapsing distinct people.\n - `geni crm people update --json \'[{"id":"<id>","title":"VP Eng","linkedinUrl":"https://\u2026"}]\'` (batch, ids inline). `companies update` mirrors it. Writes take the create field names (`title`, `linkedinUrl`), not the read names you see on `get` (`currentTitle`, `primaryLinkedinUrl`); unknown keys are rejected with a 400 naming them.\n - `geni crm lists create --json \'{"name":"Q3 ICP","type":"company"}\'`, `geni crm tags create --json \'{"name":"Customer","entityType":"company"}\'`, `geni crm tasks create --json \'{"title":"Follow up","entity":{"type":"person","id":"<id>"}}\'`, `geni crm cards create <pipelineId> --json \'{"title":"Acme renewal","amount":50000}\'`.\n- **Notes** take the text directly: `geni crm notes create person <id> --body "Met at the conference"`.\n- **State-change verbs** (no JSON, just flags/ids):\n - Lists/tags: `geni crm lists add <listId> <entityIds...>`, `geni crm tags assign <tagId> <entityIds...>` (and `remove` / `unassign`).\n - Tasks: `geni crm tasks done <id>` (also `dismiss`, `reopen`, `delete`).\n - Cards: `geni crm cards move <id> --stage <stageId>`, `geni crm cards status <id> --status won|lost|open [--reason "..."]`, `geni crm cards archive <id>`, `geni crm cards add-contact <cardId> <personId>`.\n- **Deals/touchpoints**: `geni crm touchpoints log <cardId> --json \'{"channel":"call","occurredAt":"2026-07-01T15:00:00Z","summary":"Pricing call"}\'`.\n- **Delete** is `<noun> delete <id...>` (people/companies/lists take multiple ids; most others take one).\n\nCard edits, moves, and status changes use optimistic concurrency. Pass\n`--expected-updated-at <ts>` to enforce it; omit it and the CLI reads the card\'s\ncurrent version first (last-write-wins), which is usually what you want from a\nscript. With the token, a stale card fails with an HTTP 409 conflict; re-read\nthe card and retry.\n\n## Output\n\nList commands print a table; pass `--json` to parse. `get` commands and all\nwrites print the affected record as JSON (state-change verbs print a short\nconfirmation). The single-record `get` commands take `--field <path>` to pull\none value, e.g. `geni crm cards get <id> --field status`.\n\nJSON shapes vary by verb: searches print `{"results": [...]}` (people/companies\nadd `nextCursor`), `people get` prints `{person, company, contactPoints, ...}`,\nand bare noun lists wrap in a named key (e.g. `{"lists": [...]}`) \u2014 check before\npiping into a parser.\n\n## Enrichment\n\nFind and verify contact info for people through the workspace\'s configured\nprovider waterfalls. This is **paid** (it spends credits per provider call), so\nevery verb requires `--yes` and a run is capped at 25 people. Only enrich when\nthe operator has asked you to. Found emails and numbers save onto the person\'s\ncontact points automatically.\n\n- See what\'s wired first: `geni crm waterfalls` lists the provider chain for each\n capability (email-enrichment, email-validation, phone-enrichment). An empty\n chain finds nothing and spends nothing.\n- `geni crm enrich emails <personIds...> --yes` finds work emails;\n `geni crm enrich phones <personIds...> --yes` finds mobile numbers (both take\n `--retry-unverified`).\n- `geni crm enrich validate <personIds...> --yes` checks deliverability \u2014 run it\n before sequencing so you don\'t send to a bad address.\n\n## Workspace skills (read these before doing the job yourself)\n\n`geni crm skills` lists the workspace\'s skill playbooks \u2014 the canned prompts\nthe in-app agent runs for jobs like enriching a record, drafting a sequence, or\nbuilding a list. `geni crm skills get <id>` prints one; the org\'s customized\nvariant is returned when it exists, so it reflects how _this_ workspace wants\nthe job done. Before doing one of those jobs from the CLI (e.g. drafting a\nsequence, filling in a person, compiling a list), fetch the matching skill and\nfollow its instructions \u2014 tone, structure, and rules included.\n\n## Sequences (drafts only \u2014 the dashboard sends)\n\nPer-person email sequences. The CLI reads all of them and creates, edits, and\ndeletes **drafts**; it can never queue, unqueue, or send \u2014 the server refuses,\nby design. When a draft is ready, tell the operator to review and queue it from\nthe person\'s page in the dashboard.\n\n- `geni crm sequences [--person <id>] [--status draft|queued|sending|completed|stopped|replied]` lists; `get <id>` shows the steps.\n- Draft: `geni crm sequences create --person <id> --json \'{"steps":[{"subject":"\u2026","body":"\u2026","waitDays":0},{"body":"\u2026","waitDays":3}]}\'`. The first step carries the subject; follow-ups reply in-thread after `waitDays` with no reply.\n- `geni crm sequences update <id> --json \'\u2026\'` replaces a draft wholesale; `delete <id>` removes a draft.\n- Before drafting, read the workspace\'s playbook: `geni crm skills get draft-sequence-person`. Consider `geni crm enrich validate` on the recipient first so the operator isn\'t queueing mail to a dead address.\n\n## Composing with the rest of geni\n\nThe CRM is the source of who and what; connected credentials are how you act on\nthe outside world. To add contact info, prefer `geni crm enrich` (it runs the\nworkspace\'s provider waterfalls and saves results). For anything else, pull\npeople or a company from the CRM, reach a service through `geni exec bash` (send\nan email, update an external system), and write the result back to the CRM (a\nnote, a task, a touchpoint, a moved card). Credit each tool naturally in your\nsummary.\n\n## Exit codes worth knowing\n\n- `0` success.\n- `4` not found (bad id, or it is not in the active workspace).\n- `5` forbidden (the workspace lacks CRM access, or the record is out of scope).\n- `9` stale write (a card changed since you read it; re-read and retry, or pass `--expected-updated-at`).\n- `78` session expired. Tell the operator to run `geni login`.\n';
|
|
23494
23570
|
|
|
23495
23571
|
// src/lib/skills.ts
|
|
23496
23572
|
var GENI_SKILL_NAME = "geni";
|
|
@@ -23835,6 +23911,45 @@ function parseJsonObjectArg(raw) {
|
|
|
23835
23911
|
return value;
|
|
23836
23912
|
}
|
|
23837
23913
|
|
|
23914
|
+
// src/lib/leadBatchOutput.ts
|
|
23915
|
+
function isSameName(left, right) {
|
|
23916
|
+
return left.trim().toLowerCase() === right.trim().toLowerCase();
|
|
23917
|
+
}
|
|
23918
|
+
function submittedName(input, key) {
|
|
23919
|
+
if (!isRecord(input)) return null;
|
|
23920
|
+
const value = input[key];
|
|
23921
|
+
return typeof value === "string" ? value : null;
|
|
23922
|
+
}
|
|
23923
|
+
function printPeopleCreateMatchWarnings(inputs, response) {
|
|
23924
|
+
response.results.forEach((result, index) => {
|
|
23925
|
+
if ("error" in result || result.created) return;
|
|
23926
|
+
const submitted = submittedName(inputs[index], "fullName");
|
|
23927
|
+
if (!submitted || isSameName(submitted, result.person.fullName)) return;
|
|
23928
|
+
printWarning(
|
|
23929
|
+
`people[${index}] "${submitted}" matched existing person "${result.person.fullName}" (${result.person.id}) via a shared identity key (email/LinkedIn) \u2014 no new record created.`
|
|
23930
|
+
);
|
|
23931
|
+
});
|
|
23932
|
+
}
|
|
23933
|
+
function printCompaniesCreateMatchWarnings(inputs, response) {
|
|
23934
|
+
response.results.forEach((result, index) => {
|
|
23935
|
+
if ("error" in result || result.created) return;
|
|
23936
|
+
const submitted = submittedName(inputs[index], "name");
|
|
23937
|
+
if (!submitted || isSameName(submitted, result.company.name)) return;
|
|
23938
|
+
printWarning(
|
|
23939
|
+
`companies[${index}] "${submitted}" matched existing company "${result.company.name}" (${result.company.id}) via a shared domain \u2014 no new record created.`
|
|
23940
|
+
);
|
|
23941
|
+
});
|
|
23942
|
+
}
|
|
23943
|
+
function printLeadBatchFailureSummary(results, noun) {
|
|
23944
|
+
const failedIndexes = results.flatMap(
|
|
23945
|
+
(result, index) => "error" in result ? [index] : []
|
|
23946
|
+
);
|
|
23947
|
+
if (failedIndexes.length === 0) return;
|
|
23948
|
+
printWarning(
|
|
23949
|
+
`${failedIndexes.length} of ${results.length} ${noun} failed (items ${failedIndexes.join(", ")}) \u2014 see the "error" entries in the JSON output.`
|
|
23950
|
+
);
|
|
23951
|
+
}
|
|
23952
|
+
|
|
23838
23953
|
// src/commands/crm/people.ts
|
|
23839
23954
|
function registerCrmPeople(parent) {
|
|
23840
23955
|
const people = parent.command("people").description(
|
|
@@ -23865,19 +23980,27 @@ function registerCrmPeople(parent) {
|
|
|
23865
23980
|
"Create people (find-or-create, deduped org-wide). --json is an array of person objects; each needs fullName, plus optional companyName/companyDomain, email, linkedinUrl, title, etc."
|
|
23866
23981
|
).requiredOption("--json <array>", "JSON array of people to create.").action(async (opts) => {
|
|
23867
23982
|
try {
|
|
23868
|
-
|
|
23983
|
+
const people2 = parseJsonArrayArg(opts.json);
|
|
23984
|
+
const response = await crmService.createPeople(people2);
|
|
23985
|
+
printJson(response);
|
|
23986
|
+
printPeopleCreateMatchWarnings(people2, response);
|
|
23987
|
+
printLeadBatchFailureSummary(response.results, "people");
|
|
23869
23988
|
} catch (error) {
|
|
23870
23989
|
exitOnApiError(error);
|
|
23871
23990
|
}
|
|
23872
23991
|
});
|
|
23873
23992
|
people.command("update").description(
|
|
23874
|
-
"Update people by id. --json is an array of { id, ...fields }."
|
|
23993
|
+
"Update people by id. --json is an array of { id, ...fields }. Fields take the write names from create (title, linkedinUrl, \u2026), not read names like currentTitle; unknown keys are rejected."
|
|
23875
23994
|
).requiredOption(
|
|
23876
23995
|
"--json <array>",
|
|
23877
23996
|
"JSON array of { id, ...fields } updates."
|
|
23878
23997
|
).action(async (opts) => {
|
|
23879
23998
|
try {
|
|
23880
|
-
|
|
23999
|
+
const response = await crmService.updatePeople(
|
|
24000
|
+
parseJsonArrayArg(opts.json)
|
|
24001
|
+
);
|
|
24002
|
+
printJson(response);
|
|
24003
|
+
printLeadBatchFailureSummary(response.results, "people");
|
|
23881
24004
|
} catch (error) {
|
|
23882
24005
|
exitOnApiError(error);
|
|
23883
24006
|
}
|
|
@@ -23955,23 +24078,27 @@ function registerCrmCompanies(parent) {
|
|
|
23955
24078
|
"Create companies (find-or-create, deduped by domain). --json is an array of company objects; each needs name, plus optional domain and firmographics."
|
|
23956
24079
|
).requiredOption("--json <array>", "JSON array of companies to create.").action(async (opts) => {
|
|
23957
24080
|
try {
|
|
23958
|
-
|
|
23959
|
-
|
|
23960
|
-
);
|
|
24081
|
+
const companies2 = parseJsonArrayArg(opts.json);
|
|
24082
|
+
const response = await crmService.createCompanies(companies2);
|
|
24083
|
+
printJson(response);
|
|
24084
|
+
printCompaniesCreateMatchWarnings(companies2, response);
|
|
24085
|
+
printLeadBatchFailureSummary(response.results, "companies");
|
|
23961
24086
|
} catch (error) {
|
|
23962
24087
|
exitOnApiError(error);
|
|
23963
24088
|
}
|
|
23964
24089
|
});
|
|
23965
24090
|
companies.command("update").description(
|
|
23966
|
-
"Update companies by id. --json is an array of { id, ...fields }."
|
|
24091
|
+
"Update companies by id. --json is an array of { id, ...fields }. Fields take the write names from create; unknown keys are rejected."
|
|
23967
24092
|
).requiredOption(
|
|
23968
24093
|
"--json <array>",
|
|
23969
24094
|
"JSON array of { id, ...fields } updates."
|
|
23970
24095
|
).action(async (opts) => {
|
|
23971
24096
|
try {
|
|
23972
|
-
|
|
23973
|
-
|
|
24097
|
+
const response = await crmService.updateCompanies(
|
|
24098
|
+
parseJsonArrayArg(opts.json)
|
|
23974
24099
|
);
|
|
24100
|
+
printJson(response);
|
|
24101
|
+
printLeadBatchFailureSummary(response.results, "companies");
|
|
23975
24102
|
} catch (error) {
|
|
23976
24103
|
exitOnApiError(error);
|
|
23977
24104
|
}
|
|
@@ -24912,6 +25039,180 @@ function registerCrmContactPoints(parent) {
|
|
|
24912
25039
|
});
|
|
24913
25040
|
}
|
|
24914
25041
|
|
|
25042
|
+
// src/commands/crm/sequences.ts
|
|
25043
|
+
var SEQUENCE_STATUSES = [
|
|
25044
|
+
"draft",
|
|
25045
|
+
"queued",
|
|
25046
|
+
"sending",
|
|
25047
|
+
"completed",
|
|
25048
|
+
"stopped",
|
|
25049
|
+
"replied"
|
|
25050
|
+
];
|
|
25051
|
+
function statusOrExit(value) {
|
|
25052
|
+
if (value === void 0) return void 0;
|
|
25053
|
+
const match = SEQUENCE_STATUSES.find((status) => status === value);
|
|
25054
|
+
if (match === void 0) {
|
|
25055
|
+
printError(
|
|
25056
|
+
`Unknown --status "${value}". Expected one of: ${SEQUENCE_STATUSES.join(", ")}.`
|
|
25057
|
+
);
|
|
25058
|
+
exit(ExitCode.InternalError);
|
|
25059
|
+
}
|
|
25060
|
+
return match;
|
|
25061
|
+
}
|
|
25062
|
+
function registerCrmSequences(parent) {
|
|
25063
|
+
const sequences = parent.command("sequences").description(
|
|
25064
|
+
"List email sequences (default), or get / create / update / delete drafts. Queueing and sending happen in the dashboard."
|
|
25065
|
+
).option("--person <id>", "Only this person's sequences.").option(
|
|
25066
|
+
"--status <status>",
|
|
25067
|
+
"Filter: draft, queued, sending, completed, stopped, or replied."
|
|
25068
|
+
).option("--json", "Machine-readable output.").action((opts) => executeSequencesList(opts));
|
|
25069
|
+
sequences.command("get").argument("<id>", "Sequence id.").description(
|
|
25070
|
+
"One sequence with its steps. Use --field to extract a value (e.g. status)."
|
|
25071
|
+
).option("--field <path>", "Print one dotted-path value.").action(async (id, opts) => {
|
|
25072
|
+
try {
|
|
25073
|
+
printJsonOrField(await crmService.getSequence(id), opts.field);
|
|
25074
|
+
} catch (error) {
|
|
25075
|
+
exitOnApiError(error, {
|
|
25076
|
+
notFoundMessage: `No sequence with id "${id}" in this workspace.`
|
|
25077
|
+
});
|
|
25078
|
+
}
|
|
25079
|
+
});
|
|
25080
|
+
sequences.command("create").description(
|
|
25081
|
+
"Draft a sequence for a person. --json: { steps: [{ subject?, body, waitDays }], recipientContactPointId?, emailAccountId? }. The draft stays unsent until someone queues it in the dashboard."
|
|
25082
|
+
).requiredOption("--person <id>", "Person the sequence targets.").requiredOption("--json <body>", "JSON sequence definition.").action(async (opts) => {
|
|
25083
|
+
try {
|
|
25084
|
+
printJson(
|
|
25085
|
+
await crmService.createSequence(
|
|
25086
|
+
opts.person,
|
|
25087
|
+
parseJsonObjectArg(opts.json)
|
|
25088
|
+
)
|
|
25089
|
+
);
|
|
25090
|
+
} catch (error) {
|
|
25091
|
+
exitOnApiError(error);
|
|
25092
|
+
}
|
|
25093
|
+
});
|
|
25094
|
+
sequences.command("update").argument("<id>", "Sequence id.").description(
|
|
25095
|
+
"Replace a draft wholesale (steps, recipient, inbox). Drafts only \u2014 queued or sent sequences cannot be edited."
|
|
25096
|
+
).requiredOption("--json <body>", "JSON sequence definition.").action(async (id, opts) => {
|
|
25097
|
+
try {
|
|
25098
|
+
printJson(
|
|
25099
|
+
await crmService.updateSequence(id, parseJsonObjectArg(opts.json))
|
|
25100
|
+
);
|
|
25101
|
+
} catch (error) {
|
|
25102
|
+
exitOnApiError(error, {
|
|
25103
|
+
notFoundMessage: `No sequence with id "${id}" in this workspace.`
|
|
25104
|
+
});
|
|
25105
|
+
}
|
|
25106
|
+
});
|
|
25107
|
+
sequences.command("delete").argument("<id>", "Sequence id.").description("Delete a draft or finished sequence (active ones refuse).").action(async (id) => {
|
|
25108
|
+
try {
|
|
25109
|
+
await crmService.deleteSequence(id);
|
|
25110
|
+
printSuccess("Sequence deleted.");
|
|
25111
|
+
} catch (error) {
|
|
25112
|
+
exitOnApiError(error, {
|
|
25113
|
+
notFoundMessage: `No sequence with id "${id}" in this workspace.`
|
|
25114
|
+
});
|
|
25115
|
+
}
|
|
25116
|
+
});
|
|
25117
|
+
}
|
|
25118
|
+
async function executeSequencesList(opts) {
|
|
25119
|
+
const status = statusOrExit(opts.status);
|
|
25120
|
+
try {
|
|
25121
|
+
if (opts.person) {
|
|
25122
|
+
const all = await crmService.listPersonSequences(opts.person);
|
|
25123
|
+
const results2 = status ? all.filter((sequence) => sequence.status === status) : all;
|
|
25124
|
+
if (opts.json) {
|
|
25125
|
+
printJson(results2);
|
|
25126
|
+
return;
|
|
25127
|
+
}
|
|
25128
|
+
if (results2.length === 0) {
|
|
25129
|
+
process.stdout.write("No sequences match.\n");
|
|
25130
|
+
return;
|
|
25131
|
+
}
|
|
25132
|
+
printTable(
|
|
25133
|
+
["ID", "STATUS", "STEPS", "RECIPIENT", "UPDATED"],
|
|
25134
|
+
results2.map((sequence) => [
|
|
25135
|
+
sequence.id,
|
|
25136
|
+
sequence.status,
|
|
25137
|
+
String(sequence.steps.length),
|
|
25138
|
+
sequence.recipientEmail ?? "",
|
|
25139
|
+
sequence.updatedAt.slice(0, 10)
|
|
25140
|
+
]),
|
|
25141
|
+
{ colorFn: dimColumn(0) }
|
|
25142
|
+
);
|
|
25143
|
+
return;
|
|
25144
|
+
}
|
|
25145
|
+
const results = await crmService.listSequences({ status });
|
|
25146
|
+
if (opts.json) {
|
|
25147
|
+
printJson(results);
|
|
25148
|
+
return;
|
|
25149
|
+
}
|
|
25150
|
+
if (results.length === 0) {
|
|
25151
|
+
process.stdout.write("No sequences match.\n");
|
|
25152
|
+
return;
|
|
25153
|
+
}
|
|
25154
|
+
printTable(
|
|
25155
|
+
["ID", "PERSON", "STATUS", "STEPS", "RECIPIENT", "UPDATED"],
|
|
25156
|
+
results.map((sequence) => [
|
|
25157
|
+
sequence.id,
|
|
25158
|
+
sequence.personName,
|
|
25159
|
+
sequence.status,
|
|
25160
|
+
String(sequence.stepCount),
|
|
25161
|
+
sequence.recipientEmail ?? "",
|
|
25162
|
+
sequence.updatedAt.slice(0, 10)
|
|
25163
|
+
]),
|
|
25164
|
+
{ colorFn: dimColumn(0) }
|
|
25165
|
+
);
|
|
25166
|
+
} catch (error) {
|
|
25167
|
+
exitOnApiError(error);
|
|
25168
|
+
}
|
|
25169
|
+
}
|
|
25170
|
+
|
|
25171
|
+
// src/commands/crm/skills.ts
|
|
25172
|
+
function registerCrmSkills(parent) {
|
|
25173
|
+
const skills = parent.command("skills").description(
|
|
25174
|
+
"List the workspace's agent skill playbooks (default), or get one's content."
|
|
25175
|
+
).option("--json", "Machine-readable output.").action((opts) => executeSkillsList(opts));
|
|
25176
|
+
skills.command("get").argument("<id>", "Skill id (e.g. draft-sequence-person).").description(
|
|
25177
|
+
"A skill's playbook content \u2014 the org's customized variant when one exists, else the default. --json for the full record."
|
|
25178
|
+
).option("--json", "Full record: content, default content, customization.").action(async (id, opts) => {
|
|
25179
|
+
try {
|
|
25180
|
+
const skill = await crmService.getSkill(id);
|
|
25181
|
+
if (opts.json) {
|
|
25182
|
+
printJson(skill);
|
|
25183
|
+
return;
|
|
25184
|
+
}
|
|
25185
|
+
process.stdout.write(`${skill.content}
|
|
25186
|
+
`);
|
|
25187
|
+
} catch (error) {
|
|
25188
|
+
exitOnApiError(error, {
|
|
25189
|
+
notFoundMessage: `No skill "${id}". Run \`geni crm skills\` to list ids.`
|
|
25190
|
+
});
|
|
25191
|
+
}
|
|
25192
|
+
});
|
|
25193
|
+
}
|
|
25194
|
+
async function executeSkillsList(opts) {
|
|
25195
|
+
try {
|
|
25196
|
+
const results = await crmService.listSkills();
|
|
25197
|
+
if (opts.json) {
|
|
25198
|
+
printJson(results);
|
|
25199
|
+
return;
|
|
25200
|
+
}
|
|
25201
|
+
printTable(
|
|
25202
|
+
["ID", "NAME", "CUSTOMIZED", "DESCRIPTION"],
|
|
25203
|
+
results.map((skill) => [
|
|
25204
|
+
skill.id,
|
|
25205
|
+
skill.name,
|
|
25206
|
+
skill.custom ? "yes" : "",
|
|
25207
|
+
skill.description
|
|
25208
|
+
]),
|
|
25209
|
+
{ colorFn: dimColumn(0) }
|
|
25210
|
+
);
|
|
25211
|
+
} catch (error) {
|
|
25212
|
+
exitOnApiError(error);
|
|
25213
|
+
}
|
|
25214
|
+
}
|
|
25215
|
+
|
|
24915
25216
|
// src/commands/crm/waterfalls.ts
|
|
24916
25217
|
function registerCrmWaterfalls(parent) {
|
|
24917
25218
|
parent.command("waterfalls").description(
|
|
@@ -25072,9 +25373,13 @@ function registerCrmCommands(program2) {
|
|
|
25072
25373
|
registerCrmFields(crm);
|
|
25073
25374
|
registerCrmEmployments(crm);
|
|
25074
25375
|
registerCrmContactPoints(crm);
|
|
25376
|
+
registerCrmSequences(crm);
|
|
25377
|
+
registerCrmSkills(crm);
|
|
25075
25378
|
registerCrmWaterfalls(crm);
|
|
25076
25379
|
registerCrmEnrich(crm);
|
|
25077
25380
|
crm.action(() => crm.help());
|
|
25381
|
+
crm.enablePositionalOptions();
|
|
25382
|
+
for (const noun of crm.commands) noun.enablePositionalOptions();
|
|
25078
25383
|
}
|
|
25079
25384
|
|
|
25080
25385
|
// src/commands/doctor.ts
|
|
@@ -25278,13 +25583,123 @@ function printReport(checks) {
|
|
|
25278
25583
|
}
|
|
25279
25584
|
}
|
|
25280
25585
|
|
|
25586
|
+
// src/commands/upgrade.ts
|
|
25587
|
+
import { spawn as spawn3, execFileSync } from "child_process";
|
|
25588
|
+
import { realpathSync } from "fs";
|
|
25589
|
+
import { sep as sep2 } from "path";
|
|
25590
|
+
import { z as z11 } from "zod";
|
|
25591
|
+
import semver from "semver";
|
|
25592
|
+
var PACKAGE_NAME = "@general-input/cli";
|
|
25593
|
+
var registryLatestSchema = z11.object({ version: z11.string() });
|
|
25594
|
+
function registerUpgradeCommand(program2) {
|
|
25595
|
+
program2.command("upgrade").description(
|
|
25596
|
+
"Upgrade geni to the latest published version. Checks the npm registry and reinstalls via `npm install -g` when this install is npm-managed. Use --check to only report whether a newer version exists."
|
|
25597
|
+
).option(
|
|
25598
|
+
"--check",
|
|
25599
|
+
"Report whether a newer version exists, without installing it."
|
|
25600
|
+
).action(async (opts) => {
|
|
25601
|
+
const latest = await fetchLatestVersion();
|
|
25602
|
+
if (!semver.gt(latest, CLI_VERSION)) {
|
|
25603
|
+
printSuccess(`geni ${CLI_VERSION} is already the latest version.`);
|
|
25604
|
+
exit(ExitCode.Ok);
|
|
25605
|
+
}
|
|
25606
|
+
if (opts.check) {
|
|
25607
|
+
printInfo(
|
|
25608
|
+
`geni ${latest} is available (you have ${CLI_VERSION}). Run \`geni upgrade\` to install it.`
|
|
25609
|
+
);
|
|
25610
|
+
exit(ExitCode.UpgradeRequired);
|
|
25611
|
+
}
|
|
25612
|
+
const cliPath = resolveCliRealPath();
|
|
25613
|
+
const npmGlobalRoot = resolveNpmGlobalRoot();
|
|
25614
|
+
const isNpmManaged = cliPath !== null && npmGlobalRoot !== null && isInsideDirectory({ path: cliPath, directory: npmGlobalRoot });
|
|
25615
|
+
if (!isNpmManaged) {
|
|
25616
|
+
printError(
|
|
25617
|
+
`geni ${latest} is available (you have ${CLI_VERSION}), but this install isn't managed by \`npm install -g\` (binary resolves to ${cliPath ?? "an unknown path"}). Upgrade it the way it was installed \u2014 for a linked dev checkout: git pull && pnpm build.`
|
|
25618
|
+
);
|
|
25619
|
+
exit(ExitCode.GenericError);
|
|
25620
|
+
}
|
|
25621
|
+
printInfo(`Upgrading geni ${CLI_VERSION} \u2192 ${latest} \u2026`);
|
|
25622
|
+
const npmExitCode = await runNpmInstall();
|
|
25623
|
+
if (npmExitCode !== 0) {
|
|
25624
|
+
printError(
|
|
25625
|
+
`npm install failed (exit ${npmExitCode}). If that was a permissions error, retry with: sudo npm install -g ${PACKAGE_NAME}@latest`
|
|
25626
|
+
);
|
|
25627
|
+
exit(ExitCode.GenericError);
|
|
25628
|
+
}
|
|
25629
|
+
printSuccess(`geni upgraded to ${latest}.`);
|
|
25630
|
+
printInfo("Run `geni skills install` to refresh the agent-facing skills.");
|
|
25631
|
+
exit(ExitCode.Ok);
|
|
25632
|
+
});
|
|
25633
|
+
}
|
|
25634
|
+
async function fetchLatestVersion() {
|
|
25635
|
+
try {
|
|
25636
|
+
const response = await fetch(
|
|
25637
|
+
`https://registry.npmjs.org/${PACKAGE_NAME}/latest`,
|
|
25638
|
+
{ signal: AbortSignal.timeout(1e4) }
|
|
25639
|
+
);
|
|
25640
|
+
if (!response.ok) {
|
|
25641
|
+
throw new Error(`npm registry responded ${response.status}`);
|
|
25642
|
+
}
|
|
25643
|
+
const parsed = registryLatestSchema.parse(await response.json());
|
|
25644
|
+
if (semver.valid(parsed.version) === null) {
|
|
25645
|
+
throw new Error(
|
|
25646
|
+
`npm registry returned invalid version "${parsed.version}"`
|
|
25647
|
+
);
|
|
25648
|
+
}
|
|
25649
|
+
return parsed.version;
|
|
25650
|
+
} catch (err) {
|
|
25651
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
25652
|
+
printError(
|
|
25653
|
+
`Could not check the npm registry for the latest version: ${detail}`
|
|
25654
|
+
);
|
|
25655
|
+
exit(ExitCode.GenericError);
|
|
25656
|
+
}
|
|
25657
|
+
}
|
|
25658
|
+
function resolveCliRealPath() {
|
|
25659
|
+
const binPath = process.argv[1];
|
|
25660
|
+
if (!binPath) return null;
|
|
25661
|
+
try {
|
|
25662
|
+
return realpathSync(binPath);
|
|
25663
|
+
} catch {
|
|
25664
|
+
return null;
|
|
25665
|
+
}
|
|
25666
|
+
}
|
|
25667
|
+
function resolveNpmGlobalRoot() {
|
|
25668
|
+
try {
|
|
25669
|
+
const root = execFileSync("npm", ["root", "-g"], {
|
|
25670
|
+
encoding: "utf-8"
|
|
25671
|
+
}).trim();
|
|
25672
|
+
return realpathSync(root);
|
|
25673
|
+
} catch {
|
|
25674
|
+
return null;
|
|
25675
|
+
}
|
|
25676
|
+
}
|
|
25677
|
+
function isInsideDirectory(args) {
|
|
25678
|
+
return args.path.startsWith(args.directory + sep2);
|
|
25679
|
+
}
|
|
25680
|
+
function runNpmInstall() {
|
|
25681
|
+
return new Promise((resolve20, reject) => {
|
|
25682
|
+
const child = spawn3("npm", ["install", "-g", `${PACKAGE_NAME}@latest`], {
|
|
25683
|
+
stdio: "inherit"
|
|
25684
|
+
});
|
|
25685
|
+
child.once("exit", (code) => resolve20(code ?? 1));
|
|
25686
|
+
child.once("error", (err) => reject(err));
|
|
25687
|
+
});
|
|
25688
|
+
}
|
|
25689
|
+
|
|
25281
25690
|
// src/cli.ts
|
|
25691
|
+
process.removeAllListeners("warning");
|
|
25692
|
+
process.on("warning", (warning) => {
|
|
25693
|
+
if (warning.name === "ExperimentalWarning") return;
|
|
25694
|
+
process.stderr.write(`${warning.name}: ${warning.message}
|
|
25695
|
+
`);
|
|
25696
|
+
});
|
|
25282
25697
|
var program = new Command();
|
|
25283
25698
|
program.name("geni").description(
|
|
25284
25699
|
"The agent-facing CLI for General Input. Discover the integrations and credentials the operator has connected, then run shell commands with those credentials injected as env vars by the cloud (audit-logged, output-scrubbed)."
|
|
25285
|
-
).version(CLI_VERSION, "-v, --version", "Print the geni version and exit.").showHelpAfterError().option(
|
|
25700
|
+
).version(CLI_VERSION, "-v, --version", "Print the geni version and exit.").showHelpAfterError().enablePositionalOptions().option(
|
|
25286
25701
|
"--workspace <slug>",
|
|
25287
|
-
"Override the active workspace for this invocation. Without it, commands run against the workspace set by `geni workspace switch`."
|
|
25702
|
+
"Override the active workspace for this invocation (place before the subcommand). Without it, commands run against the workspace set by `geni workspace switch`."
|
|
25288
25703
|
);
|
|
25289
25704
|
registerAuthCommands(program);
|
|
25290
25705
|
registerWorkspaceCommands(program);
|
|
@@ -25299,6 +25714,7 @@ registerConfigCommands(program);
|
|
|
25299
25714
|
registerSkillsCommands(program);
|
|
25300
25715
|
registerCrmCommands(program);
|
|
25301
25716
|
registerDoctorCommand(program);
|
|
25717
|
+
registerUpgradeCommand(program);
|
|
25302
25718
|
program.addHelpText(
|
|
25303
25719
|
"after",
|
|
25304
25720
|
`
|
|
@@ -25322,6 +25738,7 @@ function shouldRunPreflight(argv) {
|
|
|
25322
25738
|
const firstArg = argv[2];
|
|
25323
25739
|
if (!firstArg) return false;
|
|
25324
25740
|
if (firstArg === "doctor") return false;
|
|
25741
|
+
if (firstArg === "upgrade") return false;
|
|
25325
25742
|
if (firstArg === "--help" || firstArg === "-h") return false;
|
|
25326
25743
|
if (firstArg === "--version" || firstArg === "-v") return false;
|
|
25327
25744
|
return true;
|