awsquery 0.3.2__tar.gz → 0.5.0__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.
- {awsquery-0.3.2 → awsquery-0.5.0}/.claude/settings.local.json +2 -1
- {awsquery-0.3.2 → awsquery-0.5.0}/.devcontainer/devcontainer.json +3 -13
- awsquery-0.5.0/.github/workflows/multistep-validation.yml +66 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/.gitignore +2 -1
- awsquery-0.5.0/CLAUDE.md +318 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/Dockerfile +0 -1
- {awsquery-0.3.2 → awsquery-0.5.0}/Makefile +6 -6
- {awsquery-0.3.2 → awsquery-0.5.0}/PKG-INFO +180 -27
- {awsquery-0.3.2 → awsquery-0.5.0}/README.md +179 -26
- awsquery-0.5.0/coverage.json +1 -0
- awsquery-0.5.0/debug-output.txt +86 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/docker-compose.yml +0 -3
- {awsquery-0.3.2 → awsquery-0.5.0}/docs/DOCKER.md +2 -7
- {awsquery-0.3.2 → awsquery-0.5.0}/pyproject.toml +2 -1
- awsquery-0.5.0/scripts/README.md +196 -0
- awsquery-0.5.0/scripts/validate-awsquery.sh +180 -0
- awsquery-0.5.0/src/awsquery/case_utils.py +104 -0
- awsquery-0.5.0/src/awsquery/cli.py +1056 -0
- awsquery-0.5.0/src/awsquery/core.py +1109 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/src/awsquery/default_filters.yaml +365 -822
- awsquery-0.5.0/src/awsquery/filter_validator.py +154 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/src/awsquery/filters.py +65 -9
- {awsquery-0.3.2 → awsquery-0.5.0}/src/awsquery/formatters.py +166 -114
- {awsquery-0.3.2 → awsquery-0.5.0}/src/awsquery/security.py +9 -27
- awsquery-0.5.0/src/awsquery/shapes.py +250 -0
- awsquery-0.5.0/src/awsquery/utils.py +201 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/src/awsquery.egg-info/PKG-INFO +180 -27
- {awsquery-0.3.2 → awsquery-0.5.0}/src/awsquery.egg-info/SOURCES.txt +21 -4
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/conftest.py +10 -23
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/fixtures/policy_samples.py +0 -51
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/integration/test_autocomplete_resilience.py +40 -30
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/integration/test_end_to_end.py +60 -58
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/integration/test_feature_combinations.py +15 -15
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/integration/test_keys_behavior.py +3 -3
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/integration/test_multi_level.py +31 -72
- awsquery-0.5.0/tests/integration/test_parameter_option_integration.py +233 -0
- awsquery-0.5.0/tests/integration/test_parameter_type_auto_wrapping.py +600 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/integration/test_session_management.py +2 -2
- awsquery-0.5.0/tests/integration/test_shape_aware_integration.py +436 -0
- awsquery-0.5.0/tests/unit/test_case_utils.py +243 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_cli_arg_processing.py +1 -218
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_cli_flags.py +4 -4
- awsquery-0.5.0/tests/unit/test_cli_help_output.py +290 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_cli_parser.py +75 -1
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_cli_session_args.py +9 -7
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_column_ordering.py +4 -10
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_config_loading_simple.py +8 -7
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_core.py +325 -51
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_core_inference.py +76 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_critical_mutations.py +2 -2
- awsquery-0.5.0/tests/unit/test_cross_service_hints.py +773 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_default_column_filters.py +35 -32
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_filter_implementation.py +262 -0
- awsquery-0.5.0/tests/unit/test_filter_validator.py +544 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_formatter_edge_cases.py +14 -14
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_formatters.py +308 -281
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_formatters_data_processing.py +47 -17
- awsquery-0.5.0/tests/unit/test_input_hint_parameter.py +1088 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_keys_display_fix.py +10 -8
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_messaging_enhancements.py +12 -18
- awsquery-0.5.0/tests/unit/test_parameter_option.py +473 -0
- awsquery-0.5.0/tests/unit/test_parameter_type_validation.py +497 -0
- awsquery-0.5.0/tests/unit/test_preemptive_multi_step.py +528 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_security.py +4 -13
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_security_edge_cases.py +0 -45
- awsquery-0.5.0/tests/unit/test_shapes.py +624 -0
- awsquery-0.5.0/tests/unit/test_smart_prefix_matching.py +219 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_tags_transformation.py +7 -7
- awsquery-0.3.2/CLAUDE.md +0 -158
- awsquery-0.3.2/Todo.md +0 -31
- awsquery-0.3.2/src/awsquery/cli.py +0 -537
- awsquery-0.3.2/src/awsquery/core.py +0 -741
- awsquery-0.3.2/src/awsquery/utils.py +0 -118
- awsquery-0.3.2/tests/unit/test_filter_matching.py +0 -276
- awsquery-0.3.2/tests/unit/test_filters.py +0 -737
- awsquery-0.3.2/tests/unit/test_filters_pattern_matching.py +0 -282
- {awsquery-0.3.2 → awsquery-0.5.0}/.claude/agents/code-reviewer.md +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/.claude/agents/makefile-optimizer.md +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/.claude/agents/python-infra-automator.md +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/.claude/agents/test-writer.md +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/.coveragerc +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/.dockerignore +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/.flake8 +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/.github/workflows/quality.yml +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/.github/workflows/release.yml +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/.github/workflows/test.yml +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/Dockerfile.prod +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/LICENSE +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/docs/mutation-testing.md +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/policy.json +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/pytest.ini +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/requirements.txt +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/setup.cfg +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/src/awsquery/__init__.py +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/src/awsquery/config.py +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/src/awsquery/policy.json +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/src/awsquery.egg-info/dependency_links.txt +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/src/awsquery.egg-info/entry_points.txt +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/src/awsquery.egg-info/requires.txt +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/src/awsquery.egg-info/top_level.txt +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/__init__.py +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/fixtures/__init__.py +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/fixtures/aws_responses.py +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/integration/__init__.py +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/integration/test_multi_level_calls.py +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/__init__.py +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_core_string_handling.py +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_filter_edge_cases.py +0 -0
- {awsquery-0.3.2 → awsquery-0.5.0}/tests/unit/test_filter_parameter_extraction.py +0 -0
|
@@ -19,12 +19,7 @@
|
|
|
19
19
|
"ms-python.black-formatter",
|
|
20
20
|
"ms-python.pylint",
|
|
21
21
|
"ms-python.isort",
|
|
22
|
-
"ms-python.mypy-type-checker"
|
|
23
|
-
"charliermarsh.ruff",
|
|
24
|
-
"littlefoxteam.vscode-python-test-adapter",
|
|
25
|
-
"tamasfe.even-better-toml",
|
|
26
|
-
"eamodio.gitlens",
|
|
27
|
-
"GitHub.vscode-pull-request-github"
|
|
22
|
+
"ms-python.mypy-type-checker"
|
|
28
23
|
],
|
|
29
24
|
"settings": {
|
|
30
25
|
"python.defaultInterpreter": "/usr/local/bin/python",
|
|
@@ -59,16 +54,11 @@
|
|
|
59
54
|
}
|
|
60
55
|
}
|
|
61
56
|
},
|
|
62
|
-
"postCreateCommand": "pip install -e '.[dev]'
|
|
57
|
+
"postCreateCommand": "pip install -e '.[dev]'",
|
|
63
58
|
"postStartCommand": "echo 'Welcome to AWSQuery development environment!'",
|
|
64
59
|
"remoteUser": "vscode",
|
|
65
60
|
"mounts": [
|
|
66
|
-
{
|
|
67
|
-
"source": "${localEnv:HOME}/.aws",
|
|
68
|
-
"target": "/home/vscode/.aws",
|
|
69
|
-
"type": "bind",
|
|
70
|
-
"consistency": "cached"
|
|
71
|
-
}
|
|
61
|
+
"source=${localEnv:HOME}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached,readonly"
|
|
72
62
|
],
|
|
73
63
|
"containerEnv": {
|
|
74
64
|
"AWS_REGION": "${localEnv:AWS_REGION}",
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Multi-Step Validation
|
|
3
|
+
|
|
4
|
+
# This workflow validates multi-step AWS API call scenarios by checking which
|
|
5
|
+
# operations require parameters that can be resolved from list operations.
|
|
6
|
+
# Runs weekly and on main branch pushes to track API compatibility over time.
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches: [main]
|
|
11
|
+
schedule:
|
|
12
|
+
- cron: '0 0 * * 0' # Weekly on Sunday at midnight UTC
|
|
13
|
+
workflow_dispatch: # Manual trigger
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
validate:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
continue-on-error: true # Don't block other CI jobs if validation fails
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout code
|
|
22
|
+
uses: actions/checkout@v5
|
|
23
|
+
|
|
24
|
+
- name: Set up Python 3.12
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: '3.12'
|
|
28
|
+
|
|
29
|
+
- name: Cache pip packages
|
|
30
|
+
uses: actions/cache@v4
|
|
31
|
+
with:
|
|
32
|
+
path: ~/.cache/pip
|
|
33
|
+
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
|
|
34
|
+
restore-keys: |
|
|
35
|
+
${{ runner.os }}-pip-
|
|
36
|
+
|
|
37
|
+
- name: Install dependencies
|
|
38
|
+
run: |
|
|
39
|
+
python -m pip install --upgrade pip
|
|
40
|
+
pip install -e ".[dev]"
|
|
41
|
+
|
|
42
|
+
- name: Run multi-step validation
|
|
43
|
+
run: |
|
|
44
|
+
python scripts/validate_multistep_functions.py
|
|
45
|
+
|
|
46
|
+
- name: Upload validation report
|
|
47
|
+
uses: actions/upload-artifact@v4
|
|
48
|
+
if: always() # Upload report even if validation finds issues
|
|
49
|
+
with:
|
|
50
|
+
name: multistep-validation-report
|
|
51
|
+
path: multistep-validation-report.json
|
|
52
|
+
retention-days: 90
|
|
53
|
+
|
|
54
|
+
- name: Check for critical issues
|
|
55
|
+
if: always()
|
|
56
|
+
run: |
|
|
57
|
+
# Parse report and check if broken count is high
|
|
58
|
+
if [ -f multistep-validation-report.json ]; then
|
|
59
|
+
broken_count=$(jq '.statistics.multi_step_scenarios.broken' multistep-validation-report.json)
|
|
60
|
+
echo "Found $broken_count broken multi-step scenarios"
|
|
61
|
+
|
|
62
|
+
# Log warning if count is high, but don't fail
|
|
63
|
+
if [ "$broken_count" -gt 10 ]; then
|
|
64
|
+
echo "::warning::Found $broken_count broken multi-step scenarios - review may be needed"
|
|
65
|
+
fi
|
|
66
|
+
fi
|
awsquery-0.5.0/CLAUDE.md
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
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
|
+
`awsquery` is an advanced CLI tool for querying AWS APIs through boto3 with flexible filtering, automatic parameter resolution, and comprehensive security validation. The tool enforces ReadOnly AWS operations for security and provides intelligent response processing with automatic field discovery.
|
|
8
|
+
|
|
9
|
+
## Development Philosophy
|
|
10
|
+
|
|
11
|
+
**CRITICAL: ZERO BACKWARD COMPATIBILITY REQUIREMENT**
|
|
12
|
+
|
|
13
|
+
This project has **ZERO EXTERNAL CONSUMERS** and **NO BACKWARD COMPATIBILITY OBLIGATIONS**. Internal APIs can and should be changed aggressively for code quality improvements.
|
|
14
|
+
|
|
15
|
+
**MANDATORY PRINCIPLES:**
|
|
16
|
+
- **NEVER maintain backward compatibility** - there are no external users
|
|
17
|
+
- **CLI commands must remain stable** - user-facing behavior should be consistent
|
|
18
|
+
- **Internal APIs are completely mutable** - change function signatures, parameters, return types freely
|
|
19
|
+
- **Delete deprecated code immediately** - no deprecation periods needed
|
|
20
|
+
- **Refactor aggressively** - prioritize clean code over any compatibility concerns
|
|
21
|
+
- **Break internal interfaces without hesitation** - improve designs whenever beneficial
|
|
22
|
+
- **Update tests to match new APIs** - test failures from API changes should be fixed by updating tests
|
|
23
|
+
|
|
24
|
+
**The only stability requirement is the CLI user experience. All internal code is fair game for radical changes.**
|
|
25
|
+
|
|
26
|
+
## MANDATORY AGENT USAGE
|
|
27
|
+
|
|
28
|
+
**ABSOLUTE REQUIREMENT: SPECIALIZED AGENTS MUST BE USED FOR ALL DEVELOPMENT TASKS**
|
|
29
|
+
|
|
30
|
+
**ZERO TOLERANCE POLICY: MANUAL WORK IS CATEGORICALLY FORBIDDEN**
|
|
31
|
+
|
|
32
|
+
### Test Development - MANDATORY @agent-test-writer Usage
|
|
33
|
+
- **MUST USE @agent-test-writer** for ALL test creation, modification, and enhancement
|
|
34
|
+
- **NEVER write tests manually** - always delegate to the specialized test-writer agent
|
|
35
|
+
- **MANDATORY for:** Unit tests, integration tests, edge case testing, test refactoring
|
|
36
|
+
- **REQUIRED PROCESS:** Always use test-driven development through the agent
|
|
37
|
+
- **NO EXCEPTIONS:** Any test-related work MUST go through @agent-test-writer
|
|
38
|
+
|
|
39
|
+
### Python Implementation - MANDATORY @agent-python-infra-automator Usage
|
|
40
|
+
- **MUST USE @agent-python-infra-automator** for ALL Python code implementation
|
|
41
|
+
- **NEVER implement Python code manually** - always delegate to the specialized Python agent
|
|
42
|
+
- **MANDATORY for:** New features, bug fixes, refactoring, optimization, infrastructure code
|
|
43
|
+
- **REQUIRED PROCESS:** Always implement through the specialized agent for best practices
|
|
44
|
+
- **NO EXCEPTIONS:** Any Python development MUST go through @agent-python-infra-automator
|
|
45
|
+
|
|
46
|
+
### Code Review - MANDATORY @agent-code-reviewer Usage
|
|
47
|
+
- **MUST USE @agent-code-reviewer** AUTOMATICALLY after ANY significant code changes
|
|
48
|
+
- **PROACTIVE REQUIREMENT:** Agent must be invoked WITHOUT user request after commits/merges
|
|
49
|
+
- **MANDATORY for:** All code quality reviews, security analysis, maintainability checks
|
|
50
|
+
- **AUTOMATIC TRIGGERS:** Post-commit, post-merge, after major refactoring
|
|
51
|
+
- **NO EXCEPTIONS:** ALL code changes MUST be reviewed by the specialized agent
|
|
52
|
+
|
|
53
|
+
### Makefile Operations - MANDATORY @agent-makefile-optimizer Usage
|
|
54
|
+
- **MUST USE @agent-makefile-optimizer** for ANY Makefile-related work
|
|
55
|
+
- **AUTOMATIC TRIGGER:** ANY interaction with Makefile, makefile, GNUmakefile, *.mk files
|
|
56
|
+
- **MANDATORY for:** Build automation, make targets, build system optimization
|
|
57
|
+
- **PROACTIVE REQUIREMENT:** Agent MUST be used automatically when detecting Makefile work
|
|
58
|
+
- **NO EXCEPTIONS:** ALL build system work MUST go through the specialized agent
|
|
59
|
+
|
|
60
|
+
### Configuration Management - MANDATORY @agent-statusline-setup Usage
|
|
61
|
+
- **MUST USE @agent-statusline-setup** for Claude Code status line configuration
|
|
62
|
+
- **MANDATORY for:** Status line settings, configuration management
|
|
63
|
+
- **NO EXCEPTIONS:** Status line work MUST go through the specialized agent
|
|
64
|
+
|
|
65
|
+
### Output Styling - MANDATORY @agent-output-style-setup Usage
|
|
66
|
+
- **MUST USE @agent-output-style-setup** for Claude Code output style creation
|
|
67
|
+
- **MANDATORY for:** Output formatting, style configuration
|
|
68
|
+
- **NO EXCEPTIONS:** Output style work MUST go through the specialized agent
|
|
69
|
+
|
|
70
|
+
### General Research - MANDATORY @agent-general-purpose Usage
|
|
71
|
+
- **MUST USE @agent-general-purpose** for complex multi-step research tasks
|
|
72
|
+
- **MANDATORY for:** Searching keywords/files, complex questions, multi-step tasks
|
|
73
|
+
- **REQUIRED WHEN:** Not confident about finding right match in first few tries
|
|
74
|
+
- **NO EXCEPTIONS:** Complex research MUST go through the specialized agent
|
|
75
|
+
|
|
76
|
+
### Agent Usage Protocol - ABSOLUTE ENFORCEMENT
|
|
77
|
+
1. **IDENTIFY TASK TYPE:** Determine which specialized agent is required
|
|
78
|
+
2. **AUTOMATIC INVOCATION:** Many agents MUST be triggered proactively/automatically
|
|
79
|
+
3. **PROVIDE COMPLETE CONTEXT:** Include all relevant information for the agent
|
|
80
|
+
4. **FOLLOW AGENT RECOMMENDATIONS:** Implement exactly as specified by the agent
|
|
81
|
+
5. **NO MANUAL OVERRIDE:** Trust the specialized agents completely
|
|
82
|
+
6. **PARALLEL EXECUTION:** Use multiple agents concurrently when possible
|
|
83
|
+
|
|
84
|
+
### PROACTIVE AGENT TRIGGERS - MANDATORY AUTOMATION
|
|
85
|
+
- **@agent-code-reviewer:** AUTOMATICALLY after significant code changes
|
|
86
|
+
- **@agent-makefile-optimizer:** AUTOMATICALLY when detecting Makefile work
|
|
87
|
+
- **@agent-test-writer:** PROACTIVELY when functions/classes lack test coverage
|
|
88
|
+
- **@agent-python-infra-automator:** PROACTIVELY for infrastructure automation needs
|
|
89
|
+
|
|
90
|
+
**VIOLATION OF AGENT USAGE IS STRICTLY FORBIDDEN - ALL DEVELOPMENT MUST GO THROUGH SPECIALIZED AGENTS**
|
|
91
|
+
**MANUAL IMPLEMENTATION IS CATEGORICALLY PROHIBITED - AGENTS ARE MANDATORY FOR ALL WORK**
|
|
92
|
+
|
|
93
|
+
## Development Commands
|
|
94
|
+
|
|
95
|
+
### Core Commands
|
|
96
|
+
- `make install-dev` - Install development dependencies
|
|
97
|
+
- `make test` - Run all tests (MANDATORY - NO SELECTIVE EXECUTION ALLOWED)
|
|
98
|
+
- `make test-unit` - Run unit tests only (directory-based, not marker-based)
|
|
99
|
+
- `make test-integration` - Run integration tests only (directory-based, not marker-based)
|
|
100
|
+
- `make test-critical` - Run all tests (NO SELECTIVE MARKERS PERMITTED)
|
|
101
|
+
- `make coverage` - Run tests with coverage report (generates htmlcov/index.html)
|
|
102
|
+
- `python3 -m pytest tests/ -v` - Direct pytest execution (NEVER with -m markers)
|
|
103
|
+
|
|
104
|
+
### Code Quality
|
|
105
|
+
- `make lint` - Run linting checks (flake8, pylint)
|
|
106
|
+
- `make format` - Format code with black and isort
|
|
107
|
+
- `make format-check` - Check code formatting without changes
|
|
108
|
+
- `make type-check` - Run mypy type checking
|
|
109
|
+
- `make security-check` - Run security checks (bandit, safety)
|
|
110
|
+
|
|
111
|
+
### Docker Development
|
|
112
|
+
- `make docker-build` - Build development container
|
|
113
|
+
- `make shell` - Open interactive shell in container
|
|
114
|
+
- `make test-in-docker` - Run tests in Docker container
|
|
115
|
+
|
|
116
|
+
### Single Test Execution
|
|
117
|
+
- `python3 -m pytest tests/test_specific.py::TestClass::test_method -v` - Run specific test
|
|
118
|
+
- `python3 -m pytest -k "test_pattern" -v` - Run tests matching pattern
|
|
119
|
+
- `python3 -m pytest tests/ -m "unit" -v` - Run tests with specific markers
|
|
120
|
+
|
|
121
|
+
## Architecture
|
|
122
|
+
|
|
123
|
+
### Core Module Structure
|
|
124
|
+
- `src/awsquery/cli.py` - Main CLI interface and argument parsing
|
|
125
|
+
- `src/awsquery/core.py` - Core AWS query execution logic
|
|
126
|
+
- `src/awsquery/security.py` - Security policy validation (ReadOnly enforcement)
|
|
127
|
+
- `src/awsquery/filters.py` - Data filtering and column selection logic
|
|
128
|
+
- `src/awsquery/formatters.py` - Output formatting (table/JSON)
|
|
129
|
+
- `src/awsquery/utils.py` - Utility functions and debug helpers
|
|
130
|
+
|
|
131
|
+
### Key Features
|
|
132
|
+
- **Smart Multi-Level Calls**: Automatically resolves missing parameters by inferring list operations
|
|
133
|
+
- **Security-First Design**: All operations validated against `policy.json` ReadOnly policy
|
|
134
|
+
- **Flexible Filtering**: Multi-level filtering with `--` separators for different filter types
|
|
135
|
+
- **Auto-Parameter Resolution**: Handles both specific fields and standard AWS patterns (Name, Id, Arn)
|
|
136
|
+
- **Intelligent Response Processing**: Clean extraction of list data, ignoring AWS metadata
|
|
137
|
+
|
|
138
|
+
### Security Architecture
|
|
139
|
+
The tool enforces security through a comprehensive `policy.json` file that defines allowed ReadOnly AWS operations. All API calls are validated against this policy before execution.
|
|
140
|
+
|
|
141
|
+
### Testing Structure
|
|
142
|
+
- Unit tests in `tests/unit/` with `@pytest.mark.unit`
|
|
143
|
+
- Integration tests in `tests/integration/` with `@pytest.mark.integration`
|
|
144
|
+
- Critical path tests marked with `@pytest.mark.critical`
|
|
145
|
+
- AWS mocks using moto library marked with `@pytest.mark.aws`
|
|
146
|
+
|
|
147
|
+
### STRICT Testing Requirements - MUST FOLLOW
|
|
148
|
+
|
|
149
|
+
#### 🚫 PROHIBITED: Test Anti-Patterns
|
|
150
|
+
**NEVER CREATE:**
|
|
151
|
+
1. **Duplicate Test Files**: Before creating ANY test file, search for existing tests covering the same functionality
|
|
152
|
+
- Flag tests: Use `test_cli_flags.py` ONLY
|
|
153
|
+
- Parser tests: Use `test_cli_parser.py` ONLY
|
|
154
|
+
- Filter tests: Use `test_filter_implementation.py` for real tests, `test_filter_matching.py` for patterns
|
|
155
|
+
2. **Over-Mocked Tests**: Tests that mock the very functions they claim to test
|
|
156
|
+
3. **Mock Assertion Tests**: Tests that only verify `mock.assert_called()` without testing actual behavior
|
|
157
|
+
4. **Nested Mock Contexts**: More than 2 levels of `with patch()` indicates over-mocking
|
|
158
|
+
|
|
159
|
+
#### ✅ REQUIRED: Test Best Practices
|
|
160
|
+
**ALWAYS:**
|
|
161
|
+
1. **Test Real Implementation**:
|
|
162
|
+
```python
|
|
163
|
+
# GOOD: Tests actual function
|
|
164
|
+
result = filter_resources(real_data, ["filter"])
|
|
165
|
+
assert len(result) == expected
|
|
166
|
+
|
|
167
|
+
# BAD: Only tests mock
|
|
168
|
+
mock_filter.return_value = []
|
|
169
|
+
mock_filter.assert_called_once()
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
2. **Minimal Mocking**: Only mock external dependencies (boto3, file I/O, network)
|
|
173
|
+
```python
|
|
174
|
+
# GOOD: Only mock AWS
|
|
175
|
+
@patch("boto3.client")
|
|
176
|
+
def test_feature(mock_client):
|
|
177
|
+
# Test real code with mocked AWS
|
|
178
|
+
|
|
179
|
+
# BAD: Mock everything
|
|
180
|
+
@patch("filter_resources")
|
|
181
|
+
@patch("format_output")
|
|
182
|
+
@patch("parse_args")
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
3. **Consolidate Related Tests**: Group similar tests in one file
|
|
186
|
+
- All flag position tests → `test_cli_flags.py`
|
|
187
|
+
- All parser tests → `test_cli_parser.py`
|
|
188
|
+
- All filter implementation → `test_filter_implementation.py`
|
|
189
|
+
|
|
190
|
+
4. **Test Edge Cases**: Include malformed input, Unicode, empty values
|
|
191
|
+
```python
|
|
192
|
+
# Test edge cases
|
|
193
|
+
test_cases = ["", None, "^$", "ˆ", "$^", "^^$$"]
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
5. **Verify Actual Output**: Check real results, not mock calls
|
|
197
|
+
```python
|
|
198
|
+
# GOOD: Verify actual JSON
|
|
199
|
+
output = format_json_output(data, filters)
|
|
200
|
+
parsed = json.loads(output) # Ensures valid JSON
|
|
201
|
+
|
|
202
|
+
# BAD: Only check mock called
|
|
203
|
+
mock_json.assert_called_once()
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
#### 📋 Test Review Checklist
|
|
207
|
+
Before committing ANY test:
|
|
208
|
+
1. ❓ Does a test file for this feature already exist?
|
|
209
|
+
2. ❓ Am I testing real code or just mocks?
|
|
210
|
+
3. ❓ Do assertions verify actual behavior?
|
|
211
|
+
4. ❓ Is mocking limited to external dependencies only?
|
|
212
|
+
5. ❓ Are edge cases covered?
|
|
213
|
+
|
|
214
|
+
#### 🔍 Finding Duplicate Tests
|
|
215
|
+
```bash
|
|
216
|
+
# Check for existing tests before creating new ones
|
|
217
|
+
grep -r "test.*flag.*position" tests/
|
|
218
|
+
grep -r "test.*parser" tests/
|
|
219
|
+
grep -r "test.*filter" tests/
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### 🚫 **ABSOLUTE PROHIBITION: VERBOSE TEST COMMENTS**
|
|
223
|
+
|
|
224
|
+
**MANDATORY EDICT: UNNECESSARY TEST COMMENTS ARE CATEGORICALLY FORBIDDEN**
|
|
225
|
+
|
|
226
|
+
**NEVER WRITE THESE TYPES OF COMMENTS:**
|
|
227
|
+
- **TDD Placeholder Comments**: `"""Test the expected structure when -i/--input is implemented."""`
|
|
228
|
+
- **Obvious Restatements**: `"""Test that function returns expected value."""`
|
|
229
|
+
- **Implementation Descriptions**: `"""This test checks if the parser works correctly."""`
|
|
230
|
+
- **Future Implementation Notes**: `"""TODO: implement when feature X is ready."""`
|
|
231
|
+
- **Verbose Process Descriptions**: `"""First we call X, then we check Y, finally we assert Z."""`
|
|
232
|
+
|
|
233
|
+
**HARD RULES FOR TEST DOCUMENTATION:**
|
|
234
|
+
- **NO REDUNDANT DOCSTRINGS**: Never restate what the method name already says
|
|
235
|
+
- **NO TDD PLACEHOLDERS**: Delete placeholder comments immediately after implementation
|
|
236
|
+
- **NO OBVIOUS COMMENTS**: If the test name explains it, don't repeat in comments
|
|
237
|
+
- **NO VERBOSE EXPLANATIONS**: Code should be self-documenting
|
|
238
|
+
- **ESSENTIAL ONLY**: Comments only for complex edge cases or non-obvious logic
|
|
239
|
+
|
|
240
|
+
**ACCEPTABLE COMMENTS (RARE):**
|
|
241
|
+
- Complex edge case explanation: `# Unicode circumflex U+02C6 vs ASCII U+005E`
|
|
242
|
+
- Non-obvious assertion: `# Must check stderr, not stdout for debug output`
|
|
243
|
+
- External dependency note: `# Requires specific AWS policy format`
|
|
244
|
+
|
|
245
|
+
**ENFORCEMENT:**
|
|
246
|
+
- **IMMEDIATE DELETION** of any TDD placeholder comments
|
|
247
|
+
- **ZERO TOLERANCE** for verbose test documentation
|
|
248
|
+
- **CLEAN CODE OVER COMMENTS** - make tests readable through naming and structure
|
|
249
|
+
|
|
250
|
+
### 🚫 **ABSOLUTE PROHIBITION: PYTEST MARKERS**
|
|
251
|
+
|
|
252
|
+
**MANDATORY EDICT: PYTEST MARKERS ARE CATEGORICALLY FORBIDDEN AND COMPLETELY BANNED**
|
|
253
|
+
|
|
254
|
+
**UNBREAKABLE RULES:**
|
|
255
|
+
- **NEVER, EVER, UNDER ANY CIRCUMSTANCES** add `@pytest.mark.*` decorators to tests
|
|
256
|
+
- **ZERO TOLERANCE** for selective test execution markers (`@pytest.mark.unit`, `@pytest.mark.integration`, `@pytest.mark.slow`, `@pytest.mark.critical`, etc.)
|
|
257
|
+
- **ALL TESTS MUST ALWAYS RUN** - no exceptions, no conditional execution, no selective filtering
|
|
258
|
+
- **IMMEDIATE DELETION** required for any pytest markers discovered in code
|
|
259
|
+
- **NO EXEMPTIONS** - this rule is immutable and non-negotiable
|
|
260
|
+
|
|
261
|
+
**RATIONALE:**
|
|
262
|
+
- Selective test execution leads to **INCOMPLETE COVERAGE** and **HIDDEN FAILURES**
|
|
263
|
+
- Markers create **FALSE CONFIDENCE** by allowing tests to be skipped
|
|
264
|
+
- **ALL TESTS ARE CRITICAL** - none should be optional or conditional
|
|
265
|
+
- Complete test suite execution is **MANDATORY FOR QUALITY ASSURANCE**
|
|
266
|
+
|
|
267
|
+
**ENFORCEMENT:**
|
|
268
|
+
- Any pytest markers found in code must be **REMOVED IMMEDIATELY**
|
|
269
|
+
- Makefile commands must **NEVER USE** `-m "marker"` syntax
|
|
270
|
+
- Test discovery must be **PURELY DIRECTORY-BASED** (tests/unit/, tests/integration/)
|
|
271
|
+
- **NO EXCEPTIONS** - this is an inviolable principle
|
|
272
|
+
|
|
273
|
+
**ALLOWED:** `@pytest.mark.parametrize` ONLY (for test parameterization, not selection)
|
|
274
|
+
**FORBIDDEN:** All other `@pytest.mark.*` decorators without exception
|
|
275
|
+
|
|
276
|
+
### Configuration Files
|
|
277
|
+
- `pyproject.toml` - Main project configuration with dependencies and tool settings
|
|
278
|
+
- `pytest.ini` - Test configuration with coverage settings (80% minimum)
|
|
279
|
+
- `Makefile` - Comprehensive development and AWS sampling commands
|
|
280
|
+
|
|
281
|
+
## Git Commit Guidelines
|
|
282
|
+
|
|
283
|
+
### MANDATORY: Concise Commit Messages
|
|
284
|
+
|
|
285
|
+
**STRICT REQUIREMENTS:**
|
|
286
|
+
- **Single-line summary ONLY** - Maximum 72 characters
|
|
287
|
+
- **No multi-line descriptions** - Keep it to one concise line
|
|
288
|
+
- **No bullet points** - Avoid listing multiple changes
|
|
289
|
+
- **No verbose explanations** - Code speaks for itself
|
|
290
|
+
- **Combine related changes** - One commit for logically grouped changes
|
|
291
|
+
|
|
292
|
+
**GOOD EXAMPLES:**
|
|
293
|
+
- `Fix parameter auto-wrapping for list types`
|
|
294
|
+
- `Add validation script with feature coverage`
|
|
295
|
+
- `Skip Tag filter validation (runtime transform)`
|
|
296
|
+
- `Update tests for new parameter handling`
|
|
297
|
+
|
|
298
|
+
**BAD EXAMPLES:**
|
|
299
|
+
- ❌ Multi-line commits with bullets and explanations
|
|
300
|
+
- ❌ "Add X, fix Y, update Z, refactor A, improve B"
|
|
301
|
+
- ❌ Detailed descriptions of implementation choices
|
|
302
|
+
- ❌ Multiple unrelated changes in one commit
|
|
303
|
+
|
|
304
|
+
**COMMIT FORMAT:**
|
|
305
|
+
```
|
|
306
|
+
<short description>
|
|
307
|
+
|
|
308
|
+
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
|
309
|
+
|
|
310
|
+
Co-Authored-By: Claude <noreply@anthropic.com>
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
**ENFORCEMENT:**
|
|
314
|
+
- Commits MUST be atomic and focused
|
|
315
|
+
- Summary line MUST be clear and complete
|
|
316
|
+
- NO additional description beyond the trailer
|
|
317
|
+
- Related changes MUST be combined into single commit
|
|
318
|
+
- Unrelated changes MUST be separate commits
|
|
@@ -40,13 +40,13 @@ test: ## Run all tests
|
|
|
40
40
|
python3 -m pytest tests/ -v
|
|
41
41
|
|
|
42
42
|
test-unit: ## Run unit tests only
|
|
43
|
-
python3 -m pytest tests/unit/ -v
|
|
43
|
+
python3 -m pytest tests/unit/ -v
|
|
44
44
|
|
|
45
45
|
test-integration: ## Run integration tests only
|
|
46
|
-
python3 -m pytest tests/integration/ -v
|
|
46
|
+
python3 -m pytest tests/integration/ -v
|
|
47
47
|
|
|
48
|
-
test-slow: ## Run
|
|
49
|
-
python3 -m pytest tests/ -v
|
|
48
|
+
test-slow: ## Run all tests (no selective marking allowed)
|
|
49
|
+
python3 -m pytest tests/ -v
|
|
50
50
|
|
|
51
51
|
test-fast: ## Run all tests with parallel execution (optimized for Python 3.8-3.10)
|
|
52
52
|
python3 -m pytest tests/ -n auto -q
|
|
@@ -57,8 +57,8 @@ test-unit-fast: ## Run unit tests with parallel execution (2-5 seconds)
|
|
|
57
57
|
test-integration-fast: ## Run integration tests with parallel execution
|
|
58
58
|
python3 -m pytest tests/integration/ -n auto -q
|
|
59
59
|
|
|
60
|
-
test-critical: ## Run
|
|
61
|
-
python3 -m pytest tests/ -v
|
|
60
|
+
test-critical: ## Run all tests (no selective marking allowed)
|
|
61
|
+
python3 -m pytest tests/ -v
|
|
62
62
|
|
|
63
63
|
coverage: ## Run tests with coverage report
|
|
64
64
|
python3 -m pytest tests/ --cov=src/awsquery --cov-report=term-missing --cov-report=html
|