akm-cli 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -8
- package/dist/tests/add-website-source.test.js +0 -119
- package/dist/tests/agent/agent-config-loader.test.js +0 -70
- package/dist/tests/agent/agent-config.test.js +0 -221
- package/dist/tests/agent/agent-detect.test.js +0 -100
- package/dist/tests/agent/agent-spawn.test.js +0 -234
- package/dist/tests/agent-output.test.js +0 -186
- package/dist/tests/architecture/agent-no-llm-sdk-guard.test.js +0 -103
- package/dist/tests/architecture/agent-spawn-seam.test.js +0 -193
- package/dist/tests/architecture/llm-stateless-seam.test.js +0 -112
- package/dist/tests/asset-ref.test.js +0 -192
- package/dist/tests/asset-registry.test.js +0 -103
- package/dist/tests/asset-spec.test.js +0 -241
- package/dist/tests/bench/attribution.test.js +0 -996
- package/dist/tests/bench/cleanup-sigint.test.js +0 -83
- package/dist/tests/bench/cleanup.js +0 -234
- package/dist/tests/bench/cleanup.test.js +0 -166
- package/dist/tests/bench/cli.js +0 -1018
- package/dist/tests/bench/cli.test.js +0 -445
- package/dist/tests/bench/compare.test.js +0 -556
- package/dist/tests/bench/corpus.js +0 -317
- package/dist/tests/bench/corpus.test.js +0 -258
- package/dist/tests/bench/doctor.js +0 -525
- package/dist/tests/bench/driver.js +0 -401
- package/dist/tests/bench/driver.test.js +0 -584
- package/dist/tests/bench/environment.js +0 -233
- package/dist/tests/bench/environment.test.js +0 -199
- package/dist/tests/bench/evolve-metrics.js +0 -179
- package/dist/tests/bench/evolve-metrics.test.js +0 -187
- package/dist/tests/bench/evolve.js +0 -647
- package/dist/tests/bench/evolve.test.js +0 -624
- package/dist/tests/bench/failure-modes.test.js +0 -349
- package/dist/tests/bench/feedback-integrity.test.js +0 -457
- package/dist/tests/bench/leakage.test.js +0 -228
- package/dist/tests/bench/learning-curve.test.js +0 -134
- package/dist/tests/bench/metrics.js +0 -2395
- package/dist/tests/bench/metrics.test.js +0 -1150
- package/dist/tests/bench/no-os-tmpdir-invariant.test.js +0 -43
- package/dist/tests/bench/opencode-config.js +0 -194
- package/dist/tests/bench/opencode-config.test.js +0 -370
- package/dist/tests/bench/report.js +0 -1885
- package/dist/tests/bench/report.test.js +0 -1038
- package/dist/tests/bench/run-config.js +0 -355
- package/dist/tests/bench/run-config.test.js +0 -298
- package/dist/tests/bench/run-curate-test.js +0 -32
- package/dist/tests/bench/run-failing-tasks.js +0 -56
- package/dist/tests/bench/run-full-bench.js +0 -51
- package/dist/tests/bench/run-items36-targeted.js +0 -69
- package/dist/tests/bench/run-nano-quick.js +0 -42
- package/dist/tests/bench/run-waveg-targeted.js +0 -62
- package/dist/tests/bench/runner.js +0 -699
- package/dist/tests/bench/runner.test.js +0 -958
- package/dist/tests/bench/search-bridge.test.js +0 -331
- package/dist/tests/bench/tmp.js +0 -131
- package/dist/tests/bench/trajectory.js +0 -116
- package/dist/tests/bench/trajectory.test.js +0 -127
- package/dist/tests/bench/verifier.js +0 -114
- package/dist/tests/bench/verifier.test.js +0 -118
- package/dist/tests/bench/workflow-evaluator.js +0 -557
- package/dist/tests/bench/workflow-evaluator.test.js +0 -421
- package/dist/tests/bench/workflow-spec.js +0 -345
- package/dist/tests/bench/workflow-spec.test.js +0 -363
- package/dist/tests/bench/workflow-trace.js +0 -472
- package/dist/tests/bench/workflow-trace.test.js +0 -254
- package/dist/tests/benchmark-search-quality.js +0 -536
- package/dist/tests/benchmark-suite.js +0 -1441
- package/dist/tests/capture-cli.test.js +0 -112
- package/dist/tests/cli-errors.test.js +0 -204
- package/dist/tests/commands/events.test.js +0 -370
- package/dist/tests/commands/history.test.js +0 -418
- package/dist/tests/commands/import.test.js +0 -103
- package/dist/tests/commands/proposal-cli.test.js +0 -209
- package/dist/tests/commands/reflect-propose-cli.test.js +0 -333
- package/dist/tests/commands/remember.test.js +0 -97
- package/dist/tests/commands/scope-flags.test.js +0 -300
- package/dist/tests/commands/search.test.js +0 -537
- package/dist/tests/commands/show-indexer-parity.test.js +0 -117
- package/dist/tests/commands/show.test.js +0 -294
- package/dist/tests/common.test.js +0 -266
- package/dist/tests/completions.test.js +0 -142
- package/dist/tests/config-cli.test.js +0 -193
- package/dist/tests/config-llm-features.test.js +0 -139
- package/dist/tests/config.test.js +0 -569
- package/dist/tests/contracts/migration-baseline.test.js +0 -43
- package/dist/tests/contracts/reflect-propose-envelope.test.js +0 -139
- package/dist/tests/contracts/spec-helpers.js +0 -46
- package/dist/tests/contracts/v1-spec-section-11-proposal-queue.test.js +0 -228
- package/dist/tests/contracts/v1-spec-section-12-agent-config.test.js +0 -56
- package/dist/tests/contracts/v1-spec-section-13-lesson-type.test.js +0 -34
- package/dist/tests/contracts/v1-spec-section-14-llm-features.test.js +0 -94
- package/dist/tests/contracts/v1-spec-section-4-1-asset-types.test.js +0 -39
- package/dist/tests/contracts/v1-spec-section-4-2-quality-rules.test.js +0 -44
- package/dist/tests/contracts/v1-spec-section-5-configuration.test.js +0 -47
- package/dist/tests/contracts/v1-spec-section-6-orchestration.test.js +0 -40
- package/dist/tests/contracts/v1-spec-section-7-module-layout.test.js +0 -58
- package/dist/tests/contracts/v1-spec-section-8-extension-points.test.js +0 -34
- package/dist/tests/contracts/v1-spec-section-9-4-cli-surface.test.js +0 -75
- package/dist/tests/contracts/v1-spec-section-9-7-llm-agent-boundary.test.js +0 -36
- package/dist/tests/core/write-source.test.js +0 -366
- package/dist/tests/curate-command.test.js +0 -87
- package/dist/tests/db-scoring.test.js +0 -201
- package/dist/tests/db.test.js +0 -654
- package/dist/tests/distill-cli-flag.test.js +0 -208
- package/dist/tests/distill.test.js +0 -515
- package/dist/tests/docker-install.test.js +0 -120
- package/dist/tests/e2e.test.js +0 -1419
- package/dist/tests/embedder.test.js +0 -340
- package/dist/tests/embedding-model-config.test.js +0 -379
- package/dist/tests/feedback-command.test.js +0 -172
- package/dist/tests/file-context.test.js +0 -552
- package/dist/tests/fixtures/scripts/git/summarize-diff.js +0 -9
- package/dist/tests/fixtures/scripts/lint/eslint-check.js +0 -7
- package/dist/tests/fixtures/stashes/load.js +0 -166
- package/dist/tests/fixtures/stashes/load.test.js +0 -97
- package/dist/tests/fixtures/stashes/ranking-baseline/scripts/mem0-search.js +0 -12
- package/dist/tests/frontmatter.test.js +0 -190
- package/dist/tests/fts-field-weighting.test.js +0 -254
- package/dist/tests/fuzzy-search.test.js +0 -230
- package/dist/tests/git-provider-clone.test.js +0 -45
- package/dist/tests/github.test.js +0 -161
- package/dist/tests/graph-boost-ranking.test.js +0 -305
- package/dist/tests/graph-extraction.test.js +0 -282
- package/dist/tests/helpers/usage-events.js +0 -8
- package/dist/tests/index-pass-llm.test.js +0 -161
- package/dist/tests/indexer.test.js +0 -570
- package/dist/tests/info-command.test.js +0 -166
- package/dist/tests/init.test.js +0 -69
- package/dist/tests/install-script.test.js +0 -246
- package/dist/tests/integration/agent-real-profile.test.js +0 -94
- package/dist/tests/issue-36-repro.test.js +0 -304
- package/dist/tests/issues-191-194.test.js +0 -160
- package/dist/tests/lesson-lint.test.js +0 -111
- package/dist/tests/llm-client.test.js +0 -115
- package/dist/tests/llm-feature-gate.test.js +0 -151
- package/dist/tests/llm.test.js +0 -139
- package/dist/tests/lockfile.test.js +0 -216
- package/dist/tests/manifest.test.js +0 -205
- package/dist/tests/markdown.test.js +0 -126
- package/dist/tests/matchers-unit.test.js +0 -189
- package/dist/tests/memory-inference.test.js +0 -299
- package/dist/tests/merge-scoring.test.js +0 -136
- package/dist/tests/metadata.test.js +0 -313
- package/dist/tests/migration-help.test.js +0 -89
- package/dist/tests/origin-resolve.test.js +0 -124
- package/dist/tests/output-baseline.test.js +0 -218
- package/dist/tests/output-shapes-unit.test.js +0 -478
- package/dist/tests/parallel-search.test.js +0 -272
- package/dist/tests/parameter-metadata.test.js +0 -365
- package/dist/tests/paths.test.js +0 -177
- package/dist/tests/progressive-disclosure.test.js +0 -280
- package/dist/tests/proposals.test.js +0 -279
- package/dist/tests/proposed-quality.test.js +0 -271
- package/dist/tests/provider-registry.test.js +0 -32
- package/dist/tests/ranking-regression.test.js +0 -548
- package/dist/tests/reflect-propose.test.js +0 -455
- package/dist/tests/registry-build-index.test.js +0 -394
- package/dist/tests/registry-cli.test.js +0 -290
- package/dist/tests/registry-index-v2.test.js +0 -430
- package/dist/tests/registry-install.test.js +0 -728
- package/dist/tests/registry-providers/parity.test.js +0 -189
- package/dist/tests/registry-providers/skills-sh.test.js +0 -309
- package/dist/tests/registry-providers/static-index.test.js +0 -238
- package/dist/tests/registry-resolve.test.js +0 -126
- package/dist/tests/registry-search.test.js +0 -923
- package/dist/tests/remember-frontmatter.test.js +0 -378
- package/dist/tests/remember-unit.test.js +0 -123
- package/dist/tests/ripgrep-install.test.js +0 -251
- package/dist/tests/ripgrep-resolve.test.js +0 -108
- package/dist/tests/ripgrep.test.js +0 -163
- package/dist/tests/save-command.test.js +0 -94
- package/dist/tests/save-trust-qa-fixes.test.js +0 -270
- package/dist/tests/scoring-pipeline.test.js +0 -648
- package/dist/tests/search-include-proposed-cli.test.js +0 -118
- package/dist/tests/self-update.test.js +0 -442
- package/dist/tests/semantic-search-e2e.test.js +0 -512
- package/dist/tests/semantic-status.test.js +0 -471
- package/dist/tests/setup-run.integration.js +0 -877
- package/dist/tests/setup-wizard.test.js +0 -198
- package/dist/tests/setup.test.js +0 -131
- package/dist/tests/source-add.test.js +0 -11
- package/dist/tests/source-clone.test.js +0 -254
- package/dist/tests/source-manage.test.js +0 -366
- package/dist/tests/source-providers/filesystem.test.js +0 -82
- package/dist/tests/source-providers/git.test.js +0 -252
- package/dist/tests/source-providers/website.test.js +0 -128
- package/dist/tests/source-qa-fixes.test.js +0 -286
- package/dist/tests/source-registry.test.js +0 -350
- package/dist/tests/source-resolve.test.js +0 -100
- package/dist/tests/source-source.test.js +0 -281
- package/dist/tests/source.test.js +0 -533
- package/dist/tests/tar-utils-scan.test.js +0 -73
- package/dist/tests/toggle-components.test.js +0 -73
- package/dist/tests/usage-telemetry.test.js +0 -265
- package/dist/tests/utility-scoring.test.js +0 -558
- package/dist/tests/vault-load-error.test.js +0 -78
- package/dist/tests/vault-qa-fixes.test.js +0 -194
- package/dist/tests/vault.test.js +0 -429
- package/dist/tests/vector-search.test.js +0 -608
- package/dist/tests/walker.test.js +0 -252
- package/dist/tests/wave2-cluster-bc.test.js +0 -228
- package/dist/tests/wave2-cluster-d.test.js +0 -180
- package/dist/tests/wave2-cluster-e.test.js +0 -179
- package/dist/tests/wiki-qa-fixes.test.js +0 -270
- package/dist/tests/wiki.test.js +0 -529
- package/dist/tests/workflow-cli.test.js +0 -271
- package/dist/tests/workflow-markdown.test.js +0 -171
- package/dist/tests/workflow-path-escape.test.js +0 -132
- package/dist/tests/workflow-qa-fixes.test.js +0 -395
- package/dist/tests/workflows/indexer-rejection.test.js +0 -213
- /package/dist/{src/cli.js → cli.js} +0 -0
- /package/dist/{src/commands → commands}/completions.js +0 -0
- /package/dist/{src/commands → commands}/config-cli.js +0 -0
- /package/dist/{src/commands → commands}/curate.js +0 -0
- /package/dist/{src/commands → commands}/distill.js +0 -0
- /package/dist/{src/commands → commands}/events.js +0 -0
- /package/dist/{src/commands → commands}/history.js +0 -0
- /package/dist/{src/commands → commands}/info.js +0 -0
- /package/dist/{src/commands → commands}/init.js +0 -0
- /package/dist/{src/commands → commands}/install-audit.js +0 -0
- /package/dist/{src/commands → commands}/installed-stashes.js +0 -0
- /package/dist/{src/commands → commands}/migration-help.js +0 -0
- /package/dist/{src/commands → commands}/proposal.js +0 -0
- /package/dist/{src/commands → commands}/propose.js +0 -0
- /package/dist/{src/commands → commands}/reflect.js +0 -0
- /package/dist/{src/commands → commands}/registry-search.js +0 -0
- /package/dist/{src/commands → commands}/remember.js +0 -0
- /package/dist/{src/commands → commands}/search.js +0 -0
- /package/dist/{src/commands → commands}/self-update.js +0 -0
- /package/dist/{src/commands → commands}/show.js +0 -0
- /package/dist/{src/commands → commands}/source-add.js +0 -0
- /package/dist/{src/commands → commands}/source-clone.js +0 -0
- /package/dist/{src/commands → commands}/source-manage.js +0 -0
- /package/dist/{src/commands → commands}/vault.js +0 -0
- /package/dist/{src/core → core}/asset-ref.js +0 -0
- /package/dist/{src/core → core}/asset-registry.js +0 -0
- /package/dist/{src/core → core}/asset-spec.js +0 -0
- /package/dist/{src/core → core}/common.js +0 -0
- /package/dist/{src/core → core}/config.js +0 -0
- /package/dist/{src/core → core}/errors.js +0 -0
- /package/dist/{src/core → core}/events.js +0 -0
- /package/dist/{src/core → core}/frontmatter.js +0 -0
- /package/dist/{src/core → core}/lesson-lint.js +0 -0
- /package/dist/{src/core → core}/markdown.js +0 -0
- /package/dist/{src/core → core}/paths.js +0 -0
- /package/dist/{src/core → core}/proposals.js +0 -0
- /package/dist/{src/core → core}/warn.js +0 -0
- /package/dist/{src/core → core}/write-source.js +0 -0
- /package/dist/{src/indexer → indexer}/db-search.js +0 -0
- /package/dist/{src/indexer → indexer}/db.js +0 -0
- /package/dist/{src/indexer → indexer}/file-context.js +0 -0
- /package/dist/{src/indexer → indexer}/graph-boost.js +0 -0
- /package/dist/{src/indexer → indexer}/graph-extraction.js +0 -0
- /package/dist/{src/indexer → indexer}/indexer.js +0 -0
- /package/dist/{src/indexer → indexer}/manifest.js +0 -0
- /package/dist/{src/indexer → indexer}/matchers.js +0 -0
- /package/dist/{src/indexer → indexer}/memory-inference.js +0 -0
- /package/dist/{src/indexer → indexer}/metadata.js +0 -0
- /package/dist/{src/indexer → indexer}/search-fields.js +0 -0
- /package/dist/{src/indexer → indexer}/search-source.js +0 -0
- /package/dist/{src/indexer → indexer}/semantic-status.js +0 -0
- /package/dist/{src/indexer → indexer}/usage-events.js +0 -0
- /package/dist/{src/indexer → indexer}/walker.js +0 -0
- /package/dist/{src/integrations → integrations}/agent/config.js +0 -0
- /package/dist/{src/integrations → integrations}/agent/detect.js +0 -0
- /package/dist/{src/integrations → integrations}/agent/index.js +0 -0
- /package/dist/{src/integrations → integrations}/agent/profiles.js +0 -0
- /package/dist/{src/integrations → integrations}/agent/prompts.js +0 -0
- /package/dist/{src/integrations → integrations}/agent/spawn.js +0 -0
- /package/dist/{src/integrations → integrations}/github.js +0 -0
- /package/dist/{src/integrations → integrations}/lockfile.js +0 -0
- /package/dist/{src/llm → llm}/client.js +0 -0
- /package/dist/{src/llm → llm}/embedder.js +0 -0
- /package/dist/{src/llm → llm}/embedders/cache.js +0 -0
- /package/dist/{src/llm → llm}/embedders/local.js +0 -0
- /package/dist/{src/llm → llm}/embedders/remote.js +0 -0
- /package/dist/{src/llm → llm}/embedders/types.js +0 -0
- /package/dist/{src/llm → llm}/feature-gate.js +0 -0
- /package/dist/{src/llm → llm}/graph-extract.js +0 -0
- /package/dist/{src/llm → llm}/index-passes.js +0 -0
- /package/dist/{src/llm → llm}/memory-infer.js +0 -0
- /package/dist/{src/llm → llm}/metadata-enhance.js +0 -0
- /package/dist/{src/output → output}/cli-hints.js +0 -0
- /package/dist/{src/output → output}/context.js +0 -0
- /package/dist/{src/output → output}/renderers.js +0 -0
- /package/dist/{src/output → output}/shapes.js +0 -0
- /package/dist/{src/output → output}/text.js +0 -0
- /package/dist/{src/registry → registry}/build-index.js +0 -0
- /package/dist/{src/registry → registry}/create-provider-registry.js +0 -0
- /package/dist/{src/registry → registry}/factory.js +0 -0
- /package/dist/{src/registry → registry}/origin-resolve.js +0 -0
- /package/dist/{src/registry → registry}/providers/index.js +0 -0
- /package/dist/{src/registry → registry}/providers/skills-sh.js +0 -0
- /package/dist/{src/registry → registry}/providers/static-index.js +0 -0
- /package/dist/{src/registry → registry}/providers/types.js +0 -0
- /package/dist/{src/registry → registry}/resolve.js +0 -0
- /package/dist/{src/registry → registry}/types.js +0 -0
- /package/dist/{src/setup → setup}/detect.js +0 -0
- /package/dist/{src/setup → setup}/ripgrep-install.js +0 -0
- /package/dist/{src/setup → setup}/ripgrep-resolve.js +0 -0
- /package/dist/{src/setup → setup}/setup.js +0 -0
- /package/dist/{src/setup → setup}/steps.js +0 -0
- /package/dist/{src/sources → sources}/include.js +0 -0
- /package/dist/{src/sources → sources}/provider-factory.js +0 -0
- /package/dist/{src/sources → sources}/provider.js +0 -0
- /package/dist/{src/sources → sources}/providers/filesystem.js +0 -0
- /package/dist/{src/sources → sources}/providers/git.js +0 -0
- /package/dist/{src/sources → sources}/providers/index.js +0 -0
- /package/dist/{src/sources → sources}/providers/install-types.js +0 -0
- /package/dist/{src/sources → sources}/providers/npm.js +0 -0
- /package/dist/{src/sources → sources}/providers/provider-utils.js +0 -0
- /package/dist/{src/sources → sources}/providers/sync-from-ref.js +0 -0
- /package/dist/{src/sources → sources}/providers/tar-utils.js +0 -0
- /package/dist/{src/sources → sources}/providers/website.js +0 -0
- /package/dist/{src/sources → sources}/resolve.js +0 -0
- /package/dist/{src/sources → sources}/types.js +0 -0
- /package/dist/{src/templates → templates}/wiki-templates.js +0 -0
- /package/dist/{src/version.js → version.js} +0 -0
- /package/dist/{src/wiki → wiki}/wiki.js +0 -0
- /package/dist/{src/workflows → workflows}/authoring.js +0 -0
- /package/dist/{src/workflows → workflows}/cli.js +0 -0
- /package/dist/{src/workflows → workflows}/db.js +0 -0
- /package/dist/{src/workflows → workflows}/document-cache.js +0 -0
- /package/dist/{src/workflows → workflows}/parser.js +0 -0
- /package/dist/{src/workflows → workflows}/renderer.js +0 -0
- /package/dist/{src/workflows → workflows}/runs.js +0 -0
- /package/dist/{src/workflows → workflows}/schema.js +0 -0
- /package/dist/{src/workflows → workflows}/validator.js +0 -0
|
@@ -1,363 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for the workflow-spec YAML loader.
|
|
3
|
-
*
|
|
4
|
-
* Covers: valid fixtures, malformed specs, unknown event names,
|
|
5
|
-
* applicability filters, gold_ref validation, path-traversal rejection,
|
|
6
|
-
* scoring validation, duplicate ids.
|
|
7
|
-
*/
|
|
8
|
-
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
|
9
|
-
import { mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
10
|
-
import path from "node:path";
|
|
11
|
-
import { benchMkdtemp } from "./tmp";
|
|
12
|
-
import { KNOWN_EVENT_NAMES, loadAllWorkflowSpecs, loadWorkflowSpec, specApplies, WorkflowSpecError, } from "./workflow-spec";
|
|
13
|
-
const FIXTURE_DIR = path.resolve(__dirname, "..", "fixtures", "bench", "workflows");
|
|
14
|
-
const REQUIRED_SPECS = [
|
|
15
|
-
"akm-lookup-before-edit",
|
|
16
|
-
"akm-correct-asset-use",
|
|
17
|
-
"akm-feedback-after-use",
|
|
18
|
-
"akm-negative-feedback-on-failure",
|
|
19
|
-
"akm-reflect-after-repeated-failure",
|
|
20
|
-
"akm-workflow-followed",
|
|
21
|
-
];
|
|
22
|
-
// ── Scratch directory helpers ──────────────────────────────────────────────
|
|
23
|
-
let scratch;
|
|
24
|
-
beforeEach(() => {
|
|
25
|
-
scratch = benchMkdtemp("akm-workflow-spec-");
|
|
26
|
-
});
|
|
27
|
-
afterEach(() => {
|
|
28
|
-
rmSync(scratch, { recursive: true, force: true });
|
|
29
|
-
});
|
|
30
|
-
function writeSpec(name, body) {
|
|
31
|
-
const p = path.join(scratch, name);
|
|
32
|
-
writeFileSync(p, body, "utf8");
|
|
33
|
-
return p;
|
|
34
|
-
}
|
|
35
|
-
// ── Fixture sanity ─────────────────────────────────────────────────────────
|
|
36
|
-
describe("loadAllWorkflowSpecs (real fixtures)", () => {
|
|
37
|
-
test("loads every checked-in workflow spec", () => {
|
|
38
|
-
const specs = loadAllWorkflowSpecs(FIXTURE_DIR);
|
|
39
|
-
const ids = specs.map((s) => s.id).sort();
|
|
40
|
-
for (const required of REQUIRED_SPECS) {
|
|
41
|
-
expect(ids).toContain(required);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
test("every fixture has a valid scoring block", () => {
|
|
45
|
-
const specs = loadAllWorkflowSpecs(FIXTURE_DIR);
|
|
46
|
-
for (const s of specs) {
|
|
47
|
-
const sum = s.scoring.required_steps_weight + s.scoring.forbidden_steps_weight + s.scoring.evidence_quality_weight;
|
|
48
|
-
expect(Math.abs(sum - 1)).toBeLessThan(1e-6);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
test("every fixture event-name is in the known set", () => {
|
|
52
|
-
const known = new Set(KNOWN_EVENT_NAMES);
|
|
53
|
-
const specs = loadAllWorkflowSpecs(FIXTURE_DIR);
|
|
54
|
-
for (const s of specs) {
|
|
55
|
-
for (const step of s.required_sequence) {
|
|
56
|
-
expect(known.has(step.event)).toBe(true);
|
|
57
|
-
if (step.before)
|
|
58
|
-
expect(known.has(step.before)).toBe(true);
|
|
59
|
-
}
|
|
60
|
-
for (const step of s.forbidden ?? []) {
|
|
61
|
-
expect(known.has(step.event)).toBe(true);
|
|
62
|
-
if (step.before)
|
|
63
|
-
expect(known.has(step.before)).toBe(true);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
// ── Valid spec parsing ─────────────────────────────────────────────────────
|
|
69
|
-
describe("loadWorkflowSpec — valid", () => {
|
|
70
|
-
test("parses a minimal valid spec", () => {
|
|
71
|
-
const p = writeSpec("min.yaml", `id: min
|
|
72
|
-
title: Minimal
|
|
73
|
-
required_sequence:
|
|
74
|
-
- event: agent_started
|
|
75
|
-
- event: agent_finished
|
|
76
|
-
scoring:
|
|
77
|
-
required_steps_weight: 0.6
|
|
78
|
-
forbidden_steps_weight: 0.2
|
|
79
|
-
evidence_quality_weight: 0.2
|
|
80
|
-
`);
|
|
81
|
-
const spec = loadWorkflowSpec(p);
|
|
82
|
-
expect(spec.id).toBe("min");
|
|
83
|
-
expect(spec.required_sequence.length).toBe(2);
|
|
84
|
-
expect(spec.forbidden).toBeUndefined();
|
|
85
|
-
expect(spec.applies_to).toBeUndefined();
|
|
86
|
-
expect(spec.sourcePath).toBe(path.resolve(p));
|
|
87
|
-
});
|
|
88
|
-
test("preserves all richer fields (applies_to, forbidden, gold_ref)", () => {
|
|
89
|
-
const p = writeSpec("rich.yaml", `id: rich
|
|
90
|
-
title: Rich
|
|
91
|
-
applies_to:
|
|
92
|
-
arms: ["akm"]
|
|
93
|
-
task_domains: ["docker-homelab"]
|
|
94
|
-
outcomes: ["pass"]
|
|
95
|
-
requires_gold_ref: true
|
|
96
|
-
min_repeated_failures: 2
|
|
97
|
-
gold_ref: "skill:deploy"
|
|
98
|
-
required_sequence:
|
|
99
|
-
- event: agent_started
|
|
100
|
-
- event: akm_show
|
|
101
|
-
ref_must_equal: gold_ref
|
|
102
|
-
before: first_workspace_write
|
|
103
|
-
- event: first_workspace_write
|
|
104
|
-
forbidden:
|
|
105
|
-
- event: first_workspace_write
|
|
106
|
-
before: akm_show
|
|
107
|
-
scoring:
|
|
108
|
-
required_steps_weight: 0.5
|
|
109
|
-
forbidden_steps_weight: 0.3
|
|
110
|
-
evidence_quality_weight: 0.2
|
|
111
|
-
`);
|
|
112
|
-
const spec = loadWorkflowSpec(p);
|
|
113
|
-
expect(spec.applies_to?.arms).toEqual(["akm"]);
|
|
114
|
-
expect(spec.applies_to?.task_domains).toEqual(["docker-homelab"]);
|
|
115
|
-
expect(spec.applies_to?.requires_gold_ref).toBe(true);
|
|
116
|
-
expect(spec.applies_to?.min_repeated_failures).toBe(2);
|
|
117
|
-
expect(spec.gold_ref).toBe("skill:deploy");
|
|
118
|
-
expect(spec.forbidden?.length).toBe(1);
|
|
119
|
-
expect(spec.required_sequence[1].ref_must_equal).toBe("gold_ref");
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
// ── Malformed specs ────────────────────────────────────────────────────────
|
|
123
|
-
describe("loadWorkflowSpec — malformed", () => {
|
|
124
|
-
test("rejects non-YAML garbage", () => {
|
|
125
|
-
const p = writeSpec("bad.yaml", "::: not yaml\n - oops:\n: : :");
|
|
126
|
-
expect(() => loadWorkflowSpec(p)).toThrow(WorkflowSpecError);
|
|
127
|
-
});
|
|
128
|
-
test("rejects YAML whose top level is not a mapping", () => {
|
|
129
|
-
const p = writeSpec("array.yaml", "- 1\n- 2\n");
|
|
130
|
-
expect(() => loadWorkflowSpec(p)).toThrow(/must be a mapping/);
|
|
131
|
-
});
|
|
132
|
-
test("rejects missing required fields", () => {
|
|
133
|
-
const p = writeSpec("no-title.yaml", `id: x
|
|
134
|
-
required_sequence:
|
|
135
|
-
- event: agent_started
|
|
136
|
-
scoring:
|
|
137
|
-
required_steps_weight: 0.5
|
|
138
|
-
forbidden_steps_weight: 0.3
|
|
139
|
-
evidence_quality_weight: 0.2
|
|
140
|
-
`);
|
|
141
|
-
expect(() => loadWorkflowSpec(p)).toThrow(/title/);
|
|
142
|
-
});
|
|
143
|
-
test("rejects empty required_sequence", () => {
|
|
144
|
-
const p = writeSpec("empty-seq.yaml", `id: x
|
|
145
|
-
title: x
|
|
146
|
-
required_sequence: []
|
|
147
|
-
scoring:
|
|
148
|
-
required_steps_weight: 0.5
|
|
149
|
-
forbidden_steps_weight: 0.3
|
|
150
|
-
evidence_quality_weight: 0.2
|
|
151
|
-
`);
|
|
152
|
-
expect(() => loadWorkflowSpec(p)).toThrow(/required_sequence/);
|
|
153
|
-
});
|
|
154
|
-
test("rejects scoring weights that don't sum to 1", () => {
|
|
155
|
-
const p = writeSpec("bad-scoring.yaml", `id: x
|
|
156
|
-
title: x
|
|
157
|
-
required_sequence:
|
|
158
|
-
- event: agent_started
|
|
159
|
-
scoring:
|
|
160
|
-
required_steps_weight: 0.5
|
|
161
|
-
forbidden_steps_weight: 0.3
|
|
162
|
-
evidence_quality_weight: 0.5
|
|
163
|
-
`);
|
|
164
|
-
expect(() => loadWorkflowSpec(p)).toThrow(/sum to 1/);
|
|
165
|
-
});
|
|
166
|
-
test("rejects scoring weight outside [0, 1]", () => {
|
|
167
|
-
const p = writeSpec("neg-scoring.yaml", `id: x
|
|
168
|
-
title: x
|
|
169
|
-
required_sequence:
|
|
170
|
-
- event: agent_started
|
|
171
|
-
scoring:
|
|
172
|
-
required_steps_weight: -0.2
|
|
173
|
-
forbidden_steps_weight: 0.6
|
|
174
|
-
evidence_quality_weight: 0.6
|
|
175
|
-
`);
|
|
176
|
-
expect(() => loadWorkflowSpec(p)).toThrow(/in \[0, 1\]/);
|
|
177
|
-
});
|
|
178
|
-
test("rejects invalid gold_ref via parseAssetRef", () => {
|
|
179
|
-
const p = writeSpec("bad-ref.yaml", `id: x
|
|
180
|
-
title: x
|
|
181
|
-
gold_ref: "not-a-ref"
|
|
182
|
-
required_sequence:
|
|
183
|
-
- event: agent_started
|
|
184
|
-
scoring:
|
|
185
|
-
required_steps_weight: 0.5
|
|
186
|
-
forbidden_steps_weight: 0.3
|
|
187
|
-
evidence_quality_weight: 0.2
|
|
188
|
-
`);
|
|
189
|
-
expect(() => loadWorkflowSpec(p)).toThrow(/gold_ref/);
|
|
190
|
-
});
|
|
191
|
-
test("rejects invalid polarity", () => {
|
|
192
|
-
const p = writeSpec("bad-polarity.yaml", `id: x
|
|
193
|
-
title: x
|
|
194
|
-
required_sequence:
|
|
195
|
-
- event: akm_feedback
|
|
196
|
-
polarity: lukewarm
|
|
197
|
-
scoring:
|
|
198
|
-
required_steps_weight: 0.5
|
|
199
|
-
forbidden_steps_weight: 0.3
|
|
200
|
-
evidence_quality_weight: 0.2
|
|
201
|
-
`);
|
|
202
|
-
expect(() => loadWorkflowSpec(p)).toThrow(/polarity/);
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
// ── Unknown event names ────────────────────────────────────────────────────
|
|
206
|
-
describe("loadWorkflowSpec — unknown event names", () => {
|
|
207
|
-
test("rejects unknown event in required_sequence", () => {
|
|
208
|
-
const p = writeSpec("unknown.yaml", `id: x
|
|
209
|
-
title: x
|
|
210
|
-
required_sequence:
|
|
211
|
-
- event: agent_started
|
|
212
|
-
- event: cosmic_rays
|
|
213
|
-
scoring:
|
|
214
|
-
required_steps_weight: 0.5
|
|
215
|
-
forbidden_steps_weight: 0.3
|
|
216
|
-
evidence_quality_weight: 0.2
|
|
217
|
-
`);
|
|
218
|
-
expect(() => loadWorkflowSpec(p)).toThrow(/Unknown event name "cosmic_rays"/);
|
|
219
|
-
});
|
|
220
|
-
test("rejects unknown event in `before` clause", () => {
|
|
221
|
-
const p = writeSpec("unknown-before.yaml", `id: x
|
|
222
|
-
title: x
|
|
223
|
-
required_sequence:
|
|
224
|
-
- event: akm_search
|
|
225
|
-
before: nope
|
|
226
|
-
scoring:
|
|
227
|
-
required_steps_weight: 0.5
|
|
228
|
-
forbidden_steps_weight: 0.3
|
|
229
|
-
evidence_quality_weight: 0.2
|
|
230
|
-
`);
|
|
231
|
-
expect(() => loadWorkflowSpec(p)).toThrow(/Unknown event name "nope"/);
|
|
232
|
-
});
|
|
233
|
-
test("rejects unknown event in forbidden block", () => {
|
|
234
|
-
const p = writeSpec("unknown-forbidden.yaml", `id: x
|
|
235
|
-
title: x
|
|
236
|
-
required_sequence:
|
|
237
|
-
- event: agent_started
|
|
238
|
-
forbidden:
|
|
239
|
-
- event: ouija_board
|
|
240
|
-
scoring:
|
|
241
|
-
required_steps_weight: 0.5
|
|
242
|
-
forbidden_steps_weight: 0.3
|
|
243
|
-
evidence_quality_weight: 0.2
|
|
244
|
-
`);
|
|
245
|
-
expect(() => loadWorkflowSpec(p)).toThrow(/Unknown event name "ouija_board"/);
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
// ── Applicability filters ──────────────────────────────────────────────────
|
|
249
|
-
describe("specApplies", () => {
|
|
250
|
-
function specWith(applies_to) {
|
|
251
|
-
const yaml = applies_to
|
|
252
|
-
? `id: x\ntitle: x\napplies_to:\n${Object.entries(applies_to)
|
|
253
|
-
.map(([k, v]) => ` ${k}: ${JSON.stringify(v)}`)
|
|
254
|
-
.join("\n")}\nrequired_sequence:\n - event: agent_started\nscoring:\n required_steps_weight: 0.5\n forbidden_steps_weight: 0.3\n evidence_quality_weight: 0.2\n`
|
|
255
|
-
: `id: x\ntitle: x\nrequired_sequence:\n - event: agent_started\nscoring:\n required_steps_weight: 0.5\n forbidden_steps_weight: 0.3\n evidence_quality_weight: 0.2\n`;
|
|
256
|
-
const p = writeSpec(`${Math.random().toString(36).slice(2)}.yaml`, yaml);
|
|
257
|
-
return loadWorkflowSpec(p);
|
|
258
|
-
}
|
|
259
|
-
test("no filter ⇒ matches anything", () => {
|
|
260
|
-
const s = specWith();
|
|
261
|
-
expect(specApplies(s, { arm: "noakm", taskId: "any/thing" })).toBe(true);
|
|
262
|
-
});
|
|
263
|
-
test("arm filter rejects mismatched arm", () => {
|
|
264
|
-
const s = specWith({ arms: ["akm"] });
|
|
265
|
-
expect(specApplies(s, { arm: "noakm", taskId: "x/y" })).toBe(false);
|
|
266
|
-
expect(specApplies(s, { arm: "akm", taskId: "x/y" })).toBe(true);
|
|
267
|
-
});
|
|
268
|
-
test("task_domains filter uses first segment of taskId", () => {
|
|
269
|
-
const s = specWith({ task_domains: ["docker-homelab"] });
|
|
270
|
-
expect(specApplies(s, { arm: "akm", taskId: "docker-homelab/redis" })).toBe(true);
|
|
271
|
-
expect(specApplies(s, { arm: "akm", taskId: "az-cli/storage" })).toBe(false);
|
|
272
|
-
});
|
|
273
|
-
test("outcomes filter requires the outcome to be present", () => {
|
|
274
|
-
const s = specWith({ outcomes: ["pass"] });
|
|
275
|
-
expect(specApplies(s, { arm: "akm", taskId: "x/y", outcome: "pass" })).toBe(true);
|
|
276
|
-
expect(specApplies(s, { arm: "akm", taskId: "x/y", outcome: "fail" })).toBe(false);
|
|
277
|
-
expect(specApplies(s, { arm: "akm", taskId: "x/y" })).toBe(false);
|
|
278
|
-
});
|
|
279
|
-
test("requires_gold_ref demands hasGoldRef", () => {
|
|
280
|
-
const s = specWith({ requires_gold_ref: true });
|
|
281
|
-
expect(specApplies(s, { arm: "akm", taskId: "x/y", hasGoldRef: false })).toBe(false);
|
|
282
|
-
expect(specApplies(s, { arm: "akm", taskId: "x/y", hasGoldRef: true })).toBe(true);
|
|
283
|
-
});
|
|
284
|
-
test("min_repeated_failures gates on repeatedFailures count", () => {
|
|
285
|
-
const s = specWith({ min_repeated_failures: 2 });
|
|
286
|
-
expect(specApplies(s, { arm: "akm", taskId: "x/y", repeatedFailures: 1 })).toBe(false);
|
|
287
|
-
expect(specApplies(s, { arm: "akm", taskId: "x/y", repeatedFailures: 2 })).toBe(true);
|
|
288
|
-
expect(specApplies(s, { arm: "akm", taskId: "x/y" })).toBe(false);
|
|
289
|
-
});
|
|
290
|
-
});
|
|
291
|
-
// ── Path traversal ─────────────────────────────────────────────────────────
|
|
292
|
-
describe("loadWorkflowSpec — path traversal", () => {
|
|
293
|
-
test("rejects spec resolved outside the provided root", () => {
|
|
294
|
-
// Set up a workflows root with a sibling file outside it.
|
|
295
|
-
const root = path.join(scratch, "workflows");
|
|
296
|
-
mkdirSync(root, { recursive: true });
|
|
297
|
-
const inside = path.join(root, "ok.yaml");
|
|
298
|
-
writeFileSync(inside, `id: ok
|
|
299
|
-
title: ok
|
|
300
|
-
required_sequence:
|
|
301
|
-
- event: agent_started
|
|
302
|
-
scoring:
|
|
303
|
-
required_steps_weight: 0.5
|
|
304
|
-
forbidden_steps_weight: 0.3
|
|
305
|
-
evidence_quality_weight: 0.2
|
|
306
|
-
`, "utf8");
|
|
307
|
-
const outside = path.join(scratch, "outside.yaml");
|
|
308
|
-
writeFileSync(outside, "id: nope\ntitle: nope\n", "utf8");
|
|
309
|
-
expect(() => loadWorkflowSpec(inside, root)).not.toThrow();
|
|
310
|
-
expect(() => loadWorkflowSpec(outside, root)).toThrow(/outside/);
|
|
311
|
-
// Traversal pattern must also be rejected.
|
|
312
|
-
const traversal = path.join(root, "..", "outside.yaml");
|
|
313
|
-
expect(() => loadWorkflowSpec(traversal, root)).toThrow(/outside/);
|
|
314
|
-
});
|
|
315
|
-
test("allows in-root spec paths whose filename starts with '..'", () => {
|
|
316
|
-
const root = path.join(scratch, "workflows");
|
|
317
|
-
mkdirSync(root, { recursive: true });
|
|
318
|
-
const inside = path.join(root, "..still-inside.yaml");
|
|
319
|
-
writeFileSync(inside, `id: ok
|
|
320
|
-
title: ok
|
|
321
|
-
required_sequence:
|
|
322
|
-
- event: agent_started
|
|
323
|
-
scoring:
|
|
324
|
-
required_steps_weight: 0.5
|
|
325
|
-
forbidden_steps_weight: 0.3
|
|
326
|
-
evidence_quality_weight: 0.2
|
|
327
|
-
`, "utf8");
|
|
328
|
-
expect(() => loadWorkflowSpec(inside, root)).not.toThrow();
|
|
329
|
-
});
|
|
330
|
-
test("loadAllWorkflowSpecs ignores non-yaml files in dir", () => {
|
|
331
|
-
const root = path.join(scratch, "workflows");
|
|
332
|
-
mkdirSync(root, { recursive: true });
|
|
333
|
-
writeFileSync(path.join(root, "README.md"), "not a spec\n", "utf8");
|
|
334
|
-
writeFileSync(path.join(root, "a.yaml"), `id: a
|
|
335
|
-
title: a
|
|
336
|
-
required_sequence:
|
|
337
|
-
- event: agent_started
|
|
338
|
-
scoring:
|
|
339
|
-
required_steps_weight: 0.5
|
|
340
|
-
forbidden_steps_weight: 0.3
|
|
341
|
-
evidence_quality_weight: 0.2
|
|
342
|
-
`, "utf8");
|
|
343
|
-
const specs = loadAllWorkflowSpecs(root);
|
|
344
|
-
expect(specs.length).toBe(1);
|
|
345
|
-
expect(specs[0].id).toBe("a");
|
|
346
|
-
});
|
|
347
|
-
test("loadAllWorkflowSpecs rejects duplicate ids across files", () => {
|
|
348
|
-
const root = path.join(scratch, "workflows");
|
|
349
|
-
mkdirSync(root, { recursive: true });
|
|
350
|
-
const body = `id: dup
|
|
351
|
-
title: dup
|
|
352
|
-
required_sequence:
|
|
353
|
-
- event: agent_started
|
|
354
|
-
scoring:
|
|
355
|
-
required_steps_weight: 0.5
|
|
356
|
-
forbidden_steps_weight: 0.3
|
|
357
|
-
evidence_quality_weight: 0.2
|
|
358
|
-
`;
|
|
359
|
-
writeFileSync(path.join(root, "a.yaml"), body, "utf8");
|
|
360
|
-
writeFileSync(path.join(root, "b.yaml"), body, "utf8");
|
|
361
|
-
expect(() => loadAllWorkflowSpecs(root)).toThrow(/Duplicate workflow spec id "dup"/);
|
|
362
|
-
});
|
|
363
|
-
});
|