draftie 0.1.4 → 0.1.6
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 +7 -4
- package/dist/draftie.js +2 -2
- package/dist/git.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ npx draftie auth login
|
|
|
13
13
|
npx draftie upload plan.html
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
- `auth login` prints the server's
|
|
17
|
-
key into the terminal. This works over SSH.
|
|
16
|
+
- `auth login` prints the address of the server's CLI setup page. Open it, sign in, generate an
|
|
17
|
+
API key, and paste the key into the terminal. This works over SSH.
|
|
18
18
|
- `upload` prints the page's link, `URL:`, and the link that returns the exact bytes,
|
|
19
19
|
`Raw HTML:`.
|
|
20
20
|
|
|
@@ -61,8 +61,11 @@ from another address, forms and iframes do not. The server refuses a file that h
|
|
|
61
61
|
`~/.draftie/config.json` holds the server's address and one API key per server.
|
|
62
62
|
`~/.draftie/drafts.json` holds which file was uploaded to which page.
|
|
63
63
|
|
|
64
|
-
Each upload also sends the git branch, commit, commit subject and whether the working
|
|
65
|
-
dirty, and in GitHub Actions the run's link and actor.
|
|
64
|
+
Each upload also sends the repository, git branch, commit, commit subject and whether the working
|
|
65
|
+
tree is dirty, and in GitHub Actions the run's link and actor. They come from the repository that
|
|
66
|
+
holds the file, or else from the one you run `draftie` in, so a file in a temporary folder still
|
|
67
|
+
counts toward your project. The dashboard groups drafts by repository and shows the rest per
|
|
68
|
+
version.
|
|
66
69
|
|
|
67
70
|
## For agents
|
|
68
71
|
|
package/dist/draftie.js
CHANGED
|
@@ -257,11 +257,11 @@ program
|
|
|
257
257
|
const auth = program.command("auth").description("Manage the API key that the other commands send.");
|
|
258
258
|
auth
|
|
259
259
|
.command("login")
|
|
260
|
-
.description("Save an API key that you
|
|
260
|
+
.description("Save an API key that you generate on the CLI setup page. Works over SSH: you paste the key.")
|
|
261
261
|
.addOption(urlOption())
|
|
262
262
|
.action(async (options) => {
|
|
263
263
|
const url = serverUrl(options.url);
|
|
264
|
-
console.log(`Open ${url} in a browser, sign in, and
|
|
264
|
+
console.log(`Open ${url}/#cli-setup in a browser, sign in, and generate an API key.\n`);
|
|
265
265
|
const key = await ask("Paste the API key: ");
|
|
266
266
|
if (key === "")
|
|
267
267
|
throw new CliError("No key entered. Nothing saved.");
|
package/dist/git.js
CHANGED
|
@@ -25,8 +25,9 @@ function parseRemote(remote) {
|
|
|
25
25
|
const parts = cleaned.split("/").filter(Boolean);
|
|
26
26
|
return parts.length >= 2 ? { org: parts.at(-2), name: parts.at(-1) } : {};
|
|
27
27
|
}
|
|
28
|
-
/** What git says about the
|
|
29
|
-
export function gitDetails(
|
|
28
|
+
/** What git says about the repository that holds `fileFolder`, or else the current folder. Every value is null outside a repository. */
|
|
29
|
+
export function gitDetails(fileFolder) {
|
|
30
|
+
const cwd = git(["rev-parse", "--show-toplevel"], fileFolder) === null ? process.cwd() : fileFolder;
|
|
30
31
|
const root = git(["rev-parse", "--show-toplevel"], cwd);
|
|
31
32
|
const remote = parseRemote(git(["config", "--get", "remote.origin.url"], cwd));
|
|
32
33
|
const status = git(["status", "--porcelain"], cwd);
|