@botonic/nx-plugin 2.25.0 → 2.27.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 +29 -0
- package/README.md +4 -4
- package/generators.json +0 -26
- package/migrations.json +1 -38
- package/package.json +1 -1
- package/src/executors/e2e-webchat/botonic-package-publish.spec.ts +3 -3
- package/src/executors/serve-bot/executor.js +98 -16
- package/src/executors/serve-bot/schema.json +10 -0
- package/src/generators/action/files/__name__.spec.ts.template +4 -4
- package/src/generators/action/files/__name__.ts.template +5 -5
- package/src/generators/action/generator.js +1 -1
- package/src/generators/bot-app/files/.eslintrc.json.template +30 -1
- package/src/generators/bot-app/files/src/client/webchat/index.tsx.template +1 -6
- package/src/generators/bot-app/files/src/server/bot/actions/not-found.ts.template +7 -6
- package/src/generators/bot-app/files/src/server/bot/actions/welcome.ts.template +7 -6
- package/src/generators/bot-app/files/src/server/bot/index.ts.template +9 -11
- package/src/generators/bot-app/files/src/server/bot/plugins/ai-agents/index.ts.template +4 -4
- package/src/generators/bot-app/files/src/server/bot/plugins/flow-builder/index.ts.template +5 -5
- package/src/generators/bot-app/files/src/server/bot/routes.ts.template +5 -5
- package/src/generators/bot-app/files/src/server/bot/tracking.ts.template +4 -4
- package/src/generators/bot-app/files/src/server/lambda/handler.js.template +1 -6
- package/src/generators/bot-app/files/vite/plugins/dev-log-viewer-html.plugin.ts.template +65 -0
- package/src/generators/bot-app/files/vite/webchat.config.ts.template +14 -1
- package/src/generators/bot-app/generator.js +6 -2
- package/src/generators/bot-app/lilara-version.json +1 -1
- package/src/generators/bot-app/schema.d.ts +1 -0
- package/src/generators/bot-app/schema.json +4 -0
- package/src/generators/custom-message/files/__name__-output.ts.template +12 -10
- package/src/generators/custom-message/generator.js +1 -1
- package/src/{cursor-commands → generators/preset/files/.claude/commands}/update-bot.md +7 -7
- package/src/{cursor-commands → generators/preset/files/.claude/commands}/update-botonic.md +5 -3
- package/src/{migrations/add-botonic-update-bots-skill/files/.cursor → generators/preset/files/.claude}/scripts/update-bot/discover-bots.sh +1 -1
- package/src/generators/preset/files/{.cursor → .claude}/skills/botonic-action/SKILL.md +21 -21
- package/src/generators/preset/files/{.cursor → .claude}/skills/botonic-custom-message/SKILL.md +11 -12
- package/src/generators/preset/files/{.cursor → .claude}/skills/botonic-webview/SKILL.md +8 -8
- package/src/generators/preset/files/.cursor/commands/update-bot.md +1 -3
- package/src/generators/preset/files/.cursor/commands/update-botonic.md +1 -3
- package/src/lib/util/executor-helpers.d.ts +0 -1
- package/src/lib/util/executor-helpers.js +1 -8
- package/src/generators/bot-app-migrations/migrate-fix-css-code-split/generator.d.ts +0 -5
- package/src/generators/bot-app-migrations/migrate-fix-css-code-split/generator.js +0 -92
- package/src/generators/bot-app-migrations/migrate-fix-css-code-split/schema.json +0 -15
- package/src/generators/bot-app-migrations/migrate-pnpm-compat/generator.d.ts +0 -5
- package/src/generators/bot-app-migrations/migrate-pnpm-compat/generator.js +0 -97
- package/src/generators/bot-app-migrations/migrate-pnpm-compat/schema.json +0 -15
- package/src/generators/bot-app-migrations/migrate-webchat-trigger/generator.d.ts +0 -5
- package/src/generators/bot-app-migrations/migrate-webchat-trigger/generator.js +0 -165
- package/src/generators/bot-app-migrations/migrate-webchat-trigger/schema.json +0 -15
- package/src/generators/preset/files/.cursor/scripts/update-bot/discover-bots.sh +0 -67
- package/src/migrations/add-botonic-update-bots-skill/add-botonic-update-bots-skill.migration.d.ts +0 -2
- package/src/migrations/add-botonic-update-bots-skill/add-botonic-update-bots-skill.migration.js +0 -52
- package/src/migrations/add-botonic-update-bots-skill/add-botonic-update-bots-skill.migration.md +0 -23
- package/src/migrations/add-botonic-update-bots-skill/files/.cursor/commands/update-bot.md +0 -5
- package/src/migrations/add-botonic-update-bots-skill/files/.cursor/commands/update-botonic.md +0 -5
- package/src/migrations/add-botonic-update-bots-skill/files/.cursor/scripts/update-bot/find-migration-guides.sh +0 -70
- package/src/migrations/add-botonic-update-bots-skill/schema.json +0 -5
- package/src/migrations/add-lilara-registry/add-lilara-registry.migration.d.ts +0 -2
- package/src/migrations/add-lilara-registry/add-lilara-registry.migration.js +0 -49
- package/src/migrations/add-lilara-registry/schema.json +0 -5
- package/src/migrations/fix-css-code-split/fix-css-code-split.migration.md +0 -45
- package/src/migrations/remove-codeartifact-registry/remove-codeartifact-registry.migration.d.ts +0 -2
- package/src/migrations/remove-codeartifact-registry/remove-codeartifact-registry.migration.js +0 -59
- package/src/migrations/remove-codeartifact-registry/schema.json +0 -5
- package/src/migrations/sync-pending-bot-migrations/schema.json +0 -5
- package/src/migrations/sync-pending-bot-migrations/sync-pending-bot-migrations.migration.d.ts +0 -2
- package/src/migrations/sync-pending-bot-migrations/sync-pending-bot-migrations.migration.js +0 -137
- package/src/migrations/sync-pending-bot-migrations/sync-pending-bot-migrations.migration.md +0 -19
- package/src/migrations/update-cursor-commands-to-stubs/schema.json +0 -5
- package/src/migrations/update-cursor-commands-to-stubs/update-cursor-commands-to-stubs.migration.d.ts +0 -2
- package/src/migrations/update-cursor-commands-to-stubs/update-cursor-commands-to-stubs.migration.js +0 -61
- package/src/migrations/update-pnpm-workspace-scripts/schema.json +0 -4
- package/src/migrations/update-pnpm-workspace-scripts/update-pnpm-workspace-scripts.migration.d.ts +0 -2
- package/src/migrations/update-pnpm-workspace-scripts/update-pnpm-workspace-scripts.migration.js +0 -47
- /package/src/generators/preset/files/{.cursor → .claude}/scripts/update-bot/find-migration-guides.sh +0 -0
|
@@ -1,49 +0,0 @@
|
|
|
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 add_lilara_registry_migration_exports = {};
|
|
20
|
-
__export(add_lilara_registry_migration_exports, {
|
|
21
|
-
default: () => addLilaraRegistry
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(add_lilara_registry_migration_exports);
|
|
24
|
-
var import_devkit = require("@nx/devkit");
|
|
25
|
-
const NPMRC = ".npmrc";
|
|
26
|
-
const BOTONIC_REGISTRY_PREFIX = "@botonic:registry=";
|
|
27
|
-
const LILARA_REGISTRY_LINE = "@lilara:registry=https://hubtype-489822642696.d.codeartifact.eu-west-1.amazonaws.com/npm/hubtype-internal/";
|
|
28
|
-
async function addLilaraRegistry(tree) {
|
|
29
|
-
if (!tree.exists(NPMRC)) {
|
|
30
|
-
import_devkit.logger.info(`\u2139\uFE0F ${NPMRC} not found \u2013 skipping`);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const content = tree.read(NPMRC, "utf-8") ?? "";
|
|
34
|
-
if (content.includes("@lilara:registry=")) {
|
|
35
|
-
import_devkit.logger.info("\u2139\uFE0F @lilara:registry already present \u2013 skipping");
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const lines = content.split("\n");
|
|
39
|
-
const botonicIdx = lines.findIndex((l) => l.startsWith(BOTONIC_REGISTRY_PREFIX));
|
|
40
|
-
let newContent;
|
|
41
|
-
if (botonicIdx !== -1) {
|
|
42
|
-
lines.splice(botonicIdx + 1, 0, LILARA_REGISTRY_LINE);
|
|
43
|
-
newContent = lines.join("\n");
|
|
44
|
-
} else {
|
|
45
|
-
newContent = content + (content.endsWith("\n") ? "" : "\n") + LILARA_REGISTRY_LINE + "\n";
|
|
46
|
-
}
|
|
47
|
-
tree.write(NPMRC, newContent);
|
|
48
|
-
import_devkit.logger.info(`\u2705 Added @lilara:registry to ${NPMRC}`);
|
|
49
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# Fix CSS Code Split Migration
|
|
2
|
-
|
|
3
|
-
## Summary
|
|
4
|
-
|
|
5
|
-
Vite generates multiple CSS chunks when code splitting is enabled. Only the main `webchat.botonic.css` (or `webviews.botonic.css`) is injected into `index.html`; secondary chunks like `webchat.botonic-[hash].css` are not referenced, causing styles to fail loading after build.
|
|
6
|
-
|
|
7
|
-
This migration adds `cssCodeSplit: false` to the vite build config so all CSS is merged into a single file that Vite injects correctly.
|
|
8
|
-
|
|
9
|
-
## What the automated migration does
|
|
10
|
-
|
|
11
|
-
- Adds `cssCodeSplit: false` to `vite/webchat.config.ts` build options
|
|
12
|
-
- Adds `cssCodeSplit: false` to `vite/webviews.config.ts` build options
|
|
13
|
-
- Skips files that already have `cssCodeSplit` configured
|
|
14
|
-
|
|
15
|
-
## What it cannot handle
|
|
16
|
-
|
|
17
|
-
- Bots with non-standard vite config layout (e.g. config in a different path)
|
|
18
|
-
- Custom build setups that override rollup CSS output
|
|
19
|
-
- Bots that intentionally use multiple CSS entry points
|
|
20
|
-
|
|
21
|
-
## Manual migration steps
|
|
22
|
-
|
|
23
|
-
If your bot has customized the vite config or the migration skips your project:
|
|
24
|
-
|
|
25
|
-
1. Open `vite/webchat.config.ts` and `vite/webviews.config.ts`
|
|
26
|
-
2. In the `build` section, add `cssCodeSplit: false,` after `reportCompressedSize: true,`
|
|
27
|
-
3. Example:
|
|
28
|
-
|
|
29
|
-
```ts
|
|
30
|
-
build: {
|
|
31
|
-
outDir: resolve(projectRoot, output.dir),
|
|
32
|
-
emptyOutDir: true,
|
|
33
|
-
reportCompressedSize: true,
|
|
34
|
-
cssCodeSplit: false, // add this line
|
|
35
|
-
commonjsOptions: { ... },
|
|
36
|
-
...
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Verification checklist
|
|
41
|
-
|
|
42
|
-
- [ ] Run `nx build <your-bot>` for webchat and webviews
|
|
43
|
-
- [ ] Inspect `dist/webchat/` and `dist/webviews/` — expect single `webchat.botonic.css` and `webviews.botonic.css`
|
|
44
|
-
- [ ] Run `nx serve-bot <your-bot>` and verify styles render correctly
|
|
45
|
-
- [ ] Deploy to staging and confirm no missing CSS in production
|
package/src/migrations/remove-codeartifact-registry/remove-codeartifact-registry.migration.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
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 remove_codeartifact_registry_migration_exports = {};
|
|
20
|
-
__export(remove_codeartifact_registry_migration_exports, {
|
|
21
|
-
default: () => removeCodeartifactRegistry
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(remove_codeartifact_registry_migration_exports);
|
|
24
|
-
var import_devkit = require("@nx/devkit");
|
|
25
|
-
const NPMRC = ".npmrc";
|
|
26
|
-
function isCodeArtifactScopedRegistryLine(line) {
|
|
27
|
-
const t = line.trim();
|
|
28
|
-
if (!t.startsWith("@botonic:registry=") && !t.startsWith("@hubtype-lilara:registry=")) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
return t.toLowerCase().includes("codeartifact");
|
|
32
|
-
}
|
|
33
|
-
function isCodeArtifactAuthLine(line) {
|
|
34
|
-
const t = line.trim();
|
|
35
|
-
if (!t.toLowerCase().includes("codeartifact")) return false;
|
|
36
|
-
return t.includes(":always-auth=") || t.includes(":_authToken=");
|
|
37
|
-
}
|
|
38
|
-
async function removeCodeartifactRegistry(tree) {
|
|
39
|
-
if (!tree.exists(NPMRC)) {
|
|
40
|
-
import_devkit.logger.info(`\u2139\uFE0F ${NPMRC} not found \u2013 skipping`);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const content = tree.read(NPMRC, "utf-8") ?? "";
|
|
44
|
-
const lines = content.split("\n");
|
|
45
|
-
const kept = lines.filter(
|
|
46
|
-
(l) => !isCodeArtifactScopedRegistryLine(l) && !isCodeArtifactAuthLine(l)
|
|
47
|
-
);
|
|
48
|
-
if (kept.length === lines.length) {
|
|
49
|
-
import_devkit.logger.info("\u2139\uFE0F No CodeArtifact entries in .npmrc \u2013 skipping");
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
let newContent = kept.join("\n");
|
|
53
|
-
while (newContent.includes("\n\n\n")) {
|
|
54
|
-
newContent = newContent.replace(/\n\n\n/g, "\n\n");
|
|
55
|
-
}
|
|
56
|
-
if (!newContent.endsWith("\n")) newContent += "\n";
|
|
57
|
-
tree.write(NPMRC, newContent);
|
|
58
|
-
import_devkit.logger.info(`\u2705 Removed CodeArtifact registry lines from ${NPMRC}`);
|
|
59
|
-
}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var sync_pending_bot_migrations_migration_exports = {};
|
|
30
|
-
__export(sync_pending_bot_migrations_migration_exports, {
|
|
31
|
-
default: () => syncPendingBotMigrations
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(sync_pending_bot_migrations_migration_exports);
|
|
34
|
-
var import_devkit = require("@nx/devkit");
|
|
35
|
-
var fs = __toESM(require("fs"));
|
|
36
|
-
var path = __toESM(require("path"));
|
|
37
|
-
var import_migration_utils = require("../utils/migration-utils");
|
|
38
|
-
const MODULE_DIR = __dirname;
|
|
39
|
-
const PENDING_FILE = ".botonic/pending-bot-migrations.json";
|
|
40
|
-
function resolveMigrationGuide(relPath) {
|
|
41
|
-
if (!relPath) return null;
|
|
42
|
-
return `node_modules/@botonic/nx-plugin/${relPath}`;
|
|
43
|
-
}
|
|
44
|
-
function semverLt(a, b) {
|
|
45
|
-
const parse = (v) => v.replace(/^[\^~]/, "").split(".").map(Number);
|
|
46
|
-
const [aMaj, aMin, aPatch] = parse(a);
|
|
47
|
-
const [bMaj, bMin, bPatch] = parse(b);
|
|
48
|
-
if (aMaj !== bMaj) return aMaj < bMaj;
|
|
49
|
-
if (aMin !== bMin) return aMin < bMin;
|
|
50
|
-
return aPatch < bPatch;
|
|
51
|
-
}
|
|
52
|
-
function readBotAppGenerators(moduleDir, pluginVersion) {
|
|
53
|
-
try {
|
|
54
|
-
const generatorsJsonPath = path.resolve(
|
|
55
|
-
moduleDir,
|
|
56
|
-
"..",
|
|
57
|
-
"..",
|
|
58
|
-
"..",
|
|
59
|
-
"generators.json"
|
|
60
|
-
);
|
|
61
|
-
const generatorsJson = JSON.parse(
|
|
62
|
-
fs.readFileSync(generatorsJsonPath, "utf-8")
|
|
63
|
-
);
|
|
64
|
-
return Object.entries(generatorsJson.generators).filter(([, entry]) => entry["x-bot-app-migration"] === true).map(([name, entry]) => {
|
|
65
|
-
const rawIntroducedIn = entry["x-introduced-in"];
|
|
66
|
-
const introducedIn = rawIntroducedIn && rawIntroducedIn !== "{{WORKSPACE_VERSION}}" ? rawIntroducedIn : pluginVersion;
|
|
67
|
-
return {
|
|
68
|
-
generator: `@botonic/nx-plugin:${name}`,
|
|
69
|
-
description: entry.description,
|
|
70
|
-
introducedIn,
|
|
71
|
-
migrationGuideRelPath: entry["x-migration-guide"] ?? null
|
|
72
|
-
};
|
|
73
|
-
});
|
|
74
|
-
} catch {
|
|
75
|
-
import_devkit.logger.warn(
|
|
76
|
-
"\u26A0\uFE0F Could not read generators.json \u2013 no bot-app generators queued."
|
|
77
|
-
);
|
|
78
|
-
return [];
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
async function syncPendingBotMigrations(tree) {
|
|
82
|
-
const pluginVersion = (0, import_migration_utils.getPluginVersion)(MODULE_DIR);
|
|
83
|
-
const BOT_APP_GENERATORS = readBotAppGenerators(MODULE_DIR, pluginVersion);
|
|
84
|
-
const botProjects = (0, import_migration_utils.findBotApps)(tree);
|
|
85
|
-
if (botProjects.length === 0) {
|
|
86
|
-
import_devkit.logger.info(
|
|
87
|
-
"\u2139\uFE0F No Botonic bot apps found. Skipping pending migrations setup."
|
|
88
|
-
);
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
let pendingMigrations = { pending: [] };
|
|
92
|
-
if (tree.exists(PENDING_FILE)) {
|
|
93
|
-
try {
|
|
94
|
-
pendingMigrations = (0, import_devkit.readJson)(tree, PENDING_FILE);
|
|
95
|
-
} catch {
|
|
96
|
-
import_devkit.logger.warn(`\u26A0\uFE0F Could not parse ${PENDING_FILE}, creating fresh.`);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
for (const generatorDef of BOT_APP_GENERATORS) {
|
|
100
|
-
const botsNeedingGenerator = botProjects.filter((projectPath) => {
|
|
101
|
-
const botVersion = (0, import_migration_utils.getCurrentBotonicCoreVersion)(tree, projectPath);
|
|
102
|
-
if (!botVersion) return true;
|
|
103
|
-
return semverLt(botVersion, generatorDef.introducedIn);
|
|
104
|
-
});
|
|
105
|
-
if (botsNeedingGenerator.length === 0) continue;
|
|
106
|
-
const existing = pendingMigrations.pending.find(
|
|
107
|
-
(e) => e.generator === generatorDef.generator
|
|
108
|
-
);
|
|
109
|
-
if (existing) {
|
|
110
|
-
import_devkit.logger.info(
|
|
111
|
-
`\u2139\uFE0F ${generatorDef.generator} already in pending list \u2013 skipping.`
|
|
112
|
-
);
|
|
113
|
-
} else {
|
|
114
|
-
pendingMigrations.pending.push({
|
|
115
|
-
version: generatorDef.introducedIn,
|
|
116
|
-
generator: generatorDef.generator,
|
|
117
|
-
description: generatorDef.description,
|
|
118
|
-
migrationGuide: resolveMigrationGuide(
|
|
119
|
-
generatorDef.migrationGuideRelPath
|
|
120
|
-
),
|
|
121
|
-
appliedTo: []
|
|
122
|
-
});
|
|
123
|
-
import_devkit.logger.info(
|
|
124
|
-
`\u2705 Queued ${generatorDef.generator} for ${botsNeedingGenerator.length} bot(s)`
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
if (!tree.exists(".botonic/.gitkeep")) {
|
|
129
|
-
tree.write(".botonic/.gitkeep", "");
|
|
130
|
-
}
|
|
131
|
-
tree.write(PENDING_FILE, JSON.stringify(pendingMigrations, null, 2));
|
|
132
|
-
import_devkit.logger.info("");
|
|
133
|
-
import_devkit.logger.info(
|
|
134
|
-
`\u{1F4CB} ${PENDING_FILE} updated with ${pendingMigrations.pending.length} pending generator(s).`
|
|
135
|
-
);
|
|
136
|
-
import_devkit.logger.info(" Run /update-bot in Cursor to apply them per bot.");
|
|
137
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Sync Pending Bot Migrations
|
|
2
|
-
|
|
3
|
-
## Summary
|
|
4
|
-
|
|
5
|
-
This migration sets up the per-bot migration tracking system. It writes `.botonic/pending-bot-migrations.json` listing all bot-app code generators that need to be applied to each bot in the workspace.
|
|
6
|
-
|
|
7
|
-
After this migration runs, use the `/update-bot` Cursor command to apply pending generators to individual bots one at a time.
|
|
8
|
-
|
|
9
|
-
## What the automated migration does
|
|
10
|
-
|
|
11
|
-
- Finds all Botonic bot apps in the workspace (projects tagged `botonic:bot-app`)
|
|
12
|
-
- Determines which bots are behind the current plugin version
|
|
13
|
-
- Writes `.botonic/pending-bot-migrations.json` with the list of generators to apply
|
|
14
|
-
- Does not modify any bot code — code transforms happen when you run `/update-bot`
|
|
15
|
-
|
|
16
|
-
## Verification checklist
|
|
17
|
-
|
|
18
|
-
- [ ] `.botonic/pending-bot-migrations.json` exists in the workspace root
|
|
19
|
-
- [ ] Run `/update-bot` in Cursor and follow the prompts to update each bot
|
package/src/migrations/update-cursor-commands-to-stubs/update-cursor-commands-to-stubs.migration.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
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 update_cursor_commands_to_stubs_migration_exports = {};
|
|
20
|
-
__export(update_cursor_commands_to_stubs_migration_exports, {
|
|
21
|
-
default: () => updateCursorCommandsToStubs
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(update_cursor_commands_to_stubs_migration_exports);
|
|
24
|
-
var import_devkit = require("@nx/devkit");
|
|
25
|
-
const STUB_UPDATE_BOT = `# Update Botonic Bot
|
|
26
|
-
|
|
27
|
-
Applies pending bot-app migrations from \`.botonic/pending-bot-migrations.json\` to a single bot.
|
|
28
|
-
|
|
29
|
-
Follow the full workflow in: \`node_modules/@botonic/nx-plugin/src/cursor-commands/update-bot.md\`
|
|
30
|
-
`;
|
|
31
|
-
const STUB_UPDATE_BOTONIC = `# Update Botonic Workspace
|
|
32
|
-
|
|
33
|
-
Updates the Botonic plugin to the latest version and queues pending bot-app migrations.
|
|
34
|
-
|
|
35
|
-
Follow the full workflow in: \`node_modules/@botonic/nx-plugin/src/cursor-commands/update-botonic.md\`
|
|
36
|
-
`;
|
|
37
|
-
const UPDATE_BOT_MD = ".cursor/commands/update-bot.md";
|
|
38
|
-
const UPDATE_BOTONIC_MD = ".cursor/commands/update-botonic.md";
|
|
39
|
-
function isAlreadyStub(content, canonicalRef) {
|
|
40
|
-
return content.includes(canonicalRef);
|
|
41
|
-
}
|
|
42
|
-
async function updateCursorCommandsToStubs(tree) {
|
|
43
|
-
if (tree.exists(UPDATE_BOT_MD)) {
|
|
44
|
-
const content = tree.read(UPDATE_BOT_MD, "utf-8") ?? "";
|
|
45
|
-
if (isAlreadyStub(content, "cursor-commands/update-bot.md")) {
|
|
46
|
-
import_devkit.logger.info("\u2139\uFE0F update-bot.md is already a stub \u2013 skipping");
|
|
47
|
-
} else {
|
|
48
|
-
tree.write(UPDATE_BOT_MD, STUB_UPDATE_BOT);
|
|
49
|
-
import_devkit.logger.info("\u2705 Replaced update-bot.md with stable stub");
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (tree.exists(UPDATE_BOTONIC_MD)) {
|
|
53
|
-
const content = tree.read(UPDATE_BOTONIC_MD, "utf-8") ?? "";
|
|
54
|
-
if (isAlreadyStub(content, "cursor-commands/update-botonic.md")) {
|
|
55
|
-
import_devkit.logger.info("\u2139\uFE0F update-botonic.md is already a stub \u2013 skipping");
|
|
56
|
-
} else {
|
|
57
|
-
tree.write(UPDATE_BOTONIC_MD, STUB_UPDATE_BOTONIC);
|
|
58
|
-
import_devkit.logger.info("\u2705 Replaced update-botonic.md with stable stub");
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
package/src/migrations/update-pnpm-workspace-scripts/update-pnpm-workspace-scripts.migration.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
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 update_pnpm_workspace_scripts_migration_exports = {};
|
|
20
|
-
__export(update_pnpm_workspace_scripts_migration_exports, {
|
|
21
|
-
default: () => updatePnpmWorkspaceScripts
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(update_pnpm_workspace_scripts_migration_exports);
|
|
24
|
-
var import_devkit = require("@nx/devkit");
|
|
25
|
-
const FIND_MIGRATION_GUIDES = ".cursor/scripts/update-bot/find-migration-guides.sh";
|
|
26
|
-
async function updatePnpmWorkspaceScripts(tree) {
|
|
27
|
-
if (!tree.exists(FIND_MIGRATION_GUIDES)) {
|
|
28
|
-
import_devkit.logger.info(
|
|
29
|
-
`\u2139\uFE0F ${FIND_MIGRATION_GUIDES} not found \u2013 skipping pnpm script update`
|
|
30
|
-
);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const content = tree.read(FIND_MIGRATION_GUIDES, "utf-8");
|
|
34
|
-
if (!content || !content.includes("npm install")) {
|
|
35
|
-
import_devkit.logger.info(
|
|
36
|
-
`\u2139\uFE0F ${FIND_MIGRATION_GUIDES} already references pnpm \u2013 skipping`
|
|
37
|
-
);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
tree.write(
|
|
41
|
-
FIND_MIGRATION_GUIDES,
|
|
42
|
-
content.replace(/npm install/g, "pnpm install")
|
|
43
|
-
);
|
|
44
|
-
import_devkit.logger.info(
|
|
45
|
-
`\u2705 Updated ${FIND_MIGRATION_GUIDES} to reference pnpm instead of npm`
|
|
46
|
-
);
|
|
47
|
-
}
|
/package/src/generators/preset/files/{.cursor → .claude}/scripts/update-bot/find-migration-guides.sh
RENAMED
|
File without changes
|