codebakers 2.1.2 → 2.2.1
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/advisors-GGUCFS4E.js +7 -0
- package/dist/{chunk-RCC7FYEU.js → chunk-ASIJIQYC.js} +21 -20
- package/dist/{chunk-YGVDLNXY.js → chunk-ND6T4UDY.js} +1 -1
- package/dist/{chunk-FWQNLNTI.js → chunk-YUSDTJD6.js} +1 -1
- package/dist/index.js +1100 -1055
- package/dist/prd-AIEY63YY.js +7 -0
- package/package.json +1 -1
- package/src/commands/build.ts +34 -3
- package/src/commands/code.ts +28 -3
- package/src/commands/deploy.ts +36 -2
- package/src/commands/init.ts +11 -1
- package/src/commands/integrate.ts +464 -565
- package/src/commands/setup.ts +375 -357
- package/src/commands/website.ts +17 -2
- package/src/index.ts +29 -22
- package/src/utils/config.ts +24 -23
- package/dist/advisors-J3S64IZK.js +0 -7
- package/dist/prd-HBUCYLVG.js +0 -7
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/utils/config.ts
|
|
2
2
|
import Conf from "conf";
|
|
3
|
-
import
|
|
3
|
+
import fsExtra from "fs-extra";
|
|
4
|
+
import { existsSync, readFileSync, appendFileSync } from "fs";
|
|
4
5
|
import * as path from "path";
|
|
5
6
|
import os from "os";
|
|
6
7
|
import { z } from "zod";
|
|
@@ -99,10 +100,10 @@ var Config = class {
|
|
|
99
100
|
configDir;
|
|
100
101
|
constructor() {
|
|
101
102
|
this.configDir = path.join(os.homedir(), ".codebakers");
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
fsExtra.ensureDirSync(this.configDir);
|
|
104
|
+
fsExtra.ensureDirSync(path.join(this.configDir, "patterns"));
|
|
105
|
+
fsExtra.ensureDirSync(path.join(this.configDir, "templates"));
|
|
106
|
+
fsExtra.ensureDirSync(path.join(this.configDir, "learning"));
|
|
106
107
|
this.conf = new Conf({
|
|
107
108
|
projectName: "codebakers",
|
|
108
109
|
cwd: this.configDir,
|
|
@@ -126,7 +127,7 @@ var Config = class {
|
|
|
126
127
|
const cwd = process.cwd();
|
|
127
128
|
const codebakersDir = path.join(cwd, ".codebakers");
|
|
128
129
|
const claudeFile = path.join(cwd, "CLAUDE.md");
|
|
129
|
-
if (
|
|
130
|
+
if (existsSync(codebakersDir) || existsSync(claudeFile)) {
|
|
130
131
|
return true;
|
|
131
132
|
}
|
|
132
133
|
const projectIndicators = [
|
|
@@ -140,7 +141,7 @@ var Config = class {
|
|
|
140
141
|
"astro.config.mjs"
|
|
141
142
|
];
|
|
142
143
|
const hasProjectFile = projectIndicators.some(
|
|
143
|
-
(file) =>
|
|
144
|
+
(file) => existsSync(path.join(cwd, file))
|
|
144
145
|
);
|
|
145
146
|
if (hasProjectFile) {
|
|
146
147
|
this.autoInitExisting(cwd);
|
|
@@ -153,18 +154,18 @@ var Config = class {
|
|
|
153
154
|
try {
|
|
154
155
|
let framework = "unknown";
|
|
155
156
|
let ui = "unknown";
|
|
156
|
-
if (
|
|
157
|
+
if (existsSync(path.join(cwd, "next.config.js")) || existsSync(path.join(cwd, "next.config.mjs")) || existsSync(path.join(cwd, "next.config.ts"))) {
|
|
157
158
|
framework = "nextjs";
|
|
158
|
-
} else if (
|
|
159
|
+
} else if (existsSync(path.join(cwd, "vite.config.ts")) || existsSync(path.join(cwd, "vite.config.js"))) {
|
|
159
160
|
framework = "vite";
|
|
160
|
-
} else if (
|
|
161
|
+
} else if (existsSync(path.join(cwd, "remix.config.js"))) {
|
|
161
162
|
framework = "remix";
|
|
162
|
-
} else if (
|
|
163
|
+
} else if (existsSync(path.join(cwd, "astro.config.mjs"))) {
|
|
163
164
|
framework = "astro";
|
|
164
165
|
}
|
|
165
166
|
const pkgPath = path.join(cwd, "package.json");
|
|
166
|
-
if (
|
|
167
|
-
const pkg =
|
|
167
|
+
if (existsSync(pkgPath)) {
|
|
168
|
+
const pkg = fsExtra.readJsonSync(pkgPath);
|
|
168
169
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
169
170
|
if (deps["@shadcn/ui"] || deps["class-variance-authority"]) {
|
|
170
171
|
ui = "shadcn";
|
|
@@ -177,7 +178,7 @@ var Config = class {
|
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
const configDir = path.join(cwd, ".codebakers");
|
|
180
|
-
|
|
181
|
+
fsExtra.ensureDirSync(configDir);
|
|
181
182
|
const config = {
|
|
182
183
|
name: path.basename(cwd),
|
|
183
184
|
framework,
|
|
@@ -185,12 +186,12 @@ var Config = class {
|
|
|
185
186
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
186
187
|
autoDetected: true
|
|
187
188
|
};
|
|
188
|
-
|
|
189
|
+
fsExtra.writeJsonSync(path.join(configDir, "config.json"), config, { spaces: 2 });
|
|
189
190
|
const gitignorePath = path.join(cwd, ".gitignore");
|
|
190
|
-
if (
|
|
191
|
-
const gitignore =
|
|
191
|
+
if (existsSync(gitignorePath)) {
|
|
192
|
+
const gitignore = readFileSync(gitignorePath, "utf-8");
|
|
192
193
|
if (!gitignore.includes(".codebakers")) {
|
|
193
|
-
|
|
194
|
+
appendFileSync(gitignorePath, "\n# CodeBakers\n.codebakers/\n");
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
} catch {
|
|
@@ -200,8 +201,8 @@ var Config = class {
|
|
|
200
201
|
getProjectConfig() {
|
|
201
202
|
const cwd = process.cwd();
|
|
202
203
|
const configPath = path.join(cwd, ".codebakers", "config.json");
|
|
203
|
-
if (
|
|
204
|
-
return
|
|
204
|
+
if (existsSync(configPath)) {
|
|
205
|
+
return fsExtra.readJsonSync(configPath);
|
|
205
206
|
}
|
|
206
207
|
return null;
|
|
207
208
|
}
|