@appweaver/cli 1.0.22 → 1.0.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appweaver/cli",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "Appweaver - the backend framework for AI-first development (@cli)",
5
5
  "author": "Luka Matosevic",
6
6
  "license": "MIT",
@@ -18,7 +18,7 @@ provides factory methods for creating resource models, services, policies, and r
18
18
  - `appweaver.json` / `appweaver.{env}.json` - central configuration
19
19
  - `Dockerfile` - Docker image definition
20
20
 
21
- **IMPORTANT:** `{env}` is controlled by `NODE_ENV` evironment variable.
21
+ **IMPORTANT:** `{env}` is controlled by `NODE_ENV` environment variable.
22
22
 
23
23
  ## Application entrypoint
24
24
 
package/skill/SKILL.md CHANGED
@@ -553,7 +553,8 @@ weaver openapi --format yaml # generate schema in yaml
553
553
  weaver update # update all @appweaver/* packages to latest
554
554
  weaver update @appweaver/core @appweaver/cli # update specific packages
555
555
  weaver update --targetVersion 1.2.3 # update to a specific version
556
- weaver update --noSkill # skip updating AI agent skill files
556
+ weaver update --noSkill # skip updating AI agent skill files (.claude, .agents, …)
557
+ weaver update --noGuidelines # skip updating AI agent guideline files (AGENTS.md, CLAUDE.md)
557
558
  weaver update --force # force update despite peerDependency mismatches
558
559
  ```
559
560
 
@@ -205,9 +205,10 @@ Update the Appweaver packages.
205
205
 
206
206
  **Options:**
207
207
 
208
- | Option | Description | Default |
209
- |-----------------------------------|------------------------------------------------------------|------------|
210
- | `--targetVersion [targetVersion]` | The version to update the packages to | `"latest"` |
211
- | `--noSkill` | Skip updating AI agents skill files in the current project | `false` |
212
- | `-f, --force` | Force update despite peerDependency version mismatches | `false` |
213
- | `--verbose` | Print verbose output | `false` |
208
+ | Option | Description | Default |
209
+ |-----------------------------------|-------------------------------------------------------------------------|------------|
210
+ | `--targetVersion [targetVersion]` | The version to update the packages to | `"latest"` |
211
+ | `--noSkill` | Skip updating AI agents skill files in agent dirs (`.claude`, `.agents`, …) | `false` |
212
+ | `--noGuidelines` | Skip updating AI agents guideline files (`AGENTS.md`, `CLAUDE.md`) | `false` |
213
+ | `-f, --force` | Force update despite peerDependency version mismatches | `false` |
214
+ | `--verbose` | Print verbose output | `false` |
@@ -8,6 +8,23 @@ distinct parts:
8
8
 
9
9
  ---
10
10
 
11
+ ## Module formats (ESM & CommonJS)
12
+
13
+ The package ships **both** an ESM and a CommonJS build, selected automatically via the `exports` map — no configuration
14
+ needed. Both import styles work for the main entry and the `/angular` subpath:
15
+
16
+ ```ts
17
+ // ESM (tree-shakable — preferred for bundlers like Angular/Vite/webpack prod builds)
18
+ import { FetchClient, ClientError } from '@appweaver/client';
19
+ import { AngularClient } from '@appweaver/client/angular';
20
+
21
+ // CommonJS (e.g. plain Node scripts without a build step)
22
+ const { FetchClient, ClientError } = require('@appweaver/client');
23
+ const { AngularClient } = require('@appweaver/client/angular');
24
+ ```
25
+
26
+ ---
27
+
11
28
  ## `weaver-client` CLI
12
29
 
13
30
  ```
@@ -44,6 +61,7 @@ Reads an OpenAPI v3 schema and generates TypeScript types and a typed client cla
44
61
  | `--typesPath [path]` | Output path for generated TypeScript types only | same as `outputPath` |
45
62
  | `--clientPath [path]` | Output path for generated client class only | same as `outputPath` |
46
63
  | `--clientName [name]` | Custom name for the generated client class | derived from schema title |
64
+ | `--framework [name]` | Framework for the generated client class (`fetch` or `angular`) | `fetch` |
47
65
  | `--typesOnly` | Generate TypeScript types only, skip client class generation | `false` |
48
66
  | `--clientOnly` | Generate client class only, skip TypeScript types generation | `false` |
49
67
  | `--noTypes` | Generate client class without TypeScript type support | `false` |
@@ -51,8 +69,8 @@ Reads an OpenAPI v3 schema and generates TypeScript types and a typed client cla
51
69
  **Generation process:**
52
70
 
53
71
  1. Reads and parses the schema (JSON or YAML, local or remote).
54
- 2. Generates TypeScript interfaces via `openapi-typescript`, enriching them with JSDoc validation tags
55
- (`@minLength`, `@maxLength`, `@minimum`, `@maximum`, `@pattern`, `@format`).
72
+ 2. Generates TypeScript interfaces via `openapi-typescript`, enriching them with JSDoc validation tags (`@minLength`,
73
+ `@maxLength`, `@minimum`, `@maximum`, `@pattern`, `@format`).
56
74
  3. Deduplicates union types and extracts inline schemas to named exported types.
57
75
  4. Classifies all API paths into route groups: resources, auth, account, health, files, and custom.
58
76
  5. Emits a typed client class extending `FetchClient<Paths>` with a getter for each route group. Resources with
@@ -158,6 +176,28 @@ The generated second type argument to `resourceClient` (e.g., `['aggregate', 'ex
158
176
  removes those methods from the returned `ResourceClient` at the TypeScript level, preventing accidental calls to
159
177
  operations not exposed by the API.
160
178
 
179
+ ### Angular client (`--framework angular`)
180
+
181
+ Passing `--framework angular` generates a client class extending `AngularClient` instead of `FetchClient`. The generated
182
+ class is constructed with Angular's `HttpClient` and all its methods return RxJS `Observable`s instead of
183
+ `Promise`s:
184
+
185
+ ```ts
186
+ import { ClientConfig, ClientError } from '@appweaver/client';
187
+ import { AngularClient } from '@appweaver/client/angular';
188
+ import { HttpClient } from '@angular/common/http';
189
+
190
+ // In an Angular service or provider:
191
+ const client = new CMSAPIClient(httpClient, { baseUrl: 'http://localhost:3000' });
192
+ client.user.query({ filter: { enabled: true } }).subscribe((users) => {
193
+ });
194
+ ```
195
+
196
+ **Important:** `AngularClient` is only available from the `@appweaver/client/angular` subpath — it is not exported from
197
+ the main `@appweaver/client` entry point. This keeps `rxjs` completely out of the module graph (runtime and types) for
198
+ `FetchClient` users. `rxjs` is an **optional peer dependency**: Angular projects already have it installed, while
199
+ fetch-only projects do not need it at all.
200
+
161
201
  ---
162
202
 
163
203
  ## Runtime library
@@ -438,8 +478,8 @@ const data = await client.sendRequest('get', '/api/custom-endpoint');
438
478
 
439
479
  ### `sendRequestRaw`
440
480
 
441
- Returns the raw `{ data, error, response }` tuple from `openapi-fetch` without throwing. Useful when the caller
442
- needs to inspect error details or branch on status codes.
481
+ Returns the raw `{ data, error, response }` tuple from `openapi-fetch` without throwing. Useful when the caller needs to
482
+ inspect error details or branch on status codes.
443
483
 
444
484
  ```ts
445
485
  const { data, error, response } = await client.sendRequestRaw('post', '/api/custom-endpoint', {
@@ -13,13 +13,15 @@ function updateCommand(program) {
13
13
  .argument('[packages...]', 'A list of packages to update (e.g. @appweaver/core @appweaver/cli).' +
14
14
  'Defaults to all currently installed @appweaver/* packages.')
15
15
  .option('--targetVersion [targetVersion]', 'The version to update the packages.', 'latest')
16
- .option('--noSkill', 'Skip updating AI agents skill files in the current project.')
16
+ .option('--noSkill', 'Skip updating AI agents skill files in the agent directories (e.g. .claude, .agents) of the current project.')
17
+ .option('--noGuidelines', 'Skip updating AI agents guideline files (e.g. AGENTS.md, CLAUDE.md) in the current project.')
17
18
  .option('-f, --force', 'Force update despite peerDependency version mismatches.')
18
19
  .option('--verbose', 'Print verbose output.')
19
20
  .action(async (packages, _, command) => {
20
21
  const quiet = !command.getOptionValue('verbose');
21
22
  const force = command.getOptionValue('force');
22
23
  const updateSkill = !command.getOptionValue('noSkill');
24
+ const updateGuidelines = !command.getOptionValue('noGuidelines');
23
25
  const targetVersion = command.getOptionValue('targetVersion');
24
26
  // Load all currently installed packages
25
27
  const installedPackages = {};
@@ -71,8 +73,8 @@ function updateCommand(program) {
71
73
  }
72
74
  const status = await (0, update_packages_1.updatePackages)(appweaverPackages, targetVersion, force, quiet);
73
75
  if (status === 0) {
74
- if (updateSkill) {
75
- await (0, update_skill_1.updateSkillFiles)(quiet);
76
+ if (updateSkill || updateGuidelines) {
77
+ await (0, update_skill_1.updateSkillFiles)(quiet, updateSkill, updateGuidelines);
76
78
  }
77
79
  console.log(`Successfully updated packages to ${targetVersion} version.`);
78
80
  }
@@ -3,6 +3,8 @@
3
3
  * to specified agent directories and updating references in guideline files.
4
4
  *
5
5
  * @param {boolean} quiet - If true, suppresses logging output; otherwise, logs actions performed.
6
+ * @param {boolean} updateSkill - If true, copies skill files into agent directories (e.g. .claude, .agents).
7
+ * @param {boolean} updateGuidelines - If true, updates AI guideline files (e.g. AGENTS.md, CLAUDE.md).
6
8
  * @return {Promise<void>} A promise that resolves when the update process is complete.
7
9
  */
8
- export declare function updateSkillFiles(quiet: boolean): Promise<void>;
10
+ export declare function updateSkillFiles(quiet: boolean, updateSkill?: boolean, updateGuidelines?: boolean): Promise<void>;
@@ -12,9 +12,14 @@ const node_path_1 = __importDefault(require("node:path"));
12
12
  * to specified agent directories and updating references in guideline files.
13
13
  *
14
14
  * @param {boolean} quiet - If true, suppresses logging output; otherwise, logs actions performed.
15
+ * @param {boolean} updateSkill - If true, copies skill files into agent directories (e.g. .claude, .agents).
16
+ * @param {boolean} updateGuidelines - If true, updates AI guideline files (e.g. AGENTS.md, CLAUDE.md).
15
17
  * @return {Promise<void>} A promise that resolves when the update process is complete.
16
18
  */
17
- async function updateSkillFiles(quiet) {
19
+ async function updateSkillFiles(quiet, updateSkill = true, updateGuidelines = true) {
20
+ if (!updateSkill && !updateGuidelines) {
21
+ return;
22
+ }
18
23
  const projectDir = process.cwd();
19
24
  const skillDir = node_path_1.default.join(__dirname, '..', 'skill');
20
25
  if (!(await exists(skillDir))) {
@@ -40,6 +45,11 @@ async function updateSkillFiles(quiet) {
40
45
  continue;
41
46
  }
42
47
  foundAgentDirs.push(agentDir);
48
+ // Skip copying skill files when disabled, but keep the discovered agent
49
+ // dir so guideline references can still point to it.
50
+ if (!updateSkill) {
51
+ continue;
52
+ }
43
53
  // Copy skill directory to {agentDir}/skills/appweaver/
44
54
  const skillDestPath = node_path_1.default.join(agentDirPath, 'skills', 'appweaver');
45
55
  await promises_1.default.cp(skillDir, skillDestPath, {
@@ -50,6 +60,10 @@ async function updateSkillFiles(quiet) {
50
60
  console.log(`Updated skill files in ${node_path_1.default.join(agentDir, 'skills', 'appweaver')}\n`);
51
61
  }
52
62
  }
63
+ // Nothing more to do when guideline files should not be updated
64
+ if (!updateGuidelines) {
65
+ return;
66
+ }
53
67
  let firstAgentDir = foundAgentDirs[0];
54
68
  for (const guidelinesFile of ['AGENTS.md', 'CLAUDE.md']) {
55
69
  const guidelinesFilePath = node_path_1.default.join(projectDir, guidelinesFile);
@@ -57,14 +71,17 @@ async function updateSkillFiles(quiet) {
57
71
  if (!(await exists(guidelinesFilePath))) {
58
72
  continue;
59
73
  }
60
- // If no agent-specific dir was discovered, create new generic .agents dir
74
+ // If no agent-specific dir was discovered, fall back to a generic .agents
75
+ // dir and, unless skill updates are disabled, populate it with skill files.
61
76
  if (!firstAgentDir) {
62
77
  firstAgentDir = '.agents';
63
- const skillDestPath = node_path_1.default.join(node_path_1.default.join(projectDir, firstAgentDir), 'skills', 'appweaver');
64
- await promises_1.default.cp(skillDir, skillDestPath, {
65
- recursive: true,
66
- filter: (src) => !src.endsWith('GUIDELINES.md')
67
- });
78
+ if (updateSkill) {
79
+ const skillDestPath = node_path_1.default.join(node_path_1.default.join(projectDir, firstAgentDir), 'skills', 'appweaver');
80
+ await promises_1.default.cp(skillDir, skillDestPath, {
81
+ recursive: true,
82
+ filter: (src) => !src.endsWith('GUIDELINES.md')
83
+ });
84
+ }
68
85
  }
69
86
  // Replace guideline file path references with path references in first
70
87
  // discovered agents dir