cartographer-ai 1.0.10 → 1.0.11

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,6 +1,6 @@
1
1
  {
2
2
  "name": "cartographer-ai",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "main": "src/commands.js",
5
5
  "type": "module",
6
6
  "bin": {
@@ -6,8 +6,6 @@ import { execSync } from "child_process";
6
6
  const regex =
7
7
  /@cartographer\s*((?:\s*(?:id|parentId|name|diagramType|context|spaceId|folderId):\s*[^,\n]+,\s*)*(?:\s*(?:id|parentId|name|diagramType|context|spaceId|folderId):\s*[^,\n]+)?)/;
8
8
  const ignoredDirectories = ["node_modules", ".git", "build"];
9
- export const warningPrefix = "\x1b[33mWarning:\x1b[0m";
10
- export const errorPrefix = "\x1b[31mError:\x1b[0m";
11
9
 
12
10
  export class Cartographer {
13
11
  constructor({ processAllFiles = false, spaceId, apiKey }) {
@@ -93,9 +91,9 @@ export class Cartographer {
93
91
  });
94
92
  } catch (error) {
95
93
  if (error?.response?.data?.error) {
96
- const errorMessage = `${errorPrefix} ${
94
+ const errorMessage = `\x1b[31m${
97
95
  error?.response?.data?.error ?? "Unexpected error occured"
98
- }`;
96
+ }\x1b[0m`;
99
97
 
100
98
  const err = new Error(errorMessage);
101
99
  err.stack = "";
@@ -173,11 +171,11 @@ export class Cartographer {
173
171
 
174
172
  if (forbidden.length > 0) {
175
173
  console.warn(
176
- `${warningPrefix} File "${path.basename(
174
+ `\x1b[33mFile "${path.basename(
177
175
  filePath
178
176
  )}" is invalid. When "parentId" is present, the following attributes must not be used: ${forbidden.join(
179
177
  ", "
180
- )}. These attributes have been ignored.`
178
+ )}. These attributes have been ignored.\x1b[0m`
181
179
  );
182
180
  }
183
181
 
@@ -223,7 +221,7 @@ export class Cartographer {
223
221
 
224
222
  files[resolvedId].push(file);
225
223
  } catch (error) {
226
- const errorMessage = `${errorPrefix} Error reading file ${filePath}, error: ${error.message}`;
224
+ const errorMessage = `\x1b[31mError reading file ${filePath}, error: ${error.message}\x1b[0m`;
227
225
  const err = new Error(errorMessage);
228
226
  err.stack = "";
229
227
 
package/src/commands.js CHANGED
@@ -1,9 +1,9 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  import fs from "fs";
4
4
  import path from "path";
5
- import { Cartographer, errorPrefix } from "./cartographer.js";
6
5
  import { fileURLToPath } from "url";
6
+ import { Cartographer } from "./cartographer.js";
7
7
 
8
8
  const args = process.argv.slice(2);
9
9
  const fields = ["spaceId", "apiKey"];
@@ -33,7 +33,7 @@ export const saveConfig = (configPath, newConfig) => {
33
33
 
34
34
  const handleCartographerCommand = (arg) => {
35
35
  if (!arg) {
36
- const errorMessage = `${errorPrefix} No command received`;
36
+ const errorMessage = `\x1b[31mNo command received\x1b[0m`;
37
37
  const err = new Error(errorMessage);
38
38
  err.stack = "";
39
39
 
@@ -50,9 +50,9 @@ const handleCartographerCommand = (arg) => {
50
50
  }, []);
51
51
 
52
52
  if (missingFields.length > 0) {
53
- const errorMessage = `${errorPrefix} Missing required fields: ${missingFields.join(
53
+ const errorMessage = `\x1b[31mMissing required fields: ${missingFields.join(
54
54
  ", "
55
- )}`;
55
+ )}\x1b[0m`;
56
56
 
57
57
  const err = new Error(errorMessage);
58
58
  err.stack = "";
@@ -81,7 +81,7 @@ const handleCartographerCommand = (arg) => {
81
81
  const field = fields.find((field) => field === command);
82
82
 
83
83
  if (!field) {
84
- const errorMessage = `${errorPrefix} Unknown command: ${command}`;
84
+ const errorMessage = `\x1b[31mUnknown command: ${command}\x1b[0m`;
85
85
  const err = new Error(errorMessage);
86
86
  err.stack = "";
87
87