codeforerunner 0.4.5__tar.gz → 0.4.7__tar.gz
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.
- {codeforerunner-0.4.5/src/codeforerunner.egg-info → codeforerunner-0.4.7}/PKG-INFO +8 -7
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/README.md +7 -6
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/pyproject.toml +2 -2
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/cli.py +31 -28
- codeforerunner-0.4.7/src/codeforerunner/distribution.py +56 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/doctor.py +24 -43
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/installer.py +124 -109
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/mcp_server.py +12 -10
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompt_session.py +40 -0
- codeforerunner-0.4.7/src/codeforerunner/release_surfaces.json +77 -0
- codeforerunner-0.4.7/src/codeforerunner/release_surfaces.py +115 -0
- codeforerunner-0.4.7/src/codeforerunner/skill_parity.py +95 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7/src/codeforerunner.egg-info}/PKG-INFO +8 -7
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner.egg-info/SOURCES.txt +9 -0
- codeforerunner-0.4.7/tests/test_distribution.py +54 -0
- codeforerunner-0.4.7/tests/test_inspect_npm_package.py +122 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/tests/test_installer.py +39 -0
- codeforerunner-0.4.7/tests/test_package_metadata.py +35 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/tests/test_prompt_session.py +31 -1
- codeforerunner-0.4.7/tests/test_release_surfaces.py +87 -0
- codeforerunner-0.4.7/tests/test_skill_parity.py +100 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/tests/test_workflows_yaml.py +76 -1
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/LICENSE.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/setup.cfg +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/__init__.py +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/bundle.py +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/check.py +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/config.py +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/partials/context-format.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/partials/output-rules.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/partials/stack-hints.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/system/base.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/tasks/api-docs.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/tasks/arch-review.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/tasks/audit.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/tasks/changelog.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/tasks/check.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/tasks/diagrams.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/tasks/flows.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/tasks/init-agent-onboarding.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/tasks/readme.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/tasks/refresh.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/tasks/review.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/tasks/scan.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/tasks/stack-docs.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/prompts/tasks/version-audit.md +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/tasks.json +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner/tasks.py +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner.egg-info/dependency_links.txt +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner.egg-info/entry_points.txt +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner.egg-info/requires.txt +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/src/codeforerunner.egg-info/top_level.txt +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/tests/test_bundle.py +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/tests/test_check.py +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/tests/test_check_config_integration.py +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/tests/test_check_versions.py +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/tests/test_cli.py +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/tests/test_config.py +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/tests/test_doctor.py +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/tests/test_examples.py +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/tests/test_hooks_manifest.py +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/tests/test_mcp_server.py +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/tests/test_tasks.py +0 -0
- {codeforerunner-0.4.5 → codeforerunner-0.4.7}/tests/test_validate_codex_marketplace.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codeforerunner
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.7
|
|
4
4
|
Summary: Model-agnostic repository documentation tooling (prompt-first; thin CLI).
|
|
5
5
|
Author: Derek Palmer
|
|
6
6
|
License-Expression: LicenseRef-Codeforerunner-SAL-0.1
|
|
@@ -29,7 +29,7 @@ Dynamic: license-file
|
|
|
29
29
|
|
|
30
30
|
# codeForerunner
|
|
31
31
|
|
|
32
|
-
[](https://socket.dev/npm/package/codeforerunner)
|
|
33
33
|
|
|
34
34
|
Model-agnostic repository documentation tooling. Ships a prompt pack for codebase analysis and doc generation, a thin Python CLI, an MCP server, drift-detection rules that keep docs honest — and native slash-command skills for Claude Code, Codex, Gemini CLI, and other agent CLIs.
|
|
35
35
|
|
|
@@ -91,10 +91,11 @@ Slash command availability depends on the agent CLI. Claude Code, Codex, and Gem
|
|
|
91
91
|
|
|
92
92
|
| Flag | Effect |
|
|
93
93
|
|------|--------|
|
|
94
|
-
| `./install.sh` | Auto-detect
|
|
95
|
-
| `./install.sh --global` | Skip prompt, install to global agent dirs (all projects) |
|
|
96
|
-
| `./install.sh --local` | Skip prompt, install to `.claude/skills/` and `.agents/skills/` in cwd |
|
|
97
|
-
| `./install.sh --
|
|
94
|
+
| `./install.sh` | Auto-detect agents, prompt for global vs local, prompt which agents to install |
|
|
95
|
+
| `./install.sh --global` | Skip location prompt, install to global agent dirs (all projects) |
|
|
96
|
+
| `./install.sh --local` | Skip location prompt, install to `.claude/skills/` and `.agents/skills/` in cwd |
|
|
97
|
+
| `./install.sh --non-interactive` | Skip all prompts, install globally to all detected agents (useful in CI / curl\|bash) |
|
|
98
|
+
| `./install.sh --only claude` | Claude Code only (skips agent selection prompt) |
|
|
98
99
|
| `./install.sh --only codex` | Codex only |
|
|
99
100
|
| `./install.sh --only gemini` | Gemini CLI only |
|
|
100
101
|
| `./install.sh --dry-run` | Preview, write nothing |
|
|
@@ -148,7 +149,7 @@ jobs:
|
|
|
148
149
|
runs-on: ubuntu-latest
|
|
149
150
|
steps:
|
|
150
151
|
- uses: actions/checkout@v6.0.2
|
|
151
|
-
- uses: derek-palmer/codeforerunner@v0.4.
|
|
152
|
+
- uses: derek-palmer/codeforerunner@v0.4.7
|
|
152
153
|
with:
|
|
153
154
|
fail-on-drift: "true" # set "false" to warn-only
|
|
154
155
|
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# codeForerunner
|
|
4
4
|
|
|
5
|
-
[](https://socket.dev/npm/package/codeforerunner)
|
|
6
6
|
|
|
7
7
|
Model-agnostic repository documentation tooling. Ships a prompt pack for codebase analysis and doc generation, a thin Python CLI, an MCP server, drift-detection rules that keep docs honest — and native slash-command skills for Claude Code, Codex, Gemini CLI, and other agent CLIs.
|
|
8
8
|
|
|
@@ -64,10 +64,11 @@ Slash command availability depends on the agent CLI. Claude Code, Codex, and Gem
|
|
|
64
64
|
|
|
65
65
|
| Flag | Effect |
|
|
66
66
|
|------|--------|
|
|
67
|
-
| `./install.sh` | Auto-detect
|
|
68
|
-
| `./install.sh --global` | Skip prompt, install to global agent dirs (all projects) |
|
|
69
|
-
| `./install.sh --local` | Skip prompt, install to `.claude/skills/` and `.agents/skills/` in cwd |
|
|
70
|
-
| `./install.sh --
|
|
67
|
+
| `./install.sh` | Auto-detect agents, prompt for global vs local, prompt which agents to install |
|
|
68
|
+
| `./install.sh --global` | Skip location prompt, install to global agent dirs (all projects) |
|
|
69
|
+
| `./install.sh --local` | Skip location prompt, install to `.claude/skills/` and `.agents/skills/` in cwd |
|
|
70
|
+
| `./install.sh --non-interactive` | Skip all prompts, install globally to all detected agents (useful in CI / curl\|bash) |
|
|
71
|
+
| `./install.sh --only claude` | Claude Code only (skips agent selection prompt) |
|
|
71
72
|
| `./install.sh --only codex` | Codex only |
|
|
72
73
|
| `./install.sh --only gemini` | Gemini CLI only |
|
|
73
74
|
| `./install.sh --dry-run` | Preview, write nothing |
|
|
@@ -121,7 +122,7 @@ jobs:
|
|
|
121
122
|
runs-on: ubuntu-latest
|
|
122
123
|
steps:
|
|
123
124
|
- uses: actions/checkout@v6.0.2
|
|
124
|
-
- uses: derek-palmer/codeforerunner@v0.4.
|
|
125
|
+
- uses: derek-palmer/codeforerunner@v0.4.7
|
|
125
126
|
with:
|
|
126
127
|
fail-on-drift: "true" # set "false" to warn-only
|
|
127
128
|
```
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "codeforerunner"
|
|
7
|
-
version = "0.4.
|
|
7
|
+
version = "0.4.7"
|
|
8
8
|
description = "Model-agnostic repository documentation tooling (prompt-first; thin CLI)."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -50,7 +50,7 @@ forerunner = "codeforerunner.cli:main"
|
|
|
50
50
|
where = ["src"]
|
|
51
51
|
|
|
52
52
|
[tool.setuptools.package-data]
|
|
53
|
-
codeforerunner = ["py.typed", "prompts/**/*.md", "tasks.json"]
|
|
53
|
+
codeforerunner = ["py.typed", "prompts/**/*.md", "tasks.json", "release_surfaces.json"]
|
|
54
54
|
|
|
55
55
|
[tool.pytest.ini_options]
|
|
56
56
|
testpaths = ["tests"]
|
|
@@ -9,7 +9,7 @@ from pathlib import Path
|
|
|
9
9
|
from typing import Sequence
|
|
10
10
|
|
|
11
11
|
from codeforerunner.bundle import find_prompts_root
|
|
12
|
-
from codeforerunner.prompt_session import
|
|
12
|
+
from codeforerunner.prompt_session import OutcomeKind, PromptSession
|
|
13
13
|
from codeforerunner.tasks import refresh_tasks as _refresh_tasks
|
|
14
14
|
SCAN_DONE_ENV = "FORERUNNER_SCAN_DONE"
|
|
15
15
|
|
|
@@ -23,64 +23,67 @@ def _scan_satisfied(repo_root: Path) -> bool:
|
|
|
23
23
|
)
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
def
|
|
27
|
-
"""Resolve bundle for
|
|
26
|
+
def _resolve_bundle(repo, task: str) -> tuple[str, int]:
|
|
27
|
+
"""Resolve bundle text for *task* under *repo*. Returns (text, exit_code).
|
|
28
|
+
|
|
29
|
+
Encodes the session's closed Outcome into CLI exit codes; the gate/order
|
|
30
|
+
lives in the Prompt Session, this is just the encoder.
|
|
31
|
+
"""
|
|
28
32
|
try:
|
|
29
|
-
prompts_root = find_prompts_root(
|
|
33
|
+
prompts_root = find_prompts_root(repo)
|
|
30
34
|
except FileNotFoundError as e:
|
|
31
35
|
print(f"error: {e}", file=sys.stderr)
|
|
32
36
|
return "", 2
|
|
33
37
|
|
|
34
|
-
repo_root = Path(
|
|
38
|
+
repo_root = Path(repo).resolve() if repo else Path.cwd()
|
|
35
39
|
session = PromptSession(prompts_root, _scan_satisfied(repo_root))
|
|
36
|
-
|
|
37
|
-
if
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
outcome = session.resolve(task)
|
|
41
|
+
if outcome.kind is OutcomeKind.ALLOWED:
|
|
42
|
+
return outcome.text, 0
|
|
43
|
+
if outcome.kind is OutcomeKind.UNKNOWN_TASK:
|
|
44
|
+
print(f"error: unknown task '{task}'", file=sys.stderr)
|
|
45
|
+
return "", 2
|
|
46
|
+
if outcome.kind is OutcomeKind.SCAN_REQUIRED:
|
|
41
47
|
print(
|
|
42
48
|
f"error: scan-first required — run `forerunner scan` first "
|
|
43
49
|
f"(writes .forerunner/scan.md). Set {SCAN_DONE_ENV}=1 to skip.",
|
|
44
50
|
file=sys.stderr,
|
|
45
51
|
)
|
|
46
52
|
return "", 1
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
except FileNotFoundError as e:
|
|
51
|
-
print(f"error: {e}", file=sys.stderr)
|
|
52
|
-
return "", 2
|
|
53
|
+
# MISSING
|
|
54
|
+
print(f"error: {outcome.message}", file=sys.stderr)
|
|
55
|
+
return "", 2
|
|
53
56
|
|
|
54
57
|
|
|
55
|
-
def
|
|
56
|
-
"""Resolve
|
|
57
|
-
bundle, rc =
|
|
58
|
+
def _emit_task(repo, task: str) -> int:
|
|
59
|
+
"""Resolve *task* under *repo* and write its bundle to stdout. Returns rc."""
|
|
60
|
+
bundle, rc = _resolve_bundle(repo, task)
|
|
58
61
|
if rc != 0:
|
|
59
62
|
return rc
|
|
60
63
|
sys.stdout.write(bundle)
|
|
61
64
|
return 0
|
|
62
65
|
|
|
63
66
|
|
|
64
|
-
def
|
|
65
|
-
"""
|
|
66
|
-
|
|
67
|
-
return cmd_doc(ns)
|
|
67
|
+
def cmd_doc(args: argparse.Namespace) -> int:
|
|
68
|
+
"""Resolve base + partials + task bundle to stdout."""
|
|
69
|
+
return _emit_task(args.repo, args.task)
|
|
68
70
|
|
|
69
71
|
|
|
70
72
|
def cmd_init(args: argparse.Namespace) -> int:
|
|
71
73
|
"""Emit onboarding bundle; prepend scan bundle when --full is given."""
|
|
74
|
+
repo = getattr(args, "repo", None)
|
|
72
75
|
if getattr(args, "full", False):
|
|
73
76
|
sys.stdout.write("<!-- forerunner init --full: section 1/2 (scan) -->\n")
|
|
74
|
-
rc =
|
|
77
|
+
rc = _emit_task(repo, "scan")
|
|
75
78
|
if rc != 0:
|
|
76
79
|
return rc
|
|
77
80
|
sys.stdout.write("\n<!-- forerunner init --full: section 2/2 (onboarding) -->\n")
|
|
78
|
-
return
|
|
81
|
+
return _emit_task(repo, "init-agent-onboarding")
|
|
79
82
|
|
|
80
83
|
|
|
81
84
|
def cmd_scan(args: argparse.Namespace) -> int:
|
|
82
85
|
"""Emit the scan prompt bundle and hint about scan artifact."""
|
|
83
|
-
rc =
|
|
86
|
+
rc = _emit_task(getattr(args, "repo", None), "scan")
|
|
84
87
|
if rc == 0:
|
|
85
88
|
print(
|
|
86
89
|
"hint: write the scan result to .forerunner/scan.md to satisfy the "
|
|
@@ -123,10 +126,10 @@ def cmd_mcp_server(args: argparse.Namespace) -> int:
|
|
|
123
126
|
|
|
124
127
|
def cmd_refresh(args: argparse.Namespace) -> int:
|
|
125
128
|
"""Emit scan + check + all doc-task bundles to stdout for a full doc refresh."""
|
|
129
|
+
repo = getattr(args, "repo", None)
|
|
126
130
|
task_names = [t.name for t in _refresh_tasks()]
|
|
127
131
|
for i, task in enumerate(task_names):
|
|
128
|
-
|
|
129
|
-
rc = cmd_doc(ns)
|
|
132
|
+
rc = _emit_task(repo, task)
|
|
130
133
|
if rc != 0:
|
|
131
134
|
return rc
|
|
132
135
|
if i < len(task_names) - 1:
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""Distribution Inventory — single source of truth for distribution artifact
|
|
2
|
+
identity and install policy.
|
|
3
|
+
|
|
4
|
+
Owns the packaging facts that were previously duplicated across the installer,
|
|
5
|
+
doctor, and validation scripts: the canonical skill path, its distributed copy
|
|
6
|
+
paths, the Codex marketplace manifest path, the managed-region markers, and the
|
|
7
|
+
default install-destination templates. Consumers consult this module instead of
|
|
8
|
+
re-declaring constants, so a packaging change is one edit here.
|
|
9
|
+
|
|
10
|
+
Mirrors the Task Registry (``tasks.py``) and Release Surface Manifest
|
|
11
|
+
(``release_surfaces.py``) single-source pattern.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
|
|
18
|
+
# --- artifact identity (repo-relative) ------------------------------------
|
|
19
|
+
|
|
20
|
+
# Source of truth for the codeforerunner skill body; copies derive from it.
|
|
21
|
+
CANONICAL_SKILL_REL = Path("agent/codeforerunner.skill.md")
|
|
22
|
+
|
|
23
|
+
# Distributed copies whose bodies must match the canonical (V10 body parity).
|
|
24
|
+
DISTRIBUTED_SKILL_COPIES_REL: tuple[Path, ...] = (
|
|
25
|
+
Path("plugins/codeforerunner/skills/codeforerunner/SKILL.md"),
|
|
26
|
+
Path("skills/codeforerunner/SKILL.md"),
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Codex marketplace manifest shipped as a release asset.
|
|
30
|
+
MARKETPLACE_MANIFEST_REL = Path("plugins/codex/marketplace.json")
|
|
31
|
+
|
|
32
|
+
# --- managed-region markers -----------------------------------------------
|
|
33
|
+
|
|
34
|
+
# Delimit the installer-owned region in a destination file so re-runs are
|
|
35
|
+
# idempotent and unmanaged content is never clobbered.
|
|
36
|
+
MARKER_BEGIN = "<!-- forerunner:begin managed=codeforerunner.skill -->"
|
|
37
|
+
MARKER_END = "<!-- forerunner:end -->"
|
|
38
|
+
|
|
39
|
+
# --- install-destination templates ----------------------------------------
|
|
40
|
+
|
|
41
|
+
# Agents whose default skill destination the inventory can resolve.
|
|
42
|
+
SKILL_DEST_AGENTS: tuple[str, ...] = ("codex", "claude")
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def skill_destination(agent: str, slug: str, home: Path) -> Path:
|
|
46
|
+
"""Default install path for skill ``slug`` under ``agent``, relative to ``home``."""
|
|
47
|
+
if agent == "codex":
|
|
48
|
+
return home / f".codex/skills/{slug}/SKILL.md"
|
|
49
|
+
if agent == "claude":
|
|
50
|
+
return home / f".claude/plugins/codeforerunner/skills/{slug}/SKILL.md"
|
|
51
|
+
raise ValueError(f"no default skill destination for agent {agent!r} (expected: {', '.join(SKILL_DEST_AGENTS)})")
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def marketplace_destination(home: Path) -> Path:
|
|
55
|
+
"""Default install path for the Codex marketplace manifest, relative to ``home``."""
|
|
56
|
+
return home / ".codex/marketplaces/codeforerunner.json"
|
|
@@ -11,17 +11,18 @@ from dataclasses import dataclass
|
|
|
11
11
|
from pathlib import Path
|
|
12
12
|
from typing import Callable
|
|
13
13
|
|
|
14
|
+
from codeforerunner import distribution as _dist
|
|
15
|
+
from codeforerunner import skill_parity as _parity
|
|
14
16
|
from codeforerunner.config import CONFIG_FILENAME, ConfigError, load_from_repo
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
MARKETPLACE_REL = Path("plugins/codex/marketplace.json")
|
|
18
|
+
# Distribution artifact identity and markers come from the Distribution
|
|
19
|
+
# Inventory; re-exported here for callers/tests that import them off doctor.
|
|
20
|
+
CANONICAL_REL = _dist.CANONICAL_SKILL_REL
|
|
21
|
+
SKILL_COPIES_REL: tuple[Path, ...] = _dist.DISTRIBUTED_SKILL_COPIES_REL
|
|
22
|
+
MARKETPLACE_REL = _dist.MARKETPLACE_MANIFEST_REL
|
|
22
23
|
|
|
23
|
-
MARKER_BEGIN =
|
|
24
|
-
MARKER_END =
|
|
24
|
+
MARKER_BEGIN = _dist.MARKER_BEGIN
|
|
25
|
+
MARKER_END = _dist.MARKER_END
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
@dataclass(frozen=True)
|
|
@@ -37,14 +38,14 @@ def _installed_skill_destinations() -> list[Path]:
|
|
|
37
38
|
"""Return default install paths for the codeforerunner skill across supported agents."""
|
|
38
39
|
home = Path(os.path.expanduser("~"))
|
|
39
40
|
return [
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
_dist.skill_destination(agent, "codeforerunner", home)
|
|
42
|
+
for agent in _dist.SKILL_DEST_AGENTS
|
|
42
43
|
]
|
|
43
44
|
|
|
44
45
|
|
|
45
46
|
def _installed_marketplace_destination() -> Path:
|
|
46
47
|
"""Return default install path for the Codex marketplace manifest."""
|
|
47
|
-
return Path(os.path.expanduser("~"))
|
|
48
|
+
return _dist.marketplace_destination(Path(os.path.expanduser("~")))
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
def _load_script_module(repo: Path, relpath: str, module_name: str):
|
|
@@ -62,25 +63,14 @@ def _load_script_module(repo: Path, relpath: str, module_name: str):
|
|
|
62
63
|
|
|
63
64
|
|
|
64
65
|
def _check_skill_body_parity(repo: Path, run_scripts: bool = False) -> list[Finding]:
|
|
65
|
-
"""Verify that all distributed skill copies match the canonical body.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
]
|
|
74
|
-
try:
|
|
75
|
-
skill_mod = _load_script_module(
|
|
76
|
-
repo, "scripts/validate_skill_copies.py", "_forerunner_doctor_skill_copies"
|
|
77
|
-
)
|
|
78
|
-
strip_frontmatter: Callable[[str], str] = skill_mod.strip_frontmatter
|
|
79
|
-
except Exception as exc: # pragma: no cover - defensive
|
|
80
|
-
return [Finding("error", "skill-body-parity", f"loader failure: {exc}")]
|
|
81
|
-
|
|
82
|
-
canonical_path = repo / CANONICAL_REL
|
|
83
|
-
if not canonical_path.is_file():
|
|
66
|
+
"""Verify that all distributed skill copies match the canonical body.
|
|
67
|
+
|
|
68
|
+
Body parity is owned by the Skill Body Parity module, which only reads
|
|
69
|
+
files (no target-repo code is executed), so this runs regardless of
|
|
70
|
+
``run_scripts`` — that flag still gates checks that load repo scripts.
|
|
71
|
+
"""
|
|
72
|
+
result = _parity.check_skill_body_parity(repo)
|
|
73
|
+
if result.missing_canonical:
|
|
84
74
|
return [
|
|
85
75
|
Finding(
|
|
86
76
|
"error",
|
|
@@ -88,21 +78,12 @@ def _check_skill_body_parity(repo: Path, run_scripts: bool = False) -> list[Find
|
|
|
88
78
|
f"canonical skill missing: {CANONICAL_REL}",
|
|
89
79
|
)
|
|
90
80
|
]
|
|
91
|
-
canonical_body = strip_frontmatter(canonical_path.read_text(encoding="utf-8"))
|
|
92
81
|
|
|
93
82
|
findings: list[Finding] = []
|
|
94
|
-
for rel in
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
Finding("error", "skill-body-parity", f"copy missing: {rel}")
|
|
99
|
-
)
|
|
100
|
-
continue
|
|
101
|
-
body = strip_frontmatter(p.read_text(encoding="utf-8"))
|
|
102
|
-
if body != canonical_body:
|
|
103
|
-
findings.append(
|
|
104
|
-
Finding("error", "skill-body-parity", f"body drift in {rel}")
|
|
105
|
-
)
|
|
83
|
+
for rel in result.missing_copies:
|
|
84
|
+
findings.append(Finding("error", "skill-body-parity", f"copy missing: {rel}"))
|
|
85
|
+
for rel in result.drifted_copies:
|
|
86
|
+
findings.append(Finding("error", "skill-body-parity", f"body drift in {rel}"))
|
|
106
87
|
if not findings:
|
|
107
88
|
findings.append(
|
|
108
89
|
Finding(
|