dx-devkit 0.0.0-stage → 1.1.0

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.
Files changed (172) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/LICENSE +21 -0
  3. package/README.md +475 -2
  4. package/bin/dx-mcp.js +2 -0
  5. package/dist/command.d.ts +9 -0
  6. package/dist/command.d.ts.map +1 -0
  7. package/dist/command.js +2 -0
  8. package/dist/command.js.map +1 -0
  9. package/dist/commands/ai.d.ts +7 -0
  10. package/dist/commands/ai.d.ts.map +1 -0
  11. package/dist/commands/ai.js +148 -0
  12. package/dist/commands/ai.js.map +1 -0
  13. package/dist/commands/clean.d.ts +3 -0
  14. package/dist/commands/clean.d.ts.map +1 -0
  15. package/dist/commands/clean.js +72 -0
  16. package/dist/commands/clean.js.map +1 -0
  17. package/dist/commands/deps.d.ts +3 -0
  18. package/dist/commands/deps.d.ts.map +1 -0
  19. package/dist/commands/deps.js +98 -0
  20. package/dist/commands/deps.js.map +1 -0
  21. package/dist/commands/go.d.ts +3 -0
  22. package/dist/commands/go.d.ts.map +1 -0
  23. package/dist/commands/go.js +202 -0
  24. package/dist/commands/go.js.map +1 -0
  25. package/dist/commands/log.d.ts +3 -0
  26. package/dist/commands/log.d.ts.map +1 -0
  27. package/dist/commands/log.js +51 -0
  28. package/dist/commands/log.js.map +1 -0
  29. package/dist/commands/new.d.ts +3 -0
  30. package/dist/commands/new.d.ts.map +1 -0
  31. package/dist/commands/new.js +117 -0
  32. package/dist/commands/new.js.map +1 -0
  33. package/dist/commands/port.d.ts +4 -0
  34. package/dist/commands/port.d.ts.map +1 -0
  35. package/dist/commands/port.js +106 -0
  36. package/dist/commands/port.js.map +1 -0
  37. package/dist/commands/projects.d.ts +5 -0
  38. package/dist/commands/projects.d.ts.map +1 -0
  39. package/dist/commands/projects.js +46 -0
  40. package/dist/commands/projects.js.map +1 -0
  41. package/dist/commands/stack.d.ts +34 -0
  42. package/dist/commands/stack.d.ts.map +1 -0
  43. package/dist/commands/stack.js +140 -0
  44. package/dist/commands/stack.js.map +1 -0
  45. package/dist/commands/summary.d.ts +3 -0
  46. package/dist/commands/summary.d.ts.map +1 -0
  47. package/dist/commands/summary.js +88 -0
  48. package/dist/commands/summary.js.map +1 -0
  49. package/dist/commands/system.d.ts +5 -0
  50. package/dist/commands/system.d.ts.map +1 -0
  51. package/dist/commands/system.js +104 -0
  52. package/dist/commands/system.js.map +1 -0
  53. package/dist/commands/ui.d.ts +3 -0
  54. package/dist/commands/ui.d.ts.map +1 -0
  55. package/dist/commands/ui.js +96 -0
  56. package/dist/commands/ui.js.map +1 -0
  57. package/dist/index.d.ts +3 -0
  58. package/dist/index.d.ts.map +1 -0
  59. package/dist/index.js +103 -0
  60. package/dist/index.js.map +1 -0
  61. package/dist/ui.d.ts +27 -0
  62. package/dist/ui.d.ts.map +1 -0
  63. package/dist/ui.js +104 -0
  64. package/dist/ui.js.map +1 -0
  65. package/node_modules/@dx/core/dist/config.d.ts +46 -0
  66. package/node_modules/@dx/core/dist/config.d.ts.map +1 -0
  67. package/node_modules/@dx/core/dist/config.js +131 -0
  68. package/node_modules/@dx/core/dist/config.js.map +1 -0
  69. package/node_modules/@dx/core/dist/fuzzy.d.ts +15 -0
  70. package/node_modules/@dx/core/dist/fuzzy.d.ts.map +1 -0
  71. package/node_modules/@dx/core/dist/fuzzy.js +63 -0
  72. package/node_modules/@dx/core/dist/fuzzy.js.map +1 -0
  73. package/node_modules/@dx/core/dist/index.d.ts +17 -0
  74. package/node_modules/@dx/core/dist/index.d.ts.map +1 -0
  75. package/node_modules/@dx/core/dist/index.js +19 -0
  76. package/node_modules/@dx/core/dist/index.js.map +1 -0
  77. package/node_modules/@dx/core/dist/runs.d.ts +19 -0
  78. package/node_modules/@dx/core/dist/runs.d.ts.map +1 -0
  79. package/node_modules/@dx/core/dist/runs.js +41 -0
  80. package/node_modules/@dx/core/dist/runs.js.map +1 -0
  81. package/node_modules/@dx/core/dist/tools/aiSetup.d.ts +58 -0
  82. package/node_modules/@dx/core/dist/tools/aiSetup.d.ts.map +1 -0
  83. package/node_modules/@dx/core/dist/tools/aiSetup.js +243 -0
  84. package/node_modules/@dx/core/dist/tools/aiSetup.js.map +1 -0
  85. package/node_modules/@dx/core/dist/tools/cleanup.d.ts +61 -0
  86. package/node_modules/@dx/core/dist/tools/cleanup.d.ts.map +1 -0
  87. package/node_modules/@dx/core/dist/tools/cleanup.js +171 -0
  88. package/node_modules/@dx/core/dist/tools/cleanup.js.map +1 -0
  89. package/node_modules/@dx/core/dist/tools/deps.d.ts +57 -0
  90. package/node_modules/@dx/core/dist/tools/deps.d.ts.map +1 -0
  91. package/node_modules/@dx/core/dist/tools/deps.js +151 -0
  92. package/node_modules/@dx/core/dist/tools/deps.js.map +1 -0
  93. package/node_modules/@dx/core/dist/tools/devErrors.d.ts +74 -0
  94. package/node_modules/@dx/core/dist/tools/devErrors.d.ts.map +1 -0
  95. package/node_modules/@dx/core/dist/tools/devErrors.js +261 -0
  96. package/node_modules/@dx/core/dist/tools/devErrors.js.map +1 -0
  97. package/node_modules/@dx/core/dist/tools/doctor.d.ts +12 -0
  98. package/node_modules/@dx/core/dist/tools/doctor.d.ts.map +1 -0
  99. package/node_modules/@dx/core/dist/tools/doctor.js +176 -0
  100. package/node_modules/@dx/core/dist/tools/doctor.js.map +1 -0
  101. package/node_modules/@dx/core/dist/tools/github.d.ts +31 -0
  102. package/node_modules/@dx/core/dist/tools/github.d.ts.map +1 -0
  103. package/node_modules/@dx/core/dist/tools/github.js +80 -0
  104. package/node_modules/@dx/core/dist/tools/github.js.map +1 -0
  105. package/node_modules/@dx/core/dist/tools/journal.d.ts +23 -0
  106. package/node_modules/@dx/core/dist/tools/journal.d.ts.map +1 -0
  107. package/node_modules/@dx/core/dist/tools/journal.js +80 -0
  108. package/node_modules/@dx/core/dist/tools/journal.js.map +1 -0
  109. package/node_modules/@dx/core/dist/tools/launch.d.ts +24 -0
  110. package/node_modules/@dx/core/dist/tools/launch.d.ts.map +1 -0
  111. package/node_modules/@dx/core/dist/tools/launch.js +137 -0
  112. package/node_modules/@dx/core/dist/tools/launch.js.map +1 -0
  113. package/node_modules/@dx/core/dist/tools/ports.d.ts +42 -0
  114. package/node_modules/@dx/core/dist/tools/ports.d.ts.map +1 -0
  115. package/node_modules/@dx/core/dist/tools/ports.js +220 -0
  116. package/node_modules/@dx/core/dist/tools/ports.js.map +1 -0
  117. package/node_modules/@dx/core/dist/tools/projects.d.ts +58 -0
  118. package/node_modules/@dx/core/dist/tools/projects.d.ts.map +1 -0
  119. package/node_modules/@dx/core/dist/tools/projects.js +208 -0
  120. package/node_modules/@dx/core/dist/tools/projects.js.map +1 -0
  121. package/node_modules/@dx/core/dist/tools/scaffold.d.ts +40 -0
  122. package/node_modules/@dx/core/dist/tools/scaffold.d.ts.map +1 -0
  123. package/node_modules/@dx/core/dist/tools/scaffold.js +188 -0
  124. package/node_modules/@dx/core/dist/tools/scaffold.js.map +1 -0
  125. package/node_modules/@dx/core/dist/tools/stacks.d.ts +119 -0
  126. package/node_modules/@dx/core/dist/tools/stacks.d.ts.map +1 -0
  127. package/node_modules/@dx/core/dist/tools/stacks.js +386 -0
  128. package/node_modules/@dx/core/dist/tools/stacks.js.map +1 -0
  129. package/node_modules/@dx/core/dist/tools/summary.d.ts +87 -0
  130. package/node_modules/@dx/core/dist/tools/summary.d.ts.map +1 -0
  131. package/node_modules/@dx/core/dist/tools/summary.js +331 -0
  132. package/node_modules/@dx/core/dist/tools/summary.js.map +1 -0
  133. package/node_modules/@dx/core/package.json +20 -0
  134. package/node_modules/@dx/mcp/dist/index.d.ts +3 -0
  135. package/node_modules/@dx/mcp/dist/index.d.ts.map +1 -0
  136. package/node_modules/@dx/mcp/dist/index.js +540 -0
  137. package/node_modules/@dx/mcp/dist/index.js.map +1 -0
  138. package/node_modules/@dx/mcp/package.json +8 -0
  139. package/node_modules/@dx/web/dist/api.d.ts +13 -0
  140. package/node_modules/@dx/web/dist/api.d.ts.map +1 -0
  141. package/node_modules/@dx/web/dist/api.js +351 -0
  142. package/node_modules/@dx/web/dist/api.js.map +1 -0
  143. package/node_modules/@dx/web/dist/background.d.ts +2 -0
  144. package/node_modules/@dx/web/dist/background.d.ts.map +1 -0
  145. package/node_modules/@dx/web/dist/background.js +24 -0
  146. package/node_modules/@dx/web/dist/background.js.map +1 -0
  147. package/node_modules/@dx/web/dist/check.d.ts +39 -0
  148. package/node_modules/@dx/web/dist/check.d.ts.map +1 -0
  149. package/node_modules/@dx/web/dist/check.js +97 -0
  150. package/node_modules/@dx/web/dist/check.js.map +1 -0
  151. package/node_modules/@dx/web/dist/dev.d.ts +109 -0
  152. package/node_modules/@dx/web/dist/dev.d.ts.map +1 -0
  153. package/node_modules/@dx/web/dist/dev.js +645 -0
  154. package/node_modules/@dx/web/dist/dev.js.map +1 -0
  155. package/node_modules/@dx/web/dist/link.d.ts +45 -0
  156. package/node_modules/@dx/web/dist/link.d.ts.map +1 -0
  157. package/node_modules/@dx/web/dist/link.js +150 -0
  158. package/node_modules/@dx/web/dist/link.js.map +1 -0
  159. package/node_modules/@dx/web/dist/proxy.d.ts +21 -0
  160. package/node_modules/@dx/web/dist/proxy.d.ts.map +1 -0
  161. package/node_modules/@dx/web/dist/proxy.js +140 -0
  162. package/node_modules/@dx/web/dist/proxy.js.map +1 -0
  163. package/node_modules/@dx/web/dist/server.d.ts +33 -0
  164. package/node_modules/@dx/web/dist/server.d.ts.map +1 -0
  165. package/node_modules/@dx/web/dist/server.js +184 -0
  166. package/node_modules/@dx/web/dist/server.js.map +1 -0
  167. package/node_modules/@dx/web/package.json +26 -0
  168. package/node_modules/@dx/web/public/app.js +1553 -0
  169. package/node_modules/@dx/web/public/icon.svg +1 -0
  170. package/node_modules/@dx/web/public/index.html +47 -0
  171. package/node_modules/@dx/web/public/styles.css +1124 -0
  172. package/package.json +52 -4
@@ -0,0 +1,46 @@
1
+ /** Everything dx stores lives in one folder: ~/.dx (override with the DX_HOME env var). */
2
+ export declare function dxHome(): string;
3
+ export declare function dxPath(...parts: string[]): string;
4
+ export interface DxConfig {
5
+ /** Folders that hold your projects. Each is scanned `scanDepth` levels deep. */
6
+ projectsRoots: string[];
7
+ /** Command that opens a folder in your editor: "code", "cursor", or a full quoted path. */
8
+ editor: string;
9
+ /** How many folder levels below a root to look for projects (1 = direct children only). */
10
+ scanDepth: number;
11
+ /** Folder names never scanned (in addition to anything starting with "."). */
12
+ ignore: string[];
13
+ /** Seconds `dx go` waits for the dev server port before giving up on opening the browser. */
14
+ devServerTimeout: number;
15
+ /** Your GitHub username, for pull requests in `dx summary`. Guessed from your repos' remotes when unset. */
16
+ githubUser?: string;
17
+ /** Where `dx new` looks for templates (default ~/.dx/templates). */
18
+ templatesDir?: string;
19
+ /** Connect dx to newly installed AI tools automatically (default true). */
20
+ autoConnectAi?: boolean;
21
+ /** AI tools dx has already offered itself to, so one you disconnected stays disconnected. */
22
+ aiToolsSeen?: string[];
23
+ /** Serve running apps at name.localhost (default true). */
24
+ localDomains?: boolean;
25
+ /** Port for name.localhost; default 80, or 1355 when 80 is taken. */
26
+ localDomainsPort?: number;
27
+ }
28
+ /** The common code folders that exist on this computer. */
29
+ export declare function detectProjectRoots(home?: string): string[];
30
+ /** The first editor command found on PATH, or "code". */
31
+ export declare function detectEditor(): string;
32
+ export declare function defaultConfig(): DxConfig;
33
+ /** The config written on first run: the defaults, with code folders and editor found on this computer. */
34
+ export declare function firstRunConfig(): DxConfig;
35
+ export declare const CONFIG_FILE = "config.json";
36
+ export declare function configPath(): string;
37
+ export declare function ensureDxHome(): string;
38
+ /**
39
+ * Reads ~/.dx/config.json, creating it with defaults on first run.
40
+ * Missing keys fall back to defaults, so old config files keep working as options are added.
41
+ */
42
+ export declare function loadConfig(): DxConfig;
43
+ export declare function saveConfig(config: DxConfig): void;
44
+ export declare function expandHome(p: string): string;
45
+ export declare function stripBom(text: string): string;
46
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version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I,CAGjD;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAI5C;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7C"}
@@ -0,0 +1,131 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import fs from "node:fs";
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+ /** Everything dx stores lives in one folder: ~/.dx (override with the DX_HOME env var). */
6
+ export function dxHome() {
7
+ return process.env.DX_HOME ?? path.join(os.homedir(), ".dx");
8
+ }
9
+ export function dxPath(...parts) {
10
+ return path.join(dxHome(), ...parts);
11
+ }
12
+ /** Folders people usually keep their code in, checked on first run. */
13
+ const COMMON_ROOTS = [
14
+ "projects",
15
+ "code",
16
+ "dev",
17
+ "Developer",
18
+ "src",
19
+ "repos",
20
+ "workspace",
21
+ "git",
22
+ "GitHub",
23
+ path.join("Documents", "GitHub"),
24
+ path.join("Documents", "projects"),
25
+ path.join("Documents", "code"),
26
+ path.join("Desktop", "projects"),
27
+ path.join("source", "repos"),
28
+ ];
29
+ const COMMON_EDITORS = ["code", "cursor", "windsurf", "zed", "subl", "webstorm", "idea"];
30
+ /** The common code folders that exist on this computer. */
31
+ export function detectProjectRoots(home = os.homedir()) {
32
+ const found = [];
33
+ const seen = new Set();
34
+ for (const rel of COMMON_ROOTS) {
35
+ const dir = path.join(home, rel);
36
+ try {
37
+ if (!fs.statSync(dir).isDirectory())
38
+ continue;
39
+ const real = fs.realpathSync.native(dir);
40
+ const id = process.platform === "linux" ? real : real.toLowerCase();
41
+ if (seen.has(id))
42
+ continue;
43
+ seen.add(id);
44
+ found.push(real);
45
+ }
46
+ catch {
47
+ // not there
48
+ }
49
+ }
50
+ return found;
51
+ }
52
+ /** The first editor command found on PATH, or "code". */
53
+ export function detectEditor() {
54
+ for (const editor of COMMON_EDITORS) {
55
+ const r = spawnSync(process.platform === "win32" ? "where" : "which", [editor], { windowsHide: true, stdio: "ignore" });
56
+ if (r.status === 0)
57
+ return editor;
58
+ }
59
+ return "code";
60
+ }
61
+ export function defaultConfig() {
62
+ return {
63
+ projectsRoots: [path.join(os.homedir(), "projects")],
64
+ editor: "code",
65
+ scanDepth: 2,
66
+ ignore: ["node_modules", "dist", "build", "out", "vendor", "target", "bin", "obj"],
67
+ devServerTimeout: 90,
68
+ };
69
+ }
70
+ /** The config written on first run: the defaults, with code folders and editor found on this computer. */
71
+ export function firstRunConfig() {
72
+ const config = defaultConfig();
73
+ const roots = detectProjectRoots();
74
+ if (roots.length)
75
+ config.projectsRoots = roots;
76
+ config.editor = detectEditor();
77
+ return config;
78
+ }
79
+ export const CONFIG_FILE = "config.json";
80
+ export function configPath() {
81
+ return dxPath(CONFIG_FILE);
82
+ }
83
+ export function ensureDxHome() {
84
+ const home = dxHome();
85
+ fs.mkdirSync(home, { recursive: true });
86
+ return home;
87
+ }
88
+ /**
89
+ * Reads ~/.dx/config.json, creating it with defaults on first run.
90
+ * Missing keys fall back to defaults, so old config files keep working as options are added.
91
+ */
92
+ export function loadConfig() {
93
+ const file = configPath();
94
+ const defaults = defaultConfig();
95
+ if (!fs.existsSync(file)) {
96
+ ensureDxHome();
97
+ const first = firstRunConfig();
98
+ fs.writeFileSync(file, JSON.stringify(first, null, 2) + "\n", "utf8");
99
+ return first;
100
+ }
101
+ let raw;
102
+ try {
103
+ raw = JSON.parse(stripBom(fs.readFileSync(file, "utf8")));
104
+ }
105
+ catch (err) {
106
+ throw new Error(`Your dx config isn't valid JSON: ${file}\n${err.message}`);
107
+ }
108
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
109
+ throw new Error(`Your dx config should be a JSON object: ${file}`);
110
+ }
111
+ const merged = { ...defaults, ...raw };
112
+ if (!Array.isArray(merged.projectsRoots))
113
+ merged.projectsRoots = [String(merged.projectsRoots)];
114
+ merged.projectsRoots = merged.projectsRoots.map(expandHome);
115
+ return merged;
116
+ }
117
+ export function saveConfig(config) {
118
+ ensureDxHome();
119
+ fs.writeFileSync(configPath(), JSON.stringify(config, null, 2) + "\n", "utf8");
120
+ }
121
+ export function expandHome(p) {
122
+ if (p === "~")
123
+ return os.homedir();
124
+ if (p.startsWith("~/") || p.startsWith("~\\"))
125
+ return path.join(os.homedir(), p.slice(2));
126
+ return p;
127
+ }
128
+ export function stripBom(text) {
129
+ return text.charCodeAt(0) === 0xfeff ? text.slice(1) : text;
130
+ }
131
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,2FAA2F;AAC3F,MAAM,UAAU,MAAM;IACpB,OAAO,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAG,KAAe;IACvC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,KAAK,CAAC,CAAC;AACvC,CAAC;AA2BD,uEAAuE;AACvE,MAAM,YAAY,GAAG;IACnB,UAAU;IACV,MAAM;IACN,KAAK;IACL,WAAW;IACX,KAAK;IACL,OAAO;IACP,WAAW;IACX,KAAK;IACL,QAAQ;IACR,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC;IAChC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC;IAClC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC;IAC9B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAChC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC7B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a,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,CAAS;IAClC,IAAI,CAAC,KAAK,GAAG;QAAE,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC;IACnC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1F,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Small fuzzy scorer for names like "shop-website" or "Admin-Frontend".
3
+ * Higher is better; -1 means no match.
4
+ *
5
+ * exact > prefix > start of a word ("web" in "shop-website") > substring > letters in order ("sw")
6
+ */
7
+ export declare function fuzzyScore(query: string, target: string): number;
8
+ export interface Ranked<T> {
9
+ item: T;
10
+ score: number;
11
+ }
12
+ export declare function fuzzyRank<T>(query: string, items: T[], keys: (item: T) => string[]): Ranked<T>[];
13
+ /** "Admin-Frontend" -> ["Slyder", "Frontend"]; "gitHooks" -> ["gateway", "Hub"] */
14
+ export declare function splitWords(s: string): string[];
15
+ //# sourceMappingURL=fuzzy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fuzzy.d.ts","sourceRoot":"","sources":["../src/fuzzy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CA6BhE;AAED,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAQhG;AAMD,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAK9C"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Small fuzzy scorer for names like "shop-website" or "Admin-Frontend".
3
+ * Higher is better; -1 means no match.
4
+ *
5
+ * exact > prefix > start of a word ("web" in "shop-website") > substring > letters in order ("sw")
6
+ */
7
+ export function fuzzyScore(query, target) {
8
+ const q = normalize(query);
9
+ const t = normalize(target);
10
+ if (!q)
11
+ return 0;
12
+ if (!t)
13
+ return -1;
14
+ if (t === q)
15
+ return 1000;
16
+ if (t.startsWith(q))
17
+ return 900 - (t.length - q.length);
18
+ const words = splitWords(target).map(normalize);
19
+ if (words.some((w) => w.startsWith(q)))
20
+ return 700 - (t.length - q.length);
21
+ const acronym = words.map((w) => w[0] ?? "").join("");
22
+ if (acronym.startsWith(q) && q.length >= 2)
23
+ return 650 - (acronym.length - q.length);
24
+ const idx = t.indexOf(q);
25
+ if (idx >= 0)
26
+ return 500 - idx - (t.length - q.length) / 10;
27
+ // letters in order, fewer gaps is better
28
+ let ti = 0;
29
+ let gaps = 0;
30
+ let last = -1;
31
+ for (const ch of q) {
32
+ const found = t.indexOf(ch, ti);
33
+ if (found < 0)
34
+ return -1;
35
+ if (last >= 0)
36
+ gaps += found - last - 1;
37
+ last = found;
38
+ ti = found + 1;
39
+ }
40
+ return Math.max(1, 300 - gaps * 5 - (t.length - q.length));
41
+ }
42
+ export function fuzzyRank(query, items, keys) {
43
+ const ranked = [];
44
+ for (const item of items) {
45
+ let best = -1;
46
+ for (const key of keys(item))
47
+ best = Math.max(best, fuzzyScore(query, key));
48
+ if (best >= 0)
49
+ ranked.push({ item, score: best });
50
+ }
51
+ return ranked.sort((a, b) => b.score - a.score);
52
+ }
53
+ function normalize(s) {
54
+ return s.toLowerCase().replace(/[\s_\-.]+/g, "");
55
+ }
56
+ /** "Admin-Frontend" -> ["Slyder", "Frontend"]; "gitHooks" -> ["gateway", "Hub"] */
57
+ export function splitWords(s) {
58
+ return s
59
+ .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
60
+ .split(/[\s_\-.]+/)
61
+ .filter(Boolean);
62
+ }
63
+ //# sourceMappingURL=fuzzy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fuzzy.js","sourceRoot":"","sources":["../src/fuzzy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,MAAc;IACtD,MAAM,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAC3B,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5B,IAAI,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IACjB,IAAI,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC,CAAC;IAClB,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;QAAE,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IAExD,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAChD,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC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,CAAC,MAAM,CAAC,CAAC,CAAC;AAC7D,CAAC;AAOD,MAAM,UAAU,SAAS,CAAI,KAAa,EAAE,KAAU,EAAE,IAA2B;IACjF,MAAM,MAAM,GAAgB,EAAE,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC;QACd,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC;YAAE,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;QAC5E,IAAI,IAAI,IAAI,CAAC;YAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,SAAS,CAAC,CAAS;IAC1B,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,UAAU,CAAC,CAAS;IAClC,OAAO,CAAC;SACL,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC;SACtC,KAAK,CAAC,WAAW,CAAC;SAClB,MAAM,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC"}
@@ -0,0 +1,17 @@
1
+ export * from "./config.js";
2
+ export * from "./runs.js";
3
+ export * from "./fuzzy.js";
4
+ export * from "./tools/projects.js";
5
+ export * from "./tools/ports.js";
6
+ export * from "./tools/launch.js";
7
+ export * from "./tools/journal.js";
8
+ export * from "./tools/doctor.js";
9
+ export * from "./tools/summary.js";
10
+ export * from "./tools/github.js";
11
+ export * from "./tools/cleanup.js";
12
+ export * from "./tools/deps.js";
13
+ export * from "./tools/scaffold.js";
14
+ export * from "./tools/devErrors.js";
15
+ export * from "./tools/aiSetup.js";
16
+ export * from "./tools/stacks.js";
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,19 @@
1
+ // Every tool lives here once. The dx CLI, the Raycast extension and the MCP server are thin
2
+ // front ends that call these functions.
3
+ export * from "./config.js";
4
+ export * from "./runs.js";
5
+ export * from "./fuzzy.js";
6
+ export * from "./tools/projects.js";
7
+ export * from "./tools/ports.js";
8
+ export * from "./tools/launch.js";
9
+ export * from "./tools/journal.js";
10
+ export * from "./tools/doctor.js";
11
+ export * from "./tools/summary.js";
12
+ export * from "./tools/github.js";
13
+ export * from "./tools/cleanup.js";
14
+ export * from "./tools/deps.js";
15
+ export * from "./tools/scaffold.js";
16
+ export * from "./tools/devErrors.js";
17
+ export * from "./tools/aiSetup.js";
18
+ export * from "./tools/stacks.js";
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,wCAAwC;AAExC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /** One line per tool run in ~/.dx/runs.jsonl, so a failed or silent run is never invisible. */
2
+ export interface RunRecord {
3
+ at: string;
4
+ tool: string;
5
+ ok: boolean;
6
+ detail?: string;
7
+ source?: string;
8
+ /** Which project the run was about, when there was one. */
9
+ project?: string;
10
+ /** How long it ran, e.g. how long a dev server was up. */
11
+ ms?: number;
12
+ }
13
+ export interface RunExtra {
14
+ project?: string;
15
+ ms?: number;
16
+ }
17
+ export declare function recordRun(tool: string, ok: boolean, detail?: string, source?: string, extra?: RunExtra): void;
18
+ export declare function readRuns(limit?: number): RunRecord[];
19
+ //# sourceMappingURL=runs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../src/runs.ts"],"names":[],"mappings":"AAGA,+FAA+F;AAC/F,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,QAAQ;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAKD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,SAAQ,EAAE,KAAK,GAAE,QAAa,GAAG,IAAI,CAUhH;AAED,wBAAgB,QAAQ,CAAC,KAAK,SAAK,GAAG,SAAS,EAAE,CAchD"}
@@ -0,0 +1,41 @@
1
+ import fs from "node:fs";
2
+ import { dxPath, ensureDxHome } from "./config.js";
3
+ const RUNS_FILE = "runs.jsonl";
4
+ const MAX_BYTES = 1_000_000;
5
+ export function recordRun(tool, ok, detail, source = "cli", extra = {}) {
6
+ try {
7
+ ensureDxHome();
8
+ const file = dxPath(RUNS_FILE);
9
+ const line = { at: new Date().toISOString(), tool, ok, source, ...(detail ? { detail } : {}), ...extra };
10
+ fs.appendFileSync(file, JSON.stringify(line) + "\n", "utf8");
11
+ trimIfLarge(file);
12
+ }
13
+ catch {
14
+ // The run log must never break the tool that is being logged.
15
+ }
16
+ }
17
+ export function readRuns(limit = 30) {
18
+ // limit 0 reads every line.
19
+ const file = dxPath(RUNS_FILE);
20
+ if (!fs.existsSync(file))
21
+ return [];
22
+ const lines = fs.readFileSync(file, "utf8").split(/\r?\n/).filter(Boolean);
23
+ const out = [];
24
+ for (const line of limit > 0 ? lines.slice(-limit) : lines) {
25
+ try {
26
+ out.push(JSON.parse(line));
27
+ }
28
+ catch {
29
+ // skip a corrupted line rather than failing the whole read
30
+ }
31
+ }
32
+ return out;
33
+ }
34
+ function trimIfLarge(file) {
35
+ const size = fs.statSync(file).size;
36
+ if (size <= MAX_BYTES)
37
+ return;
38
+ const lines = fs.readFileSync(file, "utf8").split(/\r?\n/).filter(Boolean);
39
+ fs.writeFileSync(file, lines.slice(Math.floor(lines.length / 2)).join("\n") + "\n", "utf8");
40
+ }
41
+ //# sourceMappingURL=runs.js.map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AC,CAAC;IAC3E,MAAM,GAAG,GAAgB,EAAE,CAAC;IAC5B,KAAK,MAAM,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QAC3D,IAAI,CAAC;YACH,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAc,CAAC,CAAC;QAC1C,CAAC;QAAC,MAAM,CAAC;YACP,2DAA2D;QAC7D,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,WAAW,CAAC,IAAY;IAC/B,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;IACpC,IAAI,IAAI,IAAI,SAAS;QAAE,OAAO;IAC9B,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3E,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC;AAC9F,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Connects dx's MCP server to the AI tools installed on this computer, so nobody has to edit a
3
+ * config file: Claude Code, Claude Desktop, Cursor, Windsurf and VS Code. Each tool keeps its MCP
4
+ * servers in its own file; dx adds a "dx" entry there (with a backup of the file the first time)
5
+ * and can remove it again.
6
+ */
7
+ export type AiToolId = "claude-code" | "claude-desktop" | "cursor" | "windsurf" | "vscode";
8
+ export interface AiToolStatus {
9
+ id: AiToolId;
10
+ name: string;
11
+ /** The tool seems to be installed. */
12
+ installed: boolean;
13
+ /** It has a "dx" MCP server entry. */
14
+ connected: boolean;
15
+ /** The entry points at this copy of dx and a Node that exists. */
16
+ current: boolean;
17
+ configFile?: string;
18
+ /** What to do after connecting, e.g. restart the app. */
19
+ note?: string;
20
+ }
21
+ export interface AiToolResult {
22
+ id: AiToolId;
23
+ name: string;
24
+ ok: boolean;
25
+ message: string;
26
+ }
27
+ /** Where things live; tests pass their own. */
28
+ export interface AiEnv {
29
+ home: string;
30
+ /** %APPDATA% on Windows, ~/Library/Application Support on macOS, ~/.config on Linux. */
31
+ appData: string;
32
+ platform: NodeJS.Platform;
33
+ /** Node to run the server with, and the server script. */
34
+ node: string;
35
+ script: string;
36
+ /** Runs `claude mcp …`; tests replace it. */
37
+ claudeCli?: (args: string[]) => Promise<{
38
+ ok: boolean;
39
+ output: string;
40
+ }>;
41
+ hasClaudeCli?: () => Promise<boolean>;
42
+ }
43
+ /** The MCP server's entry point in this checkout: packages/mcp/dist/index.js. */
44
+ export declare function mcpServerScript(): string;
45
+ export declare function defaultAiEnv(): AiEnv;
46
+ export declare function listAiTools(env?: AiEnv): Promise<AiToolStatus[]>;
47
+ /** Adds dx to the given tools, or to every installed one. An outdated entry is replaced. */
48
+ export declare function connectAiTools(ids?: AiToolId[], env?: AiEnv): Promise<AiToolResult[]>;
49
+ /** Removes dx from the given tools, or from every tool it's in. */
50
+ export declare function disconnectAiTools(ids?: AiToolId[], env?: AiEnv): Promise<AiToolResult[]>;
51
+ /**
52
+ * The no-setup step, run on dx's first use and whenever the dashboard starts: connects dx to AI
53
+ * tools it hasn't seen before, and repoints entries that point at an old copy of dx or an old
54
+ * Node. A tool the user disconnected by hand stays disconnected (it's been seen), and
55
+ * `autoConnectAi: false` in the config turns this off.
56
+ */
57
+ export declare function autoConnectAiTools(env?: AiEnv): Promise<AiToolResult[]>;
58
+ //# sourceMappingURL=aiSetup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aiSetup.d.ts","sourceRoot":"","sources":["../../src/t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