altalandi 0.4.0 → 0.6.0
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 +114 -0
- package/altalandi.mjs +325 -223
- package/auth.mjs +223 -215
- package/batch.mjs +620 -0
- package/client.d.ts +9 -0
- package/client.mjs +13 -2
- package/package.json +5 -2
- package/report.mjs +288 -1
- package/segment.mjs +1059 -0
- package/skill/SKILL.md +112 -117
- package/update.mjs +3 -1
- package/web.mjs +558 -0
package/README.md
CHANGED
|
@@ -96,6 +96,9 @@ altalandi "Some English or Icelandic text."
|
|
|
96
96
|
echo "some text" | altalandi --domain marketing
|
|
97
97
|
altalandi --json "..." # full JSON response
|
|
98
98
|
altalandi --fast "..." # skip the meaning + nativeness gates
|
|
99
|
+
altalandi --diff --file draft.txt # show before, after and every change with its reason
|
|
100
|
+
altalandi --review --file in.txt --out out.txt # for agents: one block to show as it is
|
|
101
|
+
altalandi --report --file draft.txt # also write a Markdown report to ./altalandi-reports/
|
|
99
102
|
```
|
|
100
103
|
|
|
101
104
|
| flag | default | meaning |
|
|
@@ -103,8 +106,116 @@ altalandi --fast "..." # skip the meaning + nativeness gates
|
|
|
103
106
|
| `--domain` | `general` | `general` \| `marketing` \| `data-analysis` \| `childrens-fiction` |
|
|
104
107
|
| `--register` | `neutral` | `formal` \| `neutral` \| `warm` |
|
|
105
108
|
| `--json` | off | print the full API response |
|
|
109
|
+
| `--diff` | off | print the text before and after, then each change with its reason, on `stderr` (coloured in a terminal; `NO_COLOR` turns colour off) |
|
|
110
|
+
| `--review` | off | print one Markdown block on `stdout`, made to be shown as it is: the verdict, the text before and after, each change with its reason, what the call cost and the balance and free units left. Exits on the outcome: `0` rewritten and verified or no change needed, `3` refused or unverified, `4` out of credit |
|
|
111
|
+
| `--no-store` | off | send `contribute: false`: this text is never kept. Without it, free use (calls covered by the free daily units) is kept with personal data scrubbed, to improve the service; paid use is kept only with consent ([privacy](https://altalandi.is/personuvernd#textabanki)) |
|
|
112
|
+
| `--out <file>` | | write the refined text to `<file>` (UTF-8); with `--review` the block names it when the text is shortened |
|
|
113
|
+
| `--report` | off | also write `./altalandi-reports/altalandi-<time>-<id>.md`: input, output, a table of every change (before, after, reason, layer), warnings and the verdict |
|
|
114
|
+
| `--report-dir <dir>` | | write the report to `<dir>` instead (implies `--report`) |
|
|
106
115
|
| `--fast` | off | `preserveMeaning:false`, `scoreNativeness:false`, `onlyImprove:false`, `polishPass:false`, `scoring:"none"` — normally one model call (structured input can still add a structure-preserving retry) |
|
|
107
116
|
|
|
117
|
+
## Folders, i18n catalogs and websites
|
|
118
|
+
|
|
119
|
+
One command for a whole folder, one web page, or a site. The input is never
|
|
120
|
+
written to.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
altalandi ./docs # every .md .txt .html .json under ./docs → ./docs-is
|
|
124
|
+
altalandi ./locales --out ./locales-is # i18n catalogs: values only, placeholders kept
|
|
125
|
+
altalandi ./docs --dry-run # every passage and the estimate; sends nothing
|
|
126
|
+
altalandi https://example.com/pricing --out pricing-is.md # one page → Markdown
|
|
127
|
+
altalandi https://example.com/docs/ --site --max-pages 50 # a site → ./example.com-is/
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Each passage (a paragraph, list item, table cell, heading or string) is its own
|
|
131
|
+
call. Everything outside the passages is written back byte for byte:
|
|
132
|
+
|
|
133
|
+
| format | refined | never touched |
|
|
134
|
+
|--------|---------|---------------|
|
|
135
|
+
| Markdown | paragraphs, list items, table cells, heading text, front-matter `title`/`description`-style values | code blocks, inline code, URLs, link targets, HTML tags, front-matter keys, heading markup |
|
|
136
|
+
| HTML | text in elements (inline tags travel as numbered markers and come back exactly) | tags, attributes, entities, `script`, `style`, `pre`, `code`, `translate="no"` |
|
|
137
|
+
| JSON | string values of i18n catalogs | keys, `@`/`$` metadata, `{name}` `{{name}}` `%s` `%(name)s`, ICU plural/select structure, HTML in strings |
|
|
138
|
+
| Text | paragraphs (re-wrapped to their width) and lines | |
|
|
139
|
+
|
|
140
|
+
Passages with nothing to refine (code, numbers, URLs or placeholders alone) are
|
|
141
|
+
skipped, and a passage that appears twice is sent once. `node_modules`, `.git`,
|
|
142
|
+
`dist`, `build`, `altalandi-reports`, hidden files and folders and symlinks are
|
|
143
|
+
skipped. JSON config (`package.json`, `tsconfig.json`, …) and JSON with numbers
|
|
144
|
+
or booleans is copied unchanged; other file types are not copied.
|
|
145
|
+
|
|
146
|
+
Pages are fetched one at a time with a User-Agent naming altalandi, only where
|
|
147
|
+
robots.txt allows it for `altalandi` and for `*` (`Crawl-delay` is honoured).
|
|
148
|
+
The readable part (`<main>` or `<article>`, else `<body>` without navigation,
|
|
149
|
+
header, footer, sidebars, forms, scripts and hidden elements) becomes Markdown.
|
|
150
|
+
`--site` reads `/sitemap.xml`, or follows links when there is none, staying on
|
|
151
|
+
the same origin and under the URL's folder.
|
|
152
|
+
|
|
153
|
+
**Cost and safety.** Before anything is sent, the CLI prints an estimate, priced
|
|
154
|
+
from the public tariff:
|
|
155
|
+
|
|
156
|
+
```text
|
|
157
|
+
5 files, 24 passages, about 851 characters (23 calls: repeated passages are sent once).
|
|
158
|
+
1 more file has nothing to refine and is copied unchanged.
|
|
159
|
+
Billing: about 920 units (at least 40 a call), about 74 kr if paid from credit. The free allowance is 2,000 units a day.
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Every call costs at least the per-call minimum, so many short strings cost more
|
|
163
|
+
than their word count. In a terminal it asks before sending; without one (CI,
|
|
164
|
+
agents) it sends nothing unless you pass `--yes`.
|
|
165
|
+
|
|
166
|
+
| flag | default | meaning |
|
|
167
|
+
|------|---------|---------|
|
|
168
|
+
| `--out <path>` | `<folder>-is` | output folder, refused if it is the input, inside it or around it; for one page, the `.md` file |
|
|
169
|
+
| `--dry-run` | off | list every passage and the estimate; send nothing, write nothing |
|
|
170
|
+
| `--yes`, `-y` | off | send without asking |
|
|
171
|
+
| `--max-chars <n>` | | files are sent in order until the next would go over n characters; the rest are neither sent nor written |
|
|
172
|
+
| `--concurrency <n>` | `2` | calls at once, 1–4 |
|
|
173
|
+
| `--site` / `--max-pages <n>` | off / `20` | read a site from the URL, up to n pages |
|
|
174
|
+
| `--no-store` | off | keep none of the passages (free use is otherwise kept, scrubbed of personal data) |
|
|
175
|
+
| `--json` | off | a machine-readable summary of every file and passage on stdout |
|
|
176
|
+
|
|
177
|
+
A `429` waits as long as `Retry-After` asks (up to 5 minutes) and retries. A
|
|
178
|
+
`402` stops the run cleanly: finished files are written, the rest are listed and
|
|
179
|
+
not written; run the same command again after topping up.
|
|
180
|
+
|
|
181
|
+
**Results.** Only verified changes are written. A passage keeps its original
|
|
182
|
+
text when its meaning check did not pass (`meaningCheck` other than `passed`, or
|
|
183
|
+
`meaningPreserved` not `true`), or when the refined text lost or changed code, a
|
|
184
|
+
URL, a placeholder or a tag. One report next to the output
|
|
185
|
+
(`altalandi-reports/altalandi-<time>-<input>.md`) lists every file and every
|
|
186
|
+
changed passage with its meaning verdict, and the kept passages under their own
|
|
187
|
+
heading with the unused suggestion and the reason.
|
|
188
|
+
|
|
189
|
+
| exit | meaning |
|
|
190
|
+
|------|---------|
|
|
191
|
+
| `0` | done |
|
|
192
|
+
| `2` | done, but some passages kept their original text (see the report) |
|
|
193
|
+
| `4` | stopped: out of credit or allowance |
|
|
194
|
+
| `1` | error, or not everything was done (a failed call, `--max-chars`, no `--yes`) |
|
|
195
|
+
|
|
196
|
+
## Before and after
|
|
197
|
+
|
|
198
|
+
`--diff` prints what the website shows inline, in the terminal:
|
|
199
|
+
|
|
200
|
+
```text
|
|
201
|
+
── Fyrir ───────────────────────────────────
|
|
202
|
+
Vertu viss um að ná út til okkar ef þú hefur einhverjar spurningar.
|
|
203
|
+
|
|
204
|
+
── Eftir ───────────────────────────────────
|
|
205
|
+
Ekki hika við að hafa samband ef einhverjar spurningar vakna.
|
|
206
|
+
|
|
207
|
+
── Breytingar (1) ──────────────────────────
|
|
208
|
+
1. − Vertu viss um að ná út til okkar ef þú hefur einhverjar spurningar.
|
|
209
|
+
+ Ekki hika við að hafa samband ef einhverjar spurningar vakna.
|
|
210
|
+
↳ <the reason the engine gives>
|
|
211
|
+
|
|
212
|
+
Endurskrifað og merking staðfest · innfæddni 91/100
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
`--report` (or `ALTALANDI_REPORT=1`) writes the same content as a Markdown file
|
|
216
|
+
you can keep or share. Reports are off by default because they contain your text.
|
|
217
|
+
`stdout` stays the refined text alone either way, so piping is unaffected.
|
|
218
|
+
|
|
108
219
|
## The meaning guarantee
|
|
109
220
|
|
|
110
221
|
Altalandi never silently changes meaning. For Icelandic input where the rewrite
|
|
@@ -138,6 +249,9 @@ the explicit verification opt-out and exits 0 after a successful API response.
|
|
|
138
249
|
|-----|---------|---------|
|
|
139
250
|
| `ALTALANDI_API_KEY` | — | your key (Bearer). Mint at https://altalandi.is/portal |
|
|
140
251
|
| `ALTALANDI_BASE_URL` | `https://altalandi.is/api` | API base (override for self-hosting) |
|
|
252
|
+
| `ALTALANDI_DIFF` | — | `1` = always print the before/after (as `--diff`) |
|
|
253
|
+
| `ALTALANDI_REPORT` | — | `1` = always write a report (as `--report`) |
|
|
254
|
+
| `ALTALANDI_REPORT_DIR` | `./altalandi-reports` | where reports go |
|
|
141
255
|
|
|
142
256
|
MIT licensed. Calls are paid from the account's prepaid credit (a 500 kr trial,
|
|
143
257
|
then credit bought in the portal); a call the credit cannot cover exits with the
|