toolaby 1.0.1 → 1.0.2
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 +4 -3
- package/bin.mjs +8 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
The Toolaby command line. It puts the Wall — sign-in, a Free plan, paid plans, licences and subscriptions — into a Chrome extension you already have, or makes a new one for you.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
npm i -g toolaby # once (or run every command through `npx -y toolaby …`)
|
|
7
|
+
toolaby login # once: a code to approve in your browser
|
|
8
|
+
toolaby wire <tool-id> # in your extension's folder; `toolaby tools` lists your ids
|
|
8
9
|
```
|
|
9
10
|
|
|
10
11
|
## What it does
|
|
11
12
|
|
|
12
|
-
**`toolaby login`** signs you in. It shows a code and opens the Toolaby dashboard; you approve the code there
|
|
13
|
+
**`toolaby login`** signs you in. It shows a code and opens the Toolaby dashboard; you approve the code there — as the account the dashboard is signed in to — and the command is signed in as that account from then on. It works the way GitHub's and Stripe's command lines sign in, and only ever acts on that account's own tools.
|
|
13
14
|
|
|
14
15
|
**`toolaby wire <tool-id>`**, run in your extension's folder, wires that extension to your tool:
|
|
15
16
|
|
package/bin.mjs
CHANGED
|
@@ -24,7 +24,7 @@ import { spawn } from 'node:child_process';
|
|
|
24
24
|
import { wireManifest, WORKER_LINES } from './lib/manifest.js';
|
|
25
25
|
import { detectProject, CODE_FILES, filesToWrite } from './lib/project.js';
|
|
26
26
|
|
|
27
|
-
const VERSION = '1.0.
|
|
27
|
+
const VERSION = '1.0.2';
|
|
28
28
|
const CLIENT_ID = 'toolaby-cli';
|
|
29
29
|
const argv = process.argv.slice(2);
|
|
30
30
|
// `--version` and `--help` are commands of their own; every other command is the first bare word.
|
|
@@ -88,7 +88,7 @@ async function login() {
|
|
|
88
88
|
const all = readCredentials();
|
|
89
89
|
all[wall] = { token, email, at: new Date().toISOString() };
|
|
90
90
|
writeCredentials(all);
|
|
91
|
-
out(`\n\n Signed in${email ? ` as ${email}` : ''}
|
|
91
|
+
out(`\n\n Signed in${email ? ` as ${email}` : ''}.\n`);
|
|
92
92
|
return token;
|
|
93
93
|
}
|
|
94
94
|
const why = poll.json.error;
|
|
@@ -159,7 +159,12 @@ async function filesFor(slug, scaffold) {
|
|
|
159
159
|
const token = await tokenOrLogin();
|
|
160
160
|
const res = await api(`/api/cli/wiring/${slug}${scaffold ? '?scaffold=1' : ''}`, { token });
|
|
161
161
|
if (res.status === 401) { out(' The stored session is no longer valid; signing in again.'); await login(); return filesFor(slug, scaffold); }
|
|
162
|
-
if (res.status === 404)
|
|
162
|
+
if (res.status === 404) {
|
|
163
|
+
// Say who the command is: the tool may well exist — in a workspace of another account of theirs.
|
|
164
|
+
const me = await api('/api/cli/me', { token }).catch(() => null);
|
|
165
|
+
const who = me?.ok ? `\n\n You are signed in as ${me.json.email}${me.json.workspaces.length ? ` (workspaces: ${me.json.workspaces.map((w) => w.slug).join(', ')})` : ' (no workspace yet)'}.\n Another account owns it? \`toolaby logout\`, sign in to the dashboard as that account, then run this again.` : '';
|
|
166
|
+
fail(`${res.json.message ?? `No tool "${slug}" in your workspaces.`}${who}`);
|
|
167
|
+
}
|
|
163
168
|
if (!res.ok) fail(res.json.message ?? `The Wall answered HTTP ${res.status}.`);
|
|
164
169
|
return res.json;
|
|
165
170
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolaby",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "The Toolaby command line: sign in once, then wire any Chrome extension to your tool on the Wall — sign-in, the Free plan, licences and subscriptions — or start a new one.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": { "toolaby": "./bin.mjs" },
|