@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.
- package/README.md +228 -0
- package/dist/cli.d.ts +5 -0
- package/dist/cli.js +18 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/attribute.d.ts +4 -0
- package/dist/commands/attribute.js +75 -0
- package/dist/commands/attribute.js.map +1 -0
- package/dist/commands/config-cmd.d.ts +4 -0
- package/dist/commands/config-cmd.js +53 -0
- package/dist/commands/config-cmd.js.map +1 -0
- package/dist/commands/context.d.ts +4 -0
- package/dist/commands/context.js +135 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/insight.d.ts +4 -0
- package/dist/commands/insight.js +39 -0
- package/dist/commands/insight.js.map +1 -0
- package/dist/commands/integrate.d.ts +4 -0
- package/dist/commands/integrate.js +136 -0
- package/dist/commands/integrate.js.map +1 -0
- package/dist/commands/list-job.d.ts +4 -0
- package/dist/commands/list-job.js +41 -0
- package/dist/commands/list-job.js.map +1 -0
- package/dist/commands/list.d.ts +4 -0
- package/dist/commands/list.js +148 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/note.d.ts +4 -0
- package/dist/commands/note.js +77 -0
- package/dist/commands/note.js.map +1 -0
- package/dist/commands/object.d.ts +4 -0
- package/dist/commands/object.js +78 -0
- package/dist/commands/object.js.map +1 -0
- package/dist/commands/record.d.ts +4 -0
- package/dist/commands/record.js +126 -0
- package/dist/commands/record.js.map +1 -0
- package/dist/commands/register.d.ts +4 -0
- package/dist/commands/register.js +23 -0
- package/dist/commands/register.js.map +1 -0
- package/dist/commands/relationship.d.ts +4 -0
- package/dist/commands/relationship.js +80 -0
- package/dist/commands/relationship.js.map +1 -0
- package/dist/commands/scan.d.ts +4 -0
- package/dist/commands/scan.js +58 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/search.d.ts +4 -0
- package/dist/commands/search.js +22 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/session.d.ts +4 -0
- package/dist/commands/session.js +31 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/setup.d.ts +10 -0
- package/dist/commands/setup.js +254 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/task.d.ts +4 -0
- package/dist/commands/task.js +114 -0
- package/dist/commands/task.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +68 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/capture-filter.d.ts +9 -0
- package/dist/lib/capture-filter.js +14 -0
- package/dist/lib/capture-filter.js.map +1 -0
- package/dist/lib/client.d.ts +19 -0
- package/dist/lib/client.js +115 -0
- package/dist/lib/client.js.map +1 -0
- package/dist/lib/config.d.ts +34 -0
- package/dist/lib/config.js +59 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/context-format.d.ts +7 -0
- package/dist/lib/context-format.js +21 -0
- package/dist/lib/context-format.js.map +1 -0
- package/dist/lib/errors.d.ts +18 -0
- package/dist/lib/errors.js +30 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/file-scanner.d.ts +38 -0
- package/dist/lib/file-scanner.js +178 -0
- package/dist/lib/file-scanner.js.map +1 -0
- package/dist/lib/installers.d.ts +19 -0
- package/dist/lib/installers.js +205 -0
- package/dist/lib/installers.js.map +1 -0
- package/dist/lib/output.d.ts +7 -0
- package/dist/lib/output.js +50 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/platform-detect.d.ts +16 -0
- package/dist/lib/platform-detect.js +188 -0
- package/dist/lib/platform-detect.js.map +1 -0
- package/dist/lib/project-config.d.ts +53 -0
- package/dist/lib/project-config.js +151 -0
- package/dist/lib/project-config.js.map +1 -0
- package/dist/lib/prompt.d.ts +4 -0
- package/dist/lib/prompt.js +21 -0
- package/dist/lib/prompt.js.map +1 -0
- package/dist/lib/rate-limiter.d.ts +13 -0
- package/dist/lib/rate-limiter.js +49 -0
- package/dist/lib/rate-limiter.js.map +1 -0
- package/dist/lib/recall-filter.d.ts +6 -0
- package/dist/lib/recall-filter.js +58 -0
- package/dist/lib/recall-filter.js.map +1 -0
- package/dist/lib/session-store.d.ts +15 -0
- package/dist/lib/session-store.js +62 -0
- package/dist/lib/session-store.js.map +1 -0
- package/package.json +32 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* nex record — CRUD operations for 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 rec = program.command("record").description("Manage records");
|
|
14
|
+
rec
|
|
15
|
+
.command("list")
|
|
16
|
+
.description("List records for an object")
|
|
17
|
+
.argument("<object-slug>", "Object slug")
|
|
18
|
+
.option("--limit <n>", "Max records to return")
|
|
19
|
+
.option("--offset <n>", "Offset for pagination")
|
|
20
|
+
.option("--attributes <level>", "Attribute detail: all, primary, none", "primary")
|
|
21
|
+
.option("--sort <sort>", "Sort as attr:asc or attr:desc")
|
|
22
|
+
.action(async (objectSlug, opts) => {
|
|
23
|
+
const { client, format } = getClient();
|
|
24
|
+
const body = { attributes: opts.attributes ?? "primary" };
|
|
25
|
+
if (opts.limit)
|
|
26
|
+
body.limit = parseInt(opts.limit, 10);
|
|
27
|
+
if (opts.offset)
|
|
28
|
+
body.offset = parseInt(opts.offset, 10);
|
|
29
|
+
if (opts.sort) {
|
|
30
|
+
const [attribute, direction] = opts.sort.split(":");
|
|
31
|
+
body.sort = { attribute, direction };
|
|
32
|
+
}
|
|
33
|
+
const result = await client.post(`/v1/objects/${encodeURIComponent(objectSlug)}/records`, body);
|
|
34
|
+
printOutput(result, format);
|
|
35
|
+
});
|
|
36
|
+
rec
|
|
37
|
+
.command("get")
|
|
38
|
+
.description("Get a record by ID")
|
|
39
|
+
.argument("<id>", "Record ID")
|
|
40
|
+
.action(async (id) => {
|
|
41
|
+
const { client, format } = getClient();
|
|
42
|
+
const result = await client.get(`/v1/records/${encodeURIComponent(id)}`);
|
|
43
|
+
printOutput(result, format);
|
|
44
|
+
});
|
|
45
|
+
rec
|
|
46
|
+
.command("create")
|
|
47
|
+
.description("Create a record")
|
|
48
|
+
.argument("<object-slug>", "Object slug")
|
|
49
|
+
.requiredOption("--data <json>", "Attributes as JSON string")
|
|
50
|
+
.action(async (objectSlug, opts) => {
|
|
51
|
+
const { client, format } = getClient();
|
|
52
|
+
let attributes;
|
|
53
|
+
try {
|
|
54
|
+
attributes = JSON.parse(opts.data);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
throw new Error(`Invalid JSON for --data: ${opts.data}`);
|
|
58
|
+
}
|
|
59
|
+
const result = await client.post(`/v1/objects/${encodeURIComponent(objectSlug)}`, { attributes });
|
|
60
|
+
printOutput(result, format);
|
|
61
|
+
});
|
|
62
|
+
rec
|
|
63
|
+
.command("upsert")
|
|
64
|
+
.description("Upsert a record")
|
|
65
|
+
.argument("<object-slug>", "Object slug")
|
|
66
|
+
.requiredOption("--match <attr>", "Matching attribute for upsert")
|
|
67
|
+
.requiredOption("--data <json>", "Attributes as JSON string")
|
|
68
|
+
.action(async (objectSlug, opts) => {
|
|
69
|
+
const { client, format } = getClient();
|
|
70
|
+
let attributes;
|
|
71
|
+
try {
|
|
72
|
+
attributes = JSON.parse(opts.data);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
throw new Error(`Invalid JSON for --data: ${opts.data}`);
|
|
76
|
+
}
|
|
77
|
+
const result = await client.put(`/v1/objects/${encodeURIComponent(objectSlug)}`, {
|
|
78
|
+
matching_attribute: opts.match,
|
|
79
|
+
attributes,
|
|
80
|
+
});
|
|
81
|
+
printOutput(result, format);
|
|
82
|
+
});
|
|
83
|
+
rec
|
|
84
|
+
.command("update")
|
|
85
|
+
.description("Update a record")
|
|
86
|
+
.argument("<id>", "Record ID")
|
|
87
|
+
.requiredOption("--data <json>", "Attributes as JSON string")
|
|
88
|
+
.action(async (id, opts) => {
|
|
89
|
+
const { client, format } = getClient();
|
|
90
|
+
let attributes;
|
|
91
|
+
try {
|
|
92
|
+
attributes = JSON.parse(opts.data);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
throw new Error(`Invalid JSON for --data: ${opts.data}`);
|
|
96
|
+
}
|
|
97
|
+
const result = await client.patch(`/v1/records/${encodeURIComponent(id)}`, { attributes });
|
|
98
|
+
printOutput(result, format);
|
|
99
|
+
});
|
|
100
|
+
rec
|
|
101
|
+
.command("delete")
|
|
102
|
+
.description("Delete a record")
|
|
103
|
+
.argument("<id>", "Record ID")
|
|
104
|
+
.action(async (id) => {
|
|
105
|
+
const { client, format } = getClient();
|
|
106
|
+
const result = await client.delete(`/v1/records/${encodeURIComponent(id)}`);
|
|
107
|
+
printOutput(result, format);
|
|
108
|
+
});
|
|
109
|
+
rec
|
|
110
|
+
.command("timeline")
|
|
111
|
+
.description("Get record timeline")
|
|
112
|
+
.argument("<id>", "Record ID")
|
|
113
|
+
.option("--limit <n>", "Max entries")
|
|
114
|
+
.option("--cursor <cursor>", "Pagination cursor")
|
|
115
|
+
.action(async (id, opts) => {
|
|
116
|
+
const { client, format } = getClient();
|
|
117
|
+
const params = new URLSearchParams();
|
|
118
|
+
if (opts.limit)
|
|
119
|
+
params.set("limit", opts.limit);
|
|
120
|
+
if (opts.cursor)
|
|
121
|
+
params.set("cursor", opts.cursor);
|
|
122
|
+
const qs = params.toString();
|
|
123
|
+
const result = await client.get(`/v1/records/${encodeURIComponent(id)}/timeline${qs ? `?${qs}` : ""}`);
|
|
124
|
+
printOutput(result, format);
|
|
125
|
+
});
|
|
126
|
+
//# sourceMappingURL=record.js.map
|
|
@@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C;IAC5E,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEL,GAAG;KACA,OAAO,CAAC,UAAU,CAAC;KACnB,WAAW,CAAC,qBAAqB,CAAC;KAClC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;KAC7B,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC;KACpC,MAAM,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;KAChD,MAAM,CAAC,KAAK,EAAE,EAAU,EAAE,IAAyC,EAAE,EAAE;IACtE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IACvC,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;IACrC,IAAI,IAAI,CAAC,KAAK;QAAE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAChD,IAAI,IAAI,CAAC,MAAM;QAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACnD,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,eAAe,kBAAkB,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACvG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* nex register — register a new developer account.
|
|
3
|
+
*/
|
|
4
|
+
import { program } from "../cli.js";
|
|
5
|
+
import { NexClient } from "../lib/client.js";
|
|
6
|
+
import { persistRegistration, resolveTimeout } from "../lib/config.js";
|
|
7
|
+
import { printOutput } from "../lib/output.js";
|
|
8
|
+
import { resolveFormat } from "../lib/config.js";
|
|
9
|
+
program
|
|
10
|
+
.command("register")
|
|
11
|
+
.description("Register a new Nex developer account")
|
|
12
|
+
.requiredOption("--email <email>", "Email address")
|
|
13
|
+
.option("--name <name>", "Your name")
|
|
14
|
+
.option("--company <company>", "Company name")
|
|
15
|
+
.action(async (opts) => {
|
|
16
|
+
const globalOpts = program.opts();
|
|
17
|
+
const client = new NexClient(undefined, resolveTimeout(globalOpts.timeout));
|
|
18
|
+
const format = resolveFormat(globalOpts.format);
|
|
19
|
+
const data = await client.register(opts.email, opts.name, opts.company);
|
|
20
|
+
persistRegistration(data);
|
|
21
|
+
printOutput(data, format);
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/commands/register.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO;KACJ,OAAO,CAAC,UAAU,CAAC;KACnB,WAAW,CAAC,sCAAsC,CAAC;KACnD,cAAc,CAAC,iBAAiB,EAAE,eAAe,CAAC;KAClD,MAAM,CAAC,eAAe,EAAE,WAAW,CAAC;KACpC,MAAM,CAAC,qBAAqB,EAAE,cAAc,CAAC;KAC7C,MAAM,CAAC,KAAK,EAAE,IAAwD,EAAE,EAAE;IACzE,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,SAAS,EAAE,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,aAAa,CAAC,UAAU,CAAC,MAAM,CAAW,CAAC;IAE1D,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACxE,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC1B,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC5B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* nex rel — manage relationship definitions and instances.
|
|
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 rel = program.command("rel").description("Manage relationships");
|
|
14
|
+
rel
|
|
15
|
+
.command("list-defs")
|
|
16
|
+
.description("List relationship definitions")
|
|
17
|
+
.action(async () => {
|
|
18
|
+
const { client, format } = getClient();
|
|
19
|
+
const result = await client.get("/v1/relationships");
|
|
20
|
+
printOutput(result, format);
|
|
21
|
+
});
|
|
22
|
+
rel
|
|
23
|
+
.command("create-def")
|
|
24
|
+
.description("Create a relationship definition")
|
|
25
|
+
.requiredOption("--type <type>", "Relationship type: one_to_one, one_to_many, many_to_many")
|
|
26
|
+
.requiredOption("--entity1 <id>", "Entity definition 1 ID")
|
|
27
|
+
.requiredOption("--entity2 <id>", "Entity definition 2 ID")
|
|
28
|
+
.option("--pred12 <predicate>", "Entity 1 to 2 predicate")
|
|
29
|
+
.option("--pred21 <predicate>", "Entity 2 to 1 predicate")
|
|
30
|
+
.action(async (opts) => {
|
|
31
|
+
const { client, format } = getClient();
|
|
32
|
+
const body = {
|
|
33
|
+
type: opts.type,
|
|
34
|
+
entity_definition_1_id: opts.entity1,
|
|
35
|
+
entity_definition_2_id: opts.entity2,
|
|
36
|
+
};
|
|
37
|
+
if (opts.pred12)
|
|
38
|
+
body.entity_1_to_2_predicate = opts.pred12;
|
|
39
|
+
if (opts.pred21)
|
|
40
|
+
body.entity_2_to_1_predicate = opts.pred21;
|
|
41
|
+
const result = await client.post("/v1/relationships", body);
|
|
42
|
+
printOutput(result, format);
|
|
43
|
+
});
|
|
44
|
+
rel
|
|
45
|
+
.command("delete-def")
|
|
46
|
+
.description("Delete a relationship definition")
|
|
47
|
+
.argument("<id>", "Relationship definition ID")
|
|
48
|
+
.action(async (id) => {
|
|
49
|
+
const { client, format } = getClient();
|
|
50
|
+
const result = await client.delete(`/v1/relationships/${encodeURIComponent(id)}`);
|
|
51
|
+
printOutput(result, format);
|
|
52
|
+
});
|
|
53
|
+
rel
|
|
54
|
+
.command("create")
|
|
55
|
+
.description("Create a relationship between records")
|
|
56
|
+
.argument("<record-id>", "Record ID")
|
|
57
|
+
.requiredOption("--def <id>", "Relationship definition ID")
|
|
58
|
+
.requiredOption("--entity1 <id>", "Entity 1 ID")
|
|
59
|
+
.requiredOption("--entity2 <id>", "Entity 2 ID")
|
|
60
|
+
.action(async (recordId, opts) => {
|
|
61
|
+
const { client, format } = getClient();
|
|
62
|
+
const body = {
|
|
63
|
+
definition_id: opts.def,
|
|
64
|
+
entity_1_id: opts.entity1,
|
|
65
|
+
entity_2_id: opts.entity2,
|
|
66
|
+
};
|
|
67
|
+
const result = await client.post(`/v1/records/${encodeURIComponent(recordId)}/relationships`, body);
|
|
68
|
+
printOutput(result, format);
|
|
69
|
+
});
|
|
70
|
+
rel
|
|
71
|
+
.command("delete")
|
|
72
|
+
.description("Delete a relationship")
|
|
73
|
+
.argument("<record-id>", "Record ID")
|
|
74
|
+
.argument("<rel-id>", "Relationship ID")
|
|
75
|
+
.action(async (recordId, relId) => {
|
|
76
|
+
const { client, format } = getClient();
|
|
77
|
+
const result = await client.delete(`/v1/records/${encodeURIComponent(recordId)}/relationships/${encodeURIComponent(relId)}`);
|
|
78
|
+
printOutput(result, format);
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=relationship.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationship.js","sourceRoot":"","sources":["../../src/commands/relationship.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,KAAK,CAAC,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;AAEvE,GAAG;KACA,OAAO,CAAC,WAAW,CAAC;KACpB,WAAW,CAAC,+BAA+B,CAAC;KAC5C,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IACvC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,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MAAM,CAAC,eAAe,kBAAkB,CAAC,QAAQ,CAAC,kBAAkB,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC7H,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* nex scan [dir] — Scan directory for text files and ingest into Nex.
|
|
3
|
+
*/
|
|
4
|
+
import { program } from "../cli.js";
|
|
5
|
+
import { resolveApiKey, resolveFormat, resolveTimeout } from "../lib/config.js";
|
|
6
|
+
import { NexClient } from "../lib/client.js";
|
|
7
|
+
import { printOutput, printError } from "../lib/output.js";
|
|
8
|
+
import { scanFiles, loadScanConfig, isScanEnabled } from "../lib/file-scanner.js";
|
|
9
|
+
program
|
|
10
|
+
.command("scan")
|
|
11
|
+
.description("Scan a directory for text files and ingest new/changed files into Nex")
|
|
12
|
+
.argument("[dir]", "Directory to scan (default: current directory)", ".")
|
|
13
|
+
.option("--extensions <exts>", "File extensions to scan (comma-separated)")
|
|
14
|
+
.option("--max-files <n>", "Maximum files per scan run")
|
|
15
|
+
.option("--depth <n>", "Maximum directory depth")
|
|
16
|
+
.option("--force", "Re-scan all files (ignore manifest)")
|
|
17
|
+
.option("--dry-run", "Show what would be scanned without ingesting")
|
|
18
|
+
.action(async (dir, opts) => {
|
|
19
|
+
const globalOpts = program.opts();
|
|
20
|
+
const apiKey = resolveApiKey(globalOpts.apiKey);
|
|
21
|
+
const format = resolveFormat(globalOpts.format);
|
|
22
|
+
if (!opts.dryRun && !apiKey) {
|
|
23
|
+
printError("No API key. Run 'nex register --email <email>' first or set NEX_API_KEY.");
|
|
24
|
+
process.exit(2);
|
|
25
|
+
}
|
|
26
|
+
if (!isScanEnabled()) {
|
|
27
|
+
printError("File scanning is disabled (NEX_SCAN_ENABLED=false).");
|
|
28
|
+
process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
const scanOpts = loadScanConfig({
|
|
31
|
+
extensions: opts.extensions?.split(",").map((e) => e.trim()),
|
|
32
|
+
maxFiles: opts.maxFiles ? parseInt(opts.maxFiles, 10) : undefined,
|
|
33
|
+
depth: opts.depth ? parseInt(opts.depth, 10) : undefined,
|
|
34
|
+
force: opts.force,
|
|
35
|
+
dryRun: opts.dryRun,
|
|
36
|
+
});
|
|
37
|
+
const client = new NexClient(apiKey, resolveTimeout(globalOpts.timeout));
|
|
38
|
+
const result = await scanFiles(dir, scanOpts, async (content, context) => {
|
|
39
|
+
return client.post("/v1/context/text", { content, context });
|
|
40
|
+
});
|
|
41
|
+
if (opts.dryRun) {
|
|
42
|
+
printOutput({
|
|
43
|
+
dry_run: true,
|
|
44
|
+
would_scan: result.scanned,
|
|
45
|
+
would_skip: result.skipped,
|
|
46
|
+
files: result.files,
|
|
47
|
+
}, format);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
printOutput({
|
|
51
|
+
scanned: result.scanned,
|
|
52
|
+
skipped: result.skipped,
|
|
53
|
+
errors: result.errors,
|
|
54
|
+
files: result.files,
|
|
55
|
+
}, format);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=scan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan.js","sourceRoot":"","sources":["../../src/commands/scan.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGlF,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,u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I,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;QACxD,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM,EAAE,IAAI,CAAC,MAAM;KACpB,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IAEzE,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QACvE,OAAO,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,WAAW,CACT;YACE,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,MAAM,CAAC,OAAO;YAC1B,UAAU,EAAE,MAAM,CAAC,OAAO;YAC1B,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,EACD,MAAM,CACP,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,WAAW,CACT;YACE,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,EACD,MAAM,CACP,CAAC;IACJ,CAAC;AACH,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* nex search — search across your Nex context.
|
|
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
|
+
program
|
|
14
|
+
.command("search")
|
|
15
|
+
.description("Search across your Nex context")
|
|
16
|
+
.argument("<query>", "Search query")
|
|
17
|
+
.action(async (query) => {
|
|
18
|
+
const { client, format } = getClient();
|
|
19
|
+
const result = await client.post("/v1/search", { query });
|
|
20
|
+
printOutput(result, format);
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/commands/search.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,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,gCAAgC,CAAC;KAC7C,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;KACnC,MAAM,CAAC,KAAK,EAAE,KAAa,EAAE,EAAE;IAC9B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IACvC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1D,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session commands: list, clear.
|
|
3
|
+
*/
|
|
4
|
+
import { program } from "../cli.js";
|
|
5
|
+
import { SessionStore } from "../lib/session-store.js";
|
|
6
|
+
import { resolveFormat } from "../lib/config.js";
|
|
7
|
+
import { printOutput } from "../lib/output.js";
|
|
8
|
+
const session = program
|
|
9
|
+
.command("session")
|
|
10
|
+
.description("Manage CLI session mappings");
|
|
11
|
+
session
|
|
12
|
+
.command("list")
|
|
13
|
+
.description("List all stored session mappings")
|
|
14
|
+
.action(() => {
|
|
15
|
+
const store = new SessionStore();
|
|
16
|
+
const sessions = store.list();
|
|
17
|
+
const opts = program.opts();
|
|
18
|
+
const format = resolveFormat(opts.format);
|
|
19
|
+
printOutput(sessions, format);
|
|
20
|
+
});
|
|
21
|
+
session
|
|
22
|
+
.command("clear")
|
|
23
|
+
.description("Clear all stored session mappings")
|
|
24
|
+
.action(() => {
|
|
25
|
+
const store = new SessionStore();
|
|
26
|
+
store.clear();
|
|
27
|
+
const opts = program.opts();
|
|
28
|
+
const format = resolveFormat(opts.format);
|
|
29
|
+
printOutput({ message: "All sessions cleared." }, format);
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/commands/session.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,MAAM,OAAO,GAAG,OAAO;KACpB,OAAO,CAAC,SAAS,CAAC;KAClB,WAAW,CAAC,6BAA6B,CAAC,CAAC;AAE9C,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,kCAAkC,CAAC;KAC/C,MAAM,CAAC,GAAG,EAAE;IACX,MAAM,KAAK,GAAG,IAAI,YAAY,EAAE,CAAC;IACjC,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAW,CAAC;IACpD,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAChC,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,mCAAmC,CAAC;KAChD,MAAM,CAAC,GAAG,EAAE;IACX,MAAM,KAAK,GAAG,IAAI,YAAY,EAAE,CAAC;IACjC,KAAK,CAAC,KAAK,EAAE,CAAC;IACd,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAW,CAAC;IACpD,WAAW,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,EAAE,MAAM,CAAC,CAAC;AAC5D,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `nex setup` command — detect platforms, install plugin/MCP, create .nex.toml.
|
|
3
|
+
*
|
|
4
|
+
* nex setup Interactive: detect → install plugin + config
|
|
5
|
+
* nex setup --platform <name> Direct install for specific platform
|
|
6
|
+
* nex setup --with-mcp Also install MCP server
|
|
7
|
+
* nex setup --no-plugin Skip hooks/commands, only config files
|
|
8
|
+
* nex setup status Show install status + integration connections
|
|
9
|
+
*/
|
|
10
|
+
export {};
|