@opennous/cli 0.8.0 → 0.9.0
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/package.json +1 -1
- package/src/index.js +22 -5
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -837,18 +837,25 @@ program
|
|
|
837
837
|
// freshly minted API key is saved to ~/.nous/config.json. No copy-paste. Shared
|
|
838
838
|
// by `nous login` and `nous init`.
|
|
839
839
|
// ---------------------------------------------------------------------------
|
|
840
|
-
async function browserLogin(url) {
|
|
840
|
+
async function browserLogin(url, opts = {}) {
|
|
841
841
|
const apiUrl = url || process.env.NOUS_API_URL || readConfig().apiUrl || "https://api.opennous.cloud";
|
|
842
|
+
// Default = plain browser sign-in. With { startPath, startBody } it redeems a team
|
|
843
|
+
// join token instead (nous join): same device flow, different start endpoint.
|
|
844
|
+
const startPath = opts.startPath || "/api/cli/auth/start";
|
|
845
|
+
const startBody = opts.startBody ? JSON.stringify(opts.startBody) : "{}";
|
|
842
846
|
|
|
843
847
|
let start;
|
|
844
848
|
try {
|
|
845
|
-
const r = await fetch(`${apiUrl}
|
|
846
|
-
method: "POST", headers: { "Content-Type": "application/json" }, body:
|
|
849
|
+
const r = await fetch(`${apiUrl}${startPath}`, {
|
|
850
|
+
method: "POST", headers: { "Content-Type": "application/json" }, body: startBody,
|
|
847
851
|
});
|
|
848
|
-
if (!r.ok)
|
|
852
|
+
if (!r.ok) {
|
|
853
|
+
const j = await r.json().catch(() => ({}));
|
|
854
|
+
throw new Error(j.error ? j.error.replace(/_/g, " ") : `server returned ${r.status}`);
|
|
855
|
+
}
|
|
849
856
|
start = await r.json();
|
|
850
857
|
} catch (e) {
|
|
851
|
-
console.error(`Couldn't start
|
|
858
|
+
console.error(`Couldn't start: ${e.message}`);
|
|
852
859
|
process.exit(1);
|
|
853
860
|
}
|
|
854
861
|
|
|
@@ -895,6 +902,16 @@ program
|
|
|
895
902
|
console.log("Your Nous tools are ready — try `get_workspace_status` in your agent.");
|
|
896
903
|
});
|
|
897
904
|
|
|
905
|
+
program
|
|
906
|
+
.command("join <token>")
|
|
907
|
+
.description("Join a team with an invite/join token and set up your own scoped workspace")
|
|
908
|
+
.option("--url <url>", "API base URL (default: https://api.opennous.cloud)")
|
|
909
|
+
.action(async (token, { url }) => {
|
|
910
|
+
await browserLogin(url, { startPath: "/api/cli/auth/join/start", startBody: { token } });
|
|
911
|
+
console.log("You're in — your agent now has its own member-scoped Nous workspace.");
|
|
912
|
+
console.log("Try `get_workspace_status` in your agent.");
|
|
913
|
+
});
|
|
914
|
+
|
|
898
915
|
// ---------------------------------------------------------------------------
|
|
899
916
|
// MCP registration — connect Nous to whatever agent is on this machine.
|
|
900
917
|
//
|