@carrierllc/mcp 0.3.2 → 0.4.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.
- package/dist/chunk-RBG4MKMW.js +2441 -0
- package/dist/chunk-RBG4MKMW.js.map +1 -0
- package/dist/chunk-SHKKVIIA.js +114 -0
- package/dist/chunk-SHKKVIIA.js.map +1 -0
- package/dist/cli.js +891 -369
- package/dist/cli.js.map +1 -1
- package/dist/fsx-BDDIQ3Y7.js +27 -0
- package/dist/fsx-BDDIQ3Y7.js.map +1 -0
- package/dist/index.js +585 -194
- package/dist/index.js.map +1 -1
- package/package.json +14 -4
- package/plugin/carrier/commands/storefront.md +55 -6
- package/templates/storefront/next-env.d.ts +7 -0
- package/templates/storefront/package-lock.json +0 -174
- package/templates/storefront/tsconfig.json +24 -6
- package/dist/chunk-IYCGWBQU.js +0 -461
- package/dist/chunk-IYCGWBQU.js.map +0 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// src/cli/lib/fsx.ts
|
|
2
|
+
import { cp, mkdir, readdir, readFile, rm, stat, writeFile } from "fs/promises";
|
|
3
|
+
import { existsSync } from "fs";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
var SKIP = /* @__PURE__ */ new Set([
|
|
6
|
+
"node_modules",
|
|
7
|
+
".next",
|
|
8
|
+
".turbo",
|
|
9
|
+
".vercel",
|
|
10
|
+
"dist",
|
|
11
|
+
".git",
|
|
12
|
+
"test-results",
|
|
13
|
+
"playwright-report"
|
|
14
|
+
]);
|
|
15
|
+
var cpFilter = (s) => {
|
|
16
|
+
const base = s.split("/").pop() ?? "";
|
|
17
|
+
return !SKIP.has(base);
|
|
18
|
+
};
|
|
19
|
+
async function copyTree(src, dest) {
|
|
20
|
+
await mkdir(dest, { recursive: true });
|
|
21
|
+
for (const entry of await readdir(src, { withFileTypes: true })) {
|
|
22
|
+
if (SKIP.has(entry.name)) continue;
|
|
23
|
+
await cp(join(src, entry.name), join(dest, entry.name), {
|
|
24
|
+
recursive: true,
|
|
25
|
+
filter: cpFilter
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async function pruneTree(src, dest) {
|
|
30
|
+
if (!await isDir(dest)) return;
|
|
31
|
+
for (const entry of await readdir(dest, { withFileTypes: true })) {
|
|
32
|
+
if (SKIP.has(entry.name)) continue;
|
|
33
|
+
const srcPath = join(src, entry.name);
|
|
34
|
+
const destPath = join(dest, entry.name);
|
|
35
|
+
if (!existsSync(srcPath)) {
|
|
36
|
+
await rm(destPath, { recursive: true, force: true });
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (entry.isDirectory() && await isDir(srcPath)) await pruneTree(srcPath, destPath);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function* walk(dir) {
|
|
43
|
+
for (const entry of await readdir(dir, { withFileTypes: true })) {
|
|
44
|
+
if (SKIP.has(entry.name)) continue;
|
|
45
|
+
const full = join(dir, entry.name);
|
|
46
|
+
if (entry.isDirectory()) yield* walk(full);
|
|
47
|
+
else yield full;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
var TEXT_EXT = /* @__PURE__ */ new Set([
|
|
51
|
+
".ts",
|
|
52
|
+
".tsx",
|
|
53
|
+
".js",
|
|
54
|
+
".jsx",
|
|
55
|
+
".mjs",
|
|
56
|
+
".cjs",
|
|
57
|
+
".json",
|
|
58
|
+
".css",
|
|
59
|
+
".md",
|
|
60
|
+
".mdx",
|
|
61
|
+
".html",
|
|
62
|
+
".txt",
|
|
63
|
+
".env",
|
|
64
|
+
".example",
|
|
65
|
+
".yml",
|
|
66
|
+
".yaml",
|
|
67
|
+
".toml"
|
|
68
|
+
]);
|
|
69
|
+
function isTextFile(path) {
|
|
70
|
+
const dot = path.lastIndexOf(".");
|
|
71
|
+
if (dot === -1) return false;
|
|
72
|
+
return TEXT_EXT.has(path.slice(dot));
|
|
73
|
+
}
|
|
74
|
+
async function replaceInTree(dir, subs) {
|
|
75
|
+
let touched = 0;
|
|
76
|
+
for await (const file of walk(dir)) {
|
|
77
|
+
if (!isTextFile(file)) continue;
|
|
78
|
+
const before = await readFile(file, "utf8");
|
|
79
|
+
let after = before;
|
|
80
|
+
for (const [from, to] of subs) {
|
|
81
|
+
after = typeof from === "string" ? after.split(from).join(to) : after.replace(from, to);
|
|
82
|
+
}
|
|
83
|
+
if (after !== before) {
|
|
84
|
+
await writeFile(file, after);
|
|
85
|
+
touched++;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return touched;
|
|
89
|
+
}
|
|
90
|
+
async function exists(p) {
|
|
91
|
+
return existsSync(p);
|
|
92
|
+
}
|
|
93
|
+
async function isDir(p) {
|
|
94
|
+
try {
|
|
95
|
+
return (await stat(p)).isDirectory();
|
|
96
|
+
} catch {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export {
|
|
102
|
+
mkdir,
|
|
103
|
+
readdir,
|
|
104
|
+
readFile,
|
|
105
|
+
writeFile,
|
|
106
|
+
copyTree,
|
|
107
|
+
pruneTree,
|
|
108
|
+
walk,
|
|
109
|
+
isTextFile,
|
|
110
|
+
replaceInTree,
|
|
111
|
+
exists,
|
|
112
|
+
isDir
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=chunk-SHKKVIIA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/lib/fsx.ts"],"sourcesContent":["import { cp, mkdir, readdir, readFile, rm, stat, writeFile } from \"node:fs/promises\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nconst SKIP = new Set([\n \"node_modules\",\n \".next\",\n \".turbo\",\n \".vercel\",\n \"dist\",\n \".git\",\n \"test-results\",\n \"playwright-report\",\n]);\n\nconst cpFilter = (s: string) => {\n const base = s.split(\"/\").pop() ?? \"\";\n return !SKIP.has(base);\n};\n\n/** Recursively copy a directory's contents into `dest`, skipping build artifacts and VCS noise. */\nexport async function copyTree(src: string, dest: string): Promise<void> {\n await mkdir(dest, { recursive: true });\n for (const entry of await readdir(src, { withFileTypes: true })) {\n if (SKIP.has(entry.name)) continue;\n await cp(join(src, entry.name), join(dest, entry.name), {\n recursive: true,\n filter: cpFilter,\n });\n }\n}\n\n/** Remove paths under `dest` that are absent from `src` (mirror sync after `copyTree`). */\nexport async function pruneTree(src: string, dest: string): Promise<void> {\n if (!(await isDir(dest))) return;\n for (const entry of await readdir(dest, { withFileTypes: true })) {\n if (SKIP.has(entry.name)) continue;\n const srcPath = join(src, entry.name);\n const destPath = join(dest, entry.name);\n if (!existsSync(srcPath)) {\n await rm(destPath, { recursive: true, force: true });\n continue;\n }\n if (entry.isDirectory() && (await isDir(srcPath))) await pruneTree(srcPath, destPath);\n }\n}\n\n/** Walk every file under `dir` and yield absolute paths. */\nexport async function* walk(dir: string): AsyncGenerator<string> {\n for (const entry of await readdir(dir, { withFileTypes: true })) {\n if (SKIP.has(entry.name)) continue;\n const full = join(dir, entry.name);\n if (entry.isDirectory()) yield* walk(full);\n else yield full;\n }\n}\n\nconst TEXT_EXT = new Set([\n \".ts\", \".tsx\", \".js\", \".jsx\", \".mjs\", \".cjs\",\n \".json\", \".css\", \".md\", \".mdx\", \".html\", \".txt\",\n \".env\", \".example\", \".yml\", \".yaml\", \".toml\",\n]);\n\nexport function isTextFile(path: string): boolean {\n const dot = path.lastIndexOf(\".\");\n if (dot === -1) return false;\n return TEXT_EXT.has(path.slice(dot));\n}\n\n/** Apply ordered [find, replace] string substitutions to every text file under `dir`. */\nexport async function replaceInTree(\n dir: string,\n subs: ReadonlyArray<readonly [from: string | RegExp, to: string]>,\n): Promise<number> {\n let touched = 0;\n for await (const file of walk(dir)) {\n if (!isTextFile(file)) continue;\n const before = await readFile(file, \"utf8\");\n let after = before;\n for (const [from, to] of subs) {\n after = typeof from === \"string\" ? after.split(from).join(to) : after.replace(from, to);\n }\n if (after !== before) {\n await writeFile(file, after);\n touched++;\n }\n }\n return touched;\n}\n\nexport async function exists(p: string): Promise<boolean> {\n return existsSync(p);\n}\n\nexport async function isDir(p: string): Promise<boolean> {\n try {\n return (await stat(p)).isDirectory();\n } catch {\n return false;\n }\n}\n\nexport { writeFile, mkdir, readFile, readdir };\n"],"mappings":";AAAA,SAAS,IAAI,OAAO,SAAS,UAAU,IAAI,MAAM,iBAAiB;AAClE,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AAErB,IAAM,OAAO,oBAAI,IAAI;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,WAAW,CAAC,MAAc;AAC9B,QAAM,OAAO,EAAE,MAAM,GAAG,EAAE,IAAI,KAAK;AACnC,SAAO,CAAC,KAAK,IAAI,IAAI;AACvB;AAGA,eAAsB,SAAS,KAAa,MAA6B;AACvE,QAAM,MAAM,MAAM,EAAE,WAAW,KAAK,CAAC;AACrC,aAAW,SAAS,MAAM,QAAQ,KAAK,EAAE,eAAe,KAAK,CAAC,GAAG;AAC/D,QAAI,KAAK,IAAI,MAAM,IAAI,EAAG;AAC1B,UAAM,GAAG,KAAK,KAAK,MAAM,IAAI,GAAG,KAAK,MAAM,MAAM,IAAI,GAAG;AAAA,MACtD,WAAW;AAAA,MACX,QAAQ;AAAA,IACV,CAAC;AAAA,EACH;AACF;AAGA,eAAsB,UAAU,KAAa,MAA6B;AACxE,MAAI,CAAE,MAAM,MAAM,IAAI,EAAI;AAC1B,aAAW,SAAS,MAAM,QAAQ,MAAM,EAAE,eAAe,KAAK,CAAC,GAAG;AAChE,QAAI,KAAK,IAAI,MAAM,IAAI,EAAG;AAC1B,UAAM,UAAU,KAAK,KAAK,MAAM,IAAI;AACpC,UAAM,WAAW,KAAK,MAAM,MAAM,IAAI;AACtC,QAAI,CAAC,WAAW,OAAO,GAAG;AACxB,YAAM,GAAG,UAAU,EAAE,WAAW,MAAM,OAAO,KAA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