@invinite-org/invinite-cli 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/dist/inv.bundle.js +33 -22
- package/dist/inv.js +69 -4
- package/package.json +1 -1
package/dist/inv.js
CHANGED
|
@@ -29775,6 +29775,36 @@ function date8(params4) {
|
|
|
29775
29775
|
// node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
29776
29776
|
config2(en_default2());
|
|
29777
29777
|
|
|
29778
|
+
// package.json
|
|
29779
|
+
var package_default = {
|
|
29780
|
+
name: "@invinite-org/invinite-cli",
|
|
29781
|
+
version: "0.1.1",
|
|
29782
|
+
description: "Command-line access to the Invinite Web API",
|
|
29783
|
+
type: "module",
|
|
29784
|
+
bin: {
|
|
29785
|
+
inv: "./dist/inv.js"
|
|
29786
|
+
},
|
|
29787
|
+
files: [
|
|
29788
|
+
"dist",
|
|
29789
|
+
"README.md"
|
|
29790
|
+
],
|
|
29791
|
+
engines: {
|
|
29792
|
+
node: ">=18"
|
|
29793
|
+
},
|
|
29794
|
+
scripts: {
|
|
29795
|
+
build: "tsx build.ts",
|
|
29796
|
+
dev: "tsx src/inv.ts"
|
|
29797
|
+
},
|
|
29798
|
+
dependencies: {
|
|
29799
|
+
zod: "^4.2.1"
|
|
29800
|
+
},
|
|
29801
|
+
devDependencies: {
|
|
29802
|
+
esbuild: "^0.27.2",
|
|
29803
|
+
tsx: "^4.21.0",
|
|
29804
|
+
typescript: "^5.9.3"
|
|
29805
|
+
}
|
|
29806
|
+
};
|
|
29807
|
+
|
|
29778
29808
|
// src/config.ts
|
|
29779
29809
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
29780
29810
|
import { homedir } from "node:os";
|
|
@@ -30121,6 +30151,23 @@ ${url3}
|
|
|
30121
30151
|
`);
|
|
30122
30152
|
});
|
|
30123
30153
|
}
|
|
30154
|
+
function resultPage(variant, heading, detail) {
|
|
30155
|
+
const accent = variant === "success" ? "#16a34a" : "#dc2626";
|
|
30156
|
+
const glyph = variant === "success" ? '<path d="M20 6 9 17l-5-5"/>' : '<path d="M18 6 6 18M6 6l12 12"/>';
|
|
30157
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${heading} \xB7 Invinite CLI</title><style>
|
|
30158
|
+
:root{color-scheme:light dark}*{box-sizing:border-box}
|
|
30159
|
+
body{margin:0;min-height:100vh;display:grid;place-items:center;padding:24px;background:#fafafa;color:#18181b;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}
|
|
30160
|
+
.card{width:min(92vw,420px);padding:40px 36px;border:1px solid #e4e4e7;border-radius:16px;background:#fff;text-align:center;box-shadow:0 1px 3px rgba(0,0,0,.04),0 10px 34px rgba(0,0,0,.07)}
|
|
30161
|
+
.badge{width:56px;height:56px;margin:0 auto 22px;border-radius:999px;display:grid;place-items:center;color:#fff;background:${accent}}
|
|
30162
|
+
.badge svg{width:28px;height:28px;fill:none;stroke:currentColor;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}
|
|
30163
|
+
h1{margin:0 0 8px;font-size:20px;font-weight:650;letter-spacing:-.01em}
|
|
30164
|
+
p{margin:0;font-size:14.5px;line-height:1.5;color:#71717a}
|
|
30165
|
+
kbd{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12.5px;background:rgba(127,127,127,.14);padding:1px 6px;border-radius:5px;color:inherit}
|
|
30166
|
+
.brand{margin-top:26px;font-size:12px;letter-spacing:.05em;text-transform:uppercase;color:#a1a1aa;font-weight:600}
|
|
30167
|
+
@media(prefers-color-scheme:dark){body{background:#0a0a0a;color:#fafafa}.card{background:#141414;border-color:#262626}}
|
|
30168
|
+
</style></head><body><main class="card"><div class="badge"><svg viewBox="0 0 24 24">${glyph}</svg></div><h1>${heading}</h1><p>${detail}</p><div class="brand">Invinite CLI</div></main></body></html>`;
|
|
30169
|
+
}
|
|
30170
|
+
var HTML_HEADERS = { "Content-Type": "text/html; charset=utf-8" };
|
|
30124
30171
|
async function runLogin() {
|
|
30125
30172
|
if (process.env.INVINITE_CLI_MODE === "direct")
|
|
30126
30173
|
throw new Error("Browser login is only available in API mode. Set INVINITE_CLI_TOKEN for direct mode.");
|
|
@@ -30145,7 +30192,13 @@ async function runLogin() {
|
|
|
30145
30192
|
}
|
|
30146
30193
|
const callbackError = callback.searchParams.get("error");
|
|
30147
30194
|
if (callbackError) {
|
|
30148
|
-
response7.writeHead(400).end(
|
|
30195
|
+
response7.writeHead(400, HTML_HEADERS).end(
|
|
30196
|
+
resultPage(
|
|
30197
|
+
"error",
|
|
30198
|
+
"Sign-in failed",
|
|
30199
|
+
"Something went wrong during authentication. Close this tab and run inv login again."
|
|
30200
|
+
)
|
|
30201
|
+
);
|
|
30149
30202
|
rejectLogin(new Error(callbackError));
|
|
30150
30203
|
server.close();
|
|
30151
30204
|
return;
|
|
@@ -30164,11 +30217,23 @@ async function runLogin() {
|
|
|
30164
30217
|
const result = await exchange.json();
|
|
30165
30218
|
if (!exchange.ok || typeof result !== "object" || result === null || typeof result.token !== "string")
|
|
30166
30219
|
throw new Error("The login exchange was rejected.");
|
|
30167
|
-
response7.writeHead(200,
|
|
30220
|
+
response7.writeHead(200, HTML_HEADERS).end(
|
|
30221
|
+
resultPage(
|
|
30222
|
+
"success",
|
|
30223
|
+
"You're signed in",
|
|
30224
|
+
"You can close this tab and return to your terminal."
|
|
30225
|
+
)
|
|
30226
|
+
);
|
|
30168
30227
|
resolveLogin(result);
|
|
30169
30228
|
server.close();
|
|
30170
30229
|
} catch (error98) {
|
|
30171
|
-
response7.writeHead(500).end(
|
|
30230
|
+
response7.writeHead(500, HTML_HEADERS).end(
|
|
30231
|
+
resultPage(
|
|
30232
|
+
"error",
|
|
30233
|
+
"Sign-in failed",
|
|
30234
|
+
"The login could not be completed. Close this tab and run inv login again."
|
|
30235
|
+
)
|
|
30236
|
+
);
|
|
30172
30237
|
rejectLogin(error98 instanceof Error ? error98 : new Error(String(error98)));
|
|
30173
30238
|
server.close();
|
|
30174
30239
|
}
|
|
@@ -30314,7 +30379,7 @@ function formatOutput(output, format) {
|
|
|
30314
30379
|
}
|
|
30315
30380
|
|
|
30316
30381
|
// src/inv.ts
|
|
30317
|
-
var VERSION =
|
|
30382
|
+
var VERSION = package_default.version;
|
|
30318
30383
|
function parseArguments(args) {
|
|
30319
30384
|
const positional = [];
|
|
30320
30385
|
const flags = {};
|