From 5d96d4e8560d1835c4ac026c6da4fc0d09e1394e Mon Sep 17 00:00:00 2001 From: Kushal Dave Date: Tue, 17 Nov 2026 22:34:00 -0500 Subject: [PATCH] docs: fix packaging, URL, version, and CLI help drift --- .github/workflows/ci.yml | 33 +++++++++ .github/workflows/release.yml | 4 +- .lycheeignore | 15 ++++ CITATION.cff | 2 +- Dockerfile | 2 +- README.md | 4 +- docs/CI.md | 4 +- docs/REFERENCE.md | 20 +++--- docs/agents.md | 2 +- examples/ci/gitlab-ci.yml | 2 +- install.ps1 | 4 +- install.sh | 4 +- npm/secfoo-darwin-arm64/package.json | 2 +- npm/secfoo-darwin-x64/package.json | 2 +- npm/secfoo-linux-arm64/package.json | 2 +- npm/secfoo-linux-x64/package.json | 2 +- npm/secfoo-win32-x64/package.json | 2 +- npm/secfoo/README.md | 2 +- npm/secfoo/package.json | 4 +- pyproject.toml | 4 -- src/secfoo/__about__.py | 2 +- src/secfoo/agents/api.py | 4 +- src/secfoo/cli.py | 7 +- tests/test_agents/test_api.py | 4 +- tests/test_docs_consistency.py | 104 +++++++++++++++++++++++++++ 25 files changed, 196 insertions(+), 41 deletions(-) create mode 100644 .lycheeignore create mode 100644 tests/test_docs_consistency.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4443490..f1edcd7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,3 +55,36 @@ jobs: - name: Validate example custom skills # Same check a team's own skills repo would run (docs/SKILLS.md). run: secfoo skills validate examples/skills + + - name: Check __about__.py version is >= latest PyPI release + run: | + python - <<'PY' + import json + import urllib.error + import urllib.request + from packaging.version import Version + from secfoo import __version__ + + try: + with urllib.request.urlopen("https://pypi.org/pypi/secfoo/json", timeout=15) as resp: + pypi_version = json.loads(resp.read().decode("utf-8"))["info"]["version"] + except (urllib.error.URLError, TimeoutError) as exc: + print(f"Skipping PyPI version comparison (network unavailable): {exc}") + else: + print(f"Local __version__: {__version__}, PyPI latest: {pypi_version}") + assert Version(__version__) >= Version(pypi_version), ( + f"src/secfoo/__about__.py ({__version__}) is behind PyPI ({pypi_version})" + ) + PY + + docs-links: + name: Docs link check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + + - name: Check links in README.md and docs/ + uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332 # v2.4.1 + with: + args: --verbose --no-progress --accept 200..=299,429 README.md docs/ + fail: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a7a0ef..86cf8ca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -197,5 +197,5 @@ jobs: context: . push: true tags: | - ghcr.io/rakfortltd/secfoo:${{ needs.check-version.outputs.version }} - ghcr.io/rakfortltd/secfoo:latest + ghcr.io/secfoo-com/secfoo:${{ needs.check-version.outputs.version }} + ghcr.io/secfoo-com/secfoo:latest diff --git a/.lycheeignore b/.lycheeignore new file mode 100644 index 0000000..4b3aa12 --- /dev/null +++ b/.lycheeignore @@ -0,0 +1,15 @@ +# Placeholder / example URLs used in documentation snippets +^https://github\.com/org/ +^https://github\.com/acme/ +^https://raw\.githubusercontent\.com/acme/ +^https://gitlab\.com/group/ +^https://bitbucket\.org/workspace/ +^https://yourcompany\.atlassian\.net/ +^https://mcp\.example\.com/ +^https://memory\.internal\.example +^https://secfoo\.internal +^https://\.\.\./ +# Authenticated MCP endpoint returns 401/403 without OAuth token +^https://mcp\.atlassian\.com/v1/mcp/authv2 +# Localhost / loopback examples +^https?://(localhost|127\.0\.0\.1)(:[0-9]+)? diff --git a/CITATION.cff b/CITATION.cff index 9d25d75..985b2f7 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,7 +1,7 @@ cff-version: 1.2.0 message: "If you use secfoo in your research or tooling, please cite it as below." title: "secfoo" -abstract: "Context-based security architectural assessment orchestrator: pick skills, targets, and an agent CLI to run them." +abstract: "AI security review CLI: SAST, secret scanning, SCA, threat modeling, and architecture review with Claude Code, Copilot, Codex, Gemini, Cursor, or an API key." authors: - name: "RakFort" repository-code: "https://github.com/secfoo-com/secfoo" diff --git a/Dockerfile b/Dockerfile index fe7e2fb..b8da6c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -# Published to ghcr.io/rakfortltd/secfoo by .github/workflows/release.yml. +# Published to ghcr.io/secfoo-com/secfoo by .github/workflows/release.yml. # Installs from PyPI rather than PyInstaller-bundling -- simplest, most # robust route for a container image, since there's no cross-platform # concern (the image itself is the platform). diff --git a/README.md b/README.md index 1752ad3..27dc9ac 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ uvx secfoo --help # run from PyPI without installing (uv) pipx install secfoo # isolated install, Python 3.10+ pip install secfoo # PyPI npm install -g @rakfortltd/secfoo # npm, no Python needed -docker run --rm ghcr.io/rakfortltd/secfoo --help +docker run --rm ghcr.io/secfoo-com/secfoo --help ``` No agent CLI? Use an API key: @@ -241,7 +241,7 @@ steps: - **GitHub Action** with SARIF upload, job summary and severity outputs: [docs/CI.md](https://github.com/secfoo-com/secfoo/blob/main/docs/CI.md#github-actions) - **pre-commit**: `repo: https://github.com/secfoo-com/secfoo`, hooks `secfoo-secrets` and `secfoo` ([example](https://github.com/secfoo-com/secfoo/blob/main/examples/ci/pre-commit-config.yaml)) - **GitLab CI** job with SARIF artifact: [examples/ci/gitlab-ci.yml](https://github.com/secfoo-com/secfoo/blob/main/examples/ci/gitlab-ci.yml) -- **Docker**: `docker run --rm ghcr.io/rakfortltd/secfoo --help` +- **Docker**: `docker run --rm ghcr.io/secfoo-com/secfoo --help` - **Anywhere else**: `secfoo run ... --json --fail-on high`, then `secfoo findings export --format sarif`. Exit codes `0` clean, `1` run failed, `2` findings gate, `3` cost gate. ## Learn more diff --git a/docs/CI.md b/docs/CI.md index a75b78b..179da17 100644 --- a/docs/CI.md +++ b/docs/CI.md @@ -183,12 +183,12 @@ including merge-request rules and a container-image variant: The image on GHCR has secfoo and git, nothing else: ```bash -docker run --rm -e OPENAI_API_KEY -v "$PWD:/workspace" ghcr.io/rakfortltd/secfoo \ +docker run --rm -e OPENAI_API_KEY -v "$PWD:/workspace" ghcr.io/secfoo-com/secfoo \ run --agent api --target /workspace --depth quick --json --rescan --skill sast --fail-on high ``` No agent CLI is installed in the image, so `--agent api` is the practical -choice; build `FROM ghcr.io/rakfortltd/secfoo` and `npm install -g +choice; build `FROM ghcr.io/secfoo-com/secfoo` and `npm install -g @anthropic-ai/claude-code` (or another CLI) if you want one. The store is `/root/.secfoo`; mount it to keep findings between jobs. See the [Distribution](REFERENCE.md#distribution) notes. diff --git a/docs/REFERENCE.md b/docs/REFERENCE.md index 918f2e2..60c090f 100644 --- a/docs/REFERENCE.md +++ b/docs/REFERENCE.md @@ -721,16 +721,16 @@ pipx install secfoo npm install -g @rakfortltd/secfoo # Universal installer script (macOS/Linux, no Python or Node needed) -curl -fsSL https://raw.githubusercontent.com/rakfortltd/secfoo/main/install.sh | sh +curl -fsSL https://raw.githubusercontent.com/secfoo-com/secfoo/main/install.sh | sh # Windows (PowerShell), no Python or Node needed -irm https://raw.githubusercontent.com/rakfortltd/secfoo/main/install.ps1 | iex +irm https://raw.githubusercontent.com/secfoo-com/secfoo/main/install.ps1 | iex # Docker (nothing installed on the host at all) -docker run --rm ghcr.io/rakfortltd/secfoo --help +docker run --rm ghcr.io/secfoo-com/secfoo --help # Or grab a binary directly for your platform from the Releases page: -# https://github.com/rakfortltd/secfoo/releases +# https://github.com/secfoo-com/secfoo/releases ``` Developing on this repo instead? `pip install -e ".[dev]"`. @@ -949,20 +949,20 @@ Every install channel above is built on the same foundation: standalone, self-contained binaries (bundled Python interpreter + all dependencies — nothing needs to be pre-installed) for macOS (arm64/x64), Linux (x64/arm64), and Windows (x64), built by CI (`.github/workflows/release.yml`) -on every `vX.Y.Z` tag push and attached to the matching GitHub Release -along with a `SHA256SUMS` file. +via manual `workflow_dispatch` for an existing `vX.Y.Z` tag and attached to +the matching GitHub Release along with a `SHA256SUMS` file. - **pip**: the "real"/native path — a normal Python sdist+wheel, published to PyPI as usual. -- **npm**: `@rakfortltd/secfoo` is a tiny meta-package whose - `optionalDependencies` are 5 per-platform packages +- **npm**: `@rakfortltd/secfoo` (published under RakFort's npm scope) is a + tiny meta-package whose `optionalDependencies` are 5 per-platform packages (`@rakfortltd/secfoo-darwin-arm64`, etc.), each containing just that platform's binary. npm installs only the one matching your machine — no `postinstall` network fetch, which is what makes this safe to use behind a locked-down corporate npm/Artifactory mirror. - **install.sh / install.ps1**: detect your OS/arch, download the matching binary from the latest GitHub Release, verify its SHA256, install it. -- **Docker**: `ghcr.io/rakfortltd/secfoo`, built from the PyPI package on +- **Docker**: `ghcr.io/secfoo-com/secfoo`, built from the PyPI package on a slim Python base (simplest, most robust route for a container image — no cross-platform concern since the image itself is the platform). **Note**: none of the agent CLIs listed in the @@ -977,7 +977,7 @@ along with a `SHA256SUMS` file. ```bash docker run --rm -p 8787:8787 -v ~/.secfoo:/root/.secfoo \ - ghcr.io/rakfortltd/secfoo serve --host 0.0.0.0 --port 8787 + ghcr.io/secfoo-com/secfoo serve --host 0.0.0.0 --port 8787 ``` - **GitHub Action**: `uses: secfoo-com/secfoo@main` (composite action in diff --git a/docs/agents.md b/docs/agents.md index 25122c6..20207fe 100644 --- a/docs/agents.md +++ b/docs/agents.md @@ -18,7 +18,7 @@ brackets indicate optional arguments. All CLI processes run in `WORKDIR`. | `copilot` | The adapter identifies the npm package as `@github/copilot`; install and authentication commands are unverified. `copilot [--model MODEL] --output-format json --allow-all-tools` (prompt on stdin). Tools, including writes, are auto-approved: read-only behavior relies on review instructions, not a sandbox. | | `droid` | Install command unverified. Set `FACTORY_API_KEY` for noninteractive use. `droid exec [-m MODEL] --output-format json --cwd WORKDIR -- PROMPT`. Droid defaults to read-only; a full authenticated secfoo run was not verified in the adapter. | | `devin` | The adapter identifies the official Homebrew cask as `devin-cli`; install command unverified. Authenticate beforehand with `devin auth login`; credential reuse for headless runs is unverified. `devin -p PROMPT --respect-workspace-trust false --permission-mode auto`. The combined command and an authenticated end-to-end run are unverified; `auto` is documented by the CLI as approving read-only tools. | -| `api` | No agent binary is invoked. If dependencies are missing, run `pip install "secfoo[api]"`. Set `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, or `GEMINI_API_KEY`. Source files are included in the API prompt. Model selection uses the configured model, then `SECFOO_API_MODEL`, then `openai/gpt-4.1-mini`. | +| `api` | No agent binary is invoked (`litellm` and `langgraph` are installed with `secfoo`). Set `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, or `GEMINI_API_KEY`. Source files are included in the API prompt. Model selection uses the configured model, then `SECFOO_API_MODEL`, then `openai/gpt-4.1-mini`. | `agy` and `devin` do not support adapter model selection; secfoo warns and ignores a requested model. Other CLI model flags are shown above. diff --git a/examples/ci/gitlab-ci.yml b/examples/ci/gitlab-ci.yml index 2871fe3..99bcf15 100644 --- a/examples/ci/gitlab-ci.yml +++ b/examples/ci/gitlab-ci.yml @@ -37,7 +37,7 @@ secfoo: # secfoo-docker: # stage: test # image: -# name: ghcr.io/rakfortltd/secfoo:latest +# name: ghcr.io/secfoo-com/secfoo:latest # entrypoint: [""] # script: # - secfoo run --agent api --target . --depth quick --json --rescan --skill sast --fail-on high > secfoo-result.json diff --git a/install.ps1 b/install.ps1 index d05c594..097ddb9 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1,5 +1,5 @@ # Universal installer for secfoo (Windows). Usage: -# irm https://raw.githubusercontent.com/rakfortltd/secfoo/main/install.ps1 | iex +# irm https://raw.githubusercontent.com/secfoo-com/secfoo/main/install.ps1 | iex # # Downloads the latest secfoo-win32-x64.exe from GitHub Releases, verifies # its checksum, and installs it to $env:LOCALAPPDATA\secfoo\secfoo.exe, @@ -7,7 +7,7 @@ $ErrorActionPreference = "Stop" -$Repo = "rakfortltd/secfoo" +$Repo = "secfoo-com/secfoo" $InstallDir = Join-Path $env:LOCALAPPDATA "secfoo" $Asset = "secfoo-win32-x64.exe" diff --git a/install.sh b/install.sh index e0b6504..6eb2af2 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #!/bin/sh # Universal installer for secfoo (macOS/Linux). Usage: -# curl -fsSL https://raw.githubusercontent.com/rakfortltd/secfoo/main/install.sh | sh +# curl -fsSL https://raw.githubusercontent.com/secfoo-com/secfoo/main/install.sh | sh # # Downloads the correct standalone binary from the latest GitHub Release, # verifies its checksum, and installs it to $PREFIX/bin (default @@ -8,7 +8,7 @@ # POSIX sh only -- no bashisms -- since /bin/sh is dash on many systems. set -e -REPO="rakfortltd/secfoo" +REPO="secfoo-com/secfoo" PREFIX="${PREFIX:-/usr/local}" os_name() { diff --git a/npm/secfoo-darwin-arm64/package.json b/npm/secfoo-darwin-arm64/package.json index 8b116a3..63437a6 100644 --- a/npm/secfoo-darwin-arm64/package.json +++ b/npm/secfoo-darwin-arm64/package.json @@ -7,6 +7,6 @@ "license": "Apache-2.0", "repository": { "type": "git", - "url": "git+https://github.com/rakfortltd/secfoo.git" + "url": "git+https://github.com/secfoo-com/secfoo.git" } } diff --git a/npm/secfoo-darwin-x64/package.json b/npm/secfoo-darwin-x64/package.json index 53af8b0..9201cb9 100644 --- a/npm/secfoo-darwin-x64/package.json +++ b/npm/secfoo-darwin-x64/package.json @@ -7,6 +7,6 @@ "license": "Apache-2.0", "repository": { "type": "git", - "url": "git+https://github.com/rakfortltd/secfoo.git" + "url": "git+https://github.com/secfoo-com/secfoo.git" } } diff --git a/npm/secfoo-linux-arm64/package.json b/npm/secfoo-linux-arm64/package.json index 5ece7cb..5a25854 100644 --- a/npm/secfoo-linux-arm64/package.json +++ b/npm/secfoo-linux-arm64/package.json @@ -7,6 +7,6 @@ "license": "Apache-2.0", "repository": { "type": "git", - "url": "git+https://github.com/rakfortltd/secfoo.git" + "url": "git+https://github.com/secfoo-com/secfoo.git" } } diff --git a/npm/secfoo-linux-x64/package.json b/npm/secfoo-linux-x64/package.json index 5fca1f8..8ce5fbe 100644 --- a/npm/secfoo-linux-x64/package.json +++ b/npm/secfoo-linux-x64/package.json @@ -7,6 +7,6 @@ "license": "Apache-2.0", "repository": { "type": "git", - "url": "git+https://github.com/rakfortltd/secfoo.git" + "url": "git+https://github.com/secfoo-com/secfoo.git" } } diff --git a/npm/secfoo-win32-x64/package.json b/npm/secfoo-win32-x64/package.json index 094f851..ece2713 100644 --- a/npm/secfoo-win32-x64/package.json +++ b/npm/secfoo-win32-x64/package.json @@ -7,6 +7,6 @@ "license": "Apache-2.0", "repository": { "type": "git", - "url": "git+https://github.com/rakfortltd/secfoo.git" + "url": "git+https://github.com/secfoo-com/secfoo.git" } } diff --git a/npm/secfoo/README.md b/npm/secfoo/README.md index f45cce0..7099910 100644 --- a/npm/secfoo/README.md +++ b/npm/secfoo/README.md @@ -9,4 +9,4 @@ npm install -g @rakfortltd/secfoo secfoo run --skill security-architecture-review --agent claude ``` -Full documentation: https://github.com/rakfortltd/secfoo +Full documentation: https://github.com/secfoo-com/secfoo diff --git a/npm/secfoo/package.json b/npm/secfoo/package.json index 38cd160..e3e57fb 100644 --- a/npm/secfoo/package.json +++ b/npm/secfoo/package.json @@ -16,10 +16,10 @@ "node": ">=16" }, "license": "Apache-2.0", - "homepage": "https://github.com/rakfortltd/secfoo", + "homepage": "https://github.com/secfoo-com/secfoo", "repository": { "type": "git", - "url": "git+https://github.com/rakfortltd/secfoo.git" + "url": "git+https://github.com/secfoo-com/secfoo.git" }, "keywords": [ "security", diff --git a/pyproject.toml b/pyproject.toml index 1d08faf..62bbc9d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,10 +69,6 @@ dependencies = [ [project.optional-dependencies] dev = ["jsonschema>=4.26.0", "pytest>=9.2.0", "hypothesis>=6.168.5", "httpx>=0.28.1", "ruff>=0.17.5", "bandit>=1.9.4", "pip-audit>=2.10.1", "langgraph>=1.2.21"] build = ["pyinstaller>=6.22.3"] -# The `api` agent (secfoo/agents/api.py): a LangGraph workflow that calls OpenAI/Anthropic/Gemini -# through LiteLLM with an API key instead of driving an installed agent CLI. -# (dev includes langgraph so the real graph runs in tests; litellm is faked.) -api = ["litellm>=1.109.1", "langgraph>=1.2.21"] [project.urls] Homepage = "https://secfoo.com" diff --git a/src/secfoo/__about__.py b/src/secfoo/__about__.py index 493f741..260c070 100644 --- a/src/secfoo/__about__.py +++ b/src/secfoo/__about__.py @@ -1 +1 @@ -__version__ = "0.3.0" +__version__ = "0.3.1" diff --git a/src/secfoo/agents/api.py b/src/secfoo/agents/api.py index a6a9384..db240e3 100644 --- a/src/secfoo/agents/api.py +++ b/src/secfoo/agents/api.py @@ -295,7 +295,9 @@ def run(self, prompt: str, *, workdir: Path, timeout: int | None = None, prev_co from langgraph.graph import END, START, StateGraph except ImportError: return self._result( - "failed", started, stderr='litellm/langgraph are not installed. Run: pip install "secfoo[api]"' + "failed", + started, + stderr="litellm/langgraph are not installed. Reinstall secfoo: pip install --force-reinstall secfoo", ) try: final = build_graph(litellm, StateGraph, START, END).invoke({ diff --git a/src/secfoo/cli.py b/src/secfoo/cli.py index be29a42..fbc77d9 100644 --- a/src/secfoo/cli.py +++ b/src/secfoo/cli.py @@ -39,7 +39,10 @@ from secfoo.storage.repository import RunRepository from secfoo.targets.resolver import TargetResolutionError, resolve_target -app = typer.Typer(name="secfoo", help="Context-based security architectural assessment.") +app = typer.Typer( + name="secfoo", + help="AI security review CLI: SAST, secret scanning, SCA, threat modeling, and architecture review.", +) mcp_app = typer.Typer(name="mcp", help="Manage MCP servers configured in ~/.secfoo/config.toml.") config_app = typer.Typer(name="config", help="Manage ~/.secfoo/config.toml.") assessment_app = typer.Typer(name="assessment", help="Manage assessment case files.") @@ -83,7 +86,7 @@ def _root( typer.Option("--version", "-V", is_eager=True, callback=_show_version, help="Show the installed version and exit."), ] = False, ) -> None: - """Context-based security architectural assessment.""" + """AI security review CLI: SAST, secret scanning, SCA, threat modeling, and architecture review.""" @app.command() diff --git a/tests/test_agents/test_api.py b/tests/test_agents/test_api.py index 3a1e06b..0313722 100644 --- a/tests/test_agents/test_api.py +++ b/tests/test_agents/test_api.py @@ -227,7 +227,9 @@ def test_run_without_litellm_installed_says_how_to_install_it(tmp_path, monkeypa result = ApiAdapter().run("prompt", workdir=tmp_path) assert result.status == "failed" - assert "secfoo[api]" in result.stderr + assert "pip install" in result.stderr + assert "secfoo" in result.stderr + assert "secfoo[api]" not in result.stderr def test_incomplete_report_is_reformatted_once_without_resending_source(tmp_path, monkeypatch): diff --git a/tests/test_docs_consistency.py b/tests/test_docs_consistency.py new file mode 100644 index 0000000..1256734 --- /dev/null +++ b/tests/test_docs_consistency.py @@ -0,0 +1,104 @@ +"""Guard against documentation, CLI metadata, and packaging drift (#120).""" + +from __future__ import annotations + +import re +from pathlib import Path + +try: + import tomllib +except ModuleNotFoundError: # pragma: no cover - Python 3.10 + import tomli as tomllib # type: ignore[no-redef] + +from typer.testing import CliRunner + +from secfoo import __version__ +from secfoo.cli import app + +REPO_ROOT = Path(__file__).resolve().parent.parent + + +def _doc_files() -> list[Path]: + return [REPO_ROOT / "README.md", *sorted((REPO_ROOT / "docs").glob("*.md"))] + + +def test_no_obsolete_secfoo_api_extra(): + pyproject = tomllib.loads((REPO_ROOT / "pyproject.toml").read_text(encoding="utf-8")) + extras = pyproject["project"].get("optional-dependencies", {}) + assert "api" not in extras, "litellm/langgraph are base dependencies; remove empty [api] extra" + + deps = pyproject["project"]["dependencies"] + assert any(d.startswith("litellm") for d in deps) + assert any(d.startswith("langgraph") for d in deps) + + paths = [*_doc_files(), REPO_ROOT / "pyproject.toml", *sorted((REPO_ROOT / "src" / "secfoo").rglob("*.py"))] + for path in paths: + text = path.read_text(encoding="utf-8") + assert "secfoo[api]" not in text, f"obsolete secfoo[api] reference in {path.relative_to(REPO_ROOT)}" + + +def test_no_obsolete_rakfortltd_repo_or_ghcr_urls(): + """Repo, raw, release, and GHCR URLs must point to secfoo-com/secfoo (npm scope @rakfortltd stays).""" + bad_patterns = ( + "github.com/rakfortltd/secfoo", + "raw.githubusercontent.com/rakfortltd/secfoo", + "ghcr.io/rakfortltd/secfoo", + 'REPO="rakfortltd/secfoo"', + '$Repo = "rakfortltd/secfoo"', + ) + paths = [ + *_doc_files(), + REPO_ROOT / "install.sh", + REPO_ROOT / "install.ps1", + REPO_ROOT / "Dockerfile", + REPO_ROOT / ".github" / "workflows" / "release.yml", + REPO_ROOT / "examples" / "ci" / "gitlab-ci.yml", + *sorted((REPO_ROOT / "npm").rglob("package.json")), + REPO_ROOT / "npm" / "secfoo" / "README.md", + ] + for path in paths: + text = path.read_text(encoding="utf-8") + for pat in bad_patterns: + assert pat not in text, f"obsolete '{pat}' in {path.relative_to(REPO_ROOT)}" + + +def test_descriptions_aligned_across_pyproject_citation_and_cli_help(): + pyproject = tomllib.loads((REPO_ROOT / "pyproject.toml").read_text(encoding="utf-8")) + citation = (REPO_ROOT / "CITATION.cff").read_text(encoding="utf-8") + runner = CliRunner() + result = runner.invoke(app, ["--help"]) + assert result.exit_code == 0 + + for label, text in ( + ("pyproject.toml", pyproject["project"]["description"]), + ("CITATION.cff", citation), + ("secfoo --help", result.output), + ): + assert "AI security review CLI" in text, f"{label} missing 'AI security review CLI'" + assert "Context-based security architectural assessment" not in text, ( + f"obsolete description still present in {label}" + ) + + +def test_reference_release_trigger_matches_workflow_dispatch(): + ref = (REPO_ROOT / "docs" / "REFERENCE.md").read_text(encoding="utf-8") + rel = (REPO_ROOT / ".github" / "workflows" / "release.yml").read_text(encoding="utf-8") + assert "workflow_dispatch:" in rel + assert "on every `vX.Y.Z` tag push" not in ref + assert "workflow_dispatch" in ref + + +def test_version_is_at_least_0_3_1(): + parts = tuple(int(p) for p in __version__.split(".")[:3]) + assert parts >= (0, 3, 1), f"__version__ ({__version__}) behind published PyPI release 0.3.1" + + +def test_relative_markdown_links_resolve(): + link_re = re.compile(r"\[[^\]]+\]\(([^)#\s]+)(?:#[^)]*)?\)") + for md in _doc_files(): + text = md.read_text(encoding="utf-8") + for target in link_re.findall(text): + if target.startswith(("http://", "https://", "mailto:")): + continue + resolved = (md.parent / target).resolve() + assert resolved.exists(), f"broken relative link '{target}' in {md.relative_to(REPO_ROOT)}"