cocoaskills 0.2.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.
- cocoaskills-0.2.0.dist-info/METADATA +202 -0
- cocoaskills-0.2.0.dist-info/RECORD +28 -0
- cocoaskills-0.2.0.dist-info/WHEEL +5 -0
- cocoaskills-0.2.0.dist-info/entry_points.txt +2 -0
- cocoaskills-0.2.0.dist-info/licenses/LICENSE +201 -0
- cocoaskills-0.2.0.dist-info/top_level.txt +1 -0
- csk/__init__.py +18 -0
- csk/__main__.py +6 -0
- csk/_version.py +24 -0
- csk/adapters.py +120 -0
- csk/cli.py +452 -0
- csk/config.py +197 -0
- csk/env_files.py +26 -0
- csk/gc.py +35 -0
- csk/git_ops.py +111 -0
- csk/gitignore_gate.py +49 -0
- csk/hashing.py +26 -0
- csk/installer.py +314 -0
- csk/locale.py +105 -0
- csk/locking.py +64 -0
- csk/manifest.py +140 -0
- csk/project_resolver.py +108 -0
- csk/shell_init.py +77 -0
- csk/shims.py +77 -0
- csk/skillspec.py +126 -0
- csk/snapshot.py +32 -0
- csk/status.py +84 -0
- csk/whitelist.py +98 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cocoaskills
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Local skill manager for AI agent skills with reproducible per-project installs
|
|
5
|
+
Author-email: Ivan Oparin <oparin@me.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/ivanopcode/cocoaskills
|
|
8
|
+
Project-URL: Source, https://github.com/ivanopcode/cocoaskills
|
|
9
|
+
Project-URL: Issues, https://github.com/ivanopcode/cocoaskills/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/ivanopcode/cocoaskills/blob/main/CHANGELOG.md
|
|
11
|
+
Project-URL: Documentation, https://github.com/ivanopcode/cocoaskills/blob/main/docs/mvp-design.md
|
|
12
|
+
Keywords: skills,ai-agents,claude-code,cursor,codex,gemini,dependency-manager
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: MacOS
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Software Development
|
|
24
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
25
|
+
Classifier: Topic :: System :: Software Distribution
|
|
26
|
+
Requires-Python: >=3.11
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=9; extra == "dev"
|
|
31
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
32
|
+
Requires-Dist: twine>=5; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# CocoaSkill
|
|
36
|
+
|
|
37
|
+
[](https://pypi.org/project/cocoaskills/)
|
|
38
|
+
[](https://pypi.org/project/cocoaskills/)
|
|
39
|
+
[](https://github.com/ivanopcode/cocoaskills/blob/main/LICENSE)
|
|
40
|
+
[](https://github.com/ivanopcode/cocoaskills/actions/workflows/ci.yml)
|
|
41
|
+
|
|
42
|
+
`csk` is a local skill manager for AI agent skills. It installs reusable skill
|
|
43
|
+
packages from local git repositories into your project repositories with
|
|
44
|
+
reproducible, content-hashed installs and multi-agent adapter support
|
|
45
|
+
(Claude Code, Codex CLI, Cursor, Gemini).
|
|
46
|
+
|
|
47
|
+
The MVP design contract is frozen in [docs/mvp-design.md](docs/mvp-design.md).
|
|
48
|
+
|
|
49
|
+
## Why
|
|
50
|
+
|
|
51
|
+
Agent skills are useful, but managing them across many projects by hand falls
|
|
52
|
+
apart fast: drift between machines, no version pinning, README files and tests
|
|
53
|
+
leaking into the agent context, no cleanup when a skill is removed.
|
|
54
|
+
|
|
55
|
+
CocoaSkill makes per-project skill installation declarative and reproducible:
|
|
56
|
+
|
|
57
|
+
- One `Skillfile.json` per project, committed to version control.
|
|
58
|
+
- Pinned git refs (tag / branch / revision) and content-hashed installs.
|
|
59
|
+
- A whitelist-based stripped layout — README, tests, build files, and other
|
|
60
|
+
non-skill content stay out of the agent's context.
|
|
61
|
+
- One canonical location (`.agents/skills/`) with per-agent adapter symlinks
|
|
62
|
+
or copies into `.claude/skills/`, `.codex/skills/`, `.cursor/rules/`,
|
|
63
|
+
`.gemini/skills/`.
|
|
64
|
+
- Skill-provided command shims exposed via a project-local `.agents/bin/`
|
|
65
|
+
directory on `PATH`.
|
|
66
|
+
|
|
67
|
+
## Install
|
|
68
|
+
|
|
69
|
+
Pick whichever fits your machine. `pipx` is the recommended path on every
|
|
70
|
+
platform.
|
|
71
|
+
|
|
72
|
+
### pipx (recommended)
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pipx install cocoaskills
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### uv tool
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
uv tool install cocoaskills
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Homebrew (macOS, Linux)
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
brew tap ivanopcode/csk
|
|
88
|
+
brew install cocoaskills
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### mise
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
mise use -g pipx:cocoaskills@latest
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Convenience install script
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
curl -fsSL https://cocoaskills.org/install.sh | sh
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The script detects Python, prefers `pipx` or `uv tool`, and falls back to
|
|
104
|
+
`pip install --user`. Read it before piping if you do not trust the network.
|
|
105
|
+
|
|
106
|
+
### Plain pip
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
python -m pip install --user cocoaskills
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Quick start
|
|
113
|
+
|
|
114
|
+
1. Pick or create a directory of cloned skill git repositories. Example:
|
|
115
|
+
`~/agents/skills/`.
|
|
116
|
+
|
|
117
|
+
2. Bootstrap the global config:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
csk bootstrap
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
This writes `~/.cocoaskills/config.json` with your `skills_root`, preferred
|
|
124
|
+
locale, default agents, and a list of managed projects.
|
|
125
|
+
|
|
126
|
+
3. In each managed project, declare which skills you want:
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"schema_version": 1,
|
|
131
|
+
"project": { "alias": "partners-ios" },
|
|
132
|
+
"agents": ["claude_code", "codex_cli", "cursor"],
|
|
133
|
+
"locale": "en",
|
|
134
|
+
"skills": [
|
|
135
|
+
{ "name": "skill-youtrack", "tag": "v1.0.0" },
|
|
136
|
+
{ "name": "skill-grafana", "branch": "main" }
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
4. Run `csk install .` inside a checkout, or `csk install` from anywhere to
|
|
142
|
+
install every configured project.
|
|
143
|
+
|
|
144
|
+
## CLI
|
|
145
|
+
|
|
146
|
+
| Command | Behavior |
|
|
147
|
+
|---|---|
|
|
148
|
+
| `csk bootstrap` | Interactively create the global config. |
|
|
149
|
+
| `csk install [target]` | Apply `Skillfile.json` using current local git refs. Does not fetch. `target` may be an alias, `.`, or a project path. |
|
|
150
|
+
| `csk update` | Fetch all git repositories under `skills_root`. Does not modify projects. |
|
|
151
|
+
| `csk upgrade [target]` | Run `update`, then `install`. |
|
|
152
|
+
| `csk status [target]` | Show manifest vs installed state. Supports `csk status .` without saving config. |
|
|
153
|
+
| `csk list [--paths]` | List configured projects and declared skills. |
|
|
154
|
+
| `csk project add <alias> <path>` | Register a project and create an empty manifest. |
|
|
155
|
+
| `csk project resolve [target]` | Show resolved project alias, checkout alias, Skillfile, and install paths. |
|
|
156
|
+
| `csk config show` | Print resolved config path and contents. |
|
|
157
|
+
| `csk shell-init [zsh\|bash\|powershell]` | Print shell hook code for auto-`PATH` activation. |
|
|
158
|
+
| `csk --version` | Print version and exit. |
|
|
159
|
+
|
|
160
|
+
Flags shared by `install` and `upgrade`:
|
|
161
|
+
|
|
162
|
+
- `--dry-run` — plan work without modifying files.
|
|
163
|
+
- `--verbose` — print detailed progress.
|
|
164
|
+
- `--fix-gitignore` — append the managed CocoaSkill block to `.gitignore`.
|
|
165
|
+
- `--strict-tags` — fail if a tag was locally moved to another commit.
|
|
166
|
+
|
|
167
|
+
Exit codes: `0` success, `1` one or more projects or skills failed, `2`
|
|
168
|
+
configuration error, `3` lock contention.
|
|
169
|
+
|
|
170
|
+
## Development
|
|
171
|
+
|
|
172
|
+
Requires Python 3.11+.
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
git clone https://github.com/ivanopcode/cocoaskills.git
|
|
176
|
+
cd cocoaskills
|
|
177
|
+
python -m venv .venv
|
|
178
|
+
source .venv/bin/activate
|
|
179
|
+
python -m pip install -e ".[dev]"
|
|
180
|
+
pytest
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Build artifacts locally:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
python -m build
|
|
187
|
+
twine check dist/*
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
The runtime package is stdlib-only. Versioning is driven by `setuptools-scm`
|
|
191
|
+
from git tags; the generated `src/csk/_version.py` is not committed.
|
|
192
|
+
|
|
193
|
+
## Documentation
|
|
194
|
+
|
|
195
|
+
- [MVP design specification](docs/mvp-design.md) — frozen contract for v0.1
|
|
196
|
+
covering manifests, refs, install pipeline, locking, adapters, security
|
|
197
|
+
boundary, and test surface.
|
|
198
|
+
- [CHANGELOG](CHANGELOG.md) — release history in Keep a Changelog format.
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
Apache-2.0. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
cocoaskills-0.2.0.dist-info/licenses/LICENSE,sha256=C-cbKHphlzHuRwhFpb2jWavRYm1cvjvkIpdE9UF-kqI,11283
|
|
2
|
+
csk/__init__.py,sha256=uFmzuddQVmcni06kLUCcSDdcMOeGhN108nOtRey6VpA,520
|
|
3
|
+
csk/__main__.py,sha256=LN0j1PXNbDs-TLaQrRbVYGN3Z7nKWyo88Sn8wKXryCs,81
|
|
4
|
+
csk/_version.py,sha256=s9U3X54Pdr-Jlh9GP6LBaa_VRos7qs_wtrVefUHHNIA,520
|
|
5
|
+
csk/adapters.py,sha256=6-cwRZDzY3dK2F9q7NaBTngDoL14PS7ffqRJe6TypCo,3845
|
|
6
|
+
csk/cli.py,sha256=pHI70TWtlcqPvYpEBrZaAGict7nYPKdZeeNaRRsSD9E,18315
|
|
7
|
+
csk/config.py,sha256=OtrB_kkBEgvd99bouSudXdaFQ1S12h7msfJ8hGmvCuc,7560
|
|
8
|
+
csk/env_files.py,sha256=6X5g2H8KgYkZWrYORJ6sXwkoV0RIEmPU1ddE9JlB-DE,939
|
|
9
|
+
csk/gc.py,sha256=P1HfyWsaaEJgV6lcCQEYEXuymQ9XJL_XynQyqZP0Zdg,1163
|
|
10
|
+
csk/git_ops.py,sha256=JbEw9h4gS0VougayJlg5kYBLhk21bwcs-98ULC3UMq8,3701
|
|
11
|
+
csk/gitignore_gate.py,sha256=CNbP7ixhqPrERYnDWprcD_xaGGbnENVfeKdTVI_TfEU,1542
|
|
12
|
+
csk/hashing.py,sha256=bD51JJ5ZTjQizAJgRupH5dMZlZfMCb_51b1TMhgab9o,838
|
|
13
|
+
csk/installer.py,sha256=cq_HeOdmni8v-9QutkDmeecHYUWTolUh012jhQvN9xw,11751
|
|
14
|
+
csk/locale.py,sha256=O23Fm1f1eRLjX-RG75HK7xmcLzZIdKy5wIKoWRVPD68,3848
|
|
15
|
+
csk/locking.py,sha256=EzvFghTYt1w8D5hBkxIMnXM2nf0kjtrPPSuEKmNp0Wk,1887
|
|
16
|
+
csk/manifest.py,sha256=RF3VKW8MC1Oi5a6hprXW0ybeviFbB6QZUizx4xmSsC8,4577
|
|
17
|
+
csk/project_resolver.py,sha256=EmW_-IXQ-k4dmXaAmlrlcANoMvWwn3Yvw6By3z3ssCI,3339
|
|
18
|
+
csk/shell_init.py,sha256=4hexBlst64723OqIDJO69XRRmaU_FShFO43nR6uuo-8,1987
|
|
19
|
+
csk/shims.py,sha256=qYVxX--hyHCDZiiJbiPg-eurGC6aln8XXtEKsq_iBiE,2742
|
|
20
|
+
csk/skillspec.py,sha256=i48kO9OKQAqDoLtbyC0SmeSElKGXJCFjZFL9m4mu1M8,4823
|
|
21
|
+
csk/snapshot.py,sha256=sUVT1Kmoy9Uf5lefVtb5xEYCPPBmqu7XNfDhN2cUIFc,804
|
|
22
|
+
csk/status.py,sha256=iTmMEC932MwawejvSPgPoSlwbzBr_8Vz-mUhlcDgWBU,3463
|
|
23
|
+
csk/whitelist.py,sha256=AxdMAOsUCQr9rBofUZrkyIdvhTitxONRjDLGWXHagv0,2263
|
|
24
|
+
cocoaskills-0.2.0.dist-info/METADATA,sha256=lUMLmKA-ZZZb8j3JIQi6BUnqP91KTIf-ZYTAAYwfJBU,6898
|
|
25
|
+
cocoaskills-0.2.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
26
|
+
cocoaskills-0.2.0.dist-info/entry_points.txt,sha256=Kkx9YYsPmZAHs9vAsGb7GZY3scstmigkTnmGQTyVYc4,37
|
|
27
|
+
cocoaskills-0.2.0.dist-info/top_level.txt,sha256=TThFRCugnfsg8GCq8L_wxlRkXiIpC9lBlybuQY4pH9c,4
|
|
28
|
+
cocoaskills-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Support. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or support.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Ivan Oparin
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
csk
|
csk/__init__.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""CocoaSkill local skill manager package."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from importlib.metadata import PackageNotFoundError, version as _metadata_version
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def _resolve_version() -> str:
|
|
8
|
+
try:
|
|
9
|
+
return _metadata_version("cocoaskills")
|
|
10
|
+
except PackageNotFoundError:
|
|
11
|
+
try:
|
|
12
|
+
from ._version import __version__ as scm_version # type: ignore[import-not-found]
|
|
13
|
+
except ImportError:
|
|
14
|
+
return "0.0.0+unknown"
|
|
15
|
+
return scm_version
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
__version__ = _resolve_version()
|
csk/__main__.py
ADDED
csk/_version.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '0.2.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 2, 0)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = None
|
csk/adapters.py
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import json
|
|
5
|
+
import shutil
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
AGENT_PATHS = {
|
|
10
|
+
"codex_cli": ".codex/skills",
|
|
11
|
+
"claude_code": ".claude/skills",
|
|
12
|
+
"gemini": ".gemini/skills",
|
|
13
|
+
"cursor": ".cursor/rules",
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class AdapterError(Exception):
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
MANAGED_FILE = ".csk-managed.json"
|
|
22
|
+
SCHEMA_VERSION = 1
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def required_gitignore_entries(agents: list[str]) -> list[str]:
|
|
26
|
+
entries = [".agents/"]
|
|
27
|
+
for agent in agents:
|
|
28
|
+
rel = AGENT_PATHS.get(agent)
|
|
29
|
+
if rel:
|
|
30
|
+
entries.append(rel + "/")
|
|
31
|
+
return sorted(set(entries))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def refresh_adapters(project_root: Path, agents: list[str], skill_names: list[str], mode: str) -> None:
|
|
35
|
+
canonical_root = project_root / ".agents" / "skills"
|
|
36
|
+
for agent in agents:
|
|
37
|
+
rel = AGENT_PATHS.get(agent)
|
|
38
|
+
if not rel:
|
|
39
|
+
continue
|
|
40
|
+
adapter_root = project_root / rel
|
|
41
|
+
adapter_root.mkdir(parents=True, exist_ok=True)
|
|
42
|
+
expected = set(skill_names)
|
|
43
|
+
managed = _read_managed(adapter_root)
|
|
44
|
+
for name in managed - expected:
|
|
45
|
+
child = adapter_root / name
|
|
46
|
+
if child.exists() or child.is_symlink():
|
|
47
|
+
_remove_path(child)
|
|
48
|
+
for skill_name in skill_names:
|
|
49
|
+
source = canonical_root / skill_name
|
|
50
|
+
target = adapter_root / skill_name
|
|
51
|
+
if not source.exists():
|
|
52
|
+
continue
|
|
53
|
+
if _is_unmanaged_conflict(target, managed, source):
|
|
54
|
+
raise AdapterError(f"Adapter target already exists and is not managed by csk: {target}")
|
|
55
|
+
_refresh_entry(source, target, mode)
|
|
56
|
+
_write_managed(adapter_root, expected)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _refresh_entry(source: Path, target: Path, mode: str) -> None:
|
|
60
|
+
if mode == "copy":
|
|
61
|
+
if target.exists() or target.is_symlink():
|
|
62
|
+
_remove_path(target)
|
|
63
|
+
shutil.copytree(source, target, symlinks=True)
|
|
64
|
+
return
|
|
65
|
+
if mode == "symlink":
|
|
66
|
+
if target.exists() or target.is_symlink():
|
|
67
|
+
_remove_path(target)
|
|
68
|
+
target.symlink_to(os.path.relpath(source, target.parent), target_is_directory=True)
|
|
69
|
+
return
|
|
70
|
+
# auto
|
|
71
|
+
try:
|
|
72
|
+
if target.exists() or target.is_symlink():
|
|
73
|
+
_remove_path(target)
|
|
74
|
+
target.symlink_to(os.path.relpath(source, target.parent), target_is_directory=True)
|
|
75
|
+
except OSError:
|
|
76
|
+
if target.exists() or target.is_symlink():
|
|
77
|
+
_remove_path(target)
|
|
78
|
+
shutil.copytree(source, target, symlinks=True)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _remove_path(path: Path) -> None:
|
|
82
|
+
if path.is_symlink() or path.is_file():
|
|
83
|
+
path.unlink()
|
|
84
|
+
elif path.exists():
|
|
85
|
+
shutil.rmtree(path)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def _read_managed(adapter_root: Path) -> set[str]:
|
|
89
|
+
path = adapter_root / MANAGED_FILE
|
|
90
|
+
if not path.exists():
|
|
91
|
+
return set()
|
|
92
|
+
try:
|
|
93
|
+
data = json.loads(path.read_text(encoding="utf-8"))
|
|
94
|
+
except Exception:
|
|
95
|
+
return set()
|
|
96
|
+
if not isinstance(data, dict) or data.get("schema_version") != SCHEMA_VERSION:
|
|
97
|
+
return set()
|
|
98
|
+
entries = data.get("entries", [])
|
|
99
|
+
if not isinstance(entries, list):
|
|
100
|
+
return set()
|
|
101
|
+
return {entry for entry in entries if isinstance(entry, str)}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def _write_managed(adapter_root: Path, entries: set[str]) -> None:
|
|
105
|
+
path = adapter_root / MANAGED_FILE
|
|
106
|
+
data = {"schema_version": SCHEMA_VERSION, "entries": sorted(entries)}
|
|
107
|
+
path.write_text(json.dumps(data, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def _is_unmanaged_conflict(target: Path, managed: set[str], source: Path) -> bool:
|
|
111
|
+
if not target.exists() and not target.is_symlink():
|
|
112
|
+
return False
|
|
113
|
+
if target.name in managed:
|
|
114
|
+
return False
|
|
115
|
+
if target.is_symlink():
|
|
116
|
+
try:
|
|
117
|
+
return target.resolve() != source.resolve()
|
|
118
|
+
except OSError:
|
|
119
|
+
return True
|
|
120
|
+
return not (target / ".csk-install.json").exists()
|