hypha-cli 0.1.10 → 0.1.12
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/{apps-rK1_N8nw.mjs → apps-D9WCfzIl.mjs} +2 -2
- package/dist/{artifacts-8p2A4NMr.mjs → artifacts-DHPJIrSS.mjs} +208 -17
- package/dist/cli.mjs +11 -11
- package/dist/{helpers-BvfSCkvr.mjs → helpers-BC4AKy6a.mjs} +45 -9
- package/dist/index.mjs +1 -1
- package/dist/{workspace-XO_tEtii.mjs → workspace-DE2jBAXs.mjs} +4 -2
- package/package.json +2 -2
- package/dist/apps-CpJkx863.mjs +0 -512
- package/dist/apps-D659xu7q.mjs +0 -424
- package/dist/artifacts-C0yhSTgw.mjs +0 -629
- package/dist/artifacts-DdgZRh8t.mjs +0 -764
- package/dist/workspace-BwLwj61H.mjs +0 -206
- package/dist/workspace-DMqqSmvB.mjs +0 -283
- package/dist/workspace-RZLvWJpe.mjs +0 -128
- package/dist/workspace-wlyR33kp.mjs +0 -127
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { e as hasFlag, l as loginToHypha, c as connectToHypha, g as getFlagInt, i as getFlag, f as formatJson, a as formatTable } from './helpers-BvfSCkvr.mjs';
|
|
2
|
-
import 'fs';
|
|
3
|
-
import 'path';
|
|
4
|
-
import 'os';
|
|
5
|
-
|
|
6
|
-
async function loginCommand(args) {
|
|
7
|
-
if (hasFlag(args, "--help", "-h")) {
|
|
8
|
-
console.log(`Usage: hypha login [server-url]
|
|
9
|
-
|
|
10
|
-
Login to a Hypha server via browser-based OAuth.
|
|
11
|
-
Credentials are saved to ~/.hypha/.env.
|
|
12
|
-
|
|
13
|
-
Default server: https://hypha.aicell.io`);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const serverUrl = args[0] && !args[0].startsWith("-") ? args[0] : void 0;
|
|
17
|
-
await loginToHypha(serverUrl);
|
|
18
|
-
}
|
|
19
|
-
async function tokenCommand(args) {
|
|
20
|
-
if (hasFlag(args, "--help", "-h")) {
|
|
21
|
-
console.log(`Usage: hypha token [options]
|
|
22
|
-
|
|
23
|
-
Generate a workspace token.
|
|
24
|
-
|
|
25
|
-
Options:
|
|
26
|
-
--expires-in <seconds> Token expiration (default: 3600)
|
|
27
|
-
--permission <perm> Permission level: read, read_write, admin (default: read_write)
|
|
28
|
-
--workspace <ws> Target workspace (default: current)
|
|
29
|
-
--json Output as JSON`);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const server = await connectToHypha();
|
|
33
|
-
try {
|
|
34
|
-
const expiresIn = getFlagInt(args, "--expires-in") || 3600;
|
|
35
|
-
const permission = getFlag(args, "--permission") || "read_write";
|
|
36
|
-
const workspace = getFlag(args, "--workspace") || server.config.workspace;
|
|
37
|
-
const json = hasFlag(args, "--json");
|
|
38
|
-
const token = await server.generateToken({
|
|
39
|
-
expires_in: expiresIn,
|
|
40
|
-
permission,
|
|
41
|
-
workspace
|
|
42
|
-
});
|
|
43
|
-
if (json) {
|
|
44
|
-
console.log(formatJson({
|
|
45
|
-
token,
|
|
46
|
-
workspace,
|
|
47
|
-
permission,
|
|
48
|
-
expires_in: expiresIn
|
|
49
|
-
}));
|
|
50
|
-
} else {
|
|
51
|
-
console.log(token);
|
|
52
|
-
}
|
|
53
|
-
} finally {
|
|
54
|
-
await server.disconnect();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
async function servicesCommand(args) {
|
|
58
|
-
if (hasFlag(args, "--help", "-h")) {
|
|
59
|
-
console.log(`Usage: hypha services [options]
|
|
60
|
-
|
|
61
|
-
List services in the current workspace.
|
|
62
|
-
|
|
63
|
-
Options:
|
|
64
|
-
--type <type> Filter by service type
|
|
65
|
-
--include-unlisted Include unlisted services
|
|
66
|
-
--json Output as JSON`);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const server = await connectToHypha();
|
|
70
|
-
try {
|
|
71
|
-
const type = getFlag(args, "--type");
|
|
72
|
-
const includeUnlisted = hasFlag(args, "--include-unlisted");
|
|
73
|
-
const json = hasFlag(args, "--json");
|
|
74
|
-
const query = { _rkwargs: true };
|
|
75
|
-
if (type) query.type = type;
|
|
76
|
-
if (includeUnlisted) query.include_unlisted = true;
|
|
77
|
-
const services = await server.listServices(query);
|
|
78
|
-
if (json) {
|
|
79
|
-
console.log(formatJson(services));
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
if (!services || services.length === 0) {
|
|
83
|
-
console.log("No services found.");
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const rows = [["ID", "NAME", "TYPE", "DESCRIPTION"]];
|
|
87
|
-
for (const svc of services) {
|
|
88
|
-
rows.push([
|
|
89
|
-
svc.id || "",
|
|
90
|
-
svc.name || "",
|
|
91
|
-
svc.type || "",
|
|
92
|
-
(svc.description || "").slice(0, 60)
|
|
93
|
-
]);
|
|
94
|
-
}
|
|
95
|
-
console.log(formatTable(rows));
|
|
96
|
-
} finally {
|
|
97
|
-
await server.disconnect();
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
async function infoCommand(args) {
|
|
101
|
-
if (hasFlag(args, "--help", "-h")) {
|
|
102
|
-
console.log(`Usage: hypha info [--json]
|
|
103
|
-
|
|
104
|
-
Show workspace information.`);
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const server = await connectToHypha();
|
|
108
|
-
try {
|
|
109
|
-
const json = hasFlag(args, "--json");
|
|
110
|
-
const info = {
|
|
111
|
-
server_url: server.config.server_url,
|
|
112
|
-
workspace: server.config.workspace,
|
|
113
|
-
client_id: server.config.client_id
|
|
114
|
-
};
|
|
115
|
-
if (json) {
|
|
116
|
-
console.log(formatJson(info));
|
|
117
|
-
} else {
|
|
118
|
-
console.log(`Server: ${info.server_url}`);
|
|
119
|
-
console.log(`Workspace: ${info.workspace}`);
|
|
120
|
-
console.log(`Client ID: ${info.client_id}`);
|
|
121
|
-
}
|
|
122
|
-
} finally {
|
|
123
|
-
await server.disconnect();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export { infoCommand, loginCommand, servicesCommand, tokenCommand };
|