readable-cli 0.1.1 → 0.1.3
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 +126 -33
- package/dist/index.js +3574 -13
- package/package.json +12 -7
- package/dist/api.d.ts +0 -13
- package/dist/api.js +0 -43
- package/dist/commands/auth.d.ts +0 -2
- package/dist/commands/auth.js +0 -86
- package/dist/commands/pages.d.ts +0 -2
- package/dist/commands/pages.js +0 -99
- package/dist/commands/publish.d.ts +0 -2
- package/dist/commands/publish.js +0 -128
- package/dist/config.d.ts +0 -9
- package/dist/config.js +0 -34
- package/dist/fmt.d.ts +0 -14
- package/dist/fmt.js +0 -41
- package/dist/index.d.ts +0 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# readable-cli
|
|
2
2
|
|
|
3
|
-
Publish Markdown pages from your terminal.
|
|
3
|
+
Publish Markdown pages from your terminal using [Readable](https://readable.ashwinsathian.com).
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -16,82 +16,175 @@ npx readable-cli publish README.md
|
|
|
16
16
|
|
|
17
17
|
## Authentication
|
|
18
18
|
|
|
19
|
-
Get your API key from [readable.ashwinsathian.com](https://readable.ashwinsathian.com) → My Pages → Settings → API Keys.
|
|
20
|
-
|
|
21
19
|
```bash
|
|
22
20
|
readable login
|
|
23
|
-
# Paste your API key when prompted, or:
|
|
24
|
-
readable login --key rdbl_xxxxxxxxxxxx
|
|
25
21
|
```
|
|
26
22
|
|
|
27
|
-
|
|
23
|
+
This opens your browser to authorize the CLI. Sign in (or create an account) and you're done — no copy-pasting required. Your key is saved automatically to `~/.readable/config.json`.
|
|
28
24
|
|
|
29
|
-
|
|
25
|
+
**CI / non-interactive environments:** pass your key directly with `--key`:
|
|
30
26
|
|
|
31
27
|
```bash
|
|
32
|
-
readable
|
|
28
|
+
readable login --key rdbl_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
You can also set it via environment variable, which takes precedence over the config file:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
export READABLE_API_KEY=rdbl_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
33
35
|
```
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
Generate keys manually at [readable.ashwinsathian.com](https://readable.ashwinsathian.com) → My Pages → Settings → API Keys.
|
|
38
|
+
|
|
39
|
+
## Commands
|
|
40
|
+
|
|
41
|
+
### `readable publish [file]`
|
|
42
|
+
|
|
43
|
+
Publish a Markdown file as a Readable page.
|
|
36
44
|
|
|
37
45
|
```bash
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
readable publish README.md
|
|
47
|
+
readable publish NOTES.md --slug my-notes
|
|
48
|
+
readable publish NOTES.md --visibility unlisted
|
|
49
|
+
readable publish README.md --open # opens the page in your browser
|
|
40
50
|
```
|
|
41
51
|
|
|
42
|
-
|
|
52
|
+
**Publish from stdin:**
|
|
43
53
|
|
|
44
54
|
```bash
|
|
45
|
-
|
|
55
|
+
cat CHANGELOG.md | readable publish -
|
|
56
|
+
echo "# Hello world" | readable publish -
|
|
46
57
|
```
|
|
47
58
|
|
|
48
|
-
|
|
59
|
+
**Update an existing page in-place:**
|
|
49
60
|
|
|
50
61
|
```bash
|
|
51
62
|
readable publish README.md --update <page-id>
|
|
52
63
|
```
|
|
53
64
|
|
|
54
|
-
|
|
65
|
+
**Watch mode — auto-republish on every save:**
|
|
55
66
|
|
|
56
67
|
```bash
|
|
57
68
|
readable publish README.md --watch
|
|
58
69
|
readable publish README.md --update <id> --watch
|
|
59
70
|
```
|
|
60
71
|
|
|
61
|
-
|
|
72
|
+
Options:
|
|
73
|
+
|
|
74
|
+
| Flag | Description |
|
|
75
|
+
|------|-------------|
|
|
76
|
+
| `--slug <slug>` | Set a custom URL slug (e.g. `my-readme`) |
|
|
77
|
+
| `--visibility <v>` | `public` (default) or `unlisted` |
|
|
78
|
+
| `--update <id>` | Update an existing page by ID |
|
|
79
|
+
| `--watch` | Watch file and re-publish on change |
|
|
80
|
+
| `--open` | Open the page in your browser after publishing |
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
### `readable pages list`
|
|
85
|
+
|
|
86
|
+
List all your published pages.
|
|
62
87
|
|
|
63
88
|
```bash
|
|
64
89
|
readable pages list
|
|
65
|
-
readable pages list --json
|
|
90
|
+
readable pages list --json # machine-readable output
|
|
66
91
|
```
|
|
67
92
|
|
|
68
|
-
###
|
|
93
|
+
### `readable pages open <id>`
|
|
94
|
+
|
|
95
|
+
Open a page in your browser. Pass `--print` to print the URL without opening a browser.
|
|
69
96
|
|
|
70
97
|
```bash
|
|
71
|
-
readable pages
|
|
72
|
-
readable pages
|
|
98
|
+
readable pages open abc123 # opens browser
|
|
99
|
+
readable pages open abc123 --print # prints URL only
|
|
100
|
+
readable pages open my-custom-slug # works with slugs too
|
|
73
101
|
```
|
|
74
102
|
|
|
75
|
-
|
|
103
|
+
### `readable pages delete <id>`
|
|
76
104
|
|
|
77
|
-
|
|
78
|
-
| ------------------- | --------------------------------------------- |
|
|
79
|
-
| `READABLE_API_KEY` | API key (overrides `~/.readable/config.json`) |
|
|
80
|
-
| `READABLE_API_URL` | API base URL (default: production) |
|
|
81
|
-
| `NO_COLOR` | Disable ANSI colour output |
|
|
105
|
+
Delete a page by ID or slug. Shows the page title and URL in the confirmation prompt.
|
|
82
106
|
|
|
83
|
-
|
|
107
|
+
```bash
|
|
108
|
+
readable pages delete abc123
|
|
109
|
+
readable pages delete abc123 --yes # skip confirmation prompt
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### `readable whoami`
|
|
113
|
+
|
|
114
|
+
Show the active API key, base URL, and where the key was loaded from (env var or config file).
|
|
84
115
|
|
|
85
|
-
|
|
116
|
+
### `readable logout`
|
|
117
|
+
|
|
118
|
+
Remove the saved API key from `~/.readable/config.json`.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Frontmatter support
|
|
123
|
+
|
|
124
|
+
YAML frontmatter in your Markdown is parsed and applied automatically:
|
|
86
125
|
|
|
87
126
|
```markdown
|
|
88
127
|
---
|
|
89
|
-
title: My
|
|
90
|
-
slug:
|
|
91
|
-
visibility:
|
|
128
|
+
title: My Release Notes
|
|
129
|
+
slug: release-notes-v2
|
|
130
|
+
visibility: public
|
|
131
|
+
description: Summary of changes in v2.
|
|
132
|
+
author: Ashwin Sathian
|
|
133
|
+
date: 2026-05-24
|
|
92
134
|
---
|
|
93
135
|
|
|
94
|
-
#
|
|
136
|
+
# Release Notes v2
|
|
95
137
|
|
|
96
138
|
Content here…
|
|
97
139
|
```
|
|
140
|
+
|
|
141
|
+
Supported frontmatter fields:
|
|
142
|
+
|
|
143
|
+
| Field | Type | Notes |
|
|
144
|
+
|-------|------|-------|
|
|
145
|
+
| `title` | string | Overrides the extracted H1 title (max 200 chars) |
|
|
146
|
+
| `slug` | string | Custom URL slug (max 60 chars) |
|
|
147
|
+
| `visibility` | `"public"` \| `"unlisted"` | Defaults to public |
|
|
148
|
+
| `description` | string | SEO meta description (max 300 chars) |
|
|
149
|
+
| `author` | string | Stored as metadata (max 100 chars) |
|
|
150
|
+
| `date` | string | Stored as metadata, any format |
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Environment variables
|
|
155
|
+
|
|
156
|
+
| Variable | Description |
|
|
157
|
+
|----------|-------------|
|
|
158
|
+
| `READABLE_API_KEY` | API key — overrides `~/.readable/config.json` |
|
|
159
|
+
| `READABLE_API_URL` | Override API base URL (default: production) |
|
|
160
|
+
| `NO_COLOR` | Set to any value to disable ANSI colour output |
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## CI / GitHub Actions
|
|
165
|
+
|
|
166
|
+
Use the `READABLE_API_KEY` secret to publish from CI:
|
|
167
|
+
|
|
168
|
+
```yaml
|
|
169
|
+
- name: Publish to Readable
|
|
170
|
+
env:
|
|
171
|
+
READABLE_API_KEY: ${{ secrets.READABLE_API_KEY }}
|
|
172
|
+
run: |
|
|
173
|
+
if [ -n "${{ vars.READABLE_PAGE_ID }}" ]; then
|
|
174
|
+
npx readable-cli publish CHANGELOG.md --update ${{ vars.READABLE_PAGE_ID }}
|
|
175
|
+
else
|
|
176
|
+
npx readable-cli publish CHANGELOG.md --slug release-notes --visibility public
|
|
177
|
+
fi
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Set `READABLE_API_KEY` under Settings → Secrets → Actions. Set `READABLE_PAGE_ID` as a repository variable to reuse the same URL on every run.
|
|
181
|
+
|
|
182
|
+
See [.github/examples/publish-to-readable.yml](https://github.com/AshwinSathian/readable/blob/main/.github/examples/publish-to-readable.yml) for a complete example workflow.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Links
|
|
187
|
+
|
|
188
|
+
- [readable.ashwinsathian.com](https://readable.ashwinsathian.com) — Create your account
|
|
189
|
+
- [npmjs.com/package/readable-cli](https://www.npmjs.com/package/readable-cli) — npm package
|
|
190
|
+
- [GitHub](https://github.com/AshwinSathian/readable) — Source
|