Skip to content

Commit 62b18df

Browse files
djm81Dominikus Nold
andauthored
fix: GitHub Pages configuration and linting improvements (#9)
* chore: remove mcp.json from version control * fix: correct test paths for new .specfact structure - Fix test_compare_with_smart_defaults: remove duplicate mkdir for plans directory - Fix test_compare_output_to_specfact_reports: move auto-derived plan to .specfact/plans/ instead of .specfact/reports/brownfield/ - Fix test_team_collaboration_workflow: use correct pattern 'report-*.md' for comparison reports and check auto-derived plans in .specfact/plans/ * fix: update .gitignore * fix: correct pre-merge check to only flag root-level temporary files - Fix regex to only match temporary files at project root (not in tests/) - Patterns match .gitignore: /test_*.py, /debug_*.py, /trigger_*.py, /temp_*.py - Use grep -v '/' to ensure files are at root level (no subdirectories) - Also check for analysis artifacts at root - Exclude legitimate test files in tests/ directory * fix: add conftest.py to fix tools imports in tests - Create tests/conftest.py to add project root to sys.path - Fixes ModuleNotFoundError for 'tools' module in Python 3.11 tests - Update test_smart_test_coverage.py to use consistent sys.path approach - Required because pytest --import-mode=importlib doesn't respect pythonpath during test collection * fix: install specfact-cli from local source in specfact-gate workflow - Change from 'pip install specfact-cli' (PyPI) to 'pip install -e .' (local source) - Required because package is not yet published to PyPI - Matches approach used in pr-orchestrator.yml workflow - Install hatch first to ensure proper environment setup * refactor: combine hatch installation and CLI setup steps - Combine 'Install dependencies' and 'Install SpecFact CLI from source' steps - Ensures hatch is available before use - Matches pattern used in pr-orchestrator.yml cli-validation job - More efficient and clearer workflow structure * fix: make repro main command the default callback - Replace @app.command() with @app.callback(invoke_without_command=True) - Allows 'specfact repro --verbose --budget 90' without requiring a subcommand - Fixes workflow error: 'No such option: --verbose' - main() now runs when repro is called without a subcommand * fix: remove invalid -k filter from Python 3.11 compatibility tests - Remove -k 'contract' filter that was deselecting all tests (exit code 5) - Run unit and integration tests instead for Python 3.11 compatibility check - Skip E2E tests to keep compatibility check fast - Tests are advisory (don't fail build) to allow gradual compatibility work * fix: sync __version__ with pyproject.toml (0.4.0) - Update __version__ in __init__.py to match pyproject.toml version - Ensures version consistency across package metadata * fix: exclude tests, docs, tools from PyPI package - Add [tool.hatch.build.targets.sdist] configuration - Include only essential files: src/, README.md, LICENSE.md, pyproject.toml - Exclude development files: tests/, tools/, docs/, .github/, .cursor/, contracts/, reports/, etc. - Ensure clean PyPI package with only production code * docs: fix uvx command syntax in all documentation - Update all occurrences of 'uvx specfact' to 'uvx --from specfact-cli specfact' - Fixes issue where uvx couldn't find package by command name alone - Package name is 'specfact-cli', command name is 'specfact' - Updated in: README.md, docs/README.md, docs/getting-started/installation.md, docs/guides/competitive-analysis.md, AGENTS.md * fix: Contract test directory handling and GitHub Pages legal files (#3) * fix: handle directories in contract test file scanning - Add is_file() check in _get_modified_files() to skip directories - Add IsADirectoryError handling in _get_file_hash() and _compute_file_hash() - Fix contract test error when scanning resources directory - Ensure only Python files are processed for contract validation * fix: include LICENSE.md and TRADEMARKS.md in GitHub Pages - Copy LICENSE.md and TRADEMARKS.md to docs/ before building - Add root files to workflow paths trigger - Update docs/index.md to use relative links for LICENSE and TRADEMARKS - Ensure legal information is included in published documentation * feat: enable PR orchestrator workflow for dev branch - Add dev branch to pull_request and push triggers - Ensure CI/CD runs on PRs to both main and dev branches - Maintains same path ignore rules for both branches * feat: enable specfact-gate workflow for dev branch - Add dev branch to pull_request and push triggers - Ensure contract validation runs on PRs to both main and dev branches * fix: replace percent format with f-string in plan.py - Fix UP031 ruff error by using f-string instead of percent format - Update prompt text to use modern Python string formatting * fix: resolve import sorting conflict between isort and ruff - Remove isort from format and lint scripts to avoid conflicts - Configure ruff's isort to match black profile (multi_line_output=3, combine_as_imports) - Use ruff for both import sorting and formatting (more reliable and modern) - Fix I001 import sorting errors in plan.py This resolves the conflict where format and lint were producing different results due to isort and ruff having different import sorting configurations. * fix: use hatch run in GitHub workflow to ensure tools are available - Change specfact repro to hatch run specfact repro in specfact-gate.yml - Ensures all tools (semgrep, basedpyright, ruff, crosshair) are available in PATH - Fix I001 import sorting in plan.py * fix: replace try-except-pass with contextlib.suppress in logger_setup - Fix SIM105 ruff error by using contextlib.suppress(Exception) - Replace nested try-except-pass blocks with contextlib.suppress - Improves code quality and follows ruff best practices * fix: exclude logger_setup.py from CrossHair analysis - Exclude logger_setup.py from CrossHair due to known signature analysis bug - CrossHair has issues analyzing functions with *args/**kwargs patterns with decorators - Contract exploration remains advisory, this prevents false failures * fix: resolve ruff errors and CrossHair syntax issue - Fix C414: Remove unnecessary list() call in sorted() - Fix B007: Rename unused loop variable story_idx to _story_idx - Fix CrossHair: Exclude common directory instead of using non-existent --exclude flag - CrossHair doesn't support --exclude, so we exclude common/ by only including other directories * fix: use unpacking instead of list concatenation for CrossHair targets - Fix RUF005: Use unpacking (*crosshair_targets) instead of list concatenation - Improves code quality and follows ruff best practices * fix: resolve RET504 and SIM102 ruff errors - Fix RET504: Remove unnecessary assignment before return in feature_keys.py - Fix SIM102: Combine nested if statements into single if in fsm.py - Improves code quality and follows ruff best practices * fix: make CrossHair failures non-blocking - Treat CrossHair failures as warnings (advisory only) - Contract exploration is advisory, not blocking - CrossHair has known issues analyzing certain function signatures with decorators - Only count non-CrossHair failures for exit code determination * fix: ruff check * fix: ruff check * fix: ruff check --------- Co-authored-by: Dominikus Nold <[email protected]> * feat: dynamic CrossHair detection, GitHub Action integration, and enforcement report enhancements (v0.4.2) (#5) * feat: dynamic CrossHair detection, GitHub Action integration, and enforcement report enhancements - Replace hard-coded skip list with dynamic signature issue detection - Add comprehensive metadata to enforcement reports (plan, budget, config) - Add structured findings extraction from tool output - Add auto-fix support for Semgrep via --fix flag - Add GitHub Action workflow with PR annotations and comments - Add GitHub annotations utility with contract-first validation - Add comprehensive test suite for new features - Sync versions to 0.4.2 across all files Fixes: CrossHair signature analysis limitations blocking CI/CD New Features: GitHub Action integration, auto-fix support, enhanced reports * fix: handle CrossHair signature analysis limitations in GitHub annotations - Detect signature analysis limitations in create_annotations_from_report - Treat signature issues as non-blocking (notice level, not error) - Filter signature issues from failed checks in PR comments - Add dedicated section for signature analysis limitations in PR comments - Prevents workflow failures for non-blocking CrossHair signature issues Fixes: GitHub Action workflow failing on CrossHair signature analysis limitations * fix: escape GitHub Actions syntax in Jinja2 template - Use {% raw %} blocks to escape GitHub Actions expressions - Fixes Jinja2 UndefinedError for 'steps' variable - All 5 failing tests now pass Fixes: - test_import_speckit_via_cli_command - test_import_speckit_generates_github_action - test_import_speckit_with_full_workflow - test_generate_from_template - test_generate_github_action * fix: handle CrossHair signature issues in ReproChecker and fix ruff whitespace - Detect CrossHair signature analysis limitations in ReproChecker.run_check() - Mark signature issues as skipped instead of failed - Fix whitespace issues in test_directory_structure_workflow.py (W293) - Prevents local repro failures on CrossHair signature limitations Fixes: specfact repro failing on CrossHair signature analysis limitations * chore: remove duplicate specfact-gate.yml workflow - specfact.yml is the new comprehensive workflow with PR annotations - specfact-gate.yml was the old workflow with same triggers - Removing to prevent duplicate workflow executions Fixes: workflow running twice on each push * fix: show all ruff errors by using --output-format=full - Add --output-format=full flag to ruff check command - Ensures all linting errors are reported, not just a few - Fixes issue where pipeline only shows limited number of errors Fixes: ruff report showing only a few issues instead of all * fix: remove whitespace from blank lines in test_analyze_command.py - Fix 20 W293 whitespace errors in dedent() strings - Ruff now passes all checks for this file Fixes: ruff linting errors in test file * fix: remove whitespace from blank lines in test files - Fix W293 whitespace errors in: - tests/integration/analyzers/test_code_analyzer_integration.py - tests/unit/analyzers/test_code_analyzer.py - tests/unit/tools/test_smart_test_coverage.py - tests/unit/utils/test_ide_setup.py - All whitespace errors now fixed (68 fixed) - Remaining 2 SIM105 suggestions are style recommendations, not errors Fixes: ruff linting errors in test files * fix: replace try-except-pass with contextlib.suppress for SIM105 - Replace try-except-pass pattern with contextlib.suppress(SystemExit) - Fixes 2 SIM105 errors in test_smart_test_coverage.py - All ruff linting errors now fixed Fixes: SIM105 linting errors in test files --------- Co-authored-by: Dominikus Nold <[email protected]> * feat: Watch mode and documentation reorganization (v0.5.0) (#6) * feat: add watch mode and complete documentation reorganization (v0.5.0) - Add watch mode for continuous synchronization (sync spec-kit and sync repository) - Implement real-time file system monitoring with configurable interval - Add comprehensive E2E test suite for watch mode (20+ tests) - Complete documentation reorganization (all 3 phases): - Phase 1: Core reorganization (streamlined README, persona-based docs/README) - Phase 2: Content creation (first-steps.md, workflows.md, troubleshooting.md, quick-examples.md) - Phase 3: Content enhancement (architecture.md, commands.md, polish all docs) - Add plan sync --shared and plan compare --code-vs-plan convenience aliases - Fix watch mode path validation and error handling - Update all version artifacts to 0.5.0 - Add comprehensive CHANGELOG entry for 0.5.0 Closes: Watch mode implementation (Phase 6 & 7) Closes: Documentation reorganization (all phases) * chore: add reports/ to .gitignore and remove tracked reports - Add reports/ directory to .gitignore (ephemeral artifacts should not be versioned) - Remove tracked reports files from git (they are generated artifacts) - Aligns with directory structure documentation where reports/ is gitignored --------- Co-authored-by: Dominikus Nold <[email protected]> * Update to repositioning for brownfield first strategy * Switch to Apache 2 license * Fix test failurs * Fix tests and linter conflicts * Fix github pages setup * Fix pages setup * Fix pages setup * fix: remove container build job (no Dockerfile) --------- Co-authored-by: Dominikus Nold <[email protected]>
1 parent f02cc17 commit 62b18df

File tree

3 files changed

+45
-102
lines changed

3 files changed

+45
-102
lines changed

.github/workflows/pr-orchestrator.yml

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -344,64 +344,3 @@ jobs:
344344
fi
345345
} >> "$GITHUB_STEP_SUMMARY"
346346
347-
build-and-push-container:
348-
name: Build and Push Container
349-
runs-on: ubuntu-latest
350-
needs: [package-validation]
351-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
352-
permissions:
353-
contents: read
354-
packages: write
355-
id-token: write
356-
env:
357-
REGISTRY: ghcr.io
358-
IMAGE_NAME: ${{ github.repository }}
359-
steps:
360-
- name: Checkout
361-
uses: actions/checkout@v4
362-
363-
- name: Set up Docker Buildx
364-
uses: docker/setup-buildx-action@v3
365-
366-
- name: Compute tags
367-
id: vars
368-
run: |
369-
COMMIT_SHA="${{ github.sha }}"
370-
SHORT_SHA="${COMMIT_SHA:0:8}"
371-
TIMESTAMP=$(date -u +%Y%m%d-%H%M%S)
372-
VERSION_TAG="$SHORT_SHA-$TIMESTAMP"
373-
374-
{
375-
printf 'SHORT_SHA=%s\n' "$SHORT_SHA"
376-
printf 'VERSION_TAG=%s\n' "$VERSION_TAG"
377-
} >> "$GITHUB_ENV"
378-
379-
- name: Log in to ghcr.io
380-
uses: docker/login-action@v3
381-
with:
382-
registry: ${{ env.REGISTRY }}
383-
username: ${{ github.actor }}
384-
password: ${{ secrets.GITHUB_TOKEN }}
385-
386-
- name: Build & Push specfact-cli
387-
uses: docker/build-push-action@v6
388-
with:
389-
context: .
390-
file: ./dockerfile
391-
push: true
392-
tags: |
393-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
394-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION_TAG }}
395-
396-
- name: Summary
397-
if: always()
398-
run: |
399-
{
400-
echo "## Container Build Summary"
401-
echo "| Parameter | Value |"
402-
echo "|-----------|--------|"
403-
echo "| Branch | main |"
404-
echo "| Version Tag | $VERSION_TAG |"
405-
echo "| Image | \`${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest\` |"
406-
echo "| Tagged | \`${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$VERSION_TAG\` |"
407-
} >> "$GITHUB_STEP_SUMMARY"

_config.yml

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
title: SpecFact CLI Documentation
55
description: >-
6-
Complete documentation for SpecFact CLI - Spec→Contract→Sentinel tool for contract-driven development.
7-
baseurl: "" # Set to "/specfact-cli" if using project pages, "" for user/organization pages
8-
url: "https://nold-ai.github.io" # Set to your GitHub Pages domain
6+
Complete documentation for SpecFact CLI - Brownfield-first CLI: Reverse engineer legacy Python → specs → enforced contracts.
7+
baseurl: "/specfact-cli" # Project pages require baseurl
8+
url: "https://nold-ai.github.io" # GitHub Pages domain
99

1010
# Build settings
1111
markdown: kramdown
@@ -51,26 +51,35 @@ defaults:
5151
values:
5252
layout: default
5353
permalink: /:basename/
54+
- scope:
55+
path: "getting-started"
56+
values:
57+
layout: default
58+
- scope:
59+
path: "guides"
60+
values:
61+
layout: default
62+
- scope:
63+
path: "reference"
64+
values:
65+
layout: default
66+
- scope:
67+
path: "examples"
68+
values:
69+
layout: default
5470

5571
# Theme settings (using minimal theme for clean look)
5672
theme: minima
5773
minima:
5874
social:
59-
github: nold-ai/specfact-cli
75+
github:
76+
username: nold-ai
77+
repository: specfact-cli
6078
author:
6179
name: NOLD AI
6280
63-
64-
# Navigation
65-
navigation:
66-
- title: Getting Started
67-
url: /getting-started/
68-
- title: Guides
69-
url: /guides/
70-
- title: Reference
71-
url: /reference/
72-
- title: Examples
73-
url: /examples/
81+
skin: dark # or light, auto
82+
show_excerpts: true
7483

7584
# Footer
7685
footer:

docs/index.md

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,56 @@
11
---
22
layout: default
33
title: SpecFact CLI Documentation
4-
description: Everything you need to know about using SpecFact CLI
4+
description: Brownfield-first CLI for reverse engineering legacy Python code into specs with runtime contract enforcement
55
---
66

7-
> **Everything you need to know about using SpecFact CLI**
7+
# SpecFact CLI Documentation
8+
9+
**Brownfield-first CLI: Reverse engineer legacy Python → specs → enforced contracts**
10+
11+
SpecFact CLI helps you modernize legacy codebases by automatically extracting specifications from existing code and enforcing them at runtime to prevent regressions.
812

913
---
1014

11-
## 📚 Documentation
15+
## 🚀 Quick Start
1216

1317
### New to SpecFact CLI?
1418

1519
**Primary Use Case**: Modernizing legacy Python codebases
1620

17-
Start here:
18-
19-
1. **[Getting Started](getting-started/README.md)** - Install and run your first command
20-
2. **[Modernizing Legacy Code?](guides/brownfield-engineer.md)****PRIMARY** - Brownfield-first guide
21-
3. **[The Brownfield Journey](guides/brownfield-journey.md)** ⭐ - Complete modernization workflow
22-
4. **[Use Cases](guides/use-cases.md)** - See real-world examples
23-
5. **[Command Reference](reference/commands.md)** - Learn all available commands
21+
1. **[Installation](getting-started/installation.md)** - Get started in 60 seconds
22+
2. **[First Steps](getting-started/first-steps.md)** - Run your first command
23+
3. **[Modernizing Legacy Code](guides/brownfield-engineer.md)****PRIMARY** - Brownfield-first guide
24+
4. **[The Brownfield Journey](guides/brownfield-journey.md)** ⭐ - Complete modernization workflow
2425

2526
### Using GitHub Spec-Kit?
2627

27-
**Secondary Use Case**: SpecFact CLI complements Spec-Kit by adding automated enforcement to Spec-Kit's interactive authoring:
28+
**Secondary Use Case**: Add automated enforcement to your Spec-Kit projects
2829

29-
- **[The Journey: From Spec-Kit to SpecFact](guides/speckit-journey.md)** - Add automated enforcement to your Spec-Kit projects
30+
- **[From Spec-Kit to SpecFact](guides/speckit-journey.md)** - Add enforcement to Spec-Kit projects
3031
- **[Spec-Kit Comparison](guides/speckit-comparison.md)** - Understand when to use each tool
3132

33+
## 📚 Documentation
34+
3235
### Guides
3336

37+
- **[Use Cases](guides/use-cases.md)** - Real-world scenarios and workflows
3438
- **[IDE Integration](guides/ide-integration.md)** - Set up slash commands in your IDE
3539
- **[CoPilot Mode](guides/copilot-mode.md)** - Using `--mode copilot` on CLI
36-
- **[Use Cases](guides/use-cases.md)** - Real-world scenarios
40+
- **[Troubleshooting](guides/troubleshooting.md)** - Common issues and solutions
3741
- **[Competitive Analysis](guides/competitive-analysis.md)** - How SpecFact compares
3842

39-
### Reference Documentation
43+
### Reference
4044

4145
- **[Command Reference](reference/commands.md)** - Complete command documentation
4246
- **[Architecture](reference/architecture.md)** - Technical design and principles
4347
- **[Operational Modes](reference/modes.md)** - CI/CD vs CoPilot modes
4448
- **[Directory Structure](reference/directory-structure.md)** - Project structure
4549

46-
---
47-
48-
## 🚀 Quick Links
49-
50-
### Common Tasks
50+
### Examples
5151

52-
- **[Install SpecFact CLI](getting-started/installation.md)**
53-
- **[Modernize Legacy Code](guides/brownfield-engineer.md)****PRIMARY** - Reverse engineer existing code into specs
54-
- **[The Brownfield Journey](guides/brownfield-journey.md)** ⭐ - Complete modernization workflow
55-
- **[Set Up IDE Integration](guides/ide-integration.md)** - Initialize slash commands in your IDE
56-
- **[Analyze existing code](guides/use-cases.md#use-case-1-brownfield-code-modernization)****PRIMARY**
57-
- **[Add enforcement to Spec-Kit projects](guides/use-cases.md#use-case-2-github-spec-kit-migration)** - Secondary use case
58-
- **[Start a new project](guides/use-cases.md#use-case-3-greenfield-spec-first-development)** - Alternative workflow
52+
- **[Brownfield Examples](examples/)** - Real-world modernization examples
53+
- **[Quick Examples](examples/quick-examples.md)** - Code snippets and patterns
5954

6055
---
6156

0 commit comments

Comments
 (0)