@akanjs/cli 3.0.0-alpha.9 → 3.0.0-alpha.90
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/README.ko.md +1 -1
- package/README.md +1 -1
- package/{abstractCompactor-e5yq60qz.js → abstractCompactor-cefxzggj.js} +3 -5
- package/{agent.command-f0gqkfgz.js → agent.command-r93wmq7m.js} +11 -13
- package/{application.command-x903m2qq.js → application.command-5nqfqgdn.js} +62 -38
- package/{applicationBuildRunner-ha3y8ew8.js → applicationBuildRunner-b21m07fs.js} +23 -20
- package/{applicationReleasePackager-gg8ccbeh.js → applicationReleasePackager-3wh58n2m.js} +8 -9
- package/buildBatch.proc.js +12 -14
- package/capacitorApp-gzcx6txb.js +12 -0
- package/{cloud.command-zs6kyf83.js → cloud.command-g0pk0k60.js} +15 -18
- package/commandManifest.json +1 -1
- package/{context.command-fmepgjzg.js → context.command-qd8kqrnh.js} +19 -23
- package/dependencyScanner-shs82ynp.js +8 -0
- package/devTui-2xf0meaq.js +552 -0
- package/devTuiView-7jy8f30g.js +9 -0
- package/getDirname-dr3jz1xg.js +7 -0
- package/{guideline.command-n6sw0a0c.js → guideline.command-f38x8jhw.js} +16 -18
- package/guidelines/agentRule/agentRule.generate.json +31 -0
- package/guidelines/agentRule/agentRule.instruction.md +533 -0
- package/guidelines/conventions/conventions.instruction.md +406 -197
- package/guidelines/cssRule/cssRule.instruction.md +7 -0
- package/guidelines/framework/framework.generate.json +3 -2
- package/guidelines/framework/framework.instruction.md +1 -9
- package/guidelines/mcpRule/mcpRule.generate.json +25 -0
- package/guidelines/mcpRule/mcpRule.instruction.md +217 -0
- package/guidelines/modelStore/modelStore.instruction.md +12 -0
- package/guidelines/modelTemplate/modelTemplate.instruction.md +5 -0
- package/guidelines/queryRule/queryRule.generate.json +31 -0
- package/guidelines/queryRule/queryRule.instruction.md +143 -0
- package/guidelines/runtimeRule/runtimeRule.generate.json +25 -0
- package/guidelines/runtimeRule/runtimeRule.instruction.md +213 -0
- package/guidelines/ssrRule/ssrRule.instruction.md +49 -5
- package/guidelines/transportRule/transportRule.generate.json +31 -0
- package/guidelines/transportRule/transportRule.instruction.md +60 -0
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +51 -760
- package/guidelines/workspaceRecipes/workspaceRecipes.generate.json +33 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +402 -0
- package/incrementalBuilder.proc.js +26 -25
- package/{index-774gcx29.js → index-0emb9eat.js} +41 -34
- package/index-3d9y066c.js +76 -0
- package/{index-3vta1tqa.js → index-3vvbv974.js} +32 -32
- package/{index-76rn3g2c.js → index-47pj3aee.js} +4 -4
- package/{index-y4vkyhvv.js → index-5xdqxbn9.js} +14 -14
- package/{index-1577bej2.js → index-6wwzs1bc.js} +2 -2
- package/{index-wnp7hwq7.js → index-92zztqy1.js} +7 -7
- package/{index-jhpa13zj.js → index-9bwhxrqf.js} +57 -57
- package/{index-bjpxzr6s.js → index-9wtbw98m.js} +6 -3
- package/{index-fgc8r6dj.js → index-a5vmm6x4.js} +3 -1
- package/{index-xys926f2.js → index-by5gpp8x.js} +4 -4
- package/{index-kdh76j26.js → index-cezy7yb3.js} +100 -32
- package/{index-62955kn5.js → index-d61rcfa2.js} +758 -127
- package/{index-82jrh4hj.js → index-deekbtkj.js} +13 -13
- package/{index-rxkpk7n4.js → index-e82dyeqy.js} +4 -4
- package/{index-qzdjd4ct.js → index-h759vjfa.js} +18 -18
- package/{index-j37qq1f2.js → index-h7yw2z9n.js} +7 -7
- package/{index-qb61h0k7.js → index-jydtyzva.js} +1098 -1360
- package/{index-46tjzh6s.js → index-kcxmv48c.js} +29 -29
- package/{index-4m0bphac.js → index-kfnr6c19.js} +31 -30
- package/{index-xmmzf150.js → index-mpmyqm1y.js} +1 -1
- package/{index-xjd3rqzj.js → index-n68jx79w.js} +6 -15
- package/{index-0cj2zxbm.js → index-n85fer99.js} +12 -11
- package/{index-779ske1y.js → index-pgsswppj.js} +27 -27
- package/index-pvb4vdwr.js +159 -0
- package/{index-67546d0j.js → index-q0y2jq9j.js} +14 -2
- package/{index-z8ptfkzv.js → index-q8sn827n.js} +969 -240
- package/{index-5sn5w2mt.js → index-r50qen0z.js} +94 -61
- package/{index-eyyf2149.js → index-rntcdss1.js} +36 -37
- package/{index-gcv8ncfh.js → index-sjak5v5b.js} +16 -12
- package/{index-j9cxndc0.js → index-w8kmx1b6.js} +20 -11
- package/{index-jf2ya7r2.js → index-y74k5anj.js} +8 -8
- package/{index-d43t8af2.js → index-zkvpaggp.js} +58 -25
- package/index.js +22 -25
- package/{library.command-cv9gdbmg.js → library.command-em103wtn.js} +11 -10
- package/{localRegistry.command-d8fg36zc.js → localRegistry.command-gz8apn4y.js} +20 -23
- package/{module.command-qyr1s9cn.js → module.command-451pztkc.js} +13 -16
- package/{package.command-wsjx0k47.js → package.command-rfhyf38t.js} +8 -10
- package/package.json +5 -7
- package/{page.command-rdzg65rm.js → page.command-kt19da5g.js} +7 -9
- package/{primitive.command-89g38b53.js → primitive.command-pgy69ere.js} +13 -16
- package/{quality.command-0cs2z92d.js → quality.command-gpe2vqb5.js} +226 -105
- package/recipeScanner-fpagtgc1.js +11 -0
- package/{repair.command-6fphxfwj.js → repair.command-2sbrz187.js} +12 -14
- package/{routeSourceValidator-e4jmbfcx.js → routeSourceValidator-ze6x894c.js} +0 -2
- package/{scalar.command-xfer69s6.js → scalar.command-jcf4e5sv.js} +11 -14
- package/subspace.command-kqzqtk0p.js +755 -0
- package/templates/app/env/env.client.debug.ts.template +1 -5
- package/templates/app/env/env.client.develop.ts.template +1 -5
- package/templates/app/env/env.client.local.ts.template +1 -5
- package/templates/app/env/env.client.main.ts.template +1 -5
- package/templates/app/env/env.client.testing.ts.template +1 -5
- package/templates/app/env/env.client.type.ts +2 -6
- package/templates/app/env/env.server.debug.ts.template +1 -5
- package/templates/app/env/env.server.develop.ts.template +1 -5
- package/templates/app/env/env.server.local.ts.template +1 -5
- package/templates/app/env/env.server.main.ts.template +1 -5
- package/templates/app/main.ts +3 -1
- package/templates/appSample/lib/task/task.signal.ts +11 -6
- package/templates/appSample/srvkit/AuthGuard.ts +9 -5
- package/templates/appSample/srvkit/SessionInternalArg.ts +4 -3
- package/templates/crudPages/[__model__Id]/edit/page.tsx +5 -5
- package/templates/crudPages/[__model__Id]/page.tsx +10 -13
- package/templates/crudPages/new/page.tsx +5 -5
- package/templates/crudPages/page.tsx +9 -9
- package/templates/crudSinglePage/page.tsx +11 -7
- package/templates/env/_env.server.type.ts +7 -5
- package/templates/lib/db.ts +1 -1
- package/templates/lib/dict.ts +1 -1
- package/templates/lib/sig.ts +1 -1
- package/templates/lib/srv.ts +6 -2
- package/templates/module/__model__.dictionary.ts +4 -1
- package/templates/module/__model__.signal.ts +2 -3
- package/templates/module/__model__.store.ts +1 -2
- package/templates/workspaceRoot/.gitignore.template +0 -1
- package/templates/workspaceRoot/.husky/pre-commit.template +16 -0
- package/templates/workspaceRoot/.vscode/settings.json.template +1 -1
- package/templates/workspaceRoot/AGENTS.md.template +4 -0
- package/templates/workspaceRoot/CLAUDE.md.template +19 -0
- package/templates/workspaceRoot/biome.json.template +2 -1
- package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +10 -14
- package/templates/workspaceRoot/docs/GENERATED.md.template +12 -10
- package/templates/workspaceRoot/package.json.template +2 -4
- package/typeChecker-3xgrzc2v.js +7 -0
- package/typecheck.proc.js +4 -5
- package/{workflow.command-2ygfqt4f.js → workflow.command-m4z25a2p.js} +22 -25
- package/{workspace.command-88m0zs64.js → workspace.command-dqgj9zbk.js} +96 -81
- package/capacitorApp-9xswcgx7.js +0 -61
- package/dependencyScanner-f6grrep3.js +0 -9
- package/getDirname-m9s0cmhq.js +0 -8
- package/index-mxvakhsm.js +0 -66
- package/index-r24hmh0q.js +0 -4
- package/recipeScanner-tghkzrrt.js +0 -12
- package/typeChecker-kravn7ns.js +0 -8
- /package/{index-0wae5ebk.js → index-meh558jy.js} +0 -0
- /package/{index-ss469dec.js → index-nz8prx9g.js} +0 -0
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./index-
|
|
5
|
-
import {
|
|
6
|
-
WorkflowRunner
|
|
7
|
-
} from "./index-qzdjd4ct.js";
|
|
8
|
-
import {
|
|
9
|
-
ScalarScript
|
|
10
|
-
} from "./index-y4vkyhvv.js";
|
|
11
|
-
import {
|
|
12
|
-
PrimitiveScript
|
|
13
|
-
} from "./index-3vta1tqa.js";
|
|
14
|
-
import {
|
|
15
|
-
ModuleScript
|
|
16
|
-
} from "./index-jhpa13zj.js";
|
|
3
|
+
AppExecutor
|
|
4
|
+
} from "./index-q8sn827n.js";
|
|
17
5
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
jsonText,
|
|
7
|
+
createWorkflowBaselineSummary,
|
|
8
|
+
buildAkanModuleContextIndex,
|
|
9
|
+
createWorkflowStepRegistry,
|
|
10
|
+
toolingRolloutGate
|
|
11
|
+
} from "./index-e82dyeqy.js";
|
|
20
12
|
import {
|
|
21
|
-
|
|
22
|
-
akanMcpInstallConfigPaths,
|
|
23
|
-
akanMcpInstallTargets,
|
|
13
|
+
buildResourceList,
|
|
24
14
|
codexMcpConfigPath,
|
|
25
|
-
|
|
15
|
+
akanMcpInstallTargets,
|
|
16
|
+
akanMcpInstallConfigPaths,
|
|
26
17
|
createAkanMcpServer,
|
|
18
|
+
createAkanCodexMcpServerBlock,
|
|
19
|
+
upsertCodexMcpServerBlock,
|
|
27
20
|
renderDoctorText,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} from "./index-774gcx29.js";
|
|
21
|
+
AkanContextAnalyzer
|
|
22
|
+
} from "./index-0emb9eat.js";
|
|
31
23
|
import {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
CommandContainer,
|
|
25
|
+
runner,
|
|
26
|
+
script
|
|
27
|
+
} from "./index-cezy7yb3.js";
|
|
28
|
+
import {
|
|
29
|
+
isPlaceholderAppId2
|
|
30
|
+
} from "./index-pgsswppj.js";
|
|
38
31
|
import {
|
|
39
32
|
Prompter
|
|
40
|
-
} from "./index-
|
|
33
|
+
} from "./index-h7yw2z9n.js";
|
|
41
34
|
import {
|
|
42
|
-
|
|
43
|
-
} from "./index-
|
|
35
|
+
RepairRunner
|
|
36
|
+
} from "./index-y74k5anj.js";
|
|
44
37
|
import {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
script
|
|
48
|
-
} from "./index-kdh76j26.js";
|
|
38
|
+
WorkflowRunner
|
|
39
|
+
} from "./index-h759vjfa.js";
|
|
49
40
|
import {
|
|
50
|
-
|
|
51
|
-
} from "./index-
|
|
41
|
+
ModuleScript
|
|
42
|
+
} from "./index-9bwhxrqf.js";
|
|
43
|
+
import {
|
|
44
|
+
PrimitiveScript
|
|
45
|
+
} from "./index-3vvbv974.js";
|
|
46
|
+
import {
|
|
47
|
+
ScalarScript
|
|
48
|
+
} from "./index-5xdqxbn9.js";
|
|
49
|
+
import {
|
|
50
|
+
getMobileTargets
|
|
51
|
+
} from "./index-47pj3aee.js";
|
|
52
52
|
|
|
53
53
|
// pkgs/@akanjs/cli/context/context.script.ts
|
|
54
54
|
import { Logger } from "akanjs/common";
|
|
@@ -380,12 +380,15 @@ var applyMcpTools = [
|
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
];
|
|
383
|
-
var listAkanMcpTools = (mode = "readonly") => {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
383
|
+
var listAkanMcpTools = (mode = "readonly", { guidelineNames = [] } = {}) => {
|
|
384
|
+
const tools = mode === "readonly" ? readonlyMcpTools : mode === "plan" ? [...readonlyMcpTools, ...planMcpTools] : [...readonlyMcpTools, ...planMcpTools, ...applyMcpTools];
|
|
385
|
+
if (guidelineNames.length === 0)
|
|
386
|
+
return tools;
|
|
387
|
+
return tools.map((tool) => tool.name === "get_guideline" ? {
|
|
388
|
+
...tool,
|
|
389
|
+
description: `${tool.description ?? ""} One of: ${guidelineNames.join(", ")}.`.trim(),
|
|
390
|
+
inputSchema: { ...tool.inputSchema, properties: { name: { type: "string", enum: [...guidelineNames] } } }
|
|
391
|
+
} : tool);
|
|
389
392
|
};
|
|
390
393
|
var createAkanValidationContract = (listTools = listAkanMcpTools) => ({
|
|
391
394
|
schemaVersion: 1,
|
|
@@ -604,6 +607,10 @@ var createCliWorkflowStepRegistry = (workspace) => createWorkflowStepRegistry({
|
|
|
604
607
|
});
|
|
605
608
|
|
|
606
609
|
// pkgs/@akanjs/cli/context/context.runner.ts
|
|
610
|
+
var toolErrorText = (error) => {
|
|
611
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
612
|
+
return message.replace(/\/(?:[^\s"'/]+\/)*(?=(?:pkgs|apps|libs|infra)\/)/g, "<workspace>/");
|
|
613
|
+
};
|
|
607
614
|
var workflowDiagnosticFromContext = (diagnostic) => ({
|
|
608
615
|
severity: diagnostic.severity,
|
|
609
616
|
code: diagnostic.code,
|
|
@@ -662,7 +669,7 @@ class ContextRunner extends runner("context") {
|
|
|
662
669
|
if (!config.hasMobileConfig)
|
|
663
670
|
continue;
|
|
664
671
|
for (const { name, config: target } of await getMobileTargets(app)) {
|
|
665
|
-
if (!
|
|
672
|
+
if (!isPlaceholderAppId2(target.appId))
|
|
666
673
|
continue;
|
|
667
674
|
diagnostics.push({
|
|
668
675
|
severity: "warning",
|
|
@@ -720,8 +727,8 @@ class ContextRunner extends runner("context") {
|
|
|
720
727
|
await workspace.writeFile(codexMcpConfigPath, merged);
|
|
721
728
|
return codexMcpConfigPath;
|
|
722
729
|
}
|
|
723
|
-
listMcpTools(mode = "readonly") {
|
|
724
|
-
return listAkanMcpTools(mode);
|
|
730
|
+
listMcpTools(mode = "readonly", { guidelineNames = [] } = {}) {
|
|
731
|
+
return listAkanMcpTools(mode, { guidelineNames });
|
|
725
732
|
}
|
|
726
733
|
async callMcpTool(workspace, name, args = {}, { mode = "readonly" } = {}) {
|
|
727
734
|
const availableTools = this.listMcpTools(mode);
|
|
@@ -776,7 +783,7 @@ class ContextRunner extends runner("context") {
|
|
|
776
783
|
if (name === "explain_command")
|
|
777
784
|
return this.explainCommand(stringArg(args, "command"));
|
|
778
785
|
if (name === "get_validation_contract")
|
|
779
|
-
return createAkanValidationContract((
|
|
786
|
+
return createAkanValidationContract((mode) => this.listMcpTools(mode));
|
|
780
787
|
if (name === "list_workflows")
|
|
781
788
|
return parseJsonOutput(new WorkflowRunner().list({ format: "json" }));
|
|
782
789
|
if (name === "explain_workflow")
|
|
@@ -851,17 +858,20 @@ class ContextRunner extends runner("context") {
|
|
|
851
858
|
${payload}`);
|
|
852
859
|
};
|
|
853
860
|
const respond = (id, result, framing) => {
|
|
854
|
-
writeMessage({ jsonrpc: "2.0", id, result }, framing);
|
|
861
|
+
writeMessage({ jsonrpc: "2.0", id: id ?? null, result }, framing);
|
|
855
862
|
};
|
|
856
863
|
const respondError = (id, code, message, framing) => {
|
|
857
|
-
writeMessage({ jsonrpc: "2.0", id, error: { code, message } }, framing);
|
|
864
|
+
writeMessage({ jsonrpc: "2.0", id: id ?? null, error: { code, message } }, framing);
|
|
858
865
|
};
|
|
866
|
+
const guidelineNames = await Prompter.listGuidelines();
|
|
867
|
+
const resources = buildResourceList(guidelineNames);
|
|
859
868
|
const readResource = async (uri) => {
|
|
860
|
-
|
|
861
|
-
if (uri === "akan://docs/framework" || uri === "akan://guidelines/framework")
|
|
869
|
+
if (uri === "akan://docs/framework")
|
|
862
870
|
return { uri, mimeType: "text/markdown", text: await Prompter.getInstruction("framework") };
|
|
863
|
-
|
|
864
|
-
|
|
871
|
+
const guideline = /^akan:\/\/guidelines\/(.+)$/.exec(uri)?.[1];
|
|
872
|
+
if (guideline)
|
|
873
|
+
return { uri, mimeType: "text/markdown", text: await Prompter.getInstruction(guideline) };
|
|
874
|
+
const context = await AkanContextAnalyzer.analyze(workspace);
|
|
865
875
|
if (uri === "akan://workspace/summary")
|
|
866
876
|
return { uri, mimeType: "application/json", text: jsonText(context, { trailingNewline: false }) };
|
|
867
877
|
if (uri === "akan://workspace/apps")
|
|
@@ -883,7 +893,7 @@ ${payload}`);
|
|
|
883
893
|
}
|
|
884
894
|
throw new Error(`Unknown resource: ${uri}`);
|
|
885
895
|
};
|
|
886
|
-
const
|
|
896
|
+
const handleRequest = async (request, framing) => {
|
|
887
897
|
const params = request.params ?? {};
|
|
888
898
|
if (request.method === "initialize") {
|
|
889
899
|
respond(request.id, {
|
|
@@ -893,7 +903,7 @@ ${payload}`);
|
|
|
893
903
|
}, framing);
|
|
894
904
|
} else if (request.method === "tools/list") {
|
|
895
905
|
respond(request.id, {
|
|
896
|
-
tools: this.listMcpTools(mode)
|
|
906
|
+
tools: this.listMcpTools(mode, { guidelineNames })
|
|
897
907
|
}, framing);
|
|
898
908
|
} else if (request.method === "tools/call") {
|
|
899
909
|
const name = params.name;
|
|
@@ -909,16 +919,39 @@ ${payload}`);
|
|
|
909
919
|
]
|
|
910
920
|
}, framing);
|
|
911
921
|
} catch (error) {
|
|
912
|
-
|
|
922
|
+
respond(request.id, { content: [{ type: "text", text: toolErrorText(error) }], isError: true }, framing);
|
|
913
923
|
}
|
|
914
924
|
} else if (request.method === "resources/list") {
|
|
915
|
-
respond(request.id, { resources
|
|
925
|
+
respond(request.id, { resources }, framing);
|
|
916
926
|
} else if (request.method === "resources/read") {
|
|
917
927
|
respond(request.id, { contents: [await readResource(params.uri)] }, framing);
|
|
918
|
-
} else
|
|
928
|
+
} else {
|
|
919
929
|
respondError(request.id, -32601, `Unknown method: ${request.method}`, framing);
|
|
920
930
|
}
|
|
921
931
|
};
|
|
932
|
+
const handle = async (request, framing) => {
|
|
933
|
+
if (request.id === undefined || request.id === null)
|
|
934
|
+
return;
|
|
935
|
+
try {
|
|
936
|
+
await handleRequest(request, framing);
|
|
937
|
+
} catch (error) {
|
|
938
|
+
respondError(request.id, -32603, error instanceof Error ? error.message : String(error), framing);
|
|
939
|
+
}
|
|
940
|
+
};
|
|
941
|
+
const handleFrame = async (payload, framing) => {
|
|
942
|
+
let request;
|
|
943
|
+
try {
|
|
944
|
+
request = JSON.parse(payload);
|
|
945
|
+
} catch (error) {
|
|
946
|
+
respondError(null, -32700, error instanceof Error ? error.message : String(error), framing);
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
if (!request || typeof request !== "object" || typeof request.method !== "string") {
|
|
950
|
+
respondError(null, -32600, "Invalid Request: expected a JSON-RPC 2.0 object with a method", framing);
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
953
|
+
await handle(request, framing);
|
|
954
|
+
};
|
|
922
955
|
const parseContentLengthMessage = async () => {
|
|
923
956
|
const headerEnd = buffer.indexOf(`\r
|
|
924
957
|
\r
|
|
@@ -938,7 +971,7 @@ ${payload}`);
|
|
|
938
971
|
return false;
|
|
939
972
|
const body = buffer.slice(bodyStart, bodyEnd);
|
|
940
973
|
buffer = buffer.slice(bodyEnd);
|
|
941
|
-
await
|
|
974
|
+
await handleFrame(body, "content-length");
|
|
942
975
|
return true;
|
|
943
976
|
};
|
|
944
977
|
const parseLineMessage = async () => {
|
|
@@ -950,7 +983,7 @@ ${payload}`);
|
|
|
950
983
|
buffer = buffer.slice(lineEnd + 1);
|
|
951
984
|
if (!line)
|
|
952
985
|
return true;
|
|
953
|
-
await
|
|
986
|
+
await handleFrame(line, "newline");
|
|
954
987
|
return true;
|
|
955
988
|
};
|
|
956
989
|
const parse = async () => {
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import {
|
|
3
|
-
AkanContextAnalyzer
|
|
4
|
-
} from "./index-774gcx29.js";
|
|
5
|
-
import {
|
|
6
|
-
Prompter
|
|
7
|
-
} from "./index-j37qq1f2.js";
|
|
8
2
|
import {
|
|
9
3
|
runner,
|
|
10
4
|
script
|
|
11
|
-
} from "./index-
|
|
5
|
+
} from "./index-cezy7yb3.js";
|
|
12
6
|
import {
|
|
13
|
-
AGENT_BLOCK_END,
|
|
14
7
|
AGENT_BLOCK_START,
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
AGENT_BLOCK_END,
|
|
9
|
+
stampBlockVersion,
|
|
17
10
|
readDevkitVersion,
|
|
11
|
+
upsertAgentBlock,
|
|
18
12
|
renderRecipeEntries,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
CLAUDE_COMMENT_RULE,
|
|
14
|
+
AppExecutor,
|
|
15
|
+
LibExecutor
|
|
16
|
+
} from "./index-q8sn827n.js";
|
|
22
17
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} from "./index-
|
|
18
|
+
collectRecipeSources2,
|
|
19
|
+
scanRecipes2
|
|
20
|
+
} from "./index-by5gpp8x.js";
|
|
21
|
+
import {
|
|
22
|
+
AkanContextAnalyzer
|
|
23
|
+
} from "./index-0emb9eat.js";
|
|
24
|
+
import {
|
|
25
|
+
Prompter
|
|
26
|
+
} from "./index-h7yw2z9n.js";
|
|
26
27
|
|
|
27
28
|
// pkgs/@akanjs/cli/agent/agent.script.ts
|
|
28
29
|
import { Logger as Logger2 } from "akanjs/common";
|
|
@@ -76,8 +77,8 @@ Keep a sample only while you are still learning its pattern; delete it once your
|
|
|
76
77
|
`;
|
|
77
78
|
};
|
|
78
79
|
var renderRecipeIndex = async (workspace) => {
|
|
79
|
-
const sources = await
|
|
80
|
-
const recipes =
|
|
80
|
+
const sources = await collectRecipeSources2(`${workspace.workspaceRoot}/pkgs/akanjs/ui`, "akanjs/ui", "recipe");
|
|
81
|
+
const recipes = scanRecipes2(sources);
|
|
81
82
|
const scopeIndexPointer = `App and lib recipes are **not** listed here. Each app/lib carries its own generated index \u2014
|
|
82
83
|
\`apps/<app>/AGENTS.md\` / \`libs/<lib>/AGENTS.md\` (\`## Recipes In Scope\`) \u2014 regenerated by \`akan sync\` and
|
|
83
84
|
verified by \`akan lint\`. When working inside an app or lib, consult that file before consuming or authoring a look.`;
|
|
@@ -89,15 +90,14 @@ ${scopeIndexPointer}
|
|
|
89
90
|
`;
|
|
90
91
|
return `## Recipes
|
|
91
92
|
|
|
92
|
-
Framework UI recipes (Tailwind-variant look factories), importable from every app and lib
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
the
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
near-duplicate.** Full authoring/consumption policy: the \`recipeRule\` guideline.
|
|
93
|
+
Framework UI recipes (Tailwind-variant look factories), importable from every app and lib: \`import { <name> } from
|
|
94
|
+
"akanjs/ui"\`, then \`<name>(variants?, className?)\`. The second arg merges internally and takes **an array too**, so
|
|
95
|
+
never wrap it in \`cn()\`: \`<name>({}, ["h-full", isWide && "w-full", className])\`. The list below is the full
|
|
96
|
+
contract (\`*\` marks the default, \`key?\` is a boolean flag) \u2014 do not guess a name, path, or variant value, and do
|
|
97
|
+
not open the recipe file to consume one. **Before inlining a repeated surface (card, box, tile, \u2026): reuse a recipe,
|
|
98
|
+
or add one as \`apps/<app>/ui/Recipe/<name>.ts\`, one per file, re-exported from that folder's \`index.ts\` \u2014 never
|
|
99
|
+
re-implement the same look inline in several places, and never author a near-duplicate.** Full policy: the
|
|
100
|
+
\`recipeRule\` guideline.
|
|
101
101
|
|
|
102
102
|
${renderRecipeEntries(recipes)}
|
|
103
103
|
|
|
@@ -147,15 +147,12 @@ If generated output is stale or broken, update the owning source file and run \`
|
|
|
147
147
|
|
|
148
148
|
${recipeIndex}## MCP Workflow Policy
|
|
149
149
|
|
|
150
|
-
- Prefer Akan
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
-
|
|
156
|
-
- If no workflow exists, or apply reports unsupported/no-op/failed diagnostics that require manual action, keep edits scoped to owning source files and never patch generated files directly.
|
|
157
|
-
- For compound requests, split the request into workflows and apply each \`planPath\` in order, such as \`create-module\` followed by \`add-field\`.
|
|
158
|
-
- **CLI-only fallback (MCP not connected):** \`akan mcp\` starts a stdio MCP server, so the \`list_workflows\`/\`plan_workflow\`/\`apply_workflow\` tools exist only when your agent is wired to it as an MCP client. When they are unavailable, the CLI is a first-class equivalent: \`akan workflow list\` / \`explain <name>\` / \`plan <name> ... --format json --out <planPath>\` / \`apply <planPath> --format json\`, \`akan doctor --strict --format json\` for validation, and \`akan repair generated|imports|module-shape --app <app> --format json\` for repairs. Scaffolding primitives (\`create-module\`/\`create-scalar\`/\`create-service\` take the target app/lib as a POSITIONAL arg; \`add-field\`/\`add-enum-field\` use \`--app\`/\`--module\` flags) call the same code the workflows do.
|
|
150
|
+
- **Prefer an Akan workflow to a direct source edit.** A direct edit is denied when an allowlisted workflow or repair tool can make the change.
|
|
151
|
+
- Inspect with \`akan mcp --mode plan\` (\`list_workflows\`, \`explain_workflow\`, \`plan_workflow\`); apply with \`akan mcp --mode apply\`, which allowlists \`apply_workflow\`, \`run_validation\`, and the repair tools.
|
|
152
|
+
- If \`plan_workflow\` returns \`planPath\` or \`next.tool=apply_workflow\`, call \`apply_workflow({ planPath })\` before editing source. Then run \`run_validation\` with \`validationTarget\` when present, otherwise \`applyReportPath\`.
|
|
153
|
+
- Split a compound request into workflows and apply each \`planPath\` in order, such as \`create-module\` followed by \`add-field\`.
|
|
154
|
+
- When no workflow exists, or apply reports unsupported/no-op/failed diagnostics needing manual action, keep edits scoped to owning source files and never patch generated files directly.
|
|
155
|
+
- **MCP not connected?** The CLI is a first-class equivalent \u2014 \`akan workflow list\` / \`explain\` / \`plan\` / \`apply\`, \`akan doctor\`, \`akan repair\`. See the onboarding guide's CLI-only fallback for the exact flags.
|
|
159
156
|
|
|
160
157
|
## Validation
|
|
161
158
|
|
|
@@ -199,6 +196,8 @@ var renderClaudeMd = async (workspace) => {
|
|
|
199
196
|
return `# ${context.repoName} \u2014 Claude Code Guide
|
|
200
197
|
|
|
201
198
|
@AGENTS.md
|
|
199
|
+
|
|
200
|
+
${CLAUDE_COMMENT_RULE}
|
|
202
201
|
`;
|
|
203
202
|
};
|
|
204
203
|
var renderCursorRule = () => `---
|
|
@@ -246,7 +245,7 @@ class AgentRunner extends runner("agent") {
|
|
|
246
245
|
written.push(`${exec.type}s/${exec.name}/AGENTS.md`);
|
|
247
246
|
} catch (error) {
|
|
248
247
|
const message = error instanceof Error ? error.message : String(error);
|
|
249
|
-
Logger.rawLog(`Skipped ${exec.type}s/${exec.name}/AGENTS.md (${message})`, undefined, "
|
|
248
|
+
Logger.rawLog(`Skipped ${exec.type}s/${exec.name}/AGENTS.md (${message})`, undefined, "error");
|
|
250
249
|
}
|
|
251
250
|
};
|
|
252
251
|
for (const name of libNames)
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-cezy7yb3.js";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
} from "./index-
|
|
7
|
+
FileSys
|
|
8
|
+
} from "./index-q0y2jq9j.js";
|
|
9
9
|
import {
|
|
10
|
-
|
|
11
|
-
} from "./index-
|
|
10
|
+
PkgExecutor
|
|
11
|
+
} from "./index-q8sn827n.js";
|
|
12
12
|
import {
|
|
13
|
-
|
|
14
|
-
} from "./index-
|
|
13
|
+
TypeScriptDependencyScanner2
|
|
14
|
+
} from "./index-kcxmv48c.js";
|
|
15
15
|
|
|
16
16
|
// pkgs/@akanjs/cli/package/package.runner.ts
|
|
17
17
|
import path2 from "path";
|
|
@@ -140,7 +140,7 @@ class PackageRunner extends runner("package") {
|
|
|
140
140
|
await workspace.setPkgTsPaths(pkgName);
|
|
141
141
|
}
|
|
142
142
|
async removePackage(pkg) {
|
|
143
|
-
await pkg.workspace.
|
|
143
|
+
await pkg.workspace.removeDir(`pkgs/${pkg.name}`);
|
|
144
144
|
await pkg.workspace.unsetPkgTsPaths(pkg.name);
|
|
145
145
|
}
|
|
146
146
|
async scanSync(pkg) {
|
|
@@ -150,7 +150,7 @@ class PackageRunner extends runner("package") {
|
|
|
150
150
|
async buildPackage(pkg) {
|
|
151
151
|
await $`rm -rf ${pkg.dist.cwdPath}`;
|
|
152
152
|
await pkg.dist.mkdir(pkg.dist.cwdPath);
|
|
153
|
-
const scanner = await
|
|
153
|
+
const scanner = await TypeScriptDependencyScanner2.from(pkg);
|
|
154
154
|
const { npmDeps, npmDevDeps, missingDeps } = await scanner.getPackageBuildDependencies(pkg.name);
|
|
155
155
|
const packageRuntimeDependencies = {
|
|
156
156
|
"@akanjs/devkit": ["tailwind-scrollbar"]
|
|
@@ -163,13 +163,17 @@ class PackageRunner extends runner("package") {
|
|
|
163
163
|
"tailwind-scrollbar"
|
|
164
164
|
].filter((dep) => dep !== "akanjs" && dep !== "@akanjs/devkit");
|
|
165
165
|
}
|
|
166
|
-
const
|
|
166
|
+
const packageBundledRuntimeDependencies = {
|
|
167
|
+
"@akanjs/cli": ["@akanjs/devkit"],
|
|
168
|
+
akanjs: ["use-agentic"]
|
|
169
|
+
};
|
|
170
|
+
const bundledRuntimeDeps = new Set(packageBundledRuntimeDependencies[pkg.name] ?? []);
|
|
167
171
|
const forcedRuntimeDeps = packageRuntimeDependencies[pkg.name] ?? [];
|
|
168
172
|
const forcedRuntimeDevDeps = packageRuntimeDevDependencies[pkg.name] ?? [];
|
|
169
173
|
const [rootPackageJson, pkgJson] = await Promise.all([pkg.workspace.getPackageJson(), pkg.getPackageJson()]);
|
|
170
174
|
const optionalPeerDeps = new Set(Object.entries(pkgJson.peerDependenciesMeta ?? {}).filter(([, meta]) => meta.optional).map(([dep]) => dep));
|
|
171
175
|
const packageRuntimeDeps = [...new Set([...npmDeps, ...forcedRuntimeDeps])].filter((dep) => !optionalPeerDeps.has(dep) && !bundledRuntimeDeps.has(dep));
|
|
172
|
-
const packageRuntimeDevDeps = [...new Set([...npmDevDeps, ...forcedRuntimeDevDeps])].filter((dep) => !optionalPeerDeps.has(dep));
|
|
176
|
+
const packageRuntimeDevDeps = [...new Set([...npmDevDeps, ...forcedRuntimeDevDeps])].filter((dep) => !optionalPeerDeps.has(dep) && !bundledRuntimeDeps.has(dep));
|
|
173
177
|
const rootDeps = { ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies };
|
|
174
178
|
const missingForcedDeps = forcedRuntimeDeps.filter((dep) => !rootDeps[dep]);
|
|
175
179
|
const missingForcedDevDeps = forcedRuntimeDevDeps.filter((dep) => !rootDeps[dep]);
|
|
@@ -268,7 +272,7 @@ class PackageRunner extends runner("package") {
|
|
|
268
272
|
}
|
|
269
273
|
if (!pkgJson.version)
|
|
270
274
|
throw new Error(`[package] dist package version is missing for ${pkg.name}`);
|
|
271
|
-
if (
|
|
275
|
+
if (pkgJson.publishConfig?.access !== "public") {
|
|
272
276
|
throw new Error(`[package] ${pkg.name} must publish with publishConfig.access=public`);
|
|
273
277
|
}
|
|
274
278
|
if (!await Bun.file(`${pkg.dist.cwdPath}/README.md`).exists()) {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
FileSys
|
|
4
|
+
} from "./index-q0y2jq9j.js";
|
|
5
|
+
|
|
2
6
|
// pkgs/@akanjs/devkit/frontendBuild/clientEntryDiscovery.ts
|
|
3
7
|
import path3 from "path";
|
|
4
8
|
|
|
@@ -349,7 +353,7 @@ var resolveNodePackageExport = async (workspaceRoot, specifier) => {
|
|
|
349
353
|
const subpath = specifier === packageName ? "." : `.${specifier.slice(packageName.length)}`;
|
|
350
354
|
const exported = resolvePackageExport(pkgJson.exports, subpath);
|
|
351
355
|
const rel = exported ?? (subpath === "." ? pkgJson.module ?? pkgJson.main ?? "index.js" : null);
|
|
352
|
-
if (!rel
|
|
356
|
+
if (!rel?.startsWith("."))
|
|
353
357
|
return null;
|
|
354
358
|
const entryFile = await resolveFileCandidate(path2.resolve(pkgDir, rel));
|
|
355
359
|
if (!entryFile)
|
|
@@ -849,6 +853,7 @@ class ClientEntriesBundler {
|
|
|
849
853
|
#externalSubpaths;
|
|
850
854
|
#externalAliases;
|
|
851
855
|
#command;
|
|
856
|
+
#target;
|
|
852
857
|
#outputSubdir;
|
|
853
858
|
#reactFastRefresh;
|
|
854
859
|
#artifactDir;
|
|
@@ -870,6 +875,7 @@ class ClientEntriesBundler {
|
|
|
870
875
|
this.#externalSubpaths = options.externalSubpaths ?? [];
|
|
871
876
|
this.#externalAliases = options.externalAliases ?? {};
|
|
872
877
|
this.#command = options.command ?? "start";
|
|
878
|
+
this.#target = options.target ?? "browser";
|
|
873
879
|
this.#outputSubdir = options.outputSubdir ?? "client";
|
|
874
880
|
this.#reactFastRefresh = options.reactFastRefresh ?? false;
|
|
875
881
|
this.#artifactDir = `${this.#command === "build" ? this.#app.dist.cwdPath : this.#app.cwdPath}/.akan/artifact`;
|
|
@@ -883,7 +889,7 @@ class ClientEntriesBundler {
|
|
|
883
889
|
entrypoints: this.#opaqueEntries.entries,
|
|
884
890
|
outdir: this.#outdir,
|
|
885
891
|
splitting: true,
|
|
886
|
-
target:
|
|
892
|
+
target: this.#target,
|
|
887
893
|
format: "esm",
|
|
888
894
|
naming: CLIENT_BUNDLE_NAMING,
|
|
889
895
|
metafile: true,
|
|
@@ -1117,7 +1123,8 @@ var VENDOR_SPECIFIERS = [
|
|
|
1117
1123
|
"akanjs/store",
|
|
1118
1124
|
"akanjs/base",
|
|
1119
1125
|
"akanjs/common",
|
|
1120
|
-
"akanjs/constant"
|
|
1126
|
+
"akanjs/constant",
|
|
1127
|
+
"akanjs/fetch"
|
|
1121
1128
|
];
|
|
1122
1129
|
|
|
1123
1130
|
// pkgs/@akanjs/devkit/frontendBuild/routeClientBuilder.ts
|
|
@@ -1226,12 +1233,11 @@ class RouteClientBuilder {
|
|
|
1226
1233
|
}).bundle();
|
|
1227
1234
|
}
|
|
1228
1235
|
async#buildSsrBundle(bootstrapEntries) {
|
|
1229
|
-
const externalOptions = RouteClientBuilder.resolveSsrClientExternalOptions(this.#command);
|
|
1230
1236
|
return new ClientEntriesBundler({
|
|
1231
1237
|
app: this.#app,
|
|
1232
1238
|
entries: bootstrapEntries.buildEntries,
|
|
1233
1239
|
plugins: [await createBarrelImportsPlugin(this.#app)],
|
|
1234
|
-
...
|
|
1240
|
+
...RouteClientBuilder.resolveSsrClientBundleOptions(this.#command),
|
|
1235
1241
|
outputSubdir: "client-ssr",
|
|
1236
1242
|
command: this.#command
|
|
1237
1243
|
}).bundle();
|
|
@@ -1293,15 +1299,16 @@ ${defaultNames.map((name) => `export default ${name};`).join(`
|
|
|
1293
1299
|
const serverEntry = RouteClientBuilder.resolveAkanServerEntry();
|
|
1294
1300
|
return { [Bun.resolveSync("akanjs/fetch", serverEntry)]: "akanjs/fetch" };
|
|
1295
1301
|
}
|
|
1296
|
-
static
|
|
1302
|
+
static resolveSsrClientBundleOptions(command) {
|
|
1297
1303
|
if (command === "start") {
|
|
1298
1304
|
return {
|
|
1305
|
+
target: "bun",
|
|
1299
1306
|
external: SSR_CLIENT_EXTERNALS,
|
|
1300
1307
|
externalSubpaths: ["akanjs/fetch"],
|
|
1301
1308
|
externalAliases: RouteClientBuilder.resolveSsrClientRuntimeAliases()
|
|
1302
1309
|
};
|
|
1303
1310
|
}
|
|
1304
|
-
return { external: SSR_CLIENT_ALIAS_EXTERNALS };
|
|
1311
|
+
return { target: "bun", external: SSR_CLIENT_ALIAS_EXTERNALS };
|
|
1305
1312
|
}
|
|
1306
1313
|
static resolveAkanServerEntry() {
|
|
1307
1314
|
try {
|
|
@@ -1337,7 +1344,7 @@ ${defaultNames.map((name) => `export default ${name};`).join(`
|
|
|
1337
1344
|
}
|
|
1338
1345
|
|
|
1339
1346
|
// pkgs/@akanjs/devkit/frontendBuild/autoImportSync.ts
|
|
1340
|
-
import { readdir, readFile, stat
|
|
1347
|
+
import { readdir, readFile, stat } from "fs/promises";
|
|
1341
1348
|
import path7 from "path";
|
|
1342
1349
|
import ts2 from "typescript";
|
|
1343
1350
|
var TEST_FILE_RE = /\.(test|spec)\.(ts|tsx)$/;
|
|
@@ -1515,6 +1522,8 @@ class AutoImportSync {
|
|
|
1515
1522
|
const [scope, project, facet] = parts;
|
|
1516
1523
|
if (scope !== "apps" && scope !== "libs" || !project || !facet)
|
|
1517
1524
|
return null;
|
|
1525
|
+
if (facet === "lib" && parts[3] === "__lib")
|
|
1526
|
+
return null;
|
|
1518
1527
|
const role = roleFor(facet, base);
|
|
1519
1528
|
if (!role)
|
|
1520
1529
|
return null;
|
|
@@ -1529,7 +1538,7 @@ class AutoImportSync {
|
|
|
1529
1538
|
const next = transformSource(source, abs, ctx, resolveExtra);
|
|
1530
1539
|
if (next === null || next === source)
|
|
1531
1540
|
return false;
|
|
1532
|
-
await
|
|
1541
|
+
await FileSys.writeTextAtomic(abs, next);
|
|
1533
1542
|
return true;
|
|
1534
1543
|
}
|
|
1535
1544
|
async#extraResolverFor(abs, ctx) {
|
|
@@ -2010,7 +2019,7 @@ class DevChangePlanner {
|
|
|
2010
2019
|
var uniqueResolved = (files) => [...new Set(files.map((file) => path8.resolve(file)))].sort();
|
|
2011
2020
|
|
|
2012
2021
|
// pkgs/@akanjs/devkit/frontendBuild/devGeneratedIndexSync.ts
|
|
2013
|
-
import { mkdir as mkdir2, readdir as readdir2, readFile as readFile2, rm, stat as stat2
|
|
2022
|
+
import { mkdir as mkdir2, readdir as readdir2, readFile as readFile2, rm, stat as stat2 } from "fs/promises";
|
|
2014
2023
|
import path9 from "path";
|
|
2015
2024
|
var BARREL_FACETS2 = new Set(["common", "srvkit", "ui", "webkit", "plugin"]);
|
|
2016
2025
|
var FACET_SOURCE_FILE_RE = /\.(ts|tsx)$/;
|
|
@@ -2102,7 +2111,7 @@ class DevGeneratedIndexSync {
|
|
|
2102
2111
|
if (current === content)
|
|
2103
2112
|
return false;
|
|
2104
2113
|
await mkdir2(dir, { recursive: true });
|
|
2105
|
-
await
|
|
2114
|
+
await FileSys.writeTextAtomic(indexPath, content);
|
|
2106
2115
|
return true;
|
|
2107
2116
|
}
|
|
2108
2117
|
async#contentForIndex(indexPath) {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./index-774gcx29.js";
|
|
5
|
-
import {
|
|
6
|
-
createRepairReport,
|
|
3
|
+
writeWorkflowRunArtifact,
|
|
7
4
|
generatedFilePathsForTarget,
|
|
8
|
-
renderRepairReport,
|
|
9
5
|
writeGeneratedSyncState,
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
createRepairReport,
|
|
7
|
+
renderRepairReport
|
|
8
|
+
} from "./index-e82dyeqy.js";
|
|
9
|
+
import {
|
|
10
|
+
AkanContextAnalyzer
|
|
11
|
+
} from "./index-0emb9eat.js";
|
|
12
12
|
import {
|
|
13
13
|
runner
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-cezy7yb3.js";
|
|
15
15
|
|
|
16
16
|
// pkgs/@akanjs/cli/repair/repair.runner.ts
|
|
17
17
|
var commandForShell = (command) => command.startsWith("akan ") ? `bun run ${command}` : command;
|