@podge/cli 0.2.0-beta.0 → 0.2.0-beta.10
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/commands/apikeys.js +3 -3
- package/dist/commands/auth.js +6 -0
- package/dist/commands/collections.js +26 -3
- package/dist/commands/debug.js +1 -1
- package/dist/commands/environments.js +24 -2
- package/dist/commands/items.js +5 -5
- package/dist/commands/search.js +1 -1
- package/dist/commands/workspaces.js +2 -2
- package/dist/index.js +31 -1
- package/dist/lib/auth-server.js +86 -4
- package/dist/lib/config.d.ts +0 -1
- package/dist/lib/config.js +1 -3
- package/package.json +10 -8
package/dist/commands/apikeys.js
CHANGED
|
@@ -30,7 +30,7 @@ function registerApiKeyCommands(program) {
|
|
|
30
30
|
.action(async (opts) => {
|
|
31
31
|
try {
|
|
32
32
|
const ws = requireWorkspace(opts);
|
|
33
|
-
const { data } = await (0, client_1.getClient)().get(`/
|
|
33
|
+
const { data } = await (0, client_1.getClient)().get(`/v1/workspaces/${ws}/api-keys`);
|
|
34
34
|
if (opts.json) {
|
|
35
35
|
(0, output_1.printJson)(data);
|
|
36
36
|
}
|
|
@@ -69,7 +69,7 @@ function registerApiKeyCommands(program) {
|
|
|
69
69
|
if (opts.environment) {
|
|
70
70
|
body.environmentKey = opts.environment;
|
|
71
71
|
}
|
|
72
|
-
const { data } = await (0, client_1.getClient)().post(`/
|
|
72
|
+
const { data } = await (0, client_1.getClient)().post(`/v1/workspaces/${ws}/api-keys`, body);
|
|
73
73
|
if (opts.json) {
|
|
74
74
|
(0, output_1.printJson)(data);
|
|
75
75
|
}
|
|
@@ -92,7 +92,7 @@ function registerApiKeyCommands(program) {
|
|
|
92
92
|
.action(async (keyId, opts) => {
|
|
93
93
|
try {
|
|
94
94
|
const ws = requireWorkspace(opts);
|
|
95
|
-
await (0, client_1.getClient)().delete(`/
|
|
95
|
+
await (0, client_1.getClient)().delete(`/v1/workspaces/${ws}/api-keys/${keyId}`);
|
|
96
96
|
(0, output_1.printSuccess)(`API key ${keyId} revoked`);
|
|
97
97
|
}
|
|
98
98
|
catch (err) {
|
package/dist/commands/auth.js
CHANGED
|
@@ -79,6 +79,12 @@ function registerAuthCommands(program) {
|
|
|
79
79
|
const result = await tokenPromise;
|
|
80
80
|
(0, config_1.saveCredentials)({ token: result.token, apiUrl: (0, config_1.getApiUrl)() });
|
|
81
81
|
(0, output_1.printSuccess)("Authenticated successfully. Credentials saved to ~/.podge/credentials.json");
|
|
82
|
+
console.log("");
|
|
83
|
+
(0, output_1.printInfo)("Get started:");
|
|
84
|
+
console.log(` ${chalk_1.default.bold("podge ws list")} List your workspaces`);
|
|
85
|
+
console.log(` ${chalk_1.default.bold("podge config set")} Set default workspace & environment`);
|
|
86
|
+
console.log(` ${chalk_1.default.bold("podge --help")} Show all commands`);
|
|
87
|
+
console.log("");
|
|
82
88
|
}
|
|
83
89
|
catch (err) {
|
|
84
90
|
console.error(chalk_1.default.red(err instanceof Error ? err.message : "Authentication failed."));
|
|
@@ -32,7 +32,7 @@ function registerCollectionCommands(program) {
|
|
|
32
32
|
.action(async (opts) => {
|
|
33
33
|
try {
|
|
34
34
|
const { ws, env } = requireContext(opts);
|
|
35
|
-
const { data } = await (0, client_1.getClient)().get(`/
|
|
35
|
+
const { data } = await (0, client_1.getClient)().get(`/v1/workspaces/${ws}/environments/${env}/collections`);
|
|
36
36
|
if (opts.json) {
|
|
37
37
|
(0, output_1.printJson)(data);
|
|
38
38
|
}
|
|
@@ -49,6 +49,29 @@ function registerCollectionCommands(program) {
|
|
|
49
49
|
(0, client_1.handleError)(err);
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
|
+
col
|
|
53
|
+
.command("create")
|
|
54
|
+
.description("Create a collection")
|
|
55
|
+
.requiredOption("--name <name>", "Collection name")
|
|
56
|
+
.requiredOption("--key <key>", "Collection key")
|
|
57
|
+
.option("-w, --workspace <key>", "Workspace key")
|
|
58
|
+
.option("-e, --environment <key>", "Environment key")
|
|
59
|
+
.option("--json", "Output as JSON")
|
|
60
|
+
.action(async (opts) => {
|
|
61
|
+
try {
|
|
62
|
+
const { ws, env } = requireContext(opts);
|
|
63
|
+
const { data } = await (0, client_1.getClient)().post(`/v1/workspaces/${ws}/environments/${env}/collections`, { name: opts.name, key: opts.key });
|
|
64
|
+
if (opts.json) {
|
|
65
|
+
(0, output_1.printJson)(data);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
(0, output_1.printSuccess)(`Collection "${opts.name}" created (key: ${opts.key})`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
(0, client_1.handleError)(err);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
52
75
|
col
|
|
53
76
|
.command("get <key>")
|
|
54
77
|
.description("Get collection details")
|
|
@@ -58,7 +81,7 @@ function registerCollectionCommands(program) {
|
|
|
58
81
|
.action(async (key, opts) => {
|
|
59
82
|
try {
|
|
60
83
|
const { ws, env } = requireContext(opts);
|
|
61
|
-
const { data } = await (0, client_1.getClient)().get(`/
|
|
84
|
+
const { data } = await (0, client_1.getClient)().get(`/v1/workspaces/${ws}/environments/${env}/collections/${key}`);
|
|
62
85
|
if (opts.json) {
|
|
63
86
|
(0, output_1.printJson)(data);
|
|
64
87
|
}
|
|
@@ -79,7 +102,7 @@ function registerCollectionCommands(program) {
|
|
|
79
102
|
.action(async (key, opts) => {
|
|
80
103
|
try {
|
|
81
104
|
const { ws, env } = requireContext(opts);
|
|
82
|
-
const { data } = await (0, client_1.getClient)().get(`/
|
|
105
|
+
const { data } = await (0, client_1.getClient)().get(`/v1/workspaces/${ws}/environments/${env}/collections/${key}/schema`);
|
|
83
106
|
(0, output_1.printJson)(data);
|
|
84
107
|
}
|
|
85
108
|
catch (err) {
|
package/dist/commands/debug.js
CHANGED
|
@@ -34,7 +34,7 @@ function registerDebugCommands(program) {
|
|
|
34
34
|
.action(() => {
|
|
35
35
|
const config = (0, config_1.getConfig)();
|
|
36
36
|
console.log(` API URL: ${(0, config_1.getApiUrl)()}${config.apiUrl ? " (override)" : ""}`);
|
|
37
|
-
console.log(` App URL: ${(0, config_1.getAppUrl)()}
|
|
37
|
+
console.log(` App URL: ${(0, config_1.getAppUrl)()} (derived from API URL)`);
|
|
38
38
|
console.log(` Config: ~/.podge/config.json`);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
@@ -29,7 +29,7 @@ function registerEnvironmentCommands(program) {
|
|
|
29
29
|
.action(async (opts) => {
|
|
30
30
|
try {
|
|
31
31
|
const ws = requireWorkspace(opts);
|
|
32
|
-
const { data } = await (0, client_1.getClient)().get(`/
|
|
32
|
+
const { data } = await (0, client_1.getClient)().get(`/v1/workspaces/${ws}/environments`);
|
|
33
33
|
if (opts.json) {
|
|
34
34
|
(0, output_1.printJson)(data);
|
|
35
35
|
}
|
|
@@ -46,6 +46,28 @@ function registerEnvironmentCommands(program) {
|
|
|
46
46
|
(0, client_1.handleError)(err);
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
+
env
|
|
50
|
+
.command("create")
|
|
51
|
+
.description("Create an environment")
|
|
52
|
+
.requiredOption("--name <name>", "Environment name")
|
|
53
|
+
.requiredOption("--key <key>", "Environment key")
|
|
54
|
+
.option("-w, --workspace <key>", "Workspace key")
|
|
55
|
+
.option("--json", "Output as JSON")
|
|
56
|
+
.action(async (opts) => {
|
|
57
|
+
try {
|
|
58
|
+
const ws = requireWorkspace(opts);
|
|
59
|
+
const { data } = await (0, client_1.getClient)().post(`/v1/workspaces/${ws}/environments`, { name: opts.name, key: opts.key });
|
|
60
|
+
if (opts.json) {
|
|
61
|
+
(0, output_1.printJson)(data);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
(0, output_1.printSuccess)(`Environment "${opts.name}" created (key: ${opts.key})`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
(0, client_1.handleError)(err);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
49
71
|
env
|
|
50
72
|
.command("get <key>")
|
|
51
73
|
.description("Get environment details")
|
|
@@ -54,7 +76,7 @@ function registerEnvironmentCommands(program) {
|
|
|
54
76
|
.action(async (key, opts) => {
|
|
55
77
|
try {
|
|
56
78
|
const ws = requireWorkspace(opts);
|
|
57
|
-
const { data } = await (0, client_1.getClient)().get(`/
|
|
79
|
+
const { data } = await (0, client_1.getClient)().get(`/v1/workspaces/${ws}/environments/${key}`);
|
|
58
80
|
if (opts.json) {
|
|
59
81
|
(0, output_1.printJson)(data);
|
|
60
82
|
}
|
package/dist/commands/items.js
CHANGED
|
@@ -68,7 +68,7 @@ function registerItemCommands(program) {
|
|
|
68
68
|
console.error(chalk_1.default.red("Provide --file or --data"));
|
|
69
69
|
process.exit(1);
|
|
70
70
|
}
|
|
71
|
-
const url = `/
|
|
71
|
+
const url = `/v1/workspaces/${ws}/environments/${env}/collections/${col}/items${opts.dryRun ? "?dryRun=true" : ""}`;
|
|
72
72
|
const { data } = await (0, client_1.getClient)().post(url, body);
|
|
73
73
|
if (opts.dryRun) {
|
|
74
74
|
(0, output_1.printSuccess)("Dry run successful");
|
|
@@ -91,7 +91,7 @@ function registerItemCommands(program) {
|
|
|
91
91
|
.action(async (documentId, opts) => {
|
|
92
92
|
try {
|
|
93
93
|
const { ws, env, col } = requireFullContext(opts);
|
|
94
|
-
const { data } = await (0, client_1.getClient)().get(`/
|
|
94
|
+
const { data } = await (0, client_1.getClient)().get(`/v1/workspaces/${ws}/environments/${env}/collections/${col}/documents/${documentId}`);
|
|
95
95
|
(0, output_1.printJson)(data);
|
|
96
96
|
}
|
|
97
97
|
catch (err) {
|
|
@@ -110,7 +110,7 @@ function registerItemCommands(program) {
|
|
|
110
110
|
const { ws, env, col } = requireFullContext(opts);
|
|
111
111
|
const body = JSON.parse(fs.readFileSync(opts.file, "utf-8"));
|
|
112
112
|
const items = Array.isArray(body) ? body : body.items || [body];
|
|
113
|
-
const url = `/
|
|
113
|
+
const url = `/v1/workspaces/${ws}/environments/${env}/collections/${col}/items/batch`;
|
|
114
114
|
const { data } = await (0, client_1.getClient)().post(url, { items });
|
|
115
115
|
(0, output_1.printSuccess)(`Batch import submitted (${items.length} items)`);
|
|
116
116
|
(0, output_1.printJson)(data);
|
|
@@ -128,7 +128,7 @@ function registerItemCommands(program) {
|
|
|
128
128
|
.action(async (documentId, opts) => {
|
|
129
129
|
try {
|
|
130
130
|
const { ws, env, col } = requireFullContext(opts);
|
|
131
|
-
const { data } = await (0, client_1.getClient)().delete(`/
|
|
131
|
+
const { data } = await (0, client_1.getClient)().delete(`/v1/workspaces/${ws}/environments/${env}/collections/${col}/documents/${documentId}`);
|
|
132
132
|
(0, output_1.printSuccess)(`Document ${documentId} deleted`);
|
|
133
133
|
(0, output_1.printJson)(data);
|
|
134
134
|
}
|
|
@@ -158,7 +158,7 @@ function registerItemCommands(program) {
|
|
|
158
158
|
console.error(chalk_1.default.red("Provide --file or --data"));
|
|
159
159
|
process.exit(1);
|
|
160
160
|
}
|
|
161
|
-
const { data } = await (0, client_1.getClient)().patch(`/
|
|
161
|
+
const { data } = await (0, client_1.getClient)().patch(`/v1/workspaces/${ws}/environments/${env}/collections/${col}/documents/${documentId}`, body);
|
|
162
162
|
(0, output_1.printSuccess)(`Document ${documentId} update submitted`);
|
|
163
163
|
(0, output_1.printJson)(data);
|
|
164
164
|
}
|
package/dist/commands/search.js
CHANGED
|
@@ -36,7 +36,7 @@ function registerSearchCommands(program) {
|
|
|
36
36
|
if (opts.mode) {
|
|
37
37
|
body.options = { mode: opts.mode };
|
|
38
38
|
}
|
|
39
|
-
const { data } = await (0, client_1.getClient)().post(`/
|
|
39
|
+
const { data } = await (0, client_1.getClient)().post(`/v1/workspaces/${ws}/environments/${env}/collections/${col}/search`, body, { headers });
|
|
40
40
|
if (opts.json) {
|
|
41
41
|
(0, output_1.printJson)(data);
|
|
42
42
|
}
|
|
@@ -13,7 +13,7 @@ function registerWorkspaceCommands(program) {
|
|
|
13
13
|
.option("--json", "Output as JSON")
|
|
14
14
|
.action(async (opts) => {
|
|
15
15
|
try {
|
|
16
|
-
const { data } = await (0, client_1.getClient)().get("/
|
|
16
|
+
const { data } = await (0, client_1.getClient)().get("/v1/workspaces");
|
|
17
17
|
if (opts.json) {
|
|
18
18
|
(0, output_1.printJson)(data);
|
|
19
19
|
}
|
|
@@ -35,7 +35,7 @@ function registerWorkspaceCommands(program) {
|
|
|
35
35
|
.option("--json", "Output as JSON")
|
|
36
36
|
.action(async (key, opts) => {
|
|
37
37
|
try {
|
|
38
|
-
const { data } = await (0, client_1.getClient)().get(`/
|
|
38
|
+
const { data } = await (0, client_1.getClient)().get(`/v1/workspaces/${key}`);
|
|
39
39
|
if (opts.json) {
|
|
40
40
|
(0, output_1.printJson)(data);
|
|
41
41
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
3
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
7
|
const commander_1 = require("commander");
|
|
5
8
|
const fs_1 = require("fs");
|
|
6
9
|
const path_1 = require("path");
|
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
7
11
|
const auth_1 = require("./commands/auth");
|
|
8
12
|
const config_1 = require("./commands/config");
|
|
9
13
|
const workspaces_1 = require("./commands/workspaces");
|
|
@@ -14,11 +18,37 @@ const search_1 = require("./commands/search");
|
|
|
14
18
|
const apikeys_1 = require("./commands/apikeys");
|
|
15
19
|
const debug_1 = require("./commands/debug");
|
|
16
20
|
const pkg = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, "..", "package.json"), "utf-8"));
|
|
21
|
+
const accent = chalk_1.default.hex("#C2C836");
|
|
22
|
+
const dim = chalk_1.default.dim;
|
|
23
|
+
function showBanner() {
|
|
24
|
+
console.log("");
|
|
25
|
+
console.log(accent(" ____ _ "));
|
|
26
|
+
console.log(accent(" | _ \\ ___ __| | __ _ ___ "));
|
|
27
|
+
console.log(accent(" | |_) |/ _ \\ / _` |/ _` |/ _ \\"));
|
|
28
|
+
console.log(accent(" | __/| (_) | (_| | (_| | __/"));
|
|
29
|
+
console.log(accent(" |_| \\___/ \\__,_|\\__, |\\___|"));
|
|
30
|
+
console.log(accent(" |___/ "));
|
|
31
|
+
console.log(dim(` v${pkg.version}`));
|
|
32
|
+
console.log("");
|
|
33
|
+
}
|
|
34
|
+
// Show banner when run with no args, top-level --help, or auth commands
|
|
35
|
+
const args = process.argv.slice(2);
|
|
36
|
+
const isTopLevelHelp = args.length === 0 ||
|
|
37
|
+
(args.length === 1 && (args[0] === "--help" || args[0] === "-h"));
|
|
38
|
+
if (isTopLevelHelp || args[0] === "auth") {
|
|
39
|
+
showBanner();
|
|
40
|
+
}
|
|
17
41
|
const program = new commander_1.Command();
|
|
18
42
|
program
|
|
19
43
|
.name("podge")
|
|
20
44
|
.description("Podge CLI — manage workspaces, collections, and search")
|
|
21
|
-
.version(pkg.version);
|
|
45
|
+
.version(pkg.version, "-v, --version");
|
|
46
|
+
program
|
|
47
|
+
.command("version")
|
|
48
|
+
.description("Show the installed CLI version")
|
|
49
|
+
.action(() => {
|
|
50
|
+
console.log(pkg.version);
|
|
51
|
+
});
|
|
22
52
|
(0, auth_1.registerAuthCommands)(program);
|
|
23
53
|
(0, config_1.registerConfigCommands)(program);
|
|
24
54
|
(0, workspaces_1.registerWorkspaceCommands)(program);
|
package/dist/lib/auth-server.js
CHANGED
|
@@ -26,6 +26,74 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.startAuthServer = void 0;
|
|
27
27
|
const http = __importStar(require("http"));
|
|
28
28
|
const url = __importStar(require("url"));
|
|
29
|
+
function authPage(title, message, success) {
|
|
30
|
+
const accent = success ? "#C2C836" : "#ef4444";
|
|
31
|
+
return `<!DOCTYPE html>
|
|
32
|
+
<html lang="en">
|
|
33
|
+
<head>
|
|
34
|
+
<meta charset="utf-8" />
|
|
35
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
36
|
+
<title>Podge CLI — ${title}</title>
|
|
37
|
+
<style>
|
|
38
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
39
|
+
body {
|
|
40
|
+
font-family: Inter, system-ui, -apple-system, sans-serif;
|
|
41
|
+
background: #161820;
|
|
42
|
+
color: #E8E9ED;
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
min-height: 100vh;
|
|
47
|
+
}
|
|
48
|
+
.card {
|
|
49
|
+
background: #1D1F28;
|
|
50
|
+
border: 1px solid #2a2c38;
|
|
51
|
+
border-radius: 12px;
|
|
52
|
+
padding: 48px;
|
|
53
|
+
max-width: 440px;
|
|
54
|
+
text-align: center;
|
|
55
|
+
}
|
|
56
|
+
.icon {
|
|
57
|
+
width: 56px;
|
|
58
|
+
height: 56px;
|
|
59
|
+
border-radius: 50%;
|
|
60
|
+
background: ${accent}20;
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
margin: 0 auto 24px;
|
|
65
|
+
font-size: 28px;
|
|
66
|
+
}
|
|
67
|
+
h2 {
|
|
68
|
+
color: ${accent};
|
|
69
|
+
font-size: 20px;
|
|
70
|
+
font-weight: 600;
|
|
71
|
+
margin-bottom: 12px;
|
|
72
|
+
}
|
|
73
|
+
p {
|
|
74
|
+
color: #8b8d97;
|
|
75
|
+
font-size: 14px;
|
|
76
|
+
line-height: 1.5;
|
|
77
|
+
}
|
|
78
|
+
code {
|
|
79
|
+
font-family: "JetBrains Mono", ui-monospace, monospace;
|
|
80
|
+
background: #161820;
|
|
81
|
+
padding: 2px 8px;
|
|
82
|
+
border-radius: 4px;
|
|
83
|
+
font-size: 13px;
|
|
84
|
+
color: #C2C836;
|
|
85
|
+
}
|
|
86
|
+
</style>
|
|
87
|
+
</head>
|
|
88
|
+
<body>
|
|
89
|
+
<div class="card">
|
|
90
|
+
<div class="icon">${success ? "✓" : "✗"}</div>
|
|
91
|
+
<h2>${title}</h2>
|
|
92
|
+
<p>${message}</p>
|
|
93
|
+
</div>
|
|
94
|
+
</body>
|
|
95
|
+
</html>`;
|
|
96
|
+
}
|
|
29
97
|
function startAuthServer(expectedState, timeoutMs = 120000) {
|
|
30
98
|
return new Promise((resolve, reject) => {
|
|
31
99
|
let settled = false;
|
|
@@ -40,6 +108,20 @@ function startAuthServer(expectedState, timeoutMs = 120000) {
|
|
|
40
108
|
}, timeoutMs);
|
|
41
109
|
server.on("request", (req, res) => {
|
|
42
110
|
const parsed = url.parse(req.url ?? "", true);
|
|
111
|
+
// CORS headers for cross-origin requests from the web app
|
|
112
|
+
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
113
|
+
res.setHeader("Access-Control-Allow-Methods", "GET, OPTIONS");
|
|
114
|
+
res.setHeader("Access-Control-Allow-Headers", "Content-Type");
|
|
115
|
+
if (req.method === "OPTIONS") {
|
|
116
|
+
res.writeHead(204);
|
|
117
|
+
res.end();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (parsed.pathname === "/state") {
|
|
121
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
122
|
+
res.end(JSON.stringify({ state: expectedState }));
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
43
125
|
if (parsed.pathname !== "/callback") {
|
|
44
126
|
res.writeHead(404);
|
|
45
127
|
res.end("Not found");
|
|
@@ -49,7 +131,7 @@ function startAuthServer(expectedState, timeoutMs = 120000) {
|
|
|
49
131
|
// Always respond with HTML
|
|
50
132
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
51
133
|
if (error) {
|
|
52
|
-
res.end("
|
|
134
|
+
res.end(authPage("Authentication failed", "Something went wrong. You can close this tab and try again.", false));
|
|
53
135
|
clearTimeout(timer);
|
|
54
136
|
settled = true;
|
|
55
137
|
server.close();
|
|
@@ -57,7 +139,7 @@ function startAuthServer(expectedState, timeoutMs = 120000) {
|
|
|
57
139
|
return;
|
|
58
140
|
}
|
|
59
141
|
if (state !== expectedState) {
|
|
60
|
-
res.end("
|
|
142
|
+
res.end(authPage("Authentication failed", "Invalid state parameter. You can close this tab and try again.", false));
|
|
61
143
|
clearTimeout(timer);
|
|
62
144
|
settled = true;
|
|
63
145
|
server.close();
|
|
@@ -65,14 +147,14 @@ function startAuthServer(expectedState, timeoutMs = 120000) {
|
|
|
65
147
|
return;
|
|
66
148
|
}
|
|
67
149
|
if (!token) {
|
|
68
|
-
res.end("
|
|
150
|
+
res.end(authPage("Authentication failed", "No token was received. You can close this tab and try again.", false));
|
|
69
151
|
clearTimeout(timer);
|
|
70
152
|
settled = true;
|
|
71
153
|
server.close();
|
|
72
154
|
rejToken(new Error("No token received from the browser."));
|
|
73
155
|
return;
|
|
74
156
|
}
|
|
75
|
-
res.end("
|
|
157
|
+
res.end(authPage("Authentication successful!", "You can close this tab and return to your terminal. Run <code>podge --help</code> to get started.", true));
|
|
76
158
|
clearTimeout(timer);
|
|
77
159
|
settled = true;
|
|
78
160
|
server.close();
|
package/dist/lib/config.d.ts
CHANGED
package/dist/lib/config.js
CHANGED
|
@@ -82,14 +82,12 @@ function writeConfig(config) {
|
|
|
82
82
|
}
|
|
83
83
|
exports.writeConfig = writeConfig;
|
|
84
84
|
const DEFAULT_API_URL = "https://dev.podge.dev/api";
|
|
85
|
-
const DEFAULT_APP_URL = "https://app.podge.io";
|
|
86
85
|
function getApiUrl() {
|
|
87
86
|
const config = getConfig();
|
|
88
87
|
return config.apiUrl ?? DEFAULT_API_URL;
|
|
89
88
|
}
|
|
90
89
|
exports.getApiUrl = getApiUrl;
|
|
91
90
|
function getAppUrl() {
|
|
92
|
-
|
|
93
|
-
return config.appUrl ?? DEFAULT_APP_URL;
|
|
91
|
+
return getApiUrl().replace(/\/api$/, "");
|
|
94
92
|
}
|
|
95
93
|
exports.getAppUrl = getAppUrl;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@podge/cli",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.10",
|
|
4
4
|
"description": "CLI for Podge — manage workspaces, collections, and search",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"dev": "tsc --watch",
|
|
16
|
+
"clean": "rm -rf dist",
|
|
17
|
+
"start": "node dist/index.js",
|
|
18
|
+
"prepublishOnly": "pnpm run clean && pnpm run build",
|
|
19
|
+
"release": "bash scripts/release.sh"
|
|
20
|
+
},
|
|
13
21
|
"dependencies": {
|
|
14
22
|
"axios": "^1.6.0",
|
|
15
23
|
"chalk": "^4.1.2",
|
|
@@ -26,11 +34,5 @@
|
|
|
26
34
|
"repository": {
|
|
27
35
|
"type": "git",
|
|
28
36
|
"url": "https://github.com/rudeluv/podge-cli.git"
|
|
29
|
-
},
|
|
30
|
-
"scripts": {
|
|
31
|
-
"build": "tsc",
|
|
32
|
-
"dev": "tsc --watch",
|
|
33
|
-
"clean": "rm -rf dist",
|
|
34
|
-
"start": "node dist/index.js"
|
|
35
37
|
}
|
|
36
|
-
}
|
|
38
|
+
}
|