ccprofile 0.1.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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(uv build:*)"
5
+ ]
6
+ }
7
+ }
@@ -0,0 +1,3 @@
1
+ # pixi environments
2
+ .pixi
3
+ *.egg-info
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,39 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## What This Is
6
+
7
+ `ccprofile` is a CLI tool that manages named permission profiles for Claude Code's `settings.json`. It only touches the `permissions` block (allow/deny/ask); all other settings keys are preserved. Profiles are stored as JSON in `~/.claude/profiles/<name>.json`. Six built-in profiles ship with the tool (readonly, git-basics, python-dev, node-dev, notion-workspace, full-dev).
8
+
9
+ ## Commands
10
+
11
+ ```bash
12
+ # Install in editable mode
13
+ uv pip install -e .
14
+
15
+ # Run the CLI
16
+ uv run ccprofile --help
17
+
18
+ # Run all tests
19
+ uv run pytest
20
+
21
+ # Run a single test
22
+ uv run pytest tests/test_core.py::test_merge_permissions -v
23
+ ```
24
+
25
+ ## Architecture
26
+
27
+ The package lives in `src/ccprofile/` using hatch src-layout. Entry point: `ccprofile.cli:app` (Typer).
28
+
29
+ **Data flow:** CLI commands -> `core.py` (settings I/O) or `profiles.py` (profile CRUD) -> reads/writes JSON files on disk.
30
+
31
+ Key design decisions:
32
+ - `core.py` is the safety-critical layer: `write_permissions()` reads the existing settings file, replaces only the `permissions` key, and writes back — preserving all other keys. Empty permission lists are stripped from the output.
33
+ - `profiles.py` checks custom profiles on disk first, then falls back to builtins. Custom profiles can shadow built-in names.
34
+ - `Profile` model uses `Field(alias="_meta")` with `populate_by_name=True` — construct with `_meta=` kwarg, serialize with `by_alias=True` to get `_meta` key in JSON.
35
+ - Two scopes exist: `user` (reads `~/.claude/settings.json`) and `project` (reads `.claude/settings.local.json` relative to cwd). The `diff` command also accepts `@user` and `@project` as profile name aliases.
36
+
37
+ ## Testing Conventions
38
+
39
+ Tests use `monkeypatch` to redirect file paths (`USER_SETTINGS`, `PROJECT_SETTINGS`, `PROFILES_DIR`, `BACKUPS_DIR`) to `tmp_path`. No fixtures file — helpers are defined inline.
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.4
2
+ Name: ccprofile
3
+ Version: 0.1.0
4
+ Summary: Claude Code permission profile manager
5
+ Author-email: FIKS <zh3036@gmail.com>
6
+ Requires-Python: >=3.12
7
+ Requires-Dist: pydantic>=2.12.5
8
+ Requires-Dist: rich>=14.3.3
9
+ Requires-Dist: typer>=0.24.1
File without changes