charlie-agents 0.3.0__py3-none-any.whl

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,434 @@
1
+ Metadata-Version: 2.4
2
+ Name: charlie-agents
3
+ Version: 0.3.0
4
+ Summary: Universal command transpiler for AI agents, MCP servers, and rules
5
+ Project-URL: Homepage, https://github.com/henriquemoody/charlie
6
+ Project-URL: Documentation, https://github.com/henriquemoody/charlie#readme
7
+ Project-URL: Repository, https://github.com/henriquemoody/charlie
8
+ Project-URL: Issues, https://github.com/henriquemoody/charlie/issues
9
+ Author: Charlie Contributors
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: agents,ai,claude,commands,copilot,gemini,mcp,transpiler
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: pydantic>=2.0.0
21
+ Requires-Dist: python-dotenv>=1.0.0
22
+ Requires-Dist: python-slugify<9.0.0,>=8.0.4
23
+ Requires-Dist: pyyaml>=6.0.0
24
+ Requires-Dist: rich>=13.0.0
25
+ Requires-Dist: typer>=0.9.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
28
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
29
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
30
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # Charlie - Universal Agent Config Generator
34
+
35
+ **Define once in YAML/Markdown. Generate agent-specific commands, MCP config, and rules.**
36
+
37
+ Charlie is a universal agent configuration generator that produces agent-specific commands, MCP configurations, and rules from a single YAML/Markdown spec.
38
+
39
+ [![Tests](https://img.shields.io/badge/tests-94%20passed-green)]()
40
+ [![Coverage](https://img.shields.io/badge/coverage-96%25-brightgreen)]()
41
+ [![Python](https://img.shields.io/badge/python-3.11+-blue)]()
42
+
43
+ ## Features
44
+
45
+ - ✨ **Single Definition**: Write settings once in YAML or Markdown
46
+ - 🤖 **Multi-Agent Support**: Generate for different AI agents (only Claude and Cursor supported for now)
47
+ - ⚙️ **Slash Commands Integration**: Generate slash commands from a single definition.
48
+ - 🔌 **MCP Integration**: Generate MCP server configurations with tool schemas
49
+ - 📋 **Rules Generation**: Create agent-specific rules files with manual preservation
50
+ - 🎯 **Auto-Detection**: Automatically finds `charlie.yaml` or `.charlie/` directory
51
+ - ⚡ **Runtime Targeting**: Choose which agents to generate for at runtime
52
+ - 📦 **Library & CLI**: Use as CLI tool or import as Python library
53
+
54
+ ## Quick Start
55
+
56
+ ### Installation
57
+
58
+ ```bash
59
+ pip install charlie-agents
60
+ ```
61
+
62
+ ## Configuration
63
+
64
+ For advanced features, Charlie supports two configuration approaches:
65
+
66
+ 1. **Monolithic** - Single YAML file (good for small projects)
67
+ 2. **Directory-Based** - Modular files in `.charlie/` directories (good for large projects)
68
+
69
+ ### Monolithic Configuration
70
+
71
+ For advanced features, create `charlie.yaml` in your project:
72
+
73
+ ```yaml
74
+ version: "1.0" # Optional: Schema version (defaults to "1.0")
75
+
76
+ project:
77
+ name: "My project" # Optional: Inferred from directory name if omitted
78
+ namespace: "my" # Optional: Used to prefix commands, rules, and MCP servers.
79
+
80
+ variables:
81
+ mcp_api_token: ~ # It will ask the user to provide an API token, if the environment variable is not set
82
+
83
+ # Command definitions
84
+ commands:
85
+ - name: "commit"
86
+ description: "Analyze changes and create a high-quality git commit"
87
+ prompt: "Check what changed, and commit your changes. The body of the message explains WHY it changed"
88
+
89
+ - name: "command-handler"
90
+ description: "Creates a command handler"
91
+ prompt: "Create a command handler using src/examples/handler.py as an reference"
92
+
93
+ # MCP server definitions
94
+ mcp_servers:
95
+ - name: "local_server"
96
+ transport: "stdio"
97
+ command: "node"
98
+ args: ["server.js"]
99
+ env:
100
+ KEY: "value"
101
+
102
+ - name: "remote_server"
103
+ url: "https://example.com/mcp"
104
+ headers:
105
+ Authorization: "Bearer {{var:mcp_api_token}}"
106
+ Content-Type: "application/json"
107
+
108
+ # Rules configuration (rules)
109
+ rules:
110
+ - description: "Commit message standards"
111
+ prompt: "Use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)"
112
+
113
+ - description: "Coding standards"
114
+ prompt: "All code should follow PEP 8"
115
+ ```
116
+
117
+ Charlie will also read `charlie.dist.yaml`, unless you have a `charlie.yaml` in the directory.
118
+
119
+ See [`examples/`](examples/) directory for complete examples:
120
+
121
+ - [`examples/simple/`](examples/simple/) - Basic configuration
122
+ - [`examples/speckit/`](examples/speckit/) - Spec-kit inspired configuration
123
+
124
+ ### Directory-Based Configuration
125
+
126
+ For better organization and collaboration, use the directory-based approach. The `charlie.yaml` file is **optional** - if you only have a `.charlie/` directory, Charlie will infer the project name from the directory:
127
+
128
+ ```
129
+ project/
130
+ ├── charlie.yaml # Optional: Project metadata (name inferred if omitted)
131
+ └── .charlie/
132
+ ├── commands/
133
+ │ ├── init.yaml # One file per command (Markdown or YAML supported)
134
+ │ └── deploy.md
135
+ ├── rules/
136
+ │ ├── commit-messages.yaml # One file per rule (Markdown or YAML supported)
137
+ │ └── code-style.md
138
+ └── mcp-servers/
139
+ └── local-tools.yaml # MCP servers in YAML
140
+ ```
141
+
142
+ See [`examples/directory-based/`](examples/directory-based/) for a complete example.
143
+
144
+ **Benefits:**
145
+
146
+ - Clear organization (one file per command/rule)
147
+ - No merge conflicts on single file
148
+ - Easy to add/remove components
149
+ - Better for version control diffs
150
+ - Native markdown support for rich documentation
151
+
152
+ ### Generate Agent-specific Configuration
153
+
154
+ ```bash
155
+ # Generate configuration files for a specific agent (generates commands, MCP, and rules by default)
156
+ charlie generate claude
157
+ ```
158
+
159
+ ### Placeholders
160
+
161
+ Charlie supports these universal placeholders in commands, rules, and MCP configurations:
162
+
163
+ **Project Placeholders:**
164
+
165
+ - `{{project_dir}}` → Resolves to the project root directory
166
+ - `{{project_name}}` → Replaced with the project name (e.g., `My Project`)
167
+ - `{{project_namespace}}` → Replaced with the project namespace (e.g., `my`)
168
+
169
+ **Agent Placeholders:**
170
+
171
+ - `{{agent_name}}` → Replaced with the agent's full name (e.g., `Claude Code`, `Cursor`)
172
+ - `{{agent_shortname}}` → Replaced with the agent's short identifier (e.g., `claude`, `cursor`)
173
+ - `{{agent_dir}}` → Resolves to agent's base directory (e.g., `.claude`, `.cursor`)
174
+ - `{{commands_shorthand_injection}}` → Agent-specific command shorthand (e.g., `$ARGUMENTS` for supported agents)
175
+
176
+ **Agent Path Placeholders:**
177
+
178
+ - `{{commands_dir}}` → Resolves to agent's commands directory (e.g., `.claude/commands/`)
179
+ - `{{rules_dir}}` → Resolves to agent's rules directory (e.g., `.claude/rules/`)
180
+ - `{{rules_file}}` → Resolves to agent's rules file path (e.g., `.claude/rules.md`)
181
+ - `{{mcp_file}}` → Resolves to agent's MCP configuration file name (e.g., `mcp.json`)
182
+ - `{{assets_dir}}` → Resolves to agent's assets directory (e.g., `.claude/assets`)
183
+
184
+ **Variable Placeholders:**
185
+
186
+ - `{{var:VARIABLE_NAME}}` → Replaced with the value of a variable defined in your `charlie.yaml`
187
+ - Variables can be defined in the `variables:` section
188
+ - Use `~` as value to prompt user for input if not set as environment variable
189
+ - Example: `{{var:mcp_api_token}}`
190
+ - Charlie will prompt user for input if variable is not set.
191
+
192
+ **Environment Variable Placeholders:**
193
+
194
+ - `{{env:VAR_NAME}}` → Replaced with the value of the environment variable
195
+ - Loads from system environment or `.env` file in root directory
196
+ - Raises `EnvironmentVariableNotFoundError` if variable doesn't exist
197
+ - System environment variables take precedence over `.env` file
198
+
199
+ **Custom Replacements:**
200
+
201
+ - Custom placeholders can be defined per-command or per-rule using the `replacements` field
202
+ - See the Library API section for examples
203
+
204
+ These placeholders work in commands, rules, and MCP server configurations (command, args, URL, and headers fields).
205
+
206
+ ## Usage
207
+
208
+ ### CLI Commands
209
+
210
+ #### `charlie generate <agent>`
211
+
212
+ Setup agent-specific configurations (generates commands, MCP config, and rules by default):
213
+
214
+ ```bash
215
+ # Auto-detect charlie.yaml (generates all artifacts)
216
+ charlie generate claude
217
+
218
+ # Setup without MCP config
219
+ charlie generate cursor --no-mcp
220
+
221
+ # Setup without rules (rules)
222
+ charlie generate claude --no-rules
223
+
224
+ # Setup without commands
225
+ charlie generate claude --no-commands
226
+
227
+ # Explicit config file
228
+ charlie generate cursor --config my-config.yaml
229
+
230
+ # Custom output directory
231
+ charlie generate cursor --output ./build
232
+ ```
233
+
234
+ #### `charlie validate`
235
+
236
+ Validate YAML configuration:
237
+
238
+ ```bash
239
+ # Auto-detect charlie.yaml
240
+ charlie validate
241
+
242
+ # Specific file
243
+ charlie validate my-config.yaml
244
+ ```
245
+
246
+ #### `charlie list-agents`
247
+
248
+ List all supported AI agents:
249
+
250
+ ```bash
251
+ charlie list-agents
252
+ ```
253
+
254
+ #### `charlie info <agent>`
255
+
256
+ Show detailed information about an agent:
257
+
258
+ ```bash
259
+ charlie info claude
260
+ charlie info cursor
261
+ ```
262
+
263
+ ### Library API
264
+
265
+ Use Charlie programmatically in Python:
266
+
267
+ ```python
268
+ from charlie import AgentRegistry, AgentConfiguratorFactory, Tracker
269
+ from charlie.schema import Project, Command, Rule, HttpMCPServer, StdioMCPServer, ValueReplacement
270
+ from charlie.enums import RuleMode
271
+
272
+ # Initialize registry and get agent
273
+ registry = AgentRegistry()
274
+ agent = registry.get("claude")
275
+
276
+ # Create project configuration
277
+ project = Project(
278
+ name="My Project",
279
+ namespace="my",
280
+ dir="/path/to/project",
281
+ )
282
+
283
+ # Create configurator
284
+ configurator = AgentConfiguratorFactory.create(
285
+ agent=agent,
286
+ project=project,
287
+ tracker=Tracker()
288
+ )
289
+
290
+ # Generate commands
291
+ configurator.commands([
292
+ Command(
293
+ name="commit",
294
+ description="Analyze changes and create a high-quality git commit",
295
+ prompt="Check what changed, and commit your changes. The body of the message explains WHY it changed",
296
+ metadata={
297
+ "allowed-tools": "Bash(git add:*), Bash(git status:*), Bash(git commit:*)"
298
+ },
299
+ replacements={}
300
+ ),
301
+ Command(
302
+ name="deploy",
303
+ description="Deploy the application",
304
+ prompt="Run {{script}}",
305
+ metadata={},
306
+ replacements={
307
+ "script": ValueReplacement(
308
+ type="value",
309
+ value=".claude/assets/deploy.sh"
310
+ )
311
+ }
312
+ )
313
+ ])
314
+
315
+ # Generate MCP configuration
316
+ configurator.mcp_servers([
317
+ HttpMCPServer(
318
+ name="my-http-server",
319
+ transport="http",
320
+ url="https://example.com/mcp",
321
+ headers={
322
+ "Authorization": "Bearer F8417EA8-94F3-447C-A108-B0AD7E428BE6",
323
+ "Content-Type": "application/json"
324
+ },
325
+ ),
326
+ StdioMCPServer(
327
+ name="my-stdio-server",
328
+ transport="stdio",
329
+ command="node",
330
+ args=["server.js"],
331
+ env={
332
+ "API_TOKEN": "84EBB71B-0FF8-49D8-84C8-55FF9550CA2C"
333
+ },
334
+ ),
335
+ ])
336
+
337
+ # Generate rules (rules)
338
+ configurator.rules(
339
+ [
340
+ Rule(
341
+ name="commit-messages",
342
+ description="Commit message standards",
343
+ prompt="Use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)",
344
+ metadata={
345
+ "alwaysApply": True,
346
+ },
347
+ replacements={}
348
+ ),
349
+ Rule(
350
+ name="coding-standards",
351
+ description="Coding standards",
352
+ prompt="All code should follow {{standard}}",
353
+ metadata={},
354
+ replacements={
355
+ "standard": ValueReplacement(
356
+ type="value",
357
+ value="PEP 8"
358
+ )
359
+ }
360
+ )
361
+ ],
362
+ RuleMode.MERGED
363
+ )
364
+
365
+ # Copy assets to the agent's directory
366
+ configurator.assets([
367
+ ".charlie/assets/deploy.sh",
368
+ ])
369
+ ```
370
+
371
+ ## Supported Agents
372
+
373
+ Charlie currently supports the following AI agents:
374
+
375
+ - **Claude Code** (`claude`) - Claude's AI coding assistant
376
+ - **Cursor** (`cursor`) - AI-powered code editor
377
+
378
+ Run `charlie list-agents` to see all available agents.
379
+
380
+ ### Metadata support
381
+
382
+ Charlie uses **pass-through metadata** - add any agent-specific metadata to your commands or rules, and Charlie will include them in generated output:
383
+
384
+ Charlie extracts these fields and includes them in agent-specific output (YAML frontmatter for Markdown agents, TOML fields for TOML agents). See [`AGENT_FIELDS.md`](AGENT_FIELDS.md) for details on which agents support which fields.
385
+
386
+ ### Rules Generation Modes
387
+
388
+ Rules (rules) can be generated in two modes:
389
+
390
+ **Merged Mode** (default) - Single file with all sections:
391
+
392
+ ```bash
393
+ charlie generate cursor --rules-mode merged
394
+ ```
395
+
396
+ **Separate Mode** - One file per section:
397
+
398
+ ```bash
399
+ charlie generate cursor --rules-mode separate
400
+ ```
401
+
402
+ Use merged mode for simple projects, separate mode for better organization in complex projects.
403
+
404
+ ## Development
405
+
406
+ ### Running Tests
407
+
408
+ ```bash
409
+ # Install dev dependencies
410
+ pip install -e ".[dev]"
411
+
412
+ # Run tests
413
+ pytest
414
+
415
+ # Run with coverage
416
+ pytest --cov=charlie
417
+ ```
418
+
419
+ ## Contributing
420
+
421
+ Contributions welcome! Key areas:
422
+
423
+ - Adding support for new AI agents
424
+ - Improving documentation
425
+ - Adding more examples
426
+ - Bug fixes and tests
427
+
428
+ ## License
429
+
430
+ MIT
431
+
432
+ ## Acknowledgments
433
+
434
+ Charlie was inspired by the need to maintain consistent command definitions across multiple AI agents in the [Spec Kit](https://github.com/github/spec-kit) project.
@@ -0,0 +1,5 @@
1
+ charlie_agents-0.3.0.dist-info/METADATA,sha256=c9u_kHBgVPH7GhiF2woKvdB1hqe6rhbSYY20xlwADso,13265
2
+ charlie_agents-0.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
3
+ charlie_agents-0.3.0.dist-info/entry_points.txt,sha256=7GES4V3WqwQoNd4KPMq3reJVC-yfFtGu8MvUg3m27RA,44
4
+ charlie_agents-0.3.0.dist-info/licenses/LICENSE,sha256=znXDfTnwndAmN7Jl40VES70qcWOpcWk4K9qaPpSqZz8,1078
5
+ charlie_agents-0.3.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ charlie = charlie.cli:app
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Charlie Contributors
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.
22
+