@lotics/cli 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/src/cli.js +29 -3
- package/dist/src/client.d.ts +4 -0
- package/dist/src/client.js +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,6 +56,7 @@ If your organization has multiple workspaces, select one before running tools:
|
|
|
56
56
|
```bash
|
|
57
57
|
lotics workspace # list workspaces (marks current)
|
|
58
58
|
lotics workspace select wks_... # switch to a workspace
|
|
59
|
+
lotics workspace create "Sales" # create a new workspace (admin only)
|
|
59
60
|
```
|
|
60
61
|
|
|
61
62
|
Single-workspace organizations auto-select on first use.
|
package/dist/src/cli.js
CHANGED
|
@@ -44,6 +44,7 @@ USAGE
|
|
|
44
44
|
COMMANDS
|
|
45
45
|
lotics workspace List workspaces (marks current)
|
|
46
46
|
lotics workspace select <id> Switch to a different workspace
|
|
47
|
+
lotics workspace create <name> Create a new workspace (admin only)
|
|
47
48
|
lotics tools List all available tools
|
|
48
49
|
lotics tools <name> Show tool description and input schema
|
|
49
50
|
lotics run <tool> '<json>' Execute a tool
|
|
@@ -423,10 +424,30 @@ async function main() {
|
|
|
423
424
|
console.error(`Switched to workspace: ${target.name} (${target.id})`);
|
|
424
425
|
return;
|
|
425
426
|
}
|
|
427
|
+
if (subcommand === "create") {
|
|
428
|
+
const name = toolArgs;
|
|
429
|
+
if (!name) {
|
|
430
|
+
console.error('Usage: lotics workspace create <name> [--timezone <tz>]');
|
|
431
|
+
process.exit(1);
|
|
432
|
+
}
|
|
433
|
+
const timezone = flags.timezone;
|
|
434
|
+
const created = await client.createWorkspace({ name, timezone });
|
|
435
|
+
const existing = config ?? {};
|
|
436
|
+
saveConfig({ ...existing, workspace_id: created.id });
|
|
437
|
+
client.setWorkspaceId(created.id);
|
|
438
|
+
if (flags.json) {
|
|
439
|
+
console.log(JSON.stringify(created, null, 2));
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
console.error(`Created workspace: ${created.name} (${created.id})`);
|
|
443
|
+
console.error(`Switched to ${created.id}`);
|
|
444
|
+
}
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
426
447
|
// Default: list workspaces
|
|
427
448
|
if (subcommand && subcommand !== "list") {
|
|
428
449
|
console.error(`Unknown workspace subcommand: ${subcommand}`);
|
|
429
|
-
console.error('Usage: lotics workspace [list | select <id>]');
|
|
450
|
+
console.error('Usage: lotics workspace [list | select <id> | create <name>]');
|
|
430
451
|
process.exit(1);
|
|
431
452
|
}
|
|
432
453
|
if (flags.json) {
|
|
@@ -533,8 +554,13 @@ async function main() {
|
|
|
533
554
|
// Always request text format so model_output is available; --json only affects CLI output
|
|
534
555
|
const result = await client.execute(toolName, args, { format: "text", timeoutMs });
|
|
535
556
|
if (result.error) {
|
|
536
|
-
|
|
537
|
-
|
|
557
|
+
if (flags.json) {
|
|
558
|
+
console.log(JSON.stringify({ error: result.error }, null, 2));
|
|
559
|
+
}
|
|
560
|
+
else {
|
|
561
|
+
console.error(result.error);
|
|
562
|
+
console.error(`\nHint: run "lotics tools ${toolName}" to see the expected input schema.`);
|
|
563
|
+
}
|
|
538
564
|
process.exit(1);
|
|
539
565
|
}
|
|
540
566
|
if (flags.json) {
|
package/dist/src/client.d.ts
CHANGED
|
@@ -47,6 +47,10 @@ export declare class LoticsClient {
|
|
|
47
47
|
}>;
|
|
48
48
|
setWorkspaceId(id: string): void;
|
|
49
49
|
listWorkspaces(): Promise<WorkspaceInfo[]>;
|
|
50
|
+
createWorkspace(body: {
|
|
51
|
+
name: string;
|
|
52
|
+
timezone?: string;
|
|
53
|
+
}): Promise<WorkspaceInfo>;
|
|
50
54
|
login(): Promise<{
|
|
51
55
|
email: string;
|
|
52
56
|
}>;
|
package/dist/src/client.js
CHANGED
|
@@ -45,7 +45,7 @@ export class LoticsClient {
|
|
|
45
45
|
}
|
|
46
46
|
buildHeaders() {
|
|
47
47
|
const headers = {
|
|
48
|
-
"
|
|
48
|
+
"Authorization": `Bearer ${this.apiKey}`,
|
|
49
49
|
};
|
|
50
50
|
if (this.workspaceId) {
|
|
51
51
|
headers["x-workspace-id"] = this.workspaceId;
|
|
@@ -74,6 +74,9 @@ export class LoticsClient {
|
|
|
74
74
|
async listWorkspaces() {
|
|
75
75
|
return this.request("GET", "/v1/workspaces");
|
|
76
76
|
}
|
|
77
|
+
async createWorkspace(body) {
|
|
78
|
+
return this.request("POST", "/v1/workspaces", body);
|
|
79
|
+
}
|
|
77
80
|
async login() {
|
|
78
81
|
return this.request("POST", "/v1/cli/login");
|
|
79
82
|
}
|