@2kw/ai 7.1.0-dev.7 → 7.1.0-dev.9
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.
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import { getClient, runAction } from "../lib/client.js";
|
|
3
|
+
import { resolveConfig } from "../lib/config.js";
|
|
3
4
|
import { CliUsageError } from "../lib/errors.js";
|
|
4
5
|
import { formatPage, formatDetail, formatList, formatSuccess } from "../lib/output.js";
|
|
5
6
|
import { addPaginationOptions, paginationParams } from "../lib/pagination.js";
|
|
7
|
+
/**
|
|
8
|
+
* Switching member sign-in on or off is a decision a signed-in person makes: the backend refuses an
|
|
9
|
+
* API key, however admin it is, so the command says so before it sends anything (see `SESSION_ONLY`
|
|
10
|
+
* in connectors.ts for the same wording).
|
|
11
|
+
*/
|
|
12
|
+
const SESSION_ONLY = "Signed-in admins only: run 2kw auth login and sign in through the browser; an API key is refused";
|
|
6
13
|
const MIN_MONTHLY_PERCENT = 0;
|
|
7
14
|
const MAX_MONTHLY_PERCENT = 1000;
|
|
8
15
|
/**
|
|
@@ -217,6 +224,28 @@ export function makeInstallationsCommand() {
|
|
|
217
224
|
});
|
|
218
225
|
});
|
|
219
226
|
cmd.addCommand(budget);
|
|
227
|
+
cmd
|
|
228
|
+
.command("member-login")
|
|
229
|
+
.description(`Allow or stop members signing in to this installation's app as themselves. Stopping signs everyone out of it. ${SESSION_ONLY}`)
|
|
230
|
+
.argument("<id>", "Installation ID")
|
|
231
|
+
.option("--enable", "Allow members to sign in")
|
|
232
|
+
.option("--disable", "Stop member sign-in and sign everyone out of the app")
|
|
233
|
+
.action(async (id, opts, command) => {
|
|
234
|
+
await runAction(command, async () => {
|
|
235
|
+
if (Boolean(opts.enable) === Boolean(opts.disable)) {
|
|
236
|
+
throw new CliUsageError("pass exactly one of --enable and --disable");
|
|
237
|
+
}
|
|
238
|
+
if (resolveConfig(command).kind === "apiKey") {
|
|
239
|
+
throw new CliUsageError(SESSION_ONLY);
|
|
240
|
+
}
|
|
241
|
+
const client = getClient(command);
|
|
242
|
+
const { data } = await client.PUT("/v1/installations/{id}/member-login", {
|
|
243
|
+
params: { path: { id } },
|
|
244
|
+
body: { enabled: Boolean(opts.enable) },
|
|
245
|
+
});
|
|
246
|
+
formatDetail(data, command);
|
|
247
|
+
});
|
|
248
|
+
});
|
|
220
249
|
return cmd;
|
|
221
250
|
}
|
|
222
251
|
//# sourceMappingURL=installations.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@2kw/ai",
|
|
3
|
-
"version": "7.1.0-dev.
|
|
3
|
+
"version": "7.1.0-dev.9",
|
|
4
4
|
"description": "CLI for 2kw.ai — schema-driven document extraction, an OpenAI-compatible EU LLM gateway, transcription, prompts, datasets, and experiments from your terminal or agentic workflows. Ships as 2kw, backbone, and bb.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|