Skip to content

Commit b24a861

Browse files
authored
Fast Credential Access via Session Mode Upgrade (#39)
* feat: upgrade session mode to use ~/.aws/credentials for 99.7% performance improvement - Modify session storage to write/read from ~/.aws/credentials (300ms → 1ms) - Add atomic writes with 0600 permissions - Add --check-expiration and --refresh-if-needed flags - Add Ruff pre-commit hooks for code quality - Add interactive platform selection and build-verbose flag * fix: update linter * fix: update changelog
1 parent db6e2ac commit b24a861

26 files changed

+1650
-1315
lines changed

.pre-commit-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,18 @@ repos:
3333
pass_filenames: true
3434
# This hook will only run if AWS credentials are configured
3535
# It provides additional validation beyond cfn-lint
36+
37+
# Python code quality - Ruff (fast linter and formatter)
38+
- repo: https://github.com/astral-sh/ruff-pre-commit
39+
rev: v0.1.9
40+
hooks:
41+
- id: ruff
42+
name: Lint Python with Ruff (auto-fix)
43+
args: [--fix, --exit-non-zero-on-fix]
44+
files: ^source/.*\.py$
45+
exclude: ^source/(build|dist)/
46+
47+
- id: ruff-format
48+
name: Format Python with Ruff
49+
files: ^source/.*\.py$
50+
exclude: ^source/(build|dist)/

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,44 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.1.1] - 2025-10-09
9+
10+
### Added
11+
12+
- **Fast Credential Access**: Session mode now uses `~/.aws/credentials` for 99.7% performance improvement
13+
- Credentials file I/O methods with atomic writes
14+
- CLI flags: `--check-expiration` and `--refresh-if-needed`
15+
- Expiration tracking with 30-second safety buffer
16+
- ConfigParser-based INI file handling
17+
- **Code Quality Infrastructure**: Ruff pre-commit hooks for automated linting
18+
- Auto-fix import ordering, spacing, and formatting
19+
- Consistent code style enforcement on commit
20+
- **UX Improvements**: Enhanced package command
21+
- Interactive platform selection with questionary checkbox
22+
- Co-authorship preference prompt (opt-in, defaults to False)
23+
- `--build-verbose` flag for detailed build logging
24+
- Unique Docker image tags for reliable builds
25+
26+
### Changed
27+
28+
- **Session Storage Mode**: Now writes to `~/.aws/credentials` instead of custom cache files
29+
- Eliminates credential_process overhead (300ms → 1ms retrieval time)
30+
- Better credential persistence across terminal sessions
31+
- Standard AWS CLI tooling compatibility
32+
- Automatic upgrade for existing session mode users
33+
- **Package Command**: Improved user interaction with interactive prompts
34+
35+
### Security
36+
37+
- **Atomic Writes**: Temp file + `os.replace()` pattern prevents credential file corruption
38+
- **File Permissions**: Credentials file automatically set to 0600 (owner read/write only)
39+
- **Fail-Safe Expiration**: Assumes expired on any error (security-first approach)
40+
41+
### Performance
42+
43+
- **Credential Retrieval**: 99.7% improvement for session mode (300ms → 1ms)
44+
- **No Breaking Changes**: Keyring mode unchanged, session mode automatically upgraded
45+
846
## [1.1.0] - 2025-09-30
947

1048
### Added

source/claude_code_with_bedrock/cli/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
from cleo.application import Application
77

8+
from .commands.builds import BuildsCommand
89
from .commands.cleanup import CleanupCommand
910
from .commands.deploy import DeployCommand
1011
from .commands.destroy import DestroyCommand
1112
from .commands.distribute import DistributeCommand
1213
from .commands.init import InitCommand
1314
from .commands.package import PackageCommand
14-
from .commands.builds import BuildsCommand
1515
from .commands.status import StatusCommand
1616
from .commands.test import TestCommand
1717

@@ -20,10 +20,7 @@
2020

2121
def create_application() -> Application:
2222
"""Create the CLI application."""
23-
application = Application(
24-
"claude-code-with-bedrock",
25-
"1.0.0"
26-
)
23+
application = Application("claude-code-with-bedrock", "1.0.0")
2724

2825
# Add commands
2926
application.add(InitCommand())

source/claude_code_with_bedrock/cli/commands/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
"""CLI commands for Claude Code with Bedrock."""
55

6+
from .builds import BuildsCommand
67
from .deploy import DeployCommand
78
from .destroy import DestroyCommand
89
from .init import InitCommand
910
from .package import PackageCommand
10-
from .builds import BuildsCommand
1111
from .status import StatusCommand
1212
from .test import TestCommand
1313

@@ -18,5 +18,5 @@
1818
"TestCommand",
1919
"PackageCommand",
2020
"BuildsCommand",
21-
"DestroyCommand"
21+
"DestroyCommand",
2222
]

0 commit comments

Comments
 (0)