auto_link_tests
Scan test files for @spec tags and link tests to specs. Supports Python, JavaScript, and Go with dry-run preview.
Instructions
Scan a directory of test files for @spec: <ID> tags in docstrings or comments and call link_test_to_spec for each (test, spec) pair found. Supports Python (def test_*), JS/TS (it('...') / test('...')), and Go (func TestX(t *testing.T)). For each tag the nearest preceding test function within 30 lines is treated as the owner; test_node_id is <relative-path>::<test-name>. Use when a user says 'rebuild the spec coverage' or 'sync test → spec links after the refactor'. Set dry_run: true to preview without writing. Returns {test_dir, files_scanned, tags_found, links_added, links_updated, skipped, discoveries[], markdown, dry_run}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| test_dir | No | Absolute path to scan. Defaults to SPEC_PROJECT_ROOT/tests, falling back to SPEC_PROJECT_ROOT. | |
| languages | No | Subset of supported languages. Default: all three. | |
| dry_run | No |