builder-doctor 1.0.4 → 1.0.5

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
@@ -14,17 +14,38 @@ Or run directly with npx:
14
14
  npx builder-doctor
15
15
  ```
16
16
 
17
- or for additional details (like responses and headers):
17
+ ## Usage
18
+
19
+ ```bash
20
+ builder-doctor [options] [commands]
21
+ ```
22
+
23
+ ### Options
24
+
25
+ - `--verbose` - Show detailed output for each check
26
+ - `--help, -h` - Show help message
27
+
28
+ ### Running All Checks
29
+
30
+ Running without any command will execute both network and rules checks:
31
+
18
32
  ```bash
19
- npx builder-doctor --verbose
33
+ npx builder-doctor
34
+ npx builder-doctor --verbose # with detailed output
20
35
  ```
21
36
 
22
- ## Network checks
37
+ ## Commands
38
+
39
+ ### network
40
+
41
+ Check connectivity to Builder.io services.
23
42
 
24
43
  ```bash
25
44
  npx builder-doctor network
26
45
  ```
27
- The tool performs the following diagnostic checks for a valid http or ping response as a way to test network connectivity to:
46
+
47
+ The tool performs diagnostic checks for valid HTTP or ping responses to test network connectivity to:
48
+
28
49
  - firestore.googleapis.com
29
50
  - firebasestorage.googleapis.com
30
51
  - builder.io
@@ -33,24 +54,59 @@ The tool performs the following diagnostic checks for a valid http or ping respo
33
54
  - cdn.builder.io
34
55
  - *.builder.codes
35
56
  - *.builder.my
36
- - 34.136.119.149
57
+ - 34.136.119.149 (Static IP address used by Builder.io)
37
58
 
38
59
  The tool cannot verify connectivity to (but you should):
39
60
  - *.fly.dev
40
61
 
41
- ## Rules checks
62
+ ### rules
63
+
64
+ Analyze your Builder.io rules configuration.
42
65
 
43
66
  ```bash
44
67
  npx builder-doctor rules
45
68
  ```
46
- The tool analyses your .builderrules, agents.md and rules in .builder/rules or .cursor/rules. Recommendations are made to:
47
- - Find where there are too many rules being applied at once causing the AI to ignore some rules.
69
+
70
+ The tool analyzes your `.builderrules`, `agents.md`, and rules in `.builder/rules` or `.cursor/rules`. Recommendations are made to:
71
+
72
+ - Find where there are too many rules being applied at once causing the AI to ignore some rules
48
73
  - Common missing front matter like `description` where needed
49
74
  - Overuse of `alwaysApply`
50
- - Common incorrect namings of agents.md and .builderrules
75
+ - Common incorrect namings of `agents.md` and `.builderrules`
51
76
 
52
- ## ToDo
53
- - Verify if frontmatter like alwaysApply is respected without reference in agents.md
54
- - Verify if globs is respected without reference
55
- - Verify if rules are found from current working directory or root of project
77
+ ### setup
78
+
79
+ Run the Builder.io agent to analyze your project and provide setup instructions.
80
+
81
+ ```bash
82
+ npx builder-doctor setup
83
+ ```
84
+
85
+ This command uses the Builder.io agent to review your project and provide:
86
+ - Setup commands to install dependencies
87
+ - Dev commands to start the development server
88
+
89
+ The output is brief and formatted for easy reading.
90
+
91
+ ### env
92
+
93
+ Display all environment variables sorted alphabetically.
94
+
95
+ ```bash
96
+ npx builder-doctor env
97
+ npx builder-doctor env --verbose # shows count of variables
98
+ ```
99
+
100
+ Outputs all environment variables in `NAME=value` format, one per line, sorted alphabetically. Useful for debugging environment configuration issues.
101
+
102
+ ## Examples
103
+
104
+ ```bash
105
+ builder-doctor # Run network and rules checks
106
+ builder-doctor network # Run only network checks
107
+ builder-doctor rules # Run only rules checks
108
+ builder-doctor setup # Get project setup instructions
109
+ builder-doctor env # Display environment variables
110
+ builder-doctor --verbose # Run all checks with detailed output
111
+ ```
56
112
 
package/dist/env.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ export interface EnvOptions {
2
+ verbose?: boolean;
3
+ }
4
+ export interface EnvResult {
5
+ success: boolean;
6
+ variables: Record<string, string>;
7
+ }
8
+ /**
9
+ * Formats environment variables as NAME=value pairs, one per line, sorted alphabetically.
10
+ */
11
+ export declare function formatEnvOutput(variables: Record<string, string>): string;
12
+ /**
13
+ * Retrieves and displays all environment variables, sorted alphabetically.
14
+ */
15
+ export declare function runEnv(options?: EnvOptions): EnvResult;
16
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAGzE;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,OAAO,GAAE,UAAe,GAAG,SAAS,CAqB1D"}
package/dist/env.js ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatEnvOutput = formatEnvOutput;
4
+ exports.runEnv = runEnv;
5
+ /**
6
+ * Formats environment variables as NAME=value pairs, one per line, sorted alphabetically.
7
+ */
8
+ function formatEnvOutput(variables) {
9
+ const sortedKeys = Object.keys(variables).sort();
10
+ return sortedKeys.map((key) => `${key}=${variables[key]}`).join("\n");
11
+ }
12
+ /**
13
+ * Retrieves and displays all environment variables, sorted alphabetically.
14
+ */
15
+ function runEnv(options = {}) {
16
+ const variables = {};
17
+ // Read all environment variables, filtering out undefined values
18
+ for (const [key, value] of Object.entries(process.env)) {
19
+ if (value !== undefined) {
20
+ variables[key] = value;
21
+ }
22
+ }
23
+ if (options.verbose) {
24
+ console.log(`Found ${Object.keys(variables).length} environment variables`);
25
+ }
26
+ // Format and print to stdout
27
+ const output = formatEnvOutput(variables);
28
+ if (output) {
29
+ console.log(output);
30
+ }
31
+ return { success: true, variables };
32
+ }
33
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":";;AAYA,0CAGC;AAKD,wBAqBC;AAhCD;;GAEG;AACH,SAAgB,eAAe,CAAC,SAAiC;IAC/D,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC;IACjD,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxE,CAAC;AAED;;GAEG;AACH,SAAgB,MAAM,CAAC,UAAsB,EAAE;IAC7C,MAAM,SAAS,GAA2B,EAAE,CAAC;IAE7C,iEAAiE;IACjE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACvD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACzB,CAAC;IACH,CAAC;IAED,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,wBAAwB,CAAC,CAAC;IAC9E,CAAC;IAED,6BAA6B;IAC7B,MAAM,MAAM,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;IAC1C,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AACtC,CAAC"}
package/dist/index.js CHANGED
@@ -3,11 +3,41 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const rules_1 = require("./rules");
5
5
  const network_1 = require("./network");
6
+ const setup_1 = require("./setup");
7
+ const env_1 = require("./env");
6
8
  const args = process.argv.slice(2);
9
+ if (args.includes("--help") || args.includes("-h")) {
10
+ console.log(`
11
+ builder-doctor - A CLI tool for Builder.io diagnostics
12
+
13
+ Usage: builder-doctor [options] [commands]
14
+
15
+ Commands:
16
+ network Check connectivity to Builder.io services
17
+ rules Check Builder.io rules configuration
18
+ setup Run Builder.io agent to analyze project and provide setup instructions
19
+ env Display all environment variables sorted alphabetically
20
+
21
+ Options:
22
+ --verbose Show detailed output for each check
23
+ --help, -h Show this help message
24
+
25
+ Examples:
26
+ builder-doctor Run all checks
27
+ builder-doctor network Run only network checks
28
+ builder-doctor rules Run only rules checks
29
+ builder-doctor setup Get project setup instructions from Builder.io agent
30
+ builder-doctor env Display environment variables
31
+ builder-doctor --verbose Run all checks with detailed output
32
+ `);
33
+ process.exit(0);
34
+ }
7
35
  const verbose = args.includes("--verbose");
8
36
  const rules = args.includes("rules");
9
37
  const network = args.includes("network");
10
- const all = !rules && !network;
38
+ const setup = args.includes("setup");
39
+ const env = args.includes("env");
40
+ const all = !rules && !network && !setup && !env;
11
41
  async function main() {
12
42
  try {
13
43
  if (all || network) {
@@ -90,6 +120,15 @@ async function main() {
90
120
  verbose,
91
121
  });
92
122
  }
123
+ if (setup) {
124
+ const result = await (0, setup_1.runSetup)({ verbose });
125
+ if (!result.success) {
126
+ process.exit(result.exitCode);
127
+ }
128
+ }
129
+ if (env) {
130
+ (0, env_1.runEnv)({ verbose });
131
+ }
93
132
  }
94
133
  catch (error) {
95
134
  console.error("An error occurred:", error);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,mCAAqC;AACrC,uCAAkC;AAElC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACrC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAA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I;aACX,CAAC,CAAC;QACL,CAAC;QAED,IAAI,GAAG,IAAI,KAAK,EAAE,CAAC;YACjB,MAAM,IAAA,kBAAU,EAAC;gBACf,OAAO;aACR,CAAC,CAAC;QACL,CAAC;QAED,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,MAAM,GAAG,MAAM,IAAA,gBAAQ,EAAC,EAAE,OAAO,EAAE,CAAC,CAAC;YAC3C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;QAED,IAAI,GAAG,EAAE,CAAC;YACR,IAAA,YAAM,EAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ export interface SetupOptions {
2
+ verbose?: boolean;
3
+ }
4
+ export interface SetupResult {
5
+ success: boolean;
6
+ exitCode: number;
7
+ }
8
+ export declare function runSetup(options?: SetupOptions): Promise<SetupResult>;
9
+ //# sourceMappingURL=setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAYD,wBAAsB,QAAQ,CAC5B,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,CA+BtB"}
package/dist/setup.js ADDED
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runSetup = runSetup;
4
+ const child_process_1 = require("child_process");
5
+ const prompt = `
6
+ Review the project and provide the commands to run that will install its dependencies (title it Setup Command).
7
+ Also review the commands to run that will start the dev server (title it Dev Command).
8
+ Keep the output brief and to the point and output as text rather than markdown starting and ending the output with "-------------------------"`;
9
+ const SETUP_CONFIG = {
10
+ command: "npx",
11
+ args: ["@builder.io/agent", "code", "--disableMcp", "-y", `--prompt='${prompt}'`],
12
+ };
13
+ async function runSetup(options = {}) {
14
+ return new Promise((resolve) => {
15
+ const { command, args } = SETUP_CONFIG;
16
+ if (options.verbose) {
17
+ console.log(`Executing: ${command} ${args.join(" ")}`);
18
+ }
19
+ const child = (0, child_process_1.spawn)(command, args, {
20
+ stdio: "inherit",
21
+ shell: true,
22
+ });
23
+ child.on("error", (error) => {
24
+ console.error(`Failed to start setup process: ${error.message}`);
25
+ if (error.message.includes("ENOENT")) {
26
+ console.error("npx/npm is required but was not found. Please ensure Node.js and npm are installed.");
27
+ }
28
+ resolve({ success: false, exitCode: 1 });
29
+ });
30
+ child.on("close", (code) => {
31
+ const exitCode = code ?? 1;
32
+ if (exitCode !== 0) {
33
+ console.error(`Setup command exited with code ${exitCode}`);
34
+ }
35
+ resolve({ success: exitCode === 0, exitCode });
36
+ });
37
+ });
38
+ }
39
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";;AAqBA,4BAiCC;AAtDD,iDAAsC;AAWtC,MAAM,MAAM,GAAG;;;+IAGgI,CAAC;AAEhJ,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,CAAC,mBAAmB,EAAE,MAAM,EAAC,cAAc,EAAE,IAAI,EAAE,aAAa,MAAM,GAAG,CAAC;CACjF,CAAC;AAEK,KAAK,UAAU,QAAQ,CAC5B,UAAwB,EAAE;IAE1B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EA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4
  "description": "A CLI tool for Builder.io diagnostics",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -8,6 +8,7 @@
8
8
  },
9
9
  "scripts": {
10
10
  "build": "tsc",
11
+ "start": "npm run build && node dist/index.js",
11
12
  "prepublishOnly": "npm run build"
12
13
  },
13
14
  "keywords": [