fips-agents-cli 0.1.0__tar.gz → 0.1.1__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.
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/.github/workflows/test.yml +1 -1
- fips_agents_cli-0.1.1/.github/workflows/workflow.yaml +113 -0
- fips_agents_cli-0.1.1/CLAUDE.md +280 -0
- fips_agents_cli-0.1.1/GENERATOR_IMPLEMENTATION_PLAN.md +392 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/PKG-INFO +222 -5
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/README.md +219 -2
- fips_agents_cli-0.1.1/RELEASE_CHECKLIST.md +318 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/pyproject.toml +5 -5
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/src/fips_agents_cli/cli.py +2 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/src/fips_agents_cli/commands/create.py +1 -2
- fips_agents_cli-0.1.1/src/fips_agents_cli/commands/generate.py +405 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/src/fips_agents_cli/tools/filesystem.py +3 -4
- fips_agents_cli-0.1.1/src/fips_agents_cli/tools/generators.py +311 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/src/fips_agents_cli/tools/project.py +1 -2
- fips_agents_cli-0.1.1/src/fips_agents_cli/tools/validation.py +183 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/src/fips_agents_cli/version.py +1 -1
- fips_agents_cli-0.1.1/tests/test_generate.py +396 -0
- fips_agents_cli-0.1.1/tests/test_generators.py +358 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/tests/test_project.py +0 -1
- fips_agents_cli-0.1.1/tests/test_validation.py +280 -0
- fips_agents_cli-0.1.0/.github/workflows/workflow.yaml +0 -57
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/.gitignore +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/IMPLEMENTATION_SUMMARY.md +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/Ignite-CLI-Architecture-Analysis.md +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/LICENSE +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/MVP-PLAN.md +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/PLAN.md +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/PUBLISHING.md +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/QUICK_START_PUBLISHING.md +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/src/fips_agents_cli/__init__.py +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/src/fips_agents_cli/__main__.py +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/src/fips_agents_cli/commands/__init__.py +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/src/fips_agents_cli/tools/__init__.py +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/src/fips_agents_cli/tools/git.py +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/tests/__init__.py +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/tests/conftest.py +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/tests/test_create.py +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.1}/tests/test_filesystem.py +0 -0
@@ -0,0 +1,113 @@
|
|
1
|
+
name: Release and Publish
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- 'v*.*.*'
|
7
|
+
|
8
|
+
permissions:
|
9
|
+
contents: write
|
10
|
+
id-token: write # For PyPI trusted publishing
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
create-release:
|
14
|
+
name: Create GitHub Release
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v4
|
19
|
+
|
20
|
+
- name: Extract version from tag
|
21
|
+
id: version
|
22
|
+
run: |
|
23
|
+
VERSION=${GITHUB_REF#refs/tags/v}
|
24
|
+
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
25
|
+
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
26
|
+
|
27
|
+
- name: Read version from version.py
|
28
|
+
id: read_version
|
29
|
+
run: |
|
30
|
+
VERSION_PY=$(grep -E '^__version__' src/fips_agents_cli/version.py | cut -d'"' -f2)
|
31
|
+
echo "version_py=$VERSION_PY" >> $GITHUB_OUTPUT
|
32
|
+
|
33
|
+
- name: Verify version match
|
34
|
+
run: |
|
35
|
+
if [ "${{ steps.version.outputs.version }}" != "${{ steps.read_version.outputs.version_py }}" ]; then
|
36
|
+
echo "Error: Tag version (${{ steps.version.outputs.version }}) does not match version.py (${{ steps.read_version.outputs.version_py }})"
|
37
|
+
exit 1
|
38
|
+
fi
|
39
|
+
|
40
|
+
- name: Extract changelog for this version
|
41
|
+
id: changelog
|
42
|
+
run: |
|
43
|
+
VERSION="${{ steps.version.outputs.version }}"
|
44
|
+
|
45
|
+
# Extract changelog section for this version from README.md
|
46
|
+
CHANGELOG=$(awk "/### Version $VERSION/,/### Version [0-9]/ { if (/### Version [0-9]/ && !/### Version $VERSION/) exit; if (!/### Version $VERSION/) print }" README.md | sed '/^$/d')
|
47
|
+
|
48
|
+
if [ -z "$CHANGELOG" ]; then
|
49
|
+
CHANGELOG="Release version $VERSION"
|
50
|
+
fi
|
51
|
+
|
52
|
+
# Save to file to preserve formatting
|
53
|
+
echo "$CHANGELOG" > /tmp/changelog.txt
|
54
|
+
|
55
|
+
- name: Create GitHub Release
|
56
|
+
env:
|
57
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
58
|
+
run: |
|
59
|
+
CHANGELOG=$(cat /tmp/changelog.txt)
|
60
|
+
|
61
|
+
gh release create "${{ steps.version.outputs.tag }}" \
|
62
|
+
--title "Release ${{ steps.version.outputs.tag }}" \
|
63
|
+
--notes "$CHANGELOG" \
|
64
|
+
--verify-tag
|
65
|
+
|
66
|
+
build:
|
67
|
+
name: Build distribution
|
68
|
+
needs: [create-release]
|
69
|
+
runs-on: ubuntu-latest
|
70
|
+
|
71
|
+
steps:
|
72
|
+
- uses: actions/checkout@v4
|
73
|
+
|
74
|
+
- name: Set up Python
|
75
|
+
uses: actions/setup-python@v5
|
76
|
+
with:
|
77
|
+
python-version: "3.11"
|
78
|
+
|
79
|
+
- name: Install build dependencies
|
80
|
+
run: |
|
81
|
+
python -m pip install --upgrade pip
|
82
|
+
pip install build
|
83
|
+
|
84
|
+
- name: Build package
|
85
|
+
run: python -m build
|
86
|
+
|
87
|
+
- name: Store distribution packages
|
88
|
+
uses: actions/upload-artifact@v4
|
89
|
+
with:
|
90
|
+
name: python-package-distributions
|
91
|
+
path: dist/
|
92
|
+
|
93
|
+
publish-to-pypi:
|
94
|
+
name: Publish to PyPI
|
95
|
+
needs: [build]
|
96
|
+
runs-on: ubuntu-latest
|
97
|
+
|
98
|
+
environment:
|
99
|
+
name: pypi
|
100
|
+
url: https://pypi.org/p/fips-agents-cli
|
101
|
+
|
102
|
+
permissions:
|
103
|
+
id-token: write # IMPORTANT: mandatory for trusted publishing
|
104
|
+
|
105
|
+
steps:
|
106
|
+
- name: Download distribution packages
|
107
|
+
uses: actions/download-artifact@v4
|
108
|
+
with:
|
109
|
+
name: python-package-distributions
|
110
|
+
path: dist/
|
111
|
+
|
112
|
+
- name: Publish to PyPI
|
113
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
@@ -0,0 +1,280 @@
|
|
1
|
+
# CLAUDE.md
|
2
|
+
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
4
|
+
|
5
|
+
## Project Overview
|
6
|
+
|
7
|
+
**fips-agents-cli** is a Python-based CLI tool for scaffolding FIPS-compliant AI agent projects, with initial focus on MCP (Model Context Protocol) server development. The tool clones template repositories, customizes them for new projects, and prepares them for immediate development use.
|
8
|
+
|
9
|
+
**Current Status:** MVP implementation complete with `create mcp-server` command.
|
10
|
+
|
11
|
+
## Development Commands
|
12
|
+
|
13
|
+
### Environment Setup
|
14
|
+
|
15
|
+
```bash
|
16
|
+
# Create and activate virtual environment
|
17
|
+
python -m venv venv
|
18
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
19
|
+
|
20
|
+
# Install in editable mode with dev dependencies
|
21
|
+
pip install -e .[dev]
|
22
|
+
```
|
23
|
+
|
24
|
+
### Testing
|
25
|
+
|
26
|
+
```bash
|
27
|
+
# Run all tests
|
28
|
+
pytest
|
29
|
+
|
30
|
+
# Run with coverage report
|
31
|
+
pytest --cov=fips_agents_cli --cov-report=html --cov-report=term-missing
|
32
|
+
|
33
|
+
# Run specific test file
|
34
|
+
pytest tests/test_create.py
|
35
|
+
|
36
|
+
# Run specific test
|
37
|
+
pytest tests/test_create.py::TestCreateMcpServer::test_successful_creation
|
38
|
+
```
|
39
|
+
|
40
|
+
### Code Quality
|
41
|
+
|
42
|
+
```bash
|
43
|
+
# Format code with Black (line length: 100)
|
44
|
+
black src tests
|
45
|
+
|
46
|
+
# Lint with Ruff
|
47
|
+
ruff check src tests
|
48
|
+
|
49
|
+
# Run both linters before committing
|
50
|
+
black src tests && ruff check src tests
|
51
|
+
```
|
52
|
+
|
53
|
+
### Building and Distribution
|
54
|
+
|
55
|
+
```bash
|
56
|
+
# Build distribution packages
|
57
|
+
python -m build
|
58
|
+
|
59
|
+
# Verify package integrity
|
60
|
+
twine check dist/*
|
61
|
+
|
62
|
+
# Test local installation
|
63
|
+
pip install -e .
|
64
|
+
fips-agents --version
|
65
|
+
```
|
66
|
+
|
67
|
+
## Architecture
|
68
|
+
|
69
|
+
### Module Structure
|
70
|
+
|
71
|
+
The CLI follows a layered architecture:
|
72
|
+
|
73
|
+
1. **CLI Layer** (`cli.py`): Click-based command interface with Rich output
|
74
|
+
2. **Command Layer** (`commands/`): Command implementations (create, generate, etc.)
|
75
|
+
3. **Tools Layer** (`tools/`): Reusable utilities for git, filesystem, and project operations
|
76
|
+
4. **Entry Points**: `__main__.py` for `python -m fips_agents_cli`, `cli:main` for the `fips-agents` command
|
77
|
+
|
78
|
+
### Key Design Patterns
|
79
|
+
|
80
|
+
**Template Repository Pattern**: The CLI clones git repositories as templates rather than bundling templates internally. This allows:
|
81
|
+
- Independent template versioning and updates
|
82
|
+
- User customization via template forks
|
83
|
+
- Minimal CLI package size
|
84
|
+
|
85
|
+
**Project Customization Pipeline**: When creating projects, the tool follows this sequence:
|
86
|
+
1. Clone template repository (shallow clone, depth=1)
|
87
|
+
2. Remove template's `.git` directory
|
88
|
+
3. Update `pyproject.toml` with new project name
|
89
|
+
4. Rename source directory (`template_name` → `project_name` with underscores)
|
90
|
+
5. Update entry point scripts in `pyproject.toml`
|
91
|
+
6. Initialize fresh git repository with initial commit
|
92
|
+
|
93
|
+
**Rich Console Output**: All user-facing output uses Rich library for:
|
94
|
+
- Colored output (green checkmarks, red errors, yellow warnings)
|
95
|
+
- Progress spinners for long operations
|
96
|
+
- Formatted panels for success messages
|
97
|
+
- Consistent visual style
|
98
|
+
|
99
|
+
### Important Implementation Details
|
100
|
+
|
101
|
+
**Project Name Handling**: Project names use hyphens (kebab-case) but module names use underscores (snake_case). The `to_module_name()` utility converts between these formats. This is critical for Python import compatibility.
|
102
|
+
|
103
|
+
**TOML Manipulation**: Uses `tomlkit` (not `toml`) to preserve formatting and comments in `pyproject.toml` files during customization.
|
104
|
+
|
105
|
+
**Git Operations**: Uses GitPython library for all git operations. Template clones are shallow (depth=1) for performance. The `.git` directory from templates is always removed before initializing a fresh repository.
|
106
|
+
|
107
|
+
**Error Handling Strategy**: Commands use Rich console for user-friendly error messages, then call `sys.exit()` with appropriate exit codes. Validation failures provide hints for correction.
|
108
|
+
|
109
|
+
## Testing Architecture
|
110
|
+
|
111
|
+
### Test Structure
|
112
|
+
|
113
|
+
Tests are organized by module:
|
114
|
+
- `test_create.py`: Create command integration tests
|
115
|
+
- `test_filesystem.py`: Filesystem utility unit tests
|
116
|
+
- `test_project.py`: Project customization unit tests
|
117
|
+
|
118
|
+
### Key Fixtures
|
119
|
+
|
120
|
+
**`cli_runner`**: Provides Click's `CliRunner` for command testing. Use `invoke()` to run commands in isolated environment.
|
121
|
+
|
122
|
+
**`temp_dir`**: Provides temporary directory that's automatically cleaned up. Use for file operations.
|
123
|
+
|
124
|
+
**`mock_template_repo`**: Creates a complete mock MCP server template structure with:
|
125
|
+
- `pyproject.toml` with placeholder project name
|
126
|
+
- `src/mcp_server_template/` module directory
|
127
|
+
- `prompts/` directory for YAML prompts
|
128
|
+
- `.fips-agents-cli/generators/` for future generator templates
|
129
|
+
|
130
|
+
### Testing Patterns
|
131
|
+
|
132
|
+
When testing commands:
|
133
|
+
```python
|
134
|
+
result = runner.invoke(cli, ["create", "mcp-server", "test-server"])
|
135
|
+
assert result.exit_code == 0
|
136
|
+
assert "Success" in result.output
|
137
|
+
```
|
138
|
+
|
139
|
+
When testing with filesystem fixtures:
|
140
|
+
```python
|
141
|
+
def test_something(temp_dir):
|
142
|
+
project_path = temp_dir / "my-project"
|
143
|
+
# Test filesystem operations
|
144
|
+
```
|
145
|
+
|
146
|
+
## Configuration Files
|
147
|
+
|
148
|
+
### pyproject.toml
|
149
|
+
|
150
|
+
- **Build System**: Uses Hatchling (not Poetry or setuptools)
|
151
|
+
- **Python Version**: Requires ≥3.9, supports 3.9-3.12
|
152
|
+
- **Line Length**: Black and Ruff both configured for 100 characters
|
153
|
+
- **Entry Point**: `fips-agents = "fips_agents_cli.cli:main"`
|
154
|
+
- **Test Configuration**: pytest runs with coverage by default
|
155
|
+
|
156
|
+
### CI/CD Workflows
|
157
|
+
|
158
|
+
**test.yml**: Runs on push/PR to main
|
159
|
+
- Matrix testing across Python 3.9, 3.10, 3.11, 3.12
|
160
|
+
- Runs pytest with coverage
|
161
|
+
- Checks Black formatting
|
162
|
+
- Runs Ruff linting
|
163
|
+
- Builds distribution and validates with twine
|
164
|
+
|
165
|
+
**workflow.yaml**: Publishes to PyPI on GitHub releases
|
166
|
+
- Uses trusted publishing (no API key needed)
|
167
|
+
- Builds wheels and source distributions
|
168
|
+
- Uploads to PyPI automatically
|
169
|
+
|
170
|
+
## Common Development Patterns
|
171
|
+
|
172
|
+
### Adding a New Command
|
173
|
+
|
174
|
+
1. Create command file in `commands/` directory
|
175
|
+
2. Define Click command group or command
|
176
|
+
3. Register in `cli.py` with `cli.add_command()`
|
177
|
+
4. Use Rich console for all output
|
178
|
+
5. Add comprehensive tests in `tests/test_commandname.py`
|
179
|
+
|
180
|
+
### Adding a New Tool/Utility
|
181
|
+
|
182
|
+
1. Create utility module in `tools/` directory
|
183
|
+
2. Import Rich console: `console = Console()`
|
184
|
+
3. Provide clear docstrings with Args/Returns
|
185
|
+
4. Return meaningful values (bool, tuple, etc.) not just console output
|
186
|
+
5. Test in isolation with fixtures
|
187
|
+
|
188
|
+
### File Operations Best Practices
|
189
|
+
|
190
|
+
- Always use `pathlib.Path`, never string paths
|
191
|
+
- Use `Path.resolve()` for absolute paths in user-facing messages
|
192
|
+
- Check existence before operations: `path.exists()`
|
193
|
+
- Use `parents=True, exist_ok=True` for `mkdir()` calls
|
194
|
+
- Handle errors gracefully with try/except and user-friendly messages
|
195
|
+
|
196
|
+
### Output Conventions
|
197
|
+
|
198
|
+
- Success: `[green]✓[/green] Message`
|
199
|
+
- Error: `[red]✗[/red] Message`
|
200
|
+
- Warning: `[yellow]⚠[/yellow] Message`
|
201
|
+
- Info: `[cyan]Message[/cyan]` or `[dim]Message[/dim]`
|
202
|
+
- Use `console.print()` not `print()` or `click.echo()`
|
203
|
+
|
204
|
+
## Known Patterns and Conventions
|
205
|
+
|
206
|
+
### Template Repository Structure
|
207
|
+
|
208
|
+
The CLI expects templates to have:
|
209
|
+
- `pyproject.toml` with project name and entry points
|
210
|
+
- `src/{module_name}/` source directory
|
211
|
+
- `.fips-agents-cli/generators/` (optional, for Phase 2 generate commands)
|
212
|
+
- Standard Python project structure
|
213
|
+
|
214
|
+
### Project Name Validation
|
215
|
+
|
216
|
+
Valid project names must:
|
217
|
+
- Start with a lowercase letter
|
218
|
+
- Contain only lowercase letters, numbers, hyphens, and underscores
|
219
|
+
- Not be empty
|
220
|
+
|
221
|
+
Examples:
|
222
|
+
- ✅ `my-server`, `test_mcp`, `server123`
|
223
|
+
- ❌ `MyServer` (uppercase), `123server` (starts with number), `my@server` (special chars)
|
224
|
+
|
225
|
+
### Module vs Project Names
|
226
|
+
|
227
|
+
- **Project name**: Uses hyphens (e.g., `my-mcp-server`)
|
228
|
+
- **Module name**: Uses underscores (e.g., `my_mcp_server`)
|
229
|
+
- Conversion: `project_name.replace("-", "_")`
|
230
|
+
- This matters for imports and directory names
|
231
|
+
|
232
|
+
## Future Roadmap Context
|
233
|
+
|
234
|
+
### Phase 2 (Next): Generate Command
|
235
|
+
|
236
|
+
The `generate` command will:
|
237
|
+
- Load generator templates from `.fips-agents-cli/generators/` in projects
|
238
|
+
- Use Jinja2 for template rendering
|
239
|
+
- Support tool, prompt, and resource generation
|
240
|
+
- Interactive prompts for parameters
|
241
|
+
|
242
|
+
Template location strategy: Generators are copied into projects during creation (not kept in CLI), allowing per-project customization.
|
243
|
+
|
244
|
+
### Why This Matters Now
|
245
|
+
|
246
|
+
- Don't remove `.fips-agents-cli/` directories during template cloning
|
247
|
+
- Test fixtures already include generator directory structure
|
248
|
+
- Project customization must preserve these directories
|
249
|
+
|
250
|
+
## Troubleshooting Common Issues
|
251
|
+
|
252
|
+
### Git Clone Failures
|
253
|
+
|
254
|
+
Check:
|
255
|
+
1. Internet connectivity
|
256
|
+
2. Template repository URL is accessible
|
257
|
+
3. Git is installed: `git --version`
|
258
|
+
4. Permissions on target directory
|
259
|
+
|
260
|
+
### Module Not Found After Installation
|
261
|
+
|
262
|
+
Ensure:
|
263
|
+
1. Virtual environment is activated
|
264
|
+
2. Package installed with `-e` flag: `pip install -e .`
|
265
|
+
3. Using correct Python interpreter: `which python`
|
266
|
+
|
267
|
+
### Test Failures
|
268
|
+
|
269
|
+
Common causes:
|
270
|
+
1. Forgot to activate venv
|
271
|
+
2. Dependencies not installed: `pip install -e .[dev]`
|
272
|
+
3. Git not configured globally: `git config --global user.email "test@example.com"`
|
273
|
+
|
274
|
+
## Repository-Specific Notes
|
275
|
+
|
276
|
+
- The main branch is `main` (not `master`)
|
277
|
+
- Template URL is hardcoded to `https://github.com/rdwj/mcp-server-template`
|
278
|
+
- Package name on PyPI: `fips-agents-cli`
|
279
|
+
- Command name: `fips-agents` (no `-cli` suffix)
|
280
|
+
- Recommended installation: `pipx install fips-agents-cli`
|