agentfiles 0.3.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.
- agentfiles-0.3.0/LICENSE +21 -0
- agentfiles-0.3.0/PKG-INFO +384 -0
- agentfiles-0.3.0/README.md +350 -0
- agentfiles-0.3.0/pyproject.toml +85 -0
- agentfiles-0.3.0/setup.cfg +4 -0
- agentfiles-0.3.0/src/agentfiles/__init__.py +192 -0
- agentfiles-0.3.0/src/agentfiles/__main__.py +7 -0
- agentfiles-0.3.0/src/agentfiles/cli.py +2534 -0
- agentfiles-0.3.0/src/agentfiles/cli_format.py +212 -0
- agentfiles-0.3.0/src/agentfiles/completion.py +286 -0
- agentfiles-0.3.0/src/agentfiles/config.py +505 -0
- agentfiles-0.3.0/src/agentfiles/differ.py +426 -0
- agentfiles-0.3.0/src/agentfiles/doctor.py +301 -0
- agentfiles-0.3.0/src/agentfiles/engine.py +1377 -0
- agentfiles-0.3.0/src/agentfiles/frontmatter.py +317 -0
- agentfiles-0.3.0/src/agentfiles/git.py +776 -0
- agentfiles-0.3.0/src/agentfiles/interactive.py +1204 -0
- agentfiles-0.3.0/src/agentfiles/models.py +1084 -0
- agentfiles-0.3.0/src/agentfiles/output.py +826 -0
- agentfiles-0.3.0/src/agentfiles/paths.py +209 -0
- agentfiles-0.3.0/src/agentfiles/py.typed +0 -0
- agentfiles-0.3.0/src/agentfiles/scanner.py +1126 -0
- agentfiles-0.3.0/src/agentfiles/source.py +770 -0
- agentfiles-0.3.0/src/agentfiles/target.py +1248 -0
- agentfiles-0.3.0/src/agentfiles/tokens.py +282 -0
- agentfiles-0.3.0/src/agentfiles.egg-info/PKG-INFO +384 -0
- agentfiles-0.3.0/src/agentfiles.egg-info/SOURCES.txt +60 -0
- agentfiles-0.3.0/src/agentfiles.egg-info/dependency_links.txt +1 -0
- agentfiles-0.3.0/src/agentfiles.egg-info/entry_points.txt +2 -0
- agentfiles-0.3.0/src/agentfiles.egg-info/requires.txt +9 -0
- agentfiles-0.3.0/src/agentfiles.egg-info/top_level.txt +1 -0
- agentfiles-0.3.0/tests/test_clean.py +375 -0
- agentfiles-0.3.0/tests/test_cli_flags.py +624 -0
- agentfiles-0.3.0/tests/test_config.py +999 -0
- agentfiles-0.3.0/tests/test_conflicts.py +387 -0
- agentfiles-0.3.0/tests/test_create_pr.py +222 -0
- agentfiles-0.3.0/tests/test_cursor.py +351 -0
- agentfiles-0.3.0/tests/test_differ.py +1231 -0
- agentfiles-0.3.0/tests/test_doctor.py +314 -0
- agentfiles-0.3.0/tests/test_engine.py +2594 -0
- agentfiles-0.3.0/tests/test_format_json.py +446 -0
- agentfiles-0.3.0/tests/test_frontmatter.py +175 -0
- agentfiles-0.3.0/tests/test_git.py +1561 -0
- agentfiles-0.3.0/tests/test_init.py +945 -0
- agentfiles-0.3.0/tests/test_interactive.py +1202 -0
- agentfiles-0.3.0/tests/test_models.py +1535 -0
- agentfiles-0.3.0/tests/test_new_platforms.py +152 -0
- agentfiles-0.3.0/tests/test_output.py +1622 -0
- agentfiles-0.3.0/tests/test_paths.py +372 -0
- agentfiles-0.3.0/tests/test_platform_groups.py +167 -0
- agentfiles-0.3.0/tests/test_pull.py +343 -0
- agentfiles-0.3.0/tests/test_push.py +371 -0
- agentfiles-0.3.0/tests/test_scanner.py +1865 -0
- agentfiles-0.3.0/tests/test_selective.py +165 -0
- agentfiles-0.3.0/tests/test_shallow_clone.py +280 -0
- agentfiles-0.3.0/tests/test_source.py +1560 -0
- agentfiles-0.3.0/tests/test_sync_state.py +601 -0
- agentfiles-0.3.0/tests/test_target.py +1475 -0
- agentfiles-0.3.0/tests/test_token_estimate.py +654 -0
- agentfiles-0.3.0/tests/test_tokens.py +197 -0
- agentfiles-0.3.0/tests/test_windsurf.py +367 -0
- agentfiles-0.3.0/tests/test_workflow.py +173 -0
agentfiles-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 Aleksei Svetlov (SvetlovTech) <svetlovtech@aabee.tech>
|
|
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,384 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentfiles
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Load AI tool configurations (agents, skills, commands, plugins) across platforms
|
|
5
|
+
Author-email: SvetlovTech <svetlovtech@aabee.tech>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/svetlovtech/agentfiles
|
|
8
|
+
Project-URL: Repository, https://github.com/svetlovtech/agentfiles
|
|
9
|
+
Project-URL: Issues, https://github.com/svetlovtech/agentfiles/issues
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Topic :: Utilities
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: pyyaml>=6.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
29
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
30
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
31
|
+
Requires-Dist: types-PyYAML>=6.0; extra == "dev"
|
|
32
|
+
Requires-Dist: commitizen; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
<h1 align="center">agentfiles</h1>
|
|
36
|
+
|
|
37
|
+
<p align="center">
|
|
38
|
+
<strong>Sync AI tool configurations across platforms</strong>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
<p align="center">
|
|
42
|
+
<a href="https://pypi.org/project/agentfiles/">
|
|
43
|
+
<img src="https://img.shields.io/pypi/v/agentfiles?color=blue&label=pypi" alt="PyPI">
|
|
44
|
+
</a>
|
|
45
|
+
<a href="https://pypi.org/project/agentfiles/">
|
|
46
|
+
<img src="https://img.shields.io/pypi/pyversions/agentfiles" alt="Python Versions">
|
|
47
|
+
</a>
|
|
48
|
+
<a href="https://github.com/svetlovtech/agentfiles/actions">
|
|
49
|
+
<img src="https://img.shields.io/github/actions/workflow/status/svetlovtech/agentfiles/ci.yml?branch=main&label=CI" alt="CI">
|
|
50
|
+
</a>
|
|
51
|
+
<a href="LICENSE">
|
|
52
|
+
<img src="https://img.shields.io/badge/license-MIT-blue" alt="License: MIT">
|
|
53
|
+
</a>
|
|
54
|
+
</p>
|
|
55
|
+
|
|
56
|
+
<p align="center">
|
|
57
|
+
<code>pip install agentfiles</code>
|
|
58
|
+
</p>
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
`agentfiles` is a CLI that keeps your AI coding assistant configurations — agents, skills, commands, and plugins — consistent across multiple platforms. It treats a source repository as the single source of truth and propagates changes to wherever you need them.
|
|
63
|
+
|
|
64
|
+
## Why?
|
|
65
|
+
|
|
66
|
+
You use multiple AI coding tools. Each stores its config in a different place:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
~/.config/opencode/ # OpenCode
|
|
70
|
+
~/.claude/ # Claude Code
|
|
71
|
+
~/.codeium/windsurf/ # Windsurf
|
|
72
|
+
~/.cursor/rules/ # Cursor
|
|
73
|
+
.github/copilot/ # GitHub Copilot
|
|
74
|
+
.aider/ # Aider
|
|
75
|
+
.continue/ # Continue.dev
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`agentfiles` lets you maintain **one repository** and sync everywhere:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
┌─── OpenCode
|
|
82
|
+
├─── Claude Code
|
|
83
|
+
source repo ────────┼─── Windsurf
|
|
84
|
+
(agentfiles pull) ├─── Cursor
|
|
85
|
+
├─── GitHub Copilot
|
|
86
|
+
├─── Aider
|
|
87
|
+
└─── Continue.dev
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Features
|
|
91
|
+
|
|
92
|
+
- **7 platforms** — OpenCode, Claude Code, Windsurf, Cursor + GitHub Copilot, Aider, Continue.dev
|
|
93
|
+
- **6 item types** — agents, skills, commands, plugins, configs, workflows
|
|
94
|
+
- **Bidirectional sync** — pull and push with conflict detection
|
|
95
|
+
- **Surgical filtering** — `--only`, `--except`, `--type`, `--target`, `--item agent/coder`
|
|
96
|
+
- **Platform groups** — define profiles in config (`dev: [claude_code, cursor]`), use with `--target dev`
|
|
97
|
+
- **PR creation** — `push --create-pr` to auto-create a pull request via `gh`
|
|
98
|
+
- **Smart cloning** — shallow clone + sparse checkout for remote sources
|
|
99
|
+
- **Dry-run** — preview changes without applying
|
|
100
|
+
- **Diagnostics** — `doctor`, `verify` (CI drift detection), shell completions
|
|
101
|
+
- **One dependency** — `pyyaml` only
|
|
102
|
+
|
|
103
|
+
## Quick Start
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pip install agentfiles
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Initialize a new repository
|
|
111
|
+
agentfiles init
|
|
112
|
+
|
|
113
|
+
# Pull to all platforms
|
|
114
|
+
agentfiles pull /path/to/source-repo
|
|
115
|
+
|
|
116
|
+
# Pull only agents to OpenCode
|
|
117
|
+
agentfiles pull --target opencode --type agent
|
|
118
|
+
|
|
119
|
+
# Preview without applying
|
|
120
|
+
agentfiles pull --dry-run
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Commands
|
|
124
|
+
|
|
125
|
+
| Command | Description |
|
|
126
|
+
|---------|-------------|
|
|
127
|
+
| [`pull`](#pull) | Install/update items from source to local configs |
|
|
128
|
+
| [`push`](#push) | Push local items back to source (with conflict detection) |
|
|
129
|
+
| [`status`](#status) | Show installed items per platform (`--list`, `--diff`) |
|
|
130
|
+
| [`clean`](#clean) | Remove orphaned items |
|
|
131
|
+
| [`init`](#init) | Scaffold a new repository |
|
|
132
|
+
| [`verify`](#verify) | CI-friendly drift detection (exit 1 if drift) |
|
|
133
|
+
| [`doctor`](#doctor) | Run environment diagnostics |
|
|
134
|
+
| [`completion`](#completion) | Generate shell completion scripts |
|
|
135
|
+
|
|
136
|
+
### `pull`
|
|
137
|
+
|
|
138
|
+
Install or update items from a source repository to local platform configs.
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
agentfiles pull # interactive (default)
|
|
142
|
+
agentfiles pull --yes # non-interactive
|
|
143
|
+
agentfiles pull --update # git pull source, then sync
|
|
144
|
+
agentfiles pull --target opencode --type agent # only agents → OpenCode
|
|
145
|
+
agentfiles pull --only coder,solid-principles # specific items
|
|
146
|
+
agentfiles pull --item agent/coder # single item by key
|
|
147
|
+
agentfiles pull --dry-run --verbose # preview with details
|
|
148
|
+
agentfiles pull --symlinks # use symlinks instead of copies
|
|
149
|
+
agentfiles pull --full-clone # disable shallow clone optimization
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### `push`
|
|
153
|
+
|
|
154
|
+
Push locally-installed items back into the source repository. Useful when you've edited configs on one machine and want to propagate.
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
agentfiles push # interactive (with conflict detection)
|
|
158
|
+
agentfiles push --yes # non-interactive (skips conflicts)
|
|
159
|
+
agentfiles push --dry-run # preview
|
|
160
|
+
agentfiles push --target opencode # push only from OpenCode
|
|
161
|
+
agentfiles push --item agent/coder # push a single item
|
|
162
|
+
agentfiles push --create-pr # auto-create PR via gh
|
|
163
|
+
agentfiles push --create-pr --pr-title "Update agents" --pr-branch my-branch
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### `status`
|
|
167
|
+
|
|
168
|
+
Show installed-item counts per discovered platform. Supports two sub-modes via flags:
|
|
169
|
+
|
|
170
|
+
- `--list` — list items available in the source repository
|
|
171
|
+
- `--diff` — compare source vs installed items
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
agentfiles status # show platforms
|
|
175
|
+
agentfiles status --format json # JSON output
|
|
176
|
+
|
|
177
|
+
# --list mode: list source items
|
|
178
|
+
agentfiles status --list # text table
|
|
179
|
+
agentfiles status --list --tokens # include token estimates
|
|
180
|
+
agentfiles status --list --format json # machine-readable
|
|
181
|
+
|
|
182
|
+
# --diff mode: compare source vs installed
|
|
183
|
+
agentfiles status --diff # show differences
|
|
184
|
+
agentfiles status --diff --verbose # content-level diffs
|
|
185
|
+
agentfiles status --diff --target opencode # diff for one platform
|
|
186
|
+
agentfiles status --diff --format json # machine-readable
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### `clean`
|
|
190
|
+
|
|
191
|
+
Remove installed items whose source no longer exists in the repository.
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
agentfiles clean --dry-run # preview
|
|
195
|
+
agentfiles clean --yes # non-interactive
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### `init`
|
|
199
|
+
|
|
200
|
+
Scaffold a new agentfiles repository with `agents/`, `skills/`, `commands/`, `plugins/` directories and a `.agentfiles.yaml` config.
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
agentfiles init # current directory
|
|
204
|
+
agentfiles init /path/to/project # specific directory
|
|
205
|
+
agentfiles init --yes # skip confirmation
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### `verify`
|
|
209
|
+
|
|
210
|
+
CI-friendly drift detection. Compares source vs installed items, exits 0 if in sync, 1 if drift detected.
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
agentfiles verify # human-readable output
|
|
214
|
+
agentfiles verify --format json # machine-readable
|
|
215
|
+
agentfiles verify --quiet # silent, exit code only
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### `doctor`
|
|
219
|
+
|
|
220
|
+
Run environment diagnostics — checks config, source dir, git, platform directories, state file, and tool binaries.
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
agentfiles doctor
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### `completion`
|
|
227
|
+
|
|
228
|
+
Generate shell completion scripts.
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
agentfiles completion bash # bash completions
|
|
232
|
+
agentfiles completion zsh # zsh completions
|
|
233
|
+
agentfiles completion fish # fish completions
|
|
234
|
+
|
|
235
|
+
# Example: add to .bashrc
|
|
236
|
+
eval "$(agentfiles completion bash)"
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Global Options
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
--color {always,auto,never} Color output control (respects NO_COLOR/FORCE_COLOR)
|
|
243
|
+
--verbose, -v Verbose output
|
|
244
|
+
--quiet, -q Quiet mode (errors only)
|
|
245
|
+
--version Show version
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Filter Options
|
|
249
|
+
|
|
250
|
+
Most commands support surgical filtering:
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
--target {platform,group,all} Target platform or group name
|
|
254
|
+
--type {agent,skill,command,plugin,config,workflow,all} Item type
|
|
255
|
+
--only coder,solid-principles Only these items (by name)
|
|
256
|
+
--except old-plugin,deprecated Exclude these items
|
|
257
|
+
--item agent/coder Specific item by type/name key
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Source Repository Structure
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
my-agents/
|
|
264
|
+
├── agents/
|
|
265
|
+
│ ├── coder/
|
|
266
|
+
│ │ └── coder.md # YAML frontmatter + prompt
|
|
267
|
+
│ └── debugger/
|
|
268
|
+
│ └── debugger.md
|
|
269
|
+
├── skills/
|
|
270
|
+
│ ├── solid-principles/
|
|
271
|
+
│ │ ├── SKILL.md
|
|
272
|
+
│ │ └── references/
|
|
273
|
+
│ └── dry-principle/
|
|
274
|
+
│ └── SKILL.md
|
|
275
|
+
├── commands/
|
|
276
|
+
│ └── autopilot/
|
|
277
|
+
│ └── autopilot.md
|
|
278
|
+
├── plugins/
|
|
279
|
+
│ └── patterns.yaml
|
|
280
|
+
├── configs/
|
|
281
|
+
│ └── global-settings.yaml
|
|
282
|
+
├── workflows/
|
|
283
|
+
│ └── deploy-pipeline/
|
|
284
|
+
│ └── workflow.md
|
|
285
|
+
└── .agentfiles.yaml # Config (auto-generated)
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Supported Platforms
|
|
289
|
+
|
|
290
|
+
| Platform | Config path | Agents | Skills | Commands | Plugins | Configs | Workflows |
|
|
291
|
+
|----------|------------|--------|--------|----------|---------|---------|-----------|
|
|
292
|
+
| **OpenCode** | `~/.config/opencode/` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
293
|
+
| **Claude Code** | `~/.claude/` | ✅ | ✅ | ✅ | — | ✅ | ✅ |
|
|
294
|
+
| **Windsurf** | `~/.codeium/windsurf/` | — | ✅ | — | — | — | ✅ |
|
|
295
|
+
| **Cursor** | `~/.cursor/rules/` | — | ✅ | — | — | — | ✅ |
|
|
296
|
+
| **GitHub Copilot** | `.github/copilot/` | ✅ | — | — | — | ✅ | — |
|
|
297
|
+
| **Aider** | `.aider/` | ✅ | — | — | — | ✅ | — |
|
|
298
|
+
| **Continue.dev** | `.continue/` | ✅ | — | ✅ | — | ✅ | — |
|
|
299
|
+
|
|
300
|
+
## Platform Groups
|
|
301
|
+
|
|
302
|
+
Define named groups in `.agentfiles.yaml` to avoid repeating `--target` flags:
|
|
303
|
+
|
|
304
|
+
```yaml
|
|
305
|
+
source: ./
|
|
306
|
+
platform_groups:
|
|
307
|
+
dev: [claude_code, cursor]
|
|
308
|
+
ci: [opencode]
|
|
309
|
+
editors: [copilot, aider, continue]
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
agentfiles pull --target dev # → claude_code + cursor
|
|
314
|
+
agentfiles push --target editors # → copilot + aider + continue
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Architecture
|
|
318
|
+
|
|
319
|
+
```
|
|
320
|
+
┌─────────────────┐ ┌──────────────┐ ┌──────────────┐
|
|
321
|
+
│ Source Resolution│───▶│ Scanner │───▶│ Differ │
|
|
322
|
+
│ (source.py) │ │ (scanner.py) │ │ (differ.py) │
|
|
323
|
+
└─────────────────┘ └──────────────┘ └──────────────┘
|
|
324
|
+
│
|
|
325
|
+
▼
|
|
326
|
+
┌──────────────┐
|
|
327
|
+
┌──────────────┐ ┌──────────────┐ │ Engine │
|
|
328
|
+
│ SyncReport │◀──│ SyncResult[] │◀────────│ (engine.py) │
|
|
329
|
+
│ │ │ │ │ plan→execute │
|
|
330
|
+
└──────────────┘ └──────────────┘ └──────────────┘
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
| Module | Purpose |
|
|
334
|
+
|--------|---------|
|
|
335
|
+
| `source.py` | Resolve user input → local directory (local dir, git URL, git clone) |
|
|
336
|
+
| `scanner.py` | Walk source dirs → `list[Item]` |
|
|
337
|
+
| `differ.py` | Compare source vs installed: existence → metadata → SHA-256 |
|
|
338
|
+
| `engine.py` | Plan actions (INSTALL/UPDATE/SKIP) → execute → collect results |
|
|
339
|
+
| `target.py` | Discover platforms, manage installed items |
|
|
340
|
+
| `config.py` | YAML config + sync-state persistence |
|
|
341
|
+
| `cli.py` | Argparse CLI with all subcommands |
|
|
342
|
+
|
|
343
|
+
### Extending
|
|
344
|
+
|
|
345
|
+
**Add a new platform:**
|
|
346
|
+
|
|
347
|
+
1. Add `Platform` enum value in `models.py`
|
|
348
|
+
2. Add discovery logic in `target.py` (`_DISCOVERY_TABLE`)
|
|
349
|
+
3. Add alias in `PLATFORM_ALIASES`
|
|
350
|
+
|
|
351
|
+
**Add a new item type:**
|
|
352
|
+
|
|
353
|
+
1. Add `ItemType` enum value in `models.py`
|
|
354
|
+
2. Write a scanner function in `scanner.py`
|
|
355
|
+
3. Register via `_register_scanner()`
|
|
356
|
+
|
|
357
|
+
No other modules need changes (Open/Closed Principle).
|
|
358
|
+
|
|
359
|
+
## Development
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
# Install with dev dependencies
|
|
363
|
+
pip install -e ".[dev]"
|
|
364
|
+
|
|
365
|
+
# Lint & format
|
|
366
|
+
ruff check src/ tests/
|
|
367
|
+
ruff format --check src/ tests/
|
|
368
|
+
|
|
369
|
+
# Type check
|
|
370
|
+
mypy src/
|
|
371
|
+
|
|
372
|
+
# Test
|
|
373
|
+
pytest tests/ -v
|
|
374
|
+
|
|
375
|
+
# Test with coverage
|
|
376
|
+
pytest tests/ -v --cov=agentfiles --cov-report=term-missing
|
|
377
|
+
|
|
378
|
+
# Build package
|
|
379
|
+
python -m build
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
## License
|
|
383
|
+
|
|
384
|
+
[MIT](LICENSE)
|