@llman-sdd/cli 0.9.0 → 0.10.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/src/progress.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+
1
4
  /**
2
5
  * Localized stage-progress notes (B1): genuinely long-running operations print
3
6
  * a short one-line stderr note in the project locale (zh → zh-Hans text,
@@ -6,8 +9,7 @@
6
9
  * progress on stderr); each key fires at most once per process; notes are only
7
10
  * emitted before the long op itself, never ahead of domain errors.
8
11
  */
9
- import { readFileSync } from 'node:fs';
10
- import { join } from 'node:path';
12
+ import { DEFAULT_LOCALE, normalizeLocale } from '@llman-sdd/core';
11
13
 
12
14
  type Locale = 'zh' | 'en';
13
15
 
@@ -35,16 +37,22 @@ export function resolveNote(key: string, locale: Locale): string | undefined {
35
37
  return NOTES[key]?.[locale];
36
38
  }
37
39
 
38
- /** Detect the project locale from llmanspec/config.yaml (zh-* → zh, else en). */
40
+ /**
41
+ * Detect the project locale from llmanspec/config.yaml. r18 normalizes every
42
+ * locale (including `en` and unknown values) to the built-in zh-Hans, so the
43
+ * Chinese note arm is always selected; the English arm stays as the i18n
44
+ * mechanism's other side, no longer reachable from config.
45
+ */
39
46
  export function detectLocale(cwd: string): Locale {
40
47
  try {
41
48
  const cfg = readFileSync(join(cwd, 'llmanspec', 'config.yaml'), 'utf8');
42
49
  const m = cfg.match(/^locale:\s*([A-Za-z-]+)/mu);
43
- if (m?.[1]?.startsWith('zh') ?? false) return 'zh';
50
+ const normalized = m?.[1] === undefined ? DEFAULT_LOCALE : normalizeLocale(m[1]);
51
+ return normalized === DEFAULT_LOCALE ? 'zh' : 'en';
44
52
  } catch {
45
- // No config at cwd — English fallback.
53
+ // No config at cwd — the built-in default locale.
46
54
  }
47
- return 'en';
55
+ return 'zh';
48
56
  }
49
57
 
50
58
  const shown = new Set<string>();