@akanjs/cli 2.4.0-rc.9 → 2.4.1-rc.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/agent.command-h4afc69n.js +26 -0
- package/application.command-4ctkfdan.js +165 -0
- package/applicationBuildRunner-esa1kj7v.js +284 -0
- package/applicationReleasePackager-brvth6rs.js +245 -0
- package/capacitorApp-y0h6cgft.js +58 -0
- package/cloud.command-rpztn4fh.js +94 -0
- package/commandManifest.json +1 -0
- package/context.command-nqbtak4f.js +82 -0
- package/dependencyScanner-m4x5maek.js +9 -0
- package/guideline.command-ya0dh44f.js +356 -0
- package/incrementalBuilder.proc.js +89 -17394
- package/index-1xdrsbry.js +1447 -0
- package/index-45aj5ry0.js +990 -0
- package/index-5vvwc0cz.js +559 -0
- package/index-61keag0s.js +40 -0
- package/index-6pz1j0zj.js +62 -0
- package/index-73pr2cmy.js +534 -0
- package/index-76rn3g2c.js +76 -0
- package/index-85msc0wg.js +161 -0
- package/index-8pkbzj26.js +840 -0
- package/index-8rc0bm04.js +514 -0
- package/index-9sp6fsc5.js +1884 -0
- package/index-a6sbyy0b.js +2769 -0
- package/index-b0brjbp3.js +83 -0
- package/index-fgc8r6dj.js +33 -0
- package/index-h6ca6qg0.js +2777 -0
- package/index-hdqztm58.js +758 -0
- package/index-hwzpw9c1.js +202 -0
- package/index-pmm9e2jf.js +120 -0
- package/index-qaq13qk3.js +80 -0
- package/index-qhtr07v8.js +1072 -0
- package/index-r24hmh0q.js +4 -0
- package/index-ss469dec.js +11 -0
- package/index-swf4bmbg.js +25 -0
- package/index-w7fyqjrw.js +462 -0
- package/index-wnp7hwq7.js +193 -0
- package/index-wq8jwx8z.js +224 -0
- package/index-x53a5nya.js +301 -0
- package/index-xmc2w32q.js +4359 -0
- package/index-y3hdhy4p.js +229 -0
- package/index.js +54 -23340
- package/library.command-r15zdqvp.js +33 -0
- package/localRegistry.command-5tcahs3f.js +178 -0
- package/module.command-qrj3kmyz.js +54 -0
- package/package.command-r8sq5kzp.js +43 -0
- package/package.json +2 -2
- package/page.command-c6xdx0xm.js +24 -0
- package/primitive.command-pv9ssmtf.js +62 -0
- package/quality.command-es67wvdp.js +809 -0
- package/repair.command-677675vw.js +67 -0
- package/routeSourceValidator-wbhmbwpj.js +132 -0
- package/scalar.command-kabkd6wd.js +35 -0
- package/templates/app/page/_layout.tsx +19 -1
- package/templates/app/public/fonts/Pretendard-Black.woff2 +0 -0
- package/templates/app/public/fonts/Pretendard-Bold.woff2 +0 -0
- package/templates/app/public/fonts/Pretendard-ExtraBold.woff2 +0 -0
- package/templates/app/public/fonts/Pretendard-ExtraLight.woff2 +0 -0
- package/templates/app/public/fonts/Pretendard-Light.woff2 +0 -0
- package/templates/app/public/fonts/Pretendard-Medium.woff2 +0 -0
- package/templates/app/public/fonts/Pretendard-Regular.woff2 +0 -0
- package/templates/app/public/fonts/Pretendard-SemiBold.woff2 +0 -0
- package/templates/app/public/fonts/Pretendard-Thin.woff2 +0 -0
- package/templates/facetIndex/index.ts +1 -1
- package/typeChecker-kravn7ns.js +8 -0
- package/typecheck.proc.js +4 -194
- package/workflow.command-64r6cw0w.js +108 -0
- package/workspace.command-vrws0rgx.js +435 -0
- package/README.ko.md +0 -72
- package/README.md +0 -85
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
ContextScript
|
|
4
|
+
} from "./index-qhtr07v8.js";
|
|
5
|
+
import"./index-45aj5ry0.js";
|
|
6
|
+
import {
|
|
7
|
+
CloudScript
|
|
8
|
+
} from "./index-b0brjbp3.js";
|
|
9
|
+
import"./index-y3hdhy4p.js";
|
|
10
|
+
import"./index-73pr2cmy.js";
|
|
11
|
+
import"./index-85msc0wg.js";
|
|
12
|
+
import"./index-1xdrsbry.js";
|
|
13
|
+
import {
|
|
14
|
+
AgentScript
|
|
15
|
+
} from "./index-hwzpw9c1.js";
|
|
16
|
+
import"./index-8rc0bm04.js";
|
|
17
|
+
import {
|
|
18
|
+
getLatestPackageVersion,
|
|
19
|
+
getNpmRegistryUrl
|
|
20
|
+
} from "./index-w7fyqjrw.js";
|
|
21
|
+
import {
|
|
22
|
+
ApplicationScript
|
|
23
|
+
} from "./index-9sp6fsc5.js";
|
|
24
|
+
import"./index-76rn3g2c.js";
|
|
25
|
+
import {
|
|
26
|
+
LibraryScript
|
|
27
|
+
} from "./index-pmm9e2jf.js";
|
|
28
|
+
import {
|
|
29
|
+
PackageScript
|
|
30
|
+
} from "./index-wq8jwx8z.js";
|
|
31
|
+
import"./index-8pkbzj26.js";
|
|
32
|
+
import"./index-swf4bmbg.js";
|
|
33
|
+
import"./index-ss469dec.js";
|
|
34
|
+
import"./index-qaq13qk3.js";
|
|
35
|
+
import"./index-h6ca6qg0.js";
|
|
36
|
+
import {
|
|
37
|
+
GlobalConfig
|
|
38
|
+
} from "./index-5vvwc0cz.js";
|
|
39
|
+
import {
|
|
40
|
+
Exec,
|
|
41
|
+
Workspace,
|
|
42
|
+
command,
|
|
43
|
+
runner,
|
|
44
|
+
script
|
|
45
|
+
} from "./index-hdqztm58.js";
|
|
46
|
+
import"./index-fgc8r6dj.js";
|
|
47
|
+
import {
|
|
48
|
+
AppExecutor,
|
|
49
|
+
LibExecutor,
|
|
50
|
+
PkgExecutor,
|
|
51
|
+
WorkspaceExecutor
|
|
52
|
+
} from "./index-a6sbyy0b.js";
|
|
53
|
+
import"./index-x53a5nya.js";
|
|
54
|
+
import {
|
|
55
|
+
FileSys
|
|
56
|
+
} from "./index-61keag0s.js";
|
|
57
|
+
import"./index-6pz1j0zj.js";
|
|
58
|
+
import"./index-r24hmh0q.js";
|
|
59
|
+
|
|
60
|
+
// pkgs/@akanjs/cli/workspace/workspace.script.ts
|
|
61
|
+
import path2 from "path";
|
|
62
|
+
import { Logger } from "akanjs/common";
|
|
63
|
+
|
|
64
|
+
// pkgs/@akanjs/cli/workspace/workspace.runner.ts
|
|
65
|
+
import path from "path";
|
|
66
|
+
var defaultWorkspacePeerDependencies = new Set([
|
|
67
|
+
"@react-spring/web",
|
|
68
|
+
"@use-gesture/react",
|
|
69
|
+
"chance",
|
|
70
|
+
"croner",
|
|
71
|
+
"daisyui",
|
|
72
|
+
"react",
|
|
73
|
+
"react-dom",
|
|
74
|
+
"react-icons",
|
|
75
|
+
"react-refresh",
|
|
76
|
+
"react-server-dom-webpack",
|
|
77
|
+
"react-spring",
|
|
78
|
+
"scheduler",
|
|
79
|
+
"tailwind-scrollbar",
|
|
80
|
+
"tailwindcss",
|
|
81
|
+
"typescript"
|
|
82
|
+
]);
|
|
83
|
+
|
|
84
|
+
class WorkspaceRunner extends runner("workspace") {
|
|
85
|
+
async generateAgentRules(workspace, { overwrite = false, cursorRules = true } = {}) {
|
|
86
|
+
const [appNames] = await workspace.getExecs();
|
|
87
|
+
const dict = {
|
|
88
|
+
repoName: workspace.repoName,
|
|
89
|
+
appName: appNames[0] ?? "app"
|
|
90
|
+
};
|
|
91
|
+
const created = await workspace.applyTemplate({
|
|
92
|
+
basePath: ".",
|
|
93
|
+
template: "workspaceRoot/AGENTS.md.template",
|
|
94
|
+
dict,
|
|
95
|
+
overwrite
|
|
96
|
+
});
|
|
97
|
+
created.push(...await workspace.applyTemplate({
|
|
98
|
+
basePath: ".",
|
|
99
|
+
template: "workspaceRoot/CLAUDE.md.template",
|
|
100
|
+
dict,
|
|
101
|
+
overwrite
|
|
102
|
+
}));
|
|
103
|
+
if (!cursorRules)
|
|
104
|
+
return created;
|
|
105
|
+
return [
|
|
106
|
+
...created,
|
|
107
|
+
...await workspace.applyTemplate({
|
|
108
|
+
basePath: ".cursor/rules",
|
|
109
|
+
template: "workspaceRoot/.cursor/rules/akan.mdc.template",
|
|
110
|
+
dict,
|
|
111
|
+
overwrite
|
|
112
|
+
})
|
|
113
|
+
];
|
|
114
|
+
}
|
|
115
|
+
async createWorkspace(repoName, appName, {
|
|
116
|
+
dirname = ".",
|
|
117
|
+
init = true,
|
|
118
|
+
akanVersion,
|
|
119
|
+
registryUrl,
|
|
120
|
+
owner = ""
|
|
121
|
+
}) {
|
|
122
|
+
const cwdPath = process.cwd();
|
|
123
|
+
const workspaceRoot = path.join(cwdPath, dirname, repoName);
|
|
124
|
+
const normalizedRegistryUrl = registryUrl ? getNpmRegistryUrl(registryUrl) : undefined;
|
|
125
|
+
const workspace = WorkspaceExecutor.fromRoot({ workspaceRoot, repoName });
|
|
126
|
+
const templateSpinner = workspace.spinning(`Creating workspace template files in ${dirname}/${repoName}...`);
|
|
127
|
+
const [latestBiomeVersion, latestTypesBunVersion] = await Promise.all([
|
|
128
|
+
getLatestPackageVersion("@biomejs/biome", "latest", normalizedRegistryUrl),
|
|
129
|
+
getLatestPackageVersion("@types/bun", "latest", normalizedRegistryUrl)
|
|
130
|
+
]);
|
|
131
|
+
await workspace.applyTemplate({
|
|
132
|
+
basePath: ".",
|
|
133
|
+
template: "workspaceRoot",
|
|
134
|
+
dict: { repoName, appName, serveDomain: "localhost", owner }
|
|
135
|
+
});
|
|
136
|
+
if (normalizedRegistryUrl)
|
|
137
|
+
await workspace.writeFile(".npmrc", `registry=${normalizedRegistryUrl}/
|
|
138
|
+
`);
|
|
139
|
+
templateSpinner.succeed(`Workspace files created in ${dirname}/${repoName}`);
|
|
140
|
+
const [rootPackageJson, peerDependencies] = await Promise.all([
|
|
141
|
+
workspace.getPackageJson(),
|
|
142
|
+
this.#getAkanPeerDependencies()
|
|
143
|
+
]);
|
|
144
|
+
const { typescript, ...dependencies } = peerDependencies;
|
|
145
|
+
const packageJson = {
|
|
146
|
+
...rootPackageJson,
|
|
147
|
+
dependencies: {
|
|
148
|
+
...rootPackageJson.dependencies,
|
|
149
|
+
...dependencies,
|
|
150
|
+
akanjs: akanVersion
|
|
151
|
+
},
|
|
152
|
+
devDependencies: {
|
|
153
|
+
...rootPackageJson.devDependencies,
|
|
154
|
+
"@biomejs/biome": latestBiomeVersion,
|
|
155
|
+
"@types/bun": latestTypesBunVersion,
|
|
156
|
+
"@akanjs/devkit": akanVersion,
|
|
157
|
+
...typescript ? { typescript } : {}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
await workspace.setPackageJson(packageJson);
|
|
161
|
+
if (init) {
|
|
162
|
+
const installSpinner = workspace.spinning("Installing dependencies with bun...");
|
|
163
|
+
await workspace.spawn("bun", ["install"]);
|
|
164
|
+
installSpinner.succeed("Dependencies installed with bun");
|
|
165
|
+
}
|
|
166
|
+
return workspace;
|
|
167
|
+
}
|
|
168
|
+
async#getAkanPeerDependencies() {
|
|
169
|
+
const [packageJson, cliPackageJson] = await Promise.all([this.#getAkanPackageJson(), this.#getCliPackageJson()]);
|
|
170
|
+
const dependencyVersions = {
|
|
171
|
+
...packageJson.dependencies,
|
|
172
|
+
...packageJson.peerDependencies,
|
|
173
|
+
...cliPackageJson.dependencies
|
|
174
|
+
};
|
|
175
|
+
return Object.fromEntries(Object.entries(dependencyVersions).filter(([dependency]) => defaultWorkspacePeerDependencies.has(dependency)));
|
|
176
|
+
}
|
|
177
|
+
async#getCliPackageJson() {
|
|
178
|
+
const packageJsonCandidates = [
|
|
179
|
+
path.join(import.meta.dir, "../package.json"),
|
|
180
|
+
path.join(import.meta.dir, "package.json"),
|
|
181
|
+
path.join(path.dirname(Bun.main), "package.json")
|
|
182
|
+
];
|
|
183
|
+
try {
|
|
184
|
+
packageJsonCandidates.unshift(Bun.resolveSync("@akanjs/cli/package.json", import.meta.dir));
|
|
185
|
+
} catch {}
|
|
186
|
+
for (const packageJsonPath of packageJsonCandidates) {
|
|
187
|
+
if (!await Bun.file(packageJsonPath).exists())
|
|
188
|
+
continue;
|
|
189
|
+
const packageJson = await FileSys.readJson(packageJsonPath);
|
|
190
|
+
if (packageJson.name === "@akanjs/cli")
|
|
191
|
+
return packageJson;
|
|
192
|
+
}
|
|
193
|
+
return { name: "@akanjs/cli", version: "0.0.0", description: "@akanjs/cli" };
|
|
194
|
+
}
|
|
195
|
+
async#getAkanPackageJson() {
|
|
196
|
+
const packageJsonCandidates = [
|
|
197
|
+
path.join(import.meta.dir, "../../../akanjs/package.json"),
|
|
198
|
+
path.join(process.cwd(), "pkgs/akanjs/package.json"),
|
|
199
|
+
path.join(path.dirname(Bun.main), "node_modules/akanjs/package.json")
|
|
200
|
+
];
|
|
201
|
+
try {
|
|
202
|
+
packageJsonCandidates.unshift(Bun.resolveSync("akanjs/package.json", import.meta.dir));
|
|
203
|
+
} catch {}
|
|
204
|
+
for (const packageJsonPath of packageJsonCandidates) {
|
|
205
|
+
if (!await Bun.file(packageJsonPath).exists())
|
|
206
|
+
continue;
|
|
207
|
+
const packageJson = await FileSys.readJson(packageJsonPath);
|
|
208
|
+
if (packageJson.name === "akanjs")
|
|
209
|
+
return packageJson;
|
|
210
|
+
}
|
|
211
|
+
let current = import.meta.dir;
|
|
212
|
+
for (let depth = 0;depth < 6; depth++) {
|
|
213
|
+
const packageJsonPath = path.join(current, "package.json");
|
|
214
|
+
if (await Bun.file(packageJsonPath).exists()) {
|
|
215
|
+
const packageJson = await FileSys.readJson(packageJsonPath);
|
|
216
|
+
if (packageJson.name === "akanjs")
|
|
217
|
+
return packageJson;
|
|
218
|
+
}
|
|
219
|
+
const parent = path.dirname(current);
|
|
220
|
+
if (parent === current)
|
|
221
|
+
break;
|
|
222
|
+
current = parent;
|
|
223
|
+
}
|
|
224
|
+
throw new Error(`[workspace] failed to locate akanjs package.json from ${import.meta.dir}`);
|
|
225
|
+
}
|
|
226
|
+
async lint(exec, workspace, { fix = true } = {}) {
|
|
227
|
+
await workspace.spawn("./node_modules/.bin/biome", [
|
|
228
|
+
"check",
|
|
229
|
+
...fix ? ["--write"] : [],
|
|
230
|
+
"--no-errors-on-unmatched",
|
|
231
|
+
exec.cwdPath
|
|
232
|
+
]);
|
|
233
|
+
}
|
|
234
|
+
async writeTopLevelEnv(workspace, devProjectId) {
|
|
235
|
+
await workspace.writeFile(".env", `AKAN_WORKSPACE_ID=${devProjectId}
|
|
236
|
+
|
|
237
|
+
# organization configuration, no need to change
|
|
238
|
+
AKAN_PUBLIC_REPO_NAME=${workspace.repoName}
|
|
239
|
+
|
|
240
|
+
# serve domain, it changes the domain of the server.
|
|
241
|
+
AKAN_PUBLIC_SERVE_DOMAIN=try.akanjs.com
|
|
242
|
+
|
|
243
|
+
# development branch, debug, develop, main, etc. mainly it changes databases.
|
|
244
|
+
AKAN_PUBLIC_ENV=local
|
|
245
|
+
|
|
246
|
+
# local, cloud, edge it changes the connection point of the clients.
|
|
247
|
+
AKAN_PUBLIC_OPERATION_MODE=local
|
|
248
|
+
|
|
249
|
+
# log level, debug, info, warn, error
|
|
250
|
+
AKAN_PUBLIC_LOG_LEVEL=debug
|
|
251
|
+
`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// pkgs/@akanjs/cli/workspace/workspace.script.ts
|
|
256
|
+
class WorkspaceScript extends script("workspace", [
|
|
257
|
+
WorkspaceRunner,
|
|
258
|
+
ApplicationScript,
|
|
259
|
+
LibraryScript,
|
|
260
|
+
PackageScript,
|
|
261
|
+
CloudScript,
|
|
262
|
+
ContextScript,
|
|
263
|
+
AgentScript
|
|
264
|
+
]) {
|
|
265
|
+
async createWorkspace(repoName, appName, {
|
|
266
|
+
dirname = ".",
|
|
267
|
+
installLibs = false,
|
|
268
|
+
init = true,
|
|
269
|
+
registryUrl,
|
|
270
|
+
owner,
|
|
271
|
+
mcpInstall = true,
|
|
272
|
+
agentInstall = true
|
|
273
|
+
}) {
|
|
274
|
+
const akanVersion = await this.packageScript.version(null, { log: false });
|
|
275
|
+
const workspace = await this.workspaceRunner.createWorkspace(repoName, appName, {
|
|
276
|
+
dirname,
|
|
277
|
+
init,
|
|
278
|
+
akanVersion,
|
|
279
|
+
...registryUrl ? { registryUrl } : {},
|
|
280
|
+
...owner ? { owner } : {}
|
|
281
|
+
});
|
|
282
|
+
if (installLibs) {
|
|
283
|
+
await this.libraryScript.installLibrary(workspace, "util");
|
|
284
|
+
await this.libraryScript.installLibrary(workspace, "shared");
|
|
285
|
+
}
|
|
286
|
+
await this.applicationScript.createApplication(appName, workspace, { libs: installLibs ? ["util", "shared"] : [] });
|
|
287
|
+
await workspace.applyTemplate({
|
|
288
|
+
basePath: `apps/${appName}`,
|
|
289
|
+
template: "appSample",
|
|
290
|
+
dict: { appName },
|
|
291
|
+
options: { libs: installLibs ? ["util", "shared"] : [] }
|
|
292
|
+
});
|
|
293
|
+
if (agentInstall)
|
|
294
|
+
await this.agentScript.agent(workspace, "install", "all", { force: true });
|
|
295
|
+
if (mcpInstall)
|
|
296
|
+
await this.contextScript.mcpInstall(workspace, "all", { force: true });
|
|
297
|
+
const gitSpinner = workspace.spinning("Initializing git repository and commit...");
|
|
298
|
+
try {
|
|
299
|
+
await workspace.commit("Initial commit", { init: true });
|
|
300
|
+
gitSpinner.succeed("Git repository initialized and committed");
|
|
301
|
+
} catch (_) {
|
|
302
|
+
gitSpinner.fail("Git repository initialization failed. It's not fatal, you can commit manually");
|
|
303
|
+
}
|
|
304
|
+
const workspacePath = path2.join(dirname, repoName);
|
|
305
|
+
Logger.rawLog(`
|
|
306
|
+
\uD83C\uDF89 Welcome aboard! Workspace created in ${dirname}/${repoName}`);
|
|
307
|
+
Logger.rawLog(`\uD83D\uDE80 Run \`cd ${workspacePath} && akan start ${appName}\` to start the development server.`);
|
|
308
|
+
Logger.rawLog(`
|
|
309
|
+
\uD83D\uDC4B Happy coding!`);
|
|
310
|
+
}
|
|
311
|
+
async generateAgentRules(workspace, { overwrite = false, cursorRules = true } = {}) {
|
|
312
|
+
const spinner = workspace.spinning("Generating agent rules...");
|
|
313
|
+
const files = await this.workspaceRunner.generateAgentRules(workspace, { overwrite, cursorRules });
|
|
314
|
+
spinner.succeed(`Agent rules ready (${files.length} file${files.length === 1 ? "" : "s"})`);
|
|
315
|
+
}
|
|
316
|
+
async lint(exec, workspace, { fix = true } = {}) {
|
|
317
|
+
if (exec instanceof AppExecutor)
|
|
318
|
+
await this.applicationScript.sync(exec);
|
|
319
|
+
else if (exec instanceof LibExecutor)
|
|
320
|
+
await this.libraryScript.syncLibrary(exec);
|
|
321
|
+
const spinner = workspace.spinning(`Linting${fix ? " with fix" : ""}...`);
|
|
322
|
+
try {
|
|
323
|
+
await this.workspaceRunner.lint(exec, workspace, { fix });
|
|
324
|
+
spinner.succeed("Lint completed with no errors");
|
|
325
|
+
} catch (error) {
|
|
326
|
+
spinner.fail("Lint failed with errors");
|
|
327
|
+
throw error;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
async lintAll(workspace, { fix = true } = {}) {
|
|
331
|
+
const [appNames, libNames, pkgNames] = await workspace.getExecs();
|
|
332
|
+
await Promise.all(appNames.map((appName) => this.applicationScript.sync(AppExecutor.from(workspace, appName))));
|
|
333
|
+
await Promise.all(libNames.map((libName) => this.libraryScript.syncLibrary(LibExecutor.from(workspace, libName))));
|
|
334
|
+
await Promise.all([
|
|
335
|
+
...appNames.map((appName) => this.workspaceRunner.lint(AppExecutor.from(workspace, appName), workspace, { fix })),
|
|
336
|
+
...libNames.map((libName) => this.workspaceRunner.lint(LibExecutor.from(workspace, libName), workspace, { fix })),
|
|
337
|
+
...pkgNames.filter((pkgName) => pkgName !== "contract").map((pkgName) => this.workspaceRunner.lint(PkgExecutor.from(workspace, pkgName), workspace, { fix }))
|
|
338
|
+
]);
|
|
339
|
+
}
|
|
340
|
+
async syncAll(workspace) {
|
|
341
|
+
const [appNames, libNames] = await workspace.getExecs();
|
|
342
|
+
for (const libName of libNames)
|
|
343
|
+
await this.libraryScript.syncLibrary(LibExecutor.from(workspace, libName));
|
|
344
|
+
for (const appName of appNames)
|
|
345
|
+
await this.applicationScript.sync(AppExecutor.from(workspace, appName));
|
|
346
|
+
}
|
|
347
|
+
async init(devProjectId, workspace, { host } = {}) {
|
|
348
|
+
const [bunfigExists, packageJsonExists, tsconfigExists] = await Promise.all([
|
|
349
|
+
workspace.exists("bunfig.toml"),
|
|
350
|
+
workspace.exists("package.json"),
|
|
351
|
+
workspace.exists("tsconfig.json")
|
|
352
|
+
]);
|
|
353
|
+
const isRoot = bunfigExists && packageJsonExists && tsconfigExists;
|
|
354
|
+
if (!isRoot)
|
|
355
|
+
throw new Error("Current directory is not a root workspace");
|
|
356
|
+
const spinner = workspace.spinning("Initializing workspace...");
|
|
357
|
+
try {
|
|
358
|
+
await this.workspaceRunner.writeTopLevelEnv(workspace, devProjectId);
|
|
359
|
+
await this.cloudScript.downloadEnv(workspace, devProjectId, { host });
|
|
360
|
+
spinner.succeed("Workspace initialized");
|
|
361
|
+
} catch (error) {
|
|
362
|
+
spinner.fail("Workspace initialization failed");
|
|
363
|
+
throw error;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// pkgs/@akanjs/cli/workspace/workspace.command.ts
|
|
369
|
+
class WorkspaceCommand extends command("workspace", [WorkspaceScript], ({ public: target }) => ({
|
|
370
|
+
createWorkspace: target({ desc: "Create a new Akan.js workspace", runsOnWorkspaceRoot: false }).arg("workspaceName", String, { desc: "what is the name of your organization?" }).option("app", String, {
|
|
371
|
+
desc: "what is the codename of your first application? (e.g. myapp)"
|
|
372
|
+
}).option("dir", String, {
|
|
373
|
+
desc: "directory of workspace",
|
|
374
|
+
default: process.env.USE_AKANJS_PKGS === "true" ? "local" : "."
|
|
375
|
+
}).option("libs", Boolean, {
|
|
376
|
+
desc: "Do you want to install shared and util libraries? (admin, user file, etc.)",
|
|
377
|
+
enum: [
|
|
378
|
+
{ label: "No, I want to start with empty workspace (Recommended)", value: false },
|
|
379
|
+
{
|
|
380
|
+
label: "Yes, I want to accelerate development by installing shared and util libraries (for akanjs experts)",
|
|
381
|
+
value: true
|
|
382
|
+
}
|
|
383
|
+
],
|
|
384
|
+
default: false
|
|
385
|
+
}).option("init", Boolean, {
|
|
386
|
+
desc: "Do you want to initialize the workspace? (Recommended)",
|
|
387
|
+
default: true
|
|
388
|
+
}).option("registry", String, {
|
|
389
|
+
desc: "npm registry URL for installing Akan packages",
|
|
390
|
+
default: process.env.AKAN_NPM_REGISTRY ?? "https://registry.npmjs.org"
|
|
391
|
+
}).option("owner", String, {
|
|
392
|
+
desc: "owner of the workspace",
|
|
393
|
+
default: process.env.GITHUB_OWNER,
|
|
394
|
+
nullable: true
|
|
395
|
+
}).option("mcpInstall", Boolean, {
|
|
396
|
+
desc: "Install the Akan MCP server config for Cursor, Claude Code, and Codex? (Recommended)",
|
|
397
|
+
default: true
|
|
398
|
+
}).option("agentInstall", Boolean, {
|
|
399
|
+
flag: "A",
|
|
400
|
+
desc: "Install Akan agent rules (AGENTS.md, CLAUDE.md, Cursor)? (Recommended)",
|
|
401
|
+
default: true
|
|
402
|
+
}).exec(async function(workspaceName, app, dir, libs, init, registry, owner, mcpInstall, agentInstall) {
|
|
403
|
+
const appName = app || "app";
|
|
404
|
+
await this.workspaceScript.createWorkspace(workspaceName.toLowerCase().replace(/ /g, "-"), appName.toLowerCase().replace(/ /g, "-"), {
|
|
405
|
+
dirname: dir,
|
|
406
|
+
installLibs: libs,
|
|
407
|
+
init,
|
|
408
|
+
owner,
|
|
409
|
+
mcpInstall,
|
|
410
|
+
agentInstall,
|
|
411
|
+
...registry ? { registryUrl: registry } : {}
|
|
412
|
+
});
|
|
413
|
+
}),
|
|
414
|
+
generateAgentRules: target({
|
|
415
|
+
desc: "Generate AGENTS.md, CLAUDE.md, and optional Cursor rules for Akan coding agents"
|
|
416
|
+
}).option("overwrite", Boolean, { desc: "Overwrite existing agent rule files", default: false }).option("cursorRules", Boolean, { desc: "Generate .cursor/rules/akan.mdc", default: true }).with(Workspace).exec(async function(overwrite, cursorRules, workspace) {
|
|
417
|
+
await this.workspaceScript.generateAgentRules(workspace, { overwrite, cursorRules });
|
|
418
|
+
}),
|
|
419
|
+
lint: target({ desc: "Lint and fix code in a specific app/lib/pkg" }).with(Exec).option("fix", Boolean, { default: true }).with(Workspace).exec(async function(exec, fix, workspace) {
|
|
420
|
+
await this.workspaceScript.lint(exec, workspace, { fix });
|
|
421
|
+
}),
|
|
422
|
+
lintAll: target({ desc: "Lint and fix code in all apps and libraries" }).option("fix", Boolean, { default: true }).with(Workspace).exec(async function(fix, workspace) {
|
|
423
|
+
await this.workspaceScript.lintAll(workspace, { fix });
|
|
424
|
+
}),
|
|
425
|
+
syncAll: target({ desc: "Sync dependencies and configuration for all apps and libraries" }).with(Workspace).exec(async function(workspace) {
|
|
426
|
+
await this.workspaceScript.syncAll(workspace);
|
|
427
|
+
}),
|
|
428
|
+
init: target({ desc: "Initialize the workspace", runsOnWorkspaceRoot: false }).arg("devProjectId", String, { desc: "the ID of the workspace" }).option("host", String, { desc: "host of the cloud to target", default: GlobalConfig.akanCloudHost }).with(Workspace).exec(async function(devProjectId, host, workspace) {
|
|
429
|
+
await this.workspaceScript.init(devProjectId, workspace, { host });
|
|
430
|
+
})
|
|
431
|
+
})) {
|
|
432
|
+
}
|
|
433
|
+
export {
|
|
434
|
+
WorkspaceCommand
|
|
435
|
+
};
|
package/README.ko.md
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# @akanjs/cli
|
|
2
|
-
|
|
3
|
-
[문서](https://akanjs.com/docs) | [npm](https://www.npmjs.com/package/@akanjs/cli) | [런타임](https://www.npmjs.com/package/akanjs)
|
|
4
|
-
|
|
5
|
-
Akan.js 워크스페이스를 위한 command-line tooling입니다.
|
|
6
|
-
|
|
7
|
-
`@akanjs/cli`는 Akan 애플리케이션, 라이브러리, 프레임워크 패키지를 생성, 빌드, 테스트, 린트,
|
|
8
|
-
릴리즈, 유지보수하는 데 사용하는 `akan` 실행 파일을 제공합니다. Bun-first CLI 패키지이며 Akan
|
|
9
|
-
개발 tooling을 내부에 번들링하므로, 애플리케이션 런타임은 더 작은 `akanjs` 패키지에만 의존할 수
|
|
10
|
-
있습니다.
|
|
11
|
-
|
|
12
|
-
## 설치
|
|
13
|
-
|
|
14
|
-
새 워크스페이스를 바로 만들 수 있습니다.
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
bunx create-akan-workspace@latest
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
또는 CLI를 전역으로 설치할 수 있습니다.
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
bun install -g @akanjs/cli@latest
|
|
24
|
-
akan --help
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## 자주 쓰는 명령
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
akan create-workspace <workspace-name>
|
|
31
|
-
akan start <app-name>
|
|
32
|
-
akan build <app-name>
|
|
33
|
-
akan test <app-or-lib-or-pkg>
|
|
34
|
-
akan lint <app-or-lib-or-pkg>
|
|
35
|
-
akan create-application <app-name>
|
|
36
|
-
akan create-library <lib-name>
|
|
37
|
-
akan create-module <module-name>
|
|
38
|
-
akan create-scalar <scalar-name>
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
패키지 유지보수 명령도 같은 실행 파일에서 제공합니다.
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
akan build-package akanjs
|
|
45
|
-
akan build-package @akanjs/cli
|
|
46
|
-
akan build-package @akanjs/devkit
|
|
47
|
-
akan build-package create-akan-workspace
|
|
48
|
-
akan verify-akan-publish-packages
|
|
49
|
-
akan smoke-registry --test=true --tag=rc
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Akan framework 패키지는 반드시 `dist/pkgs/*` 산출물 기준으로 publish합니다. `verify-akan-publish-packages`는
|
|
53
|
-
빌드된 패키지에 `npm pack --dry-run --json`을 실행하고, `deploy-akan` 또는 local registry smoke 전에 필요한
|
|
54
|
-
metadata를 검증합니다.
|
|
55
|
-
저장소 릴리즈에서는 root `akan` bootstrap script가 CLI dist를 덮어쓰지 않도록
|
|
56
|
-
`bun run release:build-packages && bun run release:verify-packages`를 우선 사용합니다.
|
|
57
|
-
|
|
58
|
-
## 패키지 경계
|
|
59
|
-
|
|
60
|
-
- 애플리케이션과 런타임 코드는 `akanjs`를 사용합니다.
|
|
61
|
-
- 사용자-facing 실행 패키지는 `@akanjs/cli`입니다.
|
|
62
|
-
- `@akanjs/devkit`은 published CLI 사용을 위해 CLI 안에 번들링됩니다. 일반 CLI 사용자가 별도의
|
|
63
|
-
runtime dependency로 설치할 필요는 없습니다.
|
|
64
|
-
|
|
65
|
-
## 요구사항
|
|
66
|
-
|
|
67
|
-
- [Bun](https://bun.sh) `>=1.3.13`
|
|
68
|
-
- TypeScript 기반 Akan 워크스페이스
|
|
69
|
-
|
|
70
|
-
## 라이선스
|
|
71
|
-
|
|
72
|
-
MIT
|
package/README.md
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
# @akanjs/cli
|
|
2
|
-
|
|
3
|
-
[Docs](https://akanjs.com/docs) | [npm](https://www.npmjs.com/package/@akanjs/cli) | [Runtime](https://www.npmjs.com/package/akanjs)
|
|
4
|
-
|
|
5
|
-
Command-line tooling for Akan.js workspaces.
|
|
6
|
-
|
|
7
|
-
`@akanjs/cli` provides the `akan` executable used to create, build, test, lint, release, and maintain Akan
|
|
8
|
-
applications, libraries, and framework packages. It is a Bun-first CLI package and bundles Akan development
|
|
9
|
-
tooling internally so application runtimes can depend on the smaller `akanjs` package.
|
|
10
|
-
|
|
11
|
-
## Install
|
|
12
|
-
|
|
13
|
-
Create a new workspace:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
bunx create-akan-workspace@latest
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Or install the CLI globally:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
bun install -g @akanjs/cli@latest
|
|
23
|
-
akan --help
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Common Commands
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
akan create-workspace <workspace-name>
|
|
30
|
-
akan start <app-name>
|
|
31
|
-
akan build <app-name>
|
|
32
|
-
akan test <app-or-lib-or-pkg>
|
|
33
|
-
akan lint <app-or-lib-or-pkg>
|
|
34
|
-
akan create-application <app-name>
|
|
35
|
-
akan create-library <lib-name>
|
|
36
|
-
akan create-module <module-name>
|
|
37
|
-
akan create-scalar <scalar-name>
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Agent And MCP Commands
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
akan context --format markdown
|
|
44
|
-
akan context --format json --module <module-name>
|
|
45
|
-
akan doctor --format json
|
|
46
|
-
akan guideline list
|
|
47
|
-
akan guideline show framework
|
|
48
|
-
akan agent install cursor
|
|
49
|
-
akan mcp
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
These commands expose Akan workspace structure, module abstracts, diagnostics, and guideline instructions for
|
|
53
|
-
coding agents. The MCP server is read-only and is intended to provide context rather than edit files directly.
|
|
54
|
-
|
|
55
|
-
Package maintenance commands are also exposed through the same executable:
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
akan build-package akanjs
|
|
59
|
-
akan build-package @akanjs/cli
|
|
60
|
-
akan build-package @akanjs/devkit
|
|
61
|
-
akan build-package create-akan-workspace
|
|
62
|
-
akan verify-akan-publish-packages
|
|
63
|
-
akan smoke-registry --test=true --tag=rc
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Publish Akan framework packages from `dist/pkgs/*` only. `verify-akan-publish-packages` runs `npm pack --dry-run --json`
|
|
67
|
-
against the built packages and checks metadata that must be correct before `deploy-akan` or local registry smoke.
|
|
68
|
-
For repository releases, prefer `bun run release:build-packages && bun run release:verify-packages` so the CLI package
|
|
69
|
-
artifact is built last and is not overwritten by the root `akan` bootstrap script.
|
|
70
|
-
|
|
71
|
-
## Package Boundary
|
|
72
|
-
|
|
73
|
-
- Use `akanjs` from application and runtime code.
|
|
74
|
-
- Use `@akanjs/cli` as the user-facing executable package.
|
|
75
|
-
- `@akanjs/devkit` is bundled into the CLI for published CLI usage; it is not required as a separate
|
|
76
|
-
runtime dependency for ordinary CLI users.
|
|
77
|
-
|
|
78
|
-
## Requirements
|
|
79
|
-
|
|
80
|
-
- [Bun](https://bun.sh) `>=1.3.13`
|
|
81
|
-
- A TypeScript Akan workspace
|
|
82
|
-
|
|
83
|
-
## License
|
|
84
|
-
|
|
85
|
-
MIT
|