agents_skill_vault 0.1.0
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.
- checksums.yaml +7 -0
- data/AGENTS.md +93 -0
- data/CHANGELOG.md +21 -0
- data/CLAUDE.md +1 -0
- data/CODE_OF_CONDUCT.md +10 -0
- data/CONTRIBUTING.md +64 -0
- data/LICENSE +201 -0
- data/README.md +268 -0
- data/Rakefile +12 -0
- data/lib/agents_skill_vault/errors/base.rb +7 -0
- data/lib/agents_skill_vault/errors/duplicate_label.rb +9 -0
- data/lib/agents_skill_vault/errors/git_not_installed.rb +9 -0
- data/lib/agents_skill_vault/errors/git_version.rb +9 -0
- data/lib/agents_skill_vault/errors/invalid_url.rb +9 -0
- data/lib/agents_skill_vault/errors/not_found.rb +9 -0
- data/lib/agents_skill_vault/errors.rb +6 -0
- data/lib/agents_skill_vault/git_operations.rb +148 -0
- data/lib/agents_skill_vault/manifest.rb +138 -0
- data/lib/agents_skill_vault/resource.rb +235 -0
- data/lib/agents_skill_vault/skill_scanner.rb +74 -0
- data/lib/agents_skill_vault/skill_validator.rb +201 -0
- data/lib/agents_skill_vault/sync_result.rb +44 -0
- data/lib/agents_skill_vault/url_parser.rb +207 -0
- data/lib/agents_skill_vault/vault.rb +789 -0
- data/lib/agents_skill_vault/version.rb +5 -0
- data/lib/agents_skill_vault.rb +8 -0
- data/scripts/manual_test.rb +174 -0
- data/sig/agents_skill_vault.rbs +4 -0
- metadata +115 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: b05e0650894ce571b50930b4aac065e83d6581483a0598f16e013438b6072b90
|
|
4
|
+
data.tar.gz: d4eb75579062ff3f3b40b3c4a86afc73a5ff09a032507c4197ee84719eb328c4
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 83157f20b44848507c3704957254d7fa7498054aeafdfdff1c3d1e59f465f2e2bee67b3c9b4f9aa35b2723e56331479695b5ac936378ea21ca9303ef14693d33
|
|
7
|
+
data.tar.gz: 4735da42f45aebb580afd1cb9cd205bf09260b6e80e8196f8afb5d9626edd2004a2c6c3397efe55763b2847719b556d7ecf8acc0c003baaddc3c27ae933f2b31
|
data/AGENTS.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# AgentsSkillVault
|
|
2
|
+
|
|
3
|
+
A Ruby gem for managing a local vault of GitHub resources (repositories, folders, or files). Supports sparse checkout, sync management, and skill validation.
|
|
4
|
+
|
|
5
|
+
## Quick Reference
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Run tests
|
|
9
|
+
bundle exec rake test
|
|
10
|
+
|
|
11
|
+
# Run linter
|
|
12
|
+
bundle exec rake rubocop
|
|
13
|
+
|
|
14
|
+
# Run both (default task)
|
|
15
|
+
bundle exec rake
|
|
16
|
+
|
|
17
|
+
# Interactive console
|
|
18
|
+
bin/console
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Architecture
|
|
22
|
+
|
|
23
|
+
### Core Components
|
|
24
|
+
|
|
25
|
+
- **Vault** (`lib/agents_skill_vault/vault.rb`) - Main interface for managing resources. Handles add, sync, remove, validate operations.
|
|
26
|
+
- **UrlParser** (`lib/agents_skill_vault/url_parser.rb`) - Parses GitHub URLs into components (username, repo, branch, path, type).
|
|
27
|
+
- **GitOperations** (`lib/agents_skill_vault/git_operations.rb`) - Git commands wrapper for clone, sparse checkout, pull.
|
|
28
|
+
- **Resource** (`lib/agents_skill_vault/resource.rb`) - Data object representing a tracked resource.
|
|
29
|
+
- **Manifest** (`lib/agents_skill_vault/manifest.rb`) - JSON manifest persistence for tracking resources.
|
|
30
|
+
- **SkillScanner** (`lib/agents_skill_vault/skill_scanner.rb`) - Scans directories for SKILL.md files.
|
|
31
|
+
- **SkillValidator** (`lib/agents_skill_vault/skill_validator.rb`) - Validates SKILL.md file structure.
|
|
32
|
+
- **SyncResult** (`lib/agents_skill_vault/sync_result.rb`) - Result object for sync operations.
|
|
33
|
+
- **Errors** (`lib/agents_skill_vault/errors/`) - Custom error classes.
|
|
34
|
+
|
|
35
|
+
### Key Patterns
|
|
36
|
+
|
|
37
|
+
**Label Format**: Labels follow `username/repo/skill_name` format for skills and folders, `username/repo` for repositories.
|
|
38
|
+
|
|
39
|
+
**Storage Structure**: Resources are stored at `<VAULT>/username/repo/relative_path`.
|
|
40
|
+
|
|
41
|
+
**URL Types**:
|
|
42
|
+
- `:repo` - Full repository (`https://github.com/user/repo`)
|
|
43
|
+
- `:folder` - Directory via tree (`https://github.com/user/repo/tree/main/path`)
|
|
44
|
+
- `:file` - File via blob (`https://github.com/user/repo/blob/main/path/SKILL.md`)
|
|
45
|
+
|
|
46
|
+
**Autoloading**: Uses Zeitwerk for autoloading. File names must match class names (snake_case to CamelCase).
|
|
47
|
+
|
|
48
|
+
## Testing
|
|
49
|
+
|
|
50
|
+
- **Framework**: Minitest
|
|
51
|
+
- **Mocking**: Mocha (`mocha/minitest`)
|
|
52
|
+
- **Test files**: `test/*_test.rb`
|
|
53
|
+
- **Helper**: `test/test_helper.rb` provides `TestHelper.temp_vault_path` for temp directories
|
|
54
|
+
|
|
55
|
+
### Test Conventions
|
|
56
|
+
|
|
57
|
+
```ruby
|
|
58
|
+
class MyClassTest < Minitest::Test
|
|
59
|
+
def setup
|
|
60
|
+
@storage_path = TestHelper.temp_vault_path
|
|
61
|
+
FileUtils.mkdir_p(@storage_path)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def teardown
|
|
65
|
+
FileUtils.rm_rf(@storage_path)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def test_something
|
|
69
|
+
# Use stubs for GitOperations to avoid real git calls
|
|
70
|
+
AgentsSkillVault::GitOperations.stubs(:clone_repo)
|
|
71
|
+
AgentsSkillVault::GitOperations.stubs(:sparse_checkout)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Code Style
|
|
77
|
+
|
|
78
|
+
- Ruby 3.4+ required
|
|
79
|
+
- Double quotes for strings (configured in `.rubocop.yml`)
|
|
80
|
+
- `frozen_string_literal: true` in all Ruby files
|
|
81
|
+
- YARD-style documentation for public methods
|
|
82
|
+
- Max method length: 20 lines
|
|
83
|
+
- Max class length: 150 lines
|
|
84
|
+
|
|
85
|
+
## Dependencies
|
|
86
|
+
|
|
87
|
+
- `addressable` - URL parsing with proper encoding
|
|
88
|
+
- `zeitwerk` - Autoloading
|
|
89
|
+
- `mocha` - Test mocking (development)
|
|
90
|
+
|
|
91
|
+
## Git Requirements
|
|
92
|
+
|
|
93
|
+
Requires Git 2.25.0+ for sparse checkout support. The gem validates git availability on Vault initialization.
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
## [Unreleased]
|
|
2
|
+
|
|
3
|
+
## [0.1.0] - 2026-01-25
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- Add GitHub repositories, folders, or individual files to a local vault
|
|
8
|
+
- Sync resources to pull latest changes from remote repositories
|
|
9
|
+
- Remove tracked resources from the vault
|
|
10
|
+
- Sparse checkout support for efficient partial repository cloning
|
|
11
|
+
- JSON manifest persistence for tracking resources
|
|
12
|
+
- Skill validation for SKILL.md files
|
|
13
|
+
- GitHub URL parsing supporting repositories, tree/folder, and blob/file URLs
|
|
14
|
+
- Git operations abstraction (clone, sparse checkout, pull)
|
|
15
|
+
- Resource labeling with username/repo/skill_name format
|
|
16
|
+
|
|
17
|
+
### Supported URL Types
|
|
18
|
+
|
|
19
|
+
- Repository: `https://github.com/user/repo`
|
|
20
|
+
- Folder: `https://github.com/user/repo/tree/main/path/to/folder`
|
|
21
|
+
- File: `https://github.com/user/repo/blob/main/path/to/file.md`
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Read AGENTS.md file
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
"agents_skill_vault" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
|
|
4
|
+
|
|
5
|
+
* Participants will be tolerant of opposing views.
|
|
6
|
+
* Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
|
|
7
|
+
* When interpreting the words and actions of others, participants should always assume good intentions.
|
|
8
|
+
* Behaviour which can be reasonably considered harassment will not be tolerated.
|
|
9
|
+
|
|
10
|
+
If you have any concerns about behaviour within this project, please contact us at ["lucianghinda@users.noreply.github.com"](mailto:"lucianghinda@users.noreply.github.com").
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/lucianghinda/agents_skill_vault.
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
1. Clone the repository
|
|
8
|
+
2. Install dependencies: `bundle install`
|
|
9
|
+
|
|
10
|
+
## Running Tests
|
|
11
|
+
|
|
12
|
+
Run the full test suite:
|
|
13
|
+
```bash
|
|
14
|
+
bundle exec rake
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Run specific tests:
|
|
18
|
+
```bash
|
|
19
|
+
bundle exec ruby -Ilib:test test/some_test.rb
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Code Style
|
|
23
|
+
|
|
24
|
+
Run RuboCop to check code style:
|
|
25
|
+
```bash
|
|
26
|
+
bundle exec rake rubocop
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Auto-fix style issues:
|
|
30
|
+
```bash
|
|
31
|
+
bundle exec rubocop -a
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Development Workflow
|
|
35
|
+
|
|
36
|
+
1. Create a new branch for your feature or bugfix
|
|
37
|
+
2. Write tests for your changes
|
|
38
|
+
3. Make your changes
|
|
39
|
+
4. Run `bundle exec rake` to ensure tests pass and code style is correct
|
|
40
|
+
5. Commit your changes with a clear message
|
|
41
|
+
6. Push to your fork and submit a pull request
|
|
42
|
+
|
|
43
|
+
## Code Style Guidelines
|
|
44
|
+
|
|
45
|
+
- Follow Ruby style as configured in `.rubocop.yml`
|
|
46
|
+
- Use double quotes for strings
|
|
47
|
+
- Include `frozen_string_literal: true` in all Ruby files
|
|
48
|
+
- Max method length: 20 lines
|
|
49
|
+
- Max class length: 150 lines
|
|
50
|
+
- Write YARD-style documentation for public methods
|
|
51
|
+
|
|
52
|
+
## Architecture
|
|
53
|
+
|
|
54
|
+
The codebase is organized into several core components:
|
|
55
|
+
|
|
56
|
+
- `Vault` - Main interface for managing resources
|
|
57
|
+
- `UrlParser` - Parses GitHub URLs into components
|
|
58
|
+
- `GitOperations` - Git commands wrapper
|
|
59
|
+
- `Resource` - Data object representing a tracked resource
|
|
60
|
+
- `Manifest` - JSON manifest persistence
|
|
61
|
+
- `SkillScanner` - Scans directories for SKILL.md files
|
|
62
|
+
- `SkillValidator` - Validates SKILL.md file structure
|
|
63
|
+
|
|
64
|
+
See `AGENTS.md` for more detailed architecture documentation.
|
data/LICENSE
ADDED
|
@@ -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 reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and 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 Additional Liability. 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 additional liability.
|
|
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 [yyyy] [name of copyright owner]
|
|
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.
|
data/README.md
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# AgentsSkillVault
|
|
2
|
+
|
|
3
|
+
A Ruby gem for managing a local vault of GitHub resources that contains Agent Skill specifications.
|
|
4
|
+
Clone entire repositories or specific folders, keep them synced, and query them by username or repository name.
|
|
5
|
+
|
|
6
|
+
Currently works only with Github. Future plans will include to support any Git based repository.
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
AgentsSkillVault helps you maintain a local collection of GitHub resources (repositories, folders, or files) with:
|
|
11
|
+
|
|
12
|
+
- **Easy addition** - Add resources via GitHub URL
|
|
13
|
+
- **Sparse checkout** - Clone only the folders you need, not entire repos
|
|
14
|
+
- **Sync management** - Pull latest changes with one command
|
|
15
|
+
- **Querying** - Filter resources by username or repository name
|
|
16
|
+
- **Manifest tracking** - All resources tracked in a JSON manifest for portability
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
Add this line to your application's Gemfile:
|
|
21
|
+
|
|
22
|
+
```ruby
|
|
23
|
+
gem "agents_skill_vault"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
And then execute:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
bundle install
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Or install it yourself:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
gem install agents_skill_vault
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Requirements:**
|
|
39
|
+
- Ruby 3.4+
|
|
40
|
+
- Git 2.25.0+ (for sparse checkout support)
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
```ruby
|
|
45
|
+
require "agents_skill_vault"
|
|
46
|
+
|
|
47
|
+
# Create a vault in a directory
|
|
48
|
+
vault = AgentsSkillVault::Vault.new(storage_path: "~/.my_vault")
|
|
49
|
+
|
|
50
|
+
# Add a full repository
|
|
51
|
+
vault.add("https://github.com/rails/rails")
|
|
52
|
+
|
|
53
|
+
# Add a specific folder with a custom label
|
|
54
|
+
vault.add(
|
|
55
|
+
"https://github.com/user/dotfiles/tree/main/.claude/skills/deep-research",
|
|
56
|
+
label: "deep-research"
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# List all resources
|
|
60
|
+
vault.list.each do |resource|
|
|
61
|
+
puts "#{resource.label} -> #{resource.local_path}"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Sync a specific resource
|
|
65
|
+
result = vault.sync("rails/rails")
|
|
66
|
+
puts "Synced!" if result.success?
|
|
67
|
+
|
|
68
|
+
# Sync all resources
|
|
69
|
+
vault.sync_all
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## API Reference
|
|
73
|
+
|
|
74
|
+
### Vault
|
|
75
|
+
|
|
76
|
+
The main interface for managing resources.
|
|
77
|
+
|
|
78
|
+
#### Creating a Vault
|
|
79
|
+
|
|
80
|
+
```ruby
|
|
81
|
+
vault = AgentsSkillVault::Vault.new(storage_path: "/path/to/vault")
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### Adding Resources
|
|
85
|
+
|
|
86
|
+
```ruby
|
|
87
|
+
# Add a repository (auto-generates label: "username/repo")
|
|
88
|
+
vault.add("https://github.com/user/repo")
|
|
89
|
+
|
|
90
|
+
# Add with custom label
|
|
91
|
+
vault.add("https://github.com/user/repo", label: "my-custom-label")
|
|
92
|
+
|
|
93
|
+
# Add a specific folder (uses sparse checkout)
|
|
94
|
+
vault.add("https://github.com/user/repo/tree/main/lib/skills")
|
|
95
|
+
|
|
96
|
+
# Add a specific file
|
|
97
|
+
vault.add("https://github.com/user/repo/blob/main/config.yml")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
#### Querying Resources
|
|
101
|
+
|
|
102
|
+
```ruby
|
|
103
|
+
# List all resources
|
|
104
|
+
resources = vault.list
|
|
105
|
+
|
|
106
|
+
# Find by label (returns nil if not found)
|
|
107
|
+
resource = vault.find_by_label("user/repo")
|
|
108
|
+
|
|
109
|
+
# Fetch by label (raises Errors::NotFound if not found)
|
|
110
|
+
resource = vault.fetch("user/repo")
|
|
111
|
+
|
|
112
|
+
# Filter by GitHub username
|
|
113
|
+
vault.filter_by_username("octocat") # => [Resource, ...]
|
|
114
|
+
|
|
115
|
+
# Filter by repository name
|
|
116
|
+
vault.filter_by_repo("dotfiles") # => [Resource, ...]
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### Syncing Resources
|
|
120
|
+
|
|
121
|
+
```ruby
|
|
122
|
+
# Sync a single resource
|
|
123
|
+
result = vault.sync("user/repo")
|
|
124
|
+
if result.success?
|
|
125
|
+
puts "Changes: #{result.changes?}"
|
|
126
|
+
else
|
|
127
|
+
puts "Error: #{result.error}"
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Sync all resources
|
|
131
|
+
results = vault.sync_all
|
|
132
|
+
results.each do |label, result|
|
|
133
|
+
status = result.success? ? "OK" : result.error
|
|
134
|
+
puts "#{label}: #{status}"
|
|
135
|
+
end
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### Removing Resources
|
|
139
|
+
|
|
140
|
+
```ruby
|
|
141
|
+
# Remove from manifest only (keep files on disk)
|
|
142
|
+
vault.remove("user/repo")
|
|
143
|
+
|
|
144
|
+
# Remove from manifest AND delete files
|
|
145
|
+
vault.remove("user/repo", delete_files: true)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### Backup and Restore
|
|
149
|
+
|
|
150
|
+
```ruby
|
|
151
|
+
# Export manifest for backup
|
|
152
|
+
vault.export_manifest("/backups/manifest.json")
|
|
153
|
+
|
|
154
|
+
# Import manifest (merges with existing resources)
|
|
155
|
+
vault.import_manifest("/shared/manifest.json")
|
|
156
|
+
|
|
157
|
+
# Re-download all resources from scratch
|
|
158
|
+
vault.redownload_all
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Resource
|
|
162
|
+
|
|
163
|
+
Represents a tracked GitHub resource.
|
|
164
|
+
|
|
165
|
+
```ruby
|
|
166
|
+
resource = vault.fetch("user/repo")
|
|
167
|
+
|
|
168
|
+
resource.label # => "user/repo"
|
|
169
|
+
resource.url # => "https://github.com/user/repo"
|
|
170
|
+
resource.username # => "user"
|
|
171
|
+
resource.repo # => "repo"
|
|
172
|
+
resource.type # => :repo, :folder, or :file
|
|
173
|
+
resource.branch # => "main"
|
|
174
|
+
resource.local_path # => "/vault/user/repo"
|
|
175
|
+
resource.relative_path # => nil (or path within repo for folders/files)
|
|
176
|
+
resource.added_at # => Time
|
|
177
|
+
resource.synced_at # => Time
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### SyncResult
|
|
181
|
+
|
|
182
|
+
Returned by sync operations.
|
|
183
|
+
|
|
184
|
+
```ruby
|
|
185
|
+
result = vault.sync("user/repo")
|
|
186
|
+
|
|
187
|
+
result.success? # => true/false
|
|
188
|
+
result.changes? # => true/false (did the sync pull new changes?)
|
|
189
|
+
result.error # => nil or error message string
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Error Handling
|
|
193
|
+
|
|
194
|
+
```ruby
|
|
195
|
+
begin
|
|
196
|
+
vault.add("invalid-url")
|
|
197
|
+
rescue AgentsSkillVault::Errors::InvalidUrl => e
|
|
198
|
+
puts "Bad URL: #{e.message}"
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
begin
|
|
202
|
+
vault.fetch("nonexistent")
|
|
203
|
+
rescue AgentsSkillVault::Errors::NotFound => e
|
|
204
|
+
puts "Not found: #{e.message}"
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
begin
|
|
208
|
+
vault.add("https://github.com/user/repo")
|
|
209
|
+
vault.add("https://github.com/other/thing", label: "user/repo")
|
|
210
|
+
rescue AgentsSkillVault::Errors::DuplicateLabel => e
|
|
211
|
+
puts "Duplicate: #{e.message}"
|
|
212
|
+
end
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Common Use Cases
|
|
216
|
+
|
|
217
|
+
### Managing Claude Code Skills
|
|
218
|
+
|
|
219
|
+
```ruby
|
|
220
|
+
vault = AgentsSkillVault::Vault.new(storage_path: "~/.claude/skill_vault")
|
|
221
|
+
|
|
222
|
+
# Add skills from various sources
|
|
223
|
+
vault.add("https://github.com/anthropics/claude-code/tree/main/skills/web-search")
|
|
224
|
+
vault.add("https://github.com/user/my-skills/tree/main/coding-assistant", label: "coding")
|
|
225
|
+
|
|
226
|
+
# Keep everything up to date
|
|
227
|
+
vault.sync_all
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Sharing Resource Collections
|
|
231
|
+
|
|
232
|
+
```ruby
|
|
233
|
+
# On machine A: Export your vault configuration
|
|
234
|
+
vault.export_manifest("~/Dropbox/vault-manifest.json")
|
|
235
|
+
|
|
236
|
+
# On machine B: Import and download
|
|
237
|
+
new_vault = AgentsSkillVault::Vault.new(storage_path: "~/.vault")
|
|
238
|
+
new_vault.import_manifest("~/Dropbox/vault-manifest.json")
|
|
239
|
+
new_vault.redownload_all
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Selective Repository Checkout
|
|
243
|
+
|
|
244
|
+
```ruby
|
|
245
|
+
# Instead of cloning a huge monorepo, just get the folder you need
|
|
246
|
+
vault.add(
|
|
247
|
+
"https://github.com/big-org/monorepo/tree/main/packages/useful-lib",
|
|
248
|
+
label: "useful-lib"
|
|
249
|
+
)
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Development
|
|
253
|
+
|
|
254
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests.
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
bundle exec rake test
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
You can also run `bin/console` for an interactive prompt.
|
|
261
|
+
|
|
262
|
+
## Contributing
|
|
263
|
+
|
|
264
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/lucianghinda/agents_skill_vault.
|
|
265
|
+
|
|
266
|
+
## License
|
|
267
|
+
|
|
268
|
+
The gem is available as open source under the terms of the Apache 2.0 License.
|
data/Rakefile
ADDED