oh-my-knowledge 0.32.0 → 0.34.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/README.md +29 -14
- package/README.zh.md +32 -17
- package/dist/analysis/coverage-analyzer.d.ts +0 -1
- package/dist/analysis/coverage-analyzer.js +0 -1
- package/dist/analysis/failure-clusterer.d.ts +0 -1
- package/dist/analysis/failure-clusterer.js +0 -1
- package/dist/analysis/gap-analyzer.d.ts +0 -1
- package/dist/analysis/gap-analyzer.js +0 -1
- package/dist/analysis/hedging-classifier.d.ts +0 -1
- package/dist/analysis/hedging-classifier.js +1 -2
- package/dist/analysis/report-diagnostics.d.ts +0 -1
- package/dist/analysis/report-diagnostics.js +0 -1
- package/dist/analysis/sample-diagnostics.d.ts +1 -2
- package/dist/analysis/sample-diagnostics.js +18 -19
- package/dist/analysis/saturation.d.ts +8 -1
- package/dist/analysis/saturation.js +12 -5
- package/dist/assets/agent-skills/omk/SKILL.md +197 -0
- package/dist/assets/agent-skills/omk/references/commands.md +547 -0
- package/dist/authoring/evolver.d.ts +169 -4
- package/dist/authoring/evolver.js +287 -15
- package/dist/authoring/generator.d.ts +29 -2
- package/dist/authoring/generator.js +113 -1
- package/dist/authoring/sample-fixer.d.ts +0 -1
- package/dist/authoring/sample-fixer.js +0 -1
- package/dist/cli/commands/doctor.d.ts +2 -1
- package/dist/cli/commands/doctor.js +24 -6
- package/dist/cli/commands/eval/gold/compare.d.ts +0 -1
- package/dist/cli/commands/eval/gold/compare.js +0 -1
- package/dist/cli/commands/eval/gold/index.d.ts +0 -1
- package/dist/cli/commands/eval/gold/index.js +0 -1
- package/dist/cli/commands/eval/gold/init.d.ts +0 -1
- package/dist/cli/commands/eval/gold/init.js +0 -1
- package/dist/cli/commands/eval/gold/validate.d.ts +0 -1
- package/dist/cli/commands/eval/gold/validate.js +0 -1
- package/dist/cli/commands/eval/index.d.ts +2 -1
- package/dist/cli/commands/eval/index.js +23 -11
- package/dist/cli/commands/evolve.d.ts +7 -1
- package/dist/cli/commands/evolve.js +93 -6
- package/dist/cli/commands/init.d.ts +0 -1
- package/dist/cli/commands/init.js +0 -1
- package/dist/cli/commands/install.d.ts +22 -0
- package/dist/cli/commands/install.js +411 -0
- package/dist/cli/commands/observe/inbox.d.ts +0 -1
- package/dist/cli/commands/observe/inbox.js +0 -1
- package/dist/cli/commands/observe/index.d.ts +0 -1
- package/dist/cli/commands/observe/index.js +6 -3
- package/dist/cli/commands/observe/ingest.d.ts +0 -1
- package/dist/cli/commands/observe/ingest.js +0 -1
- package/dist/cli/commands/observe/show.d.ts +0 -1
- package/dist/cli/commands/observe/show.js +0 -1
- package/dist/cli/commands/sample.d.ts +2 -1
- package/dist/cli/commands/sample.js +100 -9
- package/dist/cli/commands/studio.d.ts +0 -1
- package/dist/cli/commands/studio.js +0 -1
- package/dist/cli/index.d.ts +0 -1
- package/dist/cli/index.js +1 -2
- package/dist/cli/lib/cli-exit.d.ts +0 -1
- package/dist/cli/lib/cli-exit.js +0 -1
- package/dist/cli/lib/cmd-flags.d.ts +11 -1
- package/dist/cli/lib/cmd-flags.js +0 -1
- package/dist/cli/lib/i18n-dict/common.d.ts +1 -2
- package/dist/cli/lib/i18n-dict/common.js +18 -3
- package/dist/cli/lib/i18n-dict/evolve.d.ts +1 -2
- package/dist/cli/lib/i18n-dict/evolve.js +24 -1
- package/dist/cli/lib/i18n-dict/gen.d.ts +0 -1
- package/dist/cli/lib/i18n-dict/gen.js +0 -1
- package/dist/cli/lib/i18n-dict/help.d.ts +0 -1
- package/dist/cli/lib/i18n-dict/help.js +0 -1
- package/dist/cli/lib/i18n-dict/init.d.ts +0 -1
- package/dist/cli/lib/i18n-dict/init.js +0 -1
- package/dist/cli/lib/i18n-dict/install.d.ts +3 -0
- package/dist/cli/lib/i18n-dict/install.js +90 -0
- package/dist/cli/lib/i18n-dict/run.d.ts +0 -1
- package/dist/cli/lib/i18n-dict/run.js +0 -1
- package/dist/cli/lib/i18n-dict/types.d.ts +0 -1
- package/dist/cli/lib/i18n-dict/types.js +0 -1
- package/dist/cli/lib/i18n-dict.d.ts +2 -2
- package/dist/cli/lib/i18n-dict.js +2 -1
- package/dist/cli/lib/i18n.d.ts +0 -1
- package/dist/cli/lib/i18n.js +0 -1
- package/dist/cli/lib/parse-run-config/judge-models.d.ts +0 -1
- package/dist/cli/lib/parse-run-config/judge-models.js +0 -1
- package/dist/cli/lib/parse-run-config/samples-discovery.d.ts +0 -1
- package/dist/cli/lib/parse-run-config/samples-discovery.js +1 -4
- package/dist/cli/lib/parse-run-config/variant-resolution.d.ts +8 -4
- package/dist/cli/lib/parse-run-config/variant-resolution.js +46 -14
- package/dist/cli/lib/parse-run-config.d.ts +0 -1
- package/dist/cli/lib/parse-run-config.js +1 -2
- package/dist/cli/lib/progress.d.ts +0 -1
- package/dist/cli/lib/progress.js +0 -1
- package/dist/cli/lib/resolve-skill-input.d.ts +0 -1
- package/dist/cli/lib/resolve-skill-input.js +7 -6
- package/dist/cli/lib/run-tally.d.ts +0 -1
- package/dist/cli/lib/run-tally.js +1 -2
- package/dist/cli/lib/shared.d.ts +0 -1
- package/dist/cli/lib/shared.js +1 -2
- package/dist/cli/lib/update-check.d.ts +65 -1
- package/dist/cli/lib/update-check.js +220 -32
- package/dist/cli/lib/update-fetch-worker.d.ts +1 -0
- package/dist/cli/lib/update-fetch-worker.js +34 -0
- package/dist/cli/oclif/base-command.d.ts +0 -1
- package/dist/cli/oclif/base-command.js +0 -1
- package/dist/cli/oclif/help.d.ts +0 -1
- package/dist/cli/oclif/help.js +0 -1
- package/dist/cli/oclif/i18n.d.ts +0 -1
- package/dist/cli/oclif/i18n.js +0 -1
- package/dist/cli/oclif/parsers.d.ts +0 -1
- package/dist/cli/oclif/parsers.js +0 -1
- package/dist/cli/oclif/projection.d.ts +0 -1
- package/dist/cli/oclif/projection.js +0 -1
- package/dist/cli/oclif/run.d.ts +0 -1
- package/dist/cli/oclif/run.js +0 -1
- package/dist/diagnosis/observe-mapper.d.ts +2 -3
- package/dist/diagnosis/observe-mapper.js +6 -7
- package/dist/diagnosis/observe-producer.d.ts +0 -1
- package/dist/diagnosis/observe-producer.js +3 -4
- package/dist/diagnosis/studio-projection.d.ts +0 -1
- package/dist/diagnosis/studio-projection.js +0 -1
- package/dist/diagnosis/types.d.ts +0 -1
- package/dist/diagnosis/types.js +0 -1
- package/dist/doctor/fixer.d.ts +0 -1
- package/dist/doctor/fixer.js +0 -1
- package/dist/doctor/health/builtin-dimensions.d.ts +0 -1
- package/dist/doctor/health/builtin-dimensions.js +0 -1
- package/dist/doctor/health/composer.d.ts +0 -1
- package/dist/doctor/health/composer.js +1 -2
- package/dist/doctor/health/dimension-registry.d.ts +0 -1
- package/dist/doctor/health/dimension-registry.js +0 -1
- package/dist/doctor/health/dimension-spec.d.ts +0 -1
- package/dist/doctor/health/dimension-spec.js +0 -1
- package/dist/doctor/health/load-custom-dimensions.d.ts +1 -0
- package/dist/doctor/health/load-custom-dimensions.js +30 -0
- package/dist/doctor/health/parser.d.ts +0 -1
- package/dist/doctor/health/parser.js +0 -1
- package/dist/doctor/health/prompt-builder.d.ts +0 -1
- package/dist/doctor/health/prompt-builder.js +0 -1
- package/dist/doctor/health/register.d.ts +0 -1
- package/dist/doctor/health/register.js +0 -1
- package/dist/doctor/index.d.ts +0 -1
- package/dist/doctor/index.js +1 -2
- package/dist/doctor/messages.d.ts +0 -1
- package/dist/doctor/messages.js +1 -2
- package/dist/doctor/preflight.d.ts +0 -1
- package/dist/doctor/preflight.js +0 -1
- package/dist/doctor/renderer.d.ts +0 -1
- package/dist/doctor/renderer.js +0 -1
- package/dist/doctor/rules.d.ts +0 -1
- package/dist/doctor/rules.js +0 -1
- package/dist/eval-core/bootstrap.d.ts +8 -1
- package/dist/eval-core/bootstrap.js +11 -4
- package/dist/eval-core/cache.d.ts +0 -1
- package/dist/eval-core/cache.js +0 -1
- package/dist/eval-core/comparability.d.ts +0 -1
- package/dist/eval-core/comparability.js +3 -4
- package/dist/eval-core/dependency-checker.d.ts +0 -1
- package/dist/eval-core/dependency-checker.js +2 -2
- package/dist/eval-core/evaluation-execution.d.ts +0 -1
- package/dist/eval-core/evaluation-execution.js +0 -1
- package/dist/eval-core/evaluation-job.d.ts +0 -1
- package/dist/eval-core/evaluation-job.js +0 -1
- package/dist/eval-core/evaluation-reporting.d.ts +0 -1
- package/dist/eval-core/evaluation-reporting.js +9 -8
- package/dist/eval-core/execution-strategy.d.ts +0 -1
- package/dist/eval-core/execution-strategy.js +6 -3
- package/dist/eval-core/fact-checker.d.ts +0 -1
- package/dist/eval-core/fact-checker.js +0 -1
- package/dist/eval-core/layer-gates.d.ts +0 -1
- package/dist/eval-core/layer-gates.js +0 -1
- package/dist/eval-core/mocks-runtime.d.ts +0 -1
- package/dist/eval-core/mocks-runtime.js +0 -1
- package/dist/eval-core/schema.d.ts +0 -1
- package/dist/eval-core/schema.js +0 -1
- package/dist/eval-core/statistics.d.ts +0 -1
- package/dist/eval-core/statistics.js +0 -1
- package/dist/eval-core/task-planner.d.ts +0 -1
- package/dist/eval-core/task-planner.js +0 -1
- package/dist/eval-core/verdict.d.ts +21 -4
- package/dist/eval-core/verdict.js +54 -5
- package/dist/eval-workflows/batch-evaluation-workflow.d.ts +18 -3
- package/dist/eval-workflows/batch-evaluation-workflow.js +31 -15
- package/dist/eval-workflows/evaluation-pipeline/preflight-warnings.d.ts +0 -1
- package/dist/eval-workflows/evaluation-pipeline/preflight-warnings.js +0 -1
- package/dist/eval-workflows/evaluation-pipeline/report-finalize.d.ts +0 -1
- package/dist/eval-workflows/evaluation-pipeline/report-finalize.js +0 -1
- package/dist/eval-workflows/evaluation-pipeline/run-state.d.ts +0 -1
- package/dist/eval-workflows/evaluation-pipeline/run-state.js +0 -1
- package/dist/eval-workflows/evaluation-pipeline/test-set-hash.d.ts +0 -1
- package/dist/eval-workflows/evaluation-pipeline/test-set-hash.js +0 -1
- package/dist/eval-workflows/evaluation-pipeline.d.ts +0 -1
- package/dist/eval-workflows/evaluation-pipeline.js +0 -1
- package/dist/eval-workflows/evaluation-preparation.d.ts +1 -5
- package/dist/eval-workflows/evaluation-preparation.js +20 -16
- package/dist/eval-workflows/messages.d.ts +0 -1
- package/dist/eval-workflows/messages.js +0 -1
- package/dist/eval-workflows/run-evaluation.d.ts +4 -9
- package/dist/eval-workflows/run-evaluation.js +16 -26
- package/dist/executors/anthropic-api.d.ts +0 -1
- package/dist/executors/anthropic-api.js +1 -2
- package/dist/executors/claude-cli.d.ts +0 -1
- package/dist/executors/claude-cli.js +0 -1
- package/dist/executors/claude-sdk-trace.d.ts +0 -1
- package/dist/executors/claude-sdk-trace.js +0 -1
- package/dist/executors/claude-sdk.d.ts +0 -1
- package/dist/executors/claude-sdk.js +0 -1
- package/dist/executors/codex-cli-trace.d.ts +0 -1
- package/dist/executors/codex-cli-trace.js +0 -1
- package/dist/executors/codex-cli.d.ts +0 -1
- package/dist/executors/codex-cli.js +0 -1
- package/dist/executors/codex-sdk.d.ts +0 -1
- package/dist/executors/codex-sdk.js +0 -1
- package/dist/executors/gemini.d.ts +0 -1
- package/dist/executors/gemini.js +0 -1
- package/dist/executors/index.d.ts +0 -1
- package/dist/executors/index.js +0 -1
- package/dist/executors/openai-api.d.ts +0 -1
- package/dist/executors/openai-api.js +0 -1
- package/dist/executors/runtime-fingerprint.d.ts +0 -1
- package/dist/executors/runtime-fingerprint.js +2 -3
- package/dist/executors/script.d.ts +0 -1
- package/dist/executors/script.js +0 -1
- package/dist/executors/shared.d.ts +0 -2
- package/dist/executors/shared.js +0 -1
- package/dist/grading/assertions.d.ts +0 -1
- package/dist/grading/assertions.js +0 -1
- package/dist/grading/debias-validate.d.ts +0 -1
- package/dist/grading/debias-validate.js +0 -1
- package/dist/grading/diagnostic.d.ts +0 -1
- package/dist/grading/diagnostic.js +0 -1
- package/dist/grading/gold-cli.d.ts +0 -1
- package/dist/grading/gold-cli.js +0 -1
- package/dist/grading/gold-dataset.d.ts +0 -1
- package/dist/grading/gold-dataset.js +0 -1
- package/dist/grading/human-gold.d.ts +0 -1
- package/dist/grading/human-gold.js +0 -1
- package/dist/grading/index.d.ts +0 -1
- package/dist/grading/index.js +0 -1
- package/dist/grading/judge.d.ts +0 -1
- package/dist/grading/judge.js +0 -1
- package/dist/grading/layered-scores.d.ts +0 -1
- package/dist/grading/layered-scores.js +0 -1
- package/dist/inputs/eval-config.d.ts +0 -1
- package/dist/inputs/eval-config.js +3 -2
- package/dist/inputs/load-samples.d.ts +0 -1
- package/dist/inputs/load-samples.js +0 -1
- package/dist/inputs/mcp-resolver.d.ts +0 -1
- package/dist/inputs/mcp-resolver.js +0 -1
- package/dist/inputs/skill-loader.d.ts +99 -7
- package/dist/inputs/skill-loader.js +325 -45
- package/dist/inputs/source-resolver.d.ts +28 -0
- package/dist/inputs/source-resolver.js +125 -0
- package/dist/inputs/url-fetcher.d.ts +0 -1
- package/dist/inputs/url-fetcher.js +0 -1
- package/dist/managed/index.d.ts +5 -0
- package/dist/managed/index.js +5 -0
- package/dist/managed/store.d.ts +76 -0
- package/dist/managed/store.js +260 -0
- package/dist/observability/experience-frontmatter.d.ts +0 -1
- package/dist/observability/experience-frontmatter.js +0 -1
- package/dist/observability/experience.d.ts +1 -2
- package/dist/observability/experience.js +1 -2
- package/dist/observability/feedback-matchers.d.ts +0 -1
- package/dist/observability/feedback-matchers.js +0 -1
- package/dist/observability/feedback-projection.d.ts +0 -1
- package/dist/observability/feedback-projection.js +0 -1
- package/dist/observability/inbox-view-model.d.ts +0 -1
- package/dist/observability/inbox-view-model.js +0 -1
- package/dist/observability/inbox.d.ts +0 -1
- package/dist/observability/inbox.js +2 -3
- package/dist/observability/problem-patterns.d.ts +0 -1
- package/dist/observability/problem-patterns.js +0 -1
- package/dist/observability/resolved-review.d.ts +0 -1
- package/dist/observability/resolved-review.js +4 -5
- package/dist/observability/review-state.d.ts +0 -1
- package/dist/observability/review-state.js +3 -4
- package/dist/observability/skill-chain-advisories.d.ts +0 -1
- package/dist/observability/skill-chain-advisories.js +0 -1
- package/dist/observability/skill-chain.d.ts +0 -1
- package/dist/observability/skill-chain.js +5 -6
- package/dist/observability/skill-health-analyzer.d.ts +13 -1
- package/dist/observability/skill-health-analyzer.js +17 -3
- package/dist/observability/soft-standards/constants.d.ts +0 -1
- package/dist/observability/soft-standards/constants.js +0 -1
- package/dist/observability/soft-standards/index.d.ts +0 -1
- package/dist/observability/soft-standards/index.js +0 -1
- package/dist/observability/soft-standards/llm-extractor.d.ts +0 -1
- package/dist/observability/soft-standards/llm-extractor.js +7 -8
- package/dist/observability/soft-standards/runtime-evaluator.d.ts +0 -1
- package/dist/observability/soft-standards/runtime-evaluator.js +2 -3
- package/dist/observability/soft-standards/skill-standards-store.d.ts +0 -1
- package/dist/observability/soft-standards/skill-standards-store.js +5 -6
- package/dist/observability/soft-standards/types.d.ts +10 -11
- package/dist/observability/soft-standards/types.js +0 -1
- package/dist/observability/text-signals.d.ts +0 -1
- package/dist/observability/text-signals.js +0 -1
- package/dist/observability/trace-adapter.d.ts +0 -1
- package/dist/observability/trace-adapter.js +0 -1
- package/dist/observability/trace-attribution.d.ts +0 -1
- package/dist/observability/trace-attribution.js +0 -1
- package/dist/observability/trace-segmenter.d.ts +0 -1
- package/dist/observability/trace-segmenter.js +0 -1
- package/dist/observability/trace-source.d.ts +0 -1
- package/dist/observability/trace-source.js +0 -1
- package/dist/renderer/html-renderer.d.ts +0 -1
- package/dist/renderer/html-renderer.js +4 -5
- package/dist/renderer/layout.d.ts +0 -1
- package/dist/renderer/layout.js +2 -1
- package/dist/renderer/observation-inbox/helpers.d.ts +0 -1
- package/dist/renderer/observation-inbox/helpers.js +0 -1
- package/dist/renderer/observation-inbox/styles.d.ts +0 -1
- package/dist/renderer/observation-inbox/styles.js +0 -1
- package/dist/renderer/observation-inbox-renderer.d.ts +0 -1
- package/dist/renderer/observation-inbox-renderer.js +13 -14
- package/dist/renderer/skill-detail-renderer.d.ts +0 -1
- package/dist/renderer/skill-detail-renderer.js +101 -23
- package/dist/renderer/skill-health-renderer.d.ts +0 -1
- package/dist/renderer/skill-health-renderer.js +33 -5
- package/dist/renderer/skill-list-renderer.d.ts +0 -1
- package/dist/renderer/skill-list-renderer.js +18 -7
- package/dist/renderer/summary.d.ts +0 -1
- package/dist/renderer/summary.js +21 -10
- package/dist/renderer/table.d.ts +0 -1
- package/dist/renderer/table.js +0 -1
- package/dist/renderer/test-view.d.ts +0 -1
- package/dist/renderer/test-view.js +0 -1
- package/dist/renderer/trends.d.ts +0 -1
- package/dist/renderer/trends.js +0 -1
- package/dist/server/job-store.d.ts +0 -1
- package/dist/server/job-store.js +0 -1
- package/dist/server/report-server.d.ts +0 -1
- package/dist/server/report-server.js +10 -4
- package/dist/server/report-store.d.ts +1 -2
- package/dist/server/report-store.js +6 -7
- package/dist/server/skill-index.d.ts +0 -1
- package/dist/server/skill-index.js +7 -5
- package/dist/server/skill-insights.d.ts +0 -1
- package/dist/server/skill-insights.js +41 -14
- package/dist/shared/hard-rules.d.ts +0 -1
- package/dist/shared/hard-rules.js +0 -1
- package/dist/shared/llm-prompts/index.d.ts +0 -1
- package/dist/shared/llm-prompts/index.js +0 -1
- package/dist/shared/llm-prompts/skill-health.d.ts +0 -1
- package/dist/shared/llm-prompts/skill-health.js +0 -1
- package/dist/shared/time.d.ts +0 -1
- package/dist/shared/time.js +0 -1
- package/dist/shared/tool-search.d.ts +0 -1
- package/dist/shared/tool-search.js +0 -1
- package/dist/types/dependencies.d.ts +0 -1
- package/dist/types/dependencies.js +0 -1
- package/dist/types/diagnosis.d.ts +0 -1
- package/dist/types/diagnosis.js +0 -1
- package/dist/types/doctor.d.ts +4 -5
- package/dist/types/doctor.js +2 -3
- package/dist/types/eval.d.ts +2 -1
- package/dist/types/eval.js +0 -1
- package/dist/types/executor.d.ts +1 -2
- package/dist/types/executor.js +0 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/judge.d.ts +0 -1
- package/dist/types/judge.js +0 -1
- package/dist/types/managed.d.ts +85 -0
- package/dist/types/managed.js +1 -0
- package/dist/types/observability.d.ts +5 -6
- package/dist/types/observability.js +0 -1
- package/dist/types/report.d.ts +2 -3
- package/dist/types/report.js +0 -1
- package/dist/types/shared.d.ts +0 -1
- package/dist/types/shared.js +0 -1
- package/dist/types/skill-index.d.ts +3 -1
- package/dist/types/skill-index.js +0 -1
- package/dist/types/storage.d.ts +0 -1
- package/dist/types/storage.js +0 -1
- package/dist/util/safe-slice.d.ts +0 -1
- package/dist/util/safe-slice.js +0 -1
- package/package.json +10 -5
- package/dist/analysis/coverage-analyzer.d.ts.map +0 -1
- package/dist/analysis/coverage-analyzer.js.map +0 -1
- package/dist/analysis/failure-clusterer.d.ts.map +0 -1
- package/dist/analysis/failure-clusterer.js.map +0 -1
- package/dist/analysis/gap-analyzer.d.ts.map +0 -1
- package/dist/analysis/gap-analyzer.js.map +0 -1
- package/dist/analysis/hedging-classifier.d.ts.map +0 -1
- package/dist/analysis/hedging-classifier.js.map +0 -1
- package/dist/analysis/report-diagnostics.d.ts.map +0 -1
- package/dist/analysis/report-diagnostics.js.map +0 -1
- package/dist/analysis/sample-diagnostics.d.ts.map +0 -1
- package/dist/analysis/sample-diagnostics.js.map +0 -1
- package/dist/analysis/saturation.d.ts.map +0 -1
- package/dist/analysis/saturation.js.map +0 -1
- package/dist/authoring/evolver.d.ts.map +0 -1
- package/dist/authoring/evolver.js.map +0 -1
- package/dist/authoring/generator.d.ts.map +0 -1
- package/dist/authoring/generator.js.map +0 -1
- package/dist/authoring/sample-fixer.d.ts.map +0 -1
- package/dist/authoring/sample-fixer.js.map +0 -1
- package/dist/cli/commands/doctor.d.ts.map +0 -1
- package/dist/cli/commands/doctor.js.map +0 -1
- package/dist/cli/commands/eval/gold/compare.d.ts.map +0 -1
- package/dist/cli/commands/eval/gold/compare.js.map +0 -1
- package/dist/cli/commands/eval/gold/index.d.ts.map +0 -1
- package/dist/cli/commands/eval/gold/index.js.map +0 -1
- package/dist/cli/commands/eval/gold/init.d.ts.map +0 -1
- package/dist/cli/commands/eval/gold/init.js.map +0 -1
- package/dist/cli/commands/eval/gold/validate.d.ts.map +0 -1
- package/dist/cli/commands/eval/gold/validate.js.map +0 -1
- package/dist/cli/commands/eval/index.d.ts.map +0 -1
- package/dist/cli/commands/eval/index.js.map +0 -1
- package/dist/cli/commands/evolve.d.ts.map +0 -1
- package/dist/cli/commands/evolve.js.map +0 -1
- package/dist/cli/commands/init.d.ts.map +0 -1
- package/dist/cli/commands/init.js.map +0 -1
- package/dist/cli/commands/observe/inbox.d.ts.map +0 -1
- package/dist/cli/commands/observe/inbox.js.map +0 -1
- package/dist/cli/commands/observe/index.d.ts.map +0 -1
- package/dist/cli/commands/observe/index.js.map +0 -1
- package/dist/cli/commands/observe/ingest.d.ts.map +0 -1
- package/dist/cli/commands/observe/ingest.js.map +0 -1
- package/dist/cli/commands/observe/show.d.ts.map +0 -1
- package/dist/cli/commands/observe/show.js.map +0 -1
- package/dist/cli/commands/sample.d.ts.map +0 -1
- package/dist/cli/commands/sample.js.map +0 -1
- package/dist/cli/commands/studio.d.ts.map +0 -1
- package/dist/cli/commands/studio.js.map +0 -1
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/lib/cli-exit.d.ts.map +0 -1
- package/dist/cli/lib/cli-exit.js.map +0 -1
- package/dist/cli/lib/cmd-flags.d.ts.map +0 -1
- package/dist/cli/lib/cmd-flags.js.map +0 -1
- package/dist/cli/lib/i18n-dict/common.d.ts.map +0 -1
- package/dist/cli/lib/i18n-dict/common.js.map +0 -1
- package/dist/cli/lib/i18n-dict/evolve.d.ts.map +0 -1
- package/dist/cli/lib/i18n-dict/evolve.js.map +0 -1
- package/dist/cli/lib/i18n-dict/gen.d.ts.map +0 -1
- package/dist/cli/lib/i18n-dict/gen.js.map +0 -1
- package/dist/cli/lib/i18n-dict/help.d.ts.map +0 -1
- package/dist/cli/lib/i18n-dict/help.js.map +0 -1
- package/dist/cli/lib/i18n-dict/init.d.ts.map +0 -1
- package/dist/cli/lib/i18n-dict/init.js.map +0 -1
- package/dist/cli/lib/i18n-dict/run.d.ts.map +0 -1
- package/dist/cli/lib/i18n-dict/run.js.map +0 -1
- package/dist/cli/lib/i18n-dict/types.d.ts.map +0 -1
- package/dist/cli/lib/i18n-dict/types.js.map +0 -1
- package/dist/cli/lib/i18n-dict.d.ts.map +0 -1
- package/dist/cli/lib/i18n-dict.js.map +0 -1
- package/dist/cli/lib/i18n.d.ts.map +0 -1
- package/dist/cli/lib/i18n.js.map +0 -1
- package/dist/cli/lib/parse-run-config/judge-models.d.ts.map +0 -1
- package/dist/cli/lib/parse-run-config/judge-models.js.map +0 -1
- package/dist/cli/lib/parse-run-config/samples-discovery.d.ts.map +0 -1
- package/dist/cli/lib/parse-run-config/samples-discovery.js.map +0 -1
- package/dist/cli/lib/parse-run-config/variant-resolution.d.ts.map +0 -1
- package/dist/cli/lib/parse-run-config/variant-resolution.js.map +0 -1
- package/dist/cli/lib/parse-run-config.d.ts.map +0 -1
- package/dist/cli/lib/parse-run-config.js.map +0 -1
- package/dist/cli/lib/progress.d.ts.map +0 -1
- package/dist/cli/lib/progress.js.map +0 -1
- package/dist/cli/lib/resolve-skill-input.d.ts.map +0 -1
- package/dist/cli/lib/resolve-skill-input.js.map +0 -1
- package/dist/cli/lib/run-tally.d.ts.map +0 -1
- package/dist/cli/lib/run-tally.js.map +0 -1
- package/dist/cli/lib/shared.d.ts.map +0 -1
- package/dist/cli/lib/shared.js.map +0 -1
- package/dist/cli/lib/update-check.d.ts.map +0 -1
- package/dist/cli/lib/update-check.js.map +0 -1
- package/dist/cli/oclif/base-command.d.ts.map +0 -1
- package/dist/cli/oclif/base-command.js.map +0 -1
- package/dist/cli/oclif/help.d.ts.map +0 -1
- package/dist/cli/oclif/help.js.map +0 -1
- package/dist/cli/oclif/i18n.d.ts.map +0 -1
- package/dist/cli/oclif/i18n.js.map +0 -1
- package/dist/cli/oclif/parsers.d.ts.map +0 -1
- package/dist/cli/oclif/parsers.js.map +0 -1
- package/dist/cli/oclif/projection.d.ts.map +0 -1
- package/dist/cli/oclif/projection.js.map +0 -1
- package/dist/cli/oclif/run.d.ts.map +0 -1
- package/dist/cli/oclif/run.js.map +0 -1
- package/dist/diagnosis/observe-mapper.d.ts.map +0 -1
- package/dist/diagnosis/observe-mapper.js.map +0 -1
- package/dist/diagnosis/observe-producer.d.ts.map +0 -1
- package/dist/diagnosis/observe-producer.js.map +0 -1
- package/dist/diagnosis/studio-projection.d.ts.map +0 -1
- package/dist/diagnosis/studio-projection.js.map +0 -1
- package/dist/diagnosis/types.d.ts.map +0 -1
- package/dist/diagnosis/types.js.map +0 -1
- package/dist/doctor/fixer.d.ts.map +0 -1
- package/dist/doctor/fixer.js.map +0 -1
- package/dist/doctor/health/builtin-dimensions.d.ts.map +0 -1
- package/dist/doctor/health/builtin-dimensions.js.map +0 -1
- package/dist/doctor/health/composer.d.ts.map +0 -1
- package/dist/doctor/health/composer.js.map +0 -1
- package/dist/doctor/health/dimension-registry.d.ts.map +0 -1
- package/dist/doctor/health/dimension-registry.js.map +0 -1
- package/dist/doctor/health/dimension-spec.d.ts.map +0 -1
- package/dist/doctor/health/dimension-spec.js.map +0 -1
- package/dist/doctor/health/parser.d.ts.map +0 -1
- package/dist/doctor/health/parser.js.map +0 -1
- package/dist/doctor/health/prompt-builder.d.ts.map +0 -1
- package/dist/doctor/health/prompt-builder.js.map +0 -1
- package/dist/doctor/health/register.d.ts.map +0 -1
- package/dist/doctor/health/register.js.map +0 -1
- package/dist/doctor/index.d.ts.map +0 -1
- package/dist/doctor/index.js.map +0 -1
- package/dist/doctor/messages.d.ts.map +0 -1
- package/dist/doctor/messages.js.map +0 -1
- package/dist/doctor/preflight.d.ts.map +0 -1
- package/dist/doctor/preflight.js.map +0 -1
- package/dist/doctor/renderer.d.ts.map +0 -1
- package/dist/doctor/renderer.js.map +0 -1
- package/dist/doctor/rules.d.ts.map +0 -1
- package/dist/doctor/rules.js.map +0 -1
- package/dist/eval-core/bootstrap.d.ts.map +0 -1
- package/dist/eval-core/bootstrap.js.map +0 -1
- package/dist/eval-core/cache.d.ts.map +0 -1
- package/dist/eval-core/cache.js.map +0 -1
- package/dist/eval-core/comparability.d.ts.map +0 -1
- package/dist/eval-core/comparability.js.map +0 -1
- package/dist/eval-core/dependency-checker.d.ts.map +0 -1
- package/dist/eval-core/dependency-checker.js.map +0 -1
- package/dist/eval-core/evaluation-execution.d.ts.map +0 -1
- package/dist/eval-core/evaluation-execution.js.map +0 -1
- package/dist/eval-core/evaluation-job.d.ts.map +0 -1
- package/dist/eval-core/evaluation-job.js.map +0 -1
- package/dist/eval-core/evaluation-reporting.d.ts.map +0 -1
- package/dist/eval-core/evaluation-reporting.js.map +0 -1
- package/dist/eval-core/execution-strategy.d.ts.map +0 -1
- package/dist/eval-core/execution-strategy.js.map +0 -1
- package/dist/eval-core/fact-checker.d.ts.map +0 -1
- package/dist/eval-core/fact-checker.js.map +0 -1
- package/dist/eval-core/layer-gates.d.ts.map +0 -1
- package/dist/eval-core/layer-gates.js.map +0 -1
- package/dist/eval-core/mocks-runtime.d.ts.map +0 -1
- package/dist/eval-core/mocks-runtime.js.map +0 -1
- package/dist/eval-core/schema.d.ts.map +0 -1
- package/dist/eval-core/schema.js.map +0 -1
- package/dist/eval-core/statistics.d.ts.map +0 -1
- package/dist/eval-core/statistics.js.map +0 -1
- package/dist/eval-core/task-planner.d.ts.map +0 -1
- package/dist/eval-core/task-planner.js.map +0 -1
- package/dist/eval-core/verdict.d.ts.map +0 -1
- package/dist/eval-core/verdict.js.map +0 -1
- package/dist/eval-workflows/batch-evaluation-workflow.d.ts.map +0 -1
- package/dist/eval-workflows/batch-evaluation-workflow.js.map +0 -1
- package/dist/eval-workflows/evaluation-pipeline/preflight-warnings.d.ts.map +0 -1
- package/dist/eval-workflows/evaluation-pipeline/preflight-warnings.js.map +0 -1
- package/dist/eval-workflows/evaluation-pipeline/report-finalize.d.ts.map +0 -1
- package/dist/eval-workflows/evaluation-pipeline/report-finalize.js.map +0 -1
- package/dist/eval-workflows/evaluation-pipeline/run-state.d.ts.map +0 -1
- package/dist/eval-workflows/evaluation-pipeline/run-state.js.map +0 -1
- package/dist/eval-workflows/evaluation-pipeline/test-set-hash.d.ts.map +0 -1
- package/dist/eval-workflows/evaluation-pipeline/test-set-hash.js.map +0 -1
- package/dist/eval-workflows/evaluation-pipeline.d.ts.map +0 -1
- package/dist/eval-workflows/evaluation-pipeline.js.map +0 -1
- package/dist/eval-workflows/evaluation-preparation.d.ts.map +0 -1
- package/dist/eval-workflows/evaluation-preparation.js.map +0 -1
- package/dist/eval-workflows/messages.d.ts.map +0 -1
- package/dist/eval-workflows/messages.js.map +0 -1
- package/dist/eval-workflows/run-evaluation.d.ts.map +0 -1
- package/dist/eval-workflows/run-evaluation.js.map +0 -1
- package/dist/executors/anthropic-api.d.ts.map +0 -1
- package/dist/executors/anthropic-api.js.map +0 -1
- package/dist/executors/claude-cli.d.ts.map +0 -1
- package/dist/executors/claude-cli.js.map +0 -1
- package/dist/executors/claude-sdk-trace.d.ts.map +0 -1
- package/dist/executors/claude-sdk-trace.js.map +0 -1
- package/dist/executors/claude-sdk.d.ts.map +0 -1
- package/dist/executors/claude-sdk.js.map +0 -1
- package/dist/executors/codex-cli-trace.d.ts.map +0 -1
- package/dist/executors/codex-cli-trace.js.map +0 -1
- package/dist/executors/codex-cli.d.ts.map +0 -1
- package/dist/executors/codex-cli.js.map +0 -1
- package/dist/executors/codex-sdk.d.ts.map +0 -1
- package/dist/executors/codex-sdk.js.map +0 -1
- package/dist/executors/gemini.d.ts.map +0 -1
- package/dist/executors/gemini.js.map +0 -1
- package/dist/executors/index.d.ts.map +0 -1
- package/dist/executors/index.js.map +0 -1
- package/dist/executors/openai-api.d.ts.map +0 -1
- package/dist/executors/openai-api.js.map +0 -1
- package/dist/executors/runtime-fingerprint.d.ts.map +0 -1
- package/dist/executors/runtime-fingerprint.js.map +0 -1
- package/dist/executors/script.d.ts.map +0 -1
- package/dist/executors/script.js.map +0 -1
- package/dist/executors/shared.d.ts.map +0 -1
- package/dist/executors/shared.js.map +0 -1
- package/dist/grading/assertions.d.ts.map +0 -1
- package/dist/grading/assertions.js.map +0 -1
- package/dist/grading/debias-validate.d.ts.map +0 -1
- package/dist/grading/debias-validate.js.map +0 -1
- package/dist/grading/diagnostic.d.ts.map +0 -1
- package/dist/grading/diagnostic.js.map +0 -1
- package/dist/grading/gold-cli.d.ts.map +0 -1
- package/dist/grading/gold-cli.js.map +0 -1
- package/dist/grading/gold-dataset.d.ts.map +0 -1
- package/dist/grading/gold-dataset.js.map +0 -1
- package/dist/grading/human-gold.d.ts.map +0 -1
- package/dist/grading/human-gold.js.map +0 -1
- package/dist/grading/index.d.ts.map +0 -1
- package/dist/grading/index.js.map +0 -1
- package/dist/grading/judge.d.ts.map +0 -1
- package/dist/grading/judge.js.map +0 -1
- package/dist/grading/layered-scores.d.ts.map +0 -1
- package/dist/grading/layered-scores.js.map +0 -1
- package/dist/inputs/eval-config.d.ts.map +0 -1
- package/dist/inputs/eval-config.js.map +0 -1
- package/dist/inputs/load-samples.d.ts.map +0 -1
- package/dist/inputs/load-samples.js.map +0 -1
- package/dist/inputs/mcp-resolver.d.ts.map +0 -1
- package/dist/inputs/mcp-resolver.js.map +0 -1
- package/dist/inputs/skill-loader.d.ts.map +0 -1
- package/dist/inputs/skill-loader.js.map +0 -1
- package/dist/inputs/url-fetcher.d.ts.map +0 -1
- package/dist/inputs/url-fetcher.js.map +0 -1
- package/dist/observability/experience-frontmatter.d.ts.map +0 -1
- package/dist/observability/experience-frontmatter.js.map +0 -1
- package/dist/observability/experience.d.ts.map +0 -1
- package/dist/observability/experience.js.map +0 -1
- package/dist/observability/feedback-matchers.d.ts.map +0 -1
- package/dist/observability/feedback-matchers.js.map +0 -1
- package/dist/observability/feedback-projection.d.ts.map +0 -1
- package/dist/observability/feedback-projection.js.map +0 -1
- package/dist/observability/inbox-view-model.d.ts.map +0 -1
- package/dist/observability/inbox-view-model.js.map +0 -1
- package/dist/observability/inbox.d.ts.map +0 -1
- package/dist/observability/inbox.js.map +0 -1
- package/dist/observability/problem-patterns.d.ts.map +0 -1
- package/dist/observability/problem-patterns.js.map +0 -1
- package/dist/observability/resolved-review.d.ts.map +0 -1
- package/dist/observability/resolved-review.js.map +0 -1
- package/dist/observability/review-state.d.ts.map +0 -1
- package/dist/observability/review-state.js.map +0 -1
- package/dist/observability/skill-chain-advisories.d.ts.map +0 -1
- package/dist/observability/skill-chain-advisories.js.map +0 -1
- package/dist/observability/skill-chain.d.ts.map +0 -1
- package/dist/observability/skill-chain.js.map +0 -1
- package/dist/observability/skill-health-analyzer.d.ts.map +0 -1
- package/dist/observability/skill-health-analyzer.js.map +0 -1
- package/dist/observability/soft-standards/constants.d.ts.map +0 -1
- package/dist/observability/soft-standards/constants.js.map +0 -1
- package/dist/observability/soft-standards/index.d.ts.map +0 -1
- package/dist/observability/soft-standards/index.js.map +0 -1
- package/dist/observability/soft-standards/llm-extractor.d.ts.map +0 -1
- package/dist/observability/soft-standards/llm-extractor.js.map +0 -1
- package/dist/observability/soft-standards/runtime-evaluator.d.ts.map +0 -1
- package/dist/observability/soft-standards/runtime-evaluator.js.map +0 -1
- package/dist/observability/soft-standards/skill-standards-store.d.ts.map +0 -1
- package/dist/observability/soft-standards/skill-standards-store.js.map +0 -1
- package/dist/observability/soft-standards/types.d.ts.map +0 -1
- package/dist/observability/soft-standards/types.js.map +0 -1
- package/dist/observability/text-signals.d.ts.map +0 -1
- package/dist/observability/text-signals.js.map +0 -1
- package/dist/observability/trace-adapter.d.ts.map +0 -1
- package/dist/observability/trace-adapter.js.map +0 -1
- package/dist/observability/trace-attribution.d.ts.map +0 -1
- package/dist/observability/trace-attribution.js.map +0 -1
- package/dist/observability/trace-segmenter.d.ts.map +0 -1
- package/dist/observability/trace-segmenter.js.map +0 -1
- package/dist/observability/trace-source.d.ts.map +0 -1
- package/dist/observability/trace-source.js.map +0 -1
- package/dist/renderer/html-renderer.d.ts.map +0 -1
- package/dist/renderer/html-renderer.js.map +0 -1
- package/dist/renderer/layout.d.ts.map +0 -1
- package/dist/renderer/layout.js.map +0 -1
- package/dist/renderer/observation-inbox/helpers.d.ts.map +0 -1
- package/dist/renderer/observation-inbox/helpers.js.map +0 -1
- package/dist/renderer/observation-inbox/styles.d.ts.map +0 -1
- package/dist/renderer/observation-inbox/styles.js.map +0 -1
- package/dist/renderer/observation-inbox-renderer.d.ts.map +0 -1
- package/dist/renderer/observation-inbox-renderer.js.map +0 -1
- package/dist/renderer/skill-detail-renderer.d.ts.map +0 -1
- package/dist/renderer/skill-detail-renderer.js.map +0 -1
- package/dist/renderer/skill-health-renderer.d.ts.map +0 -1
- package/dist/renderer/skill-health-renderer.js.map +0 -1
- package/dist/renderer/skill-list-renderer.d.ts.map +0 -1
- package/dist/renderer/skill-list-renderer.js.map +0 -1
- package/dist/renderer/summary.d.ts.map +0 -1
- package/dist/renderer/summary.js.map +0 -1
- package/dist/renderer/table.d.ts.map +0 -1
- package/dist/renderer/table.js.map +0 -1
- package/dist/renderer/test-view.d.ts.map +0 -1
- package/dist/renderer/test-view.js.map +0 -1
- package/dist/renderer/trends.d.ts.map +0 -1
- package/dist/renderer/trends.js.map +0 -1
- package/dist/server/job-store.d.ts.map +0 -1
- package/dist/server/job-store.js.map +0 -1
- package/dist/server/report-server.d.ts.map +0 -1
- package/dist/server/report-server.js.map +0 -1
- package/dist/server/report-store.d.ts.map +0 -1
- package/dist/server/report-store.js.map +0 -1
- package/dist/server/skill-index.d.ts.map +0 -1
- package/dist/server/skill-index.js.map +0 -1
- package/dist/server/skill-insights.d.ts.map +0 -1
- package/dist/server/skill-insights.js.map +0 -1
- package/dist/shared/hard-rules.d.ts.map +0 -1
- package/dist/shared/hard-rules.js.map +0 -1
- package/dist/shared/llm-prompts/index.d.ts.map +0 -1
- package/dist/shared/llm-prompts/index.js.map +0 -1
- package/dist/shared/llm-prompts/skill-health.d.ts.map +0 -1
- package/dist/shared/llm-prompts/skill-health.js.map +0 -1
- package/dist/shared/time.d.ts.map +0 -1
- package/dist/shared/time.js.map +0 -1
- package/dist/shared/tool-search.d.ts.map +0 -1
- package/dist/shared/tool-search.js.map +0 -1
- package/dist/types/dependencies.d.ts.map +0 -1
- package/dist/types/dependencies.js.map +0 -1
- package/dist/types/diagnosis.d.ts.map +0 -1
- package/dist/types/diagnosis.js.map +0 -1
- package/dist/types/doctor.d.ts.map +0 -1
- package/dist/types/doctor.js.map +0 -1
- package/dist/types/eval.d.ts.map +0 -1
- package/dist/types/eval.js.map +0 -1
- package/dist/types/executor.d.ts.map +0 -1
- package/dist/types/executor.js.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/types/judge.d.ts.map +0 -1
- package/dist/types/judge.js.map +0 -1
- package/dist/types/observability.d.ts.map +0 -1
- package/dist/types/observability.js.map +0 -1
- package/dist/types/report.d.ts.map +0 -1
- package/dist/types/report.js.map +0 -1
- package/dist/types/shared.d.ts.map +0 -1
- package/dist/types/shared.js.map +0 -1
- package/dist/types/skill-index.d.ts.map +0 -1
- package/dist/types/skill-index.js.map +0 -1
- package/dist/types/storage.d.ts.map +0 -1
- package/dist/types/storage.js.map +0 -1
- package/dist/util/safe-slice.d.ts.map +0 -1
- package/dist/util/safe-slice.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFileSync, existsSync, readdirSync, statSync } from 'node:fs';
|
|
1
|
+
import { readFileSync, existsSync, readdirSync, statSync, realpathSync } from 'node:fs';
|
|
2
2
|
import { resolve, join, relative, dirname, basename } from 'node:path';
|
|
3
3
|
import { execFileSync } from 'node:child_process';
|
|
4
4
|
import { extractSkillHardRules, extractSkillWorkflows } from '../shared/hard-rules.js';
|
|
@@ -37,17 +37,147 @@ function buildMetadata(content) {
|
|
|
37
37
|
metadata.workflows = workflows;
|
|
38
38
|
return Object.keys(metadata).length > 0 ? metadata : undefined;
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
// 这些是**探测**(尝试某路径是否存在),miss 是正常流程,不是错误 → 吞掉 git 的 `fatal:` stderr,
|
|
41
|
+
// 否则一次成功的 install/eval 也会在用户终端打印吓人的 `fatal: path ... does not exist`。
|
|
42
|
+
const GIT_PROBE_STDIO = ['ignore', 'pipe', 'ignore'];
|
|
43
|
+
// 用 `cat-file blob` 而非 `git show`:`git show <ref>:<目录>` 对**目录**会退出码 0 并打印树清单
|
|
44
|
+
// (`tree <ref>:path\n\nSKILL.md`),被这里当成"文件存在 + 内容"误收 —— 名字以 .md 结尾的目录会被
|
|
45
|
+
// classify 误判为 file-skill、物化出树清单当 skill 正文,也会让 eval 把清单文本量成 skill 内容。
|
|
46
|
+
// `cat-file blob` 对非 blob(tree/submodule)直接非零退出,从根上只认 blob。对真 blob 字节与 show 一致。
|
|
47
|
+
// 所有 git helper 收 `cwd`(默认进程 cwd):git 解析必须在**目标仓库**里跑,否则 eval 从别处调用、
|
|
48
|
+
// skillDir 指向另一个 repo 时,会拿进程 cwd 的 repo 与 HEAD 去解析,轻则 not_found、重则评测错内容。
|
|
49
|
+
// 由 resolveGitRepoContext 解出 repoRoot 后逐处显式传入。
|
|
50
|
+
export function gitShowFile(ref, filePath, cwd = process.cwd()) {
|
|
41
51
|
try {
|
|
42
|
-
return execFileSync('git', ['
|
|
52
|
+
return execFileSync('git', ['cat-file', 'blob', `${ref}:${filePath}`], { cwd, encoding: 'utf-8', stdio: GIT_PROBE_STDIO }).trim();
|
|
43
53
|
}
|
|
44
54
|
catch {
|
|
45
55
|
return null;
|
|
46
56
|
}
|
|
47
57
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
58
|
+
/**
|
|
59
|
+
* 取 `<ref>:<filePath>` 的原始字节(二进制资产用,不做 utf-8 解码);不存在/非 blob/出错返回 null。
|
|
60
|
+
* 同 gitShowFile 用 `cat-file blob`:对目录会非零退出,不会把树清单字节当文件内容物化。
|
|
61
|
+
*/
|
|
62
|
+
export function gitShowBytes(ref, filePath, cwd = process.cwd()) {
|
|
63
|
+
try {
|
|
64
|
+
return execFileSync('git', ['cat-file', 'blob', `${ref}:${filePath}`], { cwd, stdio: GIT_PROBE_STDIO }); // 无 encoding → Buffer
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 递归列出 `<ref>:<treePath>` 子树下的叶子条目(blob / 软链 / submodule)。tree 不存在返回 []。
|
|
72
|
+
* 用 `-z`(NUL 分隔):git 不会对含换行 / 非 ASCII 的路径做 C-quote,路径原样可回喂 git show。
|
|
73
|
+
* 用 `--full-tree`:treePath 是仓库根相对路径,不受当前 cwd 前缀限制 —— 否则在仓库子目录执行时
|
|
74
|
+
* `ls-tree HEAD:skills/review` 会返回空(而 gitShowFile 探测不受限,导致"探测命中→物化为空"的发散)。
|
|
75
|
+
* `treePath` 为空时列整棵根 tree(`<ref>:`)。
|
|
76
|
+
*/
|
|
77
|
+
export function gitLsTreeBlobs(ref, treePath, cwd = process.cwd()) {
|
|
78
|
+
let out;
|
|
79
|
+
try {
|
|
80
|
+
out = execFileSync('git', ['ls-tree', '-r', '-z', '--full-tree', `${ref}:${treePath}`], { cwd, encoding: 'utf-8', stdio: GIT_PROBE_STDIO });
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return [];
|
|
84
|
+
}
|
|
85
|
+
const NUL = String.fromCharCode(0);
|
|
86
|
+
const entries = [];
|
|
87
|
+
for (const rec of out.split(NUL)) {
|
|
88
|
+
// 记录格式:`<mode> <type> <object>\t<path>`(path 可含换行,故用 [\s\S])。
|
|
89
|
+
const m = rec.match(/^(\d+) \S+ \S+\t([\s\S]*)$/);
|
|
90
|
+
if (m)
|
|
91
|
+
entries.push({ mode: m[1], path: m[2] });
|
|
92
|
+
}
|
|
93
|
+
return entries;
|
|
94
|
+
}
|
|
95
|
+
/** 从 p 起向上找最近的存在目录(skillDir 可能尚不在磁盘,但仍要定位它所属的 repo)。 */
|
|
96
|
+
function nearestExistingDir(p) {
|
|
97
|
+
let cur = resolve(p);
|
|
98
|
+
while (!existsSync(cur)) {
|
|
99
|
+
const parent = dirname(cur);
|
|
100
|
+
if (parent === cur)
|
|
101
|
+
break;
|
|
102
|
+
cur = parent;
|
|
103
|
+
}
|
|
104
|
+
return cur;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* 解出 `fromPath` 所属 git 仓库的上下文。**关键**:`git rev-parse` 在 `fromPath` 处执行(-C),
|
|
108
|
+
* 而非进程 cwd —— 否则 eval 从别处调用、skillDir 指向另一个 repo 时,会拿进程 cwd 的 repo root 和
|
|
109
|
+
* HEAD 去解析,轻则 not_found、重则评测错 repo 的同名内容。repoRoot / relDir 都 realpath 归一,
|
|
110
|
+
* 消除 /var ↔ /private/var 这类等价路径导致 relative 算错。不在 git 仓库时 rev-parse 抛错,由上层转
|
|
111
|
+
* not_a_git_repo。stderr 吞掉,不双重打印 `fatal:`。
|
|
112
|
+
*/
|
|
113
|
+
export function resolveGitRepoContext(fromPath) {
|
|
114
|
+
const absInput = resolve(fromPath);
|
|
115
|
+
const existing = nearestExistingDir(absInput);
|
|
116
|
+
const anchor = realpathSync(existing);
|
|
117
|
+
const repoRoot = realpathSync(execFileSync('git', ['-C', anchor, 'rev-parse', '--show-toplevel'], { encoding: 'utf-8', stdio: GIT_PROBE_STDIO }).trim());
|
|
118
|
+
// 对称归一:repoRoot 经 realpath,fromPath 也必须经同源 realpath,否则 fromPath 尚不在磁盘时
|
|
119
|
+
// (纯 git eval:skill 只在 HEAD、工作树已删)absFrom 保留未归一字面,在 macOS /var ↔ /private/var
|
|
120
|
+
// 这类等价路径上 relative 会算出越界的 `../../..` relDir → classify 探到仓库外 → 误报 not_found。
|
|
121
|
+
// 做法:realpath 最近存在祖先,再拼回尚不存在的尾段(尾段为空即 fromPath 本身存在)。
|
|
122
|
+
const tail = relative(existing, absInput);
|
|
123
|
+
const absFrom = tail ? join(anchor, tail) : anchor;
|
|
124
|
+
return { repoRoot, relDir: relative(repoRoot, absFrom) };
|
|
125
|
+
}
|
|
126
|
+
/** 拼 git 仓库相对路径:始终用 `/`,空 base 直接返回 b(避免 join 产生 `.` 这类退化 tree-ish)。 */
|
|
127
|
+
export function gitJoin(base, sub) {
|
|
128
|
+
return base ? `${base}/${sub}` : sub;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* 解析 `git:<ref>:<spec>` —— **install 与 eval 共用此一处**,保证两侧对 ref/spec 的切分与合法性
|
|
132
|
+
* 判定一致。`git:<spec>` 缺省 ref=HEAD;spec 可含 `/`(如 skills/review)。空 ref / 空 spec 都非法
|
|
133
|
+
* 并返回 null:空 ref(`git::x`)会被 git 当 index/stage-0 解析,量到不可复取、依赖本地暂存区的内容,
|
|
134
|
+
* 破坏 git variant 的可复现语义;空 spec(`git:HEAD:`)会退化去探 `.md`/`SKILL.md` 误命中。
|
|
135
|
+
*/
|
|
136
|
+
export function parseGitInput(input) {
|
|
137
|
+
const parts = input.slice('git:'.length).split(':');
|
|
138
|
+
const { ref, spec } = parts.length === 1
|
|
139
|
+
? { ref: 'HEAD', spec: parts[0] }
|
|
140
|
+
: { ref: parts[0], spec: parts.slice(1).join(':') };
|
|
141
|
+
if (!ref || !spec)
|
|
142
|
+
return null;
|
|
143
|
+
return { ref, spec };
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* 把 git spec 解析成 dir / file skill —— **install 与 eval 共用此一处**,保证两条路径对同一
|
|
147
|
+
* `git:<ref>:<spec>` 的 file-vs-dir 归类绝不发散(发散会让 eval 量文件、install 注册目录,
|
|
148
|
+
* 两边对不上)。接受三种写法,与本地路径安装对称:
|
|
149
|
+
* - 显式 SKILL.md:`skills/dir/SKILL.md` → 目录-skill,name 取父目录名;
|
|
150
|
+
* - 显式 .md:`skills/foo.md` → 文件-skill;
|
|
151
|
+
* - 裸 spec:`skills/review` → **文件优先**(先试 `<spec>.md`,再试 `<spec>/SKILL.md`)。
|
|
152
|
+
* 裸 spec 的文件优先必须与 eval 历史顺序一致 —— 否则同名同时存在 .md 与 dir/SKILL.md 时,
|
|
153
|
+
* eval 量文件、install 注册目录,evidence 读时按 hash 门控被静默剥离、记录永久 stale。
|
|
154
|
+
* `gitRelDir` 是各调用方的解析基准(install=cwd 相对仓库根、eval=skillDir 相对仓库根),作为显式
|
|
155
|
+
* 参数传入,基准差异留给调用方、归类逻辑单一来源。任一探测命中即返回;都不中返回 null。
|
|
156
|
+
*/
|
|
157
|
+
export function classifyGitSkillRef(ref, gitRelDir, spec, cwd = process.cwd()) {
|
|
158
|
+
if (basename(spec) === 'SKILL.md') {
|
|
159
|
+
if (gitShowFile(ref, gitJoin(gitRelDir, spec), cwd) === null)
|
|
160
|
+
return null;
|
|
161
|
+
const dirSpec = dirname(spec);
|
|
162
|
+
const treePath = dirSpec === '.' ? gitRelDir : gitJoin(gitRelDir, dirSpec);
|
|
163
|
+
let name = basename(dirSpec);
|
|
164
|
+
if (name === '.' || name === '')
|
|
165
|
+
name = basename(treePath) || basename(gitRelDir) || 'skill';
|
|
166
|
+
return { isDir: true, treePath, fileSkillPath: '', name };
|
|
167
|
+
}
|
|
168
|
+
if (/\.md$/i.test(spec)) {
|
|
169
|
+
const fileSkillPath = gitJoin(gitRelDir, spec);
|
|
170
|
+
if (gitShowFile(ref, fileSkillPath, cwd) === null)
|
|
171
|
+
return null;
|
|
172
|
+
return { isDir: false, treePath: '', fileSkillPath, name: basename(spec).replace(/\.md$/i, '') };
|
|
173
|
+
}
|
|
174
|
+
if (gitShowFile(ref, gitJoin(gitRelDir, `${spec}.md`), cwd) !== null) {
|
|
175
|
+
return { isDir: false, treePath: '', fileSkillPath: gitJoin(gitRelDir, `${spec}.md`), name: basename(spec) };
|
|
176
|
+
}
|
|
177
|
+
if (gitShowFile(ref, gitJoin(gitJoin(gitRelDir, spec), 'SKILL.md'), cwd) !== null) {
|
|
178
|
+
return { isDir: true, treePath: gitJoin(gitRelDir, spec), fileSkillPath: '', name: basename(spec) };
|
|
179
|
+
}
|
|
180
|
+
return null;
|
|
51
181
|
}
|
|
52
182
|
export function discoverVariants(skillDir) {
|
|
53
183
|
if (!existsSync(skillDir))
|
|
@@ -82,9 +212,14 @@ export function discoverBatchSkills(skillDir) {
|
|
|
82
212
|
const mdMatch = entry.endsWith('.md') && !entry.endsWith('.eval-samples.json');
|
|
83
213
|
if (mdMatch) {
|
|
84
214
|
const name = entry.slice(0, -3);
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
215
|
+
const candidates = [
|
|
216
|
+
join(skillDir, name, '.omk'),
|
|
217
|
+
join(skillDir, `${name}.eval-samples.json`),
|
|
218
|
+
join(skillDir, `${name}.eval-samples.yaml`),
|
|
219
|
+
join(skillDir, `${name}.eval-samples.yml`),
|
|
220
|
+
].filter(existsSync);
|
|
221
|
+
if (candidates.length > 0) {
|
|
222
|
+
skills.push({ name, skillPath: join(skillDir, entry), samplesPath: candidates[0] });
|
|
88
223
|
}
|
|
89
224
|
else {
|
|
90
225
|
warned.push(name);
|
|
@@ -93,11 +228,21 @@ export function discoverBatchSkills(skillDir) {
|
|
|
93
228
|
}
|
|
94
229
|
if (statSync(entryPath).isDirectory()) {
|
|
95
230
|
const skillMd = join(entryPath, 'SKILL.md');
|
|
96
|
-
|
|
97
|
-
|
|
231
|
+
if (!existsSync(skillMd))
|
|
232
|
+
continue;
|
|
233
|
+
// .omk/ dir (loadSamples handles dir mode) > .omk/samples.json > eval-samples.{json,yaml,yml}
|
|
234
|
+
const omkDir = join(entryPath, '.omk');
|
|
235
|
+
const candidates = [
|
|
236
|
+
...(existsSync(omkDir) ? [omkDir] : []),
|
|
237
|
+
join(entryPath, 'eval-samples.json'),
|
|
238
|
+
join(entryPath, 'eval-samples.yaml'),
|
|
239
|
+
join(entryPath, 'eval-samples.yml'),
|
|
240
|
+
];
|
|
241
|
+
const samplesPath = candidates.find(existsSync);
|
|
242
|
+
if (samplesPath) {
|
|
98
243
|
skills.push({ name: entry, skillPath: skillMd, samplesPath });
|
|
99
244
|
}
|
|
100
|
-
else
|
|
245
|
+
else {
|
|
101
246
|
warned.push(entry);
|
|
102
247
|
}
|
|
103
248
|
}
|
|
@@ -116,20 +261,104 @@ export function loadSkills(skillDir, variants) {
|
|
|
116
261
|
* Format: "name@/path/to/cwd" or just "name"
|
|
117
262
|
*/
|
|
118
263
|
export function parseVariantCwd(variant) {
|
|
119
|
-
|
|
264
|
+
// 找 name@cwd 的切分点:跳过 git 修订语法里的 `@{...}`(reflog `HEAD@{2}`、upstream
|
|
265
|
+
// `main@{u}`),取第一个不是紧跟 `{` 的 `@`。这样 `git:v1@/proj`(git artifact + cwd,
|
|
266
|
+
// eval.yaml 经 configVariantsToSpecs 生成的形态)仍能切出 cwd,而 `git:HEAD@{2}:x`
|
|
267
|
+
// (无 cwd)不会被误拆成 name=`git:HEAD`、cwd=`{2}:x` → 下游静默评测错版本。
|
|
268
|
+
let atIdx = -1;
|
|
269
|
+
for (let i = variant.indexOf('@'); i !== -1; i = variant.indexOf('@', i + 1)) {
|
|
270
|
+
if (variant[i + 1] !== '{') {
|
|
271
|
+
atIdx = i;
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
120
275
|
if (atIdx === -1)
|
|
121
276
|
return { name: variant };
|
|
122
277
|
return { name: variant.slice(0, atIdx), cwd: variant.slice(atIdx + 1) };
|
|
123
278
|
}
|
|
279
|
+
/** 把一个路径折叠到稳定的 skill 锚点:目录型 skill 与其 `SKILL.md` 归一到同一个
|
|
280
|
+
* `dir/SKILL.md`,单文件 .md 用其路径本身。返回路径(不解物理身份),供取短名与身份判重共用。 */
|
|
281
|
+
function canonicalSkillAnchor(absPath) {
|
|
282
|
+
return existsSync(absPath) && statSync(absPath).isDirectory() ? join(absPath, 'SKILL.md') : absPath;
|
|
283
|
+
}
|
|
284
|
+
/** 路径的稳定物理身份:存在则取 `dev:ino`(解符号链接、折叠大小写不敏感卷的等价写法、认硬链),
|
|
285
|
+
* 不存在则退回原路径串。判重必须用物理身份——纯字符串 resolve 会把同一文件的软链/大小写/
|
|
286
|
+
* 绝对 vs CWD 相对写法判成两个 variant,放过真重复 → 同一份 skill 自比、悄悄废掉对比保护。 */
|
|
287
|
+
function pathPhysicalId(p) {
|
|
288
|
+
try {
|
|
289
|
+
const st = statSync(p);
|
|
290
|
+
return `ino:${st.dev}:${st.ino}`;
|
|
291
|
+
}
|
|
292
|
+
catch {
|
|
293
|
+
return p;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
/** 把一个 variant 表达式规范化成稳定的物理身份,用于「同一 variant 不能既是 control 又是
|
|
297
|
+
* treatment」的判重。同一份 skill 的不同写法必须折叠成同一个 key:
|
|
298
|
+
* - `./x.md` 与 `x.md`、符号链接、大小写不敏感卷上的等价写法:resolve 后取 `dev:ino` 物理身份。
|
|
299
|
+
* - 目录 `dir` 与 `dir/SKILL.md`:先折叠到同一锚点再取物理身份。
|
|
300
|
+
* - 裸短名(传了 `skillDir` 时):按 resolveArtifacts 的解析基准(`skillDir/name.md` 或
|
|
301
|
+
* `skillDir/name/SKILL.md`)取物理身份,这样裸名 `greeter` 与指向同一文件的 `./greeter.md`
|
|
302
|
+
* 能判为重复;没传 skillDir(如纯单测)则退回字面名。
|
|
303
|
+
* - `git:` / `baseline`:本身就是稳定标识,原样返回。
|
|
304
|
+
* 结构化的 `cwd`(第三参数)按物理身份纳入 key —— 同一份 skill 绑不同 cwd 是不同 runtime
|
|
305
|
+
* context,不算重复。不要用派生短名判重:`v1/greeter.md` 与 `v2/greeter.md` 短名都是 greeter
|
|
306
|
+
* 却是两个 variant。 */
|
|
307
|
+
export function variantIdentity(expr, skillDir, cwd) {
|
|
308
|
+
// expr 已是纯 artifact 身份(@cwd 在 CLI/config 边界已剥离);cwd 结构化显式传入。
|
|
309
|
+
const name = expr;
|
|
310
|
+
let id;
|
|
311
|
+
if (name.startsWith('git:')) {
|
|
312
|
+
id = name;
|
|
313
|
+
}
|
|
314
|
+
else if (name === 'baseline') {
|
|
315
|
+
id = 'baseline';
|
|
316
|
+
}
|
|
317
|
+
else if (name.includes('/') || /\.md$/i.test(name)) {
|
|
318
|
+
id = pathPhysicalId(canonicalSkillAnchor(resolve(name)));
|
|
319
|
+
}
|
|
320
|
+
else if (skillDir) {
|
|
321
|
+
// 裸短名按 resolveArtifacts 的同一基准(skillDir/name.md 或 skillDir/name/SKILL.md)解析,
|
|
322
|
+
// 命不中就退回字面名(resolveArtifacts 随后会报 not found)。
|
|
323
|
+
const md = join(skillDir, `${name}.md`);
|
|
324
|
+
const dirMd = join(skillDir, name, 'SKILL.md');
|
|
325
|
+
id = existsSync(md) ? pathPhysicalId(md) : existsSync(dirMd) ? pathPhysicalId(dirMd) : name;
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
id = name; // 无 skillDir 上下文:不同短名即不同 variant
|
|
329
|
+
}
|
|
330
|
+
return cwd ? `${id}@${pathPhysicalId(resolve(cwd))}` : id;
|
|
331
|
+
}
|
|
332
|
+
/** 从已解析的 skill 路径取短名:`SKILL.md` 取其父目录名,否则取去掉 `.md` 后缀的 basename。
|
|
333
|
+
* `variantExprToSkillName`(expr → 短名)与 `resolveArtifacts` 的 file-path 命名共用这一处,
|
|
334
|
+
* 避免两份各写一遍后悄悄发散——report 键就来自 resolveArtifacts 这一支。 */
|
|
335
|
+
export function skillNameFromPath(filePath) {
|
|
336
|
+
const base = basename(filePath);
|
|
337
|
+
return base === 'SKILL.md' ? basename(dirname(filePath)) : base.replace(/\.md$/i, '');
|
|
338
|
+
}
|
|
339
|
+
/** 从 variant 表达式(纯 artifact 身份,可能是路径)取短名。 */
|
|
340
|
+
export function variantExprToSkillName(expr) {
|
|
341
|
+
if (expr.startsWith('git:'))
|
|
342
|
+
return expr;
|
|
343
|
+
if (!expr.includes('/'))
|
|
344
|
+
return expr;
|
|
345
|
+
// 先折叠 dir↔SKILL.md 再取短名,与 resolveArtifacts 的命名一致(否则 `weird.md/` 这类
|
|
346
|
+
// 以 .md 结尾的目录,两处会派生出不同短名)。
|
|
347
|
+
return skillNameFromPath(canonicalSkillAnchor(resolve(expr))) || expr;
|
|
348
|
+
}
|
|
124
349
|
export function resolveArtifacts(skillDir, variants, opts = {}) {
|
|
125
350
|
const strictBaseline = opts.strictBaseline ?? true;
|
|
126
|
-
const variantAllowedSkills = opts.variantAllowedSkills ?? {};
|
|
127
351
|
const artifacts = [];
|
|
128
|
-
let
|
|
352
|
+
let gitCtx = null;
|
|
129
353
|
for (const rawVariant of variants) {
|
|
130
|
-
|
|
354
|
+
// 字符串即纯 expr(无 cwd);结构化对象直接取 expr/cwd。不再 split @cwd。
|
|
355
|
+
const variantName = typeof rawVariant === 'string' ? rawVariant : rawVariant.expr;
|
|
356
|
+
const variantCwd = typeof rawVariant === 'string' ? undefined : rawVariant.cwd;
|
|
357
|
+
if (!variantName) {
|
|
358
|
+
throw new Error(`variant 名不能为空。如需绑定 runtime context,用 --control-cwd / --treatment-cwd 或 eval.yaml 的 variant.cwd。`);
|
|
359
|
+
}
|
|
131
360
|
if (variantName === 'baseline' && variantCwd) {
|
|
132
|
-
throw new Error('baseline cannot be bound to a cwd. To express a project-level runtime context, use a custom label
|
|
361
|
+
throw new Error('baseline cannot be bound to a cwd. To express a project-level runtime context, use a custom label + cwd (e.g. --treatment project-env --treatment-cwd /path).');
|
|
133
362
|
}
|
|
134
363
|
if (variantName === 'baseline') {
|
|
135
364
|
artifacts.push({
|
|
@@ -142,21 +371,21 @@ export function resolveArtifacts(skillDir, variants, opts = {}) {
|
|
|
142
371
|
continue;
|
|
143
372
|
}
|
|
144
373
|
if (variantName.startsWith('git:')) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if (
|
|
149
|
-
ref
|
|
150
|
-
name = parts[0];
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
ref = parts[0];
|
|
154
|
-
name = parts.slice(1).join(':');
|
|
374
|
+
// 与 install 共用 parseGitInput:空 ref(`git::x`,会被 git 当 index 量本地暂存区、不可复取)/
|
|
375
|
+
// 空 spec(`git:HEAD:`)一律拒,守住 git variant 的可复现语义。
|
|
376
|
+
const parsed = parseGitInput(variantName);
|
|
377
|
+
if (!parsed) {
|
|
378
|
+
throw new Error(`无效的 git variant "${variantName}":ref 与 skill 名都不能为空,应为 git:<ref>:<name>(如 git:HEAD:review)。`);
|
|
155
379
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
380
|
+
const { ref, spec: name } = parsed;
|
|
381
|
+
// git 上下文锚定 skillDir 所属仓库(不是进程 cwd):从别处调用、skillDir 在另一个 repo 时也对。
|
|
382
|
+
if (!gitCtx)
|
|
383
|
+
gitCtx = resolveGitRepoContext(skillDir);
|
|
384
|
+
// file-vs-dir 归类与 install 共用 classifyGitSkillRef(裸 spec 文件优先),两条路径绝不发散。
|
|
385
|
+
const resolved = classifyGitSkillRef(ref, gitCtx.relDir, name, gitCtx.repoRoot);
|
|
386
|
+
const content = resolved
|
|
387
|
+
? (resolved.isDir ? gitShowFile(ref, gitJoin(resolved.treePath, 'SKILL.md'), gitCtx.repoRoot) : gitShowFile(ref, resolved.fileSkillPath, gitCtx.repoRoot))
|
|
388
|
+
: null;
|
|
160
389
|
if (!content) {
|
|
161
390
|
throw new Error(`skill not found in git ${ref}: ${name}.md or ${name}/SKILL.md`);
|
|
162
391
|
}
|
|
@@ -176,7 +405,6 @@ export function resolveArtifacts(skillDir, variants, opts = {}) {
|
|
|
176
405
|
if (!existsSync(filePath)) {
|
|
177
406
|
throw new Error(`skill file not found: ${filePath}`);
|
|
178
407
|
}
|
|
179
|
-
// If path is a directory, look for SKILL.md inside it
|
|
180
408
|
if (statSync(filePath).isDirectory()) {
|
|
181
409
|
const skillMd = join(filePath, 'SKILL.md');
|
|
182
410
|
if (!existsSync(skillMd)) {
|
|
@@ -185,10 +413,10 @@ export function resolveArtifacts(skillDir, variants, opts = {}) {
|
|
|
185
413
|
filePath = skillMd;
|
|
186
414
|
}
|
|
187
415
|
const content = readFileSync(filePath, 'utf-8').trim();
|
|
188
|
-
// 用户直接指 SKILL.md 等同 directory-skill 约定:cwd 默认锚到该目录
|
|
189
416
|
const isSkillMd = basename(filePath) === 'SKILL.md';
|
|
417
|
+
const name = skillNameFromPath(filePath);
|
|
190
418
|
artifacts.push({
|
|
191
|
-
name
|
|
419
|
+
name,
|
|
192
420
|
kind: 'skill',
|
|
193
421
|
source: 'file-path',
|
|
194
422
|
content,
|
|
@@ -241,21 +469,73 @@ export function resolveArtifacts(skillDir, variants, opts = {}) {
|
|
|
241
469
|
throw new Error(`skill not found: ${mdPath} or ${dirSkillPath}`);
|
|
242
470
|
}
|
|
243
471
|
}
|
|
244
|
-
// Skill-isolation
|
|
245
|
-
//
|
|
246
|
-
//
|
|
247
|
-
//
|
|
472
|
+
// Skill-isolation:resolveArtifacts 只负责 strictBaseline 默认——strictBaseline=true 时
|
|
473
|
+
// 所有 kind:'baseline' artifact 默认 allowedSkills=[];否则保持 undefined → SDK 全量发现。
|
|
474
|
+
// per-variant 显式隔离声明(eval.yaml variants[].allowedSkills)统一走 spec.allowedSkills,
|
|
475
|
+
// 由 prepareEvaluationRun 按 spec 身份绑定;batch 的 eval.yaml allowedSkills 也已在
|
|
476
|
+
// buildBatchVariantSpecs 处挂到 spec 上。隔离绑定收成单一来源,这里不再按名查。
|
|
248
477
|
for (const artifact of artifacts) {
|
|
249
|
-
const explicit = variantAllowedSkills[artifact.name];
|
|
250
|
-
if (explicit !== undefined) {
|
|
251
|
-
artifact.allowedSkills = explicit;
|
|
252
|
-
continue;
|
|
253
|
-
}
|
|
254
478
|
if (strictBaseline && artifact.kind === 'baseline') {
|
|
255
479
|
artifact.allowedSkills = [];
|
|
256
480
|
}
|
|
257
|
-
// else leave undefined → SDK default (full discovery)
|
|
258
481
|
}
|
|
482
|
+
ensureUniqueVariantNames(artifacts);
|
|
259
483
|
return artifacts;
|
|
260
484
|
}
|
|
261
|
-
|
|
485
|
+
/** variant 短名的消歧路径:取「短名所源自的那一段」所在的完整路径,用来逐段往前限定。
|
|
486
|
+
* - dir/SKILL.md 或 dir-variant:skillRoot(= 那个 skill 目录,basename 即短名)
|
|
487
|
+
* - 单文件 .md:locator 去掉 .md(basename 即短名)
|
|
488
|
+
* - baseline / git variant:无可用路径(git 名本就唯一,baseline 不参与对比键),返回 null。 */
|
|
489
|
+
function identityPathOf(a) {
|
|
490
|
+
if (a.kind !== 'skill' || a.source === 'git' || !a.locator)
|
|
491
|
+
return null;
|
|
492
|
+
return a.skillRoot ?? a.locator.replace(/\.md$/i, '');
|
|
493
|
+
}
|
|
494
|
+
/** 消歧:多个 variant resolve 出同名时(如 `v1/greeter.md` vs `v2/greeter.md` 都叫 `greeter`),
|
|
495
|
+
* 用父目录逐段限定恢复唯一性。否则 `results[sample][variant]` / `summary[variant]` 按 name 键时
|
|
496
|
+
* 后写覆盖前写,把对照 / 实验组的结果搅在一起、verdict 拿同名跟自己比 —— 静默破坏对比可信度。
|
|
497
|
+
* 没有可用路径(baseline / git)时退化加 `#n` 序号兜底,保证返回的 name 一定两两不同。 */
|
|
498
|
+
export function ensureUniqueVariantNames(artifacts) {
|
|
499
|
+
const groups = new Map();
|
|
500
|
+
for (const a of artifacts) {
|
|
501
|
+
const g = groups.get(a.name);
|
|
502
|
+
if (g)
|
|
503
|
+
g.push(a);
|
|
504
|
+
else
|
|
505
|
+
groups.set(a.name, [a]);
|
|
506
|
+
}
|
|
507
|
+
if (![...groups.values()].some((g) => g.length > 1))
|
|
508
|
+
return; // 无冲突,常见路径直接返回
|
|
509
|
+
const used = new Set();
|
|
510
|
+
for (const [name, g] of groups)
|
|
511
|
+
if (g.length === 1)
|
|
512
|
+
used.add(name);
|
|
513
|
+
for (const [name, g] of groups) {
|
|
514
|
+
if (g.length === 1)
|
|
515
|
+
continue;
|
|
516
|
+
// 找能让组内全部区分、又不撞已用名的最小段深,组内统一用同一深度 → 对称标签(v1/greeter 对 v2/greeter)
|
|
517
|
+
const segLists = g.map((a) => {
|
|
518
|
+
const p = identityPathOf(a);
|
|
519
|
+
return p ? p.split(/[\\/]+/).filter(Boolean) : null;
|
|
520
|
+
});
|
|
521
|
+
const maxDepth = Math.max(0, ...segLists.map((s) => s?.length ?? 0));
|
|
522
|
+
let chosen = null;
|
|
523
|
+
for (let take = 2; take <= maxDepth; take++) {
|
|
524
|
+
const cands = segLists.map((s) => (s && s.length >= take ? s.slice(-take).join('/') : null));
|
|
525
|
+
if (cands.includes(null))
|
|
526
|
+
continue;
|
|
527
|
+
if (new Set(cands).size === cands.length && cands.every((c) => !used.has(c))) {
|
|
528
|
+
chosen = cands;
|
|
529
|
+
break;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
g.forEach((a, i) => {
|
|
533
|
+
const candidate = chosen ? chosen[i] : name; // 无可用路径(baseline 等)退化到原名 + #n 序号
|
|
534
|
+
let unique = candidate;
|
|
535
|
+
for (let n = 2; used.has(unique); n++)
|
|
536
|
+
unique = `${candidate}#${n}`;
|
|
537
|
+
a.name = unique;
|
|
538
|
+
used.add(unique);
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 安装源解析器 —— 把"各种源"物化成统一的本地形态,让 install / managed 主干**源无关**。
|
|
3
|
+
* 新增一种源 = 加一个分支,install.ts 不动。本模块不依赖 CLI(不打印、不 tCli):错误以
|
|
4
|
+
* `SourceResolveError(messageKey)` 抛出,由调用方(install)映射成本地化文案。
|
|
5
|
+
*
|
|
6
|
+
* 当前支持:`file`(本地路径)、`git`(当前仓库的某个 ref)。远端 git / URL clone 留作后续,
|
|
7
|
+
* 沿同一 `ResolvedSource` 契约扩展即可。
|
|
8
|
+
*/
|
|
9
|
+
export type SourceKind = 'file' | 'git';
|
|
10
|
+
export interface ResolvedSource {
|
|
11
|
+
sourceKind: SourceKind;
|
|
12
|
+
/** 物化后的本地根:目录-skill 为目录、文件-skill 为 .md;喂 hashArtifactSource + 分发。 */
|
|
13
|
+
localRoot: string;
|
|
14
|
+
/** skill 短名(分发落点 / 记录 name)。 */
|
|
15
|
+
name: string;
|
|
16
|
+
isDirectorySkill: boolean;
|
|
17
|
+
/** 记录身份:file=绝对路径;git=`git:<ref>:<spec>`(非临时物化路径)。 */
|
|
18
|
+
locator: string;
|
|
19
|
+
ref?: string;
|
|
20
|
+
/** 释放临时资源(git 删临时目录);file 源为 noop。 */
|
|
21
|
+
cleanup: () => void;
|
|
22
|
+
}
|
|
23
|
+
export declare class SourceResolveError extends Error {
|
|
24
|
+
readonly messageKey: string;
|
|
25
|
+
readonly params: Record<string, string | number>;
|
|
26
|
+
constructor(messageKey: string, params?: Record<string, string | number>);
|
|
27
|
+
}
|
|
28
|
+
export declare function resolveInstallSource(input: string): ResolvedSource;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { existsSync, lstatSync, mkdirSync, mkdtempSync, realpathSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import { dirname, join, resolve, sep } from 'node:path';
|
|
4
|
+
import { isDistributablePath } from '../managed/index.js';
|
|
5
|
+
import { classifyGitSkillRef, parseGitInput, resolveGitRepoContext, gitJoin, gitLsTreeBlobs, gitShowBytes, skillNameFromPath } from './skill-loader.js';
|
|
6
|
+
export class SourceResolveError extends Error {
|
|
7
|
+
messageKey;
|
|
8
|
+
params;
|
|
9
|
+
constructor(messageKey, params = {}) {
|
|
10
|
+
super(messageKey);
|
|
11
|
+
this.name = 'SourceResolveError';
|
|
12
|
+
this.messageKey = messageKey;
|
|
13
|
+
this.params = params;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const noop = () => { };
|
|
17
|
+
/**
|
|
18
|
+
* 校验 git tree 条目路径在物化目标内,越界即 fail closed(抛 SourceResolveError)。
|
|
19
|
+
* 双保险:既显式拒 `..` / 空段(git tree 可被手工构造出名为 `..` 的子树),也用 resolve 兜底
|
|
20
|
+
* 确认落点仍在 temp 之下(绝对路径 / 符号化逃逸)。绝不静默跳过——跳过会让物化树与真实树发散。
|
|
21
|
+
*/
|
|
22
|
+
function assertContainedRelPath(temp, relPath) {
|
|
23
|
+
const segments = relPath.split('/');
|
|
24
|
+
if (segments.some((s) => s === '' || s === '.' || s === '..')) {
|
|
25
|
+
throw new SourceResolveError('cli.install.git_unsafe_path', { path: relPath });
|
|
26
|
+
}
|
|
27
|
+
const root = resolve(temp);
|
|
28
|
+
const dest = resolve(temp, relPath);
|
|
29
|
+
if (dest !== root && !dest.startsWith(root + sep)) {
|
|
30
|
+
throw new SourceResolveError('cli.install.git_unsafe_path', { path: relPath });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export function resolveInstallSource(input) {
|
|
34
|
+
if (input.startsWith('git:'))
|
|
35
|
+
return resolveGitSource(input);
|
|
36
|
+
return resolveFileSource(input);
|
|
37
|
+
}
|
|
38
|
+
function resolveFileSource(input) {
|
|
39
|
+
const abs = resolve(input);
|
|
40
|
+
if (!existsSync(abs))
|
|
41
|
+
throw new SourceResolveError('cli.install.path_not_found', { path: abs });
|
|
42
|
+
const isDir = statSync(abs).isDirectory();
|
|
43
|
+
if (isDir) {
|
|
44
|
+
const skillMd = join(abs, 'SKILL.md');
|
|
45
|
+
if (!existsSync(skillMd)) {
|
|
46
|
+
throw new SourceResolveError('cli.install.skillmd_missing', { path: abs });
|
|
47
|
+
}
|
|
48
|
+
// 软链 SKILL.md 会被分发跳过(与 git 物化、cpSync 的软链策略一致)→ 装出空壳。指向真源,让记录落在真源上。
|
|
49
|
+
if (lstatSync(skillMd).isSymbolicLink()) {
|
|
50
|
+
throw new SourceResolveError('cli.install.skillmd_is_symlink', { target: realpathSync(skillMd) });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (!isDir && !/\.md$/i.test(abs)) {
|
|
54
|
+
throw new SourceResolveError('cli.install.not_a_skill', { path: abs });
|
|
55
|
+
}
|
|
56
|
+
const name = isDir ? skillNameFromPath(join(abs, 'SKILL.md')) : skillNameFromPath(abs);
|
|
57
|
+
return { sourceKind: 'file', localRoot: abs, name, isDirectorySkill: isDir, locator: abs, cleanup: noop };
|
|
58
|
+
}
|
|
59
|
+
function resolveGitSource(input) {
|
|
60
|
+
// 空 spec / 空 ref 由共享 parseGitInput 拒(返回 null):空 ref(`git::x`)会被 git 当 index/stage-0
|
|
61
|
+
// 解析,破坏"可复现、可重取"的前提;eval 与 install 经同一 helper 判定一致。
|
|
62
|
+
const parsed = parseGitInput(input);
|
|
63
|
+
if (!parsed)
|
|
64
|
+
throw new SourceResolveError('cli.install.git_skill_not_found', { ref: '', name: input });
|
|
65
|
+
const { ref, spec } = parsed;
|
|
66
|
+
let ctx;
|
|
67
|
+
try {
|
|
68
|
+
ctx = resolveGitRepoContext(resolve('.'));
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
throw new SourceResolveError('cli.install.not_a_git_repo', {});
|
|
72
|
+
}
|
|
73
|
+
const resolved = classifyGitSkillRef(ref, ctx.relDir, spec, ctx.repoRoot);
|
|
74
|
+
if (!resolved) {
|
|
75
|
+
throw new SourceResolveError('cli.install.git_skill_not_found', { ref, name: spec });
|
|
76
|
+
}
|
|
77
|
+
const temp = mkdtempSync(join(tmpdir(), 'omk-install-git-'));
|
|
78
|
+
const cleanup = () => {
|
|
79
|
+
try {
|
|
80
|
+
rmSync(temp, { recursive: true, force: true });
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
// 临时目录清理失败不致命
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
try {
|
|
87
|
+
const locator = `git:${ref}:${spec}`;
|
|
88
|
+
if (resolved.isDir) {
|
|
89
|
+
for (const entry of gitLsTreeBlobs(ref, resolved.treePath, ctx.repoRoot)) {
|
|
90
|
+
// 安全边界 fail closed:git tree 可被 git mktree 手工构造出名为 `..` 的子树,`ls-tree -r` 会
|
|
91
|
+
// 吐 `../evil.txt`,`join(temp, ...)` 会逃出临时目录写盘、cleanup 也删不掉。任一越界路径(.. /
|
|
92
|
+
// 绝对路径 / 空段 / 解析后不在 temp 内)直接抛错,而非静默跳过——静默跳过会让物化树与真实
|
|
93
|
+
// git tree / hash / 分发树发散。正常 checkout 永不触发。
|
|
94
|
+
assertContainedRelPath(temp, entry.path);
|
|
95
|
+
if (entry.mode === '120000' || entry.mode === '160000')
|
|
96
|
+
continue; // 跳过软链 / submodule(与本地分发一致)
|
|
97
|
+
if (!isDistributablePath(entry.path.split('/')))
|
|
98
|
+
continue; // 排除 .omk/.git/evolve 等
|
|
99
|
+
const bytes = gitShowBytes(ref, gitJoin(resolved.treePath, entry.path), ctx.repoRoot);
|
|
100
|
+
if (!bytes)
|
|
101
|
+
continue;
|
|
102
|
+
const dest = join(temp, entry.path);
|
|
103
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
104
|
+
// 保留可执行位(与本地 cpSync 一致);其余 0644。
|
|
105
|
+
writeFileSync(dest, bytes, { mode: entry.mode === '100755' ? 0o755 : 0o644 });
|
|
106
|
+
}
|
|
107
|
+
// 纵深防御:classify 与物化用的是两条 git 路径(gitShowFile vs ls-tree),万一发散(如 treePath 退化)
|
|
108
|
+
// 导致空树,这里失败而非静默分发一个空 skill。
|
|
109
|
+
if (!existsSync(join(temp, 'SKILL.md'))) {
|
|
110
|
+
throw new SourceResolveError('cli.install.git_skill_not_found', { ref, name: spec });
|
|
111
|
+
}
|
|
112
|
+
return { sourceKind: 'git', localRoot: temp, name: resolved.name, isDirectorySkill: true, locator, ref, cleanup };
|
|
113
|
+
}
|
|
114
|
+
const bytes = gitShowBytes(ref, resolved.fileSkillPath, ctx.repoRoot);
|
|
115
|
+
if (!bytes)
|
|
116
|
+
throw new SourceResolveError('cli.install.git_skill_not_found', { ref, name: spec });
|
|
117
|
+
const dest = join(temp, `${resolved.name}.md`);
|
|
118
|
+
writeFileSync(dest, bytes);
|
|
119
|
+
return { sourceKind: 'git', localRoot: dest, name: resolved.name, isDirectorySkill: false, locator, ref, cleanup };
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
cleanup();
|
|
123
|
+
throw err;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -16,4 +16,3 @@ export declare function isPlaceholderUrl(url: string): boolean;
|
|
|
16
16
|
* @param skipUrls - URLs already resolved (e.g. by MCP), will be skipped
|
|
17
17
|
*/
|
|
18
18
|
export declare function resolveUrls(samples: Sample[], skipUrls?: Set<string>): Promise<void>;
|
|
19
|
-
//# sourceMappingURL=url-fetcher.d.ts.map
|