prompsit-cli 26.311.1358 → 26.311.2213
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 +280 -280
- package/dist/api/http-utils.d.ts +5 -0
- package/dist/api/http-utils.d.ts.map +1 -0
- package/dist/api/http-utils.js +19 -0
- package/dist/api/http-utils.js.map +1 -0
- package/dist/api/resources/formats.d.ts +1 -1
- package/dist/api/resources/formats.js +2 -2
- package/dist/api/resources/formats.js.map +1 -1
- package/dist/api/verbose.d.ts +2 -8
- package/dist/api/verbose.d.ts.map +1 -1
- package/dist/api/verbose.js +13 -8
- package/dist/api/verbose.js.map +1 -1
- package/dist/cli/options.js +2 -2
- package/dist/cli/options.js.map +1 -1
- package/dist/commands/config.d.ts +8 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +331 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/formats.d.ts +1 -1
- package/dist/commands/formats.d.ts.map +1 -1
- package/dist/commands/formats.js +5 -12
- package/dist/commands/formats.js.map +1 -1
- package/dist/commands/languages.d.ts +12 -0
- package/dist/commands/languages.d.ts.map +1 -0
- package/dist/commands/languages.js +48 -0
- package/dist/commands/languages.js.map +1 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +7 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/constants.d.ts +10 -17
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +10 -18
- package/dist/constants.js.map +1 -1
- package/dist/errors/catalog.d.ts.map +1 -1
- package/dist/errors/catalog.js +7 -1
- package/dist/errors/catalog.js.map +1 -1
- package/dist/i18n/catalog.d.ts +1 -0
- package/dist/i18n/catalog.d.ts.map +1 -1
- package/dist/i18n/catalog.js +1 -0
- package/dist/i18n/catalog.js.map +1 -1
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +2 -0
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/translator-adapter.d.ts +3 -0
- package/dist/i18n/translator-adapter.d.ts.map +1 -0
- package/dist/i18n/translator-adapter.js +12 -0
- package/dist/i18n/translator-adapter.js.map +1 -0
- package/dist/logging/console-handler.js +1 -1
- package/dist/logging/console-handler.js.map +1 -1
- package/dist/logging/file-handler.d.ts.map +1 -1
- package/dist/logging/file-handler.js +4 -5
- package/dist/logging/file-handler.js.map +1 -1
- package/dist/output/console.d.ts +77 -0
- package/dist/output/console.d.ts.map +1 -0
- package/dist/output/console.js +128 -0
- package/dist/output/console.js.map +1 -0
- package/dist/output/progress-display.d.ts.map +1 -1
- package/dist/output/progress-display.js +4 -3
- package/dist/output/progress-display.js.map +1 -1
- package/dist/output/tables.d.ts +52 -0
- package/dist/output/tables.d.ts.map +1 -0
- package/dist/output/tables.js +448 -0
- package/dist/output/tables.js.map +1 -0
- package/dist/repl/App.d.ts +6 -0
- package/dist/repl/App.d.ts.map +1 -0
- package/dist/repl/App.js +216 -0
- package/dist/repl/App.js.map +1 -0
- package/dist/repl/components/ControllableTextInput.d.ts +12 -0
- package/dist/repl/components/ControllableTextInput.d.ts.map +1 -0
- package/dist/repl/components/ControllableTextInput.js +102 -0
- package/dist/repl/components/ControllableTextInput.js.map +1 -0
- package/dist/repl/components/HistoryRow.d.ts +8 -0
- package/dist/repl/components/HistoryRow.d.ts.map +1 -0
- package/dist/repl/components/HistoryRow.js +40 -0
- package/dist/repl/components/HistoryRow.js.map +1 -0
- package/dist/repl/components/ProgressIndicator.d.ts +10 -0
- package/dist/repl/components/ProgressIndicator.d.ts.map +1 -0
- package/dist/repl/components/ProgressIndicator.js +39 -0
- package/dist/repl/components/ProgressIndicator.js.map +1 -0
- package/dist/repl/components/Separator.d.ts +5 -0
- package/dist/repl/components/Separator.d.ts.map +1 -0
- package/dist/repl/components/Separator.js +9 -0
- package/dist/repl/components/Separator.js.map +1 -0
- package/dist/repl/controller.d.ts.map +1 -1
- package/dist/repl/controller.js +6 -0
- package/dist/repl/controller.js.map +1 -1
- package/dist/repl/hooks.d.ts +9 -0
- package/dist/repl/hooks.d.ts.map +1 -0
- package/dist/repl/hooks.js +29 -0
- package/dist/repl/hooks.js.map +1 -0
- package/dist/repl/plugins/manager.d.ts +22 -0
- package/dist/repl/plugins/manager.d.ts.map +1 -0
- package/dist/repl/plugins/manager.js +111 -0
- package/dist/repl/plugins/manager.js.map +1 -0
- package/dist/repl/plugins/types.d.ts +33 -0
- package/dist/repl/plugins/types.d.ts.map +1 -0
- package/dist/repl/plugins/types.js +3 -0
- package/dist/repl/plugins/types.js.map +1 -0
- package/dist/repl/progress-context.d.ts +14 -0
- package/dist/repl/progress-context.d.ts.map +1 -0
- package/dist/repl/progress-context.js +15 -0
- package/dist/repl/progress-context.js.map +1 -0
- package/dist/repl/service.d.ts.map +1 -1
- package/dist/repl/service.js +3 -1
- package/dist/repl/service.js.map +1 -1
- package/dist/repl/ui/components/progress-bar.d.ts +2 -1
- package/dist/repl/ui/components/progress-bar.d.ts.map +1 -1
- package/dist/repl/ui/components/progress-bar.js +11 -2
- package/dist/repl/ui/components/progress-bar.js.map +1 -1
- package/dist/repl/ui/progress-controller.d.ts +1 -0
- package/dist/repl/ui/progress-controller.d.ts.map +1 -1
- package/dist/repl/ui/progress-controller.js +21 -4
- package/dist/repl/ui/progress-controller.js.map +1 -1
- package/dist/repl/ui-state.d.ts +9 -0
- package/dist/repl/ui-state.d.ts.map +1 -0
- package/dist/repl/ui-state.js +16 -0
- package/dist/repl/ui-state.js.map +1 -0
- package/dist/runtime/external-transport.d.ts +12 -0
- package/dist/runtime/external-transport.d.ts.map +1 -0
- package/dist/runtime/external-transport.js +59 -0
- package/dist/runtime/external-transport.js.map +1 -0
- package/dist/runtime/progress-adapters.d.ts +1 -1
- package/dist/runtime/progress-adapters.d.ts.map +1 -1
- package/dist/runtime/ui-invalidate.d.ts +3 -0
- package/dist/runtime/ui-invalidate.d.ts.map +1 -0
- package/dist/runtime/ui-invalidate.js +25 -0
- package/dist/runtime/ui-invalidate.js.map +1 -0
- package/dist/runtime/update-check.d.ts.map +1 -1
- package/dist/runtime/update-check.js +3 -0
- package/dist/runtime/update-check.js.map +1 -1
- package/dist/update/version.d.ts +5 -0
- package/dist/update/version.d.ts.map +1 -1
- package/dist/update/version.js +19 -3
- package/dist/update/version.js.map +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +3 -2
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,280 +1,280 @@
|
|
|
1
|
-
# Prompsit CLI
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/prompsit-cli)
|
|
4
|
-
[](https://www.npmjs.com/package/prompsit-cli)
|
|
5
|
-
[](https://nodejs.org/)
|
|
6
|
-
|
|
7
|
-
CLI for the Prompsit Translation API. Translate text and documents, evaluate quality, score parallel corpora, and annotate monolingual data.
|
|
8
|
-
|
|
9
|
-
## Requirements
|
|
10
|
-
|
|
11
|
-
[Node.js](https://nodejs.org/) 22+
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
node -v # Should print v22.x or higher
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Install
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install -g prompsit-cli
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
**Update:** `npm install -g prompsit-cli@latest --prefer-online`
|
|
24
|
-
**Uninstall:** `npm uninstall -g prompsit-cli`
|
|
25
|
-
|
|
26
|
-
<details>
|
|
27
|
-
<summary>Command not found after install?</summary>
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
# Check global npm bin is on PATH
|
|
31
|
-
echo "$PATH" | tr ':' '\n' | grep '.npm-global/bin'
|
|
32
|
-
command -v prompsit
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
</details>
|
|
36
|
-
|
|
37
|
-
## Usage
|
|
38
|
-
|
|
39
|
-
Run `prompsit` to enter interactive REPL with tab completion.
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
prompsit # Enter interactive REPL
|
|
43
|
-
prompsit translate "Hello" -s "en" -t "es" # Run single command
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
> **Quoting rule:** All values must be quoted. Commands, subcommands, and flags stay unquoted.
|
|
47
|
-
|
|
48
|
-
## Commands
|
|
49
|
-
|
|
50
|
-
### Authentication
|
|
51
|
-
|
|
52
|
-
#### `login` --account "EMAIL" --secret "SECRET"
|
|
53
|
-
|
|
54
|
-
Authenticate with the Prompsit API.
|
|
55
|
-
|
|
56
|
-
- `-a, --account "EMAIL"` Account email
|
|
57
|
-
- `-s, --secret "SECRET"` API secret
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
$ prompsit login # Open contact page
|
|
61
|
-
$ prompsit login -a "EMAIL" -s "SECRET" # Login with credentials
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
#### `logout`
|
|
65
|
-
|
|
66
|
-
Clear stored credentials (`~/.prompsit/credentials.json`).
|
|
67
|
-
|
|
68
|
-
#### `status`
|
|
69
|
-
|
|
70
|
-
Show auth state, plan type, and token expiry.
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
### Configuration
|
|
75
|
-
|
|
76
|
-
#### `config` [subcommand|key] [value]
|
|
77
|
-
|
|
78
|
-
Interactive TUI settings screen, or manage config via subcommands.
|
|
79
|
-
|
|
80
|
-
**Subcommands:**
|
|
81
|
-
|
|
82
|
-
- `config show` Show current configuration
|
|
83
|
-
- `config "key"` Get a config value
|
|
84
|
-
- `config "key" "value"` Set a config value
|
|
85
|
-
- `config api-url ["preset_or_url"]` Switch API endpoint
|
|
86
|
-
- `config reset [--force]` Reset to defaults
|
|
87
|
-
- `config path` Show config file path
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
> config show
|
|
91
|
-
> config "api-base-url"
|
|
92
|
-
> config "api-base-url" "https://my-server.com"
|
|
93
|
-
> config api-url "test"
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
#### `language` [code]
|
|
97
|
-
|
|
98
|
-
Set interface language.
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
> language "es"
|
|
102
|
-
$ prompsit language "en"
|
|
103
|
-
$ prompsit config language
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
### Translation
|
|
109
|
-
|
|
110
|
-
#### `translate` "text" --source "lang" --target "lang" [--qe]
|
|
111
|
-
|
|
112
|
-
Translate text. Aliases: `t`
|
|
113
|
-
|
|
114
|
-
- `-s, --source "lang"` Source language code
|
|
115
|
-
- `-t, --target "lang"` Target language code
|
|
116
|
-
- `--qe` Enable quality estimation score
|
|
117
|
-
|
|
118
|
-
```
|
|
119
|
-
> "Hello world" -s "en" -t "es"
|
|
120
|
-
> "Hello" "Good morning" "Thank you" -s "en" -t "es"
|
|
121
|
-
> t "Hello" -s "en" -t "es" --qe
|
|
122
|
-
$ prompsit translate "Hello world" -s "en" -t "es"
|
|
123
|
-
$ prompsit translate "Hello" "Good morning" "Thank you" -s "en" -t "es"
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
#### `translate` @"file..." --source "lang" --target "lang" [--out "dir"] [--output-format "fmt"]
|
|
127
|
-
|
|
128
|
-
Translate files (XLIFF, CSV, PDF, DOCX, etc.). Use `@` prefix for file mode. Alias: `t`
|
|
129
|
-
|
|
130
|
-
- `-s, --source "lang"` Source language code
|
|
131
|
-
- `-t, --target "lang"` Target language code
|
|
132
|
-
- `--out "dir"` Output directory (default: beside input file)
|
|
133
|
-
- `--output-format "fmt"` Output format (e.g. docx)
|
|
134
|
-
|
|
135
|
-
```
|
|
136
|
-
> t @"~/.prompsit/examples/translate/sample.xliff" -s "en" -t "es"
|
|
137
|
-
> t @"~/.prompsit/examples/translate/sample.txt" @"~/.prompsit/examples/translate/sample.csv" -s "en" -t "es"
|
|
138
|
-
> t @"~/.prompsit/examples/translate/sample.csv" -s "en" -t "es" --out "./translated/"
|
|
139
|
-
> t @"report.pdf" -s "en" -t "es" --output-format "docx"
|
|
140
|
-
$ prompsit translate @"~/.prompsit/examples/translate/sample.xliff" -s "en" -t "es"
|
|
141
|
-
$ prompsit translate @"~/.prompsit/examples/translate/sample.csv" -s "en" -t "es" --out "./translated/"
|
|
142
|
-
$ prompsit translate @"report.pdf" -s "en" -t "es" --output-format "docx"
|
|
143
|
-
$ prompsit translate @"manual.md" @"notes.md" -s "en" -t "es" --output-format "docx"
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
### Engines
|
|
149
|
-
|
|
150
|
-
#### `engines` [--source "lang"] [--target "lang"]
|
|
151
|
-
|
|
152
|
-
List available translation engines.
|
|
153
|
-
|
|
154
|
-
- `-s, --source "lang"` Filter by source language
|
|
155
|
-
- `-t, --target "lang"` Filter by target language
|
|
156
|
-
|
|
157
|
-
```
|
|
158
|
-
> engines
|
|
159
|
-
> engines -s "en" -t "es"
|
|
160
|
-
$ prompsit engines
|
|
161
|
-
$ prompsit engines -s "en" -t "es"
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
---
|
|
165
|
-
|
|
166
|
-
### Quality Evaluation
|
|
167
|
-
|
|
168
|
-
#### `eval` --source "src" --hypothesis "hyp" --reference "ref" [--metrics "metrics"]
|
|
169
|
-
|
|
170
|
-
Evaluate translation quality with automatic metrics (inline mode). Alias: `e`
|
|
171
|
-
|
|
172
|
-
- `-s, --source "src"` Source text
|
|
173
|
-
- `-h, --hypothesis "hyp"` Machine translation (hypothesis)
|
|
174
|
-
- `-r, --reference "ref"` Reference translation
|
|
175
|
-
- `-m, --metrics "metrics"` Comma-separated: bleu,chrf,metricx (default: bleu,chrf)
|
|
176
|
-
|
|
177
|
-
#### `eval` "file" [--metrics "metrics"]
|
|
178
|
-
|
|
179
|
-
Batch evaluation from TSV file.
|
|
180
|
-
|
|
181
|
-
#### `eval` @"file" [options]
|
|
182
|
-
|
|
183
|
-
File scoring mode. Use `@` prefix.
|
|
184
|
-
|
|
185
|
-
```
|
|
186
|
-
> eval -s "Hello" -h "Hola" -r "Hola"
|
|
187
|
-
> eval -s "Hello" -h "Hola" -r "Hola" -m "bleu,chrf,metricx"
|
|
188
|
-
> eval "segments.tsv" -m "bleu,chrf"
|
|
189
|
-
> eval @"report.txt" -s "en" -t "es"
|
|
190
|
-
$ prompsit eval -s "Hello" -h "Hola" -r "Hola"
|
|
191
|
-
$ prompsit eval -s "Hello" -h "Hola" -r "Hola" -m "bleu,chrf,metricx"
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
### Data Processing
|
|
197
|
-
|
|
198
|
-
#### `score` "file" [options]
|
|
199
|
-
|
|
200
|
-
Compute translation likelihood scores with Bicleaner-AI.
|
|
201
|
-
|
|
202
|
-
```
|
|
203
|
-
> score "~/.prompsit/examples/score/sample.tmx"
|
|
204
|
-
> score "corpus.tsv" --output-format "tsv" --out "results/"
|
|
205
|
-
$ prompsit score "corpus.tmx" --out "results/"
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
#### `annotate` "file" --lang "code" [--metadata "options"] [--out "dir"]
|
|
209
|
-
|
|
210
|
-
Annotate monolingual documents with metadata using Monotextor.
|
|
211
|
-
|
|
212
|
-
- `-l, --lang "code"` Language code (e.g. en, es, zh-Hans)
|
|
213
|
-
- `--metadata "options"` Metadata to add (comma-separated: lid, dedup, pii, adult_filter, monofixer, docscorer)
|
|
214
|
-
- `--out "dir"` Output directory (default: beside input file)
|
|
215
|
-
|
|
216
|
-
```
|
|
217
|
-
> annotate @"data.jsonl" -l "en" --metadata "lid,docscorer"
|
|
218
|
-
> annotate @"data.jsonl" -l "en" --out "results/"
|
|
219
|
-
> annotate --metadata
|
|
220
|
-
$ prompsit annotate @"data.jsonl" -l "en" --metadata "lid,docscorer" --out "results/"
|
|
221
|
-
$ prompsit annotate --metadata
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
---
|
|
225
|
-
|
|
226
|
-
### Reference
|
|
227
|
-
|
|
228
|
-
#### `formats`
|
|
229
|
-
|
|
230
|
-
List supported file formats. Alias: `f`
|
|
231
|
-
|
|
232
|
-
```
|
|
233
|
-
> formats
|
|
234
|
-
$ prompsit formats
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
---
|
|
238
|
-
|
|
239
|
-
### System
|
|
240
|
-
|
|
241
|
-
| Command | Description |
|
|
242
|
-
|---------|-------------|
|
|
243
|
-
| `health` | API health check |
|
|
244
|
-
| `help` | Show all commands (also: `?`) |
|
|
245
|
-
| `clear` | Clear screen |
|
|
246
|
-
| `exit` | Quit CLI (also: `quit`, `q`) |
|
|
247
|
-
|
|
248
|
-
---
|
|
249
|
-
|
|
250
|
-
## Configuration Reference
|
|
251
|
-
|
|
252
|
-
Config file: `~/.prompsit/config.toml` | Env override: `PROMPSIT_<SECTION>__<KEY>`
|
|
253
|
-
|
|
254
|
-
| Key | CLI Command | Default | Description |
|
|
255
|
-
|-----|-------------|---------|-------------|
|
|
256
|
-
| `api.base_url` | `config api-url` | `https://edge.prompsit.com` | API endpoint |
|
|
257
|
-
| `api.timeout` | - | `30` | HTTP read timeout (sec) |
|
|
258
|
-
| `cli.language` | `language "code"` | `en` | Interface language |
|
|
259
|
-
| `cli.log_level` | `config set log-level "val"` | `INFO` | Log level |
|
|
260
|
-
|
|
261
|
-
## Data Directory: `~/.prompsit/`
|
|
262
|
-
|
|
263
|
-
| Path | Purpose |
|
|
264
|
-
|------|---------|
|
|
265
|
-
| `config.toml` | User configuration (TOML) |
|
|
266
|
-
| `credentials.json` | OAuth2 tokens |
|
|
267
|
-
| `history` | REPL command history |
|
|
268
|
-
| `translations/{lang}.json` | Interface translation cache |
|
|
269
|
-
| `examples/translate/` | Translation examples (txt, csv, xliff) |
|
|
270
|
-
| `examples/evaluate/` | Evaluation examples (tmx) |
|
|
271
|
-
| `examples/score/` | Scoring examples (tmx) |
|
|
272
|
-
| `examples/annotate/` | Annotation examples (jsonl) |
|
|
273
|
-
|
|
274
|
-
## Troubleshooting
|
|
275
|
-
|
|
276
|
-
See [docs/project/runbook.md](docs/project/runbook.md) for setup issues, common errors, and fixes.
|
|
277
|
-
|
|
278
|
-
## License
|
|
279
|
-
|
|
280
|
-
MIT
|
|
1
|
+
# Prompsit CLI
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/prompsit-cli)
|
|
4
|
+
[](https://www.npmjs.com/package/prompsit-cli)
|
|
5
|
+
[](https://nodejs.org/)
|
|
6
|
+
|
|
7
|
+
CLI for the Prompsit Translation API. Translate text and documents, evaluate quality, score parallel corpora, and annotate monolingual data.
|
|
8
|
+
|
|
9
|
+
## Requirements
|
|
10
|
+
|
|
11
|
+
[Node.js](https://nodejs.org/) 22+
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
node -v # Should print v22.x or higher
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -g prompsit-cli
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Update:** `npm install -g prompsit-cli@latest --prefer-online`
|
|
24
|
+
**Uninstall:** `npm uninstall -g prompsit-cli`
|
|
25
|
+
|
|
26
|
+
<details>
|
|
27
|
+
<summary>Command not found after install?</summary>
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Check global npm bin is on PATH
|
|
31
|
+
echo "$PATH" | tr ':' '\n' | grep '.npm-global/bin'
|
|
32
|
+
command -v prompsit
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
</details>
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
Run `prompsit` to enter interactive REPL with tab completion.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
prompsit # Enter interactive REPL
|
|
43
|
+
prompsit translate "Hello" -s "en" -t "es" # Run single command
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
> **Quoting rule:** All values must be quoted. Commands, subcommands, and flags stay unquoted.
|
|
47
|
+
|
|
48
|
+
## Commands
|
|
49
|
+
|
|
50
|
+
### Authentication
|
|
51
|
+
|
|
52
|
+
#### `login` --account "EMAIL" --secret "SECRET"
|
|
53
|
+
|
|
54
|
+
Authenticate with the Prompsit API.
|
|
55
|
+
|
|
56
|
+
- `-a, --account "EMAIL"` Account email
|
|
57
|
+
- `-s, --secret "SECRET"` API secret
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
$ prompsit login # Open contact page
|
|
61
|
+
$ prompsit login -a "EMAIL" -s "SECRET" # Login with credentials
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### `logout`
|
|
65
|
+
|
|
66
|
+
Clear stored credentials (`~/.prompsit/credentials.json`).
|
|
67
|
+
|
|
68
|
+
#### `status`
|
|
69
|
+
|
|
70
|
+
Show auth state, plan type, and token expiry.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### Configuration
|
|
75
|
+
|
|
76
|
+
#### `config` [subcommand|key] [value]
|
|
77
|
+
|
|
78
|
+
Interactive TUI settings screen, or manage config via subcommands.
|
|
79
|
+
|
|
80
|
+
**Subcommands:**
|
|
81
|
+
|
|
82
|
+
- `config show` Show current configuration
|
|
83
|
+
- `config "key"` Get a config value
|
|
84
|
+
- `config "key" "value"` Set a config value
|
|
85
|
+
- `config api-url ["preset_or_url"]` Switch API endpoint
|
|
86
|
+
- `config reset [--force]` Reset to defaults
|
|
87
|
+
- `config path` Show config file path
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
> config show
|
|
91
|
+
> config "api-base-url"
|
|
92
|
+
> config "api-base-url" "https://my-server.com"
|
|
93
|
+
> config api-url "test"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### `language` [code]
|
|
97
|
+
|
|
98
|
+
Set interface language.
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
> language "es"
|
|
102
|
+
$ prompsit language "en"
|
|
103
|
+
$ prompsit config language
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### Translation
|
|
109
|
+
|
|
110
|
+
#### `translate` "text" --source "lang" --target "lang" [--qe]
|
|
111
|
+
|
|
112
|
+
Translate text. Aliases: `t`
|
|
113
|
+
|
|
114
|
+
- `-s, --source "lang"` Source language code
|
|
115
|
+
- `-t, --target "lang"` Target language code
|
|
116
|
+
- `--qe` Enable quality estimation score
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
> "Hello world" -s "en" -t "es"
|
|
120
|
+
> "Hello" "Good morning" "Thank you" -s "en" -t "es"
|
|
121
|
+
> t "Hello" -s "en" -t "es" --qe
|
|
122
|
+
$ prompsit translate "Hello world" -s "en" -t "es"
|
|
123
|
+
$ prompsit translate "Hello" "Good morning" "Thank you" -s "en" -t "es"
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### `translate` @"file..." --source "lang" --target "lang" [--out "dir"] [--output-format "fmt"]
|
|
127
|
+
|
|
128
|
+
Translate files (XLIFF, CSV, PDF, DOCX, etc.). Use `@` prefix for file mode. Alias: `t`
|
|
129
|
+
|
|
130
|
+
- `-s, --source "lang"` Source language code
|
|
131
|
+
- `-t, --target "lang"` Target language code
|
|
132
|
+
- `--out "dir"` Output directory (default: beside input file)
|
|
133
|
+
- `--output-format "fmt"` Output format (e.g. docx)
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
> t @"~/.prompsit/examples/translate/sample.xliff" -s "en" -t "es"
|
|
137
|
+
> t @"~/.prompsit/examples/translate/sample.txt" @"~/.prompsit/examples/translate/sample.csv" -s "en" -t "es"
|
|
138
|
+
> t @"~/.prompsit/examples/translate/sample.csv" -s "en" -t "es" --out "./translated/"
|
|
139
|
+
> t @"report.pdf" -s "en" -t "es" --output-format "docx"
|
|
140
|
+
$ prompsit translate @"~/.prompsit/examples/translate/sample.xliff" -s "en" -t "es"
|
|
141
|
+
$ prompsit translate @"~/.prompsit/examples/translate/sample.csv" -s "en" -t "es" --out "./translated/"
|
|
142
|
+
$ prompsit translate @"report.pdf" -s "en" -t "es" --output-format "docx"
|
|
143
|
+
$ prompsit translate @"manual.md" @"notes.md" -s "en" -t "es" --output-format "docx"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### Engines
|
|
149
|
+
|
|
150
|
+
#### `engines` [--source "lang"] [--target "lang"]
|
|
151
|
+
|
|
152
|
+
List available translation engines.
|
|
153
|
+
|
|
154
|
+
- `-s, --source "lang"` Filter by source language
|
|
155
|
+
- `-t, --target "lang"` Filter by target language
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
> engines
|
|
159
|
+
> engines -s "en" -t "es"
|
|
160
|
+
$ prompsit engines
|
|
161
|
+
$ prompsit engines -s "en" -t "es"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
### Quality Evaluation
|
|
167
|
+
|
|
168
|
+
#### `eval` --source "src" --hypothesis "hyp" --reference "ref" [--metrics "metrics"]
|
|
169
|
+
|
|
170
|
+
Evaluate translation quality with automatic metrics (inline mode). Alias: `e`
|
|
171
|
+
|
|
172
|
+
- `-s, --source "src"` Source text
|
|
173
|
+
- `-h, --hypothesis "hyp"` Machine translation (hypothesis)
|
|
174
|
+
- `-r, --reference "ref"` Reference translation
|
|
175
|
+
- `-m, --metrics "metrics"` Comma-separated: bleu,chrf,metricx (default: bleu,chrf)
|
|
176
|
+
|
|
177
|
+
#### `eval` "file" [--metrics "metrics"]
|
|
178
|
+
|
|
179
|
+
Batch evaluation from TSV file.
|
|
180
|
+
|
|
181
|
+
#### `eval` @"file" [options]
|
|
182
|
+
|
|
183
|
+
File scoring mode. Use `@` prefix.
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
> eval -s "Hello" -h "Hola" -r "Hola"
|
|
187
|
+
> eval -s "Hello" -h "Hola" -r "Hola" -m "bleu,chrf,metricx"
|
|
188
|
+
> eval "segments.tsv" -m "bleu,chrf"
|
|
189
|
+
> eval @"report.txt" -s "en" -t "es"
|
|
190
|
+
$ prompsit eval -s "Hello" -h "Hola" -r "Hola"
|
|
191
|
+
$ prompsit eval -s "Hello" -h "Hola" -r "Hola" -m "bleu,chrf,metricx"
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
### Data Processing
|
|
197
|
+
|
|
198
|
+
#### `score` "file" [options]
|
|
199
|
+
|
|
200
|
+
Compute translation likelihood scores with Bicleaner-AI.
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
> score "~/.prompsit/examples/score/sample.tmx"
|
|
204
|
+
> score "corpus.tsv" --output-format "tsv" --out "results/"
|
|
205
|
+
$ prompsit score "corpus.tmx" --out "results/"
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
#### `annotate` "file" --lang "code" [--metadata "options"] [--out "dir"]
|
|
209
|
+
|
|
210
|
+
Annotate monolingual documents with metadata using Monotextor.
|
|
211
|
+
|
|
212
|
+
- `-l, --lang "code"` Language code (e.g. en, es, zh-Hans)
|
|
213
|
+
- `--metadata "options"` Metadata to add (comma-separated: lid, dedup, pii, adult_filter, monofixer, docscorer)
|
|
214
|
+
- `--out "dir"` Output directory (default: beside input file)
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
> annotate @"data.jsonl" -l "en" --metadata "lid,docscorer"
|
|
218
|
+
> annotate @"data.jsonl" -l "en" --out "results/"
|
|
219
|
+
> annotate --metadata
|
|
220
|
+
$ prompsit annotate @"data.jsonl" -l "en" --metadata "lid,docscorer" --out "results/"
|
|
221
|
+
$ prompsit annotate --metadata
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
### Reference
|
|
227
|
+
|
|
228
|
+
#### `formats`
|
|
229
|
+
|
|
230
|
+
List supported file formats. Alias: `f`
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
> formats
|
|
234
|
+
$ prompsit formats
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
### System
|
|
240
|
+
|
|
241
|
+
| Command | Description |
|
|
242
|
+
|---------|-------------|
|
|
243
|
+
| `health` | API health check |
|
|
244
|
+
| `help` | Show all commands (also: `?`) |
|
|
245
|
+
| `clear` | Clear screen |
|
|
246
|
+
| `exit` | Quit CLI (also: `quit`, `q`) |
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Configuration Reference
|
|
251
|
+
|
|
252
|
+
Config file: `~/.prompsit/config.toml` | Env override: `PROMPSIT_<SECTION>__<KEY>`
|
|
253
|
+
|
|
254
|
+
| Key | CLI Command | Default | Description |
|
|
255
|
+
|-----|-------------|---------|-------------|
|
|
256
|
+
| `api.base_url` | `config api-url` | `https://edge.prompsit.com` | API endpoint |
|
|
257
|
+
| `api.timeout` | - | `30` | HTTP read timeout (sec) |
|
|
258
|
+
| `cli.language` | `language "code"` | `en` | Interface language |
|
|
259
|
+
| `cli.log_level` | `config set log-level "val"` | `INFO` | Log level |
|
|
260
|
+
|
|
261
|
+
## Data Directory: `~/.prompsit/`
|
|
262
|
+
|
|
263
|
+
| Path | Purpose |
|
|
264
|
+
|------|---------|
|
|
265
|
+
| `config.toml` | User configuration (TOML) |
|
|
266
|
+
| `credentials.json` | OAuth2 tokens |
|
|
267
|
+
| `history` | REPL command history |
|
|
268
|
+
| `translations/{lang}.json` | Interface translation cache |
|
|
269
|
+
| `examples/translate/` | Translation examples (txt, csv, xliff) |
|
|
270
|
+
| `examples/evaluate/` | Evaluation examples (tmx) |
|
|
271
|
+
| `examples/score/` | Scoring examples (tmx) |
|
|
272
|
+
| `examples/annotate/` | Annotation examples (jsonl) |
|
|
273
|
+
|
|
274
|
+
## Troubleshooting
|
|
275
|
+
|
|
276
|
+
See [docs/project/runbook.md](docs/project/runbook.md) for setup issues, common errors, and fixes.
|
|
277
|
+
|
|
278
|
+
## License
|
|
279
|
+
|
|
280
|
+
MIT
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Build auth headers object from current token (empty object if not authenticated). */
|
|
2
|
+
export declare function getAuthHeaders(): Record<string, string>;
|
|
3
|
+
/** Extract filename from Content-Disposition header value. Returns null if not found. */
|
|
4
|
+
export declare function parseContentDispositionFilename(header: string | undefined): string | null;
|
|
5
|
+
//# sourceMappingURL=http-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-utils.d.ts","sourceRoot":"","sources":["../../src/api/http-utils.ts"],"names":[],"mappings":"AAMA,wFAAwF;AACxF,wBAAgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAIvD;AAED,yFAAyF;AACzF,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAIzF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Shared HTTP utilities for API resources that bypass transport (binary responses).
|
|
2
|
+
// Used by: JobsResource.download(), EvaluationResource.evaluateFile()
|
|
3
|
+
import { getAccessToken } from "../config/credentials.js";
|
|
4
|
+
import { HEADER_AUTHORIZATION, BEARER_PREFIX } from "../constants.js";
|
|
5
|
+
/** Build auth headers object from current token (empty object if not authenticated). */
|
|
6
|
+
export function getAuthHeaders() {
|
|
7
|
+
const token = getAccessToken();
|
|
8
|
+
if (!token)
|
|
9
|
+
return {};
|
|
10
|
+
return { [HEADER_AUTHORIZATION]: `${BEARER_PREFIX} ${token}` };
|
|
11
|
+
}
|
|
12
|
+
/** Extract filename from Content-Disposition header value. Returns null if not found. */
|
|
13
|
+
export function parseContentDispositionFilename(header) {
|
|
14
|
+
if (!header?.includes("filename="))
|
|
15
|
+
return null;
|
|
16
|
+
const match = /filename="?([^";\s]+)"?/.exec(header);
|
|
17
|
+
return match?.[1] ?? null;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=http-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-utils.js","sourceRoot":"","sources":["../../src/api/http-utils.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sEAAsE;AAEtE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEtE,wFAAwF;AACxF,MAAM,UAAU,cAAc;IAC5B,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC;IAC/B,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,OAAO,EAAE,CAAC,oBAAoB,CAAC,EAAE,GAAG,aAAa,IAAI,KAAK,EAAE,EAAE,CAAC;AACjE,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,+BAA+B,CAAC,MAA0B;IACxE,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC;QAAE,OAAO,IAAI,CAAC;IAChD,MAAM,KAAK,GAAG,yBAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrD,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC5B,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { type FormatInfo } from "../models.ts";
|
|
|
3
3
|
/**
|
|
4
4
|
* Formats API resource.
|
|
5
5
|
*
|
|
6
|
-
* Calls GET /v1/formats via AuthSession (requires auth).
|
|
6
|
+
* Calls GET /v1/translation/document/formats via AuthSession (requires auth).
|
|
7
7
|
* Validates response with Zod schema at boundary.
|
|
8
8
|
*/
|
|
9
9
|
export declare class FormatsResource {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// See API-484: Formats resource - GET /v1/formats with Zod validation
|
|
1
|
+
// See API-484: Formats resource - GET /v1/translation/document/formats with Zod validation
|
|
2
2
|
// Uses AuthSession (authenticated requests with auto-refresh).
|
|
3
3
|
import { FormatsResponseSchema } from "../models.js";
|
|
4
4
|
import { Endpoint } from "../../constants.js";
|
|
5
5
|
/**
|
|
6
6
|
* Formats API resource.
|
|
7
7
|
*
|
|
8
|
-
* Calls GET /v1/formats via AuthSession (requires auth).
|
|
8
|
+
* Calls GET /v1/translation/document/formats via AuthSession (requires auth).
|
|
9
9
|
* Validates response with Zod schema at boundary.
|
|
10
10
|
*/
|
|
11
11
|
export class FormatsResource {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formats.js","sourceRoot":"","sources":["../../../src/api/resources/formats.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"formats.js","sourceRoot":"","sources":["../../../src/api/resources/formats.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,+DAA+D;AAG/D,OAAO,EAAE,qBAAqB,EAAmB,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IACT,OAAO,CAAc;IACrB,OAAO,CAAS;IAEjC,YAAY,OAAoB,EAAE,OAAe;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAU,KAAK,EAAE,GAAG,OAAO,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAE7F,MAAM,MAAM,GAAG,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjD,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;CACF"}
|
package/dist/api/verbose.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Options as GotOptions } from "got";
|
|
2
2
|
/**
|
|
3
3
|
* Set the output function for verbose curl display.
|
|
4
|
-
*
|
|
4
|
+
* Callback receives sanitized curl (for display) and raw curl (for clipboard copy).
|
|
5
5
|
*/
|
|
6
|
-
export declare function setOutputFn(fn: ((
|
|
6
|
+
export declare function setOutputFn(fn: ((sanitized: string, raw: string) => void) | null): void;
|
|
7
7
|
/**
|
|
8
8
|
* Check if verbose mode is enabled.
|
|
9
9
|
*/
|
|
@@ -26,11 +26,5 @@ export declare function buildCurl(options: GotOptions): string;
|
|
|
26
26
|
* - Hides password/secret/refresh_token/access_token values
|
|
27
27
|
*/
|
|
28
28
|
export declare function sanitizeCurl(curl: string): string;
|
|
29
|
-
/**
|
|
30
|
-
* Log curl for got request (called from got hooks).
|
|
31
|
-
*
|
|
32
|
-
* If verbose mode is enabled, builds curl, sanitizes it,
|
|
33
|
-
* and calls outputFn if set.
|
|
34
|
-
*/
|
|
35
29
|
export declare function logCurl(options: GotOptions): void;
|
|
36
30
|
//# sourceMappingURL=verbose.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verbose.d.ts","sourceRoot":"","sources":["../../src/api/verbose.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,KAAK,CAAC;AASjD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"verbose.d.ts","sourceRoot":"","sources":["../../src/api/verbose.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,KAAK,CAAC;AASjD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAEvF;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAEjD;AAaD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAsCrD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAiBjD;AAWD,wBAAgB,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAWjD"}
|