@db-ux/agent-cli 4.5.2 → 4.5.4

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 CHANGED
@@ -1,10 +1,20 @@
1
1
  # @db-ux/agent-cli
2
2
 
3
- ## 4.5.2
3
+ ## 4.5.4
4
4
 
5
5
  _version bump_
6
6
 
7
7
 
8
+ ## 4.5.3
9
+
10
+ ### Patch Changes
11
+
12
+ - fix(agent-cli): add pnpm compatibility by following symlinks in `node_modules` - [see commit 28606fd](https://github.com/db-ux-design-system/core-web/commit/28606fdae48ca991cbe341c6a7ea5e0c420b3a46)
13
+
14
+ ## 4.5.2
15
+
16
+ _version bump_
17
+
8
18
  ## 4.5.1
9
19
 
10
20
  _version bump_
package/README.md CHANGED
@@ -17,8 +17,17 @@ Use this command in your repository:
17
17
  npx @db-ux/agent-cli
18
18
  ```
19
19
 
20
+ Or with pnpm:
21
+
22
+ ```shell
23
+ pnpm i @db-ux/agent-cli --save-dev
24
+ pnpm exec agent-cli
25
+ ```
26
+
20
27
  The DB UX Design System documentation will be added to (or replaced in subsequent runs, e.g. after a DB UX Design System update) in the file `.github/copilot-instructions.md` (if this file does not yet exist in your codebase, it will be created).
21
28
 
29
+ **Note:** The tool works with all package managers (npm, yarn, pnpm) and correctly handles symlinked packages in pnpm's node_modules structure.
30
+
22
31
  ### Advanced Usage
23
32
 
24
33
  You can also change the root path where the tool should check for `node_modules`:
package/build/index.js CHANGED
@@ -14,32 +14,37 @@ import path2 from "node:path";
14
14
  // src/utils/index.ts
15
15
  import fs from "node:fs";
16
16
  import path from "node:path";
17
- function findAllNodeModulesDirectories(directory, found = []) {
17
+ function findAllNodeModulesDirectories(directory, found = /* @__PURE__ */ new Set()) {
18
18
  if (!fs.existsSync(directory)) {
19
19
  return found;
20
20
  }
21
21
  const entries = fs.readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name, "en"));
22
22
  for (const entry of entries) {
23
- if (entry.isDirectory()) {
23
+ const fullPath = path.resolve(directory, entry.name);
24
+ let isDirectory = false;
25
+ try {
26
+ const stats = fs.statSync(fullPath);
27
+ isDirectory = stats.isDirectory();
28
+ } catch {
29
+ continue;
30
+ }
31
+ if (isDirectory) {
24
32
  if (entry.name === "node_modules") {
25
- found.push(path.join(directory, entry.name));
33
+ found.add(fs.realpathSync(fullPath));
26
34
  } else if (!entry.name.startsWith(".")) {
27
- findAllNodeModulesDirectories(
28
- path.join(directory, entry.name),
29
- found
30
- );
35
+ findAllNodeModulesDirectories(fullPath, found);
31
36
  }
32
37
  }
33
38
  }
34
39
  return found;
35
40
  }
36
41
  var getInstructions = (rootPath) => {
37
- let copilotInstructionsContent = "";
38
42
  const nodeModulesDirectories = findAllNodeModulesDirectories(rootPath);
39
- if (nodeModulesDirectories.length === 0) {
40
- console.error("No node_modules folders found.");
43
+ if (nodeModulesDirectories.size === 0) {
44
+ console.error("No node_modules folders found in", rootPath);
41
45
  return "";
42
46
  }
47
+ let copilotInstructionsContent = "";
43
48
  for (const nodeModulesPath of nodeModulesDirectories) {
44
49
  const databaseUxPaths = [
45
50
  path.join(nodeModulesPath, "@db-ux/"),
@@ -53,10 +58,30 @@ var getInstructions = (rootPath) => {
53
58
  withFileTypes: true
54
59
  });
55
60
  for (const package_ of packages) {
56
- if (package_.isDirectory()) {
61
+ let packagePath = path.resolve(databaseUxPath, package_.name);
62
+ let isDirectory = false;
63
+ try {
64
+ const stats = fs.statSync(packagePath);
65
+ isDirectory = stats.isDirectory();
66
+ if (!isDirectory && stats.isFile()) {
67
+ const content = fs.readFileSync(packagePath, "utf8").trim();
68
+ if (!content.includes("\n")) {
69
+ const targetPath = path.resolve(
70
+ path.dirname(packagePath),
71
+ content
72
+ );
73
+ if (fs.existsSync(targetPath) && fs.statSync(targetPath).isDirectory()) {
74
+ isDirectory = true;
75
+ packagePath = targetPath;
76
+ }
77
+ }
78
+ }
79
+ } catch {
80
+ continue;
81
+ }
82
+ if (isDirectory) {
57
83
  const instructionsPath = path.join(
58
- databaseUxPath,
59
- package_.name,
84
+ packagePath,
60
85
  "agent",
61
86
  "_instructions.md"
62
87
  );
@@ -64,7 +89,7 @@ var getInstructions = (rootPath) => {
64
89
  let content = fs.readFileSync(instructionsPath, "utf8");
65
90
  const relativePath = path.relative(
66
91
  rootPath,
67
- path.join(databaseUxPath, package_.name)
92
+ packagePath
68
93
  );
69
94
  content = content.replaceAll(
70
95
  "__agent-path__",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@db-ux/agent-cli",
3
- "version": "4.5.2",
3
+ "version": "4.5.4",
4
4
  "type": "module",
5
5
  "description": "CLI for DB UX Design System generate AI agent instructions",
6
6
  "repository": {