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/skill/SKILL.md
CHANGED
|
@@ -1,117 +1,112 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: altalandi
|
|
3
|
-
description: >-
|
|
4
|
-
Turn English or stiff, translated or AI-written Icelandic into natural native
|
|
5
|
-
Icelandic through the Altalandi API, with a meaning check and a diff of every
|
|
6
|
-
change. Use when the user mentions Altalandi, or asks for text in proper,
|
|
7
|
-
natural, correct or native Icelandic ("á góðri íslensku", "á réttri íslensku",
|
|
8
|
-
"láttu þetta hljóma eðlilega á íslensku", "translate this into proper
|
|
9
|
-
Icelandic"), including website copy, UI strings, emails and documents meant for
|
|
10
|
-
Icelandic readers. Not for incidental Icelandic in conversation.
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
# Altalandi: native Icelandic, with a meaning check
|
|
14
|
-
|
|
15
|
-
Altalandi rewrites English or stiff
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
`
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
- Leave code, identifiers, legal quotations and anything that must stay verbatim
|
|
114
|
-
out of the text you send.
|
|
115
|
-
- Don't use `--fast` for text people will read: it skips the meaning check.
|
|
116
|
-
- Text is processed and discarded, not stored or used for training.
|
|
117
|
-
- Docs for integrating the API into an app: https://altalandi.is/agents.md
|
|
1
|
+
---
|
|
2
|
+
name: altalandi
|
|
3
|
+
description: >-
|
|
4
|
+
Turn English or stiff, translated or AI-written Icelandic into natural native
|
|
5
|
+
Icelandic through the Altalandi API, with a meaning check and a diff of every
|
|
6
|
+
change. Use when the user mentions Altalandi, or asks for text in proper,
|
|
7
|
+
natural, correct or native Icelandic ("á góðri íslensku", "á réttri íslensku",
|
|
8
|
+
"láttu þetta hljóma eðlilega á íslensku", "translate this into proper
|
|
9
|
+
Icelandic"), including website copy, UI strings, emails and documents meant for
|
|
10
|
+
Icelandic readers. Not for incidental Icelandic in conversation.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Altalandi: native Icelandic, with a meaning check
|
|
14
|
+
|
|
15
|
+
Altalandi rewrites English or stiff Icelandic so it reads as if a native wrote
|
|
16
|
+
it, checks that the meaning held, and lists every change with its reason. Each
|
|
17
|
+
call is paid from the user's free daily units or their credit.
|
|
18
|
+
|
|
19
|
+
**Follow this procedure exactly, every time.** The user must always see the same
|
|
20
|
+
thing: the verdict, the text before and after, each change with its reason, what
|
|
21
|
+
the call cost and what is left. Do not improvise scripts, parse the JSON
|
|
22
|
+
yourself or summarise the result in your own words.
|
|
23
|
+
|
|
24
|
+
## The procedure
|
|
25
|
+
|
|
26
|
+
1. **Save the text** to a UTF-8 temporary file, e.g. `altalandi-in.txt` in the
|
|
27
|
+
system temp folder. Never put the text on the command line.
|
|
28
|
+
2. **Run one command** and wait for it to finish:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx -y altalandi@latest --review --file <temp>/altalandi-in.txt --out <temp>/altalandi-out.txt
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Add `--domain marketing` for website and product copy, `--register formal`
|
|
35
|
+
for official text, `--register warm` for friendly customer messages.
|
|
36
|
+
3. **Paste its stdout into your reply exactly as printed**, as the first thing in
|
|
37
|
+
your reply. It is Markdown: a verdict line, **Fyrir**, **Eftir**,
|
|
38
|
+
**Breytingar** (each change and its reason), **Kostnaður** (cost of this call,
|
|
39
|
+
balance and free units left) and the request id. Do not shorten, reorder,
|
|
40
|
+
translate or reword it.
|
|
41
|
+
4. **Then act on the exit code:**
|
|
42
|
+
|
|
43
|
+
| Exit | What happened | What you do |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| 0 | rewritten and verified, or no change needed | the result is in `altalandi-out.txt`. If the user asked you to update a file, apply it from there; otherwise ask whether to apply it |
|
|
46
|
+
| 3 | the rewrite was refused or the meaning could not be verified | keep the user's original text. Say in one sentence that Altalandi left it unchanged and why (the block says why). Do not apply anything |
|
|
47
|
+
| 4 | out of credit | stop. The block shows the balance and the link to add credit. Do not retry |
|
|
48
|
+
| 2 | not logged in | connect (below), then run step 2 again |
|
|
49
|
+
| 1 | other error (network, too many calls) | the block says what happened. For "too many calls", wait a minute and retry once |
|
|
50
|
+
|
|
51
|
+
5. **Stop there.** After the block and the action, at most one or two sentences
|
|
52
|
+
of your own.
|
|
53
|
+
|
|
54
|
+
## Rules
|
|
55
|
+
|
|
56
|
+
- **Never hand-edit the Icelandic and present it as Altalandi's.** If you think
|
|
57
|
+
something should still change, say so separately under a heading such as
|
|
58
|
+
"Mín tillaga (ekki yfirfarin af Altalandi)", or ask before running it again.
|
|
59
|
+
- **One call per coherent text** (a page section, an email, one UI string). For
|
|
60
|
+
a few strings, run them one by one, at most 4 at a time, and paste each block.
|
|
61
|
+
Keep keys, placeholders (`{name}`, `%s`), HTML and code out of the text you send.
|
|
62
|
+
For a whole folder, i18n catalog or website, use the folder run below instead.
|
|
63
|
+
- **Product names and coined words** the meaning check cannot recognise can make
|
|
64
|
+
it refuse a rewrite (exit 3, "ekki tókst að staðfesta"). That is the safe
|
|
65
|
+
result: keep the original and tell the user.
|
|
66
|
+
- **A long text** is shortened in the block; the whole result is in
|
|
67
|
+
`altalandi-out.txt`. Use `--report` when the user wants a full record: it
|
|
68
|
+
writes `./altalandi-reports/altalandi-<time>-<id>.md`, and the block shows
|
|
69
|
+
its path. Reports contain the text, so write them only when asked.
|
|
70
|
+
- **Don't use `--fast`** for text people will read: it skips the meaning check.
|
|
71
|
+
- If the user only wants spelling fixed and every other word kept, tell them
|
|
72
|
+
Altalandi may rephrase, and go through the changes with them.
|
|
73
|
+
- Free use (the free daily units) is kept by Altalandi, with personal data
|
|
74
|
+
scrubbed, to improve the service; paid use is kept only with consent. Add
|
|
75
|
+
`--no-store` when the user asks that their text not be kept, or when it is
|
|
76
|
+
confidential.
|
|
77
|
+
|
|
78
|
+
## A whole folder, i18n catalog or website
|
|
79
|
+
|
|
80
|
+
One command refines every `.md`, `.txt`, `.html` and `.json` file in a folder,
|
|
81
|
+
or a web page, or a site. It keeps code, URLs, placeholders, tags and JSON keys
|
|
82
|
+
byte for byte, never writes to the input, and writes only changes whose meaning
|
|
83
|
+
check passed.
|
|
84
|
+
|
|
85
|
+
1. **Estimate first:** `npx -y altalandi@latest <folder or URL> --dry-run` (add
|
|
86
|
+
`--site` for a whole site). Show the user the estimate it prints: files,
|
|
87
|
+
passages, characters, units and the price if paid from credit.
|
|
88
|
+
2. **Only when the user agrees,** run the same command with `--yes` in place of
|
|
89
|
+
`--dry-run`. The result goes to `<folder>-is` unless they name a place
|
|
90
|
+
(`--out <path>`).
|
|
91
|
+
3. **Show the summary it prints and the report's path.** Exit 0: done. Exit 2:
|
|
92
|
+
done, but some passages kept their original text; the report lists them and
|
|
93
|
+
why. Exit 4: out of credit; the finished files are written, and the same
|
|
94
|
+
command finishes the rest after a top-up.
|
|
95
|
+
|
|
96
|
+
## Connect this computer (once)
|
|
97
|
+
|
|
98
|
+
Only when a call exits with 2 (`Not logged in`):
|
|
99
|
+
|
|
100
|
+
1. Run `npx -y altalandi@latest login` **in the background**. It waits up to 10
|
|
101
|
+
minutes.
|
|
102
|
+
2. As soon as it prints a link (`https://altalandi.is/tengja?kodi=XXXX-XXXX`) and
|
|
103
|
+
a code, show both to the user. Tell them to sign in or create an account
|
|
104
|
+
(2,000 free units a day, and new accounts get 500 kr. of trial credit) and
|
|
105
|
+
click **Tengja**.
|
|
106
|
+
3. When it prints `✓ Tengt sem <username>`, run step 2 of the procedure again.
|
|
107
|
+
|
|
108
|
+
Never ask the user for an API key, and do not tell them to set
|
|
109
|
+
`ALTALANDI_API_KEY`. `npx -y altalandi@latest whoami` shows the account, the
|
|
110
|
+
balance and the free units at any time.
|
|
111
|
+
|
|
112
|
+
Docs for building the API into an app: https://altalandi.is/agents.md
|
package/update.mjs
CHANGED
|
@@ -166,7 +166,9 @@ function npmGlobalRoot() {
|
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
/** A y/N question on stderr; only y/yes (or j/já) is a yes. Shared with the
|
|
170
|
+
* folder and site runs, which ask before sending anything. */
|
|
171
|
+
export async function ask(question, { input = process.stdin, output = process.stderr } = {}) {
|
|
170
172
|
const rl = createInterface({ input, output });
|
|
171
173
|
try {
|
|
172
174
|
const answer = (await rl.question(`${question} [y/N] `)).trim().toLowerCase();
|