@clipboard-health/ai-rules 0.2.5 → 0.2.7

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,10 +1,9 @@
1
1
  {
2
2
  "name": "@clipboard-health/ai-rules",
3
3
  "description": "Pre-built AI agent rules for consistent coding standards.",
4
- "version": "0.2.5",
4
+ "version": "0.2.7",
5
5
  "bugs": "https://github.com/ClipboardHealth/core-utils/issues",
6
6
  "devDependencies": {
7
- "@clipboard-health/util-ts": "3.17.3",
8
7
  "@intellectronica/ruler": "0.3.10"
9
8
  },
10
9
  "keywords": [
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PROFILES = exports.PATHS = void 0;
4
+ const node_path_1 = require("node:path");
5
+ const packageRoot = (0, node_path_1.join)(__dirname, "..");
6
+ exports.PATHS = {
7
+ packageRoot,
8
+ outputDirectory: (0, node_path_1.join)(packageRoot, "..", "..", "dist", "packages", "ai-rules"),
9
+ };
10
+ exports.PROFILES = {
11
+ frontend: ["common", "frontend"],
12
+ backend: ["common", "backend"],
13
+ fullstack: ["common", "frontend", "backend"],
14
+ common: ["common"],
15
+ };
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* eslint-disable unicorn/no-process-exit */
4
+ /* eslint-disable n/no-process-exit */
5
+ const promises_1 = require("node:fs/promises");
6
+ const node_path_1 = require("node:path");
7
+ const constants_1 = require("./constants");
8
+ const toErrorMessage_1 = require("./toErrorMessage");
9
+ const PATHS = {
10
+ projectRoot: (0, node_path_1.join)(__dirname, "../../.."),
11
+ rules: (0, node_path_1.join)(__dirname, ".."),
12
+ rulerDir: (0, node_path_1.join)(__dirname, "..", ".ruler"),
13
+ };
14
+ function getProfileFromArguments() {
15
+ const profile = process.argv[2];
16
+ if (!profile || !(profile in constants_1.PROFILES)) {
17
+ console.error("❌ Error: Invalid profile argument");
18
+ console.error(`Usage: npm run sync <profile>`);
19
+ console.error(`Available profiles: ${Object.keys(constants_1.PROFILES).join(", ")}`);
20
+ process.exit(1);
21
+ }
22
+ return profile;
23
+ }
24
+ async function sync() {
25
+ try {
26
+ const profile = getProfileFromArguments();
27
+ // Force copy files; rely on `git` if it overwrites files.
28
+ await (0, promises_1.cp)((0, node_path_1.join)(PATHS.rulerDir, profile), PATHS.projectRoot, { recursive: true, force: true });
29
+ console.log(`✅ @clipboard-health/ai-rules synced ${profile}`);
30
+ }
31
+ catch (error) {
32
+ // Log error but exit gracefully to avoid breaking installs
33
+ console.error(`⚠️ @clipboard-health/ai-rules sync failed: ${(0, toErrorMessage_1.toErrorMessage)(error)}`);
34
+ process.exit(0);
35
+ }
36
+ }
37
+ // eslint-disable-next-line unicorn/prefer-top-level-await
38
+ void sync();
39
+ /* eslint-enable n/no-process-exit */
40
+ /* eslint-enable unicorn/no-process-exit */
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toErrorMessage = toErrorMessage;
4
+ function toErrorMessage(error) {
5
+ return error instanceof Error ? (error.stack ?? error.message) : String(error);
6
+ }