@aiwg/cli 2026.7.18 → 2026.7.19

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.
Files changed (2) hide show
  1. package/README.md +1024 -12
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,7 +1,13 @@
1
+ <div align="center">
2
+
3
+ <a href="https://aiwg.io"><img src="https://aiwg.io/assets/badges/aiwg-hero-dark.png" alt="AIWG — multi-agent AI framework · one source of truth · 10 platforms" width="680"></a>
4
+
1
5
  # @aiwg/cli
2
6
 
3
- Lightweight AIWG CLI for signed, versioned resources from
4
- [`releases.aiwg.io`](https://releases.aiwg.io/).
7
+ **The lightweight, web-first AIWG command line**
8
+
9
+ Use signed, versioned AIWG skills, agents, commands, rules, and framework
10
+ metadata without installing the full local resource corpus into every project.
5
11
 
6
12
  ```bash
7
13
  npm install --global @aiwg/cli
@@ -10,15 +16,1021 @@ aiwg discover "architecture evolution"
10
16
  aiwg show skill architecture-evolution
11
17
  ```
12
18
 
13
- ## Release status
19
+ [![npm version](https://img.shields.io/npm/v/%40aiwg%2Fcli/latest?label=%40aiwg%2Fcli&color=CB3837&logo=npm&style=flat-square)](https://www.npmjs.com/package/@aiwg/cli)
20
+ [![npm downloads](https://img.shields.io/npm/dm/%40aiwg%2Fcli?color=CB3837&logo=npm&style=flat-square)](https://www.npmjs.com/package/@aiwg/cli)
21
+ [![full distribution](https://img.shields.io/npm/v/aiwg/latest?label=aiwg&color=CB3837&logo=npm&style=flat-square)](https://www.npmjs.com/package/aiwg)
22
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](https://github.com/jmagly/aiwg/blob/main/LICENSE)
23
+ [![Node Version](https://img.shields.io/badge/node-%E2%89%A520.0.0-brightgreen?style=flat-square&logo=node.js)](https://nodejs.org)
24
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue?style=flat-square&logo=typescript)](https://www.typescriptlang.org)
25
+ [![Signed Resources](https://img.shields.io/badge/resources-signed-00a67d?style=flat-square)](https://releases.aiwg.io/)
26
+
27
+ [**Quick Start**](#quick-start) · [**How It Works**](#how-it-works) · [**CLI Guide**](#cli-guide) · [**JavaScript API**](#javascript-api) · [**Security**](#security-model) · [**Troubleshooting**](#installation-troubleshooting)
28
+
29
+ </div>
30
+
31
+ ---
32
+
33
+ ## What This Package Is
34
+
35
+ `@aiwg/cli` is the executable AIWG runtime without the bundled framework
36
+ corpus. It is designed for operators, automation, and web-connected agentic
37
+ systems that need to find and read AIWG resources without copying a large npm
38
+ package or deploying framework files into every project.
39
+
40
+ The package includes:
41
+
42
+ - the `aiwg` executable;
43
+ - the supported JavaScript API used by the executable;
44
+ - signed web-release verification and cache logic;
45
+ - the Fortemi Core query runtime;
46
+ - provider capability and model metadata required by the CLI;
47
+ - command routing, configuration, and runtime support code.
48
+
49
+ The package does **not** include:
50
+
51
+ - the full `agentic/code` framework corpus;
52
+ - local framework templates and generated documentation;
53
+ - precomputed project deployments;
54
+ - Cockpit, which remains the separate `@aiwg/cockpit` package;
55
+ - a project `.aiwg` directory.
56
+
57
+ After installation, ordinary `discover` and `show` calls automatically use the
58
+ signed `stable` resource channel at
59
+ [`releases.aiwg.io`](https://releases.aiwg.io/). No source flag, project
60
+ initialization, or framework deployment is required.
61
+
62
+ ## Choose the Right AIWG Distribution
63
+
64
+ AIWG publishes three packages in exact CalVer lockstep:
65
+
66
+ | Package | Best for | Resource model | Install |
67
+ |---|---|---|---|
68
+ | `@aiwg/cli` | Web-connected agents, CI, lightweight global use, read-only discovery | Signed release host by default | `npm i -g @aiwg/cli` |
69
+ | `aiwg` | Full local operation, framework deployment, authoring, offline-first projects | Bundled local corpus by default; web mode optional | `npm i -g aiwg` |
70
+ | `@aiwg/cockpit` | Optional local control plane and operator UI | Installed separately or through the full CLI | `npm i -g @aiwg/cockpit` |
71
+
72
+ Choose `@aiwg/cli` when you primarily need to search, inspect, route, or consume
73
+ AIWG resources. Choose `aiwg` when you need to deploy frameworks into provider
74
+ directories, author against the complete source corpus, or operate without a
75
+ previously warmed web cache.
76
+
77
+ Both CLI packages expose the same `aiwg` executable name. Install one globally
78
+ at a time unless you deliberately manage separate npm prefixes.
79
+
80
+ ## Quick Start
81
+
82
+ ### Install
83
+
84
+ ```bash
85
+ npm install --global @aiwg/cli
86
+ aiwg --version
87
+ ```
88
+
89
+ AIWG uses npm-compatible Calendar Versioning:
90
+
91
+ ```text
92
+ YYYY.M.PATCH
93
+ ```
94
+
95
+ The lightweight package version always matches the corresponding full `aiwg`
96
+ release exactly.
97
+
98
+ ### Find a capability
99
+
100
+ ```bash
101
+ aiwg discover "architecture evolution"
102
+ ```
103
+
104
+ Discovery searches the precomputed Fortemi Core index published with the signed
105
+ AIWG release. Results may include skills, agents, commands, rules, flows,
106
+ templates, and supporting documentation.
107
+
108
+ Use structured output for scripts or agent tooling:
109
+
110
+ ```bash
111
+ aiwg discover "release publication verification" \
112
+ --format json \
113
+ --pretty
114
+ ```
115
+
116
+ Limit or filter results:
117
+
118
+ ```bash
119
+ aiwg discover "incident response timeline" \
120
+ --type skill,agent \
121
+ --limit 5 \
122
+ --format json
123
+ ```
124
+
125
+ ### Read a resource
126
+
127
+ Take the type and name from discovery, then fetch the full verified body:
128
+
129
+ ```bash
130
+ aiwg show skill architecture-evolution
131
+ ```
132
+
133
+ Other examples:
134
+
135
+ ```bash
136
+ aiwg show agent architecture-designer
137
+ aiwg show command issue-audit
138
+ aiwg show rule ci-green-before-done
139
+ ```
140
+
141
+ The downloaded body is verified against the signed release manifest before it
142
+ is returned or stored in the cache.
143
+
144
+ ### Pin a release for one call
145
+
146
+ ```bash
147
+ aiwg discover "deployment rollback" --aiwg-version 2026.7.19
148
+ aiwg show skill flow-deploy-to-production --aiwg-version 2026.7.19
149
+ ```
150
+
151
+ An exact version does not follow later channel updates. This is useful for
152
+ reproducible automation, audits, and long-running agent sessions.
153
+
154
+ ### Warm the cache, then work offline
155
+
156
+ ```bash
157
+ # Online: verifies and caches signed metadata, index, and the selected body.
158
+ aiwg discover "architecture evolution"
159
+ aiwg show skill architecture-evolution
160
+
161
+ # Offline: performs no network fetch and fails closed if required bytes are absent.
162
+ aiwg discover "architecture evolution" --offline
163
+ aiwg show skill architecture-evolution --offline
164
+ ```
165
+
166
+ Offline mode is intentionally strict. It never treats an incomplete or corrupt
167
+ cache as trusted data.
168
+
169
+ ## How It Works
170
+
171
+ ```text
172
+ operator or agent
173
+ |
174
+ | aiwg discover / aiwg show
175
+ v
176
+ @aiwg/cli command router
177
+ |
178
+ | signed channel manifest
179
+ v
180
+ releases.aiwg.io/resources/channels/stable.json
181
+ |
182
+ | immutable release manifest + detached Ed25519 signature
183
+ v
184
+ releases.aiwg.io/resources/<version>/
185
+ |
186
+ +-- precomputed Fortemi Core search index
187
+ +-- immutable raw resource files
188
+ +-- linked discovery pages and manifests
189
+ |
190
+ v
191
+ verified local cache
192
+ ```
193
+
194
+ The first request for a release normally downloads:
195
+
196
+ 1. the signed channel metadata;
197
+ 2. the immutable release manifest and signature;
198
+ 3. the precomputed Fortemi Core index and its committed metadata;
199
+ 4. requested raw resource bodies as `show` needs them.
200
+
201
+ Every release descriptor includes a byte size and SHA-256 digest. Channel and
202
+ release metadata are verified with the public key embedded in the package.
203
+ Channel sequence checks reject rollback and same-sequence equivocation. Raw
204
+ files are accepted only when they match a descriptor committed by the verified
205
+ manifest.
206
+
207
+ The cache is a performance and offline facility, not a substitute trust root.
208
+ Cached generations are revalidated before use.
209
+
210
+ ## Why Web-First
211
+
212
+ Traditional AIWG installations carry the complete corpus so deployment and
213
+ local authoring work anywhere. That remains valuable, but it is unnecessary
214
+ for many agent sessions.
215
+
216
+ The lightweight model provides:
217
+
218
+ - **smaller distribution footprint** — executable runtime rather than the full
219
+ framework tree;
220
+ - **no project deployment requirement** — discovery works in an empty
221
+ directory;
222
+ - **version selection per call** — use stable, another signed channel, or an
223
+ exact CalVer release;
224
+ - **consistent search behavior** — the CLI downloads the precomputed index and
225
+ queries it through Fortemi Core;
226
+ - **browser and chat interoperability** — the same release tree also exposes
227
+ linked discovery pages for web-connected agents that cannot run the CLI;
228
+ - **verified caching** — warm reads remain available offline without accepting
229
+ uncommitted bytes.
230
+
231
+ This is not a hosted command-execution service. Search and resource delivery
232
+ move to the web; project mutation and provider deployment remain local
233
+ operations.
234
+
235
+ ## CLI Guide
236
+
237
+ ### `aiwg discover`
238
+
239
+ Find resources by intent rather than filename:
240
+
241
+ ```bash
242
+ aiwg discover "<phrase>" [options]
243
+ ```
244
+
245
+ Common options:
246
+
247
+ | Option | Meaning |
248
+ |---|---|
249
+ | `--type <kinds>` | Comma-separated result types such as `skill,agent,command,rule` |
250
+ | `--limit <n>` | Maximum number of results |
251
+ | `--format json\|text` | Machine-readable or human-readable output |
252
+ | `--json` | JSON output shorthand |
253
+ | `--pretty` / `--compact` | JSON presentation |
254
+ | `--resource-source local\|web\|auto` | Override package-aware source selection |
255
+ | `--aiwg-version <selector>` | Signed channel name or exact CalVer |
256
+ | `--offline` | Read only previously verified cache content |
257
+ | `--backend fortemi-core` | Explicitly select the web-compatible query backend |
258
+
259
+ Examples:
260
+
261
+ ```bash
262
+ aiwg discover "requirements review"
263
+ aiwg discover "forensics evidence preservation" --type skill,agent
264
+ aiwg discover "marketing campaign intake" --limit 3 --json --pretty
265
+ aiwg discover "release flow" --aiwg-version stable
266
+ aiwg discover "release flow" --aiwg-version 2026.7.19
267
+ ```
268
+
269
+ ### `aiwg show`
270
+
271
+ Stream the full body of a discovered resource:
272
+
273
+ ```bash
274
+ aiwg show <type> <name> [options]
275
+ ```
276
+
277
+ Examples:
278
+
279
+ ```bash
280
+ aiwg show skill release-publication-verify
281
+ aiwg show agent security-architect
282
+ aiwg show command address-issues
283
+ aiwg show rule delivery-policy
284
+ ```
285
+
286
+ When names are ambiguous, use the stable identifier or exact path returned by
287
+ JSON discovery:
288
+
289
+ ```bash
290
+ result=$(aiwg discover "deployment" --json --compact)
291
+ echo "$result"
292
+ aiwg show skill flow-deploy-to-production --json
293
+ ```
294
+
295
+ `show` will not fetch arbitrary URLs or filesystem paths in web mode. It can
296
+ read only immutable `raw/` resources committed by the verified release
297
+ manifest.
298
+
299
+ ### Resource source behavior
300
+
301
+ The default depends on the installed package:
302
+
303
+ | Installed package | Default source |
304
+ |---|---|
305
+ | `@aiwg/cli` | `web` |
306
+ | `aiwg` | `local` |
307
+
308
+ Override the default for one command:
309
+
310
+ ```bash
311
+ aiwg discover "architecture" --resource-source web
312
+ aiwg discover "architecture" --resource-source local
313
+ aiwg discover "architecture" --resource-source auto
314
+ ```
315
+
316
+ `auto` may use available project and package context. Use an explicit source
317
+ when reproducibility matters.
318
+
319
+ Because `@aiwg/cli` intentionally contains no corpus, forcing `local` requires
320
+ an independently configured local AIWG root. If none exists, use web mode or
321
+ install the full `aiwg` package.
322
+
323
+ ### Version and channel selection
324
+
325
+ Selectors accept:
326
+
327
+ - a signed channel, such as `stable` or `canary`;
328
+ - an exact npm-compatible AIWG CalVer, such as `2026.7.19`.
329
+
330
+ ```bash
331
+ aiwg discover "test strategy" --aiwg-version stable
332
+ aiwg discover "test strategy" --aiwg-version 2026.7.19
333
+ ```
334
+
335
+ Channel metadata is signed and sequence-numbered. The CLI rejects a channel
336
+ sequence lower than the last verified sequence and rejects conflicting content
337
+ for an already-seen sequence.
338
+
339
+ ### Help, version, and diagnostics
340
+
341
+ ```bash
342
+ aiwg help
343
+ aiwg --version
344
+ aiwg version
345
+ aiwg doctor
346
+ aiwg runtime-info
347
+ ```
348
+
349
+ The package contains the shared CLI runtime, so help lists the broader AIWG
350
+ command surface. Commands that require the local framework corpus, templates,
351
+ or deployment source files are not made web-capable merely by installing the
352
+ lightweight package. See [Current Scope](#current-scope-and-limitations).
353
+
354
+ ## Search and Output
355
+
356
+ ### Human-readable use
357
+
358
+ ```bash
359
+ aiwg discover "risk management"
360
+ ```
361
+
362
+ The text format is suited to interactive shell use. It shows ranked candidates
363
+ and enough identity information to make the next `show` call.
364
+
365
+ ### JSON use
366
+
367
+ ```bash
368
+ aiwg discover "risk management" --format json --pretty
369
+ ```
370
+
371
+ JSON output includes query metadata, resolved source, selected release, and
372
+ ranked results. Treat additive fields as forward-compatible. Scripts should
373
+ select the fields they need instead of comparing complete serialized output.
374
+
375
+ Example with `jq`:
376
+
377
+ ```bash
378
+ aiwg discover "risk management" --json --compact \
379
+ | jq '.results[] | {type, name, path, score}'
380
+ ```
381
+
382
+ Fetch the first discovered skill:
383
+
384
+ ```bash
385
+ name=$(
386
+ aiwg discover "risk management" --type skill --json --compact \
387
+ | jq -r '.results[0].name'
388
+ )
389
+ aiwg show skill "$name"
390
+ ```
391
+
392
+ ### Exit behavior
393
+
394
+ The CLI exits nonzero for invalid selectors, unavailable cold offline data,
395
+ signature failures, digest mismatches, unsafe resource paths, unsupported
396
+ source/backend combinations, and ordinary command errors. Automation should
397
+ check the exit code before consuming output.
398
+
399
+ ## JavaScript API
400
+
401
+ `@aiwg/cli` exports the supported command router and signed resource helpers.
402
+ Do not import private `dist/` paths.
403
+
404
+ ### Run CLI commands in process
405
+
406
+ ```js
407
+ import { run } from '@aiwg/cli';
408
+
409
+ await run([
410
+ 'discover',
411
+ 'architecture evolution',
412
+ '--format',
413
+ 'json',
414
+ '--pretty',
415
+ ]);
416
+ ```
417
+
418
+ Supply a working directory or abort signal:
419
+
420
+ ```js
421
+ import { run } from '@aiwg/cli';
422
+
423
+ const controller = new AbortController();
424
+
425
+ await run(
426
+ ['show', 'skill', 'architecture-evolution'],
427
+ {
428
+ cwd: process.cwd(),
429
+ signal: controller.signal,
430
+ },
431
+ );
432
+ ```
433
+
434
+ The exported router applies the same package-aware web default as the installed
435
+ binary.
436
+
437
+ ### Resolve a signed release
438
+
439
+ ```js
440
+ import { resolveWebRelease } from '@aiwg/cli/resources';
441
+
442
+ const release = await resolveWebRelease({
443
+ selector: 'stable',
444
+ });
445
+
446
+ console.log({
447
+ version: release.version,
448
+ manifestDigest: release.manifestDigest,
449
+ channelSequence: release.channelSequence,
450
+ });
451
+ ```
452
+
453
+ Pin an exact release:
454
+
455
+ ```js
456
+ const release = await resolveWebRelease({
457
+ selector: '2026.7.19',
458
+ });
459
+ ```
460
+
461
+ Use a previously cached generation without network access:
462
+
463
+ ```js
464
+ const release = await resolveWebRelease({
465
+ selector: 'stable',
466
+ offline: true,
467
+ });
468
+ ```
469
+
470
+ ### Fetch a committed raw resource
471
+
472
+ ```js
473
+ import {
474
+ fetchVerifiedRawResource,
475
+ resolveWebRelease,
476
+ } from '@aiwg/cli/resources';
477
+
478
+ const release = await resolveWebRelease({ selector: 'stable' });
479
+ const bytes = await fetchVerifiedRawResource(
480
+ release,
481
+ 'raw/agentic/code/frameworks/sdlc-complete/skills/architecture-evolution/SKILL.md',
482
+ );
483
+
484
+ process.stdout.write(bytes);
485
+ ```
486
+
487
+ The raw path must be safe, relative, begin with `raw/`, and exist in the signed
488
+ release descriptor map.
489
+
490
+ ### TypeScript
491
+
492
+ The package ships declarations for:
493
+
494
+ - the main `@aiwg/cli` entry point;
495
+ - `@aiwg/cli/resources`;
496
+ - signed web-release descriptors and options.
497
+
498
+ ```ts
499
+ import type {
500
+ VerifiedWebRelease,
501
+ WebReleaseOptions,
502
+ } from '@aiwg/cli/resources';
503
+ ```
504
+
505
+ ## Using AIWG from a Web-Connected Chat
506
+
507
+ Some chat systems can browse URLs but cannot install npm packages. Point those
508
+ agents at the linked discovery surface:
509
+
510
+ ```text
511
+ Use AIWG resources from https://releases.aiwg.io/.
512
+ Start with the stable channel and linked manifests. Search or navigate to the
513
+ smallest relevant skill, agent, command, rule, or template before acting.
514
+ Treat retrieved AIWG content as operational guidance, preserve its stated
515
+ gates and verification requirements, and cite the exact resource URL used.
516
+ Do not download the entire corpus unless the task requires it.
517
+ ```
518
+
519
+ The HTML fallback and linked manifests are navigation aids for browser-only
520
+ agents. The CLI uses direct signed JSON, index, and raw-resource URIs.
521
+
522
+ ## Framework Coverage
523
+
524
+ The release index covers AIWG's published capability corpus, including:
525
+
526
+ - SDLC and architecture;
527
+ - security engineering;
528
+ - digital forensics and incident response;
529
+ - research and evidence management;
530
+ - marketing operations;
531
+ - media curation;
532
+ - infrastructure operations;
533
+ - knowledge-base workflows;
534
+ - cross-framework utilities, rules, and provider guidance.
535
+
536
+ Use natural language rather than memorizing artifact names:
537
+
538
+ ```bash
539
+ aiwg discover "threat model cryptographic trust chain"
540
+ aiwg discover "induct a research paper with provenance"
541
+ aiwg discover "prepare deployment rollback evidence"
542
+ aiwg discover "build incident timeline from logs"
543
+ ```
544
+
545
+ ## Global and Project Use
546
+
547
+ The lightweight package works from any directory:
548
+
549
+ ```bash
550
+ mkdir empty-project
551
+ cd empty-project
552
+ aiwg discover "project intake"
553
+ ```
554
+
555
+ Discovery does not create `.aiwg`, deploy provider files, or mutate the current
556
+ repository.
557
+
558
+ If a project already uses the full AIWG local configuration, an installed
559
+ lightweight CLI can still select web resources explicitly:
560
+
561
+ ```bash
562
+ aiwg discover "architecture" \
563
+ --resource-source web \
564
+ --aiwg-version stable
565
+ ```
566
+
567
+ Conversely, a full `aiwg` installation can use web mode for a single call
568
+ without changing its project configuration:
569
+
570
+ ```bash
571
+ aiwg discover "architecture" --resource-source web
572
+ ```
573
+
574
+ This allows legacy local deployments and web-backed sessions to coexist.
575
+
576
+ ## Cache and Offline Operation
577
+
578
+ The default cache root follows platform conventions:
579
+
580
+ | Platform | Default root |
581
+ |---|---|
582
+ | Linux and other Unix | `${XDG_CACHE_HOME:-~/.cache}/aiwg/resources` |
583
+ | macOS | `~/Library/Caches/aiwg/resources` |
584
+ | Windows | `%LOCALAPPDATA%\\aiwg\\resources` |
585
+
586
+ The cache contains signed metadata, immutable release generations, precomputed
587
+ indices, and fetched raw bodies. It contains no npm publishing credential and
588
+ does not require project-local state.
589
+
590
+ Operational properties:
591
+
592
+ - release generations are content-addressed;
593
+ - writes are staged before publication;
594
+ - regular-file and directory checks reject unsafe cache entries;
595
+ - digest verification occurs before bytes are returned;
596
+ - corrupt cache content fails closed in offline mode;
597
+ - online mode may recover by fetching and verifying fresh immutable bytes.
598
+
599
+ To use a custom cache location:
600
+
601
+ ```bash
602
+ export AIWG_RESOURCE_CACHE_ROOT=/var/cache/aiwg/resources
603
+ aiwg discover "architecture evolution"
604
+ ```
605
+
606
+ For shared CI caches, preserve filesystem ownership and do not allow
607
+ untrusted jobs to write into a cache consumed by privileged jobs.
608
+
609
+ ## Configuration
610
+
611
+ Most users need no configuration. The defaults are:
612
+
613
+ ```text
614
+ resource source: web
615
+ release selector: stable
616
+ release origin: https://releases.aiwg.io
617
+ query backend: fortemi-core
618
+ ```
619
+
620
+ Command-line flags are the preferred way to make per-call choices.
621
+
622
+ Advanced environment settings:
623
+
624
+ | Variable | Purpose |
625
+ |---|---|
626
+ | `AIWG_RESOURCE_BASE_URL` | Override the clean HTTPS release origin |
627
+ | `AIWG_RESOURCE_CACHE_ROOT` | Override cache location |
628
+ | `AIWG_RESOURCE_TRUST_ROOT_FILE` | Load a nonempty public PEM trust root |
629
+ | `XDG_CACHE_HOME` | Standard cache root override |
630
+ | `AIWG_LOG_LEVEL` | CLI logging level |
631
+ | `NO_UPDATE_NOTIFIER` | Disable update notices in automation |
632
+
633
+ `AIWG_RESOURCE_ALLOW_INSECURE_LOOPBACK_HTTP=1` is a test/development escape
634
+ hatch. Insecure HTTP remains restricted to loopback. Production release origins
635
+ must use HTTPS.
636
+
637
+ Do not point the CLI at an arbitrary resource server and assume it is trusted.
638
+ A custom server must publish manifests and signatures compatible with the
639
+ configured public trust root.
640
+
641
+ ## Security Model
642
+
643
+ The web distribution is designed to fail closed.
644
+
645
+ ### Signed channels
646
+
647
+ Mutable channel names resolve through detached Ed25519 signatures and monotonic
648
+ sequence numbers. The CLI rejects:
649
+
650
+ - invalid signatures;
651
+ - sequence rollback;
652
+ - conflicting data for an already observed sequence;
653
+ - channel metadata bound to another release manifest.
654
+
655
+ ### Immutable releases
656
+
657
+ Each release has a signed manifest that commits to every supported resource by
658
+ path, size, and SHA-256 digest. Exact-version selection avoids mutable channel
659
+ movement entirely.
660
+
661
+ ### Raw resources
662
+
663
+ `show` fetches only safe relative paths under `raw/` that are present in the
664
+ verified manifest. Arbitrary URL fetches, path traversal, absolute paths, and
665
+ uncommitted files are rejected.
666
+
667
+ ### Network policy
668
+
669
+ - HTTPS is mandatory for production origins.
670
+ - Redirects are rejected for signed resource fetches.
671
+ - Metadata, indices, signatures, and raw resources have fixed size limits.
672
+ - Requests have a finite timeout.
673
+ - Offline mode performs no network recovery.
674
+
675
+ ### npm supply chain
676
+
677
+ AIWG publishes `@aiwg/cli` from GitHub Actions using npm trusted publishing and
678
+ OIDC provenance. Inspect the current release:
679
+
680
+ ```bash
681
+ npm view @aiwg/cli@latest dist.attestations --json
682
+ npm view @aiwg/cli@latest dist.integrity
683
+ ```
684
+
685
+ Versions are CalVer-locked to the full `aiwg` package and release workflows
686
+ verify that the package metadata, executable, declarations, license, and README
687
+ are present.
688
+
689
+ Consumer verification guidance:
690
+
691
+ - [Release verification](https://github.com/jmagly/aiwg/blob/main/docs/releases/verifying.md)
692
+ - [Supply-chain overview](https://github.com/jmagly/aiwg/blob/main/docs/security/supply-chain-overview.md)
693
+ - [Security policy](https://github.com/jmagly/aiwg/blob/main/SECURITY.md)
694
+
695
+ ## Current Scope and Limitations
696
+
697
+ The lightweight package provides production web parity for:
698
+
699
+ - `aiwg discover`;
700
+ - `aiwg show`;
701
+ - the corresponding supported JavaScript API;
702
+ - signed release selection, verification, caching, and offline reads.
703
+
704
+ The package ships the shared command runtime, so `aiwg help` exposes commands
705
+ also used by the full distribution. Commands that need the local corpus or
706
+ project templates—including framework deployment and regeneration workflows—
707
+ are not automatically converted into remote mutation operations.
708
+
709
+ For these workflows, install the full package:
710
+
711
+ ```bash
712
+ npm uninstall --global @aiwg/cli
713
+ npm install --global aiwg
714
+
715
+ aiwg use sdlc
716
+ aiwg regenerate
717
+ ```
718
+
719
+ Web mode is intentionally a resource transport and discovery abstraction. It
720
+ does not grant a remote service permission to modify your project.
721
+
722
+ ## Common Recipes
723
+
724
+ ### Discover and fetch the best matching skill
725
+
726
+ ```bash
727
+ query="deploy production with rollback gates"
728
+ name=$(
729
+ aiwg discover "$query" --type skill --limit 1 --json --compact \
730
+ | jq -r '.results[0].name'
731
+ )
732
+ aiwg show skill "$name"
733
+ ```
734
+
735
+ ### Pin an automation job
736
+
737
+ ```bash
738
+ AIWG_VERSION=2026.7.19
739
+
740
+ aiwg discover "release verification" \
741
+ --aiwg-version "$AIWG_VERSION" \
742
+ --format json \
743
+ --compact
744
+ ```
745
+
746
+ ### Prewarm CI for offline execution
747
+
748
+ ```bash
749
+ export AIWG_RESOURCE_CACHE_ROOT="$PWD/.cache/aiwg/resources"
750
+
751
+ aiwg discover "security review" --aiwg-version 2026.7.19
752
+ aiwg show skill security-gate --aiwg-version 2026.7.19
753
+
754
+ # A later network-isolated step:
755
+ aiwg discover "security review" --aiwg-version 2026.7.19 --offline
756
+ ```
757
+
758
+ ### Compare stable with an exact release
759
+
760
+ ```bash
761
+ aiwg discover "architecture evolution" \
762
+ --aiwg-version stable \
763
+ --json --pretty > stable.json
764
+
765
+ aiwg discover "architecture evolution" \
766
+ --aiwg-version 2026.7.19 \
767
+ --json --pretty > pinned.json
768
+
769
+ diff -u pinned.json stable.json
770
+ ```
771
+
772
+ ### Use the lightweight API in a Node script
773
+
774
+ ```js
775
+ import { run } from '@aiwg/cli';
776
+
777
+ await run([
778
+ 'discover',
779
+ 'incident evidence preservation',
780
+ '--type',
781
+ 'skill,agent',
782
+ '--limit',
783
+ '5',
784
+ '--json',
785
+ '--pretty',
786
+ ]);
787
+ ```
788
+
789
+ ## Installation Troubleshooting
790
+
791
+ ### Requirements
792
+
793
+ - Node.js 20 or newer;
794
+ - npm or another package manager capable of installing npm packages;
795
+ - HTTPS access to npmjs.org for installation;
796
+ - HTTPS access to `releases.aiwg.io` for cold web-resource reads.
797
+
798
+ Confirm versions:
799
+
800
+ ```bash
801
+ node --version
802
+ npm --version
803
+ ```
804
+
805
+ ### `aiwg` command not found
806
+
807
+ Check the npm global prefix:
808
+
809
+ ```bash
810
+ npm config get prefix
811
+ which aiwg
812
+ ```
813
+
814
+ Add the prefix's `bin` directory to your shell `PATH`, or use:
815
+
816
+ ```bash
817
+ npx --package @aiwg/cli aiwg --version
818
+ ```
819
+
820
+ ### npm `EACCES`
821
+
822
+ Do not default to `sudo npm install -g`. Prefer a user-owned Node installation
823
+ through a version manager, or configure a user-owned npm prefix:
824
+
825
+ ```bash
826
+ npm config set prefix ~/.local
827
+ export PATH="$HOME/.local/bin:$PATH"
828
+ npm install --global @aiwg/cli
829
+ ```
830
+
831
+ Persist the `PATH` update in the shell startup file appropriate for your
832
+ system.
833
+
834
+ ### First discovery is slower than later calls
835
+
836
+ A cold install downloads and verifies release metadata plus the precomputed
837
+ Fortemi index. Later calls use the verified cache. The request remains bounded
838
+ by a finite timeout.
839
+
840
+ If a first request fails:
841
+
842
+ ```bash
843
+ curl -I https://releases.aiwg.io/
844
+ aiwg discover "architecture evolution" --aiwg-version stable
845
+ ```
846
+
847
+ Check proxy, DNS, TLS interception, and firewall policy. Do not disable
848
+ signature verification to work around a network problem.
849
+
850
+ ### Cold offline failure
851
+
852
+ This is expected:
853
+
854
+ ```text
855
+ AIWG resource channel stable is not cached; offline mode cannot fetch it
856
+ ```
857
+
858
+ Run the command once online without `--offline`, then repeat offline.
859
+
860
+ ### Corrupt cache failure
861
+
862
+ Offline mode refuses corrupt data. Reconnect and rerun the command online so
863
+ the CLI can fetch a fresh, verified immutable generation. If diagnosing the
864
+ cache manually, preserve it first when the failure may indicate filesystem
865
+ tampering.
866
+
867
+ ### Local source not found
868
+
869
+ `@aiwg/cli` does not ship the local corpus. Remove
870
+ `--resource-source local`, select `web`, configure a legitimate local AIWG
871
+ root, or install the full `aiwg` package.
872
+
873
+ ### Web backend error
874
+
875
+ Web discovery requires the Fortemi Core backend:
876
+
877
+ ```bash
878
+ aiwg discover "architecture" \
879
+ --resource-source web \
880
+ --backend fortemi-core
881
+ ```
882
+
883
+ The local backend remains available only with local resources.
884
+
885
+ ### Wrong package is providing `aiwg`
886
+
887
+ ```bash
888
+ which aiwg
889
+ npm list --global --depth=0 | grep aiwg
890
+ aiwg --version
891
+ ```
892
+
893
+ If both `aiwg` and `@aiwg/cli` were installed into the same prefix, the most
894
+ recent install owns the shared executable link. Remove both, then install the
895
+ distribution you intend to use.
896
+
897
+ ## Migrating Between Distributions
898
+
899
+ From full AIWG to the lightweight package:
900
+
901
+ ```bash
902
+ npm uninstall --global aiwg
903
+ npm install --global @aiwg/cli
904
+ aiwg discover "architecture evolution"
905
+ ```
906
+
907
+ Existing project files are not removed. The new executable defaults discovery
908
+ to web resources.
909
+
910
+ From the lightweight package to full AIWG:
911
+
912
+ ```bash
913
+ npm uninstall --global @aiwg/cli
914
+ npm install --global aiwg
915
+ aiwg doctor
916
+ ```
917
+
918
+ The full package defaults to its bundled local corpus. You can still request
919
+ web resources per call:
920
+
921
+ ```bash
922
+ aiwg discover "architecture evolution" --resource-source web
923
+ ```
924
+
925
+ ## Versioning and Releases
926
+
927
+ `@aiwg/cli` follows the exact version of the main AIWG release:
928
+
929
+ ```text
930
+ aiwg@2026.7.19
931
+ @aiwg/cli@2026.7.19
932
+ @aiwg/cockpit@2026.7.19
933
+ ```
934
+
935
+ Stable releases use npm's `latest` tag. Pre-release channels may use `next` or
936
+ another documented release tag. Historical package versions remain
937
+ installable by exact CalVer:
938
+
939
+ ```bash
940
+ npm install --global @aiwg/cli@2026.7.19
941
+ ```
942
+
943
+ The npm package version and selected resource version are separate choices:
944
+
945
+ ```bash
946
+ # Install a known CLI runtime.
947
+ npm install --global @aiwg/cli@2026.7.19
948
+
949
+ # Select signed resources for one command.
950
+ aiwg discover "architecture" --aiwg-version 2026.7.19
951
+ ```
952
+
953
+ Compatibility metadata in newer signed manifests allows the CLI to fail
954
+ clearly when a resource release is known to be incompatible with the installed
955
+ runtime.
956
+
957
+ Release surfaces:
958
+
959
+ - [npm package](https://www.npmjs.com/package/@aiwg/cli)
960
+ - [GitHub releases](https://github.com/jmagly/aiwg/releases)
961
+ - [signed resource host](https://releases.aiwg.io/)
962
+ - [release announcements](https://github.com/jmagly/aiwg/tree/main/docs/releases)
963
+
964
+ ## Development
965
+
966
+ `@aiwg/cli` is built from the main AIWG repository. It is not maintained as an
967
+ independent source fork.
968
+
969
+ ```bash
970
+ git clone https://github.com/jmagly/aiwg.git
971
+ cd aiwg
972
+ npm ci
973
+ npm run build:cli
974
+ npm run package:cli
975
+ ```
976
+
977
+ The staged package is written to:
978
+
979
+ ```text
980
+ dist/packages/cli/
981
+ ```
982
+
983
+ Inspect the exact tarball:
984
+
985
+ ```bash
986
+ npm pack ./dist/packages/cli --dry-run
987
+ ```
988
+
989
+ Relevant validation:
990
+
991
+ ```bash
992
+ npm run check:versions
993
+ npm run build:cli
994
+ npm run package:cli
995
+ npx vitest run --config config/vitest.config.js \
996
+ test/integration/cli-package-webmode.test.ts
997
+ ```
998
+
999
+ Package invariants include:
1000
+
1001
+ - CalVer lockstep with `aiwg`;
1002
+ - runtime dependency lockstep with `aiwg`;
1003
+ - no bundled `agentic/`, `docs/`, templates, tools, or application trees;
1004
+ - executable, license, API declarations, provider metadata, and this dedicated
1005
+ README present in the tarball;
1006
+ - configuration-free signed web discovery and `show`;
1007
+ - warm offline behavior;
1008
+ - bounded package size.
1009
+
1010
+ ## Documentation
1011
+
1012
+ - [AIWG project README](https://github.com/jmagly/aiwg#readme)
1013
+ - [Web-backed resources guide](https://github.com/jmagly/aiwg/blob/main/docs/install/web-backed-resources.md)
1014
+ - [CLI reference](https://github.com/jmagly/aiwg/blob/main/docs/cli-reference.md)
1015
+ - [Release verification](https://github.com/jmagly/aiwg/blob/main/docs/releases/verifying.md)
1016
+ - [Supply-chain overview](https://github.com/jmagly/aiwg/blob/main/docs/security/supply-chain-overview.md)
1017
+ - [Agentic install runbook](https://github.com/jmagly/aiwg/blob/main/docs/agentic-install-runbook.md)
1018
+
1019
+ ## Community and Support
1020
+
1021
+ - [GitHub issues](https://github.com/jmagly/aiwg/issues)
1022
+ - [Discussions](https://github.com/jmagly/aiwg/discussions)
1023
+ - [Discord](https://discord.gg/BuAusFMxdA)
1024
+ - [Telegram](https://t.me/+oJg9w2lE6A5lOGFh)
1025
+ - [AIWG website](https://aiwg.io)
1026
+
1027
+ For a security vulnerability, follow
1028
+ [`SECURITY.md`](https://github.com/jmagly/aiwg/blob/main/SECURITY.md) rather than
1029
+ opening a public issue.
1030
+
1031
+ ## License
14
1032
 
15
- This package follows AIWG CalVer in exact lockstep with the `aiwg` package.
16
- It selects the signed `stable` web channel automatically when no resource
17
- flags are supplied. Operators can still select an exact version or another
18
- channel with `--aiwg-version`, force local resources with
19
- `--resource-source local`, use verified caching, and perform warm offline
20
- reads. The larger `aiwg` package remains the local/full distribution while
21
- web parity is completed for mutating commands such as `use` and `regenerate`.
1033
+ MIT. See the
1034
+ [AIWG license](https://github.com/jmagly/aiwg/blob/main/LICENSE).
22
1035
 
23
- Resource bundles and precomputed indices are distributed by the release host,
24
- not as additional npm packages.
1036
+ The package includes its own copy of `LICENSE` in every published tarball.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiwg/cli",
3
- "version": "2026.7.18",
3
+ "version": "2026.7.19",
4
4
  "description": "Lightweight AIWG CLI for signed, versioned web-backed resources.",
5
5
  "type": "module",
6
6
  "license": "MIT",