@abyssinia-labs/sokie 0.11.1-staging.339 → 0.11.2
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/sokie.mjs +186 -69
- package/package.json +2 -2
package/dist/sokie.mjs
CHANGED
|
@@ -24033,9 +24033,9 @@ var require___dev__ = __commonJS((exports, module) => {
|
|
|
24033
24033
|
|
|
24034
24034
|
// package.json
|
|
24035
24035
|
var name = "@abyssinia-labs/sokie";
|
|
24036
|
-
var version = "0.11.
|
|
24036
|
+
var version = "0.11.2";
|
|
24037
24037
|
var sokie = {
|
|
24038
|
-
site: "https://
|
|
24038
|
+
site: "https://sokie.sh"
|
|
24039
24039
|
};
|
|
24040
24040
|
|
|
24041
24041
|
// src/command.ts
|
|
@@ -68816,6 +68816,14 @@ function holdWhy(deploy, slug) {
|
|
|
68816
68816
|
const verbs = tools.length === 1 ? "deletes or acts" : "delete or act";
|
|
68817
68817
|
return `It adds ${names(tools)}, which ${verbs} outside the API, so an owner or admin looks first.`;
|
|
68818
68818
|
}
|
|
68819
|
+
const changes = deploy.hold?.changes;
|
|
68820
|
+
if (changes?.host) {
|
|
68821
|
+
return `It sends ${slug}'s calls to ${changes.host.to} instead of ${changes.host.from}, so someone confirms it in the app before it goes live.`;
|
|
68822
|
+
}
|
|
68823
|
+
if (changes && changes.count > 0) {
|
|
68824
|
+
const tell = changes.tools.length === 1 ? "tells" : "tell";
|
|
68825
|
+
return `It changes what ${names(changes.tools)} ${tell} agents, and ${slug} is listed, so someone confirms it in the app before it goes live.`;
|
|
68826
|
+
}
|
|
68819
68827
|
if (deploy.hold?.reason === "secrets") {
|
|
68820
68828
|
return "It sends the server's secrets somewhere production doesn't, so it runs without them until an owner or admin looks.";
|
|
68821
68829
|
}
|
|
@@ -68912,6 +68920,98 @@ function ensureIgnored(root, entry) {
|
|
|
68912
68920
|
return true;
|
|
68913
68921
|
}
|
|
68914
68922
|
|
|
68923
|
+
// src/step-up.ts
|
|
68924
|
+
import { hostname as hostname3 } from "node:os";
|
|
68925
|
+
|
|
68926
|
+
// src/browser.ts
|
|
68927
|
+
import { spawn } from "node:child_process";
|
|
68928
|
+
function openBrowser(url2) {
|
|
68929
|
+
const [command, args] = process.platform === "darwin" ? ["open", [url2]] : process.platform === "win32" ? ["cmd", ["/c", "start", "", url2]] : ["xdg-open", [url2]];
|
|
68930
|
+
spawn(command, args, { stdio: "ignore", detached: true }).on("error", () => {}).unref();
|
|
68931
|
+
}
|
|
68932
|
+
function canOpenBrowser(env = process.env, platform = process.platform) {
|
|
68933
|
+
if (env.SSH_CONNECTION || env.SSH_TTY)
|
|
68934
|
+
return false;
|
|
68935
|
+
if (platform === "darwin" || platform === "win32")
|
|
68936
|
+
return true;
|
|
68937
|
+
return Boolean(env.DISPLAY || env.WAYLAND_DISPLAY);
|
|
68938
|
+
}
|
|
68939
|
+
|
|
68940
|
+
// src/step-up.ts
|
|
68941
|
+
var stepUpFn = {
|
|
68942
|
+
ask: makeFunctionReference("stepUpAsks:ask"),
|
|
68943
|
+
asked: makeFunctionReference("stepUpAsks:asked")
|
|
68944
|
+
};
|
|
68945
|
+
var POLL_MS2 = 2000;
|
|
68946
|
+
function workspaceOf(client) {
|
|
68947
|
+
return "workspace" in client && typeof client.workspace === "string" ? client.workspace : undefined;
|
|
68948
|
+
}
|
|
68949
|
+
function asksForBrowser(error63) {
|
|
68950
|
+
if (!(error63 instanceof ConvexError))
|
|
68951
|
+
return false;
|
|
68952
|
+
const data = error63.data;
|
|
68953
|
+
return typeof data === "object" && data !== null && "code" in data && data.code === "STEP_UP_REQUIRED" && "ask" in data && data.ask === true;
|
|
68954
|
+
}
|
|
68955
|
+
function asDeployError(error63) {
|
|
68956
|
+
if (!(error63 instanceof ConvexError))
|
|
68957
|
+
return error63;
|
|
68958
|
+
const data = error63.data;
|
|
68959
|
+
if (typeof data === "object" && data !== null && "code" in data && "message" in data) {
|
|
68960
|
+
const { code: code2, message } = data;
|
|
68961
|
+
if (typeof code2 === "string" && typeof message === "string") {
|
|
68962
|
+
return new DeployError(code2.toLowerCase(), message);
|
|
68963
|
+
}
|
|
68964
|
+
}
|
|
68965
|
+
return error63;
|
|
68966
|
+
}
|
|
68967
|
+
function openHere(url2) {
|
|
68968
|
+
if (!canOpenBrowser())
|
|
68969
|
+
return false;
|
|
68970
|
+
openBrowser(url2);
|
|
68971
|
+
return true;
|
|
68972
|
+
}
|
|
68973
|
+
async function withStepUp(client, out, change, reason, call, deps = {}) {
|
|
68974
|
+
try {
|
|
68975
|
+
return await call();
|
|
68976
|
+
} catch (error63) {
|
|
68977
|
+
if (!asksForBrowser(error63))
|
|
68978
|
+
throw error63;
|
|
68979
|
+
}
|
|
68980
|
+
const from = deps.from ?? hostname3();
|
|
68981
|
+
const asked = await client.mutation(stepUpFn.ask, { change, ...from ? { from } : {} });
|
|
68982
|
+
const opened = (deps.open ?? openHere)(asked.url);
|
|
68983
|
+
await out.aside({
|
|
68984
|
+
event: "confirm",
|
|
68985
|
+
url: asked.url,
|
|
68986
|
+
code: asked.code,
|
|
68987
|
+
expiresAt: asked.expiresAt
|
|
68988
|
+
});
|
|
68989
|
+
await out.problem(opened ? `${reason} Confirm it’s you in the browser:` : `${reason} Open this on any device where you’re signed in to Sokie:`, "warn");
|
|
68990
|
+
await out.problem(` ${asked.url}`);
|
|
68991
|
+
await out.problem(opened ? ` Opened it for you. The page shows the code ${asked.code}.` : ` The page shows the code ${asked.code}.`, "dim");
|
|
68992
|
+
await out.problem(" Waiting… Ctrl+C to stop; nothing changes until you confirm.", "dim");
|
|
68993
|
+
const sleep2 = deps.sleep ?? ((ms) => new Promise((done) => setTimeout(done, ms)));
|
|
68994
|
+
const now = deps.now ?? Date.now;
|
|
68995
|
+
for (;; ) {
|
|
68996
|
+
const state = now() >= asked.expiresAt ? "expired" : await client.query(stepUpFn.asked, { askId: asked.askId });
|
|
68997
|
+
if (state === "confirmed")
|
|
68998
|
+
break;
|
|
68999
|
+
if (state === "refused") {
|
|
69000
|
+
throw new DeployError("step_up_refused", "Refused in the browser. Nothing changed.");
|
|
69001
|
+
}
|
|
69002
|
+
if (state === "expired") {
|
|
69003
|
+
throw new DeployError("step_up_expired", "The link ran out. Run the command again.");
|
|
69004
|
+
}
|
|
69005
|
+
await sleep2(POLL_MS2);
|
|
69006
|
+
}
|
|
69007
|
+
await out.problem("✓ Confirmed.", "ok");
|
|
69008
|
+
try {
|
|
69009
|
+
return await call(asked.askId);
|
|
69010
|
+
} catch (error63) {
|
|
69011
|
+
throw asDeployError(error63);
|
|
69012
|
+
}
|
|
69013
|
+
}
|
|
69014
|
+
|
|
68915
69015
|
// src/commands/deploy.ts
|
|
68916
69016
|
function platformFor(client) {
|
|
68917
69017
|
return {
|
|
@@ -68989,10 +69089,15 @@ async function runDeploy(argv, out, deps) {
|
|
|
68989
69089
|
let server;
|
|
68990
69090
|
const linked = readLink(root, info2.site);
|
|
68991
69091
|
if (values.create) {
|
|
68992
|
-
|
|
69092
|
+
const accessMode = values.public ? "public" : "private";
|
|
69093
|
+
const workspace = workspaceOf(client);
|
|
69094
|
+
const change = {
|
|
69095
|
+
kind: "server.create",
|
|
68993
69096
|
name: name2,
|
|
68994
|
-
accessMode
|
|
68995
|
-
|
|
69097
|
+
accessMode,
|
|
69098
|
+
...workspace ? { workspace } : {}
|
|
69099
|
+
};
|
|
69100
|
+
server = await withStepUp(client, out, change, "A new public server takes a confirmation.", (stepUp) => client.mutation(fn.createServer, { name: name2, accessMode, ...stepUp ? { stepUp } : {} }), deps.stepUp);
|
|
68996
69101
|
created = server;
|
|
68997
69102
|
} else if (values.server) {
|
|
68998
69103
|
server = await serverBySlug(client, values.server);
|
|
@@ -69046,7 +69151,8 @@ var deployCommand = {
|
|
|
69046
69151
|
files and waits for the deploy. The first deploy to a site says which server:
|
|
69047
69152
|
|
|
69048
69153
|
--create Make a new server, named from sokie.json, in the workspace commands
|
|
69049
|
-
work in (sokie workspace shows it). Private unless --public
|
|
69154
|
+
work in (sokie workspace shows it). Private unless --public,
|
|
69155
|
+
which you confirm in the browser first.
|
|
69050
69156
|
--server <s> Deploy to a server you already have, by its slug.
|
|
69051
69157
|
|
|
69052
69158
|
After that the repository is linked (in ${LINK_FILE}, kept out of git).
|
|
@@ -69455,7 +69561,7 @@ ${SITE_HELP}`,
|
|
|
69455
69561
|
};
|
|
69456
69562
|
|
|
69457
69563
|
// src/commands/dev.ts
|
|
69458
|
-
import { spawn } from "node:child_process";
|
|
69564
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
69459
69565
|
import { existsSync as existsSync9 } from "node:fs";
|
|
69460
69566
|
import { join as join10, resolve as resolve5 } from "node:path";
|
|
69461
69567
|
|
|
@@ -70096,7 +70202,7 @@ function openInBrowser(url2) {
|
|
|
70096
70202
|
const [command, ...args] = process.platform === "darwin" ? ["open", url2] : process.platform === "win32" ? ["cmd", "/c", "start", "", url2] : ["xdg-open", url2];
|
|
70097
70203
|
if (!command)
|
|
70098
70204
|
return;
|
|
70099
|
-
|
|
70205
|
+
spawn2(command, args, { stdio: "ignore", detached: true }).on("error", () => {}).unref();
|
|
70100
70206
|
}
|
|
70101
70207
|
function waitForStop() {
|
|
70102
70208
|
return new Promise((done) => {
|
|
@@ -70325,11 +70431,11 @@ async function dnsHelpLines(out, help) {
|
|
|
70325
70431
|
}
|
|
70326
70432
|
|
|
70327
70433
|
// src/domains-add.ts
|
|
70328
|
-
var
|
|
70434
|
+
var POLL_MS3 = 5000;
|
|
70329
70435
|
var WAIT_MS2 = 30 * 60000;
|
|
70330
70436
|
async function followWorkspace(out, client, deps) {
|
|
70331
70437
|
const seen = { txt: false, cname: false };
|
|
70332
|
-
for (let waited = 0;waited < WAIT_MS2; waited +=
|
|
70438
|
+
for (let waited = 0;waited < WAIT_MS2; waited += POLL_MS3) {
|
|
70333
70439
|
const domain2 = (await client.query(domainFn.workspace, {})).domain;
|
|
70334
70440
|
if (!domain2)
|
|
70335
70441
|
return null;
|
|
@@ -70342,14 +70448,14 @@ async function followWorkspace(out, client, deps) {
|
|
|
70342
70448
|
await out.line(` ✓ ${domain2.domain} is verified`, "ok");
|
|
70343
70449
|
return followNames(out, client, domain2.domain, deps, WAIT_MS2 - waited);
|
|
70344
70450
|
}
|
|
70345
|
-
await deps.sleep(
|
|
70451
|
+
await deps.sleep(POLL_MS3);
|
|
70346
70452
|
}
|
|
70347
70453
|
await out.line("Still waiting. Sokie keeps checking; sokie domains shows where it stands.", "dim");
|
|
70348
70454
|
return null;
|
|
70349
70455
|
}
|
|
70350
70456
|
async function followNames(out, client, domain2, deps, left) {
|
|
70351
70457
|
let names2 = [];
|
|
70352
|
-
for (let waited = 0;waited < left; waited +=
|
|
70458
|
+
for (let waited = 0;waited < left; waited += POLL_MS3) {
|
|
70353
70459
|
names2 = (await allHostnames(client)).filter((h) => h.hostname.endsWith(`.${domain2}`));
|
|
70354
70460
|
if (names2.length > 0 && names2.every((h) => h.status === "live")) {
|
|
70355
70461
|
const list = names2.map((h) => h.serverName).join(", ");
|
|
@@ -70357,14 +70463,14 @@ async function followNames(out, client, domain2, deps, left) {
|
|
|
70357
70463
|
await out.line("New servers get theirs as they are made.", "dim");
|
|
70358
70464
|
return names2;
|
|
70359
70465
|
}
|
|
70360
|
-
await deps.sleep(
|
|
70466
|
+
await deps.sleep(POLL_MS3);
|
|
70361
70467
|
}
|
|
70362
70468
|
await out.line("Servers are still getting their certificates; sokie domains shows each.", "dim");
|
|
70363
70469
|
return names2;
|
|
70364
70470
|
}
|
|
70365
70471
|
async function followExact(out, client, server, deps) {
|
|
70366
70472
|
let said = "";
|
|
70367
|
-
for (let waited = 0;waited < WAIT_MS2; waited +=
|
|
70473
|
+
for (let waited = 0;waited < WAIT_MS2; waited += POLL_MS3) {
|
|
70368
70474
|
const card = await client.query(domainFn.forServer, { serverId: server.serverId });
|
|
70369
70475
|
const exact = card.exact;
|
|
70370
70476
|
if (!exact)
|
|
@@ -70390,7 +70496,7 @@ async function followExact(out, client, server, deps) {
|
|
|
70390
70496
|
await out.line(`${others} keep${others.includes(" and ") ? "" : "s"} working.`, "dim");
|
|
70391
70497
|
return exact;
|
|
70392
70498
|
}
|
|
70393
|
-
await deps.sleep(
|
|
70499
|
+
await deps.sleep(POLL_MS3);
|
|
70394
70500
|
}
|
|
70395
70501
|
await out.line("Still waiting. Sokie keeps checking; sokie domains shows where it stands.", "dim");
|
|
70396
70502
|
return null;
|
|
@@ -70653,7 +70759,7 @@ function serverFolder(root, path) {
|
|
|
70653
70759
|
}
|
|
70654
70760
|
|
|
70655
70761
|
// src/edit-system.ts
|
|
70656
|
-
import { spawn as
|
|
70762
|
+
import { spawn as spawn3, spawnSync as spawnSync2 } from "node:child_process";
|
|
70657
70763
|
import { accessSync, constants, existsSync as existsSync10, readdirSync as readdirSync2, statSync as statSync2 } from "node:fs";
|
|
70658
70764
|
import { join as join12 } from "node:path";
|
|
70659
70765
|
function git(args) {
|
|
@@ -70702,7 +70808,7 @@ function start(launch, options, settle2) {
|
|
|
70702
70808
|
const spec = launchSpec(launch.command, launch.args, process.platform);
|
|
70703
70809
|
return new Promise((done) => {
|
|
70704
70810
|
try {
|
|
70705
|
-
const child =
|
|
70811
|
+
const child = spawn3(spec.command, spec.args, {
|
|
70706
70812
|
...options,
|
|
70707
70813
|
windowsHide: true,
|
|
70708
70814
|
windowsVerbatimArguments: spec.verbatim
|
|
@@ -70720,7 +70826,7 @@ var runInTerminal = (launch) => start(launch, { stdio: "inherit" }, "exit");
|
|
|
70720
70826
|
function cloneRepo(url2, root) {
|
|
70721
70827
|
return new Promise((done) => {
|
|
70722
70828
|
try {
|
|
70723
|
-
|
|
70829
|
+
spawn3("git", ["clone", url2, root], { stdio: ["inherit", 2, "inherit"] }).on("error", () => done(false)).on("exit", (code2) => done(code2 === 0));
|
|
70724
70830
|
} catch {
|
|
70725
70831
|
done(false);
|
|
70726
70832
|
}
|
|
@@ -71377,12 +71483,22 @@ async function runKeys(argv, out, deps) {
|
|
|
71377
71483
|
const servers = [];
|
|
71378
71484
|
for (const slug of values.server ?? [])
|
|
71379
71485
|
servers.push(await serverBySlug(client, slug));
|
|
71380
|
-
const
|
|
71486
|
+
const fields = {
|
|
71381
71487
|
name: name3 ?? "",
|
|
71382
71488
|
scopes,
|
|
71383
|
-
serverIds: servers.length > 0 ? servers.map((server) => server.serverId) : null
|
|
71384
|
-
|
|
71385
|
-
|
|
71489
|
+
serverIds: servers.length > 0 ? servers.map((server) => server.serverId) : null
|
|
71490
|
+
};
|
|
71491
|
+
const workspace = workspaceOf(client);
|
|
71492
|
+
const change = {
|
|
71493
|
+
kind: "key.create",
|
|
71494
|
+
...fields,
|
|
71495
|
+
...workspace ? { workspace } : {}
|
|
71496
|
+
};
|
|
71497
|
+
const made = await withStepUp(client, out, change, "A key that can deploy takes a confirmation.", (stepUp) => client.action(keyFn.create, {
|
|
71498
|
+
...fields,
|
|
71499
|
+
expiresInDays: days2,
|
|
71500
|
+
...stepUp ? { stepUp } : {}
|
|
71501
|
+
}), deps.stepUp);
|
|
71386
71502
|
const where2 = servers.length > 0 ? servers.map((server) => server.name).join(", ") : "all servers";
|
|
71387
71503
|
const until = days2 === null ? "never expires" : `expires ${formatDate(now + days2 * 86400000)}`;
|
|
71388
71504
|
await out.line(`Made "${name3}". Copy it now; it isn't shown again:`, "strong");
|
|
@@ -71453,6 +71569,8 @@ create <name>
|
|
|
71453
71569
|
--scope <s> Scopes to add, comma-separated: servers:read, deploys:write, …
|
|
71454
71570
|
--server <s> Only this server (repeat for more); every server when unset.
|
|
71455
71571
|
--expires <e> 7d, 30d (the default), 90d, 1y, or never.
|
|
71572
|
+
A key that can deploy is confirmed in the browser first: sokie opens the
|
|
71573
|
+
page and waits.
|
|
71456
71574
|
|
|
71457
71575
|
revoke <name>
|
|
71458
71576
|
Ends a key at once. Name it by its name, or by its start (sokie_ak_9f2a).
|
|
@@ -71468,16 +71586,7 @@ ${WORKSPACE_HELP}`,
|
|
|
71468
71586
|
|
|
71469
71587
|
// src/commands/link.ts
|
|
71470
71588
|
import { resolve as resolve11 } from "node:path";
|
|
71471
|
-
|
|
71472
|
-
// src/browser.ts
|
|
71473
|
-
import { spawn as spawn3 } from "node:child_process";
|
|
71474
|
-
function openBrowser(url2) {
|
|
71475
|
-
const [command, args] = process.platform === "darwin" ? ["open", [url2]] : process.platform === "win32" ? ["cmd", ["/c", "start", "", url2]] : ["xdg-open", [url2]];
|
|
71476
|
-
spawn3(command, args, { stdio: "ignore", detached: true }).on("error", () => {}).unref();
|
|
71477
|
-
}
|
|
71478
|
-
|
|
71479
|
-
// src/commands/link.ts
|
|
71480
|
-
var POLL_MS3 = 2000;
|
|
71589
|
+
var POLL_MS4 = 2000;
|
|
71481
71590
|
var WAIT_MS3 = 10 * 60 * 1000;
|
|
71482
71591
|
var DIALOG_WAIT_MS = 20 * 60 * 1000;
|
|
71483
71592
|
var DEPS = {
|
|
@@ -71531,7 +71640,7 @@ async function runLink(argv, out, deps = DEPS) {
|
|
|
71531
71640
|
if (status.status !== "pending" || deps.now() > deadline) {
|
|
71532
71641
|
return fail(out, "link_failed", status.message ?? "The link request expired. Run `sokie link` again.", EXIT.no);
|
|
71533
71642
|
}
|
|
71534
|
-
await deps.sleep(
|
|
71643
|
+
await deps.sleep(POLL_MS4);
|
|
71535
71644
|
}
|
|
71536
71645
|
} catch (error63) {
|
|
71537
71646
|
if (error63 instanceof DeployError)
|
|
@@ -71563,7 +71672,7 @@ ${SITE_HELP}`,
|
|
|
71563
71672
|
};
|
|
71564
71673
|
|
|
71565
71674
|
// src/commands/login.ts
|
|
71566
|
-
import { hostname as
|
|
71675
|
+
import { hostname as hostname4 } from "node:os";
|
|
71567
71676
|
|
|
71568
71677
|
// src/auth/loopback.ts
|
|
71569
71678
|
import { createServer as createServer4 } from "node:http";
|
|
@@ -71637,7 +71746,7 @@ async function clientIdFor(info2) {
|
|
|
71637
71746
|
const stored = readCredentials(info2.site);
|
|
71638
71747
|
if (stored?.clientId)
|
|
71639
71748
|
return stored.clientId;
|
|
71640
|
-
const clientId = await registerClient(info2, `Sokie CLI (${
|
|
71749
|
+
const clientId = await registerClient(info2, `Sokie CLI (${hostname4()})`);
|
|
71641
71750
|
writeCredentials(info2.site, { clientId });
|
|
71642
71751
|
return clientId;
|
|
71643
71752
|
}
|
|
@@ -72331,12 +72440,15 @@ ${WORKSPACE_HELP}`,
|
|
|
72331
72440
|
|
|
72332
72441
|
// src/commands/secrets.ts
|
|
72333
72442
|
import { resolve as resolve14 } from "node:path";
|
|
72443
|
+
function openWords(server) {
|
|
72444
|
+
return server.accessMode === "users" ? `${server.slug} is open to its API’s users.` : `${server.slug} is public.`;
|
|
72445
|
+
}
|
|
72334
72446
|
var LIVE = {
|
|
72335
72447
|
updated: "The running server has it now.",
|
|
72336
72448
|
not_deployed: "It's bound at the first deploy.",
|
|
72337
72449
|
failed: "Saved, but the running server couldn't be updated; the next deploy binds it."
|
|
72338
72450
|
};
|
|
72339
|
-
async function
|
|
72451
|
+
async function runSecrets(argv, out, deps) {
|
|
72340
72452
|
const { values, positionals } = parseCommandArgs(argv, {
|
|
72341
72453
|
...SITE_OPTION,
|
|
72342
72454
|
server: { type: "string" },
|
|
@@ -72350,7 +72462,7 @@ async function run9(argv, out) {
|
|
|
72350
72462
|
throw new UsageError("Give the secret's name as sokie.json declares it, e.g. TASKS_API_KEY.");
|
|
72351
72463
|
}
|
|
72352
72464
|
const root = resolve14(values.dir ?? ".");
|
|
72353
|
-
return
|
|
72465
|
+
return deps.signedIn(out, values.site, async (info2, client) => {
|
|
72354
72466
|
try {
|
|
72355
72467
|
const slug = values.server ?? readLink(root, info2.site)?.slug;
|
|
72356
72468
|
if (!slug) {
|
|
@@ -72380,11 +72492,14 @@ async function run9(argv, out) {
|
|
|
72380
72492
|
return EXIT.ok;
|
|
72381
72493
|
}
|
|
72382
72494
|
const secretName2 = name3 ?? "";
|
|
72383
|
-
const
|
|
72384
|
-
|
|
72385
|
-
|
|
72386
|
-
|
|
72387
|
-
|
|
72495
|
+
const read = deps.readValue ?? readSecretValue;
|
|
72496
|
+
const value = verb === "set" ? await read(`${secretName2} for ${server.slug}`) : "";
|
|
72497
|
+
const target = { serverId: server.serverId, name: secretName2 };
|
|
72498
|
+
const change = { kind: verb === "set" ? "secret.set" : "secret.remove", ...target };
|
|
72499
|
+
const result = await withStepUp(client, out, change, openWords(server), (stepUp) => {
|
|
72500
|
+
const ask = stepUp ? { stepUp } : {};
|
|
72501
|
+
return verb === "set" ? client.action(fn.setSecret, { ...target, value, ...ask }) : client.action(fn.removeSecret, { ...target, ...ask });
|
|
72502
|
+
}, deps.stepUp);
|
|
72388
72503
|
await out.line(`${verb === "set" ? "Set" : "Removed"} ${secretName2} on ${server.slug}. ${LIVE[result.live]}`, result.live === "failed" ? "warn" : "ok");
|
|
72389
72504
|
await out.result({ ok: true, server: server.slug, name: secretName2, live: result.live });
|
|
72390
72505
|
return EXIT.ok;
|
|
@@ -72402,11 +72517,13 @@ var secretsCommand = {
|
|
|
72402
72517
|
help: `set reads the value without echoing it, or from a pipe:
|
|
72403
72518
|
echo "$TASKS_API_KEY" | sokie secrets set TASKS_API_KEY
|
|
72404
72519
|
Values are never printed again. A change reaches the running server at once.
|
|
72520
|
+
On a public server, or one open to its API's users, you confirm the change
|
|
72521
|
+
in the browser first: sokie opens the page and waits.
|
|
72405
72522
|
|
|
72406
72523
|
--server <s> A server by slug, instead of the one this repository is linked to.
|
|
72407
72524
|
--dir <dir> The repository (default .), for its link.
|
|
72408
72525
|
${SITE_HELP}`,
|
|
72409
|
-
run:
|
|
72526
|
+
run: (argv, out) => runSecrets(argv, out, { signedIn: withSignedIn })
|
|
72410
72527
|
};
|
|
72411
72528
|
|
|
72412
72529
|
// src/commands/skills.ts
|
|
@@ -73105,13 +73222,13 @@ function columnsFor(cases) {
|
|
|
73105
73222
|
tool: Math.min(TOOL_MAX, Math.max(4, ...cases.map((c) => c.tool.length)))
|
|
73106
73223
|
};
|
|
73107
73224
|
}
|
|
73108
|
-
function caseLines(
|
|
73109
|
-
const mark =
|
|
73110
|
-
const ms = `${
|
|
73111
|
-
const head = ` ${mark} ${
|
|
73112
|
-
if (
|
|
73225
|
+
function caseLines(run9, columns, tint = plain) {
|
|
73226
|
+
const mark = run9.verdict.passed ? "✓" : "✕";
|
|
73227
|
+
const ms = `${run9.ms} ms`.padStart(8);
|
|
73228
|
+
const head = ` ${mark} ${run9.testCase.name.padEnd(columns.name)} ${run9.testCase.tool.padEnd(columns.tool)}${ms}`;
|
|
73229
|
+
if (run9.verdict.passed)
|
|
73113
73230
|
return [tint("ok", head)];
|
|
73114
|
-
return [tint("fail", head), ...
|
|
73231
|
+
return [tint("fail", head), ...run9.verdict.failures.map((failure2) => ` ${failure2}`)];
|
|
73115
73232
|
}
|
|
73116
73233
|
function headerLine2(running, where2, notHere, target) {
|
|
73117
73234
|
const cases = `${running} ${running === 1 ? "case" : "cases"} against ${where2}`;
|
|
@@ -73127,16 +73244,16 @@ function summaryLine2(passed, failed) {
|
|
|
73127
73244
|
function hiddenLine(hidden) {
|
|
73128
73245
|
return hidden > 0 ? ` … ${hidden} more passed` : null;
|
|
73129
73246
|
}
|
|
73130
|
-
function caseJson(
|
|
73247
|
+
function caseJson(run9) {
|
|
73131
73248
|
return {
|
|
73132
|
-
name:
|
|
73133
|
-
file:
|
|
73134
|
-
tool:
|
|
73135
|
-
passed:
|
|
73136
|
-
ms:
|
|
73137
|
-
expected:
|
|
73138
|
-
failures:
|
|
73139
|
-
...
|
|
73249
|
+
name: run9.testCase.name,
|
|
73250
|
+
file: run9.testCase.file,
|
|
73251
|
+
tool: run9.testCase.tool,
|
|
73252
|
+
passed: run9.verdict.passed,
|
|
73253
|
+
ms: run9.ms,
|
|
73254
|
+
expected: run9.verdict.expected,
|
|
73255
|
+
failures: run9.verdict.failures,
|
|
73256
|
+
...run9.verdict.passed ? {} : { got: run9.verdict.got }
|
|
73140
73257
|
};
|
|
73141
73258
|
}
|
|
73142
73259
|
|
|
@@ -73169,16 +73286,16 @@ async function runCases(out, deps, plan, target, endpointFor, all) {
|
|
|
73169
73286
|
const message = error63 instanceof Error ? error63.message : String(error63);
|
|
73170
73287
|
outcome = { error: message, ms: Math.round(performance.now() - started) };
|
|
73171
73288
|
}
|
|
73172
|
-
const
|
|
73173
|
-
runs.push(
|
|
73174
|
-
const show2 = !
|
|
73175
|
-
if (
|
|
73289
|
+
const run9 = { testCase, ms: outcome.ms, verdict: judgeCase(testCase, outcome) };
|
|
73290
|
+
runs.push(run9);
|
|
73291
|
+
const show2 = !run9.verdict.passed || all || shownPasses < PASSES_SHOWN;
|
|
73292
|
+
if (run9.verdict.passed && show2)
|
|
73176
73293
|
shownPasses += 1;
|
|
73177
73294
|
if (show2)
|
|
73178
|
-
for (const line of caseLines(
|
|
73295
|
+
for (const line of caseLines(run9, columns, out.tint))
|
|
73179
73296
|
await out.line(line);
|
|
73180
73297
|
}
|
|
73181
|
-
const passed = runs.filter((
|
|
73298
|
+
const passed = runs.filter((run9) => run9.verdict.passed).length;
|
|
73182
73299
|
const failed = runs.length - passed;
|
|
73183
73300
|
const hidden = hiddenLine(passed - shownPasses);
|
|
73184
73301
|
if (hidden)
|
|
@@ -73239,12 +73356,12 @@ async function runTest(argv, out, deps) {
|
|
|
73239
73356
|
return EXIT.ok;
|
|
73240
73357
|
}
|
|
73241
73358
|
if (target.kind === "dev") {
|
|
73242
|
-
const
|
|
73243
|
-
if (!
|
|
73359
|
+
const run9 = readDevRun(root);
|
|
73360
|
+
if (!run9) {
|
|
73244
73361
|
const message = "sokie dev isn't running for this checkout. Start it with: sokie dev";
|
|
73245
73362
|
return fail(out, "dev_not_running", message, EXIT.no);
|
|
73246
73363
|
}
|
|
73247
|
-
const endpoint = { url:
|
|
73364
|
+
const endpoint = { url: run9.serverUrl, token: run9.token };
|
|
73248
73365
|
return runCases(out, deps, plan, target, async () => endpoint, values.all);
|
|
73249
73366
|
}
|
|
73250
73367
|
return deps.signedIn(out, values.site, async (info2, client) => {
|
|
@@ -73292,7 +73409,7 @@ ${SITE_HELP}`,
|
|
|
73292
73409
|
|
|
73293
73410
|
// src/commands/tools.ts
|
|
73294
73411
|
import { resolve as resolve20 } from "node:path";
|
|
73295
|
-
async function
|
|
73412
|
+
async function run9(argv, out) {
|
|
73296
73413
|
const { values, positionals } = parseCommandArgs(argv, {
|
|
73297
73414
|
dir: { type: "string" },
|
|
73298
73415
|
all: { type: "boolean", default: false },
|
|
@@ -73375,7 +73492,7 @@ show <name> One tool: its annotations, its inputs from the spec, and each
|
|
|
73375
73492
|
--unexposed Operations in the spec that no tool exposes.
|
|
73376
73493
|
--all Every tool, however many.
|
|
73377
73494
|
--dir <dir> The repository (default .).`,
|
|
73378
|
-
run:
|
|
73495
|
+
run: run9
|
|
73379
73496
|
};
|
|
73380
73497
|
|
|
73381
73498
|
// src/commands/update.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abyssinia-labs/sokie",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.2",
|
|
5
5
|
"description": "Turn an OpenAPI or Swagger spec into an MCP server, run it on your machine, and deploy it to Sokie. The sokie command (alias sok).",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"homepage": "https://sokie.sh/docs/cli",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"author": "Abyssinia Labs <hello@sokie.sh> (https://sokie.sh)",
|
|
12
12
|
"sokie": {
|
|
13
|
-
"site": "https://
|
|
13
|
+
"site": "https://sokie.sh"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
16
|
"mcp",
|