cl-preset 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,78 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ PIPFILE.lock
28
+
29
+ # PyInstaller
30
+ *.manifest
31
+ *.spec
32
+
33
+ # Unit test / coverage reports
34
+ htmlcov/
35
+ .tox/
36
+ .nox/
37
+ .coverage
38
+ .coverage.*
39
+ .cache
40
+ nosetests.xml
41
+ coverage.xml
42
+ *.cover
43
+ *.py,cover
44
+ .hypothesis/
45
+ .pytest_cache/
46
+ cover/
47
+
48
+ # Translations
49
+ *.mo
50
+ *.pot
51
+
52
+ # Environments
53
+ .env
54
+ .venv
55
+ env/
56
+ venv/
57
+ ENV/
58
+ env.bak/
59
+ venv.bak/
60
+
61
+ # IDEs
62
+ .vscode/
63
+ .idea/
64
+ *.swp
65
+ *.swo
66
+ *~
67
+
68
+ # OS
69
+ .DS_Store
70
+ Thumbs.db
71
+
72
+ # uv
73
+ .uv/
74
+ uv.lock
75
+
76
+ # Project specific
77
+ *.bak
78
+ preset.json
@@ -0,0 +1 @@
1
+ 3.14
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] - 2026-02-06
11
+
12
+ ### Added
13
+ - Initial release of cl-preset package
14
+ - Preset installation with support for global, user, and project scopes
15
+ - CLI commands: init, install, list, info, uninstall
16
+ - Preset metadata validation using Pydantic
17
+ - Rich terminal output with formatted tables
18
+ - JSON output support for listing presets
19
+ - Example web development strategy preset
20
+ - Comprehensive test suite with pytest
21
+ - Support for preset types: agent, skill, command, strategy
22
+
23
+ ### Features
24
+ - Create preset scaffolds with directory structure
25
+ - Install presets from local directories
26
+ - List installed presets with optional scope filtering
27
+ - Display detailed preset information
28
+ - Uninstall presets by name
29
+ - Registry-based installation tracking
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 William Jung
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ include README.md
2
+ include LICENSE
3
+ include CHANGELOG.md
4
+ recursive-include src/cl_preset *.py
5
+ recursive-include examples/presets *.md
6
+ global-include py.typed
@@ -0,0 +1,394 @@
1
+ Metadata-Version: 2.4
2
+ Name: cl-preset
3
+ Version: 0.1.0
4
+ Summary: A package for managing Claude Code configuration presets and strategies
5
+ Project-URL: Homepage, https://github.com/yarang/cl-preset
6
+ Project-URL: Documentation, https://github.com/yarang/cl-preset#readme
7
+ Project-URL: Repository, https://github.com/yarang/cl-preset
8
+ Project-URL: Issues, https://github.com/yarang/cl-preset/issues
9
+ Author-email: William Jung <yarang@gmail.com>
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Requires-Python: >=3.10
13
+ Requires-Dist: click>=8.1.0
14
+ Requires-Dist: pydantic>=2.0.0
15
+ Requires-Dist: pyyaml>=6.0.0
16
+ Requires-Dist: rich>=13.0.0
17
+ Provides-Extra: dev
18
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
19
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
20
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
21
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
22
+ Description-Content-Type: text/markdown
23
+
24
+ # cl-preset
25
+
26
+ A Python package for managing Claude Code configuration presets and strategies.
27
+
28
+ ## Overview
29
+
30
+ `cl-preset` allows you to package your Claude Code strategies and install them with different scopes (global, user, or project). This makes it easy to share and distribute custom configurations across projects and teams.
31
+
32
+ ## Features
33
+
34
+ - **Package Management**: Create, install, and uninstall preset packages
35
+ - **Multiple Scopes**: Install presets globally, per-user, or per-project
36
+ - **CLI Interface**: Simple command-line interface for all operations
37
+ - **Rich Output**: Beautiful terminal output with formatted tables
38
+ - **Validation**: Built-in metadata validation for preset packages
39
+ - **Git Strategy Management**: Built-in git workflow strategies with validation
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ pip install cl-preset
45
+ ```
46
+
47
+ Or using uv:
48
+
49
+ ```bash
50
+ uv pip install cl-preset
51
+ ```
52
+
53
+ ## Quick Start
54
+
55
+ ### Create a New Preset
56
+
57
+ ```bash
58
+ # Initialize a new preset scaffold
59
+ cl-preset init my-strategy
60
+
61
+ # This creates a directory structure:
62
+ # my-strategy/
63
+ # ├── agents/ # Agent definitions
64
+ # ├── skills/ # Skill definitions
65
+ # ├── commands/ # Command definitions
66
+ # └── examples/ # Usage examples
67
+ ```
68
+
69
+ ### Install a Preset
70
+
71
+ ```bash
72
+ # Install from a local directory
73
+ cl-preset install ./my-strategy --name my-strategy --description "My custom strategy"
74
+
75
+ # Install with specific scope
76
+ cl-preset install ./my-strategy --name my-strategy --description "My custom strategy" --scope global
77
+ ```
78
+
79
+ ### List Installed Presets
80
+
81
+ ```bash
82
+ # List all installed presets
83
+ cl-preset list
84
+
85
+ # List presets by scope
86
+ cl-preset list --scope user
87
+ cl-preset list --scope project
88
+ cl-preset list --scope global
89
+
90
+ # Output as JSON
91
+ cl-preset list --json
92
+ ```
93
+
94
+ ### Get Preset Information
95
+
96
+ ```bash
97
+ cl-preset info my-strategy
98
+ ```
99
+
100
+ ### Uninstall a Preset
101
+
102
+ ```bash
103
+ cl-preset uninstall my-strategy
104
+
105
+ # Uninstall from specific scope
106
+ cl-preset uninstall my-strategy --scope user
107
+ ```
108
+
109
+ ## Command Reference
110
+
111
+ ### `init`
112
+
113
+ Initialize a new preset scaffold.
114
+
115
+ ```bash
116
+ cl-preset init NAME [OPTIONS]
117
+ ```
118
+
119
+ **Options:**
120
+ - `--output, -o`: Output path for preset metadata (default: ./preset.json)
121
+
122
+ ### `install`
123
+
124
+ Install a preset from a source directory.
125
+
126
+ ```bash
127
+ cl-preset install SOURCE_PATH [OPTIONS]
128
+ ```
129
+
130
+ **Options:**
131
+ - `--name, -n`: Unique name for the preset (required)
132
+ - `--version, -v`: Version (default: 1.0.0)
133
+ - `--description, -d`: Description of the preset (required)
134
+ - `--author, -a`: Author name
135
+ - `--type, -t`: Type of preset (agent|skill|command|strategy)
136
+ - `--scope, -s`: Installation scope (global|user|project)
137
+
138
+ ### `list`
139
+
140
+ List installed presets.
141
+
142
+ ```bash
143
+ cl-preset list [OPTIONS]
144
+ ```
145
+
146
+ **Options:**
147
+ - `--scope, -s`: Filter by scope
148
+ - `--json`: Output as JSON
149
+
150
+ ### `info`
151
+
152
+ Show detailed information about an installed preset.
153
+
154
+ ```bash
155
+ cl-preset info NAME
156
+ ```
157
+
158
+ ### `uninstall`
159
+
160
+ Uninstall a preset by name.
161
+
162
+ ```bash
163
+ cl-preset uninstall NAME [OPTIONS]
164
+ ```
165
+
166
+ **Options:**
167
+ - `--scope, -s`: Filter by scope
168
+
169
+ ## Git Strategy Management
170
+
171
+ `cl-preset` includes built-in git workflow strategies that you can apply to your projects. These strategies define branching patterns, merge rules, and branch protection configurations.
172
+
173
+ ### Available Strategies
174
+
175
+ #### dual-repo
176
+ Dev/Release repository separation workflow.
177
+ - **Dev repository**: Active development, feature branches, experimental work
178
+ - **Release repository**: Production-ready code, stable releases, published documentation
179
+ - **Promotion workflow**: Create release branch, review, merge to release repository
180
+
181
+ #### github-flow
182
+ Simple branch-based workflow.
183
+ - Feature branches from main
184
+ - Pull requests for review
185
+ - Direct merge to main after approval
186
+ - No release/develop branches
187
+
188
+ #### git-flow
189
+ Feature/release/hotfix branching model.
190
+ - **master**: Production-ready code
191
+ - **develop**: Integration branch for features
192
+ - **feature/**: Feature development branches
193
+ - **release/**: Release preparation branches
194
+ - **hotfix/**: Emergency fixes for production
195
+
196
+ ### Git Commands
197
+
198
+ #### `git list`
199
+
200
+ List available git strategies.
201
+
202
+ ```bash
203
+ cl-preset git list
204
+ cl-preset git list --no-builtin # Only custom strategies
205
+ ```
206
+
207
+ #### `git info`
208
+
209
+ Show detailed information about a git strategy.
210
+
211
+ ```bash
212
+ cl-preset git info dual-repo
213
+ cl-preset git info github-flow
214
+ ```
215
+
216
+ #### `git export`
217
+
218
+ Export a git strategy to a YAML file.
219
+
220
+ ```bash
221
+ cl-preset git export dual-repo
222
+ cl-preset git export dual-repo -o ./my-strategy.yaml
223
+ ```
224
+
225
+ #### `git apply`
226
+
227
+ Apply a git strategy to the current project.
228
+
229
+ ```bash
230
+ # Apply a strategy
231
+ cl-preset git apply github-flow
232
+
233
+ # Dry run to see what would be configured
234
+ cl-preset git apply github-flow --dry-run
235
+ ```
236
+
237
+ This creates a `.moai/config/sections/git-strategy.yaml` file with the strategy configuration.
238
+
239
+ #### `git validate`
240
+
241
+ Validate current git setup against a strategy.
242
+
243
+ ```bash
244
+ cl-preset git validate github-flow
245
+ ```
246
+
247
+ This checks:
248
+ - Current branch matches strategy expectations
249
+ - Required branches exist (main, develop, etc.)
250
+ - Required remotes are configured
251
+ - Repository state matches the strategy
252
+
253
+ ### Creating Custom Strategies
254
+
255
+ You can create custom git strategies by exporting a built-in strategy and modifying it:
256
+
257
+ ```bash
258
+ # Export a built-in strategy as a starting point
259
+ cl-preset git export github-flow -o ./my-custom-strategy.yaml
260
+
261
+ # Edit the YAML file to customize
262
+ # Then use it as a reference for your project
263
+ ```
264
+
265
+ Strategy configuration format:
266
+
267
+ ```yaml
268
+ name: my-custom-strategy
269
+ strategy_type: custom
270
+ description: "A custom git workflow"
271
+
272
+ main_branch: main
273
+ develop_branch: develop
274
+
275
+ branch_patterns:
276
+ feature: "feature/*"
277
+ bugfix: "bugfix/*"
278
+ release: "release/*"
279
+ hotfix: "hotfix/*"
280
+
281
+ merge_rules:
282
+ require_pr: true
283
+ require_approval: true
284
+ allow_squash: true
285
+ allow_merge_commit: false
286
+ allow_rebase: false
287
+
288
+ protection_rules:
289
+ main:
290
+ enabled: true
291
+ require_status_checks: true
292
+ required_check_names: ["ci", "tests"]
293
+ allow_force_pushes: false
294
+ allow_deletions: false
295
+ ```
296
+
297
+ ### Git Strategy Integration with MoAI
298
+
299
+ When you apply a git strategy using `cl-preset git apply`, it:
300
+
301
+ 1. Creates `.moai/config/sections/git-strategy.yaml`
302
+ 2. Configures branch naming patterns
303
+ 3. Sets up merge rule recommendations
304
+ 4. Defines branch protection rules
305
+
306
+ This integrates with MoAI's git workflow commands and ensures consistent branching patterns across your team.
307
+
308
+ ## Scopes
309
+
310
+ Presets can be installed at three different scopes:
311
+
312
+ | Scope | Path | Description |
313
+ |-------|------|-------------|
314
+ | `global` | `/usr/local/share/cl-preset/{name}` | Available to all users on the system |
315
+ | `user` | `~/.claude/presets/{name}` | Available only to the current user (default) |
316
+ | `project` | `.claude/presets/{name}` | Available only in the current project |
317
+
318
+ ## Preset Structure
319
+
320
+ A valid preset directory contains:
321
+
322
+ ```
323
+ my-preset/
324
+ ├── agents/ # Agent definition files
325
+ ├── skills/ # Skill definition files
326
+ ├── commands/ # Command definition files
327
+ ├── examples/ # Usage examples
328
+ └── preset.json # Preset metadata (generated during install)
329
+ ```
330
+
331
+ ## Metadata
332
+
333
+ Each preset has metadata defined in `preset.json`:
334
+
335
+ ```json
336
+ {
337
+ "name": "my-preset",
338
+ "version": "1.0.0",
339
+ "description": "My custom Claude Code strategy",
340
+ "author": "Your Name",
341
+ "license": "MIT",
342
+ "preset_type": "strategy",
343
+ "tags": ["web", "api", "fastapi"]
344
+ }
345
+ ```
346
+
347
+ ## Development
348
+
349
+ ### Setup Development Environment
350
+
351
+ ```bash
352
+ # Clone the repository
353
+ git clone https://github.com/yarang/cl-preset
354
+ cd cl-preset
355
+
356
+ # Install with dev dependencies
357
+ uv sync --dev
358
+ ```
359
+
360
+ ### Run Tests
361
+
362
+ ```bash
363
+ uv run pytest
364
+ ```
365
+
366
+ ### Code Quality
367
+
368
+ ```bash
369
+ # Format code
370
+ uv run ruff format .
371
+
372
+ # Lint code
373
+ uv run ruff check .
374
+
375
+ # Type check
376
+ uv run mypy src/
377
+ ```
378
+
379
+ ## License
380
+
381
+ MIT License - see LICENSE file for details.
382
+
383
+ ## Contributing
384
+
385
+ Contributions are welcome! Please open an issue or submit a pull request.
386
+
387
+ ## Author
388
+
389
+ William Jung - [@yarang](https://github.com/yarang)
390
+
391
+ ## Links
392
+
393
+ - [GitHub Repository](https://github.com/yarang/cl-preset)
394
+ - [Issue Tracker](https://github.com/yarang/cl-preset/issues)