agent-package-manager 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 foo-ogawa
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.
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # agent-package-manager
2
+
3
+ Package manager for [agent-contracts](https://github.com/foo-ogawa/agent-contracts) DSL.
4
+ Manages shared agent team definitions stored in GitHub private repositories with an npm-like UX.
5
+
6
+ ## Overview
7
+
8
+ `agent-pkg` CLI lets you share and version agent-contracts DSL packages across projects using GitHub repositories as a registry backend. It uses git tags for versioning and content hashing for integrity verification.
9
+
10
+ ```text
11
+ GitHub registry repo Local project
12
+ ┌──────────────────┐ ┌──────────────────────────┐
13
+ │ packages/ │ add/ │ agent_modules/ │
14
+ │ backend-api/ │ ──────► │ backend-api/ │
15
+ │ frontend/ │ sync │ agent_overrides/ │
16
+ │ police/ │ │ agent-pkg.json │
17
+ └──────────────────┘ │ agent-pkg.lock.json │
18
+ │ .agent-pkg/build/ │
19
+ │ agent/generated/ │
20
+ └──────────────────────────┘
21
+ ```
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ npm install -D agent-package-manager
27
+ ```
28
+
29
+ ## Commands
30
+
31
+ | Command | Description |
32
+ |---------|-------------|
33
+ | `agent-pkg init` | Initialize project configuration |
34
+ | `agent-pkg add <pkg>@<ver>` | Add a package from a registry |
35
+ | `agent-pkg sync` | Restore `agent_modules/` from lock file |
36
+ | `agent-pkg update [pkg]` | Update packages to newer versions |
37
+ | `agent-pkg diff <pkg>` | Show semantic diff between versions |
38
+ | `agent-pkg materialize` | Build resolved DSL and generate runtime artifacts |
39
+ | `agent-pkg check` | Run full CI verification pipeline |
40
+ | `agent-pkg publish <path>` | Publish a package (tag + push) |
41
+
42
+ ## Quick Start
43
+
44
+ ```bash
45
+ # Initialize project
46
+ agent-pkg init --registry github:myorg/agent-pkg-registry
47
+
48
+ # Add a package
49
+ agent-pkg add backend-api@1.0.0
50
+
51
+ # Customize with project overrides
52
+ mkdir -p agent_overrides
53
+ # Edit agent_overrides/backend-api.yaml
54
+
55
+ # Rebuild
56
+ agent-pkg materialize
57
+
58
+ # CI check
59
+ agent-pkg check
60
+ ```
61
+
62
+ ## How It Works
63
+
64
+ 1. **Registry**: A GitHub repository containing versioned agent team DSL packages under `packages/`
65
+ 2. **Add/Sync**: Packages are fetched via `git archive` and extracted into `agent_modules/`
66
+ 3. **Lock file**: `agent-pkg.lock.json` pins exact commit SHAs and content hashes
67
+ 4. **Overrides**: Project-specific customizations go in `agent_overrides/`, never in `agent_modules/`
68
+ 5. **Materialize**: Resolves DSL inheritance, applies overrides, validates, lints, and generates runtime artifacts
69
+
70
+ ## Requirements
71
+
72
+ - Node.js >= 20
73
+ - Git (for registry access)
74
+ - `gh` CLI or SSH keys for GitHub authentication
75
+
76
+ ## Related
77
+
78
+ - [agent-contracts](https://github.com/foo-ogawa/agent-contracts) — DSL toolkit
79
+ - [agent-contracts-runtime](https://github.com/foo-ogawa/agent-contracts-runtime) — Runtime bridge
80
+
81
+ ## License
82
+
83
+ MIT
@@ -0,0 +1,688 @@
1
+ # yaml-language-server: $schema=./node_modules/cli-contracts/schemas/cli-contract.schema.json
2
+ cliContracts: 0.1.0
3
+
4
+ info:
5
+ title: agent-pkg CLI
6
+ version: 0.1.0
7
+ description: >-
8
+ Package manager for agent-contracts DSL. Manages shared agent team
9
+ definitions stored in GitHub private repositories with npm-like UX.
10
+ Supports add, sync, update, diff, materialize, check, and publish
11
+ workflows backed by git tags and content hashing.
12
+ license:
13
+ name: MIT
14
+ contact:
15
+ name: foo-ogawa
16
+ url: https://github.com/foo-ogawa/agent-package-manager
17
+
18
+ commandSets:
19
+ agent-pkg:
20
+ summary: Manage agent-contracts DSL packages from GitHub registries.
21
+ executable: agent-pkg
22
+
23
+ globalOptions:
24
+ - name: version
25
+ aliases: [V]
26
+ description: Print version and exit.
27
+ schema:
28
+ type: boolean
29
+
30
+ - name: help
31
+ aliases: [h]
32
+ description: Show help and exit.
33
+ schema:
34
+ type: boolean
35
+
36
+ - name: verbose
37
+ aliases: [v]
38
+ description: Enable verbose output.
39
+ schema:
40
+ type: boolean
41
+ default: false
42
+
43
+ commands:
44
+ # ── init ───────────────────────────────────────────
45
+ init:
46
+ summary: Initialize a project for agent-pkg package management.
47
+ description: >-
48
+ Creates the initial configuration files and directory structure
49
+ for managing agent-contracts DSL packages. Generates
50
+ agent-pkg.json, agent-pkg.lock.json, agent-contracts.yaml,
51
+ agent-runtime.config.yaml, and the agent_modules/,
52
+ agent_overrides/, and .agent-pkg/build/ directories.
53
+ usage:
54
+ - agent-pkg init
55
+ - agent-pkg init --registry github:foo/agent-pkg-registry
56
+ - agent-pkg init --modules-dir agent_modules
57
+ - agent-pkg init --build-dir .agent-pkg/build
58
+
59
+ options:
60
+ - name: registry
61
+ aliases: [r]
62
+ description: >-
63
+ Default registry in the format github:<owner>/<repo>.
64
+ valueName: url
65
+ schema:
66
+ type: string
67
+
68
+ - name: modules-dir
69
+ description: Directory to store fetched packages.
70
+ valueName: path
71
+ schema:
72
+ type: string
73
+ default: agent_modules
74
+
75
+ - name: build-dir
76
+ description: Directory for build artifacts.
77
+ valueName: path
78
+ schema:
79
+ type: string
80
+ default: .agent-pkg/build
81
+
82
+ exits:
83
+ "0":
84
+ description: Project initialized successfully.
85
+ stdout:
86
+ format: json
87
+ schema:
88
+ $ref: "#/components/schemas/InitResult"
89
+
90
+ "1":
91
+ description: Initialization failed (existing files, permission error, etc.).
92
+ stderr:
93
+ format: text
94
+
95
+ x-agent:
96
+ riskLevel: low
97
+ requiresConfirmation: false
98
+ idempotent: false
99
+ sideEffects:
100
+ - filesystem_write
101
+
102
+ # ── add ────────────────────────────────────────────
103
+ add:
104
+ summary: Add a package from a registry.
105
+ description: >-
106
+ Fetches a package from a GitHub registry repository by resolving
107
+ the git tag, clones/fetches into the local cache, extracts the
108
+ package into agent_modules/, updates agent-pkg.json and
109
+ agent-pkg.lock.json, adds extends entry to agent-contracts.yaml,
110
+ and runs materialize.
111
+ usage:
112
+ - agent-pkg add backend-api@1.2.3
113
+ - "agent-pkg add github:foo/agent-pkg-registry//packages/backend-api@1.2.3"
114
+ - agent-pkg add backend-api@1.2.3 --no-materialize
115
+ - agent-pkg add backend-api@1.2.3 --alias api
116
+
117
+ arguments:
118
+ - name: package
119
+ index: 0
120
+ required: true
121
+ description: >-
122
+ Package specifier in the format <name>@<version> or
123
+ github:<owner>/<repo>//<path>@<version>.
124
+ schema:
125
+ type: string
126
+
127
+ options:
128
+ - name: registry
129
+ aliases: [r]
130
+ description: Registry name to use (from agent-pkg.json registries).
131
+ valueName: name
132
+ schema:
133
+ type: string
134
+ default: default
135
+
136
+ - name: alias
137
+ description: Install under an alternative directory name.
138
+ valueName: name
139
+ schema:
140
+ type: string
141
+
142
+ - name: no-materialize
143
+ description: Skip the materialize step after adding.
144
+ schema:
145
+ type: boolean
146
+ default: false
147
+
148
+ exits:
149
+ "0":
150
+ description: Package added and materialized successfully.
151
+ stdout:
152
+ format: json
153
+ schema:
154
+ $ref: "#/components/schemas/AddResult"
155
+
156
+ "1":
157
+ description: >-
158
+ Add failed — package not found, tag resolution failed,
159
+ git fetch error, or materialize error.
160
+ stderr:
161
+ format: text
162
+
163
+ x-agent:
164
+ riskLevel: medium
165
+ requiresConfirmation: false
166
+ idempotent: true
167
+ sideEffects:
168
+ - filesystem_write
169
+ - git_fetch
170
+
171
+ # ── sync ───────────────────────────────────────────
172
+ sync:
173
+ summary: Restore agent_modules from lock file.
174
+ description: >-
175
+ Reads agent-pkg.lock.json and restores all packages into
176
+ agent_modules/ at the exact commits recorded in the lock file.
177
+ Verifies content hashes, regenerates the resolved DSL, and
178
+ runs agent-runtime generate. Use --check for CI to detect
179
+ any drift without modifying files.
180
+ usage:
181
+ - agent-pkg sync
182
+ - agent-pkg sync --check
183
+
184
+ options:
185
+ - name: check
186
+ description: >-
187
+ Dry-run mode for CI. Exits with code 1 if agent_modules
188
+ would change (drift detected).
189
+ schema:
190
+ type: boolean
191
+ default: false
192
+
193
+ exits:
194
+ "0":
195
+ description: Sync completed (or --check found no drift).
196
+ stdout:
197
+ format: json
198
+ schema:
199
+ $ref: "#/components/schemas/SyncResult"
200
+
201
+ "1":
202
+ description: >-
203
+ Sync failed, lock file missing, hash mismatch,
204
+ or --check detected drift.
205
+ stderr:
206
+ format: text
207
+
208
+ x-agent:
209
+ riskLevel: low
210
+ requiresConfirmation: false
211
+ idempotent: true
212
+ sideEffects:
213
+ - filesystem_write
214
+ - git_fetch
215
+ safeDryRunOption: check
216
+
217
+ # ── update ─────────────────────────────────────────
218
+ update:
219
+ summary: Update packages to newer versions.
220
+ description: >-
221
+ Fetches the latest tags from the registry repository, selects
222
+ update candidates based on semver range, updates agent_modules/,
223
+ and runs materialize. Without arguments, updates all packages.
224
+ With a package name, updates only that package. With --dry-run,
225
+ shows what would be updated without making changes.
226
+ usage:
227
+ - agent-pkg update
228
+ - agent-pkg update backend-api
229
+ - agent-pkg update backend-api@1.3.0
230
+ - agent-pkg update --dry-run
231
+ - agent-pkg update backend-api --latest
232
+ - agent-pkg update --yes
233
+
234
+ arguments:
235
+ - name: package
236
+ index: 0
237
+ required: false
238
+ description: >-
239
+ Package specifier. Name only for latest compatible,
240
+ or name@version for specific version.
241
+ schema:
242
+ type: string
243
+
244
+ options:
245
+ - name: latest
246
+ description: Update to the latest version (ignore semver range).
247
+ schema:
248
+ type: boolean
249
+ default: false
250
+
251
+ - name: minor
252
+ description: Only update to latest minor version.
253
+ schema:
254
+ type: boolean
255
+ default: false
256
+
257
+ - name: patch
258
+ description: Only update to latest patch version.
259
+ schema:
260
+ type: boolean
261
+ default: false
262
+
263
+ - name: "yes"
264
+ aliases: [y]
265
+ description: Skip confirmation prompts.
266
+ schema:
267
+ type: boolean
268
+ default: false
269
+
270
+ - name: dry-run
271
+ description: Show what would be updated without making changes.
272
+ schema:
273
+ type: boolean
274
+ default: false
275
+
276
+ exits:
277
+ "0":
278
+ description: Update completed (or dry-run displayed results).
279
+ stdout:
280
+ format: json
281
+ schema:
282
+ $ref: "#/components/schemas/UpdateResult"
283
+
284
+ "1":
285
+ description: >-
286
+ Update failed — registry fetch error, no update candidates,
287
+ or materialize error.
288
+ stderr:
289
+ format: text
290
+
291
+ x-agent:
292
+ riskLevel: medium
293
+ requiresConfirmation: true
294
+ idempotent: true
295
+ sideEffects:
296
+ - filesystem_write
297
+ - git_fetch
298
+ safeDryRunOption: dry-run
299
+
300
+ # ── diff ───────────────────────────────────────────
301
+ diff:
302
+ summary: Show semantic diff between current and target package versions.
303
+ description: >-
304
+ Compares the currently installed package version against a
305
+ target version (latest or specified). Displays changes to
306
+ agents, tasks, handoff types, guardrails, and workflows with
307
+ breaking change detection.
308
+ usage:
309
+ - agent-pkg diff backend-api
310
+ - agent-pkg diff backend-api@1.3.0
311
+ - agent-pkg diff --format json
312
+
313
+ arguments:
314
+ - name: package
315
+ index: 0
316
+ required: true
317
+ description: >-
318
+ Package name, or name@version to compare against a
319
+ specific version.
320
+ schema:
321
+ type: string
322
+
323
+ options:
324
+ - name: format
325
+ description: Output format.
326
+ valueName: format
327
+ schema:
328
+ type: string
329
+ enum: [text, json]
330
+ default: text
331
+
332
+ exits:
333
+ "0":
334
+ description: >-
335
+ Diff computed successfully. No breaking changes, or
336
+ informational output only.
337
+ stdout:
338
+ format: text
339
+
340
+ "1":
341
+ description: >-
342
+ Diff failed — package not found, version not found,
343
+ or git error.
344
+ stderr:
345
+ format: text
346
+
347
+ "2":
348
+ description: >-
349
+ Diff computed successfully but breaking changes detected.
350
+ stdout:
351
+ format: text
352
+
353
+ x-agent:
354
+ riskLevel: none
355
+ requiresConfirmation: false
356
+ idempotent: true
357
+ sideEffects:
358
+ - git_fetch
359
+
360
+ # ── materialize ────────────────────────────────────
361
+ materialize:
362
+ summary: Build resolved DSL and generate runtime artifacts.
363
+ description: >-
364
+ Reads agent-pkg.json and agent_modules/ package manifests,
365
+ resolves agent-contracts.yaml with extends and overrides,
366
+ applies vars, writes the resolved DSL to .agent-pkg/build/,
367
+ runs agent-contracts validate and lint, then runs
368
+ agent-runtime generate to produce typed contracts and hooks.
369
+ usage:
370
+ - agent-pkg materialize
371
+ - agent-pkg materialize --no-generate
372
+ - agent-pkg materialize --no-lint
373
+ - agent-pkg materialize --clean
374
+
375
+ options:
376
+ - name: no-generate
377
+ description: Skip agent-runtime generate step.
378
+ schema:
379
+ type: boolean
380
+ default: false
381
+
382
+ - name: no-lint
383
+ description: Skip agent-contracts lint step.
384
+ schema:
385
+ type: boolean
386
+ default: false
387
+
388
+ - name: clean
389
+ description: Clean build directory before materializing.
390
+ schema:
391
+ type: boolean
392
+ default: false
393
+
394
+ exits:
395
+ "0":
396
+ description: Materialize completed successfully.
397
+ stdout:
398
+ format: json
399
+ schema:
400
+ $ref: "#/components/schemas/MaterializeResult"
401
+
402
+ "1":
403
+ description: >-
404
+ Materialize failed — DSL resolution error, validation
405
+ error, lint error, or generation error.
406
+ stderr:
407
+ format: text
408
+
409
+ x-agent:
410
+ riskLevel: medium
411
+ requiresConfirmation: false
412
+ idempotent: true
413
+ sideEffects:
414
+ - filesystem_write
415
+ recommendedBeforeUse:
416
+ - Ensure agent_modules/ is populated (run sync or add first).
417
+
418
+ # ── check ──────────────────────────────────────────
419
+ check:
420
+ summary: Run full verification pipeline for CI.
421
+ description: >-
422
+ Executes the complete verification pipeline: validates
423
+ agent-pkg.json and lock file schemas, checks version/lock
424
+ consistency, verifies agent_modules content hashes, checks
425
+ resolved DSL hash, runs agent-contracts validate and lint
426
+ --strict, runs agent-runtime generate --check, and runs
427
+ agent-runtime doctor. Returns non-zero on any failure.
428
+ usage:
429
+ - agent-pkg check
430
+
431
+ exits:
432
+ "0":
433
+ description: All checks passed.
434
+ stdout:
435
+ format: json
436
+ schema:
437
+ $ref: "#/components/schemas/CheckResult"
438
+
439
+ "1":
440
+ description: >-
441
+ One or more checks failed — schema errors, hash mismatch,
442
+ validation errors, lint errors, or generation drift.
443
+ stderr:
444
+ format: text
445
+
446
+ x-agent:
447
+ riskLevel: none
448
+ requiresConfirmation: false
449
+ idempotent: true
450
+ sideEffects: []
451
+
452
+ # ── publish ────────────────────────────────────────
453
+ publish:
454
+ summary: Publish a package in the registry repository.
455
+ description: >-
456
+ Validates the package, checks version consistency between
457
+ package.json and agent-pkg.package.json, computes content
458
+ hash, verifies CHANGELOG.md is updated, creates a git tag
459
+ in the format <package>/v<version>, and pushes to the remote.
460
+ usage:
461
+ - agent-pkg publish packages/backend-api
462
+ - agent-pkg publish packages/backend-api --version 1.2.3
463
+ - agent-pkg publish packages/backend-api --dry-run
464
+ - agent-pkg publish packages/backend-api --tag-only
465
+ - agent-pkg publish packages/backend-api --no-push
466
+
467
+ arguments:
468
+ - name: path
469
+ index: 0
470
+ required: true
471
+ description: Path to the package directory within the registry repository.
472
+ schema:
473
+ type: string
474
+ file:
475
+ mode: read
476
+ exists: true
477
+
478
+ options:
479
+ - name: version
480
+ description: Override version for this publish.
481
+ valueName: semver
482
+ schema:
483
+ type: string
484
+
485
+ - name: dry-run
486
+ description: Show what would be published without making changes.
487
+ schema:
488
+ type: boolean
489
+ default: false
490
+
491
+ - name: tag-only
492
+ description: Only create the git tag, skip validation.
493
+ schema:
494
+ type: boolean
495
+ default: false
496
+
497
+ - name: no-push
498
+ description: Create the tag locally but do not push to remote.
499
+ schema:
500
+ type: boolean
501
+ default: false
502
+
503
+ exits:
504
+ "0":
505
+ description: Package published successfully.
506
+ stdout:
507
+ format: json
508
+ schema:
509
+ $ref: "#/components/schemas/PublishResult"
510
+
511
+ "1":
512
+ description: >-
513
+ Publish failed — validation error, version mismatch,
514
+ missing CHANGELOG, or git error.
515
+ stderr:
516
+ format: text
517
+
518
+ x-agent:
519
+ riskLevel: high
520
+ requiresConfirmation: true
521
+ idempotent: false
522
+ sideEffects:
523
+ - git_tag
524
+ - git_push
525
+ safeDryRunOption: dry-run
526
+
527
+ # =============================================================================
528
+ # Components
529
+ # =============================================================================
530
+
531
+ components:
532
+ schemas:
533
+ InitResult:
534
+ type: object
535
+ required: [filesCreated, dirsCreated]
536
+ properties:
537
+ filesCreated:
538
+ type: array
539
+ items:
540
+ type: string
541
+ description: List of configuration files created.
542
+ dirsCreated:
543
+ type: array
544
+ items:
545
+ type: string
546
+ description: List of directories created.
547
+
548
+ AddResult:
549
+ type: object
550
+ required: [package, version, installedTo]
551
+ properties:
552
+ package:
553
+ type: string
554
+ description: Package name.
555
+ version:
556
+ type: string
557
+ description: Installed version.
558
+ tag:
559
+ type: string
560
+ description: Git tag resolved.
561
+ commit:
562
+ type: string
563
+ description: Git commit SHA.
564
+ installedTo:
565
+ type: string
566
+ description: Path where the package was installed.
567
+ materialized:
568
+ type: boolean
569
+ description: Whether materialize was run after install.
570
+
571
+ SyncResult:
572
+ type: object
573
+ required: [packages, checkMode]
574
+ properties:
575
+ packages:
576
+ type: array
577
+ items:
578
+ $ref: "#/components/schemas/SyncedPackage"
579
+ description: Packages that were synced.
580
+ checkMode:
581
+ type: boolean
582
+ description: Whether --check was used.
583
+ hasDrift:
584
+ type: boolean
585
+ description: In --check mode, whether drift was detected.
586
+
587
+ SyncedPackage:
588
+ type: object
589
+ required: [name, version, status]
590
+ properties:
591
+ name:
592
+ type: string
593
+ version:
594
+ type: string
595
+ status:
596
+ type: string
597
+ enum: [up-to-date, restored, hash-mismatch]
598
+
599
+ UpdateResult:
600
+ type: object
601
+ required: [updates]
602
+ properties:
603
+ updates:
604
+ type: array
605
+ items:
606
+ $ref: "#/components/schemas/PackageUpdate"
607
+ dryRun:
608
+ type: boolean
609
+
610
+ PackageUpdate:
611
+ type: object
612
+ required: [package, fromVersion, toVersion]
613
+ properties:
614
+ package:
615
+ type: string
616
+ fromVersion:
617
+ type: string
618
+ toVersion:
619
+ type: string
620
+ hasBreakingChanges:
621
+ type: boolean
622
+
623
+ MaterializeResult:
624
+ type: object
625
+ required: [resolvedDslPath]
626
+ properties:
627
+ resolvedDslPath:
628
+ type: string
629
+ description: Path to the resolved DSL file.
630
+ resolvedDslHash:
631
+ type: string
632
+ description: SHA-256 hash of the resolved DSL.
633
+ validated:
634
+ type: boolean
635
+ linted:
636
+ type: boolean
637
+ generated:
638
+ type: boolean
639
+
640
+ CheckResult:
641
+ type: object
642
+ required: [checks, allPassed]
643
+ properties:
644
+ checks:
645
+ type: array
646
+ items:
647
+ $ref: "#/components/schemas/CheckItem"
648
+ allPassed:
649
+ type: boolean
650
+
651
+ CheckItem:
652
+ type: object
653
+ required: [name, status]
654
+ properties:
655
+ name:
656
+ type: string
657
+ description: >-
658
+ Check name (e.g. schema_valid, lock_consistent,
659
+ content_hash_ok, dsl_valid, lint_clean, generate_fresh).
660
+ status:
661
+ type: string
662
+ enum: [pass, fail, warn]
663
+ message:
664
+ type: string
665
+ description: Human-readable detail.
666
+
667
+ PublishResult:
668
+ type: object
669
+ required: [package, version, tag]
670
+ properties:
671
+ package:
672
+ type: string
673
+ description: Package name.
674
+ version:
675
+ type: string
676
+ description: Published version.
677
+ tag:
678
+ type: string
679
+ description: Git tag created.
680
+ commit:
681
+ type: string
682
+ description: Git commit SHA.
683
+ contentHash:
684
+ type: string
685
+ description: SHA-256 content hash of the package.
686
+ pushed:
687
+ type: boolean
688
+ description: Whether the tag was pushed to remote.
@@ -0,0 +1,12 @@
1
+ // src/index.ts
2
+ import { readFileSync } from "fs";
3
+ import { fileURLToPath } from "url";
4
+ import { resolve, dirname } from "path";
5
+ var __dirname = dirname(fileURLToPath(import.meta.url));
6
+ var pkg = JSON.parse(readFileSync(resolve(__dirname, "../package.json"), "utf8"));
7
+ var VERSION = pkg.version;
8
+
9
+ export {
10
+ VERSION
11
+ };
12
+ //# sourceMappingURL=chunk-5XXBSF75.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\nimport { resolve, dirname } from \"node:path\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst pkg = JSON.parse(readFileSync(resolve(__dirname, \"../package.json\"), \"utf8\"));\n\nexport const VERSION: string = pkg.version;\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,SAAS,eAAe;AAEjC,IAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AACxD,IAAM,MAAM,KAAK,MAAM,aAAa,QAAQ,WAAW,iBAAiB,GAAG,MAAM,CAAC;AAE3E,IAAM,UAAkB,IAAI;","names":[]}
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ VERSION
4
+ } from "../chunk-5XXBSF75.js";
5
+
6
+ // src/generated/cli/program.ts
7
+ import { Command } from "commander";
8
+ function createProgram(handlers2, version) {
9
+ const program2 = new Command();
10
+ program2.name("agent-pkg").version(version, "-V, --version").description("Manage agent-contracts DSL packages from GitHub registries.");
11
+ program2.option("-v, --verbose", "Enable verbose output.", false);
12
+ program2.command("init").description("Initialize a project for agent-pkg package management.").option("-r, --registry <url>", "Default registry in the format github:<owner>/<repo>.").option("--modules-dir <path>", "Directory to store fetched packages.", "agent_modules").option("--build-dir <path>", "Directory for build artifacts.", ".agent-pkg/build").action(async (opts, cmd) => {
13
+ await handlers2.init(opts, cmd.optsWithGlobals());
14
+ });
15
+ program2.command("add").description("Add a package from a registry.").argument("<package>", "Package specifier in the format <name>@<version> or github:<owner>/<repo>//<path>@<version>.").option("-r, --registry <name>", "Registry name to use (from agent-pkg.json registries).", "default").option("--alias <name>", "Install under an alternative directory name.").option("--no-materialize", "Skip the materialize step after adding.", false).action(async (packageArg, opts, cmd) => {
16
+ await handlers2.add(packageArg, opts, cmd.optsWithGlobals());
17
+ });
18
+ program2.command("sync").description("Restore agent_modules from lock file.").option("--check", "Dry-run mode for CI. Exits with code 1 if agent_modules would change (drift detected).", false).action(async (opts, cmd) => {
19
+ await handlers2.sync(opts, cmd.optsWithGlobals());
20
+ });
21
+ program2.command("update").description("Update packages to newer versions.").argument("[package]", "Package specifier. Name only for latest compatible, or name@version for specific version.").option("--latest", "Update to the latest version (ignore semver range).", false).option("--minor", "Only update to latest minor version.", false).option("--patch", "Only update to latest patch version.", false).option("-y, --yes", "Skip confirmation prompts.", false).option("--dry-run", "Show what would be updated without making changes.", false).action(async (packageArg, opts, cmd) => {
22
+ await handlers2.update(packageArg, opts, cmd.optsWithGlobals());
23
+ });
24
+ program2.command("diff").description("Show semantic diff between current and target package versions.").argument("<package>", "Package name, or name@version to compare against a specific version.").option("--format <format>", "Output format.", "text").action(async (packageArg, opts, cmd) => {
25
+ await handlers2.diff(packageArg, opts, cmd.optsWithGlobals());
26
+ });
27
+ program2.command("materialize").description("Build resolved DSL and generate runtime artifacts.").option("--no-generate", "Skip agent-runtime generate step.", false).option("--no-lint", "Skip agent-contracts lint step.", false).option("--clean", "Clean build directory before materializing.", false).action(async (opts, cmd) => {
28
+ await handlers2.materialize(opts, cmd.optsWithGlobals());
29
+ });
30
+ program2.command("check").description("Run full verification pipeline for CI.").action(async (opts, cmd) => {
31
+ await handlers2.check({}, cmd.optsWithGlobals());
32
+ });
33
+ program2.command("publish").description("Publish a package in the registry repository.").argument("<path>", "Path to the package directory within the registry repository.").option("--version <semver>", "Override version for this publish.").option("--dry-run", "Show what would be published without making changes.", false).option("--tag-only", "Only create the git tag, skip validation.", false).option("--no-push", "Create the tag locally but do not push to remote.", false).action(async (path, opts, cmd) => {
34
+ await handlers2.publish(path, opts, cmd.optsWithGlobals());
35
+ });
36
+ return program2;
37
+ }
38
+
39
+ // src/cli/index.ts
40
+ var notImplemented = () => {
41
+ console.error("Not implemented yet");
42
+ process.exit(1);
43
+ };
44
+ var handlers = {
45
+ init: async (_opts, _globals) => notImplemented(),
46
+ add: async (_pkg, _opts, _globals) => notImplemented(),
47
+ sync: async (_opts, _globals) => notImplemented(),
48
+ update: async (_pkg, _opts, _globals) => notImplemented(),
49
+ diff: async (_pkg, _opts, _globals) => notImplemented(),
50
+ materialize: async (_opts, _globals) => notImplemented(),
51
+ check: async (_globals) => notImplemented(),
52
+ publish: async (_path, _opts, _globals) => notImplemented()
53
+ };
54
+ var program = createProgram(handlers, VERSION);
55
+ program.parse();
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/generated/cli/program.ts","../../src/cli/index.ts"],"sourcesContent":["// Auto-generated by cli-contracts. Do not edit.\nimport { Command } from \"commander\";\n\nexport interface CommandHandlers {\n init: (options: { registry?: string; modulesDir?: string; buildDir?: string }, parentOpts: Record<string, unknown>) => Promise<void>;\n add: (packageArg: string | undefined, options: { registry?: string; alias?: string; noMaterialize?: boolean }, parentOpts: Record<string, unknown>) => Promise<void>;\n sync: (options: { check?: boolean }, parentOpts: Record<string, unknown>) => Promise<void>;\n update: (packageArg: string | undefined, options: { latest?: boolean; minor?: boolean; patch?: boolean; yes?: boolean; dryRun?: boolean }, parentOpts: Record<string, unknown>) => Promise<void>;\n diff: (packageArg: string | undefined, options: { format?: string }, parentOpts: Record<string, unknown>) => Promise<void>;\n materialize: (options: { noGenerate?: boolean; noLint?: boolean; clean?: boolean }, parentOpts: Record<string, unknown>) => Promise<void>;\n check: (parentOpts: Record<string, unknown>) => Promise<void>;\n publish: (path: string | undefined, options: { version?: string; dryRun?: boolean; tagOnly?: boolean; noPush?: boolean }, parentOpts: Record<string, unknown>) => Promise<void>;\n}\n\nexport function createProgram(\n handlers: CommandHandlers,\n version: string,\n): Command {\n const program = new Command();\n program\n .name(\"agent-pkg\")\n .version(version, \"-V, --version\")\n .description(\"Manage agent-contracts DSL packages from GitHub registries.\");\n\n program.option(\"-v, --verbose\", \"Enable verbose output.\", false);\n\n program\n .command(\"init\")\n .description(\"Initialize a project for agent-pkg package management.\")\n .option(\"-r, --registry <url>\", \"Default registry in the format github:<owner>/<repo>.\")\n .option(\"--modules-dir <path>\", \"Directory to store fetched packages.\", \"agent_modules\")\n .option(\"--build-dir <path>\", \"Directory for build artifacts.\", \".agent-pkg/build\")\n .action(async (opts, cmd) => {\n await handlers.init(opts, cmd.optsWithGlobals());\n });\n\n program\n .command(\"add\")\n .description(\"Add a package from a registry.\")\n .argument(\"<package>\", \"Package specifier in the format <name>@<version> or github:<owner>/<repo>//<path>@<version>.\")\n .option(\"-r, --registry <name>\", \"Registry name to use (from agent-pkg.json registries).\", \"default\")\n .option(\"--alias <name>\", \"Install under an alternative directory name.\")\n .option(\"--no-materialize\", \"Skip the materialize step after adding.\", false)\n .action(async (packageArg, opts, cmd) => {\n await handlers.add(packageArg, opts, cmd.optsWithGlobals());\n });\n\n program\n .command(\"sync\")\n .description(\"Restore agent_modules from lock file.\")\n .option(\"--check\", \"Dry-run mode for CI. Exits with code 1 if agent_modules would change (drift detected).\", false)\n .action(async (opts, cmd) => {\n await handlers.sync(opts, cmd.optsWithGlobals());\n });\n\n program\n .command(\"update\")\n .description(\"Update packages to newer versions.\")\n .argument(\"[package]\", \"Package specifier. Name only for latest compatible, or name@version for specific version.\")\n .option(\"--latest\", \"Update to the latest version (ignore semver range).\", false)\n .option(\"--minor\", \"Only update to latest minor version.\", false)\n .option(\"--patch\", \"Only update to latest patch version.\", false)\n .option(\"-y, --yes\", \"Skip confirmation prompts.\", false)\n .option(\"--dry-run\", \"Show what would be updated without making changes.\", false)\n .action(async (packageArg, opts, cmd) => {\n await handlers.update(packageArg, opts, cmd.optsWithGlobals());\n });\n\n program\n .command(\"diff\")\n .description(\"Show semantic diff between current and target package versions.\")\n .argument(\"<package>\", \"Package name, or name@version to compare against a specific version.\")\n .option(\"--format <format>\", \"Output format.\", \"text\")\n .action(async (packageArg, opts, cmd) => {\n await handlers.diff(packageArg, opts, cmd.optsWithGlobals());\n });\n\n program\n .command(\"materialize\")\n .description(\"Build resolved DSL and generate runtime artifacts.\")\n .option(\"--no-generate\", \"Skip agent-runtime generate step.\", false)\n .option(\"--no-lint\", \"Skip agent-contracts lint step.\", false)\n .option(\"--clean\", \"Clean build directory before materializing.\", false)\n .action(async (opts, cmd) => {\n await handlers.materialize(opts, cmd.optsWithGlobals());\n });\n\n program\n .command(\"check\")\n .description(\"Run full verification pipeline for CI.\")\n .action(async (opts, cmd) => {\n await handlers.check({}, cmd.optsWithGlobals());\n });\n\n program\n .command(\"publish\")\n .description(\"Publish a package in the registry repository.\")\n .argument(\"<path>\", \"Path to the package directory within the registry repository.\")\n .option(\"--version <semver>\", \"Override version for this publish.\")\n .option(\"--dry-run\", \"Show what would be published without making changes.\", false)\n .option(\"--tag-only\", \"Only create the git tag, skip validation.\", false)\n .option(\"--no-push\", \"Create the tag locally but do not push to remote.\", false)\n .action(async (path, opts, cmd) => {\n await handlers.publish(path, opts, cmd.optsWithGlobals());\n });\n\n return program;\n}\n","#!/usr/bin/env node\n\nimport { createProgram, type CommandHandlers } from \"../generated/cli/program.js\";\nimport { VERSION } from \"../index.js\";\n\nconst notImplemented = () => {\n console.error(\"Not implemented yet\");\n process.exit(1);\n};\n\nconst handlers: CommandHandlers = {\n init: async (_opts, _globals) => notImplemented(),\n add: async (_pkg, _opts, _globals) => notImplemented(),\n sync: async (_opts, _globals) => notImplemented(),\n update: async (_pkg, _opts, _globals) => notImplemented(),\n diff: async (_pkg, _opts, _globals) => notImplemented(),\n materialize: async (_opts, _globals) => notImplemented(),\n check: async (_globals) => notImplemented(),\n publish: async (_path, _opts, _globals) => notImplemented(),\n};\n\nconst program = createProgram(handlers, VERSION);\nprogram.parse();\n"],"mappings":"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","names":["handlers","program"]}
@@ -0,0 +1,3 @@
1
+ declare const VERSION: string;
2
+
3
+ export { VERSION };
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import {
2
+ VERSION
3
+ } from "./chunk-5XXBSF75.js";
4
+ export {
5
+ VERSION
6
+ };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "agent-package-manager",
3
+ "version": "0.1.0",
4
+ "description": "Package manager for agent-contracts DSL — manage shared agent team definitions via GitHub registries",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "agent-pkg": "./dist/cli/index.js"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "cli-contract.yaml",
20
+ "README.md",
21
+ "LICENSE"
22
+ ],
23
+ "scripts": {
24
+ "generate": "cli-contracts generate",
25
+ "build": "npm run generate && tsup",
26
+ "clean": "rm -rf dist",
27
+ "typecheck": "tsc --noEmit",
28
+ "test": "vitest run",
29
+ "test:watch": "vitest",
30
+ "lint": "eslint src/",
31
+ "cli:validate": "cli-contracts validate -f cli-contract.yaml",
32
+ "generate:docs": "cli-contracts docs",
33
+ "prepublishOnly": "npm run clean && npm run build"
34
+ },
35
+ "keywords": [
36
+ "agent-contracts",
37
+ "agent-pkg",
38
+ "package-manager",
39
+ "dsl",
40
+ "github-registry",
41
+ "multi-agent",
42
+ "workflow",
43
+ "ai-agent"
44
+ ],
45
+ "author": "foo-ogawa",
46
+ "license": "MIT",
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/foo-ogawa/agent-package-manager.git"
50
+ },
51
+ "bugs": {
52
+ "url": "https://github.com/foo-ogawa/agent-package-manager/issues"
53
+ },
54
+ "homepage": "https://github.com/foo-ogawa/agent-package-manager#readme",
55
+ "engines": {
56
+ "node": ">=20.0.0"
57
+ },
58
+ "dependencies": {
59
+ "commander": "^14.0.3",
60
+ "yaml": "^2.8.3"
61
+ },
62
+ "devDependencies": {
63
+ "@types/node": "^22.0.0",
64
+ "cli-contracts": "^0.2.1",
65
+ "tsup": "^8.5.0",
66
+ "tsx": "^4.21.0",
67
+ "typescript": "^5.8.0",
68
+ "vitest": "^3.1.0"
69
+ },
70
+ "peerDependencies": {
71
+ "agent-contracts": ">=0.17.0",
72
+ "agent-contracts-runtime": ">=0.5.0"
73
+ },
74
+ "peerDependenciesMeta": {
75
+ "agent-contracts": {
76
+ "optional": true
77
+ },
78
+ "agent-contracts-runtime": {
79
+ "optional": true
80
+ }
81
+ }
82
+ }