workstation.md 0.1.0 → 0.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workstation.md",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Cloud Linux workstations for AI agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,96 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const API_URL = process.env.WORKSTATION_API_URL || "https://api.workstation.md";
4
-
5
- interface WorkstationInfo {
6
- id: string;
7
- host: string;
8
- port: number;
9
- web: string;
10
- }
11
-
12
- async function apiRequest(path: string, options: RequestInit = {}): Promise<any> {
13
- const res = await fetch(`${API_URL}${path}`, {
14
- ...options,
15
- headers: {
16
- "Content-Type": "application/json",
17
- ...options.headers,
18
- },
19
- });
20
- if (!res.ok) {
21
- const text = await res.text();
22
- console.error(`Error: ${res.status} ${text}`);
23
- process.exit(1);
24
- }
25
- return res.json();
26
- }
27
-
28
- async function create(args: string[]) {
29
- let pubkey: string | undefined;
30
-
31
- for (let i = 0; i < args.length; i++) {
32
- if (args[i] === "--pubkey" && args[i + 1]) {
33
- pubkey = args[i + 1];
34
- i++;
35
- }
36
- }
37
-
38
- if (!pubkey) {
39
- console.error("Usage: workstation create --pubkey <public_key>");
40
- process.exit(1);
41
- }
42
-
43
- const info: WorkstationInfo = await apiRequest("/create", {
44
- method: "POST",
45
- body: JSON.stringify({ pubkey }),
46
- });
47
-
48
- console.log(JSON.stringify(info, null, 2));
49
- }
50
-
51
- async function destroy(wsId: string) {
52
- const result = await apiRequest(`/${wsId}`, { method: "DELETE" });
53
- console.log(JSON.stringify(result, null, 2));
54
- }
55
-
56
- async function list() {
57
- const items: WorkstationInfo[] = await apiRequest("/list");
58
- if (items.length === 0) {
59
- console.log("No active workstations.");
60
- return;
61
- }
62
- for (const ws of items) {
63
- console.log(`${ws.id}\tssh -p ${ws.port} root@${ws.host}\t${ws.web}`);
64
- }
65
- }
66
-
67
- function usage() {
68
- console.log(`Usage:
69
- workstation create --pubkey <public_key> Create a new workstation
70
- workstation <id> destroy Destroy a workstation
71
- workstation list List active workstations`);
72
- }
73
-
74
- async function main() {
75
- const args = process.argv.slice(2);
76
-
77
- if (args.length === 0) {
78
- usage();
79
- process.exit(0);
80
- }
81
-
82
- const command = args[0];
83
-
84
- if (command === "create") {
85
- await create(args.slice(1));
86
- } else if (command === "list") {
87
- await list();
88
- } else if (args.length >= 2 && args[1] === "destroy") {
89
- await destroy(command);
90
- } else {
91
- usage();
92
- process.exit(1);
93
- }
94
- }
95
-
96
- main();
package/tsconfig.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ES2022",
5
- "moduleResolution": "node",
6
- "outDir": "./bin",
7
- "rootDir": "./src",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "declaration": true
11
- },
12
- "include": ["src"]
13
- }