@db-ux/agent-cli 4.5.2-0-eff2227 → 4.5.2-agent-cli-pnpm-compatibility-ebd2994

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/README.md CHANGED
@@ -17,8 +17,16 @@ 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 exec @db-ux/agent-cli
24
+ ```
25
+
20
26
  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
27
 
28
+ **Note:** The tool works with all package managers (npm, yarn, pnpm) and correctly handles symlinked packages in pnpm's node_modules structure.
29
+
22
30
  ### Advanced Usage
23
31
 
24
32
  You can also change the root path where the tool should check for `node_modules`:
package/build/index.js CHANGED
@@ -14,32 +14,36 @@ 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.");
41
- return "";
43
+ if (nodeModulesDirectories.size === 0) {
44
+ return "No node_modules folders found.";
42
45
  }
46
+ let copilotInstructionsContent = "";
43
47
  for (const nodeModulesPath of nodeModulesDirectories) {
44
48
  const databaseUxPaths = [
45
49
  path.join(nodeModulesPath, "@db-ux/"),
@@ -53,10 +57,27 @@ var getInstructions = (rootPath) => {
53
57
  withFileTypes: true
54
58
  });
55
59
  for (const package_ of packages) {
56
- if (package_.isDirectory()) {
60
+ let packagePath = path.resolve(databaseUxPath, package_.name);
61
+ let isDirectory = false;
62
+ try {
63
+ const stats = fs.statSync(packagePath);
64
+ isDirectory = stats.isDirectory();
65
+ if (!isDirectory && stats.isFile()) {
66
+ const content = fs.readFileSync(packagePath, "utf8").trim();
67
+ if (!content.includes("\n")) {
68
+ const targetPath = path.resolve(path.dirname(packagePath), content);
69
+ if (fs.existsSync(targetPath) && fs.statSync(targetPath).isDirectory()) {
70
+ isDirectory = true;
71
+ packagePath = targetPath;
72
+ }
73
+ }
74
+ }
75
+ } catch {
76
+ continue;
77
+ }
78
+ if (isDirectory) {
57
79
  const instructionsPath = path.join(
58
- databaseUxPath,
59
- package_.name,
80
+ packagePath,
60
81
  "agent",
61
82
  "_instructions.md"
62
83
  );
@@ -64,7 +85,7 @@ var getInstructions = (rootPath) => {
64
85
  let content = fs.readFileSync(instructionsPath, "utf8");
65
86
  const relativePath = path.relative(
66
87
  rootPath,
67
- path.join(databaseUxPath, package_.name)
88
+ packagePath
68
89
  );
69
90
  content = content.replaceAll(
70
91
  "__agent-path__",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@db-ux/agent-cli",
3
- "version": "4.5.2-0-eff2227",
3
+ "version": "4.5.2-agent-cli-pnpm-compatibility-ebd2994",
4
4
  "type": "module",
5
5
  "description": "CLI for DB UX Design System generate AI agent instructions",
6
6
  "repository": {