@overscore/cli 0.9.0 → 0.9.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/index.js +25 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -695,17 +695,38 @@ async function loadAnalysisConfig() {
|
|
|
695
695
|
};
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
|
-
// (3) Interactive
|
|
698
|
+
// (3) Interactive — only ask for the API key, resolve project automatically
|
|
699
699
|
console.log("\n No Overscore config found. Let's set one up.\n");
|
|
700
700
|
const apiKey = await prompt("API key (from the Hub):");
|
|
701
701
|
if (!apiKey || !apiKey.startsWith("os_")) {
|
|
702
702
|
console.error("\n Error: API key should start with os_\n");
|
|
703
703
|
process.exit(1);
|
|
704
704
|
}
|
|
705
|
-
|
|
705
|
+
// Look up the project slug from the key
|
|
706
|
+
let projectSlug = null;
|
|
707
|
+
try {
|
|
708
|
+
const res = await fetch(`${HUB_URL}/api/auth/key-info`, {
|
|
709
|
+
method: "POST",
|
|
710
|
+
headers: { "Content-Type": "application/json" },
|
|
711
|
+
body: JSON.stringify({ key: apiKey }),
|
|
712
|
+
});
|
|
713
|
+
if (res.ok) {
|
|
714
|
+
const data = (await res.json());
|
|
715
|
+
projectSlug = data.project_slug || null;
|
|
716
|
+
if (projectSlug) {
|
|
717
|
+
console.log(`\n Detected project: ${projectSlug}`);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
catch {
|
|
722
|
+
// Fall back to manual entry
|
|
723
|
+
}
|
|
706
724
|
if (!projectSlug) {
|
|
707
|
-
|
|
708
|
-
|
|
725
|
+
projectSlug = await prompt("Project slug:");
|
|
726
|
+
if (!projectSlug) {
|
|
727
|
+
console.error("\n Error: Project slug is required\n");
|
|
728
|
+
process.exit(1);
|
|
729
|
+
}
|
|
709
730
|
}
|
|
710
731
|
// Save for next time
|
|
711
732
|
fs.mkdirSync(configDir, { recursive: true });
|