@juicesharp/rpiv-todo 1.9.1 → 1.10.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/index.ts +11 -36
- package/package.json +2 -2
package/index.ts
CHANGED
|
@@ -10,17 +10,15 @@
|
|
|
10
10
|
* The extension stays online either way.
|
|
11
11
|
*
|
|
12
12
|
* Adding a locale: drop `locales/<code>.json` next to en.json (mirroring the
|
|
13
|
-
* key set)
|
|
14
|
-
* See `@juicesharp/rpiv-i18n` README →
|
|
15
|
-
* full convention.
|
|
13
|
+
* key set). No edit needed here — `registerLocalesFromDir` iterates
|
|
14
|
+
* `SUPPORTED_LOCALES` from the SDK. See `@juicesharp/rpiv-i18n` README →
|
|
15
|
+
* "Contributing translations" for the full convention.
|
|
16
16
|
*
|
|
17
17
|
* Extracted from rpiv-pi@7525a5d. Tool name "todo" and widget key
|
|
18
18
|
* "rpiv-todos" preserved verbatim so existing session history replays
|
|
19
19
|
* correctly after upgrade.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import { readFileSync } from "node:fs";
|
|
23
|
-
import { fileURLToPath } from "node:url";
|
|
24
22
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
25
23
|
import { I18N_NAMESPACE } from "./state/i18n-bridge.js";
|
|
26
24
|
import { replayFromBranch } from "./state/replay.js";
|
|
@@ -28,43 +26,20 @@ import { replaceState } from "./state/store.js";
|
|
|
28
26
|
import { registerTodosCommand, registerTodoTool, TOOL_NAME } from "./todo.js";
|
|
29
27
|
import { TodoOverlay } from "./todo-overlay.js";
|
|
30
28
|
|
|
31
|
-
type
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
function loadLocale(code: string): TranslationMap {
|
|
35
|
-
// A missing or malformed locale file degrades gracefully: registerStrings
|
|
36
|
-
// records an empty map for the locale, so render-time `t(key, fallback)`
|
|
37
|
-
// returns the canonical English literal at the call site. Crashing here
|
|
38
|
-
// would take the entire todo extension offline at module init —
|
|
39
|
-
// publish-manifest miss would brick the extension.
|
|
40
|
-
try {
|
|
41
|
-
return JSON.parse(
|
|
42
|
-
readFileSync(fileURLToPath(new URL(`./locales/${code}.json`, import.meta.url)), "utf-8"),
|
|
43
|
-
) as TranslationMap;
|
|
44
|
-
} catch (err) {
|
|
45
|
-
console.warn(
|
|
46
|
-
`rpiv-todo: failed to load locales/${code}.json — falling back to English (${(err as Error).message})`,
|
|
47
|
-
);
|
|
48
|
-
return {};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
29
|
+
type I18nLoader = {
|
|
30
|
+
registerLocalesFromDir: (namespace: string, packageUrl: string, options?: { label?: string }) => void;
|
|
31
|
+
};
|
|
51
32
|
|
|
52
33
|
// Dynamic import keeps `@juicesharp/rpiv-i18n` a soft optional peer: when the
|
|
53
34
|
// SDK is installed alongside this package the strings register and
|
|
54
35
|
// `/languages` flips them live; when it isn't, the import rejects here, we
|
|
55
36
|
// no-op, and the bridge's English-fallback shim keeps the extension online.
|
|
37
|
+
//
|
|
38
|
+
// The `/loader` subpath is used instead of the SDK entry so the i18n-ui +
|
|
39
|
+
// pi-tui modules are not pulled into our load graph just to register strings.
|
|
56
40
|
try {
|
|
57
|
-
const sdk = (await import("@juicesharp/rpiv-i18n")) as
|
|
58
|
-
sdk.
|
|
59
|
-
de: loadLocale("de"),
|
|
60
|
-
en: loadLocale("en"),
|
|
61
|
-
es: loadLocale("es"),
|
|
62
|
-
fr: loadLocale("fr"),
|
|
63
|
-
pt: loadLocale("pt"),
|
|
64
|
-
"pt-BR": loadLocale("pt-BR"),
|
|
65
|
-
ru: loadLocale("ru"),
|
|
66
|
-
uk: loadLocale("uk"),
|
|
67
|
-
});
|
|
41
|
+
const sdk = (await import("@juicesharp/rpiv-i18n/loader")) as I18nLoader;
|
|
42
|
+
sdk.registerLocalesFromDir(I18N_NAMESPACE, import.meta.url, { label: "rpiv-todo" });
|
|
68
43
|
} catch {
|
|
69
44
|
// SDK absent — extension still loads with English-only UI.
|
|
70
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juicesharp/rpiv-todo",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Pi extension. A todo list for the model, rendered as a live overlay that survives /reload and conversation compaction.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -64,6 +64,6 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@juicesharp/rpiv-config": "^1.
|
|
67
|
+
"@juicesharp/rpiv-config": "^1.10.0"
|
|
68
68
|
}
|
|
69
69
|
}
|