oh-my-knowledge 0.26.0 → 0.27.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.
Files changed (152) hide show
  1. package/README.md +109 -347
  2. package/README.zh.md +146 -376
  3. package/dist/src/analysis/report-diagnostics.d.ts +1 -1
  4. package/dist/src/analysis/report-diagnostics.js +1 -1
  5. package/dist/src/analysis/sample-diagnostics.d.ts +2 -2
  6. package/dist/src/analysis/sample-diagnostics.js +2 -2
  7. package/dist/src/authoring/generator.d.ts.map +1 -1
  8. package/dist/src/authoring/generator.js +9 -8
  9. package/dist/src/authoring/generator.js.map +1 -1
  10. package/dist/src/cli/cli-exit.d.ts +15 -0
  11. package/dist/src/cli/cli-exit.d.ts.map +1 -0
  12. package/dist/src/cli/cli-exit.js +19 -0
  13. package/dist/src/cli/cli-exit.js.map +1 -0
  14. package/dist/src/cli/commands/_shared.d.ts +12 -0
  15. package/dist/src/cli/commands/_shared.d.ts.map +1 -0
  16. package/dist/src/cli/commands/_shared.js +26 -0
  17. package/dist/src/cli/commands/_shared.js.map +1 -0
  18. package/dist/src/cli/commands/doctor.d.ts +2 -0
  19. package/dist/src/cli/commands/doctor.d.ts.map +1 -0
  20. package/dist/src/cli/commands/doctor.js +137 -0
  21. package/dist/src/cli/commands/doctor.js.map +1 -0
  22. package/dist/src/cli/commands/eval-debias.d.ts +2 -0
  23. package/dist/src/cli/commands/eval-debias.d.ts.map +1 -0
  24. package/dist/src/cli/commands/eval-debias.js +88 -0
  25. package/dist/src/cli/commands/eval-debias.js.map +1 -0
  26. package/dist/src/cli/commands/eval-gold.d.ts +2 -0
  27. package/dist/src/cli/commands/eval-gold.d.ts.map +1 -0
  28. package/dist/src/cli/commands/eval-gold.js +137 -0
  29. package/dist/src/cli/commands/eval-gold.js.map +1 -0
  30. package/dist/src/cli/commands/eval-runner.d.ts +2 -0
  31. package/dist/src/cli/commands/eval-runner.d.ts.map +1 -0
  32. package/dist/src/cli/commands/eval-runner.js +299 -0
  33. package/dist/src/cli/commands/eval-runner.js.map +1 -0
  34. package/dist/src/cli/commands/eval.d.ts +2 -0
  35. package/dist/src/cli/commands/eval.d.ts.map +1 -0
  36. package/dist/src/cli/commands/eval.js +16 -0
  37. package/dist/src/cli/commands/eval.js.map +1 -0
  38. package/dist/src/cli/commands/export-diff.d.ts +2 -0
  39. package/dist/src/cli/commands/export-diff.d.ts.map +1 -0
  40. package/dist/src/cli/commands/export-diff.js +177 -0
  41. package/dist/src/cli/commands/export-diff.js.map +1 -0
  42. package/dist/src/cli/commands/export-saturation.d.ts +2 -0
  43. package/dist/src/cli/commands/export-saturation.d.ts.map +1 -0
  44. package/dist/src/cli/commands/export-saturation.js +59 -0
  45. package/dist/src/cli/commands/export-saturation.js.map +1 -0
  46. package/dist/src/cli/commands/export-verdict.d.ts +2 -0
  47. package/dist/src/cli/commands/export-verdict.d.ts.map +1 -0
  48. package/dist/src/cli/commands/export-verdict.js +45 -0
  49. package/dist/src/cli/commands/export-verdict.js.map +1 -0
  50. package/dist/src/cli/commands/export.d.ts +2 -0
  51. package/dist/src/cli/commands/export.d.ts.map +1 -0
  52. package/dist/src/cli/commands/export.js +150 -0
  53. package/dist/src/cli/commands/export.js.map +1 -0
  54. package/dist/src/cli/commands/improve-failures.d.ts +2 -0
  55. package/dist/src/cli/commands/improve-failures.d.ts.map +1 -0
  56. package/dist/src/cli/commands/improve-failures.js +59 -0
  57. package/dist/src/cli/commands/improve-failures.js.map +1 -0
  58. package/dist/src/cli/commands/improve-plan.d.ts +2 -0
  59. package/dist/src/cli/commands/improve-plan.d.ts.map +1 -0
  60. package/dist/src/cli/commands/improve-plan.js +75 -0
  61. package/dist/src/cli/commands/improve-plan.js.map +1 -0
  62. package/dist/src/cli/commands/improve-samples.d.ts +2 -0
  63. package/dist/src/cli/commands/improve-samples.d.ts.map +1 -0
  64. package/dist/src/cli/commands/improve-samples.js +120 -0
  65. package/dist/src/cli/commands/improve-samples.js.map +1 -0
  66. package/dist/src/cli/commands/improve-skill.d.ts +2 -0
  67. package/dist/src/cli/commands/improve-skill.d.ts.map +1 -0
  68. package/dist/src/cli/commands/improve-skill.js +115 -0
  69. package/dist/src/cli/commands/improve-skill.js.map +1 -0
  70. package/dist/src/cli/commands/improve.d.ts +2 -0
  71. package/dist/src/cli/commands/improve.d.ts.map +1 -0
  72. package/dist/src/cli/commands/improve.js +34 -0
  73. package/dist/src/cli/commands/improve.js.map +1 -0
  74. package/dist/src/cli/commands/init.d.ts +2 -0
  75. package/dist/src/cli/commands/init.d.ts.map +1 -0
  76. package/dist/src/cli/commands/init.js +110 -0
  77. package/dist/src/cli/commands/init.js.map +1 -0
  78. package/dist/src/cli/commands/observe.d.ts +2 -0
  79. package/dist/src/cli/commands/observe.d.ts.map +1 -0
  80. package/dist/src/cli/commands/observe.js +77 -0
  81. package/dist/src/cli/commands/observe.js.map +1 -0
  82. package/dist/src/cli/commands/registry.d.ts +11 -0
  83. package/dist/src/cli/commands/registry.d.ts.map +1 -0
  84. package/dist/src/cli/commands/registry.js +42 -0
  85. package/dist/src/cli/commands/registry.js.map +1 -0
  86. package/dist/src/cli/commands/studio.d.ts +2 -0
  87. package/dist/src/cli/commands/studio.d.ts.map +1 -0
  88. package/dist/src/cli/commands/studio.js +76 -0
  89. package/dist/src/cli/commands/studio.js.map +1 -0
  90. package/dist/src/cli/coverage-renderer.d.ts +1 -1
  91. package/dist/src/cli/coverage-renderer.js +1 -1
  92. package/dist/src/cli/i18n-dict.d.ts +4 -4
  93. package/dist/src/cli/i18n-dict.d.ts.map +1 -1
  94. package/dist/src/cli/i18n-dict.js +558 -564
  95. package/dist/src/cli/i18n-dict.js.map +1 -1
  96. package/dist/src/cli/index.js +43 -1516
  97. package/dist/src/cli/index.js.map +1 -1
  98. package/dist/src/cli/parse-run-config.d.ts +3 -4
  99. package/dist/src/cli/parse-run-config.d.ts.map +1 -1
  100. package/dist/src/cli/parse-run-config.js +5 -5
  101. package/dist/src/cli/parse-run-config.js.map +1 -1
  102. package/dist/src/cli/parse-strict.d.ts +0 -13
  103. package/dist/src/cli/parse-strict.d.ts.map +1 -1
  104. package/dist/src/cli/parse-strict.js +2 -1
  105. package/dist/src/cli/parse-strict.js.map +1 -1
  106. package/dist/src/doctor/index.d.ts +1 -1
  107. package/dist/src/doctor/index.js +2 -2
  108. package/dist/src/doctor/index.js.map +1 -1
  109. package/dist/src/doctor/preflight.d.ts +2 -2
  110. package/dist/src/doctor/preflight.js +2 -2
  111. package/dist/src/eval-core/fact-checker.js +1 -1
  112. package/dist/src/eval-core/fact-checker.js.map +1 -1
  113. package/dist/src/eval-core/layer-gates.d.ts +1 -1
  114. package/dist/src/eval-core/layer-gates.js +1 -1
  115. package/dist/src/eval-core/verdict.d.ts +4 -4
  116. package/dist/src/eval-core/verdict.d.ts.map +1 -1
  117. package/dist/src/eval-core/verdict.js +2 -2
  118. package/dist/src/eval-workflows/batch-evaluation-workflow.d.ts +15 -2
  119. package/dist/src/eval-workflows/batch-evaluation-workflow.d.ts.map +1 -1
  120. package/dist/src/eval-workflows/batch-evaluation-workflow.js +13 -2
  121. package/dist/src/eval-workflows/batch-evaluation-workflow.js.map +1 -1
  122. package/dist/src/eval-workflows/evaluation-pipeline.d.ts +6 -3
  123. package/dist/src/eval-workflows/evaluation-pipeline.d.ts.map +1 -1
  124. package/dist/src/eval-workflows/evaluation-pipeline.js +10 -9
  125. package/dist/src/eval-workflows/evaluation-pipeline.js.map +1 -1
  126. package/dist/src/eval-workflows/run-evaluation.d.ts +1 -1
  127. package/dist/src/eval-workflows/run-evaluation.d.ts.map +1 -1
  128. package/dist/src/eval-workflows/run-evaluation.js +13 -6
  129. package/dist/src/eval-workflows/run-evaluation.js.map +1 -1
  130. package/dist/src/executors/script.d.ts.map +1 -1
  131. package/dist/src/executors/script.js +16 -3
  132. package/dist/src/executors/script.js.map +1 -1
  133. package/dist/src/grading/debias-validate.d.ts +2 -2
  134. package/dist/src/grading/debias-validate.js +2 -2
  135. package/dist/src/grading/gold-cli.d.ts +2 -5
  136. package/dist/src/grading/gold-cli.d.ts.map +1 -1
  137. package/dist/src/grading/gold-cli.js +4 -8
  138. package/dist/src/grading/gold-cli.js.map +1 -1
  139. package/dist/src/grading/judge.d.ts +1 -1
  140. package/dist/src/renderer/html-renderer.js +1 -1
  141. package/dist/src/renderer/layout.js +5 -5
  142. package/dist/src/renderer/layout.js.map +1 -1
  143. package/dist/src/renderer/skill-health-renderer.d.ts +1 -1
  144. package/dist/src/renderer/skill-health-renderer.js +1 -1
  145. package/dist/src/renderer/summary.js +8 -8
  146. package/dist/src/server/report-server.d.ts.map +1 -1
  147. package/dist/src/server/report-server.js +8 -7
  148. package/dist/src/server/report-server.js.map +1 -1
  149. package/dist/src/types/doctor.d.ts +3 -3
  150. package/dist/src/types/eval.d.ts +1 -1
  151. package/dist/src/types/report.d.ts +1 -1
  152. package/package.json +1 -1
@@ -0,0 +1,115 @@
1
+ import { CliExit } from '../cli-exit.js';
2
+ import { resolve, join } from 'node:path';
3
+ import { existsSync } from 'node:fs';
4
+ import { tCli, langFromArgv } from '../i18n.js';
5
+ import { COMMON_OPTIONS } from '../parse-run-config.js';
6
+ import { parseArgsStrictOrExit } from '../parse-strict.js';
7
+ import { makeOnProgress } from '../progress.js';
8
+ export async function execute(argv) {
9
+ const lang = langFromArgv(argv);
10
+ const { values, positionals } = parseArgsStrictOrExit({
11
+ args: argv,
12
+ options: {
13
+ ...COMMON_OPTIONS,
14
+ rounds: { type: 'string', default: '5' },
15
+ target: { type: 'string' },
16
+ samples: { type: 'string', default: 'eval-samples.json' },
17
+ model: { type: 'string', default: 'sonnet' },
18
+ 'judge-models': { type: 'string', default: 'claude:haiku' },
19
+ 'improve-model': { type: 'string', default: 'sonnet' },
20
+ concurrency: { type: 'string', default: '1' },
21
+ timeout: { type: 'string', default: '120' },
22
+ executor: { type: 'string', default: 'claude' },
23
+ 'skip-connectivity': { type: 'boolean', default: false },
24
+ },
25
+ allowPositionals: true,
26
+ });
27
+ // skill path 走 parseArgs 的 positionals,避免 raw argv.find 把 flag value
28
+ // 当成 path 误识别,例如 `improve skill --judge-models openai-api:gpt-4o foo.md`。
29
+ const skillPath = positionals[0];
30
+ if (!skillPath) {
31
+ console.error(tCli('cli.evolve.specify_skill_path', lang));
32
+ throw new CliExit(1);
33
+ }
34
+ let samplesFile = values.samples ?? 'eval-samples.json';
35
+ if (samplesFile === 'eval-samples.json' && !existsSync(resolve(samplesFile))) {
36
+ if (existsSync(resolve('eval-samples.yaml')))
37
+ samplesFile = 'eval-samples.yaml';
38
+ else if (existsSync(resolve('eval-samples.yml')))
39
+ samplesFile = 'eval-samples.yml';
40
+ }
41
+ const { evolveSkill } = await import('../../authoring/evolver.js');
42
+ const { parseJudgeModelsArgOrExit } = await import('../parse-run-config.js');
43
+ const evolveJudges = parseJudgeModelsArgOrExit(values['judge-models']);
44
+ if (evolveJudges.length > 1) {
45
+ console.error(tCli('cli.common.judge_models_single_only', lang, { cmd: 'improve skill' }));
46
+ throw new CliExit(2);
47
+ }
48
+ process.stderr.write(tCli('cli.evolve.section_header', lang, { path: skillPath }));
49
+ try {
50
+ const result = await evolveSkill({
51
+ skillPath: resolve(skillPath),
52
+ samplesPath: resolve(samplesFile),
53
+ rounds: Math.max(1, Number(values.rounds) || 5),
54
+ target: values.target ? Number(values.target) : null,
55
+ model: values.model,
56
+ judgeModels: evolveJudges,
57
+ improveModel: values['improve-model'],
58
+ executorName: values.executor,
59
+ concurrency: Math.max(1, Number(values.concurrency) || 1),
60
+ timeoutMs: Math.max(1, Number(values.timeout) || 120) * 1000,
61
+ skipConnectivity: values['skip-connectivity'],
62
+ onProgress: makeOnProgress(lang),
63
+ onRoundProgress({ round, totalRounds: _totalRounds, phase, score, delta, accepted, costUSD, costReported, error }) {
64
+ // costReported=false 时显示「—」而不是 $0.0000(executor 不报 cost,如 codex)。
65
+ // 缺位 / true 当 reported 走旧格式。
66
+ const fmtRoundCost = (c, r) => r ? `$${c.toFixed(4)}` : '—';
67
+ if (phase === 'baseline') {
68
+ process.stderr.write(tCli('cli.evolve.round_baseline', lang, {
69
+ score: score.toFixed(2), cost: fmtRoundCost(costUSD, costReported !== false),
70
+ }));
71
+ }
72
+ else if (phase === 'error') {
73
+ process.stderr.write(tCli('cli.evolve.round_error', lang, {
74
+ round, error: String(error ?? ''),
75
+ }));
76
+ }
77
+ else if (phase === 'done') {
78
+ const delta_ = delta >= 0 ? `+${delta.toFixed(2)}` : delta.toFixed(2);
79
+ const status = accepted ? '✓ ACCEPT' : '✗ REJECT';
80
+ process.stderr.write(tCli('cli.evolve.round_done', lang, {
81
+ round, score: score.toFixed(2), delta: delta_, status, cost: fmtRoundCost(costUSD, costReported !== false),
82
+ }));
83
+ }
84
+ },
85
+ });
86
+ const improvement = result.startScore > 0
87
+ ? ((result.finalScore - result.startScore) / result.startScore * 100).toFixed(1)
88
+ : '0';
89
+ const totalCostStr = result.costReported === false
90
+ ? '—' // 任一轮的 executor 不报 cost → totalCostUSD 是 lower-bound
91
+ : `$${result.totalCostUSD.toFixed(4)}`;
92
+ process.stderr.write(tCli('cli.evolve.summary', lang, {
93
+ start: result.startScore.toFixed(2), final: result.finalScore.toFixed(2),
94
+ percent: improvement, rounds: result.totalRounds, cost: totalCostStr,
95
+ }));
96
+ process.stderr.write(tCli('cli.evolve.best_path', lang, {
97
+ best: result.bestSkillPath, target: resolve(skillPath),
98
+ }));
99
+ process.stderr.write(tCli('cli.evolve.versions_saved', lang, {
100
+ dir: join(resolve(skillPath, '..'), 'evolve'),
101
+ }));
102
+ if (result.reportId) {
103
+ process.stderr.write(tCli('cli.evolve.report_link', lang, { id: result.reportId }));
104
+ }
105
+ console.log(JSON.stringify(result, null, 2));
106
+ }
107
+ catch (err) {
108
+ // CliExit 是显式 exit 信号,保持原 code 透传(同 gate / run)。
109
+ if (err instanceof CliExit)
110
+ throw err;
111
+ console.error(tCli('cli.common.error_prefix', lang, { message: err.message }));
112
+ throw new CliExit(1);
113
+ }
114
+ }
115
+ //# sourceMappingURL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,CAAC;YACpB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,wBAAwB,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QACtF,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,iDAAiD;QACjD,IAAI,GAAG,YAAY,OAAO;YAAE,MAAM,GAAG,CAAC;QACtC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,yBAAyB,EAAE,IAAI,EAAE,EAAE,OAAO,EAAG,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC1F,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function execute(argv: string[]): Promise<void>;
2
+ //# sourceMappingURL=improve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"improve.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/improve.ts"],"names":[],"mappings":"AAOA,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAgC3D"}
@@ -0,0 +1,34 @@
1
+ import { CliExit } from '../cli-exit.js';
2
+ import { tCli, langFromArgv } from '../i18n.js';
3
+ import { execute as failures } from './improve-failures.js';
4
+ import { execute as plan } from './improve-plan.js';
5
+ import { execute as samples } from './improve-samples.js';
6
+ import { execute as skill } from './improve-skill.js';
7
+ export async function execute(argv) {
8
+ const lang = langFromArgv(argv);
9
+ const [sub, ...rest] = argv;
10
+ if (!sub) {
11
+ console.log(tCli('cli.help.improve', lang).trim());
12
+ throw new CliExit(1);
13
+ }
14
+ if (sub === 'samples') {
15
+ await samples(rest);
16
+ return;
17
+ }
18
+ if (sub === 'skill') {
19
+ await skill(rest);
20
+ return;
21
+ }
22
+ if (sub === 'plan') {
23
+ await plan(rest);
24
+ return;
25
+ }
26
+ if (sub === 'failures') {
27
+ await failures(rest);
28
+ return;
29
+ }
30
+ // Bare `omk improve <report-id>` is the common path: produce a repair plan
31
+ // from the finished report without forcing users to remember `plan`.
32
+ await plan([sub, ...rest]);
33
+ }
34
+ //# sourceMappingURL=improve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"improve.js","sourceRoot":"","sources":["../../../../src/cli/commands/improve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAc;IAC1C,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAE5B,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACnD,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QACpB,OAAO;IACT,CAAC;IAED,IAAI,GAAG,KAAK,OAAO,EAAE,CAAC;QACpB,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO;IACT,CAAC;IAED,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;QACnB,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,OAAO;IACT,CAAC;IAED,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;QACvB,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IAED,2EAA2E;IAC3E,qEAAqE;IACrE,MAAM,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function execute(argv: string[]): Promise<void>;
2
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAsFA,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA4B3D"}
@@ -0,0 +1,110 @@
1
+ import { resolve, join } from 'node:path';
2
+ import { tCli, langFromArgv } from '../i18n.js';
3
+ import { COMMON_OPTIONS } from '../parse-run-config.js';
4
+ import { parseArgsStrictOrExit } from '../parse-strict.js';
5
+ const INIT_SAMPLES = `[
6
+ {
7
+ "sample_id": "s001",
8
+ "prompt": "审查以下代码",
9
+ "context": "function authenticate(username, password) {\\n const query = \`SELECT * FROM users WHERE name='\${username}' AND pass='\${password}'\`;\\n return db.execute(query);\\n}",
10
+ "rubric": "应识别 SQL 注入风险,建议使用参数化查询",
11
+ "assertions": [
12
+ { "type": "contains", "value": "SQL", "weight": 1 },
13
+ { "type": "contains", "value": "injection", "weight": 1 },
14
+ { "type": "regex", "pattern": "parameterized|prepared|placeholder|bind", "flags": "i", "weight": 0.5 },
15
+ { "type": "not_contains", "value": "looks good", "weight": 0.5 }
16
+ ],
17
+ "dimensions": {
18
+ "security": "是否准确识别出 SQL 注入漏洞并说明其危害",
19
+ "actionability": "是否给出可直接使用的参数化查询修复代码"
20
+ }
21
+ },
22
+ {
23
+ "sample_id": "s002",
24
+ "prompt": "审查以下代码",
25
+ "context": "async function fetchData(url) {\\n const res = await fetch(url);\\n const data = await res.json();\\n return data;\\n}",
26
+ "rubric": "应指出缺少错误处理(网络异常、非 JSON 响应、HTTP 错误状态码)",
27
+ "assertions": [
28
+ { "type": "contains", "value": "error handling", "weight": 1 },
29
+ { "type": "regex", "pattern": "try[\\\\s\\\\S]*catch|exception|error", "flags": "i", "weight": 1 },
30
+ { "type": "contains", "value": "status", "weight": 0.5 }
31
+ ],
32
+ "dimensions": {
33
+ "robustness": "是否指出了所有缺失的错误处理场景",
34
+ "actionability": "是否给出了完整的 try-catch 修复代码"
35
+ }
36
+ },
37
+ {
38
+ "sample_id": "s003",
39
+ "prompt": "审查以下代码",
40
+ "context": "function renderComment(comment) {\\n document.getElementById('output').innerHTML = '<p>' + comment + '</p>';\\n}",
41
+ "rubric": "应识别 XSS 风险,建议使用 textContent 或转义 HTML",
42
+ "assertions": [
43
+ { "type": "contains", "value": "XSS", "weight": 1 },
44
+ { "type": "regex", "pattern": "textContent|escape|sanitize|sanitizer", "flags": "i", "weight": 1 },
45
+ { "type": "contains", "value": "innerHTML", "weight": 0.5 }
46
+ ],
47
+ "dimensions": {
48
+ "security": "是否准确识别出 XSS 漏洞并说明攻击方式",
49
+ "actionability": "是否给出使用 textContent 或转义的修复代码"
50
+ }
51
+ }
52
+ ]
53
+ `;
54
+ // 模板带 Claude Code SKILL.md 兼容 frontmatter(name + description),让用户
55
+ // 可以把 init 出来的 SKILL.md 直接 deploy 到 ~/.claude/skills/ 给 Claude Code 用,
56
+ // 一份文件双向 dogfood(omk 评测 + Claude 部署)。omk 当前不 strip frontmatter,
57
+ // 它会跟着 leak 进 system prompt — 在 model 行为层面是无害噪声,跨 executor 一致。
58
+ const INIT_SKILL_V1 = `---
59
+ name: code-review-v1
60
+ description: 简单代码审查 skill,识别明显问题
61
+ ---
62
+
63
+ # Code review v1
64
+
65
+ 你是一个代码审查助手。请审查用户提供的代码,指出潜在问题。
66
+ `;
67
+ const INIT_SKILL_V2 = `---
68
+ name: code-review-v2
69
+ description: 多维度代码审查,覆盖安全 / 健壮 / 可维护 / 性能,带严重程度标注
70
+ ---
71
+
72
+ # Code review v2
73
+
74
+ 你是一个高级代码审查专家。请从以下维度审查用户提供的代码:
75
+
76
+ 1. 安全性:是否存在注入、XSS、敏感信息泄露等风险
77
+ 2. 健壮性:是否有适当的错误处理和边界检查
78
+ 3. 可维护性:命名是否清晰、结构是否合理
79
+ 4. 性能:是否存在明显的性能瓶颈
80
+
81
+ 对每个维度给出具体的改进建议,并标注严重程度(高/中/低)。
82
+ `;
83
+ export async function execute(argv) {
84
+ const lang = langFromArgv(argv);
85
+ // 走 helper 让未知 option fail-fast(e.g. `omk init --bogus`),
86
+ // 否则 argv[0] 直接当目录名, --bogus / --lang 都会被当成 dir 写文件。
87
+ const { positionals } = parseArgsStrictOrExit({
88
+ args: argv,
89
+ allowPositionals: true,
90
+ options: { ...COMMON_OPTIONS },
91
+ });
92
+ const targetDir = resolve(positionals[0] || '.');
93
+ const { writeFileSync, mkdirSync } = await import('node:fs');
94
+ // omk skill loader 把 `skills/<name>/SKILL.md` 子目录识别为 directory-skill,
95
+ // cwd 默认锚到 skill 根目录,后续可在同目录下放 assets / 子文档。
96
+ // 子目录主题化命名(code-review-v1 / code-review-v2)比泛 v1.md / v2.md 心智模型更清晰。
97
+ mkdirSync(join(targetDir, 'skills', 'code-review-v1'), { recursive: true });
98
+ mkdirSync(join(targetDir, 'skills', 'code-review-v2'), { recursive: true });
99
+ writeFileSync(join(targetDir, 'eval-samples.json'), INIT_SAMPLES);
100
+ writeFileSync(join(targetDir, 'skills', 'code-review-v1', 'SKILL.md'), INIT_SKILL_V1);
101
+ writeFileSync(join(targetDir, 'skills', 'code-review-v2', 'SKILL.md'), INIT_SKILL_V2);
102
+ console.log(tCli('cli.init.scaffolded', lang, { dir: targetDir }));
103
+ console.log('');
104
+ console.log(tCli('cli.init.next_steps_title', lang));
105
+ console.log(tCli('cli.init.next_step_edit_samples', lang));
106
+ console.log(tCli('cli.init.next_step_edit_skills', lang));
107
+ console.log(tCli('cli.init.next_step_run', lang));
108
+ console.log(tCli('cli.init.note_codex_executor', lang));
109
+ }
110
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDpB,CAAC;AAEF,kEAAkE;AAClE,uEAAuE;AACvE,gEAAgE;AAChE,+DAA+D;AAC/D,MAAM,aAAa,GAAG;;;;;;;;CAQrB,CAAC;AAEF,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;CAerB,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAc;IAC1C,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAChC,0DAA0D;IAC1D,qDAAqD;IACrD,MAAM,EAAE,WAAW,EAAE,GAAG,qBAAqB,CAAC;QAC5C,IAAI,EAAE,IAAI;QACV,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE,EAAE,GAAG,cAAc,EAAE;KAC/B,CAAC,CAAC;IACH,MAAM,SAAS,GAAW,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;IACzD,MAAM,EAAE,aAAa,EAAE,S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@@
1
+ export declare function execute(argv: string[]): Promise<void>;
2
+ //# sourceMappingURL=observe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observe.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/observe.ts"],"names":[],"mappings":"AAOA,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA0E3D"}
@@ -0,0 +1,77 @@
1
+ import { CliExit } from '../cli-exit.js';
2
+ import { resolve, join } from 'node:path';
3
+ import { tCli, langFromArgv } from '../i18n.js';
4
+ import { COMMON_OPTIONS } from '../parse-run-config.js';
5
+ import { parseArgsStrictOrExit } from '../parse-strict.js';
6
+ import { parseLastWindow } from './_shared.js';
7
+ export async function execute(argv) {
8
+ const lang = langFromArgv(argv);
9
+ const { values: rawValues, positionals } = parseArgsStrictOrExit({
10
+ args: argv,
11
+ allowPositionals: true,
12
+ options: {
13
+ ...COMMON_OPTIONS,
14
+ kb: { type: 'string' },
15
+ last: { type: 'string' },
16
+ from: { type: 'string' },
17
+ to: { type: 'string' },
18
+ skills: { type: 'string' },
19
+ 'output-dir': { type: 'string' },
20
+ },
21
+ });
22
+ // 该 handler options 全是 string-typed (无 boolean), 收紧 cast 让 caller 直接 use values.xxx 当 string 用。
23
+ const values = rawValues;
24
+ const dir = positionals[0];
25
+ if (!dir) {
26
+ console.error(tCli('cli.help.observe', lang).trim());
27
+ throw new CliExit(1);
28
+ }
29
+ const tracePath = resolve(dir);
30
+ const { existsSync, mkdirSync, writeFileSync } = await import('node:fs');
31
+ if (!existsSync(tracePath)) {
32
+ console.error(`Trace path does not exist: ${tracePath}`);
33
+ throw new CliExit(1);
34
+ }
35
+ // 时间窗: --from/--to 优先, --last fallback
36
+ let from = values.from;
37
+ if (!from && values.last) {
38
+ const inferred = parseLastWindow(values.last);
39
+ if (!inferred) {
40
+ console.error(`Invalid --last format: "${values.last}". Expected e.g. "7d" / "24h" / "30m".`);
41
+ throw new CliExit(1);
42
+ }
43
+ from = inferred;
44
+ }
45
+ const to = values.to;
46
+ const skills = values.skills ? values.skills.split(',').map((s) => s.trim()).filter(Boolean) : undefined;
47
+ console.log(`[omk] analyzing ${tracePath}...`);
48
+ const { computeSkillHealthReport } = await import('../../observability/skill-health-analyzer.js');
49
+ const report = computeSkillHealthReport(tracePath, {
50
+ kbRoot: values.kb ? resolve(values.kb) : undefined,
51
+ from,
52
+ to,
53
+ skills,
54
+ });
55
+ // JSON 是主产物;HTML 由 report server 的 /analyses/:id 按需渲染。
56
+ const outDir = resolve(values['output-dir'] || join(process.env.HOME || '.', '.oh-my-knowledge', 'analyses'));
57
+ mkdirSync(outDir, { recursive: true });
58
+ const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
59
+ const jsonPath = join(outDir, `${timestamp}-skill-health.json`);
60
+ writeFileSync(jsonPath, JSON.stringify(report, null, 2));
61
+ // 控制台摘要
62
+ const { sessionCount, segmentCount, toolCallCount, toolFailureRate } = report.meta;
63
+ console.log('');
64
+ console.log(`sessions: ${sessionCount} · segments: ${segmentCount} · tool calls: ${toolCallCount} · fail rate: ${(toolFailureRate * 100).toFixed(1)}%`);
65
+ console.log(`overall: gapRate ${(report.overall.gapRate * 100).toFixed(1)}% · weightedGapRate ${(report.overall.weightedGapRate * 100).toFixed(1)}% · health: ${report.overall.healthBand}`);
66
+ console.log('');
67
+ const skillRows = Object.values(report.bySkill)
68
+ .sort((a, b) => b.segmentCount - a.segmentCount)
69
+ .slice(0, 10)
70
+ .map((s) => ` ${s.skillName.padEnd(24)} segs=${String(s.segmentCount).padStart(4)} gapRate=${String(Math.round(s.gap.gapRate * 100) + '%').padStart(4)} weighted=${String(Math.round(s.gap.weightedGapRate * 100) + '%').padStart(4)}${s.coverage ? ` cov=${Math.round(s.coverage.fileCoverageRate * 100)}%` : ''}`);
71
+ console.log('top skills:');
72
+ console.log(skillRows.join('\n'));
73
+ console.log('');
74
+ console.log(`report written to: ${jsonPath}`);
75
+ console.log(tCli('cli.observe.view_hint', lang));
76
+ }
77
+ //# sourceMappingURL=observe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observe.js","sourceRoot":"","sources":["../../../../src/cli/commands/observe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAc;IAC1C,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,qBAAqB,CAAC;QAC/D,IAAI,EAAE,IAAI;QACV,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE;YACP,GAAG,cAAc;YACjB,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACtB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACxB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACxB,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACtB,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SACjC;KACF,CAAC,CAAC;IACH,gGAAgG;IAChG,MAAM,MAAM,GAAG,SAA+C,CAAC;IAC/D,MAAM,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IAC3B,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,CAAC,KAAK,CAAC,IAA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C,IAAI,CAAC,CAAC,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,sBAAsB,QAAQ,EAAE,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC,CAAC;AACnD,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { CliMessageKey } from '../i18n-dict.js';
2
+ export interface CommandModule {
3
+ /** i18n key,dispatcher 收到 --help / -h 时打印此 key 的内容并 exit 0。 */
4
+ helpKey: CliMessageKey;
5
+ /** 二级子命令 help。用于 `omk eval gold --help` 这类产品子路径。 */
6
+ subHelp?: Record<string, CliMessageKey>;
7
+ execute: (argv: string[]) => Promise<void>;
8
+ }
9
+ /** 产品级主命令查表。新增对外命令时,在这里加一行就够。 */
10
+ export declare const PRODUCT_COMMANDS: Record<string, CommandModule>;
11
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AASrD,MAAM,WAAW,aAAa;IAC5B,+DAA+D;IAC/D,OAAO,EAAE,aAAa,CAAC;IACvB,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACxC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AAED,iCAAiC;AACjC,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAgC1D,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { execute as doctor } from './doctor.js';
2
+ import { execute as evalCommand } from './eval.js';
3
+ import { execute as exportCommand } from './export.js';
4
+ import { execute as improve } from './improve.js';
5
+ import { execute as init } from './init.js';
6
+ import { execute as observe } from './observe.js';
7
+ import { execute as studio } from './studio.js';
8
+ /** 产品级主命令查表。新增对外命令时,在这里加一行就够。 */
9
+ export const PRODUCT_COMMANDS = {
10
+ init: { helpKey: 'cli.help.init_usage', execute: init },
11
+ doctor: { helpKey: 'cli.help.doctor_usage', execute: doctor },
12
+ eval: {
13
+ helpKey: 'cli.help.eval',
14
+ subHelp: {
15
+ gold: 'cli.help.eval_gold',
16
+ debias: 'cli.help.eval_debias',
17
+ },
18
+ execute: evalCommand,
19
+ },
20
+ observe: { helpKey: 'cli.help.observe', execute: observe },
21
+ improve: {
22
+ helpKey: 'cli.help.improve',
23
+ subHelp: {
24
+ plan: 'cli.help.improve_plan',
25
+ failures: 'cli.help.improve_failures',
26
+ samples: 'cli.help.improve_samples',
27
+ skill: 'cli.help.improve_skill',
28
+ },
29
+ execute: improve,
30
+ },
31
+ export: {
32
+ helpKey: 'cli.help.export',
33
+ subHelp: {
34
+ diff: 'cli.help.export_diff',
35
+ verdict: 'cli.help.export_verdict',
36
+ saturation: 'cli.help.export_saturation',
37
+ },
38
+ execute: exportCommand,
39
+ },
40
+ studio: { helpKey: 'cli.help.studio', execute: studio },
41
+ };
42
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/cli/commands/registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAUhD,iCAAiC;AACjC,MAAM,CAAC,MAAM,gBAAgB,GAAkC;IAC7D,IAAI,EAAK,EAAE,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,IAAI,EAAE;IAC1D,MAAM,EAAG,EAAE,OAAO,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,EAAE;IAC9D,IAAI,EAAK;QACP,OAAO,EAAE,eAAe;QACxB,OAAO,EAAE;YACP,IAAI,EAAE,oBAAoB;YAC1B,MAAM,EAAE,sBAAsB;SAC/B;QACD,OAAO,EAAE,WAAW;KACrB;IACD,OAAO,EAAE,EAAE,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,OAAO,EAAE;IAC1D,OAAO,EAAE;QACP,OAAO,EAAE,kBAAkB;QAC3B,OAAO,EAAE;YACP,IAAI,EAAE,uBAAuB;YAC7B,QAAQ,EAAE,2BAA2B;YACrC,OAAO,EAAE,0BAA0B;YACnC,KAAK,EAAE,wBAAwB;SAChC;QACD,OAAO,EAAE,OAAO;KACjB;IACD,MAAM,EAAG;QACP,OAAO,EAAE,iBAAiB;QAC1B,OAAO,EAAE;YACP,IAAI,EAAE,sBAAsB;YAC5B,OAAO,EAAE,yBAAyB;YAClC,UAAU,EAAE,4BAA4B;SACzC;QACD,OAAO,EAAE,aAAa;KACvB;IACD,MAAM,EAAG,EAAE,OAAO,EAAE,iBAAiB,EAAG,OAAO,EAAE,MAAM,EAAE;CAC1D,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function execute(argv: string[]): Promise<void>;
2
+ //# sourceMappingURL=studio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"studio.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/studio.ts"],"names":[],"mappings":"AA0BA,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAqD3D"}
@@ -0,0 +1,76 @@
1
+ import { resolve } from 'node:path';
2
+ import { langFromArgv, tCli } from '../i18n.js';
3
+ import { COMMON_OPTIONS, DEFAULT_REPORTS_DIR } from '../parse-run-config.js';
4
+ import { parseArgsStrictOrExit } from '../parse-strict.js';
5
+ async function openWorkbench(url, lang) {
6
+ const { execFile } = await import('node:child_process');
7
+ const { platform } = await import('node:os');
8
+ const browser = process.env.BROWSER?.trim();
9
+ if (browser?.toLowerCase() === 'none')
10
+ return;
11
+ const os = platform();
12
+ const command = browser || (os === 'win32' ? 'cmd' : os === 'darwin' ? 'open' : 'xdg-open');
13
+ const args = os === 'win32' && !browser
14
+ ? ['/c', 'start', '', url]
15
+ : [url];
16
+ execFile(command, args, (err) => {
17
+ if (!err)
18
+ return;
19
+ process.stderr.write(tCli('cli.studio.open_failed', lang, {
20
+ command,
21
+ message: err.message,
22
+ }));
23
+ });
24
+ }
25
+ export async function execute(argv) {
26
+ const lang = langFromArgv(argv);
27
+ const { values } = parseArgsStrictOrExit({
28
+ args: argv,
29
+ options: {
30
+ ...COMMON_OPTIONS,
31
+ port: { type: 'string', default: '7799' },
32
+ 'reports-dir': { type: 'string', default: DEFAULT_REPORTS_DIR },
33
+ 'analyses-dir': { type: 'string' },
34
+ 'no-open': { type: 'boolean', default: false },
35
+ dev: { type: 'boolean', default: false },
36
+ },
37
+ });
38
+ if (values.dev && !process.env.__OMK_DEV_CHILD) {
39
+ const { spawn } = await import('node:child_process');
40
+ const { fileURLToPath } = await import('node:url');
41
+ const cliPath = resolve(fileURLToPath(import.meta.url), '..', '..', 'index.js');
42
+ const watchRoot = resolve(cliPath, '..', '..');
43
+ const args = [
44
+ '--watch-path', watchRoot,
45
+ cliPath,
46
+ 'studio',
47
+ '--port', values.port,
48
+ '--reports-dir', values['reports-dir'],
49
+ ];
50
+ if (values['analyses-dir']) {
51
+ args.push('--analyses-dir', values['analyses-dir']);
52
+ }
53
+ if (values['no-open']) {
54
+ args.push('--no-open');
55
+ }
56
+ const child = spawn(process.execPath, args, {
57
+ stdio: 'inherit',
58
+ env: { ...process.env, __OMK_DEV_CHILD: '1' },
59
+ });
60
+ child.on('exit', (code) => process.exit(code || 0));
61
+ return;
62
+ }
63
+ const { createReportServer } = await import('../../server/report-server.js');
64
+ const server = createReportServer({
65
+ port: Number(values.port),
66
+ reportsDir: resolve(values['reports-dir']),
67
+ ...(values['analyses-dir'] ? { analysesDir: resolve(values['analyses-dir']) } : {}),
68
+ });
69
+ const url = await server.start();
70
+ console.log(tCli('cli.studio.started', lang, { url }));
71
+ console.log(tCli('cli.studio.stop_hint', lang));
72
+ if (!values['no-open'] && process.stdout.isTTY) {
73
+ await openWorkbench(url, lang);
74
+ }
75
+ }
76
+ //# sourceMappingURL=studio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"studio.js","sourceRoot":"","sources":["../../../../src/cli/commands/studio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAgB,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,KAAK,UAAU,aAAa,CAAC,GAAW,EAAE,IAAa;IACrD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACxD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC;IAC5C,IAAI,OAAO,EAAE,WAAW,EAAE,KAAK,MAAM;QAAE,OAAO;IAE9C,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAC;IACtB,MAAM,OAAO,GAAG,OAAO,IAAI,CAAC,EAAE,KAAK,OAAO,CAAC,C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,kBAAkB,CAAC;QAC9C,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QACzB,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,CAAW,CAAC;QACpD,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,CAAW,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9F,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,CAAC,CAAC;IAChD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAC/C,MAAM,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;AACH,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * CLI rendering of Sample design science coverage block for `bench diagnose`.
2
+ * CLI rendering of Sample design science coverage block for `omk improve`.
3
3
  *
4
4
  * Two data sources:
5
5
  * 1. samples (loaded fresh from eval-samples file) — preferred, always up-to-date
@@ -1,5 +1,5 @@
1
1
  /**
2
- * CLI rendering of Sample design science coverage block for `bench diagnose`.
2
+ * CLI rendering of Sample design science coverage block for `omk improve`.
3
3
  *
4
4
  * Two data sources:
5
5
  * 1. samples (loaded fresh from eval-samples file) — preferred, always up-to-date
@@ -16,9 +16,9 @@
16
16
  * 2. **保留原文的白名单 (产品术语 / 命令 / 文件名)**
17
17
  * 以下 token 在两种语言里都保留原文, 不翻译:
18
18
  * - 产品名: omk, oh-my-knowledge, Claude, npm
19
- * - 子命令空间和命令名: bench, analyze, run, report, init, evolve, gold,
20
- * diff, ci, gen-samples, debias-validate, saturation, verdict,
21
- * diagnose, failures
19
+ * - 子命令空间和命令名: init, doctor, eval, observe, improve, export,
20
+ * studio, samples, skill, plan, failures, gold, debias, diff, verdict,
21
+ * saturation
22
22
  * - omk 核心业务术语: skill, variant, sample, judge, executor (出现在产品
23
23
  * UI 里时首字母可大写如 "Skill 评测", 描述句中保持小写)
24
24
  * - 技术参数: --lang, --control, --treatment, --bootstrap, --judge-repeat,
@@ -47,7 +47,7 @@
47
47
  * 未来扩 Lang (zh-TW / ja / ko ...): 改 src/types/shared.ts 的 Lang union,
48
48
  * Record 类型自动强制每 key 加新语言版本。
49
49
  */
50
- export type CliMessageKey = 'cli.common.lang_invalid_silent' | 'cli.common.help_hint' | 'cli.common.unknown_domain' | 'cli.common.unknown_bench_command' | 'cli.init.scaffolded' | 'cli.init.next_steps_title' | 'cli.init.next_step_edit_samples' | 'cli.init.next_step_edit_skills' | 'cli.init.next_step_run' | 'cli.init.note_codex_executor' | 'cli.update.new_version_available' | 'cli.progress.preflight_starting' | 'cli.progress.sample_retry' | 'cli.progress.sample_error' | 'cli.progress.sample_executing' | 'cli.progress.sample_exec_done' | 'cli.progress.output_preview' | 'cli.progress.judging' | 'cli.progress.judged' | 'cli.progress.skipped' | 'cli.progress.sample_done' | 'cli.progress.sample_failed_done' | 'cli.run.invalid_repeat' | 'cli.run.invalid_judge_repeat' | 'cli.run.no_debias_length_active' | 'cli.run.invalid_bootstrap_samples' | 'cli.run.bootstrap_samples_too_large' | 'cli.run.skill_section' | 'cli.run.run_section' | 'cli.run.batch_complete' | 'cli.run.eval_complete' | 'cli.run.tally' | 'cli.run.report_saved' | 'cli.run.report_server_running' | 'cli.run.report_server_view' | 'cli.run.report_server_stop' | 'cli.run.no_serve_in_non_tty' | 'cli.run.no_serve_view_hint' | 'cli.run.gold_load_failed' | 'cli.run.gold_load_issue' | 'cli.run.contamination_warning' | 'cli.common.error_prefix' | 'cli.analyze.view_in_browser' | 'cli.common.skill_dir_not_found' | 'cli.common.skill_file_not_found' | 'cli.common.report_not_found' | 'cli.common.no_judge_model' | 'cli.common.judge_models_single_only' | 'cli.common.usage_gold_validate' | 'cli.common.warn_load_samples_failed' | 'cli.gen.skill_skipped_existing' | 'cli.gen.skill_generating' | 'cli.gen.skill_done' | 'cli.gen.skill_failed' | 'cli.gen.batch_none_needed' | 'cli.gen.batch_summary' | 'cli.gen.specify_skill_path' | 'cli.gen.samples_already_exists' | 'cli.gen.single_generating' | 'cli.gen.single_done' | 'cli.gen.review_hint' | 'cli.gen.failed' | 'cli.evolve.specify_skill_path' | 'cli.evolve.section_header' | 'cli.evolve.round_baseline' | 'cli.evolve.round_error' | 'cli.evolve.round_done' | 'cli.evolve.summary' | 'cli.evolve.best_path' | 'cli.evolve.versions_saved' | 'cli.evolve.report_link' | 'cli.gold.created_files' | 'cli.gold.next_step_edit_annotations' | 'cli.gold.validate_ok' | 'cli.debias.warn_cost_doubles' | 'cli.saturation.no_data' | 'cli.saturation.verdict_header' | 'cli.saturation.variant_no_trace' | 'cli.saturation.variant_label' | 'cli.saturation.checkpoints' | 'cli.saturation.last_point' | 'cli.saturation.persisted_verdict' | 'cli.saturation.persisted_verdict_saturated' | 'cli.saturation.persisted_verdict_unsaturated' | 'cli.saturation.skipped_too_few_points' | 'cli.help.main' | 'cli.help.diff_usage' | 'cli.help.analyze_usage' | 'cli.help.gold' | 'cli.help.debias_validate' | 'cli.help.saturation' | 'cli.help.verdict' | 'cli.help.diagnose' | 'cli.help.failures' | 'cli.diagnose.coverage_header' | 'cli.diagnose.coverage_unspecified' | 'cli.diagnose.coverage_chars' | 'cli.diagnose.coverage_hint_empty' | 'cli.diagnose.coverage_declared' | 'cli.doctor.rule.skill_readable' | 'cli.doctor.rule.skill_metadata' | 'cli.doctor.rule.dependencies' | 'cli.doctor.rule.samples_contract' | 'cli.doctor.skill_readable.pass' | 'cli.doctor.skill_metadata.pass' | 'cli.doctor.dependencies.pass' | 'cli.doctor.samples_contract.pass' | 'cli.doctor.skill_readable.fail.missing' | 'cli.doctor.skill_readable.fail.empty' | 'cli.doctor.skill_readable.fail.too_short' | 'cli.doctor.skill_readable.hint.missing' | 'cli.doctor.dependencies.hint.tool' | 'cli.doctor.dependencies.hint.file' | 'cli.doctor.dependencies.hint.env' | 'cli.doctor.dependencies.hint.preflight' | 'cli.doctor.dependencies.issue.tool_not_found' | 'cli.doctor.dependencies.issue.file_not_found' | 'cli.doctor.dependencies.issue.env_not_set' | 'cli.doctor.dependencies.issue.preflight_failed' | 'cli.doctor.skill_readable.hint.too_short' | 'cli.doctor.skill_metadata.fail.frontmatter_invalid' | 'cli.doctor.skill_metadata.fail.missing_skillmd' | 'cli.doctor.skill_metadata.hint.frontmatter' | 'cli.doctor.skill_metadata.hint.missing_skillmd' | 'cli.doctor.dependencies.fail' | 'cli.doctor.samples_contract.skipped' | 'cli.doctor.samples_contract.warn.empty' | 'cli.doctor.samples_contract.warn.missing_prompt' | 'cli.doctor.samples_contract.hint' | 'cli.help.doctor_usage' | 'cli.doctor.no_skill_found' | 'cli.doctor.gate_blocked' | 'cli.run.skip_connectivity_warning';
50
+ export type CliMessageKey = 'cli.common.unknown_domain' | 'cli.init.scaffolded' | 'cli.init.next_steps_title' | 'cli.init.next_step_edit_samples' | 'cli.init.next_step_edit_skills' | 'cli.init.next_step_run' | 'cli.init.note_codex_executor' | 'cli.update.new_version_available' | 'cli.progress.preflight_starting' | 'cli.progress.sample_retry' | 'cli.progress.sample_error' | 'cli.progress.sample_executing' | 'cli.progress.sample_exec_done' | 'cli.progress.output_preview' | 'cli.progress.judging' | 'cli.progress.judged' | 'cli.progress.skipped' | 'cli.progress.sample_done' | 'cli.progress.sample_failed_done' | 'cli.run.invalid_repeat' | 'cli.run.invalid_judge_repeat' | 'cli.run.no_debias_length_active' | 'cli.run.invalid_bootstrap_samples' | 'cli.run.bootstrap_samples_too_large' | 'cli.run.power_warning_tiny_n' | 'cli.run.power_warning_small_n' | 'cli.run.power_warning_repeat_one' | 'cli.run.dry_run_no_scores' | 'cli.run.skill_section' | 'cli.run.run_section' | 'cli.run.batch_complete' | 'cli.run.batch_verdict_header' | 'cli.run.batch_child_report_missing' | 'cli.run.eval_complete' | 'cli.run.tally' | 'cli.run.report_saved' | 'cli.run.report_only_gate_skipped' | 'cli.run.report_server_running' | 'cli.run.report_server_view' | 'cli.run.report_server_stop' | 'cli.run.no_serve_in_non_tty' | 'cli.run.no_serve_view_hint' | 'cli.run.gold_load_failed' | 'cli.run.gold_load_issue' | 'cli.run.contamination_warning' | 'cli.common.error_prefix' | 'cli.observe.view_hint' | 'cli.common.skill_dir_not_found' | 'cli.common.skill_file_not_found' | 'cli.common.report_not_found' | 'cli.common.no_judge_model' | 'cli.common.judge_models_single_only' | 'cli.common.warn_load_samples_failed' | 'cli.export.unsupported_format' | 'cli.export.html_done' | 'cli.export.done' | 'cli.studio.started' | 'cli.studio.stop_hint' | 'cli.studio.open_failed' | 'cli.gen.skill_skipped_existing' | 'cli.gen.skill_generating' | 'cli.gen.skill_done' | 'cli.gen.skill_failed' | 'cli.gen.batch_none_needed' | 'cli.gen.batch_summary' | 'cli.gen.specify_skill_path' | 'cli.gen.samples_already_exists' | 'cli.gen.single_generating' | 'cli.gen.single_done' | 'cli.gen.review_hint' | 'cli.gen.failed' | 'cli.evolve.specify_skill_path' | 'cli.evolve.section_header' | 'cli.evolve.round_baseline' | 'cli.evolve.round_error' | 'cli.evolve.round_done' | 'cli.evolve.summary' | 'cli.evolve.best_path' | 'cli.evolve.versions_saved' | 'cli.evolve.report_link' | 'cli.help.product_main' | 'cli.help.init_usage' | 'cli.help.eval' | 'cli.help.eval_gold' | 'cli.help.eval_debias' | 'cli.help.observe' | 'cli.help.improve' | 'cli.help.improve_plan' | 'cli.help.improve_failures' | 'cli.help.improve_samples' | 'cli.help.improve_skill' | 'cli.help.export' | 'cli.help.export_diff' | 'cli.help.export_verdict' | 'cli.help.export_saturation' | 'cli.help.studio' | 'cli.diagnose.coverage_header' | 'cli.diagnose.coverage_unspecified' | 'cli.diagnose.coverage_chars' | 'cli.diagnose.coverage_hint_empty' | 'cli.diagnose.coverage_declared' | 'cli.doctor.rule.skill_readable' | 'cli.doctor.rule.skill_metadata' | 'cli.doctor.rule.dependencies' | 'cli.doctor.rule.samples_contract' | 'cli.doctor.skill_readable.pass' | 'cli.doctor.skill_metadata.pass' | 'cli.doctor.dependencies.pass' | 'cli.doctor.samples_contract.pass' | 'cli.doctor.skill_readable.fail.missing' | 'cli.doctor.skill_readable.fail.empty' | 'cli.doctor.skill_readable.fail.too_short' | 'cli.doctor.skill_readable.hint.missing' | 'cli.doctor.dependencies.hint.tool' | 'cli.doctor.dependencies.hint.file' | 'cli.doctor.dependencies.hint.env' | 'cli.doctor.dependencies.hint.preflight' | 'cli.doctor.dependencies.issue.tool_not_found' | 'cli.doctor.dependencies.issue.file_not_found' | 'cli.doctor.dependencies.issue.env_not_set' | 'cli.doctor.dependencies.issue.preflight_failed' | 'cli.doctor.skill_readable.hint.too_short' | 'cli.doctor.skill_metadata.fail.frontmatter_invalid' | 'cli.doctor.skill_metadata.fail.missing_skillmd' | 'cli.doctor.skill_metadata.hint.frontmatter' | 'cli.doctor.skill_metadata.hint.missing_skillmd' | 'cli.doctor.dependencies.fail' | 'cli.doctor.samples_contract.skipped' | 'cli.doctor.samples_contract.warn.empty' | 'cli.doctor.samples_contract.warn.missing_prompt' | 'cli.doctor.samples_contract.hint' | 'cli.help.doctor_usage' | 'cli.doctor.no_skill_found' | 'cli.doctor.samples_detected' | 'cli.doctor.gate_blocked' | 'cli.run.skip_connectivity_warning';
51
51
  export interface CliMessage {
52
52
  zh: string;
53
53
  en: string;