@garthub/gart-npm 0.1.1

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.
package/LICENSE ADDED
@@ -0,0 +1,188 @@
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, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the
13
+ copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other
16
+ entities that control, are controlled by, or are under common control with
17
+ that entity. For the purposes of this definition, "control" means (i) the
18
+ power, direct or indirect, to cause the direction or management of such
19
+ entity, whether by contract or otherwise, or (ii) ownership of fifty percent
20
+ (50%) or more of the outstanding shares, or (iii) beneficial ownership of
21
+ such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
24
+ 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 source, and
28
+ configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical transformation
31
+ or translation of a Source form, including but not limited to compiled object
32
+ code, generated documentation, and conversions to other media types.
33
+
34
+ "Work" shall mean the work of authorship, whether in Source or Object form,
35
+ made available under the License, as indicated by a copyright notice that is
36
+ included in or attached to the work (an example is provided in the Appendix
37
+ below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object form,
40
+ that is based on (or derived from) the Work and for which the editorial
41
+ revisions, annotations, elaborations, or other modifications represent, as a
42
+ whole, an original work of authorship. For the purposes of this License,
43
+ Derivative Works shall not include works that remain separable from, or
44
+ merely link (or bind by name) to the interfaces of, the Work and Derivative
45
+ Works thereof.
46
+
47
+ "Contribution" shall mean any work of authorship, including the original
48
+ version of the Work and any modifications or additions to that Work or
49
+ Derivative Works thereof, that is intentionally submitted to Licensor for
50
+ inclusion in the Work by the copyright owner or by an individual or Legal
51
+ Entity authorized to submit on behalf of the copyright owner. For the
52
+ purposes of this definition, "submitted" means any form of electronic, verbal,
53
+ or written communication sent to the Licensor or its representatives,
54
+ including but not limited to communication on electronic mailing lists,
55
+ source code control systems, and issue tracking systems that are managed by,
56
+ or on behalf of, the Licensor for the purpose of discussing and improving the
57
+ Work, but excluding communication that is conspicuously marked or otherwise
58
+ designated in writing by the copyright owner as "Not a Contribution."
59
+
60
+ "Contributor" shall mean Licensor and any individual or Legal Entity on
61
+ behalf of whom a Contribution has been received by Licensor and subsequently
62
+ incorporated within the Work.
63
+
64
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
65
+ License, each Contributor hereby grants to You a perpetual, worldwide,
66
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
67
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
68
+ sublicense, and distribute the Work and such Derivative Works in Source or
69
+ Object form.
70
+
71
+ 3. Grant of Patent License. Subject to the terms and conditions of this
72
+ License, each Contributor hereby grants to You a perpetual, worldwide,
73
+ non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
74
+ section) patent license to make, have made, use, offer to sell, sell, import,
75
+ and otherwise transfer the Work, where such license applies only to those
76
+ patent claims licensable by such Contributor that are necessarily infringed
77
+ by their Contribution(s) alone or by combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You institute
79
+ patent litigation against any entity (including a cross-claim or counterclaim
80
+ in a lawsuit) alleging that the Work or a Contribution incorporated within
81
+ the Work constitutes direct or contributory patent infringement, then any
82
+ patent licenses granted to You under this License for that Work shall
83
+ terminate as of the date such litigation is filed.
84
+
85
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
86
+ Derivative Works thereof in any medium, with or without modifications, and in
87
+ Source or Object form, provided that You meet the following conditions:
88
+
89
+ (a) You must give any other recipients of the Work or Derivative Works a copy
90
+ of this License; and
91
+
92
+ (b) You must cause any modified files to carry prominent notices stating that
93
+ You changed the files; and
94
+
95
+ (c) You must retain, in the Source form of any Derivative Works that You
96
+ distribute, all copyright, patent, trademark, and attribution notices
97
+ from the Source form of the Work, excluding those notices that do not
98
+ pertain to any part of the Derivative Works; and
99
+
100
+ (d) If the Work includes a "NOTICE" text file as part of its distribution,
101
+ then any Derivative Works that You distribute must include a readable
102
+ copy of the attribution notices contained within such NOTICE file,
103
+ excluding those notices that do not pertain to any part of the Derivative
104
+ Works, in at least one of the following places: within a NOTICE text file
105
+ distributed as part of the Derivative Works; within the Source form or
106
+ documentation, if provided along with the Derivative Works; or, within a
107
+ display generated by the Derivative Works, if and wherever such third-party
108
+ notices normally appear. The contents of the NOTICE file are for
109
+ informational purposes only and do not modify the License. You may add
110
+ Your own attribution notices within Derivative Works that You distribute,
111
+ alongside or as an addendum to the NOTICE text from the Work, provided
112
+ that such additional attribution notices cannot be construed as modifying
113
+ the License.
114
+
115
+ You may add Your own copyright statement to Your modifications and may
116
+ provide additional or different license terms and conditions for use,
117
+ reproduction, or distribution of Your modifications, or for any such
118
+ Derivative Works as a whole, provided Your use, reproduction, and
119
+ distribution of the Work otherwise complies with the conditions stated in
120
+ this License.
121
+
122
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
123
+ Contribution intentionally submitted for inclusion in the Work by You to the
124
+ Licensor shall be under the terms and conditions of this License, without any
125
+ additional terms or conditions. Notwithstanding the above, nothing herein
126
+ shall supersede or modify the terms of any separate license agreement you may
127
+ have executed with Licensor regarding such Contributions.
128
+
129
+ 6. Trademarks. This License does not grant permission to use the trade names,
130
+ trademarks, service marks, or product names of the Licensor, except as
131
+ required for reasonable and customary use in describing the origin of the
132
+ Work and reproducing the content of the NOTICE file.
133
+
134
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
135
+ writing, Licensor provides the Work (and each Contributor provides its
136
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
137
+ KIND, either express or implied, including, without limitation, any
138
+ warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or
139
+ FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining
140
+ the appropriateness of using or redistributing the Work and assume any risks
141
+ associated with Your exercise of permissions under this License.
142
+
143
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
144
+ tort (including negligence), contract, or otherwise, unless required by
145
+ applicable law (such as deliberate and grossly negligent acts) or agreed to
146
+ in writing, shall any Contributor be liable to You for damages, including any
147
+ direct, indirect, special, incidental, or consequential damages of any
148
+ character arising as a result of this License or out of the use or inability
149
+ to use the Work (including but not limited to damages for loss of goodwill,
150
+ work stoppage, computer failure or malfunction, or any and all other
151
+ commercial damages or losses), even if such Contributor has been advised of
152
+ the possibility of such damages.
153
+
154
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
155
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
156
+ acceptance of support, warranty, indemnity, or other liability obligations
157
+ and/or rights consistent with this License. However, in accepting such
158
+ obligations, You may act only on Your own behalf and on Your sole
159
+ responsibility, not on behalf of any other Contributor, and only if You agree
160
+ to indemnify, defend, and hold each Contributor harmless for any liability
161
+ incurred by, or claims asserted against, such Contributor by reason of your
162
+ accepting any such warranty or additional liability.
163
+
164
+ END OF TERMS AND CONDITIONS
165
+
166
+ APPENDIX: How to apply the Apache License to your work.
167
+
168
+ To apply the Apache License to your work, attach the following boilerplate
169
+ notice, with the fields enclosed by brackets "[]" replaced with your own
170
+ identifying information. (Don't include the brackets!) The text should be
171
+ enclosed in the appropriate comment syntax for the file format. We also
172
+ recommend that a file or class name and description of purpose be included on
173
+ the same "printed page" as the copyright notice for easier identification
174
+ within third-party archives.
175
+
176
+ Copyright [yyyy] [name of copyright owner]
177
+
178
+ Licensed under the Apache License, Version 2.0 (the "License");
179
+ you may not use this file except in compliance with the License.
180
+ You may obtain a copy of the License at
181
+
182
+ http://www.apache.org/licenses/LICENSE-2.0
183
+
184
+ Unless required by applicable law or agreed to in writing, software
185
+ distributed under the License is distributed on an "AS IS" BASIS,
186
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
187
+ See the License for the specific language governing permissions and
188
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,395 @@
1
+ # Gart NPM
2
+
3
+ > Dependencies that teach your AI how to use them.
4
+
5
+ Gart extends npm to distribute **AI usage knowledge** alongside your dependencies.
6
+
7
+ When you add a library, you usually get only code and have to figure out how to use it yourself.
8
+
9
+ Gart changes that.
10
+
11
+ It allows library authors to package **AI skills** together with their artifacts, so when a dependency is added,
12
+ its usage knowledge can be resolved and installed automatically for your AI tools.
13
+
14
+ ---
15
+
16
+ ## Why Gart Exists
17
+
18
+ Adding a dependency gives you code, but not understanding.
19
+
20
+ - Documentation is static and often incomplete
21
+ - Examples cover only basic scenarios
22
+ - Best practices live in people’s heads
23
+ - AI assistants guess instead of knowing
24
+
25
+ This leads to slow onboarding, inconsistent usage, and fragile integrations.
26
+
27
+ ---
28
+
29
+ ## What Gart Does
30
+
31
+ Gart introduces a new concept: **skills as dependencies**.
32
+
33
+ With Gart:
34
+
35
+ - libraries publish AI-readable usage knowledge
36
+ - knowledge is versioned together with the artifact
37
+ - npm projects resolve and install it automatically
38
+ - AI assistants can use it to generate correct code
39
+
40
+ Dependencies are no longer just code. They carry their own knowledge.
41
+
42
+ ---
43
+
44
+ ## Quick Example
45
+
46
+ Install the CLI package:
47
+
48
+ ```text
49
+ npm install --save-dev @garthub/gart-npm
50
+ ```
51
+
52
+ Declare skill dependencies:
53
+
54
+ ```js
55
+ // gart.config.js
56
+ module.exports = {
57
+ resolution: {
58
+ repositories: [
59
+ {
60
+ type: 'maven',
61
+ url: 'http://localhost:5151/repository/garthub/',
62
+ credentials: {
63
+ usernameEnv: 'GART_REPO_USERNAME',
64
+ passwordEnv: 'GART_REPO_PASSWORD',
65
+ },
66
+ },
67
+ ],
68
+ dependencies: {
69
+ skills: ['com.example.gart:payment-sdk:1.2.0'],
70
+ },
71
+ },
72
+ };
73
+ ```
74
+
75
+ After resolution, skills are installed into:
76
+
77
+ ```text
78
+ .agents/skills
79
+ ```
80
+
81
+ Your AI assistant can now use them to generate correct integration code.
82
+
83
+ ---
84
+
85
+ ## What This Package Does
86
+
87
+ `@garthub/gart-npm` integrates Gart into an npm-based project.
88
+
89
+ It allows your project to:
90
+
91
+ - package local skills into a distributable artifact (`*-skills.zip`)
92
+ - publish skills to Maven-style repositories
93
+ - resolve skill dependencies from Maven-style repositories
94
+ - install resolved skills into `.agents/skills`
95
+ - make them available for AI tools
96
+
97
+ In short:
98
+
99
+ > npm manages your JavaScript dependencies.
100
+ >
101
+ > Gart manages your AI knowledge dependencies.
102
+
103
+ ---
104
+
105
+ ## Basic Project Setup
106
+
107
+ Install:
108
+
109
+ ```text
110
+ npm install --save-dev @garthub/gart-npm
111
+ ```
112
+
113
+ By default, Gart reads local skills from:
114
+
115
+ ```text
116
+ skills/
117
+ ```
118
+
119
+ You can add more directories:
120
+
121
+ ```js
122
+ // gart.config.js
123
+ module.exports = {
124
+ srcDirs: ['skills', 'extra-skills', 'generated-skills'],
125
+ };
126
+ ```
127
+
128
+ Recommended scripts:
129
+
130
+ ```json
131
+ {
132
+ "scripts": {
133
+ "gart:resolve": "gart resolve",
134
+ "gart:clean": "gart clean",
135
+ "gart:build": "gart build",
136
+ "gart:publish": "gart publish"
137
+ }
138
+ }
139
+ ```
140
+
141
+ `resolve` is also triggered automatically through `postinstall` when the package is installed in a consumer project.
142
+
143
+ ---
144
+
145
+ ## Commands
146
+
147
+ - `gart resolve` — resolves skill dependencies
148
+ - `gart clean` — removes Gart-managed skills
149
+ - `gart build` — builds the `*-skills.zip` archive
150
+ - `gart publish` — builds and publishes the archive together with its Maven POM
151
+
152
+ ---
153
+
154
+ ## Configuration
155
+
156
+ Recommended precedence:
157
+
158
+ 1. `gart.config.js`
159
+ 2. `gart.config.cjs`
160
+ 3. `gart.config.json`
161
+ 4. `package.json#gart`
162
+
163
+ `gart.config.js` is the recommended format because repository credentials, environment-dependent URLs,
164
+ and future advanced rules are easier to express in JavaScript.
165
+
166
+ Basic example:
167
+
168
+ ```js
169
+ module.exports = {
170
+ srcDirs: ['skills'],
171
+ managedSkillsDir: '.agents/skills',
172
+ buildDir: '.gart',
173
+ cacheDir: '.gart/cache',
174
+ resolution: {
175
+ repositories: [
176
+ {type: 'mavenLocal', rootDir: 'C:/Users/me/.m2/repository'},
177
+ {
178
+ type: 'maven',
179
+ url: 'http://localhost:5151/repository/garthub/',
180
+ credentials: {
181
+ usernameEnv: 'GART_REPO_USERNAME',
182
+ passwordEnv: 'GART_REPO_PASSWORD',
183
+ },
184
+ },
185
+ ],
186
+ dependencies: {
187
+ skills: ['com.example.gart:shared-skills:1.2.3'],
188
+ exposedSkills: ['com.example.gart:ddd-base-skill:0.0.1'],
189
+ },
190
+ },
191
+ publishing: {
192
+ coordinates: 'com.example.gart:my-skills:1.2.3',
193
+ repository: {
194
+ type: 'maven',
195
+ url: 'http://localhost:5151/repository/garthub/',
196
+ credentials: {
197
+ usernameEnv: 'GART_REPO_USERNAME',
198
+ passwordEnv: 'GART_REPO_PASSWORD',
199
+ },
200
+ },
201
+ },
202
+ };
203
+ ```
204
+
205
+ ---
206
+
207
+ ## Publishing
208
+
209
+ ### Publish to a Remote Maven Repository
210
+
211
+ ```js
212
+ module.exports = {
213
+ publishing: {
214
+ coordinates: 'com.example.gart:my-skills:1.2.3',
215
+ repository: {
216
+ type: 'maven',
217
+ url: 'https://repo.example.com/maven-releases',
218
+ credentials: {
219
+ usernameEnv: 'GART_REPO_USERNAME',
220
+ passwordEnv: 'GART_REPO_PASSWORD',
221
+ },
222
+ },
223
+ },
224
+ };
225
+ ```
226
+
227
+ Run:
228
+
229
+ ```text
230
+ npm run gart:publish
231
+ ```
232
+
233
+ ---
234
+
235
+ ### Publish to Local Maven
236
+
237
+ ```js
238
+ module.exports = {
239
+ publishing: {
240
+ coordinates: 'com.example.gart:my-skills:1.2.3',
241
+ repository: {
242
+ type: 'mavenLocal',
243
+ rootDir: 'C:/Users/me/.m2/repository',
244
+ },
245
+ },
246
+ };
247
+ ```
248
+
249
+ Artifact location:
250
+
251
+ ```text
252
+ ~/.m2/repository/<group>/<artifact>/<version>/<artifact>-<version>-skills.zip
253
+ ```
254
+
255
+ If you prefer, publishing coordinates may also be provided as:
256
+
257
+ - `publishing.groupId`
258
+ - `publishing.artifactId`
259
+ - `publishing.version`
260
+
261
+ When `artifactId` or `version` are omitted, Gart falls back to `package.json`.
262
+
263
+ ---
264
+
265
+ ## Resolving Skill Dependencies
266
+
267
+ ```js
268
+ module.exports = {
269
+ resolution: {
270
+ repositories: [
271
+ {type: 'mavenLocal', rootDir: 'C:/Users/me/.m2/repository'},
272
+ {
273
+ type: 'maven',
274
+ url: 'https://repo.example.com/maven-releases',
275
+ credentials: {
276
+ usernameEnv: 'GART_REPO_USERNAME',
277
+ passwordEnv: 'GART_REPO_PASSWORD',
278
+ },
279
+ },
280
+ ],
281
+ dependencies: {
282
+ skills: ['com.example.gart:shared-skills:1.2.3'],
283
+ exposedSkills: ['com.example.gart:some-base-skill:0.0.1'],
284
+ },
285
+ },
286
+ };
287
+ ```
288
+
289
+ - `skills` — local to the current project
290
+ - `exposedSkills` — also published transitively through the generated Maven POM
291
+
292
+ Resolved skills are unpacked into:
293
+
294
+ ```text
295
+ .agents/skills
296
+ ```
297
+
298
+ Gart also writes a managed index file:
299
+
300
+ ```text
301
+ .agents/skills/gart.json
302
+ ```
303
+
304
+ The index stores resolved dependencies, extracted file paths, checksums, and cleanup metadata.
305
+
306
+ ---
307
+
308
+ ## Transitive Resolution
309
+
310
+ When `exposedSkills` are published, Gart generates Maven POM dependencies with:
311
+
312
+ - the same `groupId`, `artifactId`, and `version`
313
+ - classifier `skills`
314
+ - type `zip`
315
+
316
+ Consumers resolve those dependencies transitively during `gart resolve`.
317
+
318
+ At the moment, POM parsing supports explicit dependency coordinates and does not yet resolve Maven properties or
319
+ `dependencyManagement` indirection.
320
+
321
+ ---
322
+
323
+ ## Artifact Model
324
+
325
+ Gart uses Maven-compatible coordinates:
326
+
327
+ - `groupId` = publishing group
328
+ - `artifactId` = publishing artifact
329
+ - `version` = publishing version
330
+ - classifier = `skills`
331
+ - extension = `zip`
332
+
333
+ Example:
334
+
335
+ ```text
336
+ com/example/gart/my-project/1.2.3/my-project-1.2.3-skills.zip
337
+ ```
338
+
339
+ The generated POM is published alongside the archive:
340
+
341
+ ```text
342
+ com/example/gart/my-project/1.2.3/my-project-1.2.3.pom
343
+ ```
344
+
345
+ ---
346
+
347
+ ## Safety Guarantees
348
+
349
+ Gart protects your workspace:
350
+
351
+ - does not overwrite user files silently
352
+ - removes only managed files
353
+ - fails on manual modifications of managed content
354
+ - prevents duplicate resource paths
355
+ - verifies checksums before deleting managed cache entries
356
+ - records checksums in build, publish, and managed index metadata
357
+
358
+ ---
359
+
360
+ ## Build Boundary
361
+
362
+ Only local skill sources (`skills/`, `srcDirs`) are included in the built archive.
363
+
364
+ Resolved dependencies in `.agents/skills` are **not** repackaged automatically.
365
+
366
+ ---
367
+
368
+ ## Summary
369
+
370
+ Gart introduces a missing layer in modern development:
371
+
372
+ > A way to distribute knowledge together with code.
373
+
374
+ Instead of teaching developers how to use your library,
375
+ you teach their AI once, and it applies the knowledge everywhere.
376
+
377
+ ---
378
+
379
+ ## License
380
+
381
+ ### Package
382
+
383
+ `@garthub/gart-npm` is licensed under the Apache License 2.0.
384
+
385
+ ### Skills
386
+
387
+ All skills are distributed as separate artifacts and may use different licenses depending on their author.
388
+
389
+ Typical options include:
390
+
391
+ - open-source licenses
392
+ - source-available licenses
393
+ - commercial licenses
394
+
395
+ Always check the license of each skill dependency before use.
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@garthub/gart-npm",
3
+ "version": "0.1.1",
4
+ "description": "Artifact-driven npm CLI for Gart skills",
5
+ "author": "Stepan Mozyra",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://gitlab.com/garthub/gart-npm.git"
9
+ },
10
+ "homepage": "https://gitlab.com/garthub/gart-npm#readme",
11
+ "files": [
12
+ "src",
13
+ "README.md"
14
+ ],
15
+ "bin": {
16
+ "gart": "./src/cli.js"
17
+ },
18
+ "scripts": {
19
+ "resolve": "node ./src/cli.js resolve",
20
+ "clean": "node ./src/cli.js clean",
21
+ "build": "node ./src/cli.js build",
22
+ "publish:skills": "node ./src/cli.js publish",
23
+ "postinstall": "node ./src/cli.js resolve --postinstall",
24
+ "test": "node ./test/run-tests.js",
25
+ "publish:nexus": "npm publish --registry http://localhost:5151/repository/garthub-js/",
26
+ "publish:public": "npm publish --registry https://registry.npmjs.org/ --access public"
27
+ },
28
+ "keywords": [
29
+ "gart",
30
+ "skills",
31
+ "artifact",
32
+ "zip"
33
+ ],
34
+ "license": "Apache-2.0",
35
+ "engines": {
36
+ "node": ">=20"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ }
41
+ }