lopebase 0.3.1 → 0.4.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/README.md CHANGED
@@ -34,8 +34,10 @@ npx lopebase
34
34
  names, and the variable *names* in example env files, then shows your
35
35
  stack, the services you already use, and what it did not find (for example
36
36
  analytics or error logging). You see each thing it reads as it reads it.
37
- 2. **Connect this computer.** It opens your LopeBase workspace and shows a
38
- short code. Check it matches and press Connect.
37
+ 2. **Connect this computer.** It opens LopeBase in your browser and shows a
38
+ short code. Sign in, or create a free account if you are new, check the code
39
+ matches, and press Connect. No address to type: it finds your workspace.
40
+ For a custom domain or your own server, add `--url https://your-address`.
39
41
  3. **Pick what to connect.** Services already in your code are ticked; the
40
42
  ones you do not use yet are offered, never forced.
41
43
  4. **Hand over to your agent.** It finds the coding agents you have installed
@@ -76,7 +78,7 @@ Made for web products, and fine with anything else:
76
78
  | Command | What it does |
77
79
  | --- | --- |
78
80
  | `npx lopebase` | Scan, connect, choose, and hand over to your agent. |
79
- | `npx lopebase login` | Connect this computer to your workspace with a short code. `--paste` to paste an agent token instead. |
81
+ | `npx lopebase login` | Connect this computer to your workspace with a short code, creating an account if you need one. `--paste` to paste an agent token instead. |
80
82
  | `npx lopebase scan` | Show what the scan found. `--json` for scripts. |
81
83
  | `npx lopebase prompt` | Print the setup prompt instead of starting an agent. |
82
84
  | `npx lopebase mcp` | Run the LopeBase tools as a local MCP server (stdio) for any agent. |
package/dist/lopebase.js CHANGED
@@ -1579,6 +1579,18 @@ function workspaceUrl(input) {
1579
1579
  return null;
1580
1580
  }
1581
1581
  }
1582
+ function signInUrl(input) {
1583
+ for (let [raw, from] of [
1584
+ [input.flag, "--url"],
1585
+ [input.env, "LOPEBASE_URL"]
1586
+ ]) {
1587
+ if (raw === void 0 || raw.trim() === "")
1588
+ continue;
1589
+ let url = workspaceUrl(raw);
1590
+ return url ? { url } : { error: `${from} is not an address: ${raw}` };
1591
+ }
1592
+ return { url: input.saved && workspaceUrl(input.saved) || DEFAULT_URL };
1593
+ }
1582
1594
  function configDir() {
1583
1595
  let base = process.env.XDG_CONFIG_HOME || path.join(os.homedir(), ".config");
1584
1596
  return path.join(base, "lopebase");
@@ -2800,6 +2812,7 @@ ${import_picocolors4.default.bold("Usage")}
2800
2812
 
2801
2813
  ${import_picocolors4.default.bold("Options")}
2802
2814
  --print print the agent prompt instead of starting an agent
2815
+ --url <address> sign in to this workspace or server (also LOPEBASE_URL)
2803
2816
  --no-motion no animation (also LOPEBASE_NO_MOTION=1)
2804
2817
 
2805
2818
  ${import_picocolors4.default.bold("Learn more")}
@@ -2858,20 +2871,23 @@ async function checkToken(auth) {
2858
2871
  }
2859
2872
  }
2860
2873
  async function login() {
2861
- let known = option("url") ?? loadAuth()?.url, url = workspaceUrl(guard(await he({
2862
- message: "Your LopeBase workspace (name or address)",
2863
- placeholder: "yourteam or https://yourteam.lopebase.com",
2864
- initialValue: known ?? "",
2865
- validate: (v2) => workspaceUrl(v2 ?? "") ? void 0 : "Type your workspace name, like yourteam, or its full address"
2866
- })));
2874
+ let start = signInUrl({
2875
+ flag: option("url"),
2876
+ env: process.env.LOPEBASE_URL,
2877
+ saved: loadAuth()?.url
2878
+ });
2879
+ if ("error" in start)
2880
+ bail(start.error);
2881
+ let url = start.url;
2867
2882
  if (!flag("paste")) {
2868
2883
  let device = await startDeviceLogin(url);
2869
2884
  if (device) {
2870
2885
  Me([
2871
2886
  `Your code: ${import_picocolors4.default.bold(import_picocolors4.default.yellow(device.userCode))}`,
2872
2887
  "",
2873
- "We opened your workspace in the browser. Sign in if asked,",
2874
- "check the code matches, and press Connect."
2888
+ "We opened LopeBase in your browser. Sign in, or create a free",
2889
+ "account if you are new. Then check the code matches and press",
2890
+ "Connect."
2875
2891
  ].join(`
2876
2892
  `), "Connect this computer"), openBrowser(device.verifyUrl), M2.info(import_picocolors4.default.dim(device.verifyUrl));
2877
2893
  let s = Y2();
@@ -2879,14 +2895,21 @@ async function login() {
2879
2895
  let res = await pollDeviceLogin(url, device);
2880
2896
  if (res.ok) {
2881
2897
  let file2 = saveAuth({ url: res.url, token: res.token });
2882
- return s.stop(`Connected (${res.scope}). Saved to ${import_picocolors4.default.dim(file2)}`), { url: res.url, token: res.token };
2898
+ return s.stop(`Connected to ${import_picocolors4.default.bold(res.url)}. Saved to ${import_picocolors4.default.dim(file2)}`), { url: res.url, token: res.token };
2883
2899
  }
2884
2900
  if (s.stop(import_picocolors4.default.red(res.message)), res.reason === "denied")
2885
2901
  bail("Nothing was connected.");
2886
2902
  M2.warn("Falling back to pasting a token.");
2887
2903
  }
2888
2904
  }
2889
- return pasteLogin(url);
2905
+ return pasteLogin(url === DEFAULT_URL ? await askWorkspace() : url);
2906
+ }
2907
+ async function askWorkspace() {
2908
+ return workspaceUrl(guard(await he({
2909
+ message: "Your LopeBase workspace (name or address)",
2910
+ placeholder: "yourteam or https://yourteam.lopebase.com",
2911
+ validate: (v2) => workspaceUrl(v2 ?? "") ? void 0 : "Type your workspace name, like yourteam, or its full address"
2912
+ })));
2890
2913
  }
2891
2914
  async function pasteLogin(url) {
2892
2915
  let settings = `${url}/settings#agent-access`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lopebase",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Set up LopeBase from your project's folder: scan your stack, connect your workspace, and let your coding agent do the rest.",
5
5
  "type": "module",
6
6
  "bin": {