dialekt 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.
- package/README.md +8 -10
- package/TESTING.md +29 -29
- package/dist/cli/main.d.mts +1 -1
- package/dist/cli/main.mjs +549 -362
- package/dist/formatters-De4Q-X1d.mjs +516 -435
- package/dist/index.d.mts +162 -25
- package/dist/index.mjs +119 -34
- package/package.json +3 -3
- package/pnpm-workspace.yaml +3 -3
- package/src/adapter/types.test.ts +57 -57
- package/src/adapter/types.ts +7 -4
- package/src/benchmark/metrics.test.ts +141 -69
- package/src/benchmark/metrics.ts +6 -6
- package/src/benchmark/report.test.ts +38 -38
- package/src/benchmark/report.ts +6 -6
- package/src/benchmark/runner.test.ts +70 -72
- package/src/benchmark/runner.ts +4 -4
- package/src/cli/commands/add.test.ts +90 -109
- package/src/cli/commands/add.ts +40 -28
- package/src/cli/commands/benchmark.test.ts +77 -64
- package/src/cli/commands/benchmark.ts +64 -41
- package/src/cli/commands/languages.test.ts +45 -42
- package/src/cli/commands/languages.ts +16 -12
- package/src/cli/commands/missing.test.ts +143 -92
- package/src/cli/commands/missing.ts +24 -17
- package/src/cli/commands/translate.test.ts +79 -79
- package/src/cli/commands/translate.ts +41 -31
- package/src/cli/commands/unused.test.ts +62 -51
- package/src/cli/commands/unused.ts +18 -14
- package/src/cli/commands/validate.test.ts +130 -72
- package/src/cli/commands/validate.ts +25 -20
- package/src/cli/config-resolution.test.ts +169 -49
- package/src/cli/config-resolution.ts +5 -7
- package/src/cli/format.test.ts +50 -50
- package/src/cli/format.ts +57 -60
- package/src/cli/formatters.test.ts +128 -106
- package/src/cli/formatters.ts +72 -95
- package/src/cli/main.ts +13 -13
- package/src/config/define-config.test.ts +44 -29
- package/src/config/define-config.ts +1 -1
- package/src/config/load-config.test.ts +21 -18
- package/src/config/load-config.ts +5 -5
- package/src/config/types.test.ts +50 -44
- package/src/config/types.ts +2 -2
- package/src/index.ts +22 -26
- package/src/keys/flatten.test.ts +52 -52
- package/src/keys/flatten.ts +7 -9
- package/src/sdk/file-io.test.ts +47 -59
- package/src/sdk/file-io.ts +2 -2
- package/src/sdk/node-layer.test.ts +18 -18
- package/src/sdk/node-layer.ts +2 -2
- package/src/sdk/php-array-reader.test.ts +49 -40
- package/src/sdk/php-array-reader.ts +5 -5
- package/src/translation/chunking.test.ts +52 -44
- package/src/translation/chunking.ts +1 -1
- package/src/translation/missing-keys.test.ts +86 -93
- package/src/translation/missing-keys.ts +4 -6
- package/src/translation/model-registry.test.ts +41 -32
- package/src/translation/model-registry.ts +9 -9
- package/src/translation/one-shot-strategy.test.ts +105 -86
- package/src/translation/one-shot-strategy.ts +10 -12
- package/src/translation/orchestrator.test.ts +90 -101
- package/src/translation/orchestrator.ts +26 -26
- package/src/translation/prompt.test.ts +76 -76
- package/src/translation/prompt.ts +2 -2
- package/src/translation/tool-loop-strategy.test.ts +134 -107
- package/src/translation/tool-loop-strategy.ts +14 -18
- package/src/translation/types.test.ts +22 -22
- package/src/translation/types.ts +3 -3
- package/tsdown.config.ts +3 -3
- package/vitest.config.ts +3 -3
package/README.md
CHANGED
|
@@ -27,20 +27,18 @@ npm install -D @dialekt/adapter-paraglide
|
|
|
27
27
|
Create `dialekt.config.ts` in your project root:
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
|
-
import { defineConfig } from
|
|
31
|
-
import { laravel } from
|
|
30
|
+
import { defineConfig } from "dialekt";
|
|
31
|
+
import { laravel } from "@dialekt/adapter-laravel";
|
|
32
32
|
|
|
33
33
|
export default defineConfig({
|
|
34
|
-
sourceLocale:
|
|
35
|
-
targetLocales: [
|
|
36
|
-
strategy:
|
|
37
|
-
model: { provider:
|
|
38
|
-
fastModel: { provider:
|
|
34
|
+
sourceLocale: "en",
|
|
35
|
+
targetLocales: ["de", "fr", "es"],
|
|
36
|
+
strategy: "one-shot",
|
|
37
|
+
model: { provider: "openai", modelId: "gpt-4o" },
|
|
38
|
+
fastModel: { provider: "openai", modelId: "gpt-4o-mini" },
|
|
39
39
|
chunking: { maxTokens: 3000, charsPerToken: 3.0, concurrency: 3 },
|
|
40
40
|
retry: { maxAttempts: 3, baseDelayMs: 1000 },
|
|
41
|
-
adapters: [
|
|
42
|
-
laravel({ langDir: './lang', scanPaths: ['./app', './resources/views'] }),
|
|
43
|
-
],
|
|
41
|
+
adapters: [laravel({ langDir: "./lang", scanPaths: ["./app", "./resources/views"] })],
|
|
44
42
|
});
|
|
45
43
|
```
|
|
46
44
|
|
package/TESTING.md
CHANGED
|
@@ -2,35 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
## Tested Areas Map
|
|
4
4
|
|
|
5
|
-
| Export
|
|
6
|
-
|
|
7
|
-
| `AdapterReadError` / `AdapterWriteError`
|
|
8
|
-
| `flattenObject` / `unflattenObject` / `diffKeys`
|
|
9
|
-
| `chunkKeys`
|
|
10
|
-
| `computeMissingKeys`
|
|
11
|
-
| `resolveModel` / `UnknownProviderError`
|
|
12
|
-
| `createOneShotStrategy`
|
|
13
|
-
| `createToolLoopStrategy`
|
|
14
|
-
| `runTranslation`
|
|
15
|
-
| `buildSystemPrompt` / `buildUserPrompt`
|
|
16
|
-
| `TranslationFailedError`
|
|
17
|
-
| `runBenchmarkedChunk` / `summarizeBenchmarkResults` | `src/benchmark/metrics.test.ts`
|
|
18
|
-
| `formatBenchmarkReport`
|
|
19
|
-
| `runBenchmark`
|
|
20
|
-
| `translateCommand` / `runTranslate`
|
|
21
|
-
| `validateCommand` / `runValidate`
|
|
22
|
-
| `addCommand` / `runAdd` / `parseAddTokens`
|
|
23
|
-
| `missingCommand` / `runMissing`
|
|
24
|
-
| `unusedCommand` / `runUnused`
|
|
25
|
-
| `languagesCommand` / `runLanguages`
|
|
26
|
-
| `benchmarkCommand` / `runBenchmarkCommand`
|
|
27
|
-
| `resolveEffectiveConfig`
|
|
28
|
-
| `loadConfig` / `ConfigLoadError`
|
|
29
|
-
| `defineConfig`
|
|
30
|
-
| config types
|
|
31
|
-
| `readFileIfExists` / `writeFileEnsuringDir`
|
|
32
|
-
| `NodePlatformLayer`
|
|
33
|
-
| `readPhpArrayAsJson` / `PhpExecutionError`
|
|
5
|
+
| Export | Test File | Status |
|
|
6
|
+
| --------------------------------------------------- | -------------------------------------------- | ------ |
|
|
7
|
+
| `AdapterReadError` / `AdapterWriteError` | `src/adapter/types.test.ts` | ✅ |
|
|
8
|
+
| `flattenObject` / `unflattenObject` / `diffKeys` | `src/keys/flatten.test.ts` | ✅ |
|
|
9
|
+
| `chunkKeys` | `src/translation/chunking.test.ts` | ✅ |
|
|
10
|
+
| `computeMissingKeys` | `src/translation/missing-keys.test.ts` | ✅ |
|
|
11
|
+
| `resolveModel` / `UnknownProviderError` | `src/translation/model-registry.test.ts` | ✅ |
|
|
12
|
+
| `createOneShotStrategy` | `src/translation/one-shot-strategy.test.ts` | ✅ |
|
|
13
|
+
| `createToolLoopStrategy` | `src/translation/tool-loop-strategy.test.ts` | ✅ |
|
|
14
|
+
| `runTranslation` | `src/translation/orchestrator.test.ts` | ✅ |
|
|
15
|
+
| `buildSystemPrompt` / `buildUserPrompt` | `src/translation/prompt.test.ts` | ✅ |
|
|
16
|
+
| `TranslationFailedError` | `src/translation/types.test.ts` | ✅ |
|
|
17
|
+
| `runBenchmarkedChunk` / `summarizeBenchmarkResults` | `src/benchmark/metrics.test.ts` | ✅ |
|
|
18
|
+
| `formatBenchmarkReport` | `src/benchmark/report.test.ts` | ✅ |
|
|
19
|
+
| `runBenchmark` | `src/benchmark/runner.test.ts` | ✅ |
|
|
20
|
+
| `translateCommand` / `runTranslate` | `src/cli/commands/translate.test.ts` | ✅ |
|
|
21
|
+
| `validateCommand` / `runValidate` | `src/cli/commands/validate.test.ts` | ✅ |
|
|
22
|
+
| `addCommand` / `runAdd` / `parseAddTokens` | `src/cli/commands/add.test.ts` | ✅ |
|
|
23
|
+
| `missingCommand` / `runMissing` | `src/cli/commands/missing.test.ts` | ✅ |
|
|
24
|
+
| `unusedCommand` / `runUnused` | `src/cli/commands/unused.test.ts` | ✅ |
|
|
25
|
+
| `languagesCommand` / `runLanguages` | `src/cli/commands/languages.test.ts` | ✅ |
|
|
26
|
+
| `benchmarkCommand` / `runBenchmarkCommand` | `src/cli/commands/benchmark.test.ts` | ✅ |
|
|
27
|
+
| `resolveEffectiveConfig` | `src/cli/config-resolution.test.ts` | ✅ |
|
|
28
|
+
| `loadConfig` / `ConfigLoadError` | `src/config/load-config.test.ts` | ✅ |
|
|
29
|
+
| `defineConfig` | `src/config/define-config.test.ts` | ✅ |
|
|
30
|
+
| config types | `src/config/types.test.ts` | ✅ |
|
|
31
|
+
| `readFileIfExists` / `writeFileEnsuringDir` | `src/sdk/file-io.test.ts` | ✅ |
|
|
32
|
+
| `NodePlatformLayer` | `src/sdk/node-layer.test.ts` | ✅ |
|
|
33
|
+
| `readPhpArrayAsJson` / `PhpExecutionError` | `src/sdk/php-array-reader.test.ts` | ✅ |
|
|
34
34
|
|
|
35
35
|
## Known Coverage Gaps
|
|
36
36
|
|
package/dist/cli/main.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|