@usenaive-sdk/cli 0.3.0 → 0.4.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 +48 -0
- package/dist/commands/apps.d.ts +2 -0
- package/dist/commands/apps.js +424 -0
- package/dist/commands/apps.js.map +1 -0
- package/dist/commands/ceo.d.ts +2 -0
- package/dist/commands/ceo.js +369 -0
- package/dist/commands/ceo.js.map +1 -0
- package/dist/commands/companies.js +105 -0
- package/dist/commands/companies.js.map +1 -1
- package/dist/commands/cron-jobs.d.ts +2 -0
- package/dist/commands/cron-jobs.js +208 -0
- package/dist/commands/cron-jobs.js.map +1 -0
- package/dist/commands/employees.d.ts +2 -0
- package/dist/commands/employees.js +190 -0
- package/dist/commands/employees.js.map +1 -0
- package/dist/commands/media.d.ts +2 -0
- package/dist/commands/media.js +183 -0
- package/dist/commands/media.js.map +1 -0
- package/dist/commands/memory.d.ts +2 -0
- package/dist/commands/memory.js +151 -0
- package/dist/commands/memory.js.map +1 -0
- package/dist/commands/objectives.d.ts +2 -0
- package/dist/commands/objectives.js +243 -0
- package/dist/commands/objectives.js.map +1 -0
- package/dist/commands/register.js +4 -4
- package/dist/commands/register.js.map +1 -1
- package/dist/commands/social.js +3 -0
- package/dist/commands/social.js.map +1 -1
- package/dist/commands/tasks.d.ts +2 -0
- package/dist/commands/tasks.js +400 -0
- package/dist/commands/tasks.js.map +1 -0
- package/dist/commands/usage.js +5 -5
- package/dist/commands/video.js +259 -11
- package/dist/commands/video.js.map +1 -1
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { apiRequest, handleApiError } from "../client.js";
|
|
3
|
+
import { agentOutput } from "../output.js";
|
|
4
|
+
export const cronCmd = new Command("cron")
|
|
5
|
+
.description("Schedule recurring jobs — create, list, trigger, pause, and remove cron jobs")
|
|
6
|
+
.addHelpText("after", `
|
|
7
|
+
Subcommands:
|
|
8
|
+
naive cron create <schedule> <prompt> Create a new cron job
|
|
9
|
+
naive cron list List all cron jobs
|
|
10
|
+
naive cron trigger <id> Manually trigger a cron job now
|
|
11
|
+
naive cron pause <id> Pause a cron job
|
|
12
|
+
naive cron remove <id> Delete a cron job permanently
|
|
13
|
+
|
|
14
|
+
Schedule format (cron expression):
|
|
15
|
+
"0 9 * * *" → every day at 9:00 AM UTC
|
|
16
|
+
"0 */6 * * *" → every 6 hours
|
|
17
|
+
"0 9 * * 1" → every Monday at 9:00 AM UTC
|
|
18
|
+
"0 0 1 * *" → first day of every month at midnight
|
|
19
|
+
|
|
20
|
+
Workflow:
|
|
21
|
+
1. naive cron create "0 9 * * *" "Check inbox and summarize new emails"
|
|
22
|
+
2. naive cron list → see all scheduled jobs
|
|
23
|
+
3. naive cron trigger <id> → test-fire immediately
|
|
24
|
+
4. naive cron pause <id> → temporarily disable
|
|
25
|
+
5. naive cron remove <id> → delete permanently
|
|
26
|
+
|
|
27
|
+
Examples:
|
|
28
|
+
$ naive cron create "0 9 * * 1" "Generate weekly social media content" --skill naive-social --name "Weekly Social"
|
|
29
|
+
$ naive cron list
|
|
30
|
+
$ naive cron trigger cron-abc-123
|
|
31
|
+
$ naive cron pause cron-abc-123
|
|
32
|
+
$ naive cron remove cron-abc-123
|
|
33
|
+
`);
|
|
34
|
+
cronCmd
|
|
35
|
+
.command("create <schedule> <prompt>")
|
|
36
|
+
.description("Create a new cron job that runs a prompt on a schedule")
|
|
37
|
+
.option("--skill <name>", "Skill to invoke when the job fires (e.g., naive-social, naive-email)")
|
|
38
|
+
.option("--name <name>", "Human-readable name for the cron job")
|
|
39
|
+
.addHelpText("after", `
|
|
40
|
+
Examples:
|
|
41
|
+
$ naive cron create "0 9 * * *" "Check email and respond to urgent messages"
|
|
42
|
+
$ naive cron create "0 */6 * * *" "Monitor social media mentions" --skill naive-social
|
|
43
|
+
$ naive cron create "0 0 * * 1" "Generate weekly analytics report" --name "Weekly Report"
|
|
44
|
+
|
|
45
|
+
What this does:
|
|
46
|
+
Creates a scheduled job that fires at the specified cron interval.
|
|
47
|
+
Each firing:
|
|
48
|
+
1. Sends the prompt to the CEO (or directly to the specified skill)
|
|
49
|
+
2. The CEO creates tasks and dispatches them
|
|
50
|
+
3. Results are logged and accessible via 'naive jobs'
|
|
51
|
+
|
|
52
|
+
Cost: Each cron firing costs credits based on the work performed.
|
|
53
|
+
`)
|
|
54
|
+
.action(async (schedule, prompt, opts) => {
|
|
55
|
+
const resp = await apiRequest("POST", "/v1/cron", {
|
|
56
|
+
schedule,
|
|
57
|
+
prompt,
|
|
58
|
+
...(opts.skill && { skill: opts.skill }),
|
|
59
|
+
...(opts.name && { name: opts.name }),
|
|
60
|
+
});
|
|
61
|
+
handleApiError("cron.create", resp);
|
|
62
|
+
const raw = resp.data;
|
|
63
|
+
const job = (raw.job ?? raw);
|
|
64
|
+
const jobId = job.id ?? "unknown";
|
|
65
|
+
const scheduleDisplay = job.schedule_display ?? (typeof job.schedule === "string" ? job.schedule : schedule);
|
|
66
|
+
agentOutput({
|
|
67
|
+
action: "cron.create",
|
|
68
|
+
result: resp.data,
|
|
69
|
+
next_steps: [
|
|
70
|
+
{ command: `naive cron trigger ${jobId}`, description: "Test-fire this job immediately" },
|
|
71
|
+
{ command: "naive cron list", description: "View all scheduled jobs" },
|
|
72
|
+
],
|
|
73
|
+
hints: [
|
|
74
|
+
`Cron job created (id: ${jobId})`,
|
|
75
|
+
`Schedule: ${scheduleDisplay}`,
|
|
76
|
+
...(job.name ? [`Name: ${job.name}`] : []),
|
|
77
|
+
...(job.next_run_at ? [`Next run: ${job.next_run_at}`] : []),
|
|
78
|
+
"The job will fire automatically at the next scheduled interval",
|
|
79
|
+
],
|
|
80
|
+
related_commands: ["naive cron list", "naive cron trigger", "naive cron pause"],
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
cronCmd
|
|
84
|
+
.command("list")
|
|
85
|
+
.description("List all cron jobs — active, paused, and their schedules")
|
|
86
|
+
.addHelpText("after", `
|
|
87
|
+
Examples:
|
|
88
|
+
$ naive cron list
|
|
89
|
+
|
|
90
|
+
Returns cron job details:
|
|
91
|
+
- id, name, schedule (cron expression)
|
|
92
|
+
- Status (active, paused)
|
|
93
|
+
- Prompt that fires on each run
|
|
94
|
+
- Last run timestamp and result
|
|
95
|
+
- Next scheduled run time
|
|
96
|
+
`)
|
|
97
|
+
.action(async () => {
|
|
98
|
+
const resp = await apiRequest("GET", "/v1/cron");
|
|
99
|
+
handleApiError("cron.list", resp);
|
|
100
|
+
const data = resp.data;
|
|
101
|
+
const count = data.cron_jobs?.length ?? 0;
|
|
102
|
+
const active = data.cron_jobs?.filter((j) => j.status === "active") ?? [];
|
|
103
|
+
agentOutput({
|
|
104
|
+
action: "cron.list",
|
|
105
|
+
result: resp.data,
|
|
106
|
+
next_steps: [
|
|
107
|
+
...(count > 0
|
|
108
|
+
? [{ command: `naive cron trigger ${data.cron_jobs[0].id}`, description: "Manually trigger the first job" }]
|
|
109
|
+
: []),
|
|
110
|
+
{ command: 'naive cron create "<schedule>" "<prompt>"', description: "Create a new cron job" },
|
|
111
|
+
],
|
|
112
|
+
hints: [
|
|
113
|
+
`${count} cron job${count !== 1 ? "s" : ""} total, ${active.length} active`,
|
|
114
|
+
],
|
|
115
|
+
related_commands: ["naive cron create", "naive cron trigger", "naive cron pause", "naive cron remove"],
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
cronCmd
|
|
119
|
+
.command("trigger <id>")
|
|
120
|
+
.description("Manually trigger a cron job immediately — useful for testing")
|
|
121
|
+
.addHelpText("after", `
|
|
122
|
+
Examples:
|
|
123
|
+
$ naive cron trigger cron-abc-123
|
|
124
|
+
|
|
125
|
+
Fires the job's prompt immediately, regardless of its schedule.
|
|
126
|
+
The job's schedule is not affected — it will still fire at its next
|
|
127
|
+
scheduled interval.
|
|
128
|
+
|
|
129
|
+
Cost: Same as a regular cron firing (credits based on work performed).
|
|
130
|
+
`)
|
|
131
|
+
.action(async (id) => {
|
|
132
|
+
const resp = await apiRequest("POST", `/v1/cron/${id}/trigger`);
|
|
133
|
+
handleApiError("cron.trigger", resp);
|
|
134
|
+
const data = resp.data;
|
|
135
|
+
agentOutput({
|
|
136
|
+
action: "cron.trigger",
|
|
137
|
+
result: resp.data,
|
|
138
|
+
next_steps: [
|
|
139
|
+
...(data.run_id
|
|
140
|
+
? [{ command: `naive ceo stream ${data.run_id}`, description: "Stream the triggered run" }]
|
|
141
|
+
: []),
|
|
142
|
+
{ command: "naive cron list", description: "View all cron jobs" },
|
|
143
|
+
{ command: "naive tasks list", description: "See tasks created by this trigger" },
|
|
144
|
+
],
|
|
145
|
+
hints: [
|
|
146
|
+
`Cron job ${id} triggered manually`,
|
|
147
|
+
"This does not affect the regular schedule",
|
|
148
|
+
],
|
|
149
|
+
related_commands: ["naive cron list", "naive ceo stream", "naive tasks list"],
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
cronCmd
|
|
153
|
+
.command("pause <id>")
|
|
154
|
+
.description("Pause a cron job — it will not fire until resumed")
|
|
155
|
+
.addHelpText("after", `
|
|
156
|
+
Examples:
|
|
157
|
+
$ naive cron pause cron-abc-123
|
|
158
|
+
|
|
159
|
+
Pauses the cron job. It remains configured but will not fire on schedule.
|
|
160
|
+
Use 'naive cron trigger <id>' to still fire it manually while paused.
|
|
161
|
+
Resume by updating the job status (re-create with same config if needed).
|
|
162
|
+
`)
|
|
163
|
+
.action(async (id) => {
|
|
164
|
+
const resp = await apiRequest("POST", `/v1/cron/${id}/pause`);
|
|
165
|
+
handleApiError("cron.pause", resp);
|
|
166
|
+
agentOutput({
|
|
167
|
+
action: "cron.pause",
|
|
168
|
+
result: resp.data,
|
|
169
|
+
next_steps: [
|
|
170
|
+
{ command: `naive cron trigger ${id}`, description: "Manually trigger while paused" },
|
|
171
|
+
{ command: "naive cron list", description: "View all cron jobs" },
|
|
172
|
+
{ command: `naive cron remove ${id}`, description: "Delete this job permanently" },
|
|
173
|
+
],
|
|
174
|
+
hints: [
|
|
175
|
+
`Cron job ${id} paused — will not fire on schedule`,
|
|
176
|
+
"You can still trigger it manually",
|
|
177
|
+
],
|
|
178
|
+
related_commands: ["naive cron list", "naive cron trigger", "naive cron remove"],
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
cronCmd
|
|
182
|
+
.command("remove <id>")
|
|
183
|
+
.description("Permanently delete a cron job")
|
|
184
|
+
.addHelpText("after", `
|
|
185
|
+
Examples:
|
|
186
|
+
$ naive cron remove cron-abc-123
|
|
187
|
+
|
|
188
|
+
Permanently removes the cron job. This cannot be undone.
|
|
189
|
+
Past executions and their results remain in job history.
|
|
190
|
+
`)
|
|
191
|
+
.action(async (id) => {
|
|
192
|
+
const resp = await apiRequest("DELETE", `/v1/cron/${id}`);
|
|
193
|
+
handleApiError("cron.remove", resp);
|
|
194
|
+
agentOutput({
|
|
195
|
+
action: "cron.remove",
|
|
196
|
+
result: resp.data,
|
|
197
|
+
next_steps: [
|
|
198
|
+
{ command: "naive cron list", description: "View remaining cron jobs" },
|
|
199
|
+
{ command: 'naive cron create "<schedule>" "<prompt>"', description: "Create a replacement job" },
|
|
200
|
+
],
|
|
201
|
+
hints: [
|
|
202
|
+
`Cron job ${id} deleted permanently`,
|
|
203
|
+
"Historical execution results remain in job history",
|
|
204
|
+
],
|
|
205
|
+
related_commands: ["naive cron list", "naive cron create"],
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
//# sourceMappingURL=cron-jobs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron-jobs.js","sourceRoot":"","sources":["../../src/commands/cron-jobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,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,CAAC,KAAK,EAAE,EAAU,EAAE,EAAE;IAC3B,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAE,CAAC,CAAC;IAC1D,cAAc,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IAEpC,WAAW,CAAC;QACV,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE,IAAI,CAAC,IAAI;QACjB,UAAU,EAAE;YACV,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,0BAA0B,EAAE;YACvE,EAAE,OAAO,EAAE,2CAA2C,EAAE,WAAW,EAAE,0BAA0B,EAAE;SAClG;QACD,KAAK,EAAE;YACL,YAAY,EAAE,sBAAsB;YACpC,oDAAoD;SACrD;QACD,gBAAgB,EAAE,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;KAC3D,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { apiRequest, handleApiError } from "../client.js";
|
|
3
|
+
import { agentOutput } from "../output.js";
|
|
4
|
+
export const employeesCmd = new Command("employees")
|
|
5
|
+
.description("Manage AI employees — hire, fire, configure, and list your workforce")
|
|
6
|
+
.addHelpText("after", `
|
|
7
|
+
Subcommands:
|
|
8
|
+
naive employees list List all employees in your company
|
|
9
|
+
naive employees hire Hire a new AI employee
|
|
10
|
+
naive employees fire <id> Terminate an employee
|
|
11
|
+
naive employees configure <id> Update an employee's model, skills, or settings
|
|
12
|
+
|
|
13
|
+
Workflow:
|
|
14
|
+
1. naive employees hire --role engineer --name "Alice" → hire an employee
|
|
15
|
+
2. naive employees list → see your workforce
|
|
16
|
+
3. naive employees configure <id> --model gpt-4o --skills "coding,devops"
|
|
17
|
+
4. naive tasks dispatch → dispatch tasks to employees
|
|
18
|
+
5. naive employees fire <id> → terminate if no longer needed
|
|
19
|
+
|
|
20
|
+
Employees are AI agents that execute tasks on the kanban board. Each employee
|
|
21
|
+
has a role (engineer, marketer, writer, etc.), a model configuration, and
|
|
22
|
+
a set of skills that determine which tasks they can handle.
|
|
23
|
+
|
|
24
|
+
Examples:
|
|
25
|
+
$ naive employees list
|
|
26
|
+
$ naive employees hire --role marketer --name "Marketing Max"
|
|
27
|
+
$ naive employees hire --role engineer --name "Dev Diana" --skills "typescript,react,devops"
|
|
28
|
+
$ naive employees configure emp-123 --model claude-sonnet-4-20250514
|
|
29
|
+
$ naive employees fire emp-123
|
|
30
|
+
`);
|
|
31
|
+
employeesCmd
|
|
32
|
+
.command("list")
|
|
33
|
+
.description("List all AI employees in your company")
|
|
34
|
+
.addHelpText("after", `
|
|
35
|
+
Examples:
|
|
36
|
+
$ naive employees list
|
|
37
|
+
|
|
38
|
+
Returns employee details:
|
|
39
|
+
- id, name, role
|
|
40
|
+
- Model configuration
|
|
41
|
+
- Skills list
|
|
42
|
+
- Current status (idle, working, offline)
|
|
43
|
+
- Active task (if working)
|
|
44
|
+
- Tasks completed count
|
|
45
|
+
`)
|
|
46
|
+
.action(async () => {
|
|
47
|
+
const resp = await apiRequest("GET", "/v1/employees");
|
|
48
|
+
handleApiError("employees.list", resp);
|
|
49
|
+
const data = resp.data;
|
|
50
|
+
const count = data.employees?.length ?? 0;
|
|
51
|
+
const working = data.employees?.filter((e) => e.status === "working") ?? [];
|
|
52
|
+
agentOutput({
|
|
53
|
+
action: "employees.list",
|
|
54
|
+
result: resp.data,
|
|
55
|
+
next_steps: [
|
|
56
|
+
{ command: "naive employees hire --role <role> --name <name>", description: "Hire a new employee" },
|
|
57
|
+
...(count > 0
|
|
58
|
+
? [{ command: `naive employees configure ${data.employees[0].id} --model <model>`, description: "Configure an employee" }]
|
|
59
|
+
: []),
|
|
60
|
+
{ command: "naive tasks dispatch", description: "Dispatch tasks to available employees" },
|
|
61
|
+
],
|
|
62
|
+
hints: [
|
|
63
|
+
`${count} employee${count !== 1 ? "s" : ""} in your company`,
|
|
64
|
+
`${working.length} currently working on tasks`,
|
|
65
|
+
],
|
|
66
|
+
related_commands: ["naive employees hire", "naive employees configure", "naive tasks dispatch"],
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
employeesCmd
|
|
70
|
+
.command("hire")
|
|
71
|
+
.description("Hire a new AI employee for your company")
|
|
72
|
+
.requiredOption("--role <role>", "Employee role: engineer | marketer | writer | sales | designer | researcher | support")
|
|
73
|
+
.requiredOption("--name <name>", "Display name for the employee")
|
|
74
|
+
.option("--skills <skills>", "Comma-separated skill tags (e.g., 'typescript,react,seo')")
|
|
75
|
+
.option("--model <model>", "AI model to use (default: auto-selected based on role)")
|
|
76
|
+
.addHelpText("after", `
|
|
77
|
+
Examples:
|
|
78
|
+
$ naive employees hire --role engineer --name "Dev Diana"
|
|
79
|
+
$ naive employees hire --role marketer --name "Marketing Max" --skills "seo,content,social"
|
|
80
|
+
$ naive employees hire --role writer --name "Content Casey" --model gpt-4o
|
|
81
|
+
|
|
82
|
+
Available roles:
|
|
83
|
+
engineer — coding, deployment, infrastructure
|
|
84
|
+
marketer — SEO, social media, content marketing, ads
|
|
85
|
+
writer — blog posts, copy, documentation, emails
|
|
86
|
+
sales — outreach, lead generation, proposals
|
|
87
|
+
designer — branding, visual assets, UI mockups
|
|
88
|
+
researcher — market research, competitive analysis, reports
|
|
89
|
+
support — customer service, ticket handling, FAQ management
|
|
90
|
+
|
|
91
|
+
Skills help the task dispatcher match employees to appropriate tasks.
|
|
92
|
+
`)
|
|
93
|
+
.action(async (opts) => {
|
|
94
|
+
const resp = await apiRequest("POST", "/v1/employees", {
|
|
95
|
+
role: opts.role,
|
|
96
|
+
name: opts.name,
|
|
97
|
+
...(opts.skills && { skills: opts.skills.split(",").map((s) => s.trim()) }),
|
|
98
|
+
...(opts.model && { model: opts.model }),
|
|
99
|
+
});
|
|
100
|
+
handleApiError("employees.hire", resp);
|
|
101
|
+
const data = resp.data;
|
|
102
|
+
agentOutput({
|
|
103
|
+
action: "employees.hire",
|
|
104
|
+
result: resp.data,
|
|
105
|
+
next_steps: [
|
|
106
|
+
{ command: `naive employees configure ${data.id} --skills <skills>`, description: "Fine-tune skills" },
|
|
107
|
+
{ command: "naive employees list", description: "View your full team" },
|
|
108
|
+
{ command: "naive tasks dispatch", description: "Dispatch tasks to the new employee" },
|
|
109
|
+
],
|
|
110
|
+
hints: [
|
|
111
|
+
`Employee hired: ${data.name} (${data.role}, id: ${data.id})`,
|
|
112
|
+
"New employees start in 'idle' status and can receive tasks immediately",
|
|
113
|
+
],
|
|
114
|
+
related_commands: ["naive employees list", "naive employees configure", "naive tasks dispatch"],
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
employeesCmd
|
|
118
|
+
.command("fire <id>")
|
|
119
|
+
.description("Terminate an AI employee — reassigns their active tasks")
|
|
120
|
+
.addHelpText("after", `
|
|
121
|
+
Examples:
|
|
122
|
+
$ naive employees fire emp-abc-123
|
|
123
|
+
|
|
124
|
+
What this does:
|
|
125
|
+
1. Marks the employee as terminated
|
|
126
|
+
2. Any active tasks are returned to 'pending' status
|
|
127
|
+
3. The employee can no longer receive new tasks
|
|
128
|
+
4. Historical task completions are preserved
|
|
129
|
+
|
|
130
|
+
Note: This does not delete the employee record — it remains in history.
|
|
131
|
+
`)
|
|
132
|
+
.action(async (id) => {
|
|
133
|
+
const resp = await apiRequest("DELETE", `/v1/employees/${id}`);
|
|
134
|
+
handleApiError("employees.fire", resp);
|
|
135
|
+
agentOutput({
|
|
136
|
+
action: "employees.fire",
|
|
137
|
+
result: resp.data,
|
|
138
|
+
next_steps: [
|
|
139
|
+
{ command: "naive employees list", description: "View remaining employees" },
|
|
140
|
+
{ command: "naive tasks list --status pending", description: "Check for reassigned tasks" },
|
|
141
|
+
{ command: "naive tasks dispatch", description: "Redistribute orphaned tasks" },
|
|
142
|
+
],
|
|
143
|
+
hints: [
|
|
144
|
+
`Employee ${id} terminated`,
|
|
145
|
+
"Active tasks have been returned to pending status",
|
|
146
|
+
],
|
|
147
|
+
related_commands: ["naive employees list", "naive employees hire", "naive tasks dispatch"],
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
employeesCmd
|
|
151
|
+
.command("configure <id>")
|
|
152
|
+
.description("Update an employee's model, skills, or other configuration")
|
|
153
|
+
.option("--model <model>", "Change the AI model (e.g., gpt-4o, claude-sonnet-4-20250514)")
|
|
154
|
+
.option("--skills <skills>", "Replace skill tags (comma-separated)")
|
|
155
|
+
.option("--name <name>", "Update display name")
|
|
156
|
+
.addHelpText("after", `
|
|
157
|
+
Examples:
|
|
158
|
+
$ naive employees configure emp-123 --model gpt-4o
|
|
159
|
+
$ naive employees configure emp-123 --skills "typescript,react,nextjs,devops"
|
|
160
|
+
$ naive employees configure emp-123 --name "Senior Dev Diana" --model claude-sonnet-4-20250514
|
|
161
|
+
|
|
162
|
+
Changes take effect for the next task the employee picks up.
|
|
163
|
+
Active tasks continue with the previous configuration.
|
|
164
|
+
`)
|
|
165
|
+
.action(async (id, opts) => {
|
|
166
|
+
const body = {};
|
|
167
|
+
if (opts.model)
|
|
168
|
+
body.model = opts.model;
|
|
169
|
+
if (opts.skills)
|
|
170
|
+
body.skills = opts.skills.split(",").map((s) => s.trim());
|
|
171
|
+
if (opts.name)
|
|
172
|
+
body.name = opts.name;
|
|
173
|
+
const resp = await apiRequest("PATCH", `/v1/employees/${id}`, body);
|
|
174
|
+
handleApiError("employees.configure", resp);
|
|
175
|
+
agentOutput({
|
|
176
|
+
action: "employees.configure",
|
|
177
|
+
result: resp.data,
|
|
178
|
+
next_steps: [
|
|
179
|
+
{ command: `naive employees list`, description: "View updated employee roster" },
|
|
180
|
+
{ command: "naive tasks dispatch", description: "Dispatch tasks with updated skills matching" },
|
|
181
|
+
],
|
|
182
|
+
hints: [
|
|
183
|
+
`Employee ${id} configuration updated`,
|
|
184
|
+
...(opts.model ? [`Model → ${opts.model}`] : []),
|
|
185
|
+
...(opts.skills ? [`Skills → ${opts.skills}`] : []),
|
|
186
|
+
],
|
|
187
|
+
related_commands: ["naive employees list", "naive employees hire"],
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
//# sourceMappingURL=employees.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"employees.js","sourceRoot":"","sources":["../../src/commands/employees.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC;KACjD,WAAW,CAAC,sEAAsE,CAAC;KACnF,WAAW,CAAC,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;CAwBvB,CAAC,CAAC;AAEH,YAAY;KACT,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,uCAAuC,CAAC;KACpD,WAAW,CAAC,OAAO,EAAE;;;;;;;;;;;CAWvB,CAAC;KACC,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACtD,cAAc,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IAEvC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAwF,CAAC;IAC3G,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,IAAI,EAAE,CAAC;IAE5E,WAAW,CAAC;QACV,MAAM,EAAE,gBAAgB;QACxB,MAAM,EAAE,IAAI,CAAC,IAAI;QACjB,UAAU,EAAE;YACV,EAAE,OAAO,EAAE,kDAAkD,EAAE,WAAW,EAAE,qBAAqB,EAAE;YACnG,GAA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,MAAM,EAAE,qBAAqB;QAC7B,MAAM,EAAE,IAAI,CAAC,IAAI;QACjB,UAAU,EAAE;YACV,EAAE,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,8BAA8B,EAAE;YAChF,EAAE,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,6CAA6C,EAAE;SAChG;QACD,KAAK,EAAE;YACL,YAAY,EAAE,wBAAwB;YACtC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAChD,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SACpD;QACD,gBAAgB,EAAE,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;KACnE,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { readFileSync } from "fs";
|
|
3
|
+
import { basename } from "path";
|
|
4
|
+
import { apiRequest, handleApiError } from "../client.js";
|
|
5
|
+
import { loadConfig, getApiKey } from "../config.js";
|
|
6
|
+
import { agentOutput, formatApiError } from "../output.js";
|
|
7
|
+
export const mediaCmd = new Command("media")
|
|
8
|
+
.description("Manage media assets — upload, list, update, delete files in your Media Asset Manager")
|
|
9
|
+
.addHelpText("after", `
|
|
10
|
+
Subcommands:
|
|
11
|
+
naive media list List media assets
|
|
12
|
+
naive media get <id> Get a single asset by ID
|
|
13
|
+
naive media upload --url <url> Upload from a URL
|
|
14
|
+
naive media upload --file <path> Upload a local file
|
|
15
|
+
naive media update <id> --title ... --tags ... Update asset metadata
|
|
16
|
+
naive media delete <id> Delete an asset
|
|
17
|
+
|
|
18
|
+
Assets are auto-populated when video clipping or video generation jobs complete.
|
|
19
|
+
`);
|
|
20
|
+
// ── List ──────────────────────────────────────────────────────────────────
|
|
21
|
+
mediaCmd
|
|
22
|
+
.command("list")
|
|
23
|
+
.description("List media assets with optional filters")
|
|
24
|
+
.option("--source <type>", "Filter by source: manual, video_clipping, video_generation, url_import")
|
|
25
|
+
.option("--search <query>", "Search by title or filename")
|
|
26
|
+
.option("--limit <n>", "Max results (default 50, max 100)")
|
|
27
|
+
.option("--offset <n>", "Pagination offset")
|
|
28
|
+
.action(async (opts) => {
|
|
29
|
+
const params = new URLSearchParams();
|
|
30
|
+
if (opts.source)
|
|
31
|
+
params.set("source_type", opts.source);
|
|
32
|
+
if (opts.search)
|
|
33
|
+
params.set("search", opts.search);
|
|
34
|
+
if (opts.limit)
|
|
35
|
+
params.set("limit", opts.limit);
|
|
36
|
+
if (opts.offset)
|
|
37
|
+
params.set("offset", opts.offset);
|
|
38
|
+
const qs = params.toString();
|
|
39
|
+
const resp = await apiRequest("GET", `/v1/media${qs ? `?${qs}` : ""}`);
|
|
40
|
+
handleApiError("media.list", resp);
|
|
41
|
+
agentOutput({
|
|
42
|
+
action: "media.list",
|
|
43
|
+
result: resp.data,
|
|
44
|
+
next_steps: [
|
|
45
|
+
{ command: "naive media get <id>", description: "View a specific asset" },
|
|
46
|
+
{ command: "naive media upload --url <url>", description: "Upload a new asset from URL" },
|
|
47
|
+
],
|
|
48
|
+
hints: ["Use --source to filter by origin (video_clipping, video_generation, manual, url_import)."],
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
// ── Get ───────────────────────────────────────────────────────────────────
|
|
52
|
+
mediaCmd
|
|
53
|
+
.command("get <id>")
|
|
54
|
+
.description("Get details of a single media asset")
|
|
55
|
+
.action(async (id) => {
|
|
56
|
+
const resp = await apiRequest("GET", `/v1/media/${id}`);
|
|
57
|
+
handleApiError("media.get", resp);
|
|
58
|
+
agentOutput({
|
|
59
|
+
action: "media.get",
|
|
60
|
+
result: resp.data,
|
|
61
|
+
next_steps: [
|
|
62
|
+
{ command: `naive media update ${id} --title "New Title"`, description: "Update this asset" },
|
|
63
|
+
{ command: `naive media delete ${id}`, description: "Delete this asset" },
|
|
64
|
+
],
|
|
65
|
+
hints: ["Asset details include source_type, source_job_id, and tags."],
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
// ── Upload ────────────────────────────────────────────────────────────────
|
|
69
|
+
mediaCmd
|
|
70
|
+
.command("upload")
|
|
71
|
+
.description("Upload a media asset from a URL or local file")
|
|
72
|
+
.option("--url <url>", "Public URL of the media file")
|
|
73
|
+
.option("--file <path>", "Path to a local file to upload")
|
|
74
|
+
.option("--title <title>", "Asset title")
|
|
75
|
+
.option("--description <desc>", "Asset description")
|
|
76
|
+
.option("--tags <tags>", "Comma-separated tags")
|
|
77
|
+
.action(async (opts) => {
|
|
78
|
+
if (!opts.url && !opts.file) {
|
|
79
|
+
console.error("Error: provide --url or --file");
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
const tags = opts.tags ? opts.tags.split(",").map((t) => t.trim()) : undefined;
|
|
83
|
+
if (opts.url) {
|
|
84
|
+
const body = { url: opts.url };
|
|
85
|
+
if (opts.title)
|
|
86
|
+
body.title = opts.title;
|
|
87
|
+
if (opts.description)
|
|
88
|
+
body.description = opts.description;
|
|
89
|
+
if (tags)
|
|
90
|
+
body.tags = tags;
|
|
91
|
+
const resp = await apiRequest("POST", "/v1/media/upload/url", body);
|
|
92
|
+
handleApiError("media.upload", resp);
|
|
93
|
+
agentOutput({
|
|
94
|
+
action: "media.upload",
|
|
95
|
+
result: resp.data,
|
|
96
|
+
next_steps: [
|
|
97
|
+
{ command: "naive media list", description: "View all assets" },
|
|
98
|
+
],
|
|
99
|
+
hints: ["Asset uploaded from URL and added to your Media Asset Manager."],
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
const filePath = opts.file;
|
|
104
|
+
const fileBuffer = readFileSync(filePath);
|
|
105
|
+
const filename = basename(filePath);
|
|
106
|
+
const config = loadConfig();
|
|
107
|
+
const url = `${config.base_url}/v1/media/upload/file`;
|
|
108
|
+
const formData = new FormData();
|
|
109
|
+
formData.append("file", new Blob([fileBuffer]), filename);
|
|
110
|
+
if (opts.title)
|
|
111
|
+
formData.append("title", opts.title);
|
|
112
|
+
if (opts.description)
|
|
113
|
+
formData.append("description", opts.description);
|
|
114
|
+
if (tags)
|
|
115
|
+
formData.append("tags", JSON.stringify(tags));
|
|
116
|
+
const resp = await fetch(url, {
|
|
117
|
+
method: "POST",
|
|
118
|
+
headers: { Authorization: `Bearer ${getApiKey()}` },
|
|
119
|
+
body: formData,
|
|
120
|
+
});
|
|
121
|
+
const data = await resp.json();
|
|
122
|
+
if (resp.status >= 400) {
|
|
123
|
+
formatApiError("media.upload", data);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
agentOutput({
|
|
127
|
+
action: "media.upload",
|
|
128
|
+
result: data,
|
|
129
|
+
next_steps: [
|
|
130
|
+
{ command: "naive media list", description: "View all assets" },
|
|
131
|
+
],
|
|
132
|
+
hints: [`File "${filename}" uploaded to your Media Asset Manager.`],
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
// ── Update ────────────────────────────────────────────────────────────────
|
|
138
|
+
mediaCmd
|
|
139
|
+
.command("update <id>")
|
|
140
|
+
.description("Update media asset metadata (title, description, tags)")
|
|
141
|
+
.option("--title <title>", "New title")
|
|
142
|
+
.option("--description <desc>", "New description")
|
|
143
|
+
.option("--tags <tags>", "Comma-separated tags (replaces existing)")
|
|
144
|
+
.action(async (id, opts) => {
|
|
145
|
+
const body = {};
|
|
146
|
+
if (opts.title !== undefined)
|
|
147
|
+
body.title = opts.title;
|
|
148
|
+
if (opts.description !== undefined)
|
|
149
|
+
body.description = opts.description;
|
|
150
|
+
if (opts.tags !== undefined)
|
|
151
|
+
body.tags = opts.tags.split(",").map((t) => t.trim());
|
|
152
|
+
if (Object.keys(body).length === 0) {
|
|
153
|
+
console.error("Error: provide at least one of --title, --description, or --tags");
|
|
154
|
+
process.exit(1);
|
|
155
|
+
}
|
|
156
|
+
const resp = await apiRequest("PATCH", `/v1/media/${id}`, body);
|
|
157
|
+
handleApiError("media.update", resp);
|
|
158
|
+
agentOutput({
|
|
159
|
+
action: "media.update",
|
|
160
|
+
result: resp.data,
|
|
161
|
+
next_steps: [
|
|
162
|
+
{ command: `naive media get ${id}`, description: "View updated asset" },
|
|
163
|
+
],
|
|
164
|
+
hints: ["Asset metadata updated."],
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
// ── Delete ────────────────────────────────────────────────────────────────
|
|
168
|
+
mediaCmd
|
|
169
|
+
.command("delete <id>")
|
|
170
|
+
.description("Delete a media asset")
|
|
171
|
+
.action(async (id) => {
|
|
172
|
+
const resp = await apiRequest("DELETE", `/v1/media/${id}`);
|
|
173
|
+
handleApiError("media.delete", resp);
|
|
174
|
+
agentOutput({
|
|
175
|
+
action: "media.delete",
|
|
176
|
+
result: resp.data,
|
|
177
|
+
next_steps: [
|
|
178
|
+
{ command: "naive media list", description: "View remaining assets" },
|
|
179
|
+
],
|
|
180
|
+
hints: ["Asset permanently deleted."],
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
//# sourceMappingURL=media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/commands/media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE3D,MAAM,CAAC,MAAM,Q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