@akanjs/cli 3.1.1-rc.9 → 3.1.2-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/.build-stamp +1 -1
- package/CodeAgent-dyc45f5w.js +11 -0
- package/{CodeAgentRpcHost-9g27hmer.js → CodeAgentRpcHost-6dzfkvsc.js} +1 -1
- package/CodeAgentRpcListener-tcwrdvst.js +182 -0
- package/{CodeTui-z5vkm9ea.js → CodeTui-q55b2zrn.js} +25 -8
- package/TunnelShare-hdq9h1hr.js +14 -0
- package/agent.command-20zaqe60.js +49 -0
- package/akanCode.js +13 -8
- package/{application.command-wthg8nn9.js → application.command-nd0fshsk.js} +45 -12
- package/{applicationBuildRunner-t2r84sz6.js → applicationBuildRunner-s13x3zqb.js} +14 -10
- package/buildBatch.proc.js +7 -7
- package/{cloud.command-sz11hpre.js → cloud.command-8kbddsz9.js} +28 -19
- package/cloud.script-hgvvajm3.js +27 -0
- package/code.command-625bg8s8.js +345 -0
- package/commandManifest.json +1 -1
- package/{context.command-15j9b7c0.js → context.command-p6haqjay.js} +20 -18
- package/context.runner-rsnqnk9j.js +27 -0
- package/{dependencyScanner-3afj2vt1.js → dependencyScanner-78sq8m4q.js} +2 -2
- package/{devTui-q7k7bakd.js → devTui-evr3b35y.js} +1 -1
- package/{fileSys-wzzrntkw.js → fileSys-zpvt5gtf.js} +1 -1
- package/{guideline.command-snh85ctf.js → guideline.command-195g0h9a.js} +4 -4
- package/guidelines/agentRule/agentRule.instruction.md +22 -8
- package/guidelines/conventions/core.md +106 -0
- package/guidelines/conventions/rules/app.md +83 -0
- package/guidelines/conventions/rules/auth.md +46 -0
- package/guidelines/conventions/rules/config.md +60 -0
- package/guidelines/conventions/rules/constant.md +24 -0
- package/guidelines/conventions/rules/gates.md +32 -0
- package/guidelines/conventions/rules/layer.md +25 -0
- package/guidelines/conventions/rules/migration.md +27 -0
- package/guidelines/conventions/rules/module.md +90 -0
- package/guidelines/conventions/rules/page.md +56 -0
- package/guidelines/conventions/rules/sensitive.md +16 -0
- package/guidelines/conventions/rules/server.md +91 -0
- package/guidelines/conventions/rules/ssr.md +47 -0
- package/guidelines/conventions/rules/style.md +43 -0
- package/guidelines/conventions/rules/test.md +34 -0
- package/guidelines/conventions/rules/ts.md +95 -0
- package/guidelines/conventions/rules/tsx.md +76 -0
- package/guidelines/mcpRule/mcpRule.instruction.md +1 -1
- package/guidelines/pageRule/pageRule.instruction.md +8 -7
- package/guidelines/queryRule/queryRule.instruction.md +4 -0
- package/guidelines/runtimeRule/runtimeRule.instruction.md +35 -25
- package/guidelines/ssrRule/ssrRule.instruction.md +11 -10
- package/guidelines/transportRule/transportRule.instruction.md +5 -4
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +4 -4
- package/incrementalBuilder.proc.js +7 -7
- package/{index-301pdbzz.js → index-00a7j05x.js} +7 -7
- package/{index-js6geqjn.js → index-0j1t1h2b.js} +3 -1
- package/{index-6txx6a9p.js → index-1h2jc0x3.js} +154 -88
- package/{index-55j120r8.js → index-1qsd8ft1.js} +65 -145
- package/{index-9th4gszy.js → index-2mwjshz5.js} +233 -1271
- package/index-2nxk8wgs.js +266 -0
- package/{index-j9vyj3dj.js → index-2phm56a1.js} +49 -8
- package/index-35j83zkd.js +61 -0
- package/index-4am4dvmf.js +29 -0
- package/index-75y7bcz4.js +28 -0
- package/index-7apsdr5g.js +487 -0
- package/{index-42j4a8zq.js → index-84h43kg6.js} +8 -6
- package/index-9bv479q5.js +1 -0
- package/{index-3wypz6xj.js → index-9zy8479y.js} +11 -5
- package/{index-a5dhqkdr.js → index-a1vb3x7t.js} +273 -259
- package/{index-52w0fvh8.js → index-bns3wcpc.js} +15 -0
- package/index-cjmjvg4r.js +3622 -0
- package/{index-pcwzkdqb.js → index-defp4gmb.js} +1 -1
- package/index-ewbmfarf.js +1606 -0
- package/index-fbewhg4g.js +590 -0
- package/index-fhw7yq2d.js +653 -0
- package/{index-wcej7g4z.js → index-g500c5j9.js} +271 -105
- package/{index-74tjjsnc.js → index-g841cap9.js} +33 -37
- package/{index-2azahjaw.js → index-gr9thy79.js} +5 -5
- package/{index-4pf8g7ff.js → index-h7hehkw6.js} +3 -0
- package/{index-xjf5j657.js → index-hm0tn7qv.js} +1001 -91
- package/index-j6eeh5d7.js +138 -0
- package/{index-31es1yev.js → index-j7hwy56s.js} +108 -7
- package/{index-skk9zc1x.js → index-jc2zbwra.js} +2 -2
- package/{index-905qdgqp.js → index-khk05tsf.js} +1 -1
- package/{index-5nd1wtkv.js → index-p6x5b7hr.js} +1 -1
- package/{index-tvehn2sp.js → index-qd7xn2bk.js} +1 -1
- package/{index-a58emady.js → index-qw6814m4.js} +55 -17
- package/index-raz588b3.js +445 -0
- package/{index-at7bz0xq.js → index-s4nvxpzm.js} +2 -0
- package/{index-bt438yxm.js → index-sp0qsr7a.js} +116 -13
- package/{index-xb8809yb.js → index-sveq36gh.js} +40 -43
- package/{index-hmt54t45.js → index-t1t9wq9a.js} +4 -4
- package/index-t78230d7.js +191 -0
- package/index-tenw3mah.js +225 -0
- package/{index-qfp55x1y.js → index-tgqameyb.js} +4 -4
- package/{index-espk51ah.js → index-tp56652m.js} +6 -6
- package/index-w15mg3km.js +389 -0
- package/{index-dy0jx9ay.js → index-wwe9rsrx.js} +14 -0
- package/{index-2xcc2ax5.js → index-y4kcmbt2.js} +2 -2
- package/index-yf9wc28h.js +52 -0
- package/{index-0fz95kxe.js → index-zbrwnmf1.js} +9 -7
- package/{index-40brg4px.js → index-zttm13c3.js} +5 -5
- package/index.js +24 -23
- package/{library.command-gycrwhf1.js → library.command-63hgt9te.js} +4 -4
- package/{localRegistry.command-jtd8gaes.js → localRegistry.command-g3f8k25t.js} +46 -22
- package/{module.command-v6hgs1bc.js → module.command-r4sa2khp.js} +7 -6
- package/{package.command-shzpcfph.js → package.command-96eheyvd.js} +5 -5
- package/package.json +2 -2
- package/{page.command-ptxn5kqk.js → page.command-gs6d841d.js} +4 -4
- package/{pipeline.command-zz31pgax.js → pipeline.command-wdfvdbfj.js} +3 -3
- package/{primitive.command-a1vse91z.js → primitive.command-dfsv4mpe.js} +8 -7
- package/{projectTypecheck-2ztky9cf.js → projectTypecheck-kqj1t6hb.js} +1 -1
- package/{prompter-76k56b37.js → prompter-qrwx1p17.js} +2 -2
- package/quality.command-webzxee2.js +78 -0
- package/{repair.command-cvazbz99.js → repair.command-3r3j1xre.js} +7 -6
- package/{routeSourceValidator-6jd0q6r6.js → routeSourceValidator-4h947v7c.js} +13 -3
- package/{scalar.command-0acvyp26.js → scalar.command-e8y47j6d.js} +6 -5
- package/skills/akan-agent/SKILL.md +43 -0
- package/skills/akan-code/SKILL.md +38 -11
- package/skills/akan-debug/SKILL.md +41 -6
- package/skills/akan-deps/SKILL.md +1 -2
- package/skills/akan-err/SKILL.md +2 -1
- package/skills/akan-mcp/SKILL.md +40 -0
- package/skills/akan-page/SKILL.md +44 -0
- package/skills/akan-query/SKILL.md +39 -0
- package/skills/akan-runtime/SKILL.md +43 -0
- package/skills/akan-scaffold/SKILL.md +16 -6
- package/skills/akan-transport/SKILL.md +40 -0
- package/skills/akan-validate/SKILL.md +13 -11
- package/{subspace.command-822qx2bx.js → subspace.command-a1sf9n5a.js} +12 -10
- package/templates/__scalar/__model__/__model__.constant.ts +3 -5
- package/templates/__scalar/__model__/__model__.dictionary.ts +6 -5
- package/templates/__scalar/__model__/__model__.document.ts +3 -3
- package/templates/app/akan.config.ts +2 -3
- package/templates/app/env/env.client.ts +2 -4
- package/templates/app/env/env.client.type.ts +2 -3
- package/templates/app/env/env.server.ts +2 -3
- package/templates/app/lib/___appName__/__appName__.dictionary.ts +1 -2
- package/templates/app/lib/___appName__/__appName__.service.ts +3 -3
- package/templates/app/lib/___appName__/__appName__.signal.ts +5 -5
- package/templates/app/lib/___appName__/__appName__.store.ts +4 -6
- package/templates/app/lib/option.ts +2 -3
- package/templates/app/main.ts +2 -4
- package/templates/app/page/_index.tsx +3 -3
- package/templates/app/page/_layout.tsx +13 -10
- package/templates/appSample/lib/__scalar/workHistory/workHistory.constant.ts +1 -5
- package/templates/appSample/lib/__scalar/workHistory/workHistory.dictionary.ts +1 -1
- package/templates/appSample/lib/_noti/noti.signal.ts +1 -1
- package/templates/appSample/lib/task/Task.Template.tsx +2 -1
- package/templates/appSample/lib/task/Task.Unit.tsx +3 -2
- package/templates/appSample/lib/task/Task.Util.tsx +16 -4
- package/templates/appSample/lib/task/task.constant.ts +1 -5
- package/templates/appSample/lib/task/task.dictionary.ts +2 -8
- package/templates/appSample/lib/task/task.document.ts +1 -1
- package/templates/appSample/lib/task/task.signal.ts +14 -9
- package/templates/appSample/page/task/_index.tsx +2 -1
- package/templates/appSample/page/task/new.tsx +2 -1
- package/templates/appSample/srvkit/guards.ts +11 -0
- package/templates/appSample/ui/QuantityControl.tsx +5 -9
- package/templates/biomeForm.ts +144 -0
- package/templates/crudPages/[__model__Id]/edit/page.tsx +3 -3
- package/templates/crudPages/[__model__Id]/page.tsx +5 -5
- package/templates/crudPages/new/page.tsx +4 -3
- package/templates/crudPages/page.tsx +3 -3
- package/templates/crudSinglePage/page.tsx +9 -5
- package/templates/libRoot/akan.config.ts +2 -3
- package/templates/libRoot/lib/___libName__/__libName__.dictionary.ts +1 -2
- package/templates/libRoot/lib/___libName__/__libName__.service.ts +5 -4
- package/templates/libRoot/lib/___libName__/__libName__.signal.ts +6 -5
- package/templates/libRoot/lib/___libName__/__libName__.store.ts +5 -6
- package/templates/libRoot/lib/option.ts +1 -2
- package/templates/module/__Model__.Template.tsx +11 -10
- package/templates/module/__Model__.Unit.tsx +18 -5
- package/templates/module/__Model__.Util.tsx +9 -7
- package/templates/module/__Model__.View.tsx +9 -6
- package/templates/module/__Model__.Zone.tsx +25 -17
- package/templates/module/__model__.constant.ts +8 -9
- package/templates/module/__model__.dictionary.ts +16 -17
- package/templates/module/__model__.document.ts +6 -8
- package/templates/module/__model__.service.ts +3 -3
- package/templates/module/__model__.signal.ts +11 -10
- package/templates/module/__model__.store.ts +3 -5
- package/templates/service/__model__.dictionary.ts +5 -6
- package/templates/service/__model__.service.ts +3 -3
- package/templates/service/__model__.signal.ts +5 -4
- package/templates/service/__model__.store.ts +3 -5
- package/templates/workspaceRoot/.gitignore.template +4 -0
- package/templates/workspaceRoot/.vscode/settings.json.template +21 -21
- package/templates/workspaceRoot/AGENTS.md.template +4 -10
- package/{tunnel.command-ycmja19q.js → tunnel.command-dcb0wg93.js} +25 -13
- package/{typeChecker-px49mezc.js → typeChecker-j2jdnqsr.js} +1 -1
- package/typecheck.proc.js +6 -1
- package/verify.command-yyepccbh.js +93 -0
- package/{workflow.command-abb1d5xy.js → workflow.command-z5pg9ay0.js} +49 -14
- package/workspace.command-d7x5jttw.js +290 -0
- package/CodeAgent-8d5qs787.js +0 -9
- package/CodeAgentRpcListener-7p7z5dd7.js +0 -97
- package/TunnelShare-qkm8zp03.js +0 -14
- package/agent.command-ydftceda.js +0 -25
- package/cloud.script-nqevg5qw.js +0 -24
- package/code.command-9h3yrzhe.js +0 -167
- package/context.runner-8gg030b0.js +0 -25
- package/guidelines/conventions/conventions.instruction.md +0 -617
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +0 -291
- package/index-2mwc0g0d.js +0 -49
- package/index-4vgbysa0.js +0 -279
- package/index-7md2g9vw.js +0 -6
- package/index-b70zct19.js +0 -856
- package/index-c6eggbee.js +0 -123
- package/index-zzvvc845.js +0 -74
- package/quality.command-ah8qcakd.js +0 -1478
- package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +0 -69
- package/templates/workspaceRoot/docs/GENERATED.md.template +0 -55
- package/workspace.command-qm7cw29v.js +0 -521
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
This is an Akan.js workspace. Akan is convention-driven: keep business intent in the expected place and let
|
|
4
4
|
the framework generate the repeated surfaces.
|
|
5
5
|
|
|
6
|
-
For agent-neutral documentation that Claude Code, Codex, Devin, GitHub Copilot Coding Agent, and other tools can
|
|
7
|
-
also read, see `docs/AI-DEVELOPMENT.md` and `docs/GENERATED.md`.
|
|
8
|
-
|
|
9
6
|
## Framework Bugs And Feature Requests
|
|
10
7
|
|
|
11
8
|
If you hit an Akan.js bug, or a fix that one framework change would solve more easily than app-level workarounds,
|
|
@@ -14,13 +11,10 @@ the user before filing it. Keep any interim workaround small and marked `// TODO
|
|
|
14
11
|
|
|
15
12
|
## Generated Context
|
|
16
13
|
|
|
17
|
-
The section below is regenerated by `akan agent install` (run `bun run setup:agent`)
|
|
18
|
-
|
|
19
|
-
markers freely; content between them is overwritten on the next
|
|
20
|
-
|
|
21
|
-
It carries the rules only. The reasoning behind each area lives in deep-dive guidelines fetched on demand —
|
|
22
|
-
`akan guideline list` names them, `akan guideline show <name>` prints one, and an agent wired to `akan mcp`
|
|
23
|
-
calls `get_guideline` instead.
|
|
14
|
+
The section below is regenerated by `akan agent install` (run `bun run setup:agent`), together with the path
|
|
15
|
+
rules in `.claude/rules/akan/` and `.cursor/rules/akan-*.mdc` and the skills in `.claude/skills/` and
|
|
16
|
+
`.agents/skills/`. Edit anything outside the markers freely; content between them is overwritten on the next
|
|
17
|
+
install, and so is a generated file that still carries its `<!-- akan:generated -->` marker.
|
|
24
18
|
|
|
25
19
|
<!-- akan:agent:start -->
|
|
26
20
|
<!-- Populated by `akan agent install`. Run `bun run setup:agent` to refresh. -->
|
|
@@ -4,22 +4,22 @@ import {
|
|
|
4
4
|
runner,
|
|
5
5
|
script,
|
|
6
6
|
command
|
|
7
|
-
} from "./index-
|
|
8
|
-
import"./index-
|
|
7
|
+
} from "./index-9zy8479y.js";
|
|
8
|
+
import"./index-bns3wcpc.js";
|
|
9
9
|
import {
|
|
10
10
|
AppExecutor
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-g500c5j9.js";
|
|
12
12
|
import {
|
|
13
13
|
GlobalConfig,
|
|
14
14
|
CloudApi
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-gr9thy79.js";
|
|
16
16
|
import"./index-m9jj544v.js";
|
|
17
|
-
import"./index-
|
|
18
|
-
import"./index-
|
|
19
|
-
import"./index-
|
|
17
|
+
import"./index-sp0qsr7a.js";
|
|
18
|
+
import"./index-zbrwnmf1.js";
|
|
19
|
+
import"./index-sveq36gh.js";
|
|
20
20
|
import {
|
|
21
21
|
TunnelShare2
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-t78230d7.js";
|
|
23
23
|
import {
|
|
24
24
|
writeClipboard
|
|
25
25
|
} from "./index-p6pbz9n5.js";
|
|
@@ -46,7 +46,8 @@ class TunnelRunner extends runner("tunnel") {
|
|
|
46
46
|
${chalk.bold(share.url)}${copied ? chalk.dim(" (copied)") : ""}`);
|
|
47
47
|
if (share.grant.expiresAt)
|
|
48
48
|
Logger.rawLog(chalk.dim(` expires ${share.grant.expiresAt}`));
|
|
49
|
-
Logger.rawLog(chalk.dim(` code ${share.grant.code} \u2014 stop it with: akan tunnel --stop ${share.grant.code}
|
|
49
|
+
Logger.rawLog(chalk.dim(` code ${share.grant.code} \u2014 stop it with: akan tunnel --stop ${share.grant.code}`));
|
|
50
|
+
Logger.rawLog(chalk.yellow(` ${TunnelShare2.exposureNotice(app.name, !!options.devRoutes)}
|
|
50
51
|
`));
|
|
51
52
|
await TunnelRunner.holdUntilInterrupt(() => share.close());
|
|
52
53
|
}
|
|
@@ -100,13 +101,14 @@ class TunnelScript extends script("tunnel", [TunnelRunner]) {
|
|
|
100
101
|
return AppExecutor.from(workspace, only);
|
|
101
102
|
return AppExecutor.from(workspace, await select({ message: "Select the app to share", choices: appNames }));
|
|
102
103
|
}
|
|
103
|
-
async share(name, { workspace, host, port, ttl }) {
|
|
104
|
+
async share(name, { workspace, host, port, ttl, devRoutes }) {
|
|
104
105
|
const app = await TunnelScript.resolveApp(workspace, name);
|
|
105
106
|
await this.tunnelRunner.share(app, {
|
|
106
107
|
workspace,
|
|
107
108
|
...host ? { host } : {},
|
|
108
109
|
...port ? { port } : {},
|
|
109
|
-
...ttl ? { ttlMinutes: ttl } : {}
|
|
110
|
+
...ttl ? { ttlMinutes: ttl } : {},
|
|
111
|
+
...devRoutes ? { devRoutes } : {}
|
|
110
112
|
});
|
|
111
113
|
}
|
|
112
114
|
async list(workspace, host) {
|
|
@@ -122,12 +124,22 @@ class TunnelCommand extends command("tunnel", [TunnelScript], ({ public: target
|
|
|
122
124
|
tunnel: target({ desc: "Share a locally running app on a public URL" }).arg("app", String, { desc: "app to share", nullable: true }).option("list", Boolean, { desc: "list the shares this account is holding", default: false }).option("stop", String, { desc: "stop the share with this code", default: "" }).option("host", String, {
|
|
123
125
|
desc: "host of the cloud (default: cloud.host of the root akan.config.ts, else Akan Cloud)",
|
|
124
126
|
nullable: true
|
|
125
|
-
}).option("port", Number, { desc: "local port to share (default: the app's dev port)", nullable: true }).option("ttl", Number, { desc: "minutes before the share expires", nullable: true }).
|
|
127
|
+
}).option("port", Number, { desc: "local port to share (default: the app's dev port)", nullable: true }).option("ttl", Number, { desc: "minutes before the share expires", nullable: true }).option("devRoutes", Boolean, {
|
|
128
|
+
flag: "d",
|
|
129
|
+
desc: "also share devtools, the HMR socket and source maps, which a share leaves out by default",
|
|
130
|
+
default: false
|
|
131
|
+
}).with(Workspace).exec(async function(app, list, stop, host, port, ttl, devRoutes, workspace) {
|
|
126
132
|
if (list)
|
|
127
133
|
return await this.tunnelScript.list(workspace, host);
|
|
128
134
|
if (stop)
|
|
129
135
|
return await this.tunnelScript.stop(stop, workspace, host);
|
|
130
|
-
await this.tunnelScript.share(app, {
|
|
136
|
+
await this.tunnelScript.share(app, {
|
|
137
|
+
workspace,
|
|
138
|
+
host,
|
|
139
|
+
devRoutes,
|
|
140
|
+
...port ? { port } : {},
|
|
141
|
+
...ttl ? { ttl } : {}
|
|
142
|
+
});
|
|
131
143
|
})
|
|
132
144
|
})) {
|
|
133
145
|
}
|
package/typecheck.proc.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
TypeChecker2
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-wwe9rsrx.js";
|
|
5
5
|
|
|
6
6
|
// pkgs/@akanjs/devkit/typecheck/typecheck.proc.ts
|
|
7
7
|
import { Logger } from "akanjs/common";
|
|
@@ -26,6 +26,11 @@ try {
|
|
|
26
26
|
if (!configPath)
|
|
27
27
|
throw new Error("AKAN_TYPECHECK_TSCONFIG is required");
|
|
28
28
|
const result = TypeChecker2.checkProject(configPath);
|
|
29
|
+
if (process.env.AKAN_TYPECHECK_FORMAT === "json") {
|
|
30
|
+
const root = process.env.AKAN_TYPECHECK_ROOT ?? process.cwd();
|
|
31
|
+
process.stdout.write(JSON.stringify(TypeChecker2.toRecords(result.errors, root)));
|
|
32
|
+
process.exit(result.errors.length > 0 ? 1 : 0);
|
|
33
|
+
}
|
|
29
34
|
if (result.errors.length > 0) {
|
|
30
35
|
console.error(result.message);
|
|
31
36
|
process.exit(1);
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
Workspace,
|
|
4
|
+
script,
|
|
5
|
+
ExitCodeError,
|
|
6
|
+
markCliErrorPrinted,
|
|
7
|
+
command
|
|
8
|
+
} from "./index-9zy8479y.js";
|
|
9
|
+
import"./index-bns3wcpc.js";
|
|
10
|
+
import"./index-g500c5j9.js";
|
|
11
|
+
import {
|
|
12
|
+
ApplicationRunner,
|
|
13
|
+
VerifyScope
|
|
14
|
+
} from "./index-2mwjshz5.js";
|
|
15
|
+
import"./index-p6x5b7hr.js";
|
|
16
|
+
import"./index-sp0qsr7a.js";
|
|
17
|
+
import"./index-0j1t1h2b.js";
|
|
18
|
+
import"./index-m9jj544v.js";
|
|
19
|
+
import"./index-zbrwnmf1.js";
|
|
20
|
+
import"./index-sveq36gh.js";
|
|
21
|
+
import"./index-62md4dwy.js";
|
|
22
|
+
import {
|
|
23
|
+
WorkspaceRunner
|
|
24
|
+
} from "./index-cjmjvg4r.js";
|
|
25
|
+
import"./index-2nxk8wgs.js";
|
|
26
|
+
import"./index-hj6w4ka1.js";
|
|
27
|
+
import"./index-4am4dvmf.js";
|
|
28
|
+
import"./index-fbewhg4g.js";
|
|
29
|
+
import {
|
|
30
|
+
VerifyPipeline,
|
|
31
|
+
VerifyReport
|
|
32
|
+
} from "./index-7apsdr5g.js";
|
|
33
|
+
import"./index-defp4gmb.js";
|
|
34
|
+
|
|
35
|
+
// pkgs/@akanjs/cli/verify/verify.script.ts
|
|
36
|
+
import path from "path";
|
|
37
|
+
import { Logger } from "akanjs/common";
|
|
38
|
+
class VerifyScript extends script("verify", [WorkspaceRunner, ApplicationRunner]) {
|
|
39
|
+
async verify(workspace, requested, options = {}) {
|
|
40
|
+
const [apps, libs, pkgs] = await workspace.getExecs();
|
|
41
|
+
const names = { apps, libs, pkgs };
|
|
42
|
+
const changes = options.files?.length ? options.files.map((file) => ({ code: " M", file: VerifyScript.#relative(workspace, file) })) : await VerifyScope.changesIn(workspace.workspaceRoot) ?? [];
|
|
43
|
+
const scope = VerifyScope.resolve(changes, names, requested);
|
|
44
|
+
const consoleOutput = Logger.consoleOutput;
|
|
45
|
+
Logger.consoleOutput = false;
|
|
46
|
+
const result = await new VerifyPipeline(workspace, this.workspaceRunner, this.applicationRunner).run(scope, { lintOnly: options.lintOnly, build: options.build }).finally(() => {
|
|
47
|
+
Logger.consoleOutput = consoleOutput;
|
|
48
|
+
});
|
|
49
|
+
Logger.rawLog(options.format === "json" ? VerifyReport.json(result) : VerifyReport.text(result, { max: options.max }));
|
|
50
|
+
if (result.ok)
|
|
51
|
+
return;
|
|
52
|
+
const failure = new ExitCodeError("verify failed", 1);
|
|
53
|
+
markCliErrorPrinted(failure);
|
|
54
|
+
throw failure;
|
|
55
|
+
}
|
|
56
|
+
static #relative(workspace, file) {
|
|
57
|
+
const absolute = path.isAbsolute(file) ? file : path.resolve(workspace.workspaceRoot, file);
|
|
58
|
+
return path.relative(workspace.workspaceRoot, absolute).split(path.sep).join("/");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// pkgs/@akanjs/cli/verify/verify.command.ts
|
|
63
|
+
var listOf = (value) => (value ?? "").split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
64
|
+
|
|
65
|
+
class VerifyCommand extends command("verify", [VerifyScript], ({ public: target }) => ({
|
|
66
|
+
verify: target({
|
|
67
|
+
desc: "Sync, lint, typecheck and build what changed, in one run, and print only what failed",
|
|
68
|
+
stdio: true
|
|
69
|
+
}).arg("targets", String, {
|
|
70
|
+
desc: "apps, libraries or packages to verify, comma-separated (default: whatever git reports as changed)",
|
|
71
|
+
nullable: true
|
|
72
|
+
}).option("files", String, {
|
|
73
|
+
flag: "F",
|
|
74
|
+
desc: "verify these files only, comma-separated, instead of the git changes",
|
|
75
|
+
nullable: true
|
|
76
|
+
}).option("lintOnly", Boolean, {
|
|
77
|
+
flag: "l",
|
|
78
|
+
desc: "lint only: skip sync, typecheck, build and the SSR check",
|
|
79
|
+
default: false
|
|
80
|
+
}).option("build", Boolean, { flag: "b", desc: "build the changed apps once lint and typecheck pass", default: true }).option("max", Number, { flag: "m", desc: "diagnostic lines to print, 0 for all", default: 20 }).option("format", String, { flag: "f", desc: "output format", default: "text", enum: ["text", "json"] }).with(Workspace).exec(async function(targets, files, lintOnly, build, max, format, workspace) {
|
|
81
|
+
await this.verifyScript.verify(workspace, listOf(targets), {
|
|
82
|
+
files: listOf(files),
|
|
83
|
+
lintOnly,
|
|
84
|
+
build,
|
|
85
|
+
max,
|
|
86
|
+
format: format === "json" ? "json" : "text"
|
|
87
|
+
});
|
|
88
|
+
})
|
|
89
|
+
})) {
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
VerifyCommand
|
|
93
|
+
};
|
|
@@ -3,20 +3,22 @@ import {
|
|
|
3
3
|
Workspace,
|
|
4
4
|
script,
|
|
5
5
|
command
|
|
6
|
-
} from "./index-
|
|
7
|
-
import"./index-
|
|
8
|
-
import"./index-
|
|
6
|
+
} from "./index-9zy8479y.js";
|
|
7
|
+
import"./index-bns3wcpc.js";
|
|
8
|
+
import"./index-g500c5j9.js";
|
|
9
9
|
import"./index-hj6w4ka1.js";
|
|
10
|
-
import"./index-
|
|
11
|
-
import"./index-
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
14
|
-
import"./index-
|
|
15
|
-
import"./index-
|
|
16
|
-
import"./index-
|
|
10
|
+
import"./index-hm0tn7qv.js";
|
|
11
|
+
import"./index-2nxk8wgs.js";
|
|
12
|
+
import"./index-j7hwy56s.js";
|
|
13
|
+
import"./index-khk05tsf.js";
|
|
14
|
+
import"./index-t1t9wq9a.js";
|
|
15
|
+
import"./index-g841cap9.js";
|
|
16
|
+
import"./index-2phm56a1.js";
|
|
17
|
+
import"./index-jc2zbwra.js";
|
|
18
|
+
import"./index-fbewhg4g.js";
|
|
17
19
|
import {
|
|
18
20
|
WorkflowRunner
|
|
19
|
-
} from "./index-
|
|
21
|
+
} from "./index-raz588b3.js";
|
|
20
22
|
|
|
21
23
|
// pkgs/@akanjs/cli/workflow/workflow.script.ts
|
|
22
24
|
import { Logger } from "akanjs/common";
|
|
@@ -38,7 +40,7 @@ class WorkflowScript extends script("workflow", [WorkflowRunner]) {
|
|
|
38
40
|
return;
|
|
39
41
|
}
|
|
40
42
|
if (action === "plan") {
|
|
41
|
-
Logger.rawLog(await this.workflowRunner.plan(workflow, inputs, { format, out }));
|
|
43
|
+
Logger.rawLog(await this.workflowRunner.plan(workflow, inputs, { format, out, workspace }));
|
|
42
44
|
return;
|
|
43
45
|
}
|
|
44
46
|
if (action === "apply") {
|
|
@@ -69,8 +71,41 @@ class WorkflowCommand extends command("workflow", [WorkflowScript], ({ public: t
|
|
|
69
71
|
workflow: target({ desc: "List, explain, plan, apply, validate, or report Akan workflows" }).arg("action", String, {
|
|
70
72
|
desc: "list, explain, plan, apply, validate, or report",
|
|
71
73
|
enum: ["list", "explain", "plan", "apply", "validate", "report"]
|
|
72
|
-
}).arg("workflow", String, { desc: "workflow name, plan path, or run id", nullable: true }).with(Workspace).option("format", String, { desc: "output format", flag: "o", default: "markdown", enum: ["markdown", "json"] }).option("out", String, { flag: "w", desc: "write workflow plan JSON to this path", nullable: true }).option("dryRun", Boolean, { flag: "r", desc: "show predicted apply report without writing files", default: false }).option("app", String, { desc: "target app or library name", nullable: true }).option("module", String, { desc: "target module name", nullable: true }).option("field", String, { desc: "field name", nullable: true }).option("type", String, { desc: "field type or scalar name", nullable: true }).option("values", String, { flag: "l", desc: "comma-separated values", nullable: true }).option("default", String, { desc: "default value", nullable: true }).option("scalar", String, { flag: "c", desc: "scalar name", nullable: true }).option("surface", String, { flag: "u", desc: "UI surface name", nullable: true }).option("
|
|
73
|
-
|
|
74
|
+
}).arg("workflow", String, { desc: "workflow name, plan path, or run id", nullable: true }).with(Workspace).option("format", String, { desc: "output format", flag: "o", default: "markdown", enum: ["markdown", "json"] }).option("out", String, { flag: "w", desc: "write workflow plan JSON to this path", nullable: true }).option("dryRun", Boolean, { flag: "r", desc: "show predicted apply report without writing files", default: false }).option("app", String, { desc: "target app or library name", nullable: true }).option("module", String, { desc: "target module name", nullable: true }).option("field", String, { desc: "field name", nullable: true }).option("type", String, { desc: "field type or scalar name", nullable: true }).option("values", String, { flag: "l", desc: "comma-separated values", nullable: true }).option("default", String, { desc: "default value", nullable: true }).option("scalar", String, { flag: "c", desc: "scalar name", nullable: true }).option("surface", String, { flag: "u", desc: "UI surface name", nullable: true }).option("surfaces", String, {
|
|
75
|
+
flag: "s",
|
|
76
|
+
desc: "comma-separated UI surfaces add-field updates (template, unit, view)",
|
|
77
|
+
nullable: true
|
|
78
|
+
}).option("includeInLight", Boolean, {
|
|
79
|
+
flag: "p",
|
|
80
|
+
desc: "add the field to the Light<Model> projection used by lists and cards",
|
|
81
|
+
nullable: true
|
|
82
|
+
}).option("mutation", String, { flag: "n", desc: "mutation name", nullable: true }).option("slice", String, { flag: "i", desc: "slice name", nullable: true }).option("guard", String, { flag: "g", desc: "comma-separated guard class names", nullable: true }).option("with", String, {
|
|
83
|
+
flag: "b",
|
|
84
|
+
desc: "comma-separated <serviceRef>.<method> writes committed with the mutation",
|
|
85
|
+
nullable: true
|
|
86
|
+
}).option("after", String, {
|
|
87
|
+
flag: "e",
|
|
88
|
+
desc: "comma-separated <serviceRef>.<method> side effects run after the commit",
|
|
89
|
+
nullable: true
|
|
90
|
+
}).option("interaction", String, { flag: "k", desc: "interaction name", nullable: true }).exec(async function(action, workflow, workspace, format, out, dryRun, app, module, field, typeName, values, defaultValue, scalar, surface, surfaces, includeInLight, mutation, slice, guard, withCalls, after, interaction) {
|
|
91
|
+
await this.workflowScript.workflow(action, workflow, {
|
|
92
|
+
app,
|
|
93
|
+
module,
|
|
94
|
+
field,
|
|
95
|
+
type: typeName,
|
|
96
|
+
values,
|
|
97
|
+
default: defaultValue,
|
|
98
|
+
scalar,
|
|
99
|
+
surface,
|
|
100
|
+
surfaces,
|
|
101
|
+
includeInLight: includeInLight === null ? null : String(includeInLight),
|
|
102
|
+
mutation,
|
|
103
|
+
slice,
|
|
104
|
+
guard,
|
|
105
|
+
with: withCalls,
|
|
106
|
+
after,
|
|
107
|
+
interaction
|
|
108
|
+
}, { format, out, dryRun, workspace });
|
|
74
109
|
})
|
|
75
110
|
})) {
|
|
76
111
|
}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
Exec,
|
|
4
|
+
Workspace,
|
|
5
|
+
script,
|
|
6
|
+
command
|
|
7
|
+
} from "./index-9zy8479y.js";
|
|
8
|
+
import"./index-bns3wcpc.js";
|
|
9
|
+
import {
|
|
10
|
+
AppExecutor,
|
|
11
|
+
LibExecutor,
|
|
12
|
+
PkgExecutor
|
|
13
|
+
} from "./index-g500c5j9.js";
|
|
14
|
+
import {
|
|
15
|
+
npmRegistryFromEnv,
|
|
16
|
+
warnIgnoredNpmRegistry
|
|
17
|
+
} from "./index-4am4dvmf.js";
|
|
18
|
+
import"./index-62md4dwy.js";
|
|
19
|
+
import {
|
|
20
|
+
defaultMaxDiagnostics,
|
|
21
|
+
WorkspaceRunner
|
|
22
|
+
} from "./index-cjmjvg4r.js";
|
|
23
|
+
import"./index-2nxk8wgs.js";
|
|
24
|
+
import"./index-hj6w4ka1.js";
|
|
25
|
+
import"./index-fbewhg4g.js";
|
|
26
|
+
import"./index-35j83zkd.js";
|
|
27
|
+
import"./index-j6eeh5d7.js";
|
|
28
|
+
import"./index-hm0tn7qv.js";
|
|
29
|
+
import"./index-j7hwy56s.js";
|
|
30
|
+
import"./index-2mwjshz5.js";
|
|
31
|
+
import"./index-p6x5b7hr.js";
|
|
32
|
+
import"./index-sp0qsr7a.js";
|
|
33
|
+
import"./index-0j1t1h2b.js";
|
|
34
|
+
import"./index-m9jj544v.js";
|
|
35
|
+
import"./index-zbrwnmf1.js";
|
|
36
|
+
import"./index-sveq36gh.js";
|
|
37
|
+
import {
|
|
38
|
+
AgentScript
|
|
39
|
+
} from "./index-fhw7yq2d.js";
|
|
40
|
+
import {
|
|
41
|
+
LibraryScript
|
|
42
|
+
} from "./index-y4kcmbt2.js";
|
|
43
|
+
import {
|
|
44
|
+
ApplicationScript
|
|
45
|
+
} from "./index-ewbmfarf.js";
|
|
46
|
+
import"./index-tenw3mah.js";
|
|
47
|
+
import"./index-gr9thy79.js";
|
|
48
|
+
import"./index-qd7xn2bk.js";
|
|
49
|
+
import {
|
|
50
|
+
PackageScript
|
|
51
|
+
} from "./index-84h43kg6.js";
|
|
52
|
+
import"./index-1h2jc0x3.js";
|
|
53
|
+
import {
|
|
54
|
+
CloudScript2
|
|
55
|
+
} from "./index-00a7j05x.js";
|
|
56
|
+
import"./index-qw6814m4.js";
|
|
57
|
+
import"./index-2phm56a1.js";
|
|
58
|
+
import"./index-khk05tsf.js";
|
|
59
|
+
import"./index-t1t9wq9a.js";
|
|
60
|
+
import"./index-g841cap9.js";
|
|
61
|
+
import"./index-jc2zbwra.js";
|
|
62
|
+
import"./index-raz588b3.js";
|
|
63
|
+
import {
|
|
64
|
+
ContextScript
|
|
65
|
+
} from "./index-tgqameyb.js";
|
|
66
|
+
import"./index-7apsdr5g.js";
|
|
67
|
+
import"./index-defp4gmb.js";
|
|
68
|
+
import"./index-9bv479q5.js";
|
|
69
|
+
|
|
70
|
+
// pkgs/@akanjs/cli/workspace/workspace.command.ts
|
|
71
|
+
import path from "path";
|
|
72
|
+
|
|
73
|
+
// pkgs/@akanjs/cli/workspace/workspace.script.ts
|
|
74
|
+
import { Logger } from "akanjs/common";
|
|
75
|
+
class WorkspaceScript extends script("workspace", [
|
|
76
|
+
WorkspaceRunner,
|
|
77
|
+
ApplicationScript,
|
|
78
|
+
LibraryScript,
|
|
79
|
+
PackageScript,
|
|
80
|
+
CloudScript2,
|
|
81
|
+
ContextScript,
|
|
82
|
+
AgentScript
|
|
83
|
+
]) {
|
|
84
|
+
async createWorkspace(repoName, appName, {
|
|
85
|
+
dirname = ".",
|
|
86
|
+
inPlace = false,
|
|
87
|
+
installLibs = false,
|
|
88
|
+
init = true,
|
|
89
|
+
sample = true,
|
|
90
|
+
registryUrl,
|
|
91
|
+
owner,
|
|
92
|
+
mcpInstall = true,
|
|
93
|
+
agentInstall = true
|
|
94
|
+
}) {
|
|
95
|
+
const akanVersion = await this.packageScript.version(null, { log: false });
|
|
96
|
+
const libs = installLibs ? ["util", "shared"] : [];
|
|
97
|
+
const workspace = await this.workspaceRunner.createWorkspace(repoName, appName, {
|
|
98
|
+
dirname,
|
|
99
|
+
inPlace,
|
|
100
|
+
init,
|
|
101
|
+
akanVersion,
|
|
102
|
+
libs,
|
|
103
|
+
...registryUrl ? { registryUrl } : {},
|
|
104
|
+
...owner ? { owner } : {}
|
|
105
|
+
});
|
|
106
|
+
if (installLibs) {
|
|
107
|
+
await this.libraryScript.installLibrary(workspace, "util");
|
|
108
|
+
await this.libraryScript.installLibrary(workspace, "shared");
|
|
109
|
+
}
|
|
110
|
+
await this.applicationScript.createApplication(appName, workspace, { libs, sample });
|
|
111
|
+
if (sample)
|
|
112
|
+
await workspace.applyTemplate({
|
|
113
|
+
basePath: `apps/${appName}`,
|
|
114
|
+
template: "appSample",
|
|
115
|
+
dict: { appName },
|
|
116
|
+
options: { libs }
|
|
117
|
+
});
|
|
118
|
+
if (agentInstall)
|
|
119
|
+
await this.agentScript.agent(workspace, "install", "all", { force: true });
|
|
120
|
+
if (mcpInstall)
|
|
121
|
+
await this.contextScript.mcpInstall(workspace, "all", { force: true });
|
|
122
|
+
const gitSpinner = workspace.spinning("Initializing git repository and commit...");
|
|
123
|
+
try {
|
|
124
|
+
const commit = await this.workspaceRunner.commitWorkspace(workspace);
|
|
125
|
+
if (!commit.committed)
|
|
126
|
+
gitSpinner.succeed(`Left the new files uncommitted in the git repository at ${commit.repository}`);
|
|
127
|
+
else if (commit.identity)
|
|
128
|
+
gitSpinner.succeed(`Git repository initialized and committed as ${commit.identity.name} <${commit.identity.email}>, since git ` + "has no identity here. Once user.name and user.email are set, `git commit --amend --reset-author` makes it yours");
|
|
129
|
+
else
|
|
130
|
+
gitSpinner.succeed("Git repository initialized and committed");
|
|
131
|
+
} catch (_) {
|
|
132
|
+
gitSpinner.fail("Git repository initialization failed. It's not fatal, you can commit manually");
|
|
133
|
+
}
|
|
134
|
+
Logger.rawLog(`
|
|
135
|
+
\uD83C\uDF89 Welcome aboard! Workspace created in ${workspace.workspaceRoot}`);
|
|
136
|
+
Logger.rawLog(`\uD83D\uDE80 Run \`cd ${workspace.workspaceRoot} && akan start ${appName}\` to start the development server.`);
|
|
137
|
+
Logger.rawLog(`
|
|
138
|
+
\uD83D\uDC4B Happy coding!`);
|
|
139
|
+
}
|
|
140
|
+
async generateAgentRules(workspace, { overwrite = false, cursorRules = true } = {}) {
|
|
141
|
+
const spinner = workspace.spinning("Generating agent rules...");
|
|
142
|
+
const files = await this.workspaceRunner.generateAgentRules(workspace, { overwrite, cursorRules });
|
|
143
|
+
if (files.some((file) => file.filePath.endsWith("AGENTS.md")))
|
|
144
|
+
await this.agentScript.agent(workspace, "install", "agents-md", { force: overwrite });
|
|
145
|
+
spinner.succeed(`Agent rules ready (${files.length} file${files.length === 1 ? "" : "s"})`);
|
|
146
|
+
}
|
|
147
|
+
async machineKeygen(workspace, out) {
|
|
148
|
+
const { file, publicKey } = await this.workspaceRunner.machineKeygen(workspace, out);
|
|
149
|
+
const access = process.platform === "win32" ? "; Windows gives it the permissions of its folder, so keep it in one only you can read" : " (mode 600)";
|
|
150
|
+
Logger.rawLog(`Wrote the private key to ${file}${access}. Set it as AKAN_MACHINE_PRIVATE_KEY on the server that issues machine tokens; nothing else needs it.`);
|
|
151
|
+
Logger.rawLog(`A server that only verifies them takes the public key:
|
|
152
|
+
AKAN_MACHINE_PUBLIC_KEY=${publicKey}`);
|
|
153
|
+
}
|
|
154
|
+
async lint(exec, workspace, { fix = true, maxDiagnostics } = {}) {
|
|
155
|
+
if (exec instanceof AppExecutor)
|
|
156
|
+
await this.applicationScript.sync(exec);
|
|
157
|
+
else if (exec instanceof LibExecutor)
|
|
158
|
+
await this.libraryScript.syncLibrary(exec);
|
|
159
|
+
const spinner = workspace.spinning(`Linting${fix ? " with fix" : ""}...`);
|
|
160
|
+
try {
|
|
161
|
+
await this.workspaceRunner.lint(exec, workspace, { fix, maxDiagnostics });
|
|
162
|
+
spinner.succeed("Lint completed with no errors");
|
|
163
|
+
} catch (error) {
|
|
164
|
+
spinner.fail("Lint failed with errors");
|
|
165
|
+
throw error;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
async lintAll(workspace, { fix = true, maxDiagnostics } = {}) {
|
|
169
|
+
const [appNames, libNames, pkgNames] = await workspace.getExecs();
|
|
170
|
+
const options = { fix, maxDiagnostics };
|
|
171
|
+
await Promise.all(appNames.map((appName) => this.applicationScript.sync(AppExecutor.from(workspace, appName))));
|
|
172
|
+
await Promise.all(libNames.map((libName) => this.libraryScript.syncLibrary(LibExecutor.from(workspace, libName))));
|
|
173
|
+
await Promise.all([
|
|
174
|
+
...appNames.map((appName) => this.workspaceRunner.lint(AppExecutor.from(workspace, appName), workspace, options)),
|
|
175
|
+
...libNames.map((libName) => this.workspaceRunner.lint(LibExecutor.from(workspace, libName), workspace, options)),
|
|
176
|
+
...pkgNames.filter((pkgName) => pkgName !== "contract").map((pkgName) => this.workspaceRunner.lint(PkgExecutor.from(workspace, pkgName), workspace, options))
|
|
177
|
+
]);
|
|
178
|
+
}
|
|
179
|
+
async syncAll(workspace) {
|
|
180
|
+
const [appNames, libNames] = await workspace.getExecs();
|
|
181
|
+
for (const libName of libNames)
|
|
182
|
+
await this.libraryScript.syncLibrary(LibExecutor.from(workspace, libName));
|
|
183
|
+
for (const appName of appNames)
|
|
184
|
+
await this.applicationScript.sync(AppExecutor.from(workspace, appName));
|
|
185
|
+
}
|
|
186
|
+
async init(devProjectId, workspace, { host } = {}) {
|
|
187
|
+
const [bunfigExists, packageJsonExists, tsconfigExists] = await Promise.all([
|
|
188
|
+
workspace.exists("bunfig.toml"),
|
|
189
|
+
workspace.exists("package.json"),
|
|
190
|
+
workspace.exists("tsconfig.json")
|
|
191
|
+
]);
|
|
192
|
+
const isRoot = bunfigExists && packageJsonExists && tsconfigExists;
|
|
193
|
+
if (!isRoot)
|
|
194
|
+
throw new Error("Current directory is not a root workspace");
|
|
195
|
+
const spinner = workspace.spinning("Initializing workspace...");
|
|
196
|
+
try {
|
|
197
|
+
await this.workspaceRunner.writeTopLevelEnv(workspace, devProjectId);
|
|
198
|
+
await this.cloudScript.downloadEnv(workspace, devProjectId, { host });
|
|
199
|
+
spinner.succeed("Workspace initialized");
|
|
200
|
+
} catch (error) {
|
|
201
|
+
spinner.fail("Workspace initialization failed");
|
|
202
|
+
throw error;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// pkgs/@akanjs/cli/workspace/workspace.command.ts
|
|
208
|
+
var maxDiagnosticsOption = {
|
|
209
|
+
desc: "How many diagnostics Biome prints before truncating (0 for no limit)",
|
|
210
|
+
default: defaultMaxDiagnostics
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
class WorkspaceCommand extends command("workspace", [WorkspaceScript], ({ public: target }) => ({
|
|
214
|
+
createWorkspace: target({ desc: "Create a new Akan.js workspace", runsOnWorkspaceRoot: false }).arg("workspaceName", String, {
|
|
215
|
+
desc: 'what is the name of your organization? ("." creates the workspace in --dir itself, named after it)'
|
|
216
|
+
}).option("app", String, { desc: "what is the codename of your first application? (e.g. myapp)" }).option("dir", String, {
|
|
217
|
+
desc: 'directory the workspace is created in, as <dir>/<name>, or as <dir> itself when the name is "."',
|
|
218
|
+
default: process.env.USE_AKANJS_PKGS === "true" ? "local" : "."
|
|
219
|
+
}).option("libs", Boolean, {
|
|
220
|
+
desc: "Do you want to install shared and util libraries? (admin, user file, etc.)",
|
|
221
|
+
enum: [
|
|
222
|
+
{ label: "No, I want to start with empty workspace (Recommended)", value: false },
|
|
223
|
+
{
|
|
224
|
+
label: "Yes, I want to accelerate development by installing shared and util libraries (for akanjs experts)",
|
|
225
|
+
value: true
|
|
226
|
+
}
|
|
227
|
+
],
|
|
228
|
+
default: false
|
|
229
|
+
}).option("init", Boolean, { desc: "Do you want to initialize the workspace? (Recommended)", default: true }).option("registry", String, {
|
|
230
|
+
desc: "npm registry URL for installing Akan packages",
|
|
231
|
+
default: npmRegistryFromEnv() ?? "https://registry.npmjs.org"
|
|
232
|
+
}).option("owner", String, { desc: "owner of the workspace", default: process.env.GITHUB_OWNER, nullable: true }).option("mcpInstall", Boolean, {
|
|
233
|
+
desc: "Install the Akan MCP server config for Cursor, Claude Code, and Codex? (Recommended)",
|
|
234
|
+
default: true
|
|
235
|
+
}).option("agentInstall", Boolean, {
|
|
236
|
+
flag: "A",
|
|
237
|
+
desc: "Install Akan agent rules (AGENTS.md, CLAUDE.md, Cursor)? (Recommended)",
|
|
238
|
+
default: true
|
|
239
|
+
}).option("sample", Boolean, {
|
|
240
|
+
desc: "Generate the sample task module, pages and helpers in the first app?",
|
|
241
|
+
default: true
|
|
242
|
+
}).exec(async function(workspaceName, app, dir, libs, init, registry, owner, mcpInstall, agentInstall, sample) {
|
|
243
|
+
warnIgnoredNpmRegistry();
|
|
244
|
+
const appName = app || "app";
|
|
245
|
+
const inPlace = workspaceName === ".";
|
|
246
|
+
const repoName = inPlace ? path.basename(path.resolve(dir)) : workspaceName;
|
|
247
|
+
await this.workspaceScript.createWorkspace(repoName.toLowerCase().replace(/ /g, "-"), appName.toLowerCase().replace(/ /g, "-"), {
|
|
248
|
+
dirname: dir,
|
|
249
|
+
inPlace,
|
|
250
|
+
installLibs: libs,
|
|
251
|
+
init,
|
|
252
|
+
sample,
|
|
253
|
+
owner,
|
|
254
|
+
mcpInstall,
|
|
255
|
+
agentInstall,
|
|
256
|
+
...registry ? { registryUrl: registry } : {}
|
|
257
|
+
});
|
|
258
|
+
}),
|
|
259
|
+
generateAgentRules: target({
|
|
260
|
+
desc: "Generate AGENTS.md, CLAUDE.md, and optional Cursor rules for Akan coding agents"
|
|
261
|
+
}).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) {
|
|
262
|
+
await this.workspaceScript.generateAgentRules(workspace, { overwrite, cursorRules });
|
|
263
|
+
}),
|
|
264
|
+
lint: target({ desc: "Lint and fix code in a specific app/lib/pkg" }).with(Exec).option("fix", Boolean, { default: true }).option("maxDiagnostics", Number, maxDiagnosticsOption).with(Workspace).exec(async function(exec, fix, maxDiagnostics, workspace) {
|
|
265
|
+
await this.workspaceScript.lint(exec, workspace, { fix, maxDiagnostics });
|
|
266
|
+
}),
|
|
267
|
+
lintAll: target({ desc: "Lint and fix code in all apps and libraries" }).option("fix", Boolean, { default: true }).option("maxDiagnostics", Number, maxDiagnosticsOption).with(Workspace).exec(async function(fix, maxDiagnostics, workspace) {
|
|
268
|
+
await this.workspaceScript.lintAll(workspace, { fix, maxDiagnostics });
|
|
269
|
+
}),
|
|
270
|
+
machineKeygen: target({
|
|
271
|
+
desc: "Make an Ed25519 key for machine tokens: write the private key to a file, print the public key"
|
|
272
|
+
}).arg("out", String, {
|
|
273
|
+
desc: "file the private key is written to (mode 600; on Windows, its folder's permissions); an existing one is refused"
|
|
274
|
+
}).with(Workspace).exec(async function(out, workspace) {
|
|
275
|
+
await this.workspaceScript.machineKeygen(workspace, out);
|
|
276
|
+
}),
|
|
277
|
+
syncAll: target({ desc: "Sync dependencies and configuration for all apps and libraries" }).with(Workspace).exec(async function(workspace) {
|
|
278
|
+
await this.workspaceScript.syncAll(workspace);
|
|
279
|
+
}),
|
|
280
|
+
init: target({ desc: "Initialize the workspace", runsOnWorkspaceRoot: false }).arg("devProjectId", String, { desc: "the ID of the workspace" }).option("host", String, {
|
|
281
|
+
desc: "host of the cloud to target (default: cloud.host of the root akan.config.ts, else Akan Cloud)",
|
|
282
|
+
nullable: true
|
|
283
|
+
}).with(Workspace).exec(async function(devProjectId, host, workspace) {
|
|
284
|
+
await this.workspaceScript.init(devProjectId, workspace, { host });
|
|
285
|
+
})
|
|
286
|
+
})) {
|
|
287
|
+
}
|
|
288
|
+
export {
|
|
289
|
+
WorkspaceCommand
|
|
290
|
+
};
|