@itznexus/itznexus-cli 0.0.0 → 1.1.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/dist/commands/agents/upwork.d.ts +2 -0
- package/dist/commands/agents/upwork.js +276 -0
- package/dist/commands/agents/upwork.js.map +1 -0
- package/dist/commands/auth.js +5 -8
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/health.js +5 -2
- package/dist/commands/health.js.map +1 -1
- package/dist/commands/interaction.js.map +1 -1
- package/dist/commands/pipeline.js.map +1 -1
- package/dist/index.js +46 -5
- package/dist/index.js.map +1 -1
- package/dist/lib/config.js +1 -1
- package/package.json +2 -2
- package/dist/commands/company.d.ts +0 -2
- package/dist/commands/company.js +0 -193
- package/dist/commands/company.js.map +0 -1
- package/dist/commands/contact.d.ts +0 -2
- package/dist/commands/contact.js +0 -142
- package/dist/commands/contact.js.map +0 -1
- package/dist/commands/conversation.d.ts +0 -2
- package/dist/commands/conversation.js +0 -217
- package/dist/commands/conversation.js.map +0 -1
- package/dist/skills/claude-code/itznexus-auth.md +0 -61
- package/dist/skills/claude-code/itznexus-company.md +0 -143
- package/dist/skills/claude-code/itznexus-contact.md +0 -109
- package/dist/skills/claude-code/itznexus-conversation.md +0 -146
- package/dist/skills/claude-code/itznexus-lead.md +0 -146
- package/dist/skills/claude-code/itznexus-project.md +0 -115
- package/dist/skills/claude-code/itznexus-sprint.md +0 -126
- package/dist/skills/claude-code/itznexus-task.md +0 -159
- package/dist/skills/claude-code/itznexus-user.md +0 -66
- package/dist/skills/openclaw-tools.json +0 -1404
package/dist/commands/company.js
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import chalk from "chalk";
|
|
3
|
-
import { api } from "../lib/api.js";
|
|
4
|
-
import { printList, printDetail, handleError } from "../lib/format.js";
|
|
5
|
-
// --- list ---
|
|
6
|
-
const listCommand = new Command("list")
|
|
7
|
-
.description("List all companies")
|
|
8
|
-
.option("--status <status>", "Filter by status (active, inactive, churned)")
|
|
9
|
-
.option("--search <query>", "Search by name")
|
|
10
|
-
.option("--json", "Output as JSON")
|
|
11
|
-
.action(async (opts) => {
|
|
12
|
-
try {
|
|
13
|
-
const params = new URLSearchParams();
|
|
14
|
-
if (opts.status)
|
|
15
|
-
params.set("status", opts.status);
|
|
16
|
-
if (opts.search)
|
|
17
|
-
params.set("search", opts.search);
|
|
18
|
-
const qs = params.toString();
|
|
19
|
-
const data = await api.get(`/companies${qs ? `?${qs}` : ""}`);
|
|
20
|
-
printList(data, [
|
|
21
|
-
{ key: "name", label: "Name", width: 30 },
|
|
22
|
-
{ key: "status", label: "Status", width: 12 },
|
|
23
|
-
{ key: "referral", label: "Referral", width: 20 },
|
|
24
|
-
{ key: "contactCount", label: "Contacts", width: 10 },
|
|
25
|
-
{ key: "createdAt", label: "Created", width: 24 },
|
|
26
|
-
], opts);
|
|
27
|
-
}
|
|
28
|
-
catch (err) {
|
|
29
|
-
handleError(err);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
// --- get ---
|
|
33
|
-
const getCommand = new Command("get")
|
|
34
|
-
.description("Get company details")
|
|
35
|
-
.argument("<id>", "Company ID")
|
|
36
|
-
.option("--json", "Output as JSON")
|
|
37
|
-
.action(async (id, opts) => {
|
|
38
|
-
try {
|
|
39
|
-
const data = await api.get(`/companies/${id}`);
|
|
40
|
-
if (opts.json) {
|
|
41
|
-
console.log(JSON.stringify(data, null, 2));
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
console.log(chalk.bold(data.name));
|
|
45
|
-
printDetail(data, [
|
|
46
|
-
{ key: "id", label: "ID" },
|
|
47
|
-
{ key: "status", label: "Status" },
|
|
48
|
-
{ key: "website", label: "Website" },
|
|
49
|
-
{ key: "referral", label: "Referral" },
|
|
50
|
-
{ key: "notes", label: "Notes" },
|
|
51
|
-
{ key: "createdAt", label: "Created" },
|
|
52
|
-
{ key: "updatedAt", label: "Updated" },
|
|
53
|
-
], opts);
|
|
54
|
-
if (data.contacts.length > 0) {
|
|
55
|
-
console.log(chalk.dim(`\n Contacts (${data.contacts.length}):`));
|
|
56
|
-
for (const c of data.contacts) {
|
|
57
|
-
const role = c.role ? chalk.dim(` (${c.role})`) : "";
|
|
58
|
-
const email = c.email ? chalk.dim(` — ${c.email}`) : "";
|
|
59
|
-
console.log(` ${c.name}${role}${email}`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
catch (err) {
|
|
64
|
-
handleError(err);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
// --- create ---
|
|
68
|
-
const createCommand = new Command("create")
|
|
69
|
-
.description("Create a new company")
|
|
70
|
-
.requiredOption("--name <name>", "Company name")
|
|
71
|
-
.option("--website <url>", "Website URL")
|
|
72
|
-
.option("--referral <source>", "Referral source")
|
|
73
|
-
.option("--status <status>", "Status (active, inactive, churned)", "active")
|
|
74
|
-
.option("--notes <notes>", "Notes (markdown)")
|
|
75
|
-
.option("--json", "Output as JSON")
|
|
76
|
-
.action(async (opts) => {
|
|
77
|
-
try {
|
|
78
|
-
const data = await api.post("/companies", {
|
|
79
|
-
name: opts.name,
|
|
80
|
-
website: opts.website,
|
|
81
|
-
referral: opts.referral,
|
|
82
|
-
status: opts.status,
|
|
83
|
-
notes: opts.notes,
|
|
84
|
-
});
|
|
85
|
-
if (opts.json) {
|
|
86
|
-
console.log(JSON.stringify(data, null, 2));
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
console.log(chalk.green("✓"), `Company created: ${chalk.bold(data.name)} (${data.id})`);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
catch (err) {
|
|
93
|
-
handleError(err);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
// --- update ---
|
|
97
|
-
const updateCommand = new Command("update")
|
|
98
|
-
.description("Update a company")
|
|
99
|
-
.argument("<id>", "Company ID")
|
|
100
|
-
.option("--name <name>", "Company name")
|
|
101
|
-
.option("--website <url>", "Website URL")
|
|
102
|
-
.option("--referral <source>", "Referral source")
|
|
103
|
-
.option("--status <status>", "Status (active, inactive, churned)")
|
|
104
|
-
.option("--notes <notes>", "Notes (markdown)")
|
|
105
|
-
.option("--json", "Output as JSON")
|
|
106
|
-
.action(async (id, opts) => {
|
|
107
|
-
try {
|
|
108
|
-
const { json: _, ...fields } = opts;
|
|
109
|
-
void _;
|
|
110
|
-
const payload = Object.fromEntries(Object.entries(fields).filter(([, v]) => v !== undefined));
|
|
111
|
-
const data = await api.post(`/companies/${id}`, payload);
|
|
112
|
-
if (opts.json) {
|
|
113
|
-
console.log(JSON.stringify(data, null, 2));
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
console.log(chalk.green("✓"), `Company updated: ${chalk.bold(data.name)}`);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
catch (err) {
|
|
120
|
-
handleError(err);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
// --- delete ---
|
|
124
|
-
const deleteCommand = new Command("delete")
|
|
125
|
-
.description("Delete a company")
|
|
126
|
-
.argument("<id>", "Company ID")
|
|
127
|
-
.option("--json", "Output as JSON")
|
|
128
|
-
.action(async (id, opts) => {
|
|
129
|
-
try {
|
|
130
|
-
await api.delete(`/companies/${id}`);
|
|
131
|
-
if (opts.json) {
|
|
132
|
-
console.log(JSON.stringify({ deleted: true, id }));
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
console.log(chalk.green("✓"), "Company deleted");
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
catch (err) {
|
|
139
|
-
handleError(err);
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
// --- link-contact ---
|
|
143
|
-
const linkContactCommand = new Command("link-contact")
|
|
144
|
-
.description("Link a contact to this company")
|
|
145
|
-
.argument("<companyId>", "Company ID")
|
|
146
|
-
.requiredOption("--contact <contactId>", "Contact ID to link")
|
|
147
|
-
.option("--role <role>", "Role at this company (e.g. CTO)")
|
|
148
|
-
.option("--json", "Output as JSON")
|
|
149
|
-
.action(async (companyId, opts) => {
|
|
150
|
-
try {
|
|
151
|
-
const data = await api.post(`/companies/${companyId}/contacts`, { contactId: opts.contact, role: opts.role });
|
|
152
|
-
if (opts.json) {
|
|
153
|
-
console.log(JSON.stringify(data, null, 2));
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
console.log(chalk.green("✓"), "Contact linked to company");
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
catch (err) {
|
|
160
|
-
handleError(err);
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
// --- unlink-contact ---
|
|
164
|
-
const unlinkContactCommand = new Command("unlink-contact")
|
|
165
|
-
.description("Unlink a contact from this company")
|
|
166
|
-
.argument("<companyId>", "Company ID")
|
|
167
|
-
.requiredOption("--contact <contactId>", "Contact ID to unlink")
|
|
168
|
-
.option("--json", "Output as JSON")
|
|
169
|
-
.action(async (companyId, opts) => {
|
|
170
|
-
try {
|
|
171
|
-
await api.delete(`/companies/${companyId}/contacts/${opts.contact}`);
|
|
172
|
-
if (opts.json) {
|
|
173
|
-
console.log(JSON.stringify({ unlinked: true }));
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
console.log(chalk.green("✓"), "Contact unlinked from company");
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
catch (err) {
|
|
180
|
-
handleError(err);
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
// --- parent ---
|
|
184
|
-
export const companyCommand = new Command("company")
|
|
185
|
-
.description("Manage companies")
|
|
186
|
-
.addCommand(listCommand)
|
|
187
|
-
.addCommand(getCommand)
|
|
188
|
-
.addCommand(createCommand)
|
|
189
|
-
.addCommand(updateCommand)
|
|
190
|
-
.addCommand(deleteCommand)
|
|
191
|
-
.addCommand(linkContactCommand)
|
|
192
|
-
.addCommand(unlinkContactCommand);
|
|
193
|
-
//# sourceMappingURL=company.js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WAAW,CAAC;KACvB,UAAU,CAAC,UAAU,CAAC;KACtB,UAAU,CAAC,aAAa,CAAC;KACzB,UAAU,CAAC,aAAa,CAAC;KACzB,UAAU,CAAC,aAAa,CAAC;KACzB,UAAU,CAAC,kBAAkB,CAAC;KAC9B,UAAU,CAAC,oBAAoB,CAAC,CAAC"}
|
package/dist/commands/contact.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import chalk from "chalk";
|
|
3
|
-
import { api } from "../lib/api.js";
|
|
4
|
-
import { printList, printDetail, handleError } from "../lib/format.js";
|
|
5
|
-
// --- list ---
|
|
6
|
-
const listCommand = new Command("list")
|
|
7
|
-
.description("List all contacts")
|
|
8
|
-
.option("--search <query>", "Search by name")
|
|
9
|
-
.option("--json", "Output as JSON")
|
|
10
|
-
.action(async (opts) => {
|
|
11
|
-
try {
|
|
12
|
-
const params = new URLSearchParams();
|
|
13
|
-
if (opts.search)
|
|
14
|
-
params.set("search", opts.search);
|
|
15
|
-
const qs = params.toString();
|
|
16
|
-
const data = await api.get(`/contacts${qs ? `?${qs}` : ""}`);
|
|
17
|
-
printList(data, [
|
|
18
|
-
{ key: "name", label: "Name", width: 25 },
|
|
19
|
-
{ key: "email", label: "Email", width: 30 },
|
|
20
|
-
{ key: "phone", label: "Phone", width: 18 },
|
|
21
|
-
{ key: "companyCount", label: "Companies", width: 10 },
|
|
22
|
-
{ key: "createdAt", label: "Created", width: 24 },
|
|
23
|
-
], opts);
|
|
24
|
-
}
|
|
25
|
-
catch (err) {
|
|
26
|
-
handleError(err);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
// --- get ---
|
|
30
|
-
const getCommand = new Command("get")
|
|
31
|
-
.description("Get contact details")
|
|
32
|
-
.argument("<id>", "Contact ID")
|
|
33
|
-
.option("--json", "Output as JSON")
|
|
34
|
-
.action(async (id, opts) => {
|
|
35
|
-
try {
|
|
36
|
-
const data = await api.get(`/contacts/${id}`);
|
|
37
|
-
if (opts.json) {
|
|
38
|
-
console.log(JSON.stringify(data, null, 2));
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
console.log(chalk.bold(data.name));
|
|
42
|
-
printDetail(data, [
|
|
43
|
-
{ key: "id", label: "ID" },
|
|
44
|
-
{ key: "email", label: "Email" },
|
|
45
|
-
{ key: "phone", label: "Phone" },
|
|
46
|
-
{ key: "notes", label: "Notes" },
|
|
47
|
-
{ key: "createdAt", label: "Created" },
|
|
48
|
-
{ key: "updatedAt", label: "Updated" },
|
|
49
|
-
], opts);
|
|
50
|
-
if (data.companies.length > 0) {
|
|
51
|
-
console.log(chalk.dim(`\n Companies (${data.companies.length}):`));
|
|
52
|
-
for (const c of data.companies) {
|
|
53
|
-
const role = c.role ? chalk.dim(` (${c.role})`) : "";
|
|
54
|
-
console.log(` ${c.name}${role}`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
catch (err) {
|
|
59
|
-
handleError(err);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
// --- create ---
|
|
63
|
-
const createCommand = new Command("create")
|
|
64
|
-
.description("Create a new contact")
|
|
65
|
-
.requiredOption("--name <name>", "Contact name")
|
|
66
|
-
.option("--email <email>", "Email address")
|
|
67
|
-
.option("--phone <phone>", "Phone number")
|
|
68
|
-
.option("--notes <notes>", "Notes (markdown)")
|
|
69
|
-
.option("--json", "Output as JSON")
|
|
70
|
-
.action(async (opts) => {
|
|
71
|
-
try {
|
|
72
|
-
const data = await api.post("/contacts", {
|
|
73
|
-
name: opts.name,
|
|
74
|
-
email: opts.email,
|
|
75
|
-
phone: opts.phone,
|
|
76
|
-
notes: opts.notes,
|
|
77
|
-
});
|
|
78
|
-
if (opts.json) {
|
|
79
|
-
console.log(JSON.stringify(data, null, 2));
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
console.log(chalk.green("✓"), `Contact created: ${chalk.bold(data.name)} (${data.id})`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (err) {
|
|
86
|
-
handleError(err);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
// --- update ---
|
|
90
|
-
const updateCommand = new Command("update")
|
|
91
|
-
.description("Update a contact")
|
|
92
|
-
.argument("<id>", "Contact ID")
|
|
93
|
-
.option("--name <name>", "Contact name")
|
|
94
|
-
.option("--email <email>", "Email address")
|
|
95
|
-
.option("--phone <phone>", "Phone number")
|
|
96
|
-
.option("--notes <notes>", "Notes (markdown)")
|
|
97
|
-
.option("--json", "Output as JSON")
|
|
98
|
-
.action(async (id, opts) => {
|
|
99
|
-
try {
|
|
100
|
-
const { json: _, ...fields } = opts;
|
|
101
|
-
void _;
|
|
102
|
-
const payload = Object.fromEntries(Object.entries(fields).filter(([, v]) => v !== undefined));
|
|
103
|
-
const data = await api.post(`/contacts/${id}`, payload);
|
|
104
|
-
if (opts.json) {
|
|
105
|
-
console.log(JSON.stringify(data, null, 2));
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
console.log(chalk.green("✓"), `Contact updated: ${chalk.bold(data.name)}`);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
catch (err) {
|
|
112
|
-
handleError(err);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
// --- delete ---
|
|
116
|
-
const deleteCommand = new Command("delete")
|
|
117
|
-
.description("Delete a contact")
|
|
118
|
-
.argument("<id>", "Contact ID")
|
|
119
|
-
.option("--json", "Output as JSON")
|
|
120
|
-
.action(async (id, opts) => {
|
|
121
|
-
try {
|
|
122
|
-
await api.delete(`/contacts/${id}`);
|
|
123
|
-
if (opts.json) {
|
|
124
|
-
console.log(JSON.stringify({ deleted: true, id }));
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
console.log(chalk.green("✓"), "Contact deleted");
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
catch (err) {
|
|
131
|
-
handleError(err);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
// --- parent ---
|
|
135
|
-
export const contactCommand = new Command("contact")
|
|
136
|
-
.description("Manage contacts")
|
|
137
|
-
.addCommand(listCommand)
|
|
138
|
-
.addCommand(getCommand)
|
|
139
|
-
.addCommand(createCommand)
|
|
140
|
-
.addCommand(updateCommand)
|
|
141
|
-
.addCommand(deleteCommand);
|
|
142
|
-
//# sourceMappingURL=contact.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contact.js","sourceRoot":"","sources":["../../src/commands/contact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAyBvE,eAAe;AAEf,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KACpC,WAAW,CAAC,mBAAmB,CAAC;KAChC,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;KAC5C,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;KAClC,MAAM,CAAC,KAAK,EAAE,IAAyC,EAAE,EAAE;IAC1D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,MAAM;YAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAEnD,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,GAAG,CACxB,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CACjC,CAAC;QAEF,SAAS,CACP,IAA4C,EAC5C;YACE,EAAE,GAAG,EAAE,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AO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,iBAAiB,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,WAAW,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,iBAAiB;AAEjB,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC;KACjD,WAAW,CAAC,iBAAiB,CAAC;KAC9B,UAAU,CAAC,WAAW,CAAC;KACvB,UAAU,CAAC,UAAU,CAAC;KACtB,UAAU,CAAC,aAAa,CAAC;KACzB,UAAU,CAAC,aAAa,CAAC;KACzB,UAAU,CAAC,aAAa,CAAC,CAAC"}
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import chalk from "chalk";
|
|
3
|
-
import { api } from "../lib/api.js";
|
|
4
|
-
import { printList, printDetail, handleError } from "../lib/format.js";
|
|
5
|
-
// --- list ---
|
|
6
|
-
const listCommand = new Command("list")
|
|
7
|
-
.description("List conversations")
|
|
8
|
-
.option("--contact <contactId>", "Filter by contact")
|
|
9
|
-
.option("--lead <leadId>", "Filter by lead")
|
|
10
|
-
.option("--project <projectId>", "Filter by project")
|
|
11
|
-
.option("--channel <channel>", "Filter by channel (upwork, whatsapp, email, slack)")
|
|
12
|
-
.option("--status <status>", "Filter by status (active, archived)")
|
|
13
|
-
.option("--search <query>", "Search by subject")
|
|
14
|
-
.option("--json", "Output as JSON")
|
|
15
|
-
.action(async (opts) => {
|
|
16
|
-
try {
|
|
17
|
-
const params = new URLSearchParams();
|
|
18
|
-
if (opts.contact)
|
|
19
|
-
params.set("contactId", opts.contact);
|
|
20
|
-
if (opts.lead)
|
|
21
|
-
params.set("leadId", opts.lead);
|
|
22
|
-
if (opts.project)
|
|
23
|
-
params.set("projectId", opts.project);
|
|
24
|
-
if (opts.channel)
|
|
25
|
-
params.set("channel", opts.channel);
|
|
26
|
-
if (opts.status)
|
|
27
|
-
params.set("status", opts.status);
|
|
28
|
-
if (opts.search)
|
|
29
|
-
params.set("search", opts.search);
|
|
30
|
-
const qs = params.toString();
|
|
31
|
-
const data = await api.get(`/conversations${qs ? `?${qs}` : ""}`);
|
|
32
|
-
printList(data, [
|
|
33
|
-
{ key: "contactName", label: "Contact", width: 20 },
|
|
34
|
-
{ key: "channel", label: "Channel", width: 12 },
|
|
35
|
-
{ key: "subject", label: "Subject", width: 25 },
|
|
36
|
-
{ key: "messageCount", label: "Msgs", width: 6 },
|
|
37
|
-
{ key: "status", label: "Status", width: 10 },
|
|
38
|
-
{ key: "updatedAt", label: "Last Activity", width: 24 },
|
|
39
|
-
], opts);
|
|
40
|
-
}
|
|
41
|
-
catch (err) {
|
|
42
|
-
handleError(err);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
// --- get ---
|
|
46
|
-
const getCommand = new Command("get")
|
|
47
|
-
.description("Get conversation details with messages")
|
|
48
|
-
.argument("<id>", "Conversation ID")
|
|
49
|
-
.option("--json", "Output as JSON")
|
|
50
|
-
.action(async (id, opts) => {
|
|
51
|
-
try {
|
|
52
|
-
const data = await api.get(`/conversations/${id}`);
|
|
53
|
-
if (opts.json) {
|
|
54
|
-
console.log(JSON.stringify(data, null, 2));
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
console.log(chalk.bold(data.contactName), chalk.dim(`[${data.channel}]`));
|
|
58
|
-
if (data.subject) {
|
|
59
|
-
console.log(chalk.dim(data.subject));
|
|
60
|
-
}
|
|
61
|
-
printDetail(data, [
|
|
62
|
-
{ key: "id", label: "ID" },
|
|
63
|
-
{ key: "status", label: "Status" },
|
|
64
|
-
{ key: "createdAt", label: "Created" },
|
|
65
|
-
{ key: "updatedAt", label: "Updated" },
|
|
66
|
-
], opts);
|
|
67
|
-
if (data.messages.length > 0) {
|
|
68
|
-
console.log(chalk.dim(`\n Messages (${data.messages.length}):`));
|
|
69
|
-
for (const msg of data.messages) {
|
|
70
|
-
const arrow = msg.direction === "outbound"
|
|
71
|
-
? chalk.blue("→")
|
|
72
|
-
: chalk.yellow("←");
|
|
73
|
-
const sender = msg.direction === "outbound"
|
|
74
|
-
? (msg.authorName ?? "You")
|
|
75
|
-
: (msg.senderName ?? "Unknown");
|
|
76
|
-
const date = new Date(msg.createdAt).toLocaleString();
|
|
77
|
-
console.log(`\n ${arrow} ${chalk.bold(sender)} ${chalk.dim(date)}`);
|
|
78
|
-
console.log(` ${msg.body}`);
|
|
79
|
-
if (msg.attachments.length > 0) {
|
|
80
|
-
for (const att of msg.attachments) {
|
|
81
|
-
console.log(chalk.dim(` 📎 ${att.fileName} (${formatSize(att.fileSize)})`));
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
catch (err) {
|
|
88
|
-
handleError(err);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
// --- create ---
|
|
92
|
-
const createCommand = new Command("create")
|
|
93
|
-
.description("Create a new conversation")
|
|
94
|
-
.requiredOption("--contact <contactId>", "Contact ID")
|
|
95
|
-
.requiredOption("--channel <channel>", "Channel (upwork, whatsapp, email, slack)")
|
|
96
|
-
.option("--subject <text>", "Subject")
|
|
97
|
-
.option("--lead <leadId>", "Lead ID")
|
|
98
|
-
.option("--project <projectId>", "Project ID")
|
|
99
|
-
.option("--json", "Output as JSON")
|
|
100
|
-
.action(async (opts) => {
|
|
101
|
-
try {
|
|
102
|
-
const data = await api.post("/conversations", {
|
|
103
|
-
contactId: opts.contact,
|
|
104
|
-
channel: opts.channel,
|
|
105
|
-
subject: opts.subject,
|
|
106
|
-
leadId: opts.lead,
|
|
107
|
-
projectId: opts.project,
|
|
108
|
-
});
|
|
109
|
-
if (opts.json) {
|
|
110
|
-
console.log(JSON.stringify(data, null, 2));
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
console.log(chalk.green("✓"), `Conversation created (${data.id})`);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
catch (err) {
|
|
117
|
-
handleError(err);
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
// --- update ---
|
|
121
|
-
const updateCommand = new Command("update")
|
|
122
|
-
.description("Update a conversation")
|
|
123
|
-
.argument("<id>", "Conversation ID")
|
|
124
|
-
.option("--subject <text>", "Subject")
|
|
125
|
-
.option("--status <status>", "Status (active, archived)")
|
|
126
|
-
.option("--channel <channel>", "Channel")
|
|
127
|
-
.option("--lead <leadId>", "Lead ID")
|
|
128
|
-
.option("--project <projectId>", "Project ID")
|
|
129
|
-
.option("--json", "Output as JSON")
|
|
130
|
-
.action(async (id, opts) => {
|
|
131
|
-
try {
|
|
132
|
-
const payload = {};
|
|
133
|
-
if (opts.subject !== undefined)
|
|
134
|
-
payload.subject = opts.subject;
|
|
135
|
-
if (opts.status !== undefined)
|
|
136
|
-
payload.status = opts.status;
|
|
137
|
-
if (opts.channel !== undefined)
|
|
138
|
-
payload.channel = opts.channel;
|
|
139
|
-
if (opts.lead !== undefined)
|
|
140
|
-
payload.leadId = opts.lead;
|
|
141
|
-
if (opts.project !== undefined)
|
|
142
|
-
payload.projectId = opts.project;
|
|
143
|
-
const data = await api.post(`/conversations/${id}`, payload);
|
|
144
|
-
if (opts.json) {
|
|
145
|
-
console.log(JSON.stringify(data, null, 2));
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
console.log(chalk.green("✓"), "Conversation updated");
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
catch (err) {
|
|
152
|
-
handleError(err);
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
// --- message ---
|
|
156
|
-
const messageCommand = new Command("message")
|
|
157
|
-
.description("Add a message to a conversation")
|
|
158
|
-
.argument("<conversationId>", "Conversation ID")
|
|
159
|
-
.requiredOption("--body <text>", "Message body")
|
|
160
|
-
.option("--direction <dir>", "Direction (inbound, outbound)", "outbound")
|
|
161
|
-
.option("--sender <name>", "Sender name (for inbound)")
|
|
162
|
-
.option("--json", "Output as JSON")
|
|
163
|
-
.action(async (conversationId, opts) => {
|
|
164
|
-
try {
|
|
165
|
-
const data = await api.post(`/conversations/${conversationId}/messages`, {
|
|
166
|
-
body: opts.body,
|
|
167
|
-
direction: opts.direction,
|
|
168
|
-
senderName: opts.sender,
|
|
169
|
-
});
|
|
170
|
-
if (opts.json) {
|
|
171
|
-
console.log(JSON.stringify(data, null, 2));
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
console.log(chalk.green("✓"), "Message added");
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
catch (err) {
|
|
178
|
-
handleError(err);
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
// --- delete ---
|
|
182
|
-
const deleteCommand = new Command("delete")
|
|
183
|
-
.description("Delete a conversation")
|
|
184
|
-
.argument("<id>", "Conversation ID")
|
|
185
|
-
.option("--json", "Output as JSON")
|
|
186
|
-
.action(async (id, opts) => {
|
|
187
|
-
try {
|
|
188
|
-
await api.delete(`/conversations/${id}`);
|
|
189
|
-
if (opts.json) {
|
|
190
|
-
console.log(JSON.stringify({ deleted: true, id }));
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
console.log(chalk.green("✓"), "Conversation deleted");
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
catch (err) {
|
|
197
|
-
handleError(err);
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
// --- parent ---
|
|
201
|
-
export const conversationCommand = new Command("conversation")
|
|
202
|
-
.description("Manage conversations")
|
|
203
|
-
.addCommand(listCommand)
|
|
204
|
-
.addCommand(getCommand)
|
|
205
|
-
.addCommand(createCommand)
|
|
206
|
-
.addCommand(updateCommand)
|
|
207
|
-
.addCommand(messageCommand)
|
|
208
|
-
.addCommand(deleteCommand);
|
|
209
|
-
// --- helpers ---
|
|
210
|
-
function formatSize(bytes) {
|
|
211
|
-
if (bytes < 1024)
|
|
212
|
-
return `${bytes} B`;
|
|
213
|
-
if (bytes < 1024 * 1024)
|
|
214
|
-
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
215
|
-
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
216
|
-
}
|
|
217
|
-
//# sourceMappingURL=conversation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../src/commands/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAiCvE,eAAe;AAEf,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KACpC,WAAW,CAAC,oBAAoB,CAAC;KACjC,MAAM,CAAC,uBAAuB,EAAE,mBAAmB,CAAC;KACpD,MAAM,CAAC,iBAAiB,EAAE,gBAAgB,CAAC;KAC3C,MAAM,CAAC,uBAAuB,EAAE,mBAAmB,CAAC;KACpD,MAAM,CAAC,qBAAqB,EAAE,oDAAoD,CAAC;KACnF,MAAM,CAAC,mBAAmB,EAAE,qCAAqC,CAAC;KAClE,MAAM,CAAC,kBAAkB,EAAE,mBAAmB,CAAC;KAC/C,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;KAClC,MAAM,CACL,KAAK,EAAE,IAQN,EAAE,EAAE;IACH,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,OAAO;YAAE,MAAM,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,CAAC,KAAa;IAC/B,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,GAAG,KAAK,IAAI,CAAC;IACtC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAClE,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AACpD,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: itznexus-auth
|
|
3
|
-
description: "Manage authentication via the ITzNexus CLI"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# itznexus auth
|
|
7
|
-
|
|
8
|
-
Manage authentication. All commands return JSON when called with `--json`.
|
|
9
|
-
|
|
10
|
-
## Response Shape
|
|
11
|
-
|
|
12
|
-
All commands output JSON to stdout:
|
|
13
|
-
- **Success:** the created/updated/fetched object(s) directly
|
|
14
|
-
- **Error:** process exits with code 1 and prints an error message to stderr
|
|
15
|
-
|
|
16
|
-
## When to Use
|
|
17
|
-
|
|
18
|
-
Use this skill when you need to create, read, update, or delete **auth** records in ITzNexus. Always use the `--json` flag so output is machine-parseable.
|
|
19
|
-
|
|
20
|
-
## Commands
|
|
21
|
-
|
|
22
|
-
### login
|
|
23
|
-
|
|
24
|
-
Configure API key authentication.
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
itznexus auth login [--api-url] [--api-key] --json
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
| Parameter | Required | Description |
|
|
31
|
-
|-----------|----------|-------------|
|
|
32
|
-
| `--api-url` | no | API base URL |
|
|
33
|
-
| `--api-key` | no | API key (sk-itznx_...) |
|
|
34
|
-
|
|
35
|
-
### status
|
|
36
|
-
|
|
37
|
-
Show current authentication status.
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
itznexus auth status --json
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### logout
|
|
44
|
-
|
|
45
|
-
Remove stored API key.
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
itznexus auth logout --json
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Example Flows
|
|
52
|
-
|
|
53
|
-
**Check authentication:**
|
|
54
|
-
```bash
|
|
55
|
-
itznexus auth status --json
|
|
56
|
-
```
|
|
57
|
-
## Important
|
|
58
|
-
|
|
59
|
-
- Always pass `--json` for machine-readable output.
|
|
60
|
-
- IDs are UUIDs. Get them from `list` or `create` responses.
|
|
61
|
-
- The CLI authenticates via API key stored in `~/.itznexus/config.json`. Run `itznexus auth status --json` to verify.
|