oh-my-knowledge 0.33.0 → 0.35.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 +21 -5
- package/README.zh.md +25 -9
- 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 +0 -1
- package/dist/analysis/saturation.js +0 -1
- package/dist/assets/agent-skills/omk/SKILL.md +197 -0
- package/dist/assets/agent-skills/omk/references/commands.md +556 -0
- package/dist/authoring/evolver.d.ts +130 -6
- package/dist/authoring/evolver.js +233 -35
- package/dist/authoring/generator.d.ts +0 -1
- package/dist/authoring/generator.js +0 -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 +0 -1
- package/dist/cli/commands/doctor.js +2 -3
- 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 +3 -1
- package/dist/cli/commands/eval/index.js +56 -11
- package/dist/cli/commands/evolve.d.ts +6 -1
- package/dist/cli/commands/evolve.js +77 -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 +24 -0
- package/dist/cli/commands/install.js +436 -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 +0 -1
- 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 +1 -2
- package/dist/cli/commands/sample.js +27 -15
- 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 +7 -1
- package/dist/cli/lib/cmd-flags.js +0 -1
- package/dist/cli/lib/i18n-dict/common.d.ts +0 -1
- package/dist/cli/lib/i18n-dict/common.js +0 -1
- package/dist/cli/lib/i18n-dict/evolve.d.ts +1 -2
- package/dist/cli/lib/i18n-dict/evolve.js +16 -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 +110 -0
- package/dist/cli/lib/i18n-dict/run.d.ts +1 -2
- package/dist/cli/lib/i18n-dict/run.js +8 -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 +0 -1
- package/dist/cli/lib/parse-run-config/variant-resolution.js +41 -8
- 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 +0 -1
- 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 +0 -1
- package/dist/cli/lib/update-check.js +0 -1
- package/dist/cli/lib/update-fetch-worker.d.ts +0 -1
- package/dist/cli/lib/update-fetch-worker.js +0 -1
- 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 +0 -1
- package/dist/doctor/health/load-custom-dimensions.js +0 -1
- 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 +6 -7
- 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 +0 -1
- package/dist/eval-core/bootstrap.js +0 -1
- package/dist/eval-core/cache.d.ts +11 -4
- package/dist/eval-core/cache.js +13 -6
- 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 +5 -3
- package/dist/eval-core/evaluation-execution.d.ts +0 -1
- package/dist/eval-core/evaluation-execution.js +4 -2
- 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 +18 -8
- package/dist/eval-core/execution-strategy.d.ts +0 -1
- package/dist/eval-core/execution-strategy.js +8 -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 +2 -2
- package/dist/eval-core/verdict.d.ts +0 -1
- package/dist/eval-core/verdict.js +0 -1
- 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 +22 -44
- 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 +3 -8
- package/dist/eval-workflows/run-evaluation.js +9 -19
- 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/content-hash.d.ts +28 -0
- package/dist/inputs/content-hash.js +106 -0
- package/dist/inputs/eval-config.d.ts +0 -1
- package/dist/inputs/eval-config.js +44 -11
- package/dist/inputs/load-samples.d.ts +0 -1
- package/dist/inputs/load-samples.js +0 -1
- package/dist/inputs/materialize-copy.d.ts +37 -0
- package/dist/inputs/materialize-copy.js +193 -0
- package/dist/inputs/mcp-resolver.d.ts +0 -1
- package/dist/inputs/mcp-resolver.js +0 -1
- package/dist/inputs/skill-loader.d.ts +145 -12
- package/dist/inputs/skill-loader.js +476 -60
- package/dist/inputs/source-resolver.d.ts +35 -0
- package/dist/inputs/source-resolver.js +105 -0
- package/dist/inputs/url-fetcher.d.ts +0 -1
- package/dist/inputs/url-fetcher.js +0 -1
- package/dist/managed/evidence.d.ts +22 -0
- package/dist/managed/evidence.js +143 -0
- package/dist/managed/index.d.ts +6 -0
- package/dist/managed/index.js +6 -0
- package/dist/managed/store.d.ts +72 -0
- package/dist/managed/store.js +224 -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 +0 -1
- package/dist/observability/skill-health-analyzer.js +0 -1
- 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 -3
- 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 +3 -4
- package/dist/renderer/skill-health-renderer.d.ts +0 -1
- package/dist/renderer/skill-health-renderer.js +0 -1
- package/dist/renderer/skill-list-renderer.d.ts +0 -1
- package/dist/renderer/skill-list-renderer.js +0 -1
- package/dist/renderer/summary.d.ts +0 -1
- package/dist/renderer/summary.js +1 -2
- 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 +1 -2
- 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 +4 -5
- package/dist/server/skill-insights.d.ts +0 -1
- package/dist/server/skill-insights.js +8 -9
- 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 +13 -2
- 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 +110 -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 +19 -6
- 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 +0 -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 +9 -4
- 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/lib/update-fetch-worker.d.ts.map +0 -1
- package/dist/cli/lib/update-fetch-worker.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/load-custom-dimensions.d.ts.map +0 -1
- package/dist/doctor/health/load-custom-dimensions.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,7 +1,10 @@
|
|
|
1
|
-
import { readFileSync, existsSync, readdirSync, statSync } from 'node:fs';
|
|
2
|
-
import { resolve, join, relative, dirname, basename } from 'node:path';
|
|
1
|
+
import { readFileSync, existsSync, readdirSync, statSync, realpathSync, mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';
|
|
2
|
+
import { resolve, join, relative, dirname, basename, sep } from 'node:path';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
3
4
|
import { execFileSync } from 'node:child_process';
|
|
4
5
|
import { extractSkillHardRules, extractSkillWorkflows } from '../shared/hard-rules.js';
|
|
6
|
+
import { hashArtifactSource, hashBytes, isDistributablePath } from './content-hash.js';
|
|
7
|
+
import { materializeIsolatedCopy } from './materialize-copy.js';
|
|
5
8
|
function parseFrontmatterPreflight(content) {
|
|
6
9
|
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
7
10
|
if (!match)
|
|
@@ -37,17 +40,299 @@ function buildMetadata(content) {
|
|
|
37
40
|
metadata.workflows = workflows;
|
|
38
41
|
return Object.keys(metadata).length > 0 ? metadata : undefined;
|
|
39
42
|
}
|
|
40
|
-
|
|
43
|
+
// 这些是**探测**(尝试某路径是否存在),miss 是正常流程,不是错误 → 吞掉 git 的 `fatal:` stderr,
|
|
44
|
+
// 否则一次成功的 install/eval 也会在用户终端打印吓人的 `fatal: path ... does not exist`。
|
|
45
|
+
const GIT_PROBE_STDIO = ['ignore', 'pipe', 'ignore'];
|
|
46
|
+
// 用 `cat-file blob` 而非 `git show`:`git show <ref>:<目录>` 对**目录**会退出码 0 并打印树清单
|
|
47
|
+
// (`tree <ref>:path\n\nSKILL.md`),被这里当成"文件存在 + 内容"误收 —— 名字以 .md 结尾的目录会被
|
|
48
|
+
// classify 误判为 file-skill、物化出树清单当 skill 正文,也会让 eval 把清单文本量成 skill 内容。
|
|
49
|
+
// `cat-file blob` 对非 blob(tree/submodule)直接非零退出,从根上只认 blob。对真 blob 字节与 show 一致。
|
|
50
|
+
// 所有 git helper 收 `cwd`(默认进程 cwd):git 解析必须在**目标仓库**里跑,否则 eval 从别处调用、
|
|
51
|
+
// skillDir 指向另一个 repo 时,会拿进程 cwd 的 repo 与 HEAD 去解析,轻则 not_found、重则评测错内容。
|
|
52
|
+
// 由 resolveGitRepoContext 解出 repoRoot 后逐处显式传入。
|
|
53
|
+
export function gitShowFile(ref, filePath, cwd = process.cwd()) {
|
|
41
54
|
try {
|
|
42
|
-
return execFileSync('git', ['
|
|
55
|
+
return execFileSync('git', ['cat-file', 'blob', `${ref}:${filePath}`], { cwd, encoding: 'utf-8', stdio: GIT_PROBE_STDIO }).trim();
|
|
43
56
|
}
|
|
44
57
|
catch {
|
|
45
58
|
return null;
|
|
46
59
|
}
|
|
47
60
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
/**
|
|
62
|
+
* 取 `<ref>:<filePath>` 的原始字节(二进制资产用,不做 utf-8 解码);不存在/非 blob/出错返回 null。
|
|
63
|
+
* 同 gitShowFile 用 `cat-file blob`:对目录会非零退出,不会把树清单字节当文件内容物化。
|
|
64
|
+
*/
|
|
65
|
+
export function gitShowBytes(ref, filePath, cwd = process.cwd()) {
|
|
66
|
+
try {
|
|
67
|
+
return execFileSync('git', ['cat-file', 'blob', `${ref}:${filePath}`], { cwd, stdio: GIT_PROBE_STDIO }); // 无 encoding → Buffer
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* 递归列出 `<ref>:<treePath>` 子树下的叶子条目(blob / 软链 / submodule)。tree 不存在返回 []。
|
|
75
|
+
* 用 `-z`(NUL 分隔):git 不会对含换行 / 非 ASCII 的路径做 C-quote,路径原样可回喂 git show。
|
|
76
|
+
* 用 `--full-tree`:treePath 是仓库根相对路径,不受当前 cwd 前缀限制 —— 否则在仓库子目录执行时
|
|
77
|
+
* `ls-tree HEAD:skills/review` 会返回空(而 gitShowFile 探测不受限,导致"探测命中→物化为空"的发散)。
|
|
78
|
+
* `treePath` 为空时列整棵根 tree(`<ref>:`)。
|
|
79
|
+
*/
|
|
80
|
+
export function gitLsTreeBlobs(ref, treePath, cwd = process.cwd()) {
|
|
81
|
+
let out;
|
|
82
|
+
try {
|
|
83
|
+
out = execFileSync('git', ['ls-tree', '-r', '-z', '--full-tree', `${ref}:${treePath}`], { cwd, encoding: 'utf-8', stdio: GIT_PROBE_STDIO });
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
88
|
+
const NUL = String.fromCharCode(0);
|
|
89
|
+
const entries = [];
|
|
90
|
+
for (const rec of out.split(NUL)) {
|
|
91
|
+
// 记录格式:`<mode> <type> <object>\t<path>`(path 可含换行,故用 [\s\S])。
|
|
92
|
+
const m = rec.match(/^(\d+) \S+ \S+\t([\s\S]*)$/);
|
|
93
|
+
if (m)
|
|
94
|
+
entries.push({ mode: m[1], path: m[2] });
|
|
95
|
+
}
|
|
96
|
+
return entries;
|
|
97
|
+
}
|
|
98
|
+
/** 从 p 起向上找最近的存在目录(skillDir 可能尚不在磁盘,但仍要定位它所属的 repo)。 */
|
|
99
|
+
function nearestExistingDir(p) {
|
|
100
|
+
let cur = resolve(p);
|
|
101
|
+
while (!existsSync(cur)) {
|
|
102
|
+
const parent = dirname(cur);
|
|
103
|
+
if (parent === cur)
|
|
104
|
+
break;
|
|
105
|
+
cur = parent;
|
|
106
|
+
}
|
|
107
|
+
return cur;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* 解出 `fromPath` 所属 git 仓库的上下文。**关键**:`git rev-parse` 在 `fromPath` 处执行(-C),
|
|
111
|
+
* 而非进程 cwd —— 否则 eval 从别处调用、skillDir 指向另一个 repo 时,会拿进程 cwd 的 repo root 和
|
|
112
|
+
* HEAD 去解析,轻则 not_found、重则评测错 repo 的同名内容。repoRoot / relDir 都 realpath 归一,
|
|
113
|
+
* 消除 /var ↔ /private/var 这类等价路径导致 relative 算错。不在 git 仓库时 rev-parse 抛错,由上层转
|
|
114
|
+
* not_a_git_repo。stderr 吞掉,不双重打印 `fatal:`。
|
|
115
|
+
*/
|
|
116
|
+
export function resolveGitRepoContext(fromPath) {
|
|
117
|
+
const absInput = resolve(fromPath);
|
|
118
|
+
const existing = nearestExistingDir(absInput);
|
|
119
|
+
const anchor = realpathSync(existing);
|
|
120
|
+
const repoRoot = realpathSync(execFileSync('git', ['-C', anchor, 'rev-parse', '--show-toplevel'], { encoding: 'utf-8', stdio: GIT_PROBE_STDIO }).trim());
|
|
121
|
+
// 对称归一:repoRoot 经 realpath,fromPath 也必须经同源 realpath,否则 fromPath 尚不在磁盘时
|
|
122
|
+
// (纯 git eval:skill 只在 HEAD、工作树已删)absFrom 保留未归一字面,在 macOS /var ↔ /private/var
|
|
123
|
+
// 这类等价路径上 relative 会算出越界的 `../../..` relDir → classify 探到仓库外 → 误报 not_found。
|
|
124
|
+
// 做法:realpath 最近存在祖先,再拼回尚不存在的尾段(尾段为空即 fromPath 本身存在)。
|
|
125
|
+
const tail = relative(existing, absInput);
|
|
126
|
+
const absFrom = tail ? join(anchor, tail) : anchor;
|
|
127
|
+
return { repoRoot, relDir: relative(repoRoot, absFrom) };
|
|
128
|
+
}
|
|
129
|
+
/** 拼 git 仓库相对路径:始终用 `/`,空 base 直接返回 b(避免 join 产生 `.` 这类退化 tree-ish)。 */
|
|
130
|
+
export function gitJoin(base, sub) {
|
|
131
|
+
return base ? `${base}/${sub}` : sub;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* 解析 `git:<ref>:<spec>` —— **install 与 eval 共用此一处**,保证两侧对 ref/spec 的切分与合法性
|
|
135
|
+
* 判定一致。`git:<spec>` 缺省 ref=HEAD;spec 可含 `/`(如 skills/review)。空 ref / 空 spec 都非法
|
|
136
|
+
* 并返回 null:空 ref(`git::x`)会被 git 当 index/stage-0 解析,量到不可复取、依赖本地暂存区的内容,
|
|
137
|
+
* 破坏 git variant 的可复现语义;空 spec(`git:HEAD:`)会退化去探 `.md`/`SKILL.md` 误命中。
|
|
138
|
+
*/
|
|
139
|
+
export function parseGitInput(input) {
|
|
140
|
+
const parts = input.slice('git:'.length).split(':');
|
|
141
|
+
const { ref, spec } = parts.length === 1
|
|
142
|
+
? { ref: 'HEAD', spec: parts[0] }
|
|
143
|
+
: { ref: parts[0], spec: parts.slice(1).join(':') };
|
|
144
|
+
if (!ref || !spec)
|
|
145
|
+
return null;
|
|
146
|
+
return { ref, spec };
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* 把 git spec 解析成 dir / file skill —— **install 与 eval 共用此一处**,保证两条路径对同一
|
|
150
|
+
* `git:<ref>:<spec>` 的 file-vs-dir 归类绝不发散(发散会让 eval 量文件、install 注册目录,
|
|
151
|
+
* 两边对不上)。接受三种写法,与本地路径安装对称:
|
|
152
|
+
* - 显式 SKILL.md:`skills/dir/SKILL.md` → 目录-skill,name 取父目录名;
|
|
153
|
+
* - 显式 .md:`skills/foo.md` → 文件-skill;
|
|
154
|
+
* - 裸 spec:`skills/review` → **文件优先**(先试 `<spec>.md`,再试 `<spec>/SKILL.md`)。
|
|
155
|
+
* 裸 spec 的文件优先必须与 eval 历史顺序一致 —— 否则同名同时存在 .md 与 dir/SKILL.md 时,
|
|
156
|
+
* eval 量文件、install 注册目录,evidence 读时按 hash 门控被静默剥离、记录永久 stale。
|
|
157
|
+
* `gitRelDir` 是各调用方的解析基准(install=cwd 相对仓库根、eval=skillDir 相对仓库根),作为显式
|
|
158
|
+
* 参数传入,基准差异留给调用方、归类逻辑单一来源。任一探测命中即返回;都不中返回 null。
|
|
159
|
+
*/
|
|
160
|
+
export function classifyGitSkillRef(ref, gitRelDir, spec, cwd = process.cwd()) {
|
|
161
|
+
if (basename(spec) === 'SKILL.md') {
|
|
162
|
+
if (gitShowFile(ref, gitJoin(gitRelDir, spec), cwd) === null)
|
|
163
|
+
return null;
|
|
164
|
+
const dirSpec = dirname(spec);
|
|
165
|
+
const treePath = dirSpec === '.' ? gitRelDir : gitJoin(gitRelDir, dirSpec);
|
|
166
|
+
let name = basename(dirSpec);
|
|
167
|
+
if (name === '.' || name === '')
|
|
168
|
+
name = basename(treePath) || basename(gitRelDir) || 'skill';
|
|
169
|
+
return { isDir: true, treePath, fileSkillPath: '', name };
|
|
170
|
+
}
|
|
171
|
+
if (/\.md$/i.test(spec)) {
|
|
172
|
+
const fileSkillPath = gitJoin(gitRelDir, spec);
|
|
173
|
+
if (gitShowFile(ref, fileSkillPath, cwd) === null)
|
|
174
|
+
return null;
|
|
175
|
+
return { isDir: false, treePath: '', fileSkillPath, name: basename(spec).replace(/\.md$/i, '') };
|
|
176
|
+
}
|
|
177
|
+
if (gitShowFile(ref, gitJoin(gitRelDir, `${spec}.md`), cwd) !== null) {
|
|
178
|
+
return { isDir: false, treePath: '', fileSkillPath: gitJoin(gitRelDir, `${spec}.md`), name: basename(spec) };
|
|
179
|
+
}
|
|
180
|
+
if (gitShowFile(ref, gitJoin(gitJoin(gitRelDir, spec), 'SKILL.md'), cwd) !== null) {
|
|
181
|
+
return { isDir: true, treePath: gitJoin(gitRelDir, spec), fileSkillPath: '', name: basename(spec) };
|
|
182
|
+
}
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* 源解析的结构化错误 —— 不依赖 CLI:以 `messageKey` 抛出,由调用方(install 走 tCli、eval 走自身
|
|
187
|
+
* 中文错误)映射成本地化文案。住在 skill-loader(而非 source-resolver)是为了让共享的
|
|
188
|
+
* `materializeGitSkillTree` 能抛它而不致 skill-loader → source-resolver 反向成环;source-resolver
|
|
189
|
+
* re-export 以保持 install 既有 import 不破。
|
|
190
|
+
*/
|
|
191
|
+
export class SourceResolveError extends Error {
|
|
192
|
+
messageKey;
|
|
193
|
+
params;
|
|
194
|
+
constructor(messageKey, params = {}) {
|
|
195
|
+
super(messageKey);
|
|
196
|
+
this.name = 'SourceResolveError';
|
|
197
|
+
this.messageKey = messageKey;
|
|
198
|
+
this.params = params;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* 校验 git tree 条目路径在物化目标内,越界即 fail closed(抛 SourceResolveError)。
|
|
203
|
+
* 双保险:既显式拒 `..` / 空段(git tree 可被手工构造出名为 `..` 的子树),也用 resolve 兜底
|
|
204
|
+
* 确认落点仍在 temp 之下(绝对路径 / 符号化逃逸)。绝不静默跳过——跳过会让物化树与真实树发散。
|
|
205
|
+
*/
|
|
206
|
+
export function assertContainedRelPath(temp, relPath) {
|
|
207
|
+
const segments = relPath.split('/');
|
|
208
|
+
if (segments.some((s) => s === '' || s === '.' || s === '..')) {
|
|
209
|
+
throw new SourceResolveError('cli.install.git_unsafe_path', { path: relPath });
|
|
210
|
+
}
|
|
211
|
+
const root = resolve(temp);
|
|
212
|
+
const dest = resolve(temp, relPath);
|
|
213
|
+
if (dest !== root && !dest.startsWith(root + sep)) {
|
|
214
|
+
throw new SourceResolveError('cli.install.git_unsafe_path', { path: relPath });
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* 把 git 某个 ref 上的 skill(已由 `classifyGitSkillRef` 归类)逐文件物化到临时目录 ——
|
|
219
|
+
* **install 与 eval 共用此一处物化**,保证两侧拿到完全一致的本地树(此前 install/eval 各写一套
|
|
220
|
+
* git 解析正是四轮 bug 的根源,已靠共享 helper 收敛)。eval 仅为算整树指纹(hashArtifactSource)而
|
|
221
|
+
* 物化,算完即 cleanup;install 物化后分发并登记。失败(越界路径 / 空树 / 取不到 blob)抛
|
|
222
|
+
* SourceResolveError,绝不静默落空壳。
|
|
223
|
+
*/
|
|
224
|
+
export function materializeGitSkillTree(ref, resolved, repoRoot) {
|
|
225
|
+
const temp = mkdtempSync(join(tmpdir(), 'omk-git-skill-'));
|
|
226
|
+
const cleanup = () => {
|
|
227
|
+
try {
|
|
228
|
+
rmSync(temp, { recursive: true, force: true });
|
|
229
|
+
}
|
|
230
|
+
catch {
|
|
231
|
+
// 临时目录清理失败不致命
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
try {
|
|
235
|
+
if (resolved.isDir) {
|
|
236
|
+
for (const entry of gitLsTreeBlobs(ref, resolved.treePath, repoRoot)) {
|
|
237
|
+
// 安全边界 fail closed:git tree 可被 git mktree 手工构造出名为 `..` 的子树,`ls-tree -r` 会
|
|
238
|
+
// 吐 `../evil.txt`,`join(temp, ...)` 会逃出临时目录写盘、cleanup 也删不掉。任一越界路径直接抛错,
|
|
239
|
+
// 而非静默跳过——静默跳过会让物化树与真实 git tree / hash / 分发树发散。正常 checkout 永不触发。
|
|
240
|
+
assertContainedRelPath(temp, entry.path);
|
|
241
|
+
if (entry.mode === '120000' || entry.mode === '160000')
|
|
242
|
+
continue; // 跳过软链 / submodule(与本地分发一致)
|
|
243
|
+
if (!isDistributablePath(entry.path.split('/')))
|
|
244
|
+
continue; // 排除 .omk/.git/evolve 等
|
|
245
|
+
const bytes = gitShowBytes(ref, gitJoin(resolved.treePath, entry.path), repoRoot);
|
|
246
|
+
if (!bytes)
|
|
247
|
+
continue;
|
|
248
|
+
const dest = join(temp, entry.path);
|
|
249
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
250
|
+
// 保留可执行位(与本地 cpSync 一致);其余 0644。
|
|
251
|
+
writeFileSync(dest, bytes, { mode: entry.mode === '100755' ? 0o755 : 0o644 });
|
|
252
|
+
}
|
|
253
|
+
// 纵深防御:classify 与物化用的是两条 git 路径(gitShowFile vs ls-tree),万一发散(如 treePath 退化)
|
|
254
|
+
// 导致空树,这里失败而非静默物化一个空 skill。
|
|
255
|
+
if (!existsSync(join(temp, 'SKILL.md'))) {
|
|
256
|
+
throw new SourceResolveError('cli.install.git_skill_not_found', { ref, name: resolved.name });
|
|
257
|
+
}
|
|
258
|
+
return { localRoot: temp, isDirectorySkill: true, name: resolved.name, cleanup };
|
|
259
|
+
}
|
|
260
|
+
const bytes = gitShowBytes(ref, resolved.fileSkillPath, repoRoot);
|
|
261
|
+
if (!bytes)
|
|
262
|
+
throw new SourceResolveError('cli.install.git_skill_not_found', { ref, name: resolved.name });
|
|
263
|
+
const dest = join(temp, `${resolved.name}.md`);
|
|
264
|
+
writeFileSync(dest, bytes);
|
|
265
|
+
return { localRoot: dest, isDirectorySkill: false, name: resolved.name, cleanup };
|
|
266
|
+
}
|
|
267
|
+
catch (err) {
|
|
268
|
+
cleanup();
|
|
269
|
+
throw err;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* 远端 git URL 形态校验:接受 https(s):// / ssh:// / git:// / file:// 协议 URL、scp 形式
|
|
274
|
+
* `user@host:path`、绝对本地路径(file 远端 / 测试)。明显非法(空、相对裸串)拒。
|
|
275
|
+
*/
|
|
276
|
+
export function isPlausibleGitUrl(url) {
|
|
277
|
+
if (!url)
|
|
278
|
+
return false;
|
|
279
|
+
if (/^(https?|ssh|git|file):\/\//i.test(url))
|
|
280
|
+
return true;
|
|
281
|
+
if (/^[\w.-]+@[\w.-]+:/.test(url))
|
|
282
|
+
return true;
|
|
283
|
+
if (/^\//.test(url))
|
|
284
|
+
return true;
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* 远端 git:clone 某 ref 到临时 bare 仓库、pin 实际 SHA —— **install 与 eval 共用此一处**,远端只是
|
|
289
|
+
* 把下游 git helper(classifyGitSkillRef / materializeGitSkillTree)的 repoRoot 从「当前仓库」换成
|
|
290
|
+
* 「fetch 下来的临时 bare」,其余一字不改。`git init --bare` + `git fetch --depth 1`(省带宽,只取该
|
|
291
|
+
* ref 的 tip 树);ref 为 branch/tag/HEAD 通用,裸 SHA 取决于服务端是否允许 reachable-SHA fetch。
|
|
292
|
+
* 认证依赖本机 git 凭证(SSH agent / credential helper),omk 不自管 token。失败 fail-closed
|
|
293
|
+
* (SourceResolveError),由调用方本地化;eval 侧捕获后改抛中文 Error。
|
|
294
|
+
*/
|
|
295
|
+
export function fetchRemoteGitRef(url, ref) {
|
|
296
|
+
if (!isPlausibleGitUrl(url))
|
|
297
|
+
throw new SourceResolveError('cli.install.invalid_remote_url', { url });
|
|
298
|
+
const bare = mkdtempSync(join(tmpdir(), 'omk-git-remote-'));
|
|
299
|
+
const cleanup = () => {
|
|
300
|
+
try {
|
|
301
|
+
rmSync(bare, { recursive: true, force: true });
|
|
302
|
+
}
|
|
303
|
+
catch {
|
|
304
|
+
// 临时目录清理失败不致命
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
try {
|
|
308
|
+
execFileSync('git', ['init', '--bare', '--quiet', bare], { stdio: GIT_PROBE_STDIO });
|
|
309
|
+
try {
|
|
310
|
+
// `--` 隔断:git fetch 会扫描**全部** argv 找带短横的选项,不止第一个。少了 `--`,一个形如
|
|
311
|
+
// `--upload-pack=<cmd>` 的 ref 会被当成选项执行任意命令(RCE)。`--` 后一切按位置参数
|
|
312
|
+
// (repository + refspec)解析,恶意 ref 退化成非法 refspec、fail-closed。url 也一并护在 `--` 后。
|
|
313
|
+
execFileSync('git', ['--git-dir', bare, 'fetch', '--depth', '1', '--quiet', '--', url, `${ref}:refs/omk/fetched`], { stdio: GIT_PROBE_STDIO });
|
|
314
|
+
}
|
|
315
|
+
catch {
|
|
316
|
+
throw new SourceResolveError('cli.install.remote_fetch_failed', { url, ref });
|
|
317
|
+
}
|
|
318
|
+
let sha;
|
|
319
|
+
try {
|
|
320
|
+
sha = execFileSync('git', ['--git-dir', bare, 'rev-parse', 'refs/omk/fetched'], {
|
|
321
|
+
encoding: 'utf-8',
|
|
322
|
+
stdio: GIT_PROBE_STDIO,
|
|
323
|
+
}).trim();
|
|
324
|
+
}
|
|
325
|
+
catch {
|
|
326
|
+
throw new SourceResolveError('cli.install.remote_ref_not_found', { url, ref });
|
|
327
|
+
}
|
|
328
|
+
if (!sha)
|
|
329
|
+
throw new SourceResolveError('cli.install.remote_ref_not_found', { url, ref });
|
|
330
|
+
return { repoRoot: bare, ref: sha, cleanup };
|
|
331
|
+
}
|
|
332
|
+
catch (err) {
|
|
333
|
+
cleanup();
|
|
334
|
+
throw err;
|
|
335
|
+
}
|
|
51
336
|
}
|
|
52
337
|
export function discoverVariants(skillDir) {
|
|
53
338
|
if (!existsSync(skillDir))
|
|
@@ -124,7 +409,8 @@ export function discoverBatchSkills(skillDir) {
|
|
|
124
409
|
return skills;
|
|
125
410
|
}
|
|
126
411
|
export function loadSkills(skillDir, variants) {
|
|
127
|
-
|
|
412
|
+
// 只取 content 映射,不执行 → 不落副本(materialize:false)。
|
|
413
|
+
return Object.fromEntries(resolveArtifacts(skillDir, variants, { materialize: false }).map((artifact) => [artifact.name, artifact.content]));
|
|
128
414
|
}
|
|
129
415
|
/**
|
|
130
416
|
* Parse variant expression, extracting optional cwd suffix.
|
|
@@ -171,12 +457,15 @@ function pathPhysicalId(p) {
|
|
|
171
457
|
* `skillDir/name/SKILL.md`)取物理身份,这样裸名 `greeter` 与指向同一文件的 `./greeter.md`
|
|
172
458
|
* 能判为重复;没传 skillDir(如纯单测)则退回字面名。
|
|
173
459
|
* - `git:` / `baseline`:本身就是稳定标识,原样返回。
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
|
|
177
|
-
|
|
460
|
+
* 结构化的 `cwd`(第三参数)按物理身份纳入 key —— 同一份 skill 绑不同 cwd 是不同 runtime
|
|
461
|
+
* context,不算重复。不要用派生短名判重:`v1/greeter.md` 与 `v2/greeter.md` 短名都是 greeter
|
|
462
|
+
* 却是两个 variant。 */
|
|
463
|
+
export function variantIdentity(expr, skillDir, cwd) {
|
|
464
|
+
// expr 已是纯 artifact 身份(@cwd 在 CLI/config 边界已剥离);cwd 结构化显式传入。
|
|
465
|
+
const name = expr;
|
|
178
466
|
let id;
|
|
179
|
-
if (name.startsWith('git:')) {
|
|
467
|
+
if (name.startsWith('git:') || name.startsWith('git+')) {
|
|
468
|
+
// 本地 git:<ref>:<spec> 与远端 git+<url>@<sha>:<spec> 都是稳定身份串,原样作 key,绝不再 split。
|
|
180
469
|
id = name;
|
|
181
470
|
}
|
|
182
471
|
else if (name === 'baseline') {
|
|
@@ -204,29 +493,115 @@ export function skillNameFromPath(filePath) {
|
|
|
204
493
|
const base = basename(filePath);
|
|
205
494
|
return base === 'SKILL.md' ? basename(dirname(filePath)) : base.replace(/\.md$/i, '');
|
|
206
495
|
}
|
|
207
|
-
/**
|
|
496
|
+
/** 从 variant 表达式(纯 artifact 身份,可能是路径)取短名。 */
|
|
208
497
|
export function variantExprToSkillName(expr) {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
return name || expr;
|
|
498
|
+
if (expr.startsWith('git:'))
|
|
499
|
+
return expr;
|
|
500
|
+
if (!expr.includes('/'))
|
|
501
|
+
return expr;
|
|
214
502
|
// 先折叠 dir↔SKILL.md 再取短名,与 resolveArtifacts 的命名一致(否则 `weird.md/` 这类
|
|
215
503
|
// 以 .md 结尾的目录,两处会派生出不同短名)。
|
|
216
|
-
return skillNameFromPath(canonicalSkillAnchor(resolve(
|
|
504
|
+
return skillNameFromPath(canonicalSkillAnchor(resolve(expr))) || expr;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* 解析一个目录-skill 的整树指纹 + SKILL.md 正文;`materialize` 为真时另落地内容寻址隔离副本、返回执行根。
|
|
508
|
+
* 本地源 localDir 是真源目录;git 源 localDir 是 materializeGitSkillTree 物化出的临时目录。
|
|
509
|
+
* execRoot(副本)供 executor cwd / skillDir 锚定;skillRoot(真源)由各分支自行保留。
|
|
510
|
+
* 只有 eval 路径需要副本(执行隔离);doctor / loadSkills 只需指纹与正文,materialize=false 不落副本、
|
|
511
|
+
* 不写 `~/.oh-my-knowledge/trees`(避免纯读路径的副作用 I/O 与 trees 污染)。
|
|
512
|
+
*/
|
|
513
|
+
function isolateDirSkill(localDir, name, materialize) {
|
|
514
|
+
const content = readFileSync(join(localDir, 'SKILL.md'), 'utf-8').trim();
|
|
515
|
+
if (materialize) {
|
|
516
|
+
const copy = materializeIsolatedCopy(localDir, true, name);
|
|
517
|
+
return { execRoot: copy.copyRoot, contentHash: copy.contentHash, content };
|
|
518
|
+
}
|
|
519
|
+
return { contentHash: hashArtifactSource(localDir, true), content };
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* 远端 git variant:fetch 到临时 bare → classify → materialize 临时树 → 隔离副本(dir,materialize 时)
|
|
523
|
+
* 或单文件字节(file)。url/ref/spec 全程结构化,locator 落 `git+<url>@<sha>:<spec>` 身份串。
|
|
524
|
+
* SourceResolveError(install 口径的 messageKey)在此转成 eval 的中文 Error。临时树与 bare 用完即清。
|
|
525
|
+
*/
|
|
526
|
+
function resolveRemoteGitVariant(input, materialize, artifacts) {
|
|
527
|
+
const { url, spec } = input.git;
|
|
528
|
+
const ref = input.git.ref ?? 'HEAD';
|
|
529
|
+
let checkout;
|
|
530
|
+
try {
|
|
531
|
+
checkout = fetchRemoteGitRef(url, ref);
|
|
532
|
+
}
|
|
533
|
+
catch (err) {
|
|
534
|
+
if (err instanceof SourceResolveError) {
|
|
535
|
+
const zh = err.messageKey === 'cli.install.invalid_remote_url'
|
|
536
|
+
? `不是合法的 git 远端 URL:${url}`
|
|
537
|
+
: `从远端 ${url} 拉取 ref ${ref} 失败,请检查 URL / ref 是否存在与本机 git 凭证。`;
|
|
538
|
+
throw new Error(zh);
|
|
539
|
+
}
|
|
540
|
+
throw err;
|
|
541
|
+
}
|
|
542
|
+
try {
|
|
543
|
+
const resolved = classifyGitSkillRef(checkout.ref, '', spec, checkout.repoRoot);
|
|
544
|
+
if (!resolved)
|
|
545
|
+
throw new Error(`在远端 ${url} 的 ref ${ref} 下找不到 skill ${spec}(既无 ${spec}/SKILL.md 也无 ${spec}.md)。`);
|
|
546
|
+
const mat = materializeGitSkillTree(checkout.ref, resolved, checkout.repoRoot);
|
|
547
|
+
try {
|
|
548
|
+
const locator = `git+${url}@${checkout.ref}:${spec}`;
|
|
549
|
+
if (resolved.isDir) {
|
|
550
|
+
const iso = isolateDirSkill(mat.localRoot, resolved.name, materialize);
|
|
551
|
+
artifacts.push({
|
|
552
|
+
name: input.name,
|
|
553
|
+
kind: 'skill',
|
|
554
|
+
source: 'git',
|
|
555
|
+
content: iso.content,
|
|
556
|
+
contentHash: iso.contentHash,
|
|
557
|
+
locator,
|
|
558
|
+
ref: checkout.ref,
|
|
559
|
+
cwd: input.cwd,
|
|
560
|
+
...(iso.execRoot ? { execRoot: iso.execRoot } : {}),
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
else {
|
|
564
|
+
const bytes = readFileSync(mat.localRoot);
|
|
565
|
+
artifacts.push({
|
|
566
|
+
name: input.name,
|
|
567
|
+
kind: 'skill',
|
|
568
|
+
source: 'git',
|
|
569
|
+
content: bytes.toString('utf-8').trim(),
|
|
570
|
+
contentHash: hashArtifactSource(mat.localRoot, false),
|
|
571
|
+
locator,
|
|
572
|
+
ref: checkout.ref,
|
|
573
|
+
cwd: input.cwd,
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
finally {
|
|
578
|
+
mat.cleanup();
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
finally {
|
|
582
|
+
checkout.cleanup();
|
|
583
|
+
}
|
|
217
584
|
}
|
|
218
585
|
export function resolveArtifacts(skillDir, variants, opts = {}) {
|
|
219
586
|
const strictBaseline = opts.strictBaseline ?? true;
|
|
220
|
-
const
|
|
587
|
+
const materialize = opts.materialize ?? true;
|
|
221
588
|
const artifacts = [];
|
|
222
|
-
let
|
|
589
|
+
let gitCtx = null;
|
|
223
590
|
for (const rawVariant of variants) {
|
|
224
|
-
|
|
591
|
+
// 远端 git 结构化输入:url/ref/spec 分字段,fetch 到临时 bare 后复用 classify/materialize/隔离副本,
|
|
592
|
+
// URL 全程不经任何字符串切分(避开 parseGitInput 的 `:` 与 parseVariantCwd 的 `@`)。
|
|
593
|
+
if (typeof rawVariant === 'object' && 'git' in rawVariant) {
|
|
594
|
+
resolveRemoteGitVariant(rawVariant, materialize, artifacts);
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
597
|
+
// 字符串即纯 expr(无 cwd);结构化对象直接取 expr/cwd。不再 split @cwd。
|
|
598
|
+
const variantName = typeof rawVariant === 'string' ? rawVariant : rawVariant.expr;
|
|
599
|
+
const variantCwd = typeof rawVariant === 'string' ? undefined : rawVariant.cwd;
|
|
225
600
|
if (!variantName) {
|
|
226
|
-
throw new Error(`variant
|
|
601
|
+
throw new Error(`variant 名不能为空。如需绑定 runtime context,用 --control-cwd / --treatment-cwd 或 eval.yaml 的 variant.cwd。`);
|
|
227
602
|
}
|
|
228
603
|
if (variantName === 'baseline' && variantCwd) {
|
|
229
|
-
throw new Error('baseline cannot be bound to a cwd. To express a project-level runtime context, use a custom label
|
|
604
|
+
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).');
|
|
230
605
|
}
|
|
231
606
|
if (variantName === 'baseline') {
|
|
232
607
|
artifacts.push({
|
|
@@ -239,22 +614,51 @@ export function resolveArtifacts(skillDir, variants, opts = {}) {
|
|
|
239
614
|
continue;
|
|
240
615
|
}
|
|
241
616
|
if (variantName.startsWith('git:')) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
if (
|
|
246
|
-
ref
|
|
247
|
-
name = parts[0];
|
|
617
|
+
// 与 install 共用 parseGitInput:空 ref(`git::x`,会被 git 当 index 量本地暂存区、不可复取)/
|
|
618
|
+
// 空 spec(`git:HEAD:`)一律拒,守住 git variant 的可复现语义。
|
|
619
|
+
const parsed = parseGitInput(variantName);
|
|
620
|
+
if (!parsed) {
|
|
621
|
+
throw new Error(`无效的 git variant "${variantName}":ref 与 skill 名都不能为空,应为 git:<ref>:<name>(如 git:HEAD:review)。`);
|
|
248
622
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
623
|
+
const { ref, spec: name } = parsed;
|
|
624
|
+
// git 上下文锚定 skillDir 所属仓库(不是进程 cwd):从别处调用、skillDir 在另一个 repo 时也对。
|
|
625
|
+
if (!gitCtx)
|
|
626
|
+
gitCtx = resolveGitRepoContext(skillDir);
|
|
627
|
+
// file-vs-dir 归类与 install 共用 classifyGitSkillRef(裸 spec 文件优先),两条路径绝不发散。
|
|
628
|
+
const resolved = classifyGitSkillRef(ref, gitCtx.relDir, name, gitCtx.repoRoot);
|
|
629
|
+
if (!resolved) {
|
|
630
|
+
throw new Error(`skill not found in git ${ref}: ${name}.md or ${name}/SKILL.md`);
|
|
631
|
+
}
|
|
632
|
+
if (resolved.isDir) {
|
|
633
|
+
// git 目录-skill 忠实执行:物化整树到临时目录 → 落地内容寻址隔离副本 → executor cwd 锚副本,
|
|
634
|
+
// agent 读得到 references/ 资产、资产成为真实运行时输入。整树指纹与 install 受管记录的
|
|
635
|
+
// contentHash 落同一空间 → evidence 可绑(见 docs/specs/evidence-gated-management.md §9)。
|
|
636
|
+
const mat = materializeGitSkillTree(ref, resolved, gitCtx.repoRoot);
|
|
637
|
+
let isolated;
|
|
638
|
+
try {
|
|
639
|
+
isolated = isolateDirSkill(mat.localRoot, resolved.name, materialize);
|
|
640
|
+
}
|
|
641
|
+
finally {
|
|
642
|
+
mat.cleanup(); // 临时物化树只为喂副本,落地完即删
|
|
643
|
+
}
|
|
644
|
+
artifacts.push({
|
|
645
|
+
name: variantName,
|
|
646
|
+
kind: 'skill',
|
|
647
|
+
source: 'git',
|
|
648
|
+
content: isolated.content,
|
|
649
|
+
contentHash: isolated.contentHash,
|
|
650
|
+
locator: name,
|
|
651
|
+
ref,
|
|
652
|
+
cwd: variantCwd,
|
|
653
|
+
...(isolated.execRoot ? { execRoot: isolated.execRoot } : {}),
|
|
654
|
+
});
|
|
655
|
+
continue;
|
|
252
656
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
if (!content) {
|
|
657
|
+
// git 文件-skill:单个 .md 字节(与 install 单文件分支「不 trim」一致),无资产、本就与本地 /
|
|
658
|
+
// file 源同空间可绑,不走副本。
|
|
659
|
+
const skillMdBytes = gitShowBytes(ref, resolved.fileSkillPath, gitCtx.repoRoot);
|
|
660
|
+
const content = skillMdBytes !== null ? skillMdBytes.toString('utf-8').trim() : null;
|
|
661
|
+
if (!skillMdBytes || !content) {
|
|
258
662
|
throw new Error(`skill not found in git ${ref}: ${name}.md or ${name}/SKILL.md`);
|
|
259
663
|
}
|
|
260
664
|
artifacts.push({
|
|
@@ -262,6 +666,7 @@ export function resolveArtifacts(skillDir, variants, opts = {}) {
|
|
|
262
666
|
kind: 'skill',
|
|
263
667
|
source: 'git',
|
|
264
668
|
content,
|
|
669
|
+
contentHash: hashBytes(skillMdBytes),
|
|
265
670
|
locator: name,
|
|
266
671
|
ref,
|
|
267
672
|
cwd: variantCwd,
|
|
@@ -283,14 +688,32 @@ export function resolveArtifacts(skillDir, variants, opts = {}) {
|
|
|
283
688
|
const content = readFileSync(filePath, 'utf-8').trim();
|
|
284
689
|
const isSkillMd = basename(filePath) === 'SKILL.md';
|
|
285
690
|
const name = skillNameFromPath(filePath);
|
|
691
|
+
if (isSkillMd) {
|
|
692
|
+
// dir-skill:落地隔离副本,执行根锚副本(agent 读 references)、整树指纹;skillRoot 仍记真源(doctor 等用)。
|
|
693
|
+
const isolated = isolateDirSkill(dirname(filePath), name, materialize);
|
|
694
|
+
artifacts.push({
|
|
695
|
+
name,
|
|
696
|
+
kind: 'skill',
|
|
697
|
+
source: 'file-path',
|
|
698
|
+
content: isolated.content,
|
|
699
|
+
contentHash: isolated.contentHash,
|
|
700
|
+
locator: filePath,
|
|
701
|
+
cwd: variantCwd,
|
|
702
|
+
skillRoot: dirname(filePath),
|
|
703
|
+
...(isolated.execRoot ? { execRoot: isolated.execRoot } : {}),
|
|
704
|
+
metadata: buildMetadata(isolated.content),
|
|
705
|
+
});
|
|
706
|
+
continue;
|
|
707
|
+
}
|
|
708
|
+
// 裸 .md 文件-skill:单文件字节,无资产不 copy。
|
|
286
709
|
artifacts.push({
|
|
287
710
|
name,
|
|
288
711
|
kind: 'skill',
|
|
289
712
|
source: 'file-path',
|
|
290
713
|
content,
|
|
714
|
+
contentHash: hashArtifactSource(filePath, false),
|
|
291
715
|
locator: filePath,
|
|
292
716
|
cwd: variantCwd,
|
|
293
|
-
...(isSkillMd && { skillRoot: dirname(filePath) }),
|
|
294
717
|
metadata: buildMetadata(content),
|
|
295
718
|
});
|
|
296
719
|
continue;
|
|
@@ -305,23 +728,27 @@ export function resolveArtifacts(skillDir, variants, opts = {}) {
|
|
|
305
728
|
kind: 'skill',
|
|
306
729
|
source: 'variant-name',
|
|
307
730
|
content,
|
|
731
|
+
contentHash: hashArtifactSource(mdPath, false),
|
|
308
732
|
locator: mdPath,
|
|
309
733
|
cwd: variantCwd,
|
|
310
734
|
metadata: buildMetadata(content),
|
|
311
735
|
});
|
|
312
736
|
}
|
|
313
737
|
else if (existsSync(dirSkillPath)) {
|
|
314
|
-
// directory-skill:SKILL.md 引相对路径 assets
|
|
315
|
-
|
|
738
|
+
// directory-skill:SKILL.md 引相对路径 assets;落地隔离副本,executor cwd 锚副本读 references,
|
|
739
|
+
// skillRoot 仍记真源(doctor / dependency-checker 用)。
|
|
740
|
+
const isolated = isolateDirSkill(dirname(dirSkillPath), variantName, materialize);
|
|
316
741
|
artifacts.push({
|
|
317
742
|
name: variantName,
|
|
318
743
|
kind: 'skill',
|
|
319
744
|
source: 'variant-name',
|
|
320
|
-
content,
|
|
745
|
+
content: isolated.content,
|
|
746
|
+
contentHash: isolated.contentHash,
|
|
321
747
|
locator: dirSkillPath,
|
|
322
748
|
cwd: variantCwd,
|
|
323
749
|
skillRoot: dirname(dirSkillPath),
|
|
324
|
-
|
|
750
|
+
...(isolated.execRoot ? { execRoot: isolated.execRoot } : {}),
|
|
751
|
+
metadata: buildMetadata(isolated.content),
|
|
325
752
|
});
|
|
326
753
|
}
|
|
327
754
|
else if (variantCwd) {
|
|
@@ -337,25 +764,15 @@ export function resolveArtifacts(skillDir, variants, opts = {}) {
|
|
|
337
764
|
throw new Error(`skill not found: ${mdPath} or ${dirSkillPath}`);
|
|
338
765
|
}
|
|
339
766
|
}
|
|
340
|
-
// Skill-isolation
|
|
341
|
-
//
|
|
342
|
-
//
|
|
343
|
-
//
|
|
344
|
-
//
|
|
345
|
-
// 职责边界:这条按名查的绑定服务 doctor / batch / loadSkills 等直接调 resolveArtifacts 的
|
|
346
|
-
// 调用方。eval 主路径(prepareEvaluationRun)已改为按 spec 身份绑定、不再传 variantAllowedSkills,
|
|
347
|
-
// 不走这里。两条路径暂并存。
|
|
348
|
-
// TODO: 待 batch 也迁到 spec-based 绑定后,退役 opts.variantAllowedSkills,让隔离绑定收成一处。
|
|
767
|
+
// Skill-isolation:resolveArtifacts 只负责 strictBaseline 默认——strictBaseline=true 时
|
|
768
|
+
// 所有 kind:'baseline' artifact 默认 allowedSkills=[];否则保持 undefined → SDK 全量发现。
|
|
769
|
+
// per-variant 显式隔离声明(eval.yaml variants[].allowedSkills)统一走 spec.allowedSkills,
|
|
770
|
+
// 由 prepareEvaluationRun 按 spec 身份绑定;batch 的 eval.yaml allowedSkills 也已在
|
|
771
|
+
// buildBatchVariantSpecs 处挂到 spec 上。隔离绑定收成单一来源,这里不再按名查。
|
|
349
772
|
for (const artifact of artifacts) {
|
|
350
|
-
const explicit = variantAllowedSkills[artifact.name];
|
|
351
|
-
if (explicit !== undefined) {
|
|
352
|
-
artifact.allowedSkills = explicit;
|
|
353
|
-
continue;
|
|
354
|
-
}
|
|
355
773
|
if (strictBaseline && artifact.kind === 'baseline') {
|
|
356
774
|
artifact.allowedSkills = [];
|
|
357
775
|
}
|
|
358
|
-
// else leave undefined → SDK default (full discovery)
|
|
359
776
|
}
|
|
360
777
|
ensureUniqueVariantNames(artifacts);
|
|
361
778
|
return artifacts;
|
|
@@ -417,4 +834,3 @@ export function ensureUniqueVariantNames(artifacts) {
|
|
|
417
834
|
});
|
|
418
835
|
}
|
|
419
836
|
}
|
|
420
|
-
//# sourceMappingURL=skill-loader.js.map
|