Skip to content

Commit 930ffa8

Browse files
authored
Merge pull request #2 from netdevops/claude/code-documentation-review-VGrcG
Refactor to package structure and enhance CLI with comprehensive features
2 parents 599b493 + 99ed71f commit 930ffa8

17 files changed

Lines changed: 2528 additions & 168 deletions

.editorconfig

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
13+
# Python files
14+
[*.py]
15+
indent_style = space
16+
indent_size = 4
17+
max_line_length = 100
18+
19+
# YAML files
20+
[*.{yml,yaml}]
21+
indent_style = space
22+
indent_size = 2
23+
24+
# TOML files
25+
[*.toml]
26+
indent_style = space
27+
indent_size = 2
28+
29+
# Markdown files
30+
[*.md]
31+
trim_trailing_whitespace = false
32+
max_line_length = 120
33+
34+
# Shell scripts
35+
[*.sh]
36+
indent_style = space
37+
indent_size = 2
38+
39+
# JSON files
40+
[*.json]
41+
indent_style = space
42+
indent_size = 2
43+
44+
# Configuration files
45+
[*.conf]
46+
indent_style = space
47+
indent_size = 2

.github/workflows/deploy.yaml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,36 @@ on:
44
release:
55
types: [created]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
deploy:
912
runs-on: ubuntu-latest
13+
environment:
14+
name: pypi
15+
url: https://pypi.org/project/hier-config-cli/
16+
permissions:
17+
id-token: write # Required for trusted publishing
18+
1019
steps:
11-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v4
21+
1222
- name: Set up Python
13-
uses: actions/setup-python@v2
23+
uses: actions/setup-python@v5
1424
with:
15-
python-version: '3.9'
25+
python-version: '3.12'
26+
1627
- name: Install poetry
1728
uses: snok/install-poetry@v1
1829
with:
19-
version: 1.5.1
20-
- name: Build and publish to PyPI
30+
version: 1.8.2
31+
32+
- name: Build package
33+
run: |
34+
poetry build
35+
36+
- name: Publish to PyPI
2137
env:
2238
TWINE_API_KEY: ${{ secrets.TWINE_API_KEY }}
2339
run: |

.github/workflows/test-app.yaml

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,70 @@ on:
77
branches: [main]
88

99
jobs:
10-
build:
10+
test:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
1414
python-version:
15-
- "3.9"
1615
- "3.10"
1716
- "3.11"
1817
- "3.12"
18+
- "3.13"
1919

2020
steps:
21-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v4
22+
2223
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v5
2425
with:
2526
python-version: ${{ matrix.python-version }}
27+
2628
- name: Install poetry
2729
uses: snok/install-poetry@v1
2830
with:
29-
version: 1.5.1
30-
- name: Set PYTHONPATH
31-
run: echo "PYTHONPATH=src" >> $GITHUB_ENV
32-
- name: Run tests
31+
version: 1.8.2
32+
33+
- name: Cache dependencies
34+
uses: actions/cache@v4
35+
with:
36+
path: ~/.cache/pypoetry
37+
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
38+
restore-keys: |
39+
${{ runner.os }}-poetry-
40+
41+
- name: Install dependencies
42+
run: |
43+
poetry install --no-interaction
44+
45+
- name: Run black formatter check
46+
run: |
47+
poetry run black --check src/ tests/
48+
49+
- name: Run ruff linter
3350
run: |
34-
poetry install --no-interaction --no-root
35-
poetry run black --check .
36-
poetry run pytest tests/
51+
poetry run ruff check src/ tests/
52+
53+
- name: Run mypy type checker
54+
run: |
55+
poetry run mypy src/
56+
57+
- name: Run tests with coverage
58+
run: |
59+
poetry run pytest --cov=hier_config_cli --cov-report=xml --cov-report=term-missing
60+
61+
- name: Upload coverage to Codecov
62+
uses: codecov/codecov-action@v4
63+
if: matrix.python-version == '3.12'
64+
with:
65+
file: ./coverage.xml
66+
flags: unittests
67+
name: codecov-umbrella
68+
fail_ci_if_error: false
69+
70+
- name: Upload coverage reports
71+
uses: actions/upload-artifact@v4
72+
if: matrix.python-version == '3.12'
73+
with:
74+
name: coverage-report
75+
path: htmlcov/
76+
retention-days: 7

CHANGELOG.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [0.2.0] - 2026-01-25
11+
12+
### Added
13+
- Added support for Fortinet FortiOS platform
14+
- Added `--format` option to output results in JSON, YAML, or text formats
15+
- Added `--output` / `-o` flag to save output to file
16+
- Added `list-platforms` command to show all available platforms
17+
- Added `version` command to display tool version
18+
- Added comprehensive error handling for file operations and platform validation
19+
- Added verbose logging support with `-v` (INFO) and `-vv` (DEBUG) flags
20+
- Added complete type hints throughout codebase
21+
- Added comprehensive test suite with 20+ test cases including:
22+
- Error handling tests
23+
- All platform tests
24+
- Output format tests (text, JSON, YAML)
25+
- File output tests
26+
- Verbose logging tests
27+
- Added comprehensive documentation:
28+
- Detailed README with installation instructions and examples
29+
- CONTRIBUTING.md with development guidelines
30+
- SECURITY.md with security policy
31+
- Examples directory with sample configurations
32+
- Integration examples for Nornir, Ansible, and CI/CD
33+
- Added development tools configuration:
34+
- Black formatter configuration
35+
- Ruff linter configuration
36+
- Mypy type checker configuration
37+
- Pytest with coverage reporting
38+
- Added `py.typed` marker file for PEP 561 compliance
39+
40+
### Changed
41+
- **BREAKING**: Converted to proper Python package structure with `__init__.py`
42+
- **BREAKING**: Entry point now uses `hier_config_cli:cli` instead of module path
43+
- Refactored duplicate code in commands into shared `process_configs()` function
44+
- Fixed platform-specific output formatting (no longer hardcodes `cisco_style_text()` for all platforms)
45+
- Improved command help text with detailed descriptions and examples
46+
- Enhanced pyproject.toml with comprehensive metadata and classifiers
47+
- Updated Python version support to 3.9-3.13
48+
- Improved error messages to be more descriptive and actionable
49+
50+
### Fixed
51+
- Fixed incorrect output format for Juniper JunOS configurations
52+
- Fixed missing platform support for Fortinet FortiOS
53+
- Fixed lack of error handling for missing or unreadable configuration files
54+
- Fixed unused PyYAML dependency (now actively used for YAML output)
55+
56+
### Removed
57+
- Removed code duplication across remediation, rollback, and future commands
58+
59+
## [0.1.0] - 2024-12-XX
60+
61+
### Added
62+
- Initial release
63+
- Basic remediation, rollback, and future commands
64+
- Support for major network platforms:
65+
- Cisco IOS
66+
- Cisco NX-OS
67+
- Cisco IOS XR
68+
- Arista EOS
69+
- Juniper JunOS
70+
- VyOS
71+
- HP Comware5
72+
- HP ProCurve
73+
- Generic platform
74+
- GitHub Actions CI/CD pipeline
75+
- Basic test coverage
76+
- Apache 2.0 license
77+
78+
[Unreleased]: https://github.com/netdevops/hier-config-cli/compare/v0.2.0...HEAD
79+
[0.2.0]: https://github.com/netdevops/hier-config-cli/compare/v0.1.0...v0.2.0
80+
[0.1.0]: https://github.com/netdevops/hier-config-cli/releases/tag/v0.1.0

0 commit comments

Comments
 (0)