@nex-ai/nex 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/README.md +228 -0
  2. package/dist/cli.d.ts +5 -0
  3. package/dist/cli.js +18 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/commands/attribute.d.ts +4 -0
  6. package/dist/commands/attribute.js +75 -0
  7. package/dist/commands/attribute.js.map +1 -0
  8. package/dist/commands/config-cmd.d.ts +4 -0
  9. package/dist/commands/config-cmd.js +53 -0
  10. package/dist/commands/config-cmd.js.map +1 -0
  11. package/dist/commands/context.d.ts +4 -0
  12. package/dist/commands/context.js +135 -0
  13. package/dist/commands/context.js.map +1 -0
  14. package/dist/commands/insight.d.ts +4 -0
  15. package/dist/commands/insight.js +39 -0
  16. package/dist/commands/insight.js.map +1 -0
  17. package/dist/commands/integrate.d.ts +4 -0
  18. package/dist/commands/integrate.js +136 -0
  19. package/dist/commands/integrate.js.map +1 -0
  20. package/dist/commands/list-job.d.ts +4 -0
  21. package/dist/commands/list-job.js +41 -0
  22. package/dist/commands/list-job.js.map +1 -0
  23. package/dist/commands/list.d.ts +4 -0
  24. package/dist/commands/list.js +148 -0
  25. package/dist/commands/list.js.map +1 -0
  26. package/dist/commands/note.d.ts +4 -0
  27. package/dist/commands/note.js +77 -0
  28. package/dist/commands/note.js.map +1 -0
  29. package/dist/commands/object.d.ts +4 -0
  30. package/dist/commands/object.js +78 -0
  31. package/dist/commands/object.js.map +1 -0
  32. package/dist/commands/record.d.ts +4 -0
  33. package/dist/commands/record.js +126 -0
  34. package/dist/commands/record.js.map +1 -0
  35. package/dist/commands/register.d.ts +4 -0
  36. package/dist/commands/register.js +23 -0
  37. package/dist/commands/register.js.map +1 -0
  38. package/dist/commands/relationship.d.ts +4 -0
  39. package/dist/commands/relationship.js +80 -0
  40. package/dist/commands/relationship.js.map +1 -0
  41. package/dist/commands/scan.d.ts +4 -0
  42. package/dist/commands/scan.js +58 -0
  43. package/dist/commands/scan.js.map +1 -0
  44. package/dist/commands/search.d.ts +4 -0
  45. package/dist/commands/search.js +22 -0
  46. package/dist/commands/search.js.map +1 -0
  47. package/dist/commands/session.d.ts +4 -0
  48. package/dist/commands/session.js +31 -0
  49. package/dist/commands/session.js.map +1 -0
  50. package/dist/commands/setup.d.ts +10 -0
  51. package/dist/commands/setup.js +254 -0
  52. package/dist/commands/setup.js.map +1 -0
  53. package/dist/commands/task.d.ts +4 -0
  54. package/dist/commands/task.js +114 -0
  55. package/dist/commands/task.js.map +1 -0
  56. package/dist/index.d.ts +25 -0
  57. package/dist/index.js +68 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/lib/capture-filter.d.ts +9 -0
  60. package/dist/lib/capture-filter.js +14 -0
  61. package/dist/lib/capture-filter.js.map +1 -0
  62. package/dist/lib/client.d.ts +19 -0
  63. package/dist/lib/client.js +115 -0
  64. package/dist/lib/client.js.map +1 -0
  65. package/dist/lib/config.d.ts +34 -0
  66. package/dist/lib/config.js +59 -0
  67. package/dist/lib/config.js.map +1 -0
  68. package/dist/lib/context-format.d.ts +7 -0
  69. package/dist/lib/context-format.js +21 -0
  70. package/dist/lib/context-format.js.map +1 -0
  71. package/dist/lib/errors.d.ts +18 -0
  72. package/dist/lib/errors.js +30 -0
  73. package/dist/lib/errors.js.map +1 -0
  74. package/dist/lib/file-scanner.d.ts +38 -0
  75. package/dist/lib/file-scanner.js +178 -0
  76. package/dist/lib/file-scanner.js.map +1 -0
  77. package/dist/lib/installers.d.ts +19 -0
  78. package/dist/lib/installers.js +205 -0
  79. package/dist/lib/installers.js.map +1 -0
  80. package/dist/lib/output.d.ts +7 -0
  81. package/dist/lib/output.js +50 -0
  82. package/dist/lib/output.js.map +1 -0
  83. package/dist/lib/platform-detect.d.ts +16 -0
  84. package/dist/lib/platform-detect.js +188 -0
  85. package/dist/lib/platform-detect.js.map +1 -0
  86. package/dist/lib/project-config.d.ts +53 -0
  87. package/dist/lib/project-config.js +151 -0
  88. package/dist/lib/project-config.js.map +1 -0
  89. package/dist/lib/prompt.d.ts +4 -0
  90. package/dist/lib/prompt.js +21 -0
  91. package/dist/lib/prompt.js.map +1 -0
  92. package/dist/lib/rate-limiter.d.ts +13 -0
  93. package/dist/lib/rate-limiter.js +49 -0
  94. package/dist/lib/rate-limiter.js.map +1 -0
  95. package/dist/lib/recall-filter.d.ts +6 -0
  96. package/dist/lib/recall-filter.js +58 -0
  97. package/dist/lib/recall-filter.js.map +1 -0
  98. package/dist/lib/session-store.d.ts +15 -0
  99. package/dist/lib/session-store.js +62 -0
  100. package/dist/lib/session-store.js.map +1 -0
  101. package/package.json +32 -0
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Integration commands: list, connect, disconnect.
3
+ */
4
+ import { spawn } from "node:child_process";
5
+ import { program } from "../cli.js";
6
+ import { NexClient } from "../lib/client.js";
7
+ import { resolveApiKey, resolveFormat, resolveTimeout } from "../lib/config.js";
8
+ import { AuthError, ServerError } from "../lib/errors.js";
9
+ import { printOutput, printError } from "../lib/output.js";
10
+ function padRight(str, len) {
11
+ return str.length >= len ? str : str + " ".repeat(len - str.length);
12
+ }
13
+ function getClient() {
14
+ const opts = program.opts();
15
+ const client = new NexClient(resolveApiKey(opts.apiKey), resolveTimeout(opts.timeout));
16
+ return { client, format: resolveFormat(opts.format) };
17
+ }
18
+ const integrate = program
19
+ .command("integrate")
20
+ .description("Manage third-party integrations (Gmail, Slack, Salesforce, etc.)");
21
+ integrate
22
+ .command("list")
23
+ .description("List all available integrations and their connection status")
24
+ .action(async () => {
25
+ const { client, format } = getClient();
26
+ const result = await client.get("/v1/integrations/");
27
+ if (format === "json") {
28
+ printOutput(result, "json");
29
+ return;
30
+ }
31
+ // Human-readable text output
32
+ if (!Array.isArray(result) || result.length === 0) {
33
+ process.stdout.write("No integrations available.\n");
34
+ return;
35
+ }
36
+ const lines = [];
37
+ lines.push("Integrations");
38
+ lines.push("\u2500".repeat(50));
39
+ for (const integration of result) {
40
+ const type = String(integration.type ?? "");
41
+ const provider = String(integration.provider ?? "");
42
+ const label = `${type} / ${provider}`;
43
+ const connections = integration.connections;
44
+ if (connections && connections.length > 0) {
45
+ for (const conn of connections) {
46
+ const displayName = conn.display_name ?? conn.email ?? "";
47
+ lines.push(`${padRight(label, 25)} \u25CF connected ${displayName} (ID: ${conn.id})`);
48
+ }
49
+ }
50
+ else {
51
+ lines.push(`${padRight(label, 25)} \u25CB not connected`);
52
+ }
53
+ }
54
+ lines.push("");
55
+ lines.push("Connect: nex integrate connect <type> <provider>");
56
+ lines.push("Disconnect: nex integrate disconnect <id>");
57
+ process.stdout.write(lines.join("\n") + "\n");
58
+ });
59
+ integrate
60
+ .command("connect")
61
+ .description("Connect a third-party integration via OAuth")
62
+ .argument("<type>", "Integration type: email, calendar, crm, messaging")
63
+ .argument("<provider>", "Provider: google, microsoft, attio, slack, salesforce, hubspot")
64
+ .action(async (type, provider) => {
65
+ const { client, format } = getClient();
66
+ const result = await client.post(`/v1/integrations/${encodeURIComponent(type)}/${encodeURIComponent(provider)}/connect`);
67
+ if (!result.auth_url) {
68
+ throw new Error("No auth URL returned from API");
69
+ }
70
+ // Open browser using spawn (no shell interpolation — safe from injection)
71
+ const url = result.auth_url;
72
+ try {
73
+ let cmd;
74
+ let args;
75
+ if (process.platform === "darwin") {
76
+ cmd = "open";
77
+ args = [url];
78
+ }
79
+ else if (process.platform === "linux") {
80
+ cmd = "xdg-open";
81
+ args = [url];
82
+ }
83
+ else if (process.platform === "win32") {
84
+ cmd = "cmd";
85
+ args = ["/c", "start", "", url];
86
+ }
87
+ else {
88
+ throw new Error("Unsupported platform");
89
+ }
90
+ spawn(cmd, args, { stdio: "ignore", detached: true }).unref();
91
+ }
92
+ catch {
93
+ process.stderr.write(`Open this URL in your browser:\n${url}\n\n`);
94
+ }
95
+ process.stderr.write("Waiting for OAuth completion...\n");
96
+ // Poll for status
97
+ const connectId = result.connect_id;
98
+ const maxWaitMs = 5 * 60 * 1000; // 5 minutes
99
+ const pollIntervalMs = 2000;
100
+ const startTime = Date.now();
101
+ while (Date.now() - startTime < maxWaitMs) {
102
+ await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
103
+ try {
104
+ const status = await client.get(`/v1/integrations/connect/${encodeURIComponent(connectId)}/status`);
105
+ if (status.status === "connected") {
106
+ process.stderr.write(`\nConnected successfully!\n`);
107
+ printOutput(status, format);
108
+ return;
109
+ }
110
+ }
111
+ catch (err) {
112
+ // Fail fast on non-transient errors
113
+ if (err instanceof AuthError)
114
+ throw err;
115
+ if (err instanceof ServerError && (err.status === 410 || err.status === 403))
116
+ throw err;
117
+ // Continue polling on transient errors
118
+ if (program.opts().debug) {
119
+ process.stderr.write(`Poll error: ${err}\n`);
120
+ }
121
+ }
122
+ }
123
+ printError("Timed out waiting for OAuth completion. You can check status with 'nex integrate list'.");
124
+ process.exit(1);
125
+ });
126
+ integrate
127
+ .command("disconnect")
128
+ .description("Disconnect an integration")
129
+ .argument("<connection_id>", "Connection ID to disconnect")
130
+ .action(async (connectionId) => {
131
+ const { client, format } = getClient();
132
+ const result = await client.delete(`/v1/integrations/connections/${encodeURIComponent(connectionId)}`);
133
+ printOutput(result, format);
134
+ process.stderr.write("Disconnected successfully.\n");
135
+ });
136
+ //# sourceMappingURL=integrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrate.js","sourceRoot":"","sources":["../../src/commands/integrate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,UAAU,EA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;gBAAE,MAAM,GAAG,CAAC;YACxF,uCAAuC;YACvC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC;gBACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC;IACH,CAAC;IAED,UAAU,CAAC,yFAAyF,CAAC,CAAC;IACtG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEL,SAAS;KACN,OAAO,CAAC,YAAY,CAAC;KACrB,WAAW,CAAC,2BAA2B,CAAC;KACxC,QAAQ,CAAC,iBAAiB,EAAE,6BAA6B,CAAC;KAC1D,MAAM,CAAC,KAAK,EAAE,YAAoB,EAAE,EAAE;IACrC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IACvC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,gCAAgC,kBAAkB,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IACvG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * nex list-job — AI-powered list generation jobs.
3
+ */
4
+ export {};
@@ -0,0 +1,41 @@
1
+ /**
2
+ * nex list-job — AI-powered list generation jobs.
3
+ */
4
+ import { program } from "../cli.js";
5
+ import { NexClient } from "../lib/client.js";
6
+ import { resolveApiKey, resolveFormat, resolveTimeout } from "../lib/config.js";
7
+ import { printOutput } from "../lib/output.js";
8
+ function getClient() {
9
+ const opts = program.opts();
10
+ const client = new NexClient(resolveApiKey(opts.apiKey), resolveTimeout(opts.timeout));
11
+ return { client, format: resolveFormat(opts.format) };
12
+ }
13
+ const listJob = program.command("list-job").description("Manage list generation jobs");
14
+ listJob
15
+ .command("create")
16
+ .description("Create a list generation job")
17
+ .argument("<query>", "Natural language query")
18
+ .option("--type <type>", "Object type: contact, company")
19
+ .option("--limit <n>", "Max results")
20
+ .action(async (query, opts) => {
21
+ const { client, format } = getClient();
22
+ const body = { query };
23
+ if (opts.type)
24
+ body.object_type = opts.type;
25
+ if (opts.limit)
26
+ body.limit = parseInt(opts.limit, 10);
27
+ const result = await client.post("/v1/context/list/jobs", body);
28
+ printOutput(result, format);
29
+ });
30
+ listJob
31
+ .command("status")
32
+ .description("Get job status")
33
+ .argument("<id>", "Job ID")
34
+ .option("--include-attributes", "Include attributes in response")
35
+ .action(async (id, opts) => {
36
+ const { client, format } = getClient();
37
+ const params = opts.includeAttributes ? "?include_attributes=true" : "";
38
+ const result = await client.get(`/v1/context/list/jobs/${encodeURIComponent(id)}${params}`);
39
+ printOutput(result, format);
40
+ });
41
+ //# sourceMappingURL=list-job.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-job.js","sourceRoot":"","sources":["../../src/commands/list-job.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,SAAS,SAAS;IAChB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACvF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAW,EAAE,CAAC;AAClE,CAAC;AAED,MAAM,OAAO,GAAG,OAAO,CAAC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AG,MAAM,MAAM,CAAC,GAAG,CAAC,yBAAyB,kBAAkB,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC;IAC5F,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * nex list — CRUD operations for lists and list records.
3
+ */
4
+ export {};
@@ -0,0 +1,148 @@
1
+ /**
2
+ * nex list — CRUD operations for lists and list records.
3
+ */
4
+ import { program } from "../cli.js";
5
+ import { NexClient } from "../lib/client.js";
6
+ import { resolveApiKey, resolveFormat, resolveTimeout } from "../lib/config.js";
7
+ import { printOutput } from "../lib/output.js";
8
+ function getClient() {
9
+ const opts = program.opts();
10
+ const client = new NexClient(resolveApiKey(opts.apiKey), resolveTimeout(opts.timeout));
11
+ return { client, format: resolveFormat(opts.format) };
12
+ }
13
+ const list = program.command("list").description("Manage lists");
14
+ list
15
+ .command("list")
16
+ .description("List all lists for an object")
17
+ .argument("<object-slug>", "Object slug")
18
+ .option("--include-attributes", "Include attributes in response")
19
+ .action(async (objectSlug, opts) => {
20
+ const { client, format } = getClient();
21
+ const params = opts.includeAttributes ? "?include_attributes=true" : "";
22
+ const result = await client.get(`/v1/objects/${encodeURIComponent(objectSlug)}/lists${params}`);
23
+ printOutput(result, format);
24
+ });
25
+ list
26
+ .command("get")
27
+ .description("Get a list by ID")
28
+ .argument("<id>", "List ID")
29
+ .action(async (id) => {
30
+ const { client, format } = getClient();
31
+ const result = await client.get(`/v1/lists/${encodeURIComponent(id)}`);
32
+ printOutput(result, format);
33
+ });
34
+ list
35
+ .command("create")
36
+ .description("Create a new list")
37
+ .argument("<object-slug>", "Object slug")
38
+ .requiredOption("--name <name>", "List name")
39
+ .requiredOption("--slug <slug>", "List slug")
40
+ .option("--description <description>", "List description")
41
+ .action(async (objectSlug, opts) => {
42
+ const { client, format } = getClient();
43
+ const body = { name: opts.name, slug: opts.slug };
44
+ if (opts.description)
45
+ body.description = opts.description;
46
+ const result = await client.post(`/v1/objects/${encodeURIComponent(objectSlug)}/lists`, body);
47
+ printOutput(result, format);
48
+ });
49
+ list
50
+ .command("delete")
51
+ .description("Delete a list")
52
+ .argument("<id>", "List ID")
53
+ .action(async (id) => {
54
+ const { client, format } = getClient();
55
+ const result = await client.delete(`/v1/lists/${encodeURIComponent(id)}`);
56
+ printOutput(result, format);
57
+ });
58
+ list
59
+ .command("add-member")
60
+ .description("Add a member to a list")
61
+ .argument("<list-id>", "List ID")
62
+ .requiredOption("--parent <record-id>", "Parent record ID")
63
+ .option("--data <json>", "Attributes as JSON string")
64
+ .action(async (listId, opts) => {
65
+ const { client, format } = getClient();
66
+ const body = { parent_id: opts.parent };
67
+ if (opts.data) {
68
+ try {
69
+ body.attributes = JSON.parse(opts.data);
70
+ }
71
+ catch {
72
+ throw new Error(`Invalid JSON for --data: ${opts.data}`);
73
+ }
74
+ }
75
+ const result = await client.post(`/v1/lists/${encodeURIComponent(listId)}`, body);
76
+ printOutput(result, format);
77
+ });
78
+ list
79
+ .command("upsert-member")
80
+ .description("Upsert a member in a list")
81
+ .argument("<list-id>", "List ID")
82
+ .requiredOption("--parent <record-id>", "Parent record ID")
83
+ .option("--data <json>", "Attributes as JSON string")
84
+ .action(async (listId, opts) => {
85
+ const { client, format } = getClient();
86
+ const body = { parent_id: opts.parent };
87
+ if (opts.data) {
88
+ try {
89
+ body.attributes = JSON.parse(opts.data);
90
+ }
91
+ catch {
92
+ throw new Error(`Invalid JSON for --data: ${opts.data}`);
93
+ }
94
+ }
95
+ const result = await client.put(`/v1/lists/${encodeURIComponent(listId)}`, body);
96
+ printOutput(result, format);
97
+ });
98
+ list
99
+ .command("records")
100
+ .description("List records in a list")
101
+ .argument("<list-id>", "List ID")
102
+ .option("--limit <n>", "Max records to return")
103
+ .option("--offset <n>", "Offset for pagination")
104
+ .option("--attributes <level>", "Attribute detail: all, primary, none", "primary")
105
+ .option("--sort <sort>", "Sort as attr:dir")
106
+ .action(async (listId, opts) => {
107
+ const { client, format } = getClient();
108
+ const body = { attributes: opts.attributes ?? "primary" };
109
+ if (opts.limit)
110
+ body.limit = parseInt(opts.limit, 10);
111
+ if (opts.offset)
112
+ body.offset = parseInt(opts.offset, 10);
113
+ if (opts.sort) {
114
+ const [attribute, direction] = opts.sort.split(":");
115
+ body.sort = { attribute, direction };
116
+ }
117
+ const result = await client.post(`/v1/lists/${encodeURIComponent(listId)}/records`, body);
118
+ printOutput(result, format);
119
+ });
120
+ list
121
+ .command("update-record")
122
+ .description("Update a record in a list")
123
+ .argument("<list-id>", "List ID")
124
+ .argument("<record-id>", "Record ID")
125
+ .requiredOption("--data <json>", "Attributes as JSON string")
126
+ .action(async (listId, recordId, opts) => {
127
+ const { client, format } = getClient();
128
+ let attributes;
129
+ try {
130
+ attributes = JSON.parse(opts.data);
131
+ }
132
+ catch {
133
+ throw new Error(`Invalid JSON for --data: ${opts.data}`);
134
+ }
135
+ const result = await client.patch(`/v1/lists/${encodeURIComponent(listId)}/records/${encodeURIComponent(recordId)}`, { attributes });
136
+ printOutput(result, format);
137
+ });
138
+ list
139
+ .command("remove-record")
140
+ .description("Remove a record from a list")
141
+ .argument("<list-id>", "List ID")
142
+ .argument("<record-id>", "Record ID")
143
+ .action(async (listId, recordId) => {
144
+ const { client, format } = getClient();
145
+ const result = await client.delete(`/v1/lists/${encodeURIComponent(listId)}/records/${encodeURIComponent(recordId)}`);
146
+ printOutput(result, format);
147
+ });
148
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE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AAkB,CAAC,MAAM,CAAC,YAAY,kBAAkB,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IACrI,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEL,IAAI;KACD,OAAO,CAAC,eAAe,CAAC;KACxB,WAAW,CAAC,6BAA6B,CAAC;KAC1C,QAAQ,CAAC,WAAW,EAAE,SAAS,CAAC;KAChC,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC;KACpC,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,QAAgB,EAAE,EAAE;IACjD,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IACvC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,aAAa,kBAAkB,CAAC,MAAM,CAAC,YAAY,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACtH,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * nex note — CRUD operations for notes.
3
+ */
4
+ export {};
@@ -0,0 +1,77 @@
1
+ /**
2
+ * nex note — CRUD operations for notes.
3
+ */
4
+ import { program } from "../cli.js";
5
+ import { NexClient } from "../lib/client.js";
6
+ import { resolveApiKey, resolveFormat, resolveTimeout } from "../lib/config.js";
7
+ import { printOutput } from "../lib/output.js";
8
+ function getClient() {
9
+ const opts = program.opts();
10
+ const client = new NexClient(resolveApiKey(opts.apiKey), resolveTimeout(opts.timeout));
11
+ return { client, format: resolveFormat(opts.format) };
12
+ }
13
+ const note = program.command("note").description("Manage notes");
14
+ note
15
+ .command("list")
16
+ .description("List notes")
17
+ .option("--entity <id>", "Filter by entity ID")
18
+ .action(async (opts) => {
19
+ const { client, format } = getClient();
20
+ const params = opts.entity ? `?entity_id=${encodeURIComponent(opts.entity)}` : "";
21
+ const result = await client.get(`/v1/notes${params}`);
22
+ printOutput(result, format);
23
+ });
24
+ note
25
+ .command("get")
26
+ .description("Get a note by ID")
27
+ .argument("<id>", "Note ID")
28
+ .action(async (id) => {
29
+ const { client, format } = getClient();
30
+ const result = await client.get(`/v1/notes/${encodeURIComponent(id)}`);
31
+ printOutput(result, format);
32
+ });
33
+ note
34
+ .command("create")
35
+ .description("Create a note")
36
+ .requiredOption("--title <title>", "Note title")
37
+ .option("--content <content>", "Note content")
38
+ .option("--entity <id>", "Entity ID to attach to")
39
+ .action(async (opts) => {
40
+ const { client, format } = getClient();
41
+ const body = { title: opts.title };
42
+ if (opts.content)
43
+ body.content = opts.content;
44
+ if (opts.entity)
45
+ body.entity_id = opts.entity;
46
+ const result = await client.post("/v1/notes", body);
47
+ printOutput(result, format);
48
+ });
49
+ note
50
+ .command("update")
51
+ .description("Update a note")
52
+ .argument("<id>", "Note ID")
53
+ .option("--title <title>", "New title")
54
+ .option("--content <content>", "New content")
55
+ .option("--entity <id>", "Change associated entity")
56
+ .action(async (id, opts) => {
57
+ const { client, format } = getClient();
58
+ const body = {};
59
+ if (opts.title !== undefined)
60
+ body.title = opts.title;
61
+ if (opts.content !== undefined)
62
+ body.content = opts.content;
63
+ if (opts.entity !== undefined)
64
+ body.entity_id = opts.entity;
65
+ const result = await client.patch(`/v1/notes/${encodeURIComponent(id)}`, body);
66
+ printOutput(result, format);
67
+ });
68
+ note
69
+ .command("delete")
70
+ .description("Delete a note")
71
+ .argument("<id>", "Note ID")
72
+ .action(async (id) => {
73
+ const { client, format } = getClient();
74
+ const result = await client.delete(`/v1/notes/${encodeURIComponent(id)}`);
75
+ printOutput(result, format);
76
+ });
77
+ //# sourceMappingURL=note.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"note.js","sourceRoot":"","sources":["../../src/commands/note.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,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AE,0BAA0B,CAAC;KACnD,MAAM,CAAC,KAAK,EAAE,EAAU,EAAE,IAA2D,EAAE,EAAE;IACxF,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IACvC,MAAM,IAAI,GAA4B,EAAE,CAAC;IACzC,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;QAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IACtD,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS;QAAE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC5D,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;QAAE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC;IAC5D,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,aAAa,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAC/E,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEL,IAAI;KACD,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,eAAe,CAAC;KAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;KAC3B,MAAM,CAAC,KAAK,EAAE,EAAU,EAAE,EAAE;IAC3B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IACvC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,aAAa,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC1E,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * nex object — CRUD operations for object definitions.
3
+ */
4
+ export {};
@@ -0,0 +1,78 @@
1
+ /**
2
+ * nex object — CRUD operations for object definitions.
3
+ */
4
+ import { program } from "../cli.js";
5
+ import { NexClient } from "../lib/client.js";
6
+ import { resolveApiKey, resolveFormat, resolveTimeout } from "../lib/config.js";
7
+ import { printOutput } from "../lib/output.js";
8
+ function getClient() {
9
+ const opts = program.opts();
10
+ const client = new NexClient(resolveApiKey(opts.apiKey), resolveTimeout(opts.timeout));
11
+ return { client, format: resolveFormat(opts.format) };
12
+ }
13
+ const obj = program.command("object").description("Manage object definitions");
14
+ obj
15
+ .command("list")
16
+ .description("List all objects")
17
+ .option("--include-attributes", "Include attributes in response")
18
+ .action(async (opts) => {
19
+ const { client, format } = getClient();
20
+ const params = opts.includeAttributes ? "?include_attributes=true" : "";
21
+ const result = await client.get(`/v1/objects${params}`);
22
+ printOutput(result, format);
23
+ });
24
+ obj
25
+ .command("get")
26
+ .description("Get an object by slug")
27
+ .argument("<slug>", "Object slug")
28
+ .action(async (slug) => {
29
+ const { client, format } = getClient();
30
+ const result = await client.get(`/v1/objects/${encodeURIComponent(slug)}`);
31
+ printOutput(result, format);
32
+ });
33
+ obj
34
+ .command("create")
35
+ .description("Create a new object")
36
+ .requiredOption("--name <name>", "Object name")
37
+ .requiredOption("--slug <slug>", "Object slug")
38
+ .option("--type <type>", "Object type: person, company, custom, deal")
39
+ .option("--description <description>", "Object description")
40
+ .action(async (opts) => {
41
+ const { client, format } = getClient();
42
+ const body = { name: opts.name, slug: opts.slug };
43
+ if (opts.type)
44
+ body.type = opts.type;
45
+ if (opts.description)
46
+ body.description = opts.description;
47
+ const result = await client.post("/v1/objects", body);
48
+ printOutput(result, format);
49
+ });
50
+ obj
51
+ .command("update")
52
+ .description("Update an object")
53
+ .argument("<slug>", "Object slug")
54
+ .option("--name <name>", "New name")
55
+ .option("--description <description>", "New description")
56
+ .option("--name-plural <plural>", "New plural name")
57
+ .action(async (slug, opts) => {
58
+ const { client, format } = getClient();
59
+ const body = {};
60
+ if (opts.name !== undefined)
61
+ body.name = opts.name;
62
+ if (opts.namePlural !== undefined)
63
+ body.name_plural = opts.namePlural;
64
+ if (opts.description !== undefined)
65
+ body.description = opts.description;
66
+ const result = await client.patch(`/v1/objects/${encodeURIComponent(slug)}`, body);
67
+ printOutput(result, format);
68
+ });
69
+ obj
70
+ .command("delete")
71
+ .description("Delete an object")
72
+ .argument("<slug>", "Object slug")
73
+ .action(async (slug) => {
74
+ const { client, format } = getClient();
75
+ const result = await client.delete(`/v1/objects/${encodeURIComponent(slug)}`);
76
+ printOutput(result, format);
77
+ });
78
+ //# sourceMappingURL=object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../../src/commands/object.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,SAAS,SAAS;IAChB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACvF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAW,EAAE,CAAC;AAClE,CAAC;AAED,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC;AAE/E,GAAG;KACA,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,kBAAkB,CAAC;KAC/B,MAAM,CAAC,sBAAsB,EAAE,gCAAgC,CAAC;KAChE,MAAM,CAAC,KAAK,EAAE,IAAqC,EAAE,EAAE;IACtD,MAAM,EAAE,MAAM,EAAE,MAAM,E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