fips-agents-cli 0.1.0__tar.gz → 0.1.2__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.2/.claude/commands/create-release.md +75 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/.github/workflows/test.yml +1 -1
- fips_agents_cli-0.1.2/.github/workflows/workflow.yaml +113 -0
- fips_agents_cli-0.1.2/CLAUDE.md +328 -0
- fips_agents_cli-0.1.2/GENERATOR_IMPLEMENTATION_PLAN.md +392 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/LICENSE +2 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/PKG-INFO +246 -8
- fips_agents_cli-0.1.2/README.md +522 -0
- fips_agents_cli-0.1.2/RELEASE_CHECKLIST.md +318 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/pyproject.toml +5 -5
- fips_agents_cli-0.1.2/scripts/README.md +89 -0
- fips_agents_cli-0.1.2/scripts/release.sh +127 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/src/fips_agents_cli/cli.py +2 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/src/fips_agents_cli/commands/create.py +1 -2
- fips_agents_cli-0.1.2/src/fips_agents_cli/commands/generate.py +405 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/src/fips_agents_cli/tools/filesystem.py +3 -4
- fips_agents_cli-0.1.2/src/fips_agents_cli/tools/generators.py +311 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/src/fips_agents_cli/tools/project.py +1 -2
- fips_agents_cli-0.1.2/src/fips_agents_cli/tools/validation.py +183 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/src/fips_agents_cli/version.py +1 -1
- fips_agents_cli-0.1.2/tests/test_generate.py +396 -0
- fips_agents_cli-0.1.2/tests/test_generators.py +358 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/tests/test_project.py +0 -1
- fips_agents_cli-0.1.2/tests/test_validation.py +280 -0
- fips_agents_cli-0.1.0/.github/workflows/workflow.yaml +0 -57
- fips_agents_cli-0.1.0/README.md +0 -284
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/.gitignore +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/IMPLEMENTATION_SUMMARY.md +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/Ignite-CLI-Architecture-Analysis.md +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/MVP-PLAN.md +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/PLAN.md +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/PUBLISHING.md +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/QUICK_START_PUBLISHING.md +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/src/fips_agents_cli/__init__.py +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/src/fips_agents_cli/__main__.py +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/src/fips_agents_cli/commands/__init__.py +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/src/fips_agents_cli/tools/__init__.py +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/src/fips_agents_cli/tools/git.py +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/tests/__init__.py +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/tests/conftest.py +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/tests/test_create.py +0 -0
- {fips_agents_cli-0.1.0 → fips_agents_cli-0.1.2}/tests/test_filesystem.py +0 -0
@@ -0,0 +1,75 @@
|
|
1
|
+
---
|
2
|
+
description: Prepare and publish a new release version
|
3
|
+
tags: [release, publish, version]
|
4
|
+
---
|
5
|
+
|
6
|
+
You are assisting with creating a new release for the fips-agents-cli project.
|
7
|
+
|
8
|
+
## Your Task
|
9
|
+
|
10
|
+
1. **Ask the user for release information:**
|
11
|
+
- New version number (format: x.y.z, e.g., 0.1.2)
|
12
|
+
- Release notes/description of changes
|
13
|
+
|
14
|
+
2. **Update the README.md changelog:**
|
15
|
+
- Read the current README.md file
|
16
|
+
- Add a new version section under the `## Changelog` heading
|
17
|
+
- Format as:
|
18
|
+
```markdown
|
19
|
+
### Version X.Y.Z
|
20
|
+
|
21
|
+
- Feature/Fix: Description of change
|
22
|
+
- Feature/Fix: Description of change
|
23
|
+
```
|
24
|
+
- Place the new version ABOVE older versions (newest first)
|
25
|
+
- Use the release notes provided by the user to populate the changelog
|
26
|
+
|
27
|
+
3. **Run the release script:**
|
28
|
+
- After updating the changelog, run the release script:
|
29
|
+
```bash
|
30
|
+
./scripts/release.sh <version> "<commit-message>"
|
31
|
+
```
|
32
|
+
- The commit message should be a concise summary of the release (e.g., "Add generator commands")
|
33
|
+
|
34
|
+
## Important Notes
|
35
|
+
|
36
|
+
- The release script will:
|
37
|
+
- Update version in `version.py` and `pyproject.toml`
|
38
|
+
- Commit all changes (including the changelog you updated)
|
39
|
+
- Create and push a git tag
|
40
|
+
- Trigger automated GitHub Actions for PyPI publishing
|
41
|
+
|
42
|
+
- Version format must be x.y.z (three numbers separated by dots)
|
43
|
+
- Follow semantic versioning:
|
44
|
+
- Major (1.0.0): Breaking changes
|
45
|
+
- Minor (0.1.0): New features, backward compatible
|
46
|
+
- Patch (0.1.1): Bug fixes, backward compatible
|
47
|
+
|
48
|
+
- The changelog should be clear and user-focused
|
49
|
+
- Group related changes together
|
50
|
+
- Use consistent formatting
|
51
|
+
|
52
|
+
## Example Interaction
|
53
|
+
|
54
|
+
User: "I want to release version 0.1.2"
|
55
|
+
|
56
|
+
You should:
|
57
|
+
1. Ask: "What changes are included in version 0.1.2? Please describe the new features, fixes, or improvements."
|
58
|
+
2. User provides: "Added support for middleware generation, fixed bug in tool validation, improved error messages"
|
59
|
+
3. You update README.md changelog:
|
60
|
+
```markdown
|
61
|
+
### Version 0.1.2
|
62
|
+
|
63
|
+
- Feature: Added support for middleware generation
|
64
|
+
- Fix: Fixed bug in tool validation
|
65
|
+
- Improvement: Improved error messages
|
66
|
+
```
|
67
|
+
4. You run: `./scripts/release.sh 0.1.2 "Add middleware generation support"`
|
68
|
+
5. Confirm success and provide links to monitor the release
|
69
|
+
|
70
|
+
## Validation
|
71
|
+
|
72
|
+
Before running the script, verify:
|
73
|
+
- Version number is in correct format (x.y.z)
|
74
|
+
- Changelog is properly formatted
|
75
|
+
- User has confirmed the changes are ready to release
|
@@ -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,328 @@
|
|
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
|
+
### Creating a Release
|
68
|
+
|
69
|
+
**Automated Method (Recommended):**
|
70
|
+
|
71
|
+
Use the `/create-release` slash command in Claude Code:
|
72
|
+
|
73
|
+
```
|
74
|
+
/create-release
|
75
|
+
```
|
76
|
+
|
77
|
+
This command will:
|
78
|
+
1. Ask for version number and release notes
|
79
|
+
2. Update the changelog in README.md
|
80
|
+
3. Run `scripts/release.sh` to:
|
81
|
+
- Update version in `version.py` and `pyproject.toml`
|
82
|
+
- Commit and push changes
|
83
|
+
- Create and push git tag
|
84
|
+
- Trigger GitHub Actions for automated PyPI publishing
|
85
|
+
|
86
|
+
**Manual Method:**
|
87
|
+
|
88
|
+
**IMPORTANT**: Version numbers must be updated in TWO places:
|
89
|
+
1. `src/fips_agents_cli/version.py`
|
90
|
+
2. `pyproject.toml`
|
91
|
+
|
92
|
+
```bash
|
93
|
+
# 1. Update version in both files manually or use the script:
|
94
|
+
./scripts/release.sh <version> "<commit-message>"
|
95
|
+
|
96
|
+
# Example:
|
97
|
+
./scripts/release.sh 0.1.2 "Add new generator features"
|
98
|
+
|
99
|
+
# The script handles:
|
100
|
+
# - Updating version.py and pyproject.toml
|
101
|
+
# - Committing changes (including README.md changelog)
|
102
|
+
# - Creating and pushing tag
|
103
|
+
# - Triggering GitHub Actions
|
104
|
+
```
|
105
|
+
|
106
|
+
**Note**: Always update the changelog in README.md before running the script.
|
107
|
+
|
108
|
+
See `RELEASE_CHECKLIST.md` for detailed release procedures and troubleshooting.
|
109
|
+
|
110
|
+
## Architecture
|
111
|
+
|
112
|
+
### Module Structure
|
113
|
+
|
114
|
+
The CLI follows a layered architecture:
|
115
|
+
|
116
|
+
1. **CLI Layer** (`cli.py`): Click-based command interface with Rich output
|
117
|
+
2. **Command Layer** (`commands/`): Command implementations (create, generate, etc.)
|
118
|
+
3. **Tools Layer** (`tools/`): Reusable utilities for git, filesystem, and project operations
|
119
|
+
4. **Entry Points**: `__main__.py` for `python -m fips_agents_cli`, `cli:main` for the `fips-agents` command
|
120
|
+
|
121
|
+
### Key Design Patterns
|
122
|
+
|
123
|
+
**Template Repository Pattern**: The CLI clones git repositories as templates rather than bundling templates internally. This allows:
|
124
|
+
- Independent template versioning and updates
|
125
|
+
- User customization via template forks
|
126
|
+
- Minimal CLI package size
|
127
|
+
|
128
|
+
**Project Customization Pipeline**: When creating projects, the tool follows this sequence:
|
129
|
+
1. Clone template repository (shallow clone, depth=1)
|
130
|
+
2. Remove template's `.git` directory
|
131
|
+
3. Update `pyproject.toml` with new project name
|
132
|
+
4. Rename source directory (`template_name` → `project_name` with underscores)
|
133
|
+
5. Update entry point scripts in `pyproject.toml`
|
134
|
+
6. Initialize fresh git repository with initial commit
|
135
|
+
|
136
|
+
**Rich Console Output**: All user-facing output uses Rich library for:
|
137
|
+
- Colored output (green checkmarks, red errors, yellow warnings)
|
138
|
+
- Progress spinners for long operations
|
139
|
+
- Formatted panels for success messages
|
140
|
+
- Consistent visual style
|
141
|
+
|
142
|
+
### Important Implementation Details
|
143
|
+
|
144
|
+
**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.
|
145
|
+
|
146
|
+
**TOML Manipulation**: Uses `tomlkit` (not `toml`) to preserve formatting and comments in `pyproject.toml` files during customization.
|
147
|
+
|
148
|
+
**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.
|
149
|
+
|
150
|
+
**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.
|
151
|
+
|
152
|
+
## Testing Architecture
|
153
|
+
|
154
|
+
### Test Structure
|
155
|
+
|
156
|
+
Tests are organized by module:
|
157
|
+
- `test_create.py`: Create command integration tests
|
158
|
+
- `test_filesystem.py`: Filesystem utility unit tests
|
159
|
+
- `test_project.py`: Project customization unit tests
|
160
|
+
|
161
|
+
### Key Fixtures
|
162
|
+
|
163
|
+
**`cli_runner`**: Provides Click's `CliRunner` for command testing. Use `invoke()` to run commands in isolated environment.
|
164
|
+
|
165
|
+
**`temp_dir`**: Provides temporary directory that's automatically cleaned up. Use for file operations.
|
166
|
+
|
167
|
+
**`mock_template_repo`**: Creates a complete mock MCP server template structure with:
|
168
|
+
- `pyproject.toml` with placeholder project name
|
169
|
+
- `src/mcp_server_template/` module directory
|
170
|
+
- `prompts/` directory for YAML prompts
|
171
|
+
- `.fips-agents-cli/generators/` for future generator templates
|
172
|
+
|
173
|
+
### Testing Patterns
|
174
|
+
|
175
|
+
When testing commands:
|
176
|
+
```python
|
177
|
+
result = runner.invoke(cli, ["create", "mcp-server", "test-server"])
|
178
|
+
assert result.exit_code == 0
|
179
|
+
assert "Success" in result.output
|
180
|
+
```
|
181
|
+
|
182
|
+
When testing with filesystem fixtures:
|
183
|
+
```python
|
184
|
+
def test_something(temp_dir):
|
185
|
+
project_path = temp_dir / "my-project"
|
186
|
+
# Test filesystem operations
|
187
|
+
```
|
188
|
+
|
189
|
+
## Configuration Files
|
190
|
+
|
191
|
+
### pyproject.toml
|
192
|
+
|
193
|
+
- **Build System**: Uses Hatchling (not Poetry or setuptools)
|
194
|
+
- **Python Version**: Requires ≥3.10, supports 3.10-3.12 (dropped 3.9 in v0.1.1)
|
195
|
+
- **Line Length**: Black and Ruff both configured for 100 characters
|
196
|
+
- **Entry Point**: `fips-agents = "fips_agents_cli.cli:main"`
|
197
|
+
- **Test Configuration**: pytest runs with coverage by default
|
198
|
+
- **Version Management**: Version number must match `src/fips_agents_cli/version.py`
|
199
|
+
|
200
|
+
### CI/CD Workflows
|
201
|
+
|
202
|
+
**test.yml**: Runs on push/PR to main
|
203
|
+
- Matrix testing across Python 3.10, 3.11, 3.12 (dropped 3.9 support in v0.1.1)
|
204
|
+
- Runs pytest with coverage
|
205
|
+
- Checks Black formatting
|
206
|
+
- Runs Ruff linting
|
207
|
+
- Builds distribution and validates with twine
|
208
|
+
|
209
|
+
**workflow.yaml**: Automated release and PyPI publishing (triggered by version tags)
|
210
|
+
- Triggers on `v*.*.*` tags (e.g., `v0.1.1`)
|
211
|
+
- Verifies tag version matches both `version.py` and `pyproject.toml`
|
212
|
+
- Extracts changelog from README.md
|
213
|
+
- Creates GitHub Release automatically
|
214
|
+
- Builds wheels and source distributions
|
215
|
+
- Publishes to PyPI using trusted publishing (no API key needed)
|
216
|
+
- **Important**: This single workflow handles the complete release process - DO NOT create separate release workflows
|
217
|
+
|
218
|
+
## Common Development Patterns
|
219
|
+
|
220
|
+
### Adding a New Command
|
221
|
+
|
222
|
+
1. Create command file in `commands/` directory
|
223
|
+
2. Define Click command group or command
|
224
|
+
3. Register in `cli.py` with `cli.add_command()`
|
225
|
+
4. Use Rich console for all output
|
226
|
+
5. Add comprehensive tests in `tests/test_commandname.py`
|
227
|
+
|
228
|
+
### Adding a New Tool/Utility
|
229
|
+
|
230
|
+
1. Create utility module in `tools/` directory
|
231
|
+
2. Import Rich console: `console = Console()`
|
232
|
+
3. Provide clear docstrings with Args/Returns
|
233
|
+
4. Return meaningful values (bool, tuple, etc.) not just console output
|
234
|
+
5. Test in isolation with fixtures
|
235
|
+
|
236
|
+
### File Operations Best Practices
|
237
|
+
|
238
|
+
- Always use `pathlib.Path`, never string paths
|
239
|
+
- Use `Path.resolve()` for absolute paths in user-facing messages
|
240
|
+
- Check existence before operations: `path.exists()`
|
241
|
+
- Use `parents=True, exist_ok=True` for `mkdir()` calls
|
242
|
+
- Handle errors gracefully with try/except and user-friendly messages
|
243
|
+
|
244
|
+
### Output Conventions
|
245
|
+
|
246
|
+
- Success: `[green]✓[/green] Message`
|
247
|
+
- Error: `[red]✗[/red] Message`
|
248
|
+
- Warning: `[yellow]⚠[/yellow] Message`
|
249
|
+
- Info: `[cyan]Message[/cyan]` or `[dim]Message[/dim]`
|
250
|
+
- Use `console.print()` not `print()` or `click.echo()`
|
251
|
+
|
252
|
+
## Known Patterns and Conventions
|
253
|
+
|
254
|
+
### Template Repository Structure
|
255
|
+
|
256
|
+
The CLI expects templates to have:
|
257
|
+
- `pyproject.toml` with project name and entry points
|
258
|
+
- `src/{module_name}/` source directory
|
259
|
+
- `.fips-agents-cli/generators/` (optional, for Phase 2 generate commands)
|
260
|
+
- Standard Python project structure
|
261
|
+
|
262
|
+
### Project Name Validation
|
263
|
+
|
264
|
+
Valid project names must:
|
265
|
+
- Start with a lowercase letter
|
266
|
+
- Contain only lowercase letters, numbers, hyphens, and underscores
|
267
|
+
- Not be empty
|
268
|
+
|
269
|
+
Examples:
|
270
|
+
- ✅ `my-server`, `test_mcp`, `server123`
|
271
|
+
- ❌ `MyServer` (uppercase), `123server` (starts with number), `my@server` (special chars)
|
272
|
+
|
273
|
+
### Module vs Project Names
|
274
|
+
|
275
|
+
- **Project name**: Uses hyphens (e.g., `my-mcp-server`)
|
276
|
+
- **Module name**: Uses underscores (e.g., `my_mcp_server`)
|
277
|
+
- Conversion: `project_name.replace("-", "_")`
|
278
|
+
- This matters for imports and directory names
|
279
|
+
|
280
|
+
## Future Roadmap Context
|
281
|
+
|
282
|
+
### Phase 2 (Next): Generate Command
|
283
|
+
|
284
|
+
The `generate` command will:
|
285
|
+
- Load generator templates from `.fips-agents-cli/generators/` in projects
|
286
|
+
- Use Jinja2 for template rendering
|
287
|
+
- Support tool, prompt, and resource generation
|
288
|
+
- Interactive prompts for parameters
|
289
|
+
|
290
|
+
Template location strategy: Generators are copied into projects during creation (not kept in CLI), allowing per-project customization.
|
291
|
+
|
292
|
+
### Why This Matters Now
|
293
|
+
|
294
|
+
- Don't remove `.fips-agents-cli/` directories during template cloning
|
295
|
+
- Test fixtures already include generator directory structure
|
296
|
+
- Project customization must preserve these directories
|
297
|
+
|
298
|
+
## Troubleshooting Common Issues
|
299
|
+
|
300
|
+
### Git Clone Failures
|
301
|
+
|
302
|
+
Check:
|
303
|
+
1. Internet connectivity
|
304
|
+
2. Template repository URL is accessible
|
305
|
+
3. Git is installed: `git --version`
|
306
|
+
4. Permissions on target directory
|
307
|
+
|
308
|
+
### Module Not Found After Installation
|
309
|
+
|
310
|
+
Ensure:
|
311
|
+
1. Virtual environment is activated
|
312
|
+
2. Package installed with `-e` flag: `pip install -e .`
|
313
|
+
3. Using correct Python interpreter: `which python`
|
314
|
+
|
315
|
+
### Test Failures
|
316
|
+
|
317
|
+
Common causes:
|
318
|
+
1. Forgot to activate venv
|
319
|
+
2. Dependencies not installed: `pip install -e .[dev]`
|
320
|
+
3. Git not configured globally: `git config --global user.email "test@example.com"`
|
321
|
+
|
322
|
+
## Repository-Specific Notes
|
323
|
+
|
324
|
+
- The main branch is `main` (not `master`)
|
325
|
+
- Template URL is hardcoded to `https://github.com/rdwj/mcp-server-template`
|
326
|
+
- Package name on PyPI: `fips-agents-cli`
|
327
|
+
- Command name: `fips-agents` (no `-cli` suffix)
|
328
|
+
- Recommended installation: `pipx install fips-agents-cli`
|