@appweaver/cli 1.0.23 → 1.0.25

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.23",
3
+ "version": "1.0.25",
4
4
  "description": "Appweaver - the backend framework for AI-first development (@cli)",
5
5
  "author": "Luka Matosevic",
6
6
  "license": "MIT",
@@ -241,7 +241,7 @@ export async function createAdminUser(): Promise<void> {
241
241
  data: {
242
242
  firstName: 'Admin',
243
243
  lastName: 'Admin',
244
- email: 'admin@appweaver.com',
244
+ email: 'admin@appweaver.co',
245
245
  roles: {
246
246
  connectOrCreate: [
247
247
  {
package/skill/SKILL.md CHANGED
@@ -472,7 +472,7 @@ export async function createAdminUser(): Promise<void> {
472
472
  data: {
473
473
  firstName: 'Admin',
474
474
  lastName: 'Admin',
475
- email: 'admin@appweaver.com',
475
+ email: 'admin@appweaver.co',
476
476
  phone: '01234435',
477
477
  roles: {
478
478
  connectOrCreate: [
@@ -553,7 +553,7 @@ 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
557
  weaver update --force # force update despite peerDependency mismatches
558
558
  ```
559
559
 
@@ -205,9 +205,9 @@ 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
+ | `-f, --force` | Force update despite peerDependency version mismatches | `false` |
213
+ | `--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
  ```
@@ -52,8 +69,8 @@ Reads an OpenAPI v3 schema and generates TypeScript types and a typed client cla
52
69
  **Generation process:**
53
70
 
54
71
  1. Reads and parses the schema (JSON or YAML, local or remote).
55
- 2. Generates TypeScript interfaces via `openapi-typescript`, enriching them with JSDoc validation tags
56
- (`@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`).
57
74
  3. Deduplicates union types and extracts inline schemas to named exported types.
58
75
  4. Classifies all API paths into route groups: resources, auth, account, health, files, and custom.
59
76
  5. Emits a typed client class extending `FetchClient<Paths>` with a getter for each route group. Resources with
@@ -161,8 +178,8 @@ operations not exposed by the API.
161
178
 
162
179
  ### Angular client (`--framework angular`)
163
180
 
164
- Passing `--framework angular` generates a client class extending `AngularClient` instead of `FetchClient`. The
165
- generated class is constructed with Angular's `HttpClient` and all its methods return RxJS `Observable`s instead of
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
166
183
  `Promise`s:
167
184
 
168
185
  ```ts
@@ -172,7 +189,8 @@ import { HttpClient } from '@angular/common/http';
172
189
 
173
190
  // In an Angular service or provider:
174
191
  const client = new CMSAPIClient(httpClient, { baseUrl: 'http://localhost:3000' });
175
- client.user.query({ filter: { enabled: true } }).subscribe((users) => {});
192
+ client.user.query({ filter: { enabled: true } }).subscribe((users) => {
193
+ });
176
194
  ```
177
195
 
178
196
  **Important:** `AngularClient` is only available from the `@appweaver/client/angular` subpath — it is not exported from
@@ -460,8 +478,8 @@ const data = await client.sendRequest('get', '/api/custom-endpoint');
460
478
 
461
479
  ### `sendRequestRaw`
462
480
 
463
- Returns the raw `{ data, error, response }` tuple from `openapi-fetch` without throwing. Useful when the caller
464
- 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.
465
483
 
466
484
  ```ts
467
485
  const { data, error, response } = await client.sendRequestRaw('post', '/api/custom-endpoint', {
@@ -13,7 +13,7 @@ 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
17
  .option('-f, --force', 'Force update despite peerDependency version mismatches.')
18
18
  .option('--verbose', 'Print verbose output.')
19
19
  .action(async (packages, _, command) => {
@@ -1,8 +1,13 @@
1
1
  /**
2
- * Updates skill files and AI guidelines in the project by copying the skill directory
3
- * to specified agent directories and updating references in guideline files.
2
+ * Updates the Appweaver skill files in the project by copying the skill
3
+ * directory (including the framework GUIDELINES.md) into every discovered agent
4
+ * directory (e.g. `.claude`, `.agents`).
4
5
  *
5
- * @param {boolean} quiet - If true, suppresses logging output; otherwise, logs actions performed.
6
+ * The project's own root guidelines file (`AGENTS.md` / `CLAUDE.md`) is never
7
+ * touched here — it only references the framework guidelines from the skills
8
+ * directory, so it can be freely extended in the project.
9
+ *
10
+ * @param {boolean} quiet - If true, suppresses logging output; otherwise, logs actions are performed.
6
11
  * @return {Promise<void>} A promise that resolves when the update process is complete.
7
12
  */
8
13
  export declare function updateSkillFiles(quiet: boolean): Promise<void>;
@@ -8,10 +8,15 @@ const node_fs_1 = __importDefault(require("node:fs"));
8
8
  const promises_1 = __importDefault(require("node:fs/promises"));
9
9
  const node_path_1 = __importDefault(require("node:path"));
10
10
  /**
11
- * Updates skill files and AI guidelines in the project by copying the skill directory
12
- * to specified agent directories and updating references in guideline files.
11
+ * Updates the Appweaver skill files in the project by copying the skill
12
+ * directory (including the framework GUIDELINES.md) into every discovered agent
13
+ * directory (e.g. `.claude`, `.agents`).
13
14
  *
14
- * @param {boolean} quiet - If true, suppresses logging output; otherwise, logs actions performed.
15
+ * The project's own root guidelines file (`AGENTS.md` / `CLAUDE.md`) is never
16
+ * touched here — it only references the framework guidelines from the skills
17
+ * directory, so it can be freely extended in the project.
18
+ *
19
+ * @param {boolean} quiet - If true, suppresses logging output; otherwise, logs actions are performed.
15
20
  * @return {Promise<void>} A promise that resolves when the update process is complete.
16
21
  */
17
22
  async function updateSkillFiles(quiet) {
@@ -23,9 +28,6 @@ async function updateSkillFiles(quiet) {
23
28
  }
24
29
  return;
25
30
  }
26
- const guidelinesFilePath = node_path_1.default.join(skillDir, 'GUIDELINES.md');
27
- const guidelinesContents = await promises_1.default.readFile(guidelinesFilePath, 'utf8');
28
- const foundAgentDirs = [];
29
31
  for (const agentDir of [
30
32
  '.claude',
31
33
  '.junie',
@@ -39,48 +41,13 @@ async function updateSkillFiles(quiet) {
39
41
  if (!(await exists(agentDirPath))) {
40
42
  continue;
41
43
  }
42
- foundAgentDirs.push(agentDir);
43
44
  // Copy skill directory to {agentDir}/skills/appweaver/
44
45
  const skillDestPath = node_path_1.default.join(agentDirPath, 'skills', 'appweaver');
45
- await promises_1.default.cp(skillDir, skillDestPath, {
46
- recursive: true,
47
- filter: (src) => !src.endsWith('GUIDELINES.md')
48
- });
46
+ await promises_1.default.cp(skillDir, skillDestPath, { recursive: true });
49
47
  if (!quiet) {
50
48
  console.log(`Updated skill files in ${node_path_1.default.join(agentDir, 'skills', 'appweaver')}\n`);
51
49
  }
52
50
  }
53
- let firstAgentDir = foundAgentDirs[0];
54
- for (const guidelinesFile of ['AGENTS.md', 'CLAUDE.md']) {
55
- const guidelinesFilePath = node_path_1.default.join(projectDir, guidelinesFile);
56
- // Update only agent guidelines files that already exist
57
- if (!(await exists(guidelinesFilePath))) {
58
- continue;
59
- }
60
- // If no agent-specific dir was discovered, create new generic .agents dir
61
- if (!firstAgentDir) {
62
- 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
- });
68
- }
69
- // Replace guideline file path references with path references in first
70
- // discovered agents dir
71
- const referencesPath = node_path_1.default
72
- .join(firstAgentDir, 'skills', 'appweaver', 'references')
73
- .replace(/\\/g, '/');
74
- const guidelinesContent = guidelinesContents.replace(/(\[.+]\()references\/(.+\))/g, `$1${referencesPath}/$2`);
75
- await promises_1.default.writeFile(guidelinesFilePath, guidelinesContent, {
76
- encoding: 'utf8'
77
- });
78
- if (!quiet) {
79
- console.log(`Updated AI guidelines file ${guidelinesFile}\n`);
80
- }
81
- // Update only the first found guidelines file
82
- break;
83
- }
84
51
  }
85
52
  async function exists(filePath) {
86
53
  try {