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.
Files changed (71) hide show
  1. package/README.md +8 -10
  2. package/TESTING.md +29 -29
  3. package/dist/cli/main.d.mts +1 -1
  4. package/dist/cli/main.mjs +549 -362
  5. package/dist/formatters-De4Q-X1d.mjs +516 -435
  6. package/dist/index.d.mts +162 -25
  7. package/dist/index.mjs +119 -34
  8. package/package.json +3 -3
  9. package/pnpm-workspace.yaml +3 -3
  10. package/src/adapter/types.test.ts +57 -57
  11. package/src/adapter/types.ts +7 -4
  12. package/src/benchmark/metrics.test.ts +141 -69
  13. package/src/benchmark/metrics.ts +6 -6
  14. package/src/benchmark/report.test.ts +38 -38
  15. package/src/benchmark/report.ts +6 -6
  16. package/src/benchmark/runner.test.ts +70 -72
  17. package/src/benchmark/runner.ts +4 -4
  18. package/src/cli/commands/add.test.ts +90 -109
  19. package/src/cli/commands/add.ts +40 -28
  20. package/src/cli/commands/benchmark.test.ts +77 -64
  21. package/src/cli/commands/benchmark.ts +64 -41
  22. package/src/cli/commands/languages.test.ts +45 -42
  23. package/src/cli/commands/languages.ts +16 -12
  24. package/src/cli/commands/missing.test.ts +143 -92
  25. package/src/cli/commands/missing.ts +24 -17
  26. package/src/cli/commands/translate.test.ts +79 -79
  27. package/src/cli/commands/translate.ts +41 -31
  28. package/src/cli/commands/unused.test.ts +62 -51
  29. package/src/cli/commands/unused.ts +18 -14
  30. package/src/cli/commands/validate.test.ts +130 -72
  31. package/src/cli/commands/validate.ts +25 -20
  32. package/src/cli/config-resolution.test.ts +169 -49
  33. package/src/cli/config-resolution.ts +5 -7
  34. package/src/cli/format.test.ts +50 -50
  35. package/src/cli/format.ts +57 -60
  36. package/src/cli/formatters.test.ts +128 -106
  37. package/src/cli/formatters.ts +72 -95
  38. package/src/cli/main.ts +13 -13
  39. package/src/config/define-config.test.ts +44 -29
  40. package/src/config/define-config.ts +1 -1
  41. package/src/config/load-config.test.ts +21 -18
  42. package/src/config/load-config.ts +5 -5
  43. package/src/config/types.test.ts +50 -44
  44. package/src/config/types.ts +2 -2
  45. package/src/index.ts +22 -26
  46. package/src/keys/flatten.test.ts +52 -52
  47. package/src/keys/flatten.ts +7 -9
  48. package/src/sdk/file-io.test.ts +47 -59
  49. package/src/sdk/file-io.ts +2 -2
  50. package/src/sdk/node-layer.test.ts +18 -18
  51. package/src/sdk/node-layer.ts +2 -2
  52. package/src/sdk/php-array-reader.test.ts +49 -40
  53. package/src/sdk/php-array-reader.ts +5 -5
  54. package/src/translation/chunking.test.ts +52 -44
  55. package/src/translation/chunking.ts +1 -1
  56. package/src/translation/missing-keys.test.ts +86 -93
  57. package/src/translation/missing-keys.ts +4 -6
  58. package/src/translation/model-registry.test.ts +41 -32
  59. package/src/translation/model-registry.ts +9 -9
  60. package/src/translation/one-shot-strategy.test.ts +105 -86
  61. package/src/translation/one-shot-strategy.ts +10 -12
  62. package/src/translation/orchestrator.test.ts +90 -101
  63. package/src/translation/orchestrator.ts +26 -26
  64. package/src/translation/prompt.test.ts +76 -76
  65. package/src/translation/prompt.ts +2 -2
  66. package/src/translation/tool-loop-strategy.test.ts +134 -107
  67. package/src/translation/tool-loop-strategy.ts +14 -18
  68. package/src/translation/types.test.ts +22 -22
  69. package/src/translation/types.ts +3 -3
  70. package/tsdown.config.ts +3 -3
  71. 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 'dialekt';
31
- import { laravel } from '@dialekt/adapter-laravel';
30
+ import { defineConfig } from "dialekt";
31
+ import { laravel } from "@dialekt/adapter-laravel";
32
32
 
33
33
  export default defineConfig({
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' },
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 | 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` | ✅ |
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
 
@@ -1 +1 @@
1
- export { };
1
+ export {};