@overscore/cli 0.13.18 → 0.13.19
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/index.js +7 -68
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1155,7 +1155,6 @@ async function listDashboards() {
|
|
|
1155
1155
|
}
|
|
1156
1156
|
const data = (await res.json());
|
|
1157
1157
|
console.log(`\n ${data.project} (${data.project_slug})\n`);
|
|
1158
|
-
console.log(" Showing one project — run 'overscore projects' to list them all.\n");
|
|
1159
1158
|
if (data.dashboards.length === 0) {
|
|
1160
1159
|
console.log(" No dashboards yet.\n");
|
|
1161
1160
|
return;
|
|
@@ -1174,65 +1173,6 @@ async function listDashboards() {
|
|
|
1174
1173
|
console.log();
|
|
1175
1174
|
}
|
|
1176
1175
|
}
|
|
1177
|
-
// Account-level project list. Uses the CLI DEVICE token (ocli_) rather than a
|
|
1178
|
-
// project-scoped API key, so it can enumerate EVERY project on the account —
|
|
1179
|
-
// including empty ones a project key could never see.
|
|
1180
|
-
async function listProjects() {
|
|
1181
|
-
const configPath = path.join(process.env.HOME || "", ".overscore", "config");
|
|
1182
|
-
const readToken = () => {
|
|
1183
|
-
const cfg = fs.existsSync(configPath)
|
|
1184
|
-
? parseEnv(fs.readFileSync(configPath, "utf-8"))
|
|
1185
|
-
: {};
|
|
1186
|
-
return cfg.OVERSCORE_DEVICE_TOKEN;
|
|
1187
|
-
};
|
|
1188
|
-
let deviceToken = readToken();
|
|
1189
|
-
if (!deviceToken) {
|
|
1190
|
-
console.log("\n No session found. Launching browser login...\n");
|
|
1191
|
-
await authLogin();
|
|
1192
|
-
deviceToken = readToken();
|
|
1193
|
-
if (!deviceToken) {
|
|
1194
|
-
console.error("\n Could not authenticate.\n");
|
|
1195
|
-
process.exit(1);
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
for (let attempt = 0; attempt < 2; attempt++) {
|
|
1199
|
-
const res = await fetch(`${HUB_URL}/api/projects`, {
|
|
1200
|
-
headers: { Authorization: `Bearer ${deviceToken}` },
|
|
1201
|
-
});
|
|
1202
|
-
if (res.ok) {
|
|
1203
|
-
const { projects } = (await res.json());
|
|
1204
|
-
printProjects(projects);
|
|
1205
|
-
return;
|
|
1206
|
-
}
|
|
1207
|
-
// Device token expired — re-auth once, then retry.
|
|
1208
|
-
if (res.status === 401 && attempt === 0) {
|
|
1209
|
-
console.log("\n Session expired. Launching browser login...\n");
|
|
1210
|
-
await authLogin();
|
|
1211
|
-
deviceToken = readToken();
|
|
1212
|
-
if (!deviceToken)
|
|
1213
|
-
break;
|
|
1214
|
-
continue;
|
|
1215
|
-
}
|
|
1216
|
-
const body = (await res.json().catch(() => ({})));
|
|
1217
|
-
console.error(`\n Error: ${body.error || `HTTP ${res.status}`}\n`);
|
|
1218
|
-
process.exit(1);
|
|
1219
|
-
}
|
|
1220
|
-
console.error("\n Could not authenticate.\n");
|
|
1221
|
-
process.exit(1);
|
|
1222
|
-
}
|
|
1223
|
-
function printProjects(projects) {
|
|
1224
|
-
if (!projects.length) {
|
|
1225
|
-
console.log("\n No projects yet.\n\n Create one: npx create-overscore --dashboard <name> --project <slug>\n");
|
|
1226
|
-
return;
|
|
1227
|
-
}
|
|
1228
|
-
console.log(`\n Your projects (${projects.length})\n`);
|
|
1229
|
-
for (const p of projects) {
|
|
1230
|
-
const count = p.dashboard_count === 1 ? "1 dashboard" : `${p.dashboard_count} dashboards`;
|
|
1231
|
-
console.log(` ${p.name}`);
|
|
1232
|
-
console.log(` slug: ${p.slug} · ${count} · ${p.role}`);
|
|
1233
|
-
console.log();
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
1176
|
function collectFiles(dir, prefix) {
|
|
1237
1177
|
const files = [];
|
|
1238
1178
|
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
@@ -2911,12 +2851,16 @@ async function authLogin() {
|
|
|
2911
2851
|
catch {
|
|
2912
2852
|
// Browser open failed — user can follow the printed URL
|
|
2913
2853
|
}
|
|
2914
|
-
// Wait up to
|
|
2854
|
+
// Wait up to 5 minutes for the callback. A first-time login (OAuth, 2FA, or
|
|
2855
|
+
// just stepping away) can easily blow past a tight window, and a premature
|
|
2856
|
+
// timeout is worse than a long wait — it strands a login the user is mid-way
|
|
2857
|
+
// through and shows a scary error for something that was about to succeed.
|
|
2915
2858
|
const timeout = setTimeout(() => {
|
|
2916
|
-
console.error("\n
|
|
2859
|
+
console.error("\n Login timed out — no response after 5 minutes." +
|
|
2860
|
+
"\n Run the command again to retry.\n");
|
|
2917
2861
|
server.close();
|
|
2918
2862
|
process.exit(1);
|
|
2919
|
-
},
|
|
2863
|
+
}, 300000);
|
|
2920
2864
|
const { token: deviceToken, project: projectSlug } = await callbackPromise;
|
|
2921
2865
|
clearTimeout(timeout);
|
|
2922
2866
|
server.close();
|
|
@@ -3112,9 +3056,6 @@ else if (command === "versions") {
|
|
|
3112
3056
|
else if (command === "list") {
|
|
3113
3057
|
listDashboards();
|
|
3114
3058
|
}
|
|
3115
|
-
else if (command === "projects") {
|
|
3116
|
-
listProjects();
|
|
3117
|
-
}
|
|
3118
3059
|
else if (command === "install-skills") {
|
|
3119
3060
|
installSkills();
|
|
3120
3061
|
}
|
|
@@ -3279,7 +3220,6 @@ else {
|
|
|
3279
3220
|
auth logout Remove saved credentials
|
|
3280
3221
|
dev Start the dev server (injects auth automatically)
|
|
3281
3222
|
list List all dashboards in the project
|
|
3282
|
-
projects List every project on your account
|
|
3283
3223
|
deploy Build and deploy the dashboard
|
|
3284
3224
|
pull <slug> Pull source code from the hub
|
|
3285
3225
|
versions List deploy history
|
|
@@ -3292,7 +3232,6 @@ else {
|
|
|
3292
3232
|
npx @overscore/cli auth login
|
|
3293
3233
|
npx @overscore/cli dev
|
|
3294
3234
|
npx @overscore/cli list
|
|
3295
|
-
npx @overscore/cli projects
|
|
3296
3235
|
npx @overscore/cli deploy --message "description"
|
|
3297
3236
|
npx @overscore/cli pull <slug>
|
|
3298
3237
|
npx @overscore/cli pull <slug> --version 3
|