@botonic/nx-plugin 2.28.0 → 2.29.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/CHANGELOG.md +10 -0
- package/migrations.json +8 -1
- package/package.json +1 -1
- package/src/executors/serve-bot/schema.json +2 -3
- package/src/generators/bot-app/lilara-version.json +1 -1
- package/src/generators/preset/files/.claude/skills/botonic-bot-update/SKILL.md +160 -0
- package/src/generators/preset/files/.claude/{commands/update-botonic.md → skills/botonic-update/SKILL.md} +11 -2
- package/src/lib/util/executor-helpers.d.ts +0 -4
- package/src/lib/util/executor-helpers.js +22 -0
- package/src/migrations/install-claude-update-skills/install-claude-update-skills.migration.d.ts +2 -0
- package/src/migrations/install-claude-update-skills/install-claude-update-skills.migration.js +290 -0
- package/src/generators/preset/files/.claude/commands/update-bot.md +0 -114
- package/src/generators/preset/files/.cursor/commands/update-bot.md +0 -3
- package/src/generators/preset/files/.cursor/commands/update-botonic.md +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 2.29.0 (2026-05-12)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **botonic:** v2 refinements - update skills, serve-bot defaults, staging bot warning ([#888](https://github.com/metis-ai/hubtype-product/pull/888))
|
|
6
|
+
|
|
7
|
+
### ❤️ Thank You
|
|
8
|
+
|
|
9
|
+
- David Hidalgo @Davidhidalgo
|
|
10
|
+
|
|
1
11
|
## 2.28.0 (2026-05-06)
|
|
2
12
|
|
|
3
13
|
### 🚀 Features
|
package/migrations.json
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generators": {
|
|
2
|
+
"generators": {
|
|
3
|
+
"install-claude-update-skills": {
|
|
4
|
+
"version": "2.29.0",
|
|
5
|
+
"description": "Replace .cursor/.claude command stubs with .claude/skills/botonic-update and .claude/skills/botonic-bot-update",
|
|
6
|
+
"cli": "nx",
|
|
7
|
+
"implementation": "./src/migrations/install-claude-update-skills/install-claude-update-skills.migration"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
3
10
|
}
|
package/package.json
CHANGED
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
"properties": {
|
|
8
8
|
"configuration": {
|
|
9
9
|
"type": "string",
|
|
10
|
-
"description": "Configuration/environment to use",
|
|
11
|
-
"enum": ["local", "dev", "dev2", "qa", "prod"]
|
|
12
|
-
"default": "local"
|
|
10
|
+
"description": "Configuration/environment to use. Defaults to 'prod' in generated workspaces; set defaultConfiguration: 'local' in project.json for development repos.",
|
|
11
|
+
"enum": ["local", "dev", "dev2", "qa", "prod"]
|
|
13
12
|
},
|
|
14
13
|
"skipWebviews": {
|
|
15
14
|
"type": "boolean",
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: botonic-bot-update
|
|
3
|
+
description: >
|
|
4
|
+
Update a single Botonic bot app to the current workspace version — applies pending bot-app
|
|
5
|
+
generators and bumps @botonic/* dependencies. Use when user says "update bot",
|
|
6
|
+
"apply bot migrations", or "update <bot-name>". Run /botonic-update first to upgrade the
|
|
7
|
+
workspace itself.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Update Botonic Bot
|
|
11
|
+
|
|
12
|
+
## Workflow: Update Bot App to Current Workspace Version
|
|
13
|
+
|
|
14
|
+
### Step 0: Detect Package Manager
|
|
15
|
+
|
|
16
|
+
Check which package manager the workspace uses:
|
|
17
|
+
|
|
18
|
+
- If `pnpm-lock.yaml` exists → use `pnpm`
|
|
19
|
+
- Else → use `npm`
|
|
20
|
+
|
|
21
|
+
Use the detected package manager for all subsequent commands.
|
|
22
|
+
|
|
23
|
+
### Step 1: Get Target Version
|
|
24
|
+
|
|
25
|
+
Read `node_modules/@botonic/nx-plugin/package.json` → `.version` field.
|
|
26
|
+
This is the version the workspace was updated to and the target for this bot.
|
|
27
|
+
|
|
28
|
+
If the file does not exist, tell user: "Could not find @botonic/nx-plugin in node_modules. Run /botonic-update first to install the latest version."
|
|
29
|
+
|
|
30
|
+
### Step 2: Discover Bots
|
|
31
|
+
|
|
32
|
+
Run `bash .claude/scripts/update-bot/discover-bots.sh` from the workspace root.
|
|
33
|
+
Expected output: JSON list of bots with name, path, current `@botonic/core` version.
|
|
34
|
+
|
|
35
|
+
### Step 3: Ask Which Bot
|
|
36
|
+
|
|
37
|
+
Present the bot list to the user. Ask which SINGLE bot to update.
|
|
38
|
+
**CRITICAL**: Never accept more than one bot. If user asks for multiple, explain why and ask them to pick one.
|
|
39
|
+
|
|
40
|
+
### Step 4: Check Bot's Current State
|
|
41
|
+
|
|
42
|
+
Read the selected bot's `package.json` (at `<bot-path>/package.json`):
|
|
43
|
+
|
|
44
|
+
- Extract the current `@botonic/core` version (strip `^` / `~` prefixes for comparison).
|
|
45
|
+
|
|
46
|
+
Read `.botonic/pending-bot-migrations.json` if it exists:
|
|
47
|
+
|
|
48
|
+
- Filter entries where `appliedTo` does NOT include `<bot-name>`.
|
|
49
|
+
|
|
50
|
+
Determine:
|
|
51
|
+
|
|
52
|
+
- `hasVersionGap`: bot's `@botonic/core` version ≠ target version
|
|
53
|
+
- `hasPendingMigrations`: any filtered pending migration entries exist
|
|
54
|
+
|
|
55
|
+
If **neither** is true, report: "`<bot-name>` is already at v`<target>` with no pending migrations. All up to date." and stop.
|
|
56
|
+
|
|
57
|
+
### Step 5: Ask Target Version (only when pending migrations exist)
|
|
58
|
+
|
|
59
|
+
If `hasPendingMigrations`:
|
|
60
|
+
|
|
61
|
+
- Show distinct `version` values from the pending migrations (sorted ascending).
|
|
62
|
+
- Ask the user: "Which version would you like to update to?" (default: latest in list).
|
|
63
|
+
- Only apply migrations whose `version` ≤ chosen target version.
|
|
64
|
+
|
|
65
|
+
If there are **no** pending migrations (version gap only), skip this step — use the target version from Step 1.
|
|
66
|
+
|
|
67
|
+
### Step 6: Check Git State
|
|
68
|
+
|
|
69
|
+
Run `git status --porcelain`. If output is non-empty, STOP.
|
|
70
|
+
Tell user: "Please commit or stash changes before updating."
|
|
71
|
+
|
|
72
|
+
### Step 7: Create Branch
|
|
73
|
+
|
|
74
|
+
`git checkout -b update/<bot-name>-to-v<target>`
|
|
75
|
+
|
|
76
|
+
### Step 8: Apply Pending Migrations (if any)
|
|
77
|
+
|
|
78
|
+
For each pending migration (in version order, filtered to `version` ≤ target):
|
|
79
|
+
|
|
80
|
+
1. Run: `<package-manager> nx g <generator> --project=<bot-name>`
|
|
81
|
+
2. If `migrationGuide` path exists, READ it. Follow verification checklist and manual steps.
|
|
82
|
+
3. `git add -A && git commit -m "chore(<bot-name>): apply <generator-name>"`
|
|
83
|
+
4. Mark bot as applied: update `.botonic/pending-bot-migrations.json` — add `<bot-name>` to the `appliedTo` array for this entry.
|
|
84
|
+
5. `git add .botonic/pending-bot-migrations.json && git commit --amend --no-edit`
|
|
85
|
+
|
|
86
|
+
### Step 9: Bump @botonic/\* Versions
|
|
87
|
+
|
|
88
|
+
Check if the bot's `@botonic/core` version (after any migrations) still differs from the target version.
|
|
89
|
+
|
|
90
|
+
If it does, edit `<bot-path>/package.json`:
|
|
91
|
+
|
|
92
|
+
- Update **all** `@botonic/*` entries in `dependencies`, `devDependencies`, and `peerDependencies` to the exact target version (no `^` or `~`).
|
|
93
|
+
|
|
94
|
+
`git add <bot-path>/package.json && git commit -m "chore(<bot-name>): bump @botonic/* to v<target>"`
|
|
95
|
+
|
|
96
|
+
Skip this step only if the versions already match.
|
|
97
|
+
|
|
98
|
+
### Step 10: Final Verification
|
|
99
|
+
|
|
100
|
+
- `nx build <bot-name>`
|
|
101
|
+
- Report: list all commits made, any remaining manual steps from migration guides
|
|
102
|
+
- Suggest: `nx serve-bot <bot-name>` for manual testing
|
|
103
|
+
|
|
104
|
+
## Examples
|
|
105
|
+
|
|
106
|
+
### Example 1: Bot with pending migrations and a version gap
|
|
107
|
+
|
|
108
|
+
User says: "Update my-bot" (currently on v2.17.0, workspace on v2.19.0, 2 pending migrations)
|
|
109
|
+
|
|
110
|
+
1. Target version: 2.19.0 (from node_modules)
|
|
111
|
+
2. discover-bots.sh → my-bot on v2.17.0
|
|
112
|
+
3. Check state: hasVersionGap=true, hasPendingMigrations=true (v2.18.0, v2.19.0)
|
|
113
|
+
4. Ask target: "Available versions: 2.18.0, 2.19.0. Update to which? [default: 2.19.0]"
|
|
114
|
+
5. Branch: update/my-bot-to-v2.19.0
|
|
115
|
+
6. Apply v2.18.0 generator → commit → mark applied
|
|
116
|
+
7. Apply v2.19.0 generator → commit → mark applied
|
|
117
|
+
8. Bump @botonic/\* to 2.19.0 in package.json → commit
|
|
118
|
+
9. Report: "Done. 2 generators applied + version bumped to v2.19.0."
|
|
119
|
+
|
|
120
|
+
### Example 2: New version with no bot-app migrations (version gap only)
|
|
121
|
+
|
|
122
|
+
User says: "Update my-bot" (currently on v2.17.0, workspace on v2.18.0, no pending migrations)
|
|
123
|
+
|
|
124
|
+
1. Target version: 2.18.0 (from node_modules)
|
|
125
|
+
2. discover-bots.sh → my-bot on v2.17.0
|
|
126
|
+
3. Check state: hasVersionGap=true, hasPendingMigrations=false
|
|
127
|
+
4. No version selection prompt needed
|
|
128
|
+
5. Branch: update/my-bot-to-v2.18.0
|
|
129
|
+
6. Skip Step 8 (no migrations)
|
|
130
|
+
7. Bump @botonic/\* to 2.18.0 in package.json → commit
|
|
131
|
+
8. Report: "Done. No migrations needed — @botonic/\* bumped to v2.18.0."
|
|
132
|
+
|
|
133
|
+
### Example 3: Bot already up to date
|
|
134
|
+
|
|
135
|
+
User says: "Update customer-bot" (on v2.19.0, workspace on v2.19.0, no pending migrations)
|
|
136
|
+
|
|
137
|
+
1. Target version: 2.19.0
|
|
138
|
+
2. Check state: hasVersionGap=false, hasPendingMigrations=false
|
|
139
|
+
3. Report: "customer-bot is already at v2.19.0 with no pending migrations. All up to date."
|
|
140
|
+
|
|
141
|
+
### Example 4: Multiple bots requested (refuse)
|
|
142
|
+
|
|
143
|
+
User says: "Update all bots"
|
|
144
|
+
Response: "I update one bot at a time to ensure each migration is properly verified. Which bot would you like to start with? [list bots]"
|
|
145
|
+
|
|
146
|
+
## Troubleshooting
|
|
147
|
+
|
|
148
|
+
### Error: Generator reports "already up to date"
|
|
149
|
+
|
|
150
|
+
Cause: The bot code was already manually updated before running the generator.
|
|
151
|
+
Solution: The generator is idempotent and skipped correctly. Mark it as applied and continue to the version bump step.
|
|
152
|
+
|
|
153
|
+
### Error: Build fails after generator
|
|
154
|
+
|
|
155
|
+
Cause: Custom bot code uses removed/changed APIs.
|
|
156
|
+
Solution:
|
|
157
|
+
|
|
158
|
+
1. Read the migration guide "What it cannot handle" section
|
|
159
|
+
2. Follow "Manual migration steps" for custom patterns
|
|
160
|
+
3. Check TypeScript: `npx tsc --noEmit`
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: botonic-update
|
|
3
|
+
description: >
|
|
4
|
+
Update the Botonic workspace to the latest version by running nx migrate. Use when user says
|
|
5
|
+
"update botonic", "upgrade botonic", "update workspace", or wants to update @botonic/nx-plugin
|
|
6
|
+
to the latest version. If pending bot migrations are queued afterward, instruct user to run
|
|
7
|
+
/botonic-bot-update per bot.
|
|
8
|
+
---
|
|
9
|
+
|
|
1
10
|
# Update Botonic Workspace
|
|
2
11
|
|
|
3
12
|
## Workflow: Update Botonic to Latest Version
|
|
@@ -47,7 +56,7 @@ If output says "no migrations to run" and `package.json` was already at the late
|
|
|
47
56
|
|
|
48
57
|
This runs any workspace-level migrations shipped by the target `@botonic/nx-plugin` version.
|
|
49
58
|
|
|
50
|
-
If that version also queues bot-app generators, it may write `.botonic/pending-bot-migrations.json` for `/
|
|
59
|
+
If that version also queues bot-app generators, it may write `.botonic/pending-bot-migrations.json` for `/botonic-bot-update`.
|
|
51
60
|
|
|
52
61
|
### Step 6: Commit
|
|
53
62
|
|
|
@@ -62,4 +71,4 @@ Report:
|
|
|
62
71
|
- New version installed
|
|
63
72
|
- Any workspace changes applied
|
|
64
73
|
- Whether `.botonic/pending-bot-migrations.json` was created and how many generators are pending
|
|
65
|
-
- If generators are pending, instruct user to run `/
|
|
74
|
+
- If generators are pending, instruct user to run `/botonic-bot-update` to apply them per bot
|
|
@@ -70,10 +70,6 @@ export declare function writeLocalRuntimeBotToAppFolder(projectRoot: string, bot
|
|
|
70
70
|
* Removes the app folder .botonic.json so the next run will prompt to create/select a new bot (e.g. after 404 when bot was deleted).
|
|
71
71
|
*/
|
|
72
72
|
export declare function removeAppBotonicJson(projectRoot: string): void;
|
|
73
|
-
/**
|
|
74
|
-
* Ensures a local runtime bot is set: reuses one from .botonic.json, or prompts to select an existing bot or create a new one by name.
|
|
75
|
-
* Used when performing deploy_local_runtime with a tunnel URL from serve-bot or serve-dev-tunnel target.
|
|
76
|
-
*/
|
|
77
73
|
export declare function ensureLocalRuntimeBot(botonicApiService: BotonicAPIService): Promise<void>;
|
|
78
74
|
export interface PerformDeployLocalRuntimeOptions {
|
|
79
75
|
email?: string;
|
|
@@ -416,6 +416,22 @@ function removeAppBotonicJson(projectRoot) {
|
|
|
416
416
|
(0, import_fs.unlinkSync)(path);
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
|
+
async function promptConfirmStagingBot(botName) {
|
|
420
|
+
console.log(
|
|
421
|
+
`
|
|
422
|
+
\u26A0\uFE0F Bot "${botName}" will be created as a staging bot on the Hubtype platform.`
|
|
423
|
+
);
|
|
424
|
+
console.log(
|
|
425
|
+
` To create a production bot, use the Hubtype dashboard or the deploy-to-hubtype command instead.
|
|
426
|
+
`
|
|
427
|
+
);
|
|
428
|
+
const confirmation = await (0, import_enquirer.prompt)({
|
|
429
|
+
type: "confirm",
|
|
430
|
+
name: "confirm_staging",
|
|
431
|
+
message: "\u{1F6A6} Do you want to proceed?"
|
|
432
|
+
});
|
|
433
|
+
return confirmation.confirm_staging;
|
|
434
|
+
}
|
|
419
435
|
async function ensureLocalRuntimeBot(botonicApiService) {
|
|
420
436
|
if (botonicApiService.hasLocalRuntimeBot()) {
|
|
421
437
|
return;
|
|
@@ -436,6 +452,9 @@ async function ensureLocalRuntimeBot(botonicApiService) {
|
|
|
436
452
|
}
|
|
437
453
|
});
|
|
438
454
|
const name = response2.bot_name.trim();
|
|
455
|
+
if (!await promptConfirmStagingBot(name)) {
|
|
456
|
+
throw new Error("Bot creation cancelled.");
|
|
457
|
+
}
|
|
439
458
|
await createNewBotWithName(botonicApiService, name);
|
|
440
459
|
return;
|
|
441
460
|
}
|
|
@@ -467,6 +486,9 @@ async function ensureLocalRuntimeBot(botonicApiService) {
|
|
|
467
486
|
}
|
|
468
487
|
});
|
|
469
488
|
const name = nameResponse.bot_name.trim();
|
|
489
|
+
if (!await promptConfirmStagingBot(name)) {
|
|
490
|
+
throw new Error("Bot creation cancelled.");
|
|
491
|
+
}
|
|
470
492
|
await createNewBotWithName(botonicApiService, name);
|
|
471
493
|
return;
|
|
472
494
|
}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var install_claude_update_skills_migration_exports = {};
|
|
20
|
+
__export(install_claude_update_skills_migration_exports, {
|
|
21
|
+
default: () => installClaudeUpdateSkills
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(install_claude_update_skills_migration_exports);
|
|
24
|
+
var import_devkit = require("@nx/devkit");
|
|
25
|
+
const BOTONIC_BOT_UPDATE_SKILL = `---
|
|
26
|
+
name: botonic-bot-update
|
|
27
|
+
description: >
|
|
28
|
+
Update a single Botonic bot app to the current workspace version \u2014 applies pending bot-app
|
|
29
|
+
generators and bumps @botonic/* dependencies. Use when user says "update bot",
|
|
30
|
+
"apply bot migrations", or "update <bot-name>". Run /botonic-update first to upgrade the
|
|
31
|
+
workspace itself.
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
# Update Botonic Bot
|
|
35
|
+
|
|
36
|
+
## Workflow: Update Bot App to Current Workspace Version
|
|
37
|
+
|
|
38
|
+
### Step 0: Detect Package Manager
|
|
39
|
+
|
|
40
|
+
Check which package manager the workspace uses:
|
|
41
|
+
|
|
42
|
+
- If \`pnpm-lock.yaml\` exists \u2192 use \`pnpm\`
|
|
43
|
+
- Else \u2192 use \`npm\`
|
|
44
|
+
|
|
45
|
+
Use the detected package manager for all subsequent commands.
|
|
46
|
+
|
|
47
|
+
### Step 1: Get Target Version
|
|
48
|
+
|
|
49
|
+
Read \`node_modules/@botonic/nx-plugin/package.json\` \u2192 \`.version\` field.
|
|
50
|
+
This is the version the workspace was updated to and the target for this bot.
|
|
51
|
+
|
|
52
|
+
If the file does not exist, tell user: "Could not find @botonic/nx-plugin in node_modules. Run /botonic-update first to install the latest version."
|
|
53
|
+
|
|
54
|
+
### Step 2: Discover Bots
|
|
55
|
+
|
|
56
|
+
Run \`bash .claude/scripts/update-bot/discover-bots.sh\` from the workspace root.
|
|
57
|
+
Expected output: JSON list of bots with name, path, current \`@botonic/core\` version.
|
|
58
|
+
|
|
59
|
+
### Step 3: Ask Which Bot
|
|
60
|
+
|
|
61
|
+
Present the bot list to the user. Ask which SINGLE bot to update.
|
|
62
|
+
**CRITICAL**: Never accept more than one bot. If user asks for multiple, explain why and ask them to pick one.
|
|
63
|
+
|
|
64
|
+
### Step 4: Check Bot's Current State
|
|
65
|
+
|
|
66
|
+
Read the selected bot's \`package.json\` (at \`<bot-path>/package.json\`):
|
|
67
|
+
- Extract the current \`@botonic/core\` version (strip \`^\` / \`~\` prefixes for comparison).
|
|
68
|
+
|
|
69
|
+
Read \`.botonic/pending-bot-migrations.json\` if it exists:
|
|
70
|
+
- Filter entries where \`appliedTo\` does NOT include \`<bot-name>\`.
|
|
71
|
+
|
|
72
|
+
Determine:
|
|
73
|
+
- \`hasVersionGap\`: bot's \`@botonic/core\` version \u2260 target version
|
|
74
|
+
- \`hasPendingMigrations\`: any filtered pending migration entries exist
|
|
75
|
+
|
|
76
|
+
If **neither** is true, report: "\`<bot-name>\` is already at v\`<target>\` with no pending migrations. All up to date." and stop.
|
|
77
|
+
|
|
78
|
+
### Step 5: Ask Target Version (only when pending migrations exist)
|
|
79
|
+
|
|
80
|
+
If \`hasPendingMigrations\`:
|
|
81
|
+
- Show distinct \`version\` values from the pending migrations (sorted ascending).
|
|
82
|
+
- Ask the user: "Which version would you like to update to?" (default: latest in list).
|
|
83
|
+
- Only apply migrations whose \`version\` \u2264 chosen target version.
|
|
84
|
+
|
|
85
|
+
If there are **no** pending migrations (version gap only), skip this step \u2014 use the target version from Step 1.
|
|
86
|
+
|
|
87
|
+
### Step 6: Check Git State
|
|
88
|
+
|
|
89
|
+
Run \`git status --porcelain\`. If output is non-empty, STOP.
|
|
90
|
+
Tell user: "Please commit or stash changes before updating."
|
|
91
|
+
|
|
92
|
+
### Step 7: Create Branch
|
|
93
|
+
|
|
94
|
+
\`git checkout -b update/<bot-name>-to-v<target>\`
|
|
95
|
+
|
|
96
|
+
### Step 8: Apply Pending Migrations (if any)
|
|
97
|
+
|
|
98
|
+
For each pending migration (in version order, filtered to \`version\` \u2264 target):
|
|
99
|
+
|
|
100
|
+
1. Run: \`<package-manager> nx g <generator> --project=<bot-name>\`
|
|
101
|
+
2. If \`migrationGuide\` path exists, READ it. Follow verification checklist and manual steps.
|
|
102
|
+
3. \`git add -A && git commit -m "chore(<bot-name>): apply <generator-name>"\`
|
|
103
|
+
4. Mark bot as applied: update \`.botonic/pending-bot-migrations.json\` \u2014 add \`<bot-name>\` to the \`appliedTo\` array for this entry.
|
|
104
|
+
5. \`git add .botonic/pending-bot-migrations.json && git commit --amend --no-edit\`
|
|
105
|
+
|
|
106
|
+
### Step 9: Bump @botonic/* Versions
|
|
107
|
+
|
|
108
|
+
Check if the bot's \`@botonic/core\` version (after any migrations) still differs from the target version.
|
|
109
|
+
|
|
110
|
+
If it does, edit \`<bot-path>/package.json\`:
|
|
111
|
+
- Update **all** \`@botonic/*\` entries in \`dependencies\`, \`devDependencies\`, and \`peerDependencies\` to the exact target version (no \`^\` or \`~\`).
|
|
112
|
+
|
|
113
|
+
\`git add <bot-path>/package.json && git commit -m "chore(<bot-name>): bump @botonic/* to v<target>"\`
|
|
114
|
+
|
|
115
|
+
Skip this step only if the versions already match.
|
|
116
|
+
|
|
117
|
+
### Step 10: Final Verification
|
|
118
|
+
|
|
119
|
+
- \`nx build <bot-name>\`
|
|
120
|
+
- Report: list all commits made, any remaining manual steps from migration guides
|
|
121
|
+
- Suggest: \`nx serve-bot <bot-name>\` for manual testing
|
|
122
|
+
|
|
123
|
+
## Examples
|
|
124
|
+
|
|
125
|
+
### Example 1: Bot with pending migrations and a version gap
|
|
126
|
+
|
|
127
|
+
User says: "Update my-bot" (currently on v2.17.0, workspace on v2.19.0, 2 pending migrations)
|
|
128
|
+
|
|
129
|
+
1. Target version: 2.19.0 (from node_modules)
|
|
130
|
+
2. discover-bots.sh \u2192 my-bot on v2.17.0
|
|
131
|
+
3. Check state: hasVersionGap=true, hasPendingMigrations=true (v2.18.0, v2.19.0)
|
|
132
|
+
4. Ask target: "Available versions: 2.18.0, 2.19.0. Update to which? [default: 2.19.0]"
|
|
133
|
+
5. Branch: update/my-bot-to-v2.19.0
|
|
134
|
+
6. Apply v2.18.0 generator \u2192 commit \u2192 mark applied
|
|
135
|
+
7. Apply v2.19.0 generator \u2192 commit \u2192 mark applied
|
|
136
|
+
8. Bump @botonic/* to 2.19.0 in package.json \u2192 commit
|
|
137
|
+
9. Report: "Done. 2 generators applied + version bumped to v2.19.0."
|
|
138
|
+
|
|
139
|
+
### Example 2: New version with no bot-app migrations (version gap only)
|
|
140
|
+
|
|
141
|
+
User says: "Update my-bot" (currently on v2.17.0, workspace on v2.18.0, no pending migrations)
|
|
142
|
+
|
|
143
|
+
1. Target version: 2.18.0 (from node_modules)
|
|
144
|
+
2. discover-bots.sh \u2192 my-bot on v2.17.0
|
|
145
|
+
3. Check state: hasVersionGap=true, hasPendingMigrations=false
|
|
146
|
+
4. No version selection prompt needed
|
|
147
|
+
5. Branch: update/my-bot-to-v2.18.0
|
|
148
|
+
6. Skip Step 8 (no migrations)
|
|
149
|
+
7. Bump @botonic/* to 2.18.0 in package.json \u2192 commit
|
|
150
|
+
8. Report: "Done. No migrations needed \u2014 @botonic/* bumped to v2.18.0."
|
|
151
|
+
|
|
152
|
+
### Example 3: Bot already up to date
|
|
153
|
+
|
|
154
|
+
User says: "Update customer-bot" (on v2.19.0, workspace on v2.19.0, no pending migrations)
|
|
155
|
+
|
|
156
|
+
1. Target version: 2.19.0
|
|
157
|
+
2. Check state: hasVersionGap=false, hasPendingMigrations=false
|
|
158
|
+
3. Report: "customer-bot is already at v2.19.0 with no pending migrations. All up to date."
|
|
159
|
+
|
|
160
|
+
### Example 4: Multiple bots requested (refuse)
|
|
161
|
+
|
|
162
|
+
User says: "Update all bots"
|
|
163
|
+
Response: "I update one bot at a time to ensure each migration is properly verified. Which bot would you like to start with? [list bots]"
|
|
164
|
+
|
|
165
|
+
## Troubleshooting
|
|
166
|
+
|
|
167
|
+
### Error: Generator reports "already up to date"
|
|
168
|
+
|
|
169
|
+
Cause: The bot code was already manually updated before running the generator.
|
|
170
|
+
Solution: The generator is idempotent and skipped correctly. Mark it as applied and continue to the version bump step.
|
|
171
|
+
|
|
172
|
+
### Error: Build fails after generator
|
|
173
|
+
|
|
174
|
+
Cause: Custom bot code uses removed/changed APIs.
|
|
175
|
+
Solution:
|
|
176
|
+
|
|
177
|
+
1. Read the migration guide "What it cannot handle" section
|
|
178
|
+
2. Follow "Manual migration steps" for custom patterns
|
|
179
|
+
3. Check TypeScript: \`npx tsc --noEmit\`
|
|
180
|
+
`;
|
|
181
|
+
const BOTONIC_UPDATE_SKILL = `---
|
|
182
|
+
name: botonic-update
|
|
183
|
+
description: >
|
|
184
|
+
Update the Botonic workspace to the latest version by running nx migrate. Use when user says
|
|
185
|
+
"update botonic", "upgrade botonic", "update workspace", or wants to update @botonic/nx-plugin
|
|
186
|
+
to the latest version. If pending bot migrations are queued afterward, instruct user to run
|
|
187
|
+
/botonic-bot-update per bot.
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
# Update Botonic Workspace
|
|
191
|
+
|
|
192
|
+
## Workflow: Update Botonic to Latest Version
|
|
193
|
+
|
|
194
|
+
### Step 0: Detect Package Manager
|
|
195
|
+
|
|
196
|
+
Check which package manager the workspace uses:
|
|
197
|
+
|
|
198
|
+
- If \`pnpm-lock.yaml\` exists \u2192 use \`pnpm\`
|
|
199
|
+
- Else \u2192 use \`npm\`
|
|
200
|
+
|
|
201
|
+
Use the detected package manager for all subsequent commands.
|
|
202
|
+
|
|
203
|
+
### Step 1: Check Current State
|
|
204
|
+
|
|
205
|
+
Run \`npm view @botonic/nx-plugin version\` to get the latest available version.
|
|
206
|
+
Check \`node_modules/@botonic/nx-plugin/package.json\` for the currently installed version.
|
|
207
|
+
|
|
208
|
+
If already on latest, report "already up to date" and stop.
|
|
209
|
+
|
|
210
|
+
### Step 2: Check Git State
|
|
211
|
+
|
|
212
|
+
Run \`git status --porcelain\`. If output is non-empty, STOP.
|
|
213
|
+
Tell user: "Please commit or stash changes before updating."
|
|
214
|
+
|
|
215
|
+
### Step 3: Run Nx Migrate
|
|
216
|
+
|
|
217
|
+
\`\`\`
|
|
218
|
+
npx nx migrate @botonic/nx-plugin@latest
|
|
219
|
+
\`\`\`
|
|
220
|
+
|
|
221
|
+
This updates \`package.json\` and creates \`migrations.json\`.
|
|
222
|
+
|
|
223
|
+
If output says "no migrations to run" and \`package.json\` was already at the latest version, stop and report "already up to date".
|
|
224
|
+
|
|
225
|
+
### Step 4: Install Dependencies
|
|
226
|
+
|
|
227
|
+
\`\`\`
|
|
228
|
+
<package-manager> install
|
|
229
|
+
\`\`\`
|
|
230
|
+
|
|
231
|
+
### Step 5: Run Workspace Migrations
|
|
232
|
+
|
|
233
|
+
\`\`\`
|
|
234
|
+
<package-manager> nx migrate --run-migrations
|
|
235
|
+
\`\`\`
|
|
236
|
+
|
|
237
|
+
This runs any workspace-level migrations shipped by the target \`@botonic/nx-plugin\` version.
|
|
238
|
+
|
|
239
|
+
If that version also queues bot-app generators, it may write \`.botonic/pending-bot-migrations.json\` for \`/botonic-bot-update\`.
|
|
240
|
+
|
|
241
|
+
### Step 6: Commit
|
|
242
|
+
|
|
243
|
+
\`\`\`
|
|
244
|
+
git add -A && git commit -m "chore: update @botonic/nx-plugin to v<version>"
|
|
245
|
+
\`\`\`
|
|
246
|
+
|
|
247
|
+
### Step 7: Report
|
|
248
|
+
|
|
249
|
+
Report:
|
|
250
|
+
|
|
251
|
+
- New version installed
|
|
252
|
+
- Any workspace changes applied
|
|
253
|
+
- Whether \`.botonic/pending-bot-migrations.json\` was created and how many generators are pending
|
|
254
|
+
- If generators are pending, instruct user to run \`/botonic-bot-update\` to apply them per bot
|
|
255
|
+
`;
|
|
256
|
+
const OLD_FILES = [
|
|
257
|
+
".cursor/commands/update-bot.md",
|
|
258
|
+
".cursor/commands/update-botonic.md",
|
|
259
|
+
".claude/commands/update-bot.md",
|
|
260
|
+
".claude/commands/update-botonic.md"
|
|
261
|
+
];
|
|
262
|
+
async function installClaudeUpdateSkills(tree) {
|
|
263
|
+
let removedCount = 0;
|
|
264
|
+
for (const filePath of OLD_FILES) {
|
|
265
|
+
if (tree.exists(filePath)) {
|
|
266
|
+
tree.delete(filePath);
|
|
267
|
+
removedCount++;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
tree.write(
|
|
271
|
+
".claude/skills/botonic-bot-update/SKILL.md",
|
|
272
|
+
BOTONIC_BOT_UPDATE_SKILL
|
|
273
|
+
);
|
|
274
|
+
tree.write(".claude/skills/botonic-update/SKILL.md", BOTONIC_UPDATE_SKILL);
|
|
275
|
+
await (0, import_devkit.formatFiles)(tree);
|
|
276
|
+
if (removedCount > 0) {
|
|
277
|
+
import_devkit.logger.info(
|
|
278
|
+
` \u2705 Removed ${removedCount} old command stub(s) (.cursor/commands/, .claude/commands/)`
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
import_devkit.logger.info(
|
|
282
|
+
` \u2705 Installed .claude/skills/botonic-bot-update/SKILL.md (was /update-bot)`
|
|
283
|
+
);
|
|
284
|
+
import_devkit.logger.info(
|
|
285
|
+
` \u2705 Installed .claude/skills/botonic-update/SKILL.md (was /update-botonic)`
|
|
286
|
+
);
|
|
287
|
+
import_devkit.logger.info(
|
|
288
|
+
` \u2139\uFE0F Use /botonic-bot-update to apply pending bot migrations and /botonic-update to upgrade the workspace`
|
|
289
|
+
);
|
|
290
|
+
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
# Update Botonic Bot
|
|
2
|
-
|
|
3
|
-
## Workflow: Apply Pending Bot Migrations
|
|
4
|
-
|
|
5
|
-
### Step 0: Detect Package Manager
|
|
6
|
-
|
|
7
|
-
Check which package manager the workspace uses:
|
|
8
|
-
|
|
9
|
-
- If `pnpm-lock.yaml` exists → use `pnpm`
|
|
10
|
-
- Else → use `npm`
|
|
11
|
-
|
|
12
|
-
Use the detected package manager for all subsequent commands.
|
|
13
|
-
|
|
14
|
-
### Step 1: Check Pending Migrations
|
|
15
|
-
|
|
16
|
-
Read `.botonic/pending-bot-migrations.json`.
|
|
17
|
-
|
|
18
|
-
If the file does not exist, tell user: "No pending bot migrations found. Run /update-botonic first to update the workspace."
|
|
19
|
-
|
|
20
|
-
If the `pending` array is empty, tell user: "All bot migrations are already applied."
|
|
21
|
-
|
|
22
|
-
### Step 2: Discover Bots
|
|
23
|
-
|
|
24
|
-
Run `bash .claude/scripts/update-bot/discover-bots.sh` from the workspace root.
|
|
25
|
-
Expected output: JSON list of bots with name, path, current version.
|
|
26
|
-
|
|
27
|
-
### Step 3: Ask Which Bot
|
|
28
|
-
|
|
29
|
-
Present the bot list to the user. Ask which SINGLE bot to update.
|
|
30
|
-
**CRITICAL**: Never accept more than one bot. If user asks for multiple, explain why and ask them to pick one.
|
|
31
|
-
|
|
32
|
-
### Step 4: Ask Target Version
|
|
33
|
-
|
|
34
|
-
Show the distinct `version` values from all pending migrations (sorted ascending, e.g. `2.16.0`, `2.17.0`, `2.18.0`).
|
|
35
|
-
|
|
36
|
-
Ask the user: "Which version would you like to update to?" (default: the latest version in the list).
|
|
37
|
-
|
|
38
|
-
Only apply migrations whose `version` ≤ the chosen target version.
|
|
39
|
-
|
|
40
|
-
### Step 5: Find Pending Migrations for Selected Bot
|
|
41
|
-
|
|
42
|
-
Filter `.botonic/pending-bot-migrations.json` entries where ALL of:
|
|
43
|
-
|
|
44
|
-
- `appliedTo` does NOT include `<bot-name>`, AND
|
|
45
|
-
- `version` ≤ chosen target version
|
|
46
|
-
|
|
47
|
-
If none, report: "<bot-name> has no pending migrations up to v<target>. All up to date."
|
|
48
|
-
|
|
49
|
-
### Step 6: Check Git State
|
|
50
|
-
|
|
51
|
-
Run `git status --porcelain`. If output is non-empty, STOP.
|
|
52
|
-
Tell user: "Please commit or stash changes before updating."
|
|
53
|
-
|
|
54
|
-
### Step 7: Create Branch
|
|
55
|
-
|
|
56
|
-
`git checkout -b update/<bot-name>-pending-migrations`
|
|
57
|
-
|
|
58
|
-
### Step 8: Apply Each Pending Generator
|
|
59
|
-
|
|
60
|
-
For each pending migration (in version order, filtered to `version` ≤ target):
|
|
61
|
-
|
|
62
|
-
1. Run: `<package-manager> nx g <generator> --project=<bot-name>`
|
|
63
|
-
2. If `migrationGuide` path exists, READ it. Follow verification checklist and manual steps.
|
|
64
|
-
3. `git add -A && git commit -m "chore(<bot-name>): apply <generator-name>"`
|
|
65
|
-
4. Mark bot as applied: update `.botonic/pending-bot-migrations.json` — add `<bot-name>` to the `appliedTo` array for this entry.
|
|
66
|
-
5. `git add .botonic/pending-bot-migrations.json && git commit --amend --no-edit`
|
|
67
|
-
|
|
68
|
-
### Step 9: Final Verification
|
|
69
|
-
|
|
70
|
-
- `nx build <bot-name>`
|
|
71
|
-
- Report: list all commits, any remaining manual steps from migration guides
|
|
72
|
-
- Suggest: `nx serve-bot <bot-name>` for manual testing
|
|
73
|
-
|
|
74
|
-
## Examples
|
|
75
|
-
|
|
76
|
-
### Example 1: Bot with two pending migrations
|
|
77
|
-
|
|
78
|
-
User says: "Update my-bot"
|
|
79
|
-
|
|
80
|
-
1. Read pending-bot-migrations.json → 2 entries (v2.0.1, v2.1.0), my-bot not in appliedTo for either
|
|
81
|
-
2. discover-bots.sh → my-bot on v2.0.0
|
|
82
|
-
3. Ask target: "Available versions: 2.0.1, 2.1.0. Update to which? [default: 2.1.0]" → user picks 2.1.0
|
|
83
|
-
4. Branch: update/my-bot-pending-migrations
|
|
84
|
-
5. Run first pending generator (v2.0.1) → read guide if present → commit → mark applied
|
|
85
|
-
6. Run second pending generator (v2.1.0) → commit → mark applied
|
|
86
|
-
7. Report: "Done. 2 generators applied to my-bot up to v2.1.0."
|
|
87
|
-
|
|
88
|
-
### Example 2: Bot already up to date
|
|
89
|
-
|
|
90
|
-
User says: "Update customer-bot"
|
|
91
|
-
|
|
92
|
-
1. Read pending-bot-migrations.json → customer-bot is in appliedTo for all entries
|
|
93
|
-
2. Report: "customer-bot has no pending migrations. All up to date."
|
|
94
|
-
|
|
95
|
-
### Example 3: Multiple bots requested (refuse)
|
|
96
|
-
|
|
97
|
-
User says: "Update all bots"
|
|
98
|
-
Response: "I update one bot at a time to ensure each migration is properly verified. Which bot would you like to start with? [list bots]"
|
|
99
|
-
|
|
100
|
-
## Troubleshooting
|
|
101
|
-
|
|
102
|
-
### Error: Generator reports "already up to date"
|
|
103
|
-
|
|
104
|
-
Cause: The bot code was already manually updated before running the generator.
|
|
105
|
-
Solution: The generator is idempotent and skipped correctly. Mark it as applied and continue.
|
|
106
|
-
|
|
107
|
-
### Error: Build fails after generator
|
|
108
|
-
|
|
109
|
-
Cause: Custom bot code uses removed/changed APIs.
|
|
110
|
-
Solution:
|
|
111
|
-
|
|
112
|
-
1. Read the migration guide "What it cannot handle" section
|
|
113
|
-
2. Follow "Manual migration steps" for custom patterns
|
|
114
|
-
3. Check TypeScript: `npx tsc --noEmit`
|