govuk-rewrite-cli 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +133 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,133 @@
1
+ # govuk-rewrite-cli
2
+
3
+ A minimal CLI that rewrites text into GOV.UK-style content. Supports one-shot rewrites, piped input, and an interactive chat mode.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g govuk-rewrite-cli
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ```bash
14
+ govuk-rewrite setup
15
+ govuk-rewrite "Please kindly complete the form below"
16
+ # Complete the form below.
17
+ ```
18
+
19
+ ## Commands
20
+
21
+ ### One-shot rewrite
22
+
23
+ ```bash
24
+ govuk-rewrite "Please kindly complete the form below"
25
+ ```
26
+
27
+ ### Piped input
28
+
29
+ ```bash
30
+ echo "Click here to find out more" | govuk-rewrite
31
+ cat content.txt | govuk-rewrite
32
+ ```
33
+
34
+ ### Flags
35
+
36
+ | Flag | Description |
37
+ |---|---|
38
+ | `--explain` | Print short explanation bullets after the rewrite |
39
+ | `--check` | Check for style issues without rewriting |
40
+ | `--diff` | Show a line diff of changes |
41
+ | `--json` | Output structured JSON |
42
+ | `--provider` | Override provider (`openai`, `anthropic`, `openrouter`) |
43
+ | `--model` | Override model name |
44
+ | `--mode` | Content type hint (see below) |
45
+ | `--context` | Additional context for the rewrite |
46
+ | `--no-spinner` | Suppress the spinner |
47
+ | `--copy` | Copy rewritten text to clipboard |
48
+
49
+ ### Content modes
50
+
51
+ ```bash
52
+ govuk-rewrite --mode error-message "Please enter a valid date"
53
+ ```
54
+
55
+ Available modes: `page-body`, `error-message`, `hint-text`, `notification`, `button`
56
+
57
+ ### Interactive chat
58
+
59
+ ```bash
60
+ govuk-rewrite chat
61
+ ```
62
+
63
+ Stays open until `/quit` or `Ctrl+C`. Paste text to rewrite, use `/help` for shortcuts.
64
+
65
+ Chat commands:
66
+
67
+ ```
68
+ /help
69
+ /provider <openai|anthropic|openrouter>
70
+ /model <name>
71
+ /mode <page-body|error-message|hint-text|notification|button>
72
+ /context <text>
73
+ /context clear
74
+ /explain on|off
75
+ /check on|off
76
+ /diff on|off
77
+ /json on|off
78
+ /show
79
+ /quit
80
+ ```
81
+
82
+ Chat shortcuts:
83
+
84
+ ```
85
+ Ctrl+C / Ctrl+D Exit
86
+ Ctrl+L Clear transcript
87
+ ? Toggle shortcut help
88
+ ```
89
+
90
+ ### Setup wizard
91
+
92
+ ```bash
93
+ govuk-rewrite setup
94
+ ```
95
+
96
+ Writes provider, model, and timeout settings to your config file. API keys are never stored — the wizard prints the exact `export` command to add to your shell profile.
97
+
98
+ ## Configuration
99
+
100
+ Precedence: CLI flags > environment variables > config file > defaults.
101
+
102
+ **Config file location**
103
+
104
+ - macOS/Linux: `~/.config/govuk-rewrite/config.json`
105
+ - Windows: `%APPDATA%\govuk-rewrite\config.json`
106
+
107
+ **Environment variables**
108
+
109
+ ```bash
110
+ OPENAI_API_KEY
111
+ ANTHROPIC_API_KEY
112
+ OPENROUTER_API_KEY
113
+ GOVUK_REWRITE_PROVIDER
114
+ GOVUK_REWRITE_MODEL
115
+ GOVUK_REWRITE_TIMEOUT_MS
116
+ GOVUK_REWRITE_BASE_URL
117
+ ```
118
+
119
+ ## Exit codes
120
+
121
+ | Code | Meaning |
122
+ |---|---|
123
+ | `0` | Success |
124
+ | `1` | Runtime / provider / config error |
125
+ | `2` | Usage error |
126
+
127
+ ## Library
128
+
129
+ If you want to use the rewrite engine directly in your own code, install [`govuk-rewrite`](https://www.npmjs.com/package/govuk-rewrite) instead.
130
+
131
+ ## Repository
132
+
133
+ [github.com/sensecall/govuk-rewrite](https://github.com/sensecall/govuk-rewrite)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "govuk-rewrite-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A tiny CLI that rewrites text into GOV.UK-style content",
5
5
  "author": "Dan Sensecall",
6
6
  "license": "MIT",