@akanjs/cli 3.2.0-rc.8 → 3.2.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 +2 -2
- package/CodeAgent-fx6088tv.js +11 -0
- package/{CodeTui-qstk5vpj.js → CodeTui-zee8atsr.js} +822 -666
- package/README.ko.md +7 -0
- package/README.md +7 -0
- package/TunnelShare-9ry4vh0y.js +18 -0
- package/agent.command-x65f2ags.js +61 -0
- package/akanCode.js +12 -12
- package/appExecutor-79azsb2w.js +11 -0
- package/{application.command-m4rq4wc2.js → application.command-azbd1pb2.js} +83 -37
- package/{applicationBuildRunner-df7rx3ra.js → applicationBuildRunner-trfxv3pd.js} +49 -18
- package/buildBatch.proc.js +25 -11
- package/{cloud.command-a0gy0qq2.js → cloud.command-gapp4634.js} +33 -29
- package/cloud.script-3b401efv.js +35 -0
- package/{code.command-5rsdqw8s.js → code.command-5smx61yf.js} +13 -9
- package/context.command-ym5jbkny.js +64 -0
- package/context.runner-kctbfsde.js +34 -0
- package/{dependencyScanner-78sq8m4q.js → dependencyScanner-ge10gb52.js} +2 -2
- package/{devTui-h77zrjv5.js → devTui-rf374y2w.js} +1 -1
- package/{fileSys-zpvt5gtf.js → fileSys-q22646yc.js} +1 -1
- package/{guideline.command-mffxknbr.js → guideline.command-zwypaqsh.js} +9 -5
- package/guidelines/agentRule/agentRule.instruction.md +25 -9
- package/guidelines/akanApi/akanApi.instruction.md +6 -4
- package/guidelines/conventions/core.md +23 -5
- package/guidelines/conventions/rules/app.md +4 -1
- package/guidelines/conventions/rules/page.md +5 -4
- package/guidelines/conventions/rules/ts.md +3 -3
- package/guidelines/errorCodes/errorCodes.instruction.md +165 -0
- package/guidelines/fieldRule/fieldRule.instruction.md +2 -1
- package/guidelines/mcpRule/mcpRule.instruction.md +225 -5
- package/guidelines/pageRule/pageRule.instruction.md +10 -1
- package/guidelines/queryRule/queryRule.instruction.md +3 -1
- package/guidelines/runtimeRule/runtimeRule.instruction.md +14 -8
- package/guidelines/transportRule/transportRule.instruction.md +31 -1
- package/incrementalBuilder.proc.js +577 -411
- package/{index-w15mg3km.js → index-0dm25wvf.js} +1 -1
- package/{index-0gg15zwa.js → index-0s7w2085.js} +6 -6
- package/{index-hj6w4ka1.js → index-1p81ecbz.js} +1 -1
- package/{index-swwjakt0.js → index-275a4r3n.js} +11 -11
- package/{index-j6gc8n14.js → index-2jmvfa62.js} +11 -9
- package/{index-qd7xn2bk.js → index-2ny1e95c.js} +2 -2
- package/{index-exn38bzx.js → index-2yn3r67f.js} +116 -54
- package/{index-34792nh7.js → index-3txdtztz.js} +1 -1
- package/{index-28x1aszt.js → index-41a03gkj.js} +149 -53
- package/{index-2mf1aen9.js → index-4ss4gkv3.js} +2 -2
- package/{index-an76bdrv.js → index-612fdtbk.js} +1 -1
- package/{index-5radqwn2.js → index-67sd09ag.js} +12 -12
- package/{index-0hbtve0a.js → index-6dzjer7p.js} +32 -28
- package/{index-3ghdb7p5.js → index-71y6176j.js} +2777 -3676
- package/{index-xyn02k0w.js → index-78y75t0a.js} +662 -433
- package/index-7wf8snar.js +80 -0
- package/{index-skmtj8rm.js → index-8jtqfye2.js} +27 -10
- package/{index-2mrn1mrg.js → index-9f3reh2y.js} +1 -1
- package/{index-nmvhjn8c.js → index-9wh04mqy.js} +93 -82
- package/{index-xvk2a75m.js → index-a860mx0m.js} +3 -3
- package/{index-5zwr4n6k.js → index-baccvws5.js} +65 -8
- package/{index-yf9wc28h.js → index-bejy9zyc.js} +1 -1
- package/{index-bns3wcpc.js → index-by2tvsq6.js} +1 -1
- package/{index-r0a604h4.js → index-c669pbyb.js} +5 -4
- package/{index-x40bdsca.js → index-dadwp2aw.js} +33 -98
- package/{index-vm0dn0mt.js → index-dmcpetwe.js} +200 -138
- package/{index-43f4h4cm.js → index-ebn9kgea.js} +6 -6
- package/{index-hqv34wzq.js → index-gt8phqpt.js} +10 -10
- package/{index-yckz5t8b.js → index-h901f24n.js} +516 -434
- package/{index-j3v29pq7.js → index-j0wr4e32.js} +219 -175
- package/{index-gcx48get.js → index-j592zfqc.js} +2 -2
- package/{index-grxs6fts.js → index-j6jjmn2r.js} +57 -31
- package/{index-w8yasvpc.js → index-jek2re5k.js} +2136 -2175
- package/{index-ny2k80mv.js → index-jf4vk1s0.js} +9 -2
- package/{index-gxav1bjz.js → index-k6vwww45.js} +9 -9
- package/{index-99qvtff2.js → index-kfvjzk8r.js} +5 -5
- package/{index-j6eeh5d7.js → index-knpm8sdm.js} +5 -5
- package/{index-2r9ff9qm.js → index-nc3br31y.js} +2 -2
- package/{index-35j83zkd.js → index-p5zh7pmc.js} +2 -2
- package/{index-cmg5ngqa.js → index-p7beqww9.js} +2 -2
- package/{index-b4qq3rq0.js → index-rwgqba9p.js} +1 -1
- package/{index-rfzp4pqs.js → index-s885g0jj.js} +3 -3
- package/{index-9p260r4e.js → index-trffs83s.js} +538 -250
- package/{index-k92x3vne.js → index-v7ajmsh3.js} +1 -1
- package/index-w1zexzpx.js +127 -0
- package/{index-h7hehkw6.js → index-xczjdng6.js} +3 -1
- package/{index-39jz41jb.js → index-xs9a3ddt.js} +3 -3
- package/{index-rp4yf32g.js → index-xwwex8rf.js} +36 -29
- package/{index-ra9fvn7s.js → index-ybcb9wc8.js} +74 -38
- package/index-z92zm3wd.js +788 -0
- package/{index-j9790rhk.js → index-z96ks033.js} +1509 -1121
- package/index-zfnz878d.js +30 -0
- package/{index-2vgv7fs7.js → index-zmd9xxgd.js} +727 -693
- package/{index-ygdbn9jn.js → index-zyb0ebm4.js} +1 -1
- package/index.js +28 -24
- package/libExecutor-jc6f8hm6.js +10 -0
- package/{library.command-bmd7zc5m.js → library.command-nxvesvhb.js} +12 -5
- package/{localRegistry.command-y6en1599.js → localRegistry.command-xz62e4ng.js} +29 -24
- package/{module.command-7exfffqw.js → module.command-aaws9byg.js} +11 -7
- package/{package.command-adskw2rj.js → package.command-j7hv26p0.js} +14 -10
- package/package.json +8 -8
- package/{page.command-dw01272p.js → page.command-7yffs7n9.js} +8 -4
- package/{pipeline.command-0b1r3y5r.js → pipeline.command-7yk0zcng.js} +15 -9
- package/pkgExecutor-arxmvx4t.js +10 -0
- package/{primitive.command-byw6vc04.js → primitive.command-7a1pt715.js} +12 -8
- package/{projectTypecheck-kkrpq60a.js → projectTypecheck-f4qhbecd.js} +1 -1
- package/{prompter-qrwx1p17.js → prompter-qyggfhqd.js} +2 -2
- package/{quality.command-6rqnhzct.js → quality.command-c6mvrjh1.js} +25 -16
- package/{recipeScanner-4b69ybe0.js → recipeScanner-rrx69awy.js} +1 -1
- package/{repair.command-rw5zymak.js → repair.command-093adzt9.js} +12 -8
- package/{routeSourceValidator-4h947v7c.js → routeSourceValidator-8n6j1vn7.js} +4 -2
- package/{scalar.command-2dyp9nh9.js → scalar.command-2ex84spb.js} +10 -6
- package/skills/akan-debug/SKILL.md +8 -5
- package/skills/akan-err/SKILL.md +7 -0
- package/skills/akan-mcp/SKILL.md +19 -1
- package/skills/akan-scaffold/SKILL.md +1 -1
- package/skills/akan-validate/SKILL.md +3 -3
- package/{subspace.command-111ynwv1.js → subspace.command-4n4n4jpv.js} +32 -24
- package/templates/app/page/_layout.tsx +13 -0
- package/templates/app/page/styles.css.template +40 -0
- package/templates/appSample/page/_index.tsx +9 -9
- package/templates/appSample/page/_layout.tsx +1 -0
- package/templates/appSample/page/styles.css.template +40 -5
- package/templates/appSample/ui/Recipe/jellyButton.ts +1 -1
- package/templates/biomeForm.ts +1 -1
- package/templates/env/_env.server.type.ts +1 -1
- package/templates/facetIndex/index.ts +2 -37
- package/templates/lib/sig.ts +0 -4
- package/templates/lib/useClient.ts +1 -1
- package/templates/workspaceRoot/.devcontainer/devcontainer.json.template +1 -1
- package/templates/workspaceRoot/AGENTS.md.template +2 -1
- package/templates/workspaceRoot/README.ts +4 -2
- package/{tunnel.command-2gcpfbdj.js → tunnel.command-f7ep1qfa.js} +17 -13
- package/{typeChecker-s640r6c0.js → typeChecker-7jt6abrs.js} +1 -1
- package/typecheck.proc.js +3 -2
- package/{verify.command-djgs86ma.js → verify.command-zrkxnvct.js} +21 -17
- package/{workflow.command-n0k2mxr5.js → workflow.command-ks16jegk.js} +21 -14
- package/{workspace.command-fh1qwxfx.js → workspace.command-ahhfpaag.js} +60 -54
- package/CodeAgent-x2p3a3e0.js +0 -11
- package/TunnelShare-c4xsfzg5.js +0 -15
- package/agent.command-9et2e27p.js +0 -52
- package/cloud.script-xze4zh7n.js +0 -31
- package/context.command-rk1dwrg4.js +0 -57
- package/context.runner-83ky5m1b.js +0 -30
- /package/templates/{appSample → app}/public/fonts/Pretendard-Bold.woff2 +0 -0
- /package/templates/{appSample → app}/public/fonts/Pretendard-Medium.woff2 +0 -0
- /package/templates/{appSample → app}/public/fonts/Pretendard-Regular.woff2 +0 -0
- /package/templates/{appSample → app}/public/fonts/Pretendard-SemiBold.woff2 +0 -0
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./index-
|
|
3
|
+
runner
|
|
4
|
+
} from "./index-2yn3r67f.js";
|
|
5
|
+
import {
|
|
6
|
+
AppExecutor2
|
|
7
|
+
} from "./index-z92zm3wd.js";
|
|
8
|
+
import {
|
|
9
|
+
jsonText,
|
|
10
|
+
workflowStatus,
|
|
11
|
+
createWorkflowBaselineSummary,
|
|
12
|
+
buildAkanModuleContextIndex,
|
|
13
|
+
toolingRolloutGate
|
|
14
|
+
} from "./index-zmd9xxgd.js";
|
|
5
15
|
import {
|
|
6
16
|
buildResourceList,
|
|
7
17
|
codexMcpConfigPath,
|
|
@@ -11,46 +21,220 @@ import {
|
|
|
11
21
|
upsertCodexMcpServerBlock,
|
|
12
22
|
renderDoctorText,
|
|
13
23
|
AkanContextAnalyzer
|
|
14
|
-
} from "./index-
|
|
24
|
+
} from "./index-h901f24n.js";
|
|
15
25
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
createWorkflowBaselineSummary,
|
|
19
|
-
buildAkanModuleContextIndex,
|
|
20
|
-
toolingRolloutGate
|
|
21
|
-
} from "./index-2vgv7fs7.js";
|
|
22
|
-
import {
|
|
23
|
-
runner
|
|
24
|
-
} from "./index-exn38bzx.js";
|
|
26
|
+
Prompter2
|
|
27
|
+
} from "./index-knpm8sdm.js";
|
|
25
28
|
import {
|
|
26
29
|
NativeApp
|
|
27
|
-
} from "./index-
|
|
30
|
+
} from "./index-ebn9kgea.js";
|
|
28
31
|
import {
|
|
29
32
|
isPlaceholderAppId
|
|
30
|
-
} from "./index-
|
|
33
|
+
} from "./index-612fdtbk.js";
|
|
31
34
|
import {
|
|
32
35
|
getMobileTargets,
|
|
33
36
|
appIdsOf
|
|
34
37
|
} from "./index-m9jj544v.js";
|
|
35
|
-
import {
|
|
36
|
-
Prompter2
|
|
37
|
-
} from "./index-j6eeh5d7.js";
|
|
38
38
|
import {
|
|
39
39
|
WorkspaceGraph
|
|
40
|
-
} from "./index-
|
|
40
|
+
} from "./index-xs9a3ddt.js";
|
|
41
41
|
import {
|
|
42
42
|
RepairRunner
|
|
43
|
-
} from "./index-
|
|
43
|
+
} from "./index-kfvjzk8r.js";
|
|
44
44
|
import {
|
|
45
45
|
WorkflowRunner
|
|
46
|
-
} from "./index-
|
|
46
|
+
} from "./index-67sd09ag.js";
|
|
47
47
|
|
|
48
|
-
// pkgs/@akanjs/devkit/akanMcpContract.ts
|
|
48
|
+
// pkgs/@akanjs/devkit/context/akanMcpContract.ts
|
|
49
49
|
import { lstatSync, realpathSync } from "fs";
|
|
50
50
|
import path from "path";
|
|
51
51
|
import { isRecord } from "akanjs/common";
|
|
52
52
|
|
|
53
|
-
// pkgs/@akanjs/devkit/
|
|
53
|
+
// pkgs/@akanjs/devkit/context/akanContextInspection.ts
|
|
54
|
+
var inspectDiagnostic = (severity, code, message) => ({ severity, code, message });
|
|
55
|
+
var moduleEvidence = (module) => ({
|
|
56
|
+
kind: "module",
|
|
57
|
+
target: `${module.sysName}:${module.name}`,
|
|
58
|
+
path: module.path,
|
|
59
|
+
summary: `${module.kind} module at ${module.path} with ${module.files.length} source file(s).`
|
|
60
|
+
});
|
|
61
|
+
var moduleCandidate = (module) => ({
|
|
62
|
+
app: module.sysName,
|
|
63
|
+
sysType: module.sysType,
|
|
64
|
+
module: module.name,
|
|
65
|
+
kind: module.kind,
|
|
66
|
+
path: module.path,
|
|
67
|
+
files: module.files
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
class AkanContextInspection {
|
|
71
|
+
#workspace;
|
|
72
|
+
#question;
|
|
73
|
+
#diagnostics = [];
|
|
74
|
+
constructor(workspace, props) {
|
|
75
|
+
this.#workspace = workspace;
|
|
76
|
+
this.#question = props.question;
|
|
77
|
+
if (props.draft.type !== props.request.type) {
|
|
78
|
+
this.#diagnostics.push(inspectDiagnostic("warning", "inspect-draft-request-mismatch", `Draft chose ${props.draft.type}, but request uses ${props.request.type}.`));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
escape(request) {
|
|
82
|
+
return this.#result("escape", [{ kind: "escape", summary: request.reason }], {
|
|
83
|
+
action: "escape",
|
|
84
|
+
reason: request.reason,
|
|
85
|
+
...request.nextStep ? { args: { nextStep: request.nextStep } } : {}
|
|
86
|
+
}, { reason: request.reason, nextStep: request.nextStep ?? null });
|
|
87
|
+
}
|
|
88
|
+
async workflowDiagnostics(request, artifactPath) {
|
|
89
|
+
const doctor = await AkanContextAnalyzer.doctor(this.#workspace, {
|
|
90
|
+
strict: true,
|
|
91
|
+
runIdOrPlan: artifactPath
|
|
92
|
+
});
|
|
93
|
+
const toWorkflowDiagnostic = ({ severity, code, message, scope }, context) => ({ severity, code, message, scope, context });
|
|
94
|
+
const baselineSummary = createWorkflowBaselineSummary((doctor.baselineDiagnostics ?? []).map((diagnostic) => toWorkflowDiagnostic(diagnostic, diagnostic.context)), { detailsIncluded: false });
|
|
95
|
+
this.#diagnostics.push(...(doctor.workflowDiagnostics ?? doctor.diagnostics).map((diagnostic) => toWorkflowDiagnostic(diagnostic, {
|
|
96
|
+
...diagnostic.context,
|
|
97
|
+
...diagnostic.path ? { paths: [diagnostic.path] } : {}
|
|
98
|
+
})));
|
|
99
|
+
return this.#result("workflowDiagnostics", [
|
|
100
|
+
{
|
|
101
|
+
kind: "workflow",
|
|
102
|
+
target: request.runIdOrPlan,
|
|
103
|
+
summary: `Workflow diagnostics status is ${doctor.status}.`
|
|
104
|
+
}
|
|
105
|
+
], {
|
|
106
|
+
action: doctor.status === "passed" ? "answer" : "validate",
|
|
107
|
+
reason: doctor.status === "passed" ? "No strict workspace diagnostics were found for the workflow context." : "Review diagnostics before applying or manually editing source files."
|
|
108
|
+
}, {
|
|
109
|
+
status: doctor.status,
|
|
110
|
+
baselineSummary,
|
|
111
|
+
baselineDiagnostics: 0,
|
|
112
|
+
workflowDiagnostics: doctor.workflowDiagnostics?.length ?? 0
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
async workspaceOverview() {
|
|
116
|
+
const context = await AkanContextAnalyzer.analyze(this.#workspace, {
|
|
117
|
+
app: null,
|
|
118
|
+
module: null,
|
|
119
|
+
includeAbstractContent: false
|
|
120
|
+
});
|
|
121
|
+
return this.#result("workspaceOverview", [
|
|
122
|
+
{
|
|
123
|
+
kind: "workspace",
|
|
124
|
+
summary: `${context.repoName} has ${context.apps.length} app(s), ${context.libs.length} lib(s), and ${context.pkgs.length} package(s).`
|
|
125
|
+
}
|
|
126
|
+
], {
|
|
127
|
+
action: "inspect",
|
|
128
|
+
reason: "Choose moduleContext or fieldInsertionContext for module-scoped evidence before planning a workflow.",
|
|
129
|
+
tool: "inspect_akan_context"
|
|
130
|
+
}, {
|
|
131
|
+
repoName: context.repoName,
|
|
132
|
+
apps: context.apps.map((app) => ({ name: app.name, path: app.path, modules: app.modules.length })),
|
|
133
|
+
libs: context.libs.map((lib) => ({ name: lib.name, path: lib.path, modules: lib.modules.length })),
|
|
134
|
+
pkgs: context.pkgs.map((pkg) => ({ name: pkg.name, path: pkg.path, version: pkg.version ?? null })),
|
|
135
|
+
generatedFiles: context.generatedFiles,
|
|
136
|
+
validationCommands: context.validationCommands
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
async moduleContext(request) {
|
|
140
|
+
const modules = await this.#matchingModules(request);
|
|
141
|
+
const unresolved = this.#unresolvedModule(request, modules);
|
|
142
|
+
if (unresolved)
|
|
143
|
+
return unresolved;
|
|
144
|
+
const module = modules[0];
|
|
145
|
+
return this.#result("moduleContext", [moduleEvidence(module)], {
|
|
146
|
+
action: "inspect",
|
|
147
|
+
reason: "Use fieldInsertionContext when preparing add-field or escape when source body details are required.",
|
|
148
|
+
tool: "inspect_akan_context"
|
|
149
|
+
}, { module: moduleCandidate(module) });
|
|
150
|
+
}
|
|
151
|
+
async fieldInsertionContext(request) {
|
|
152
|
+
const modules = await this.#matchingModules(request);
|
|
153
|
+
const unresolved = this.#unresolvedModule(request, modules);
|
|
154
|
+
if (unresolved)
|
|
155
|
+
return unresolved;
|
|
156
|
+
const module = modules[0];
|
|
157
|
+
if (module.kind !== "domain") {
|
|
158
|
+
this.#diagnostics.push(inspectDiagnostic("error", "field-insertion-unsupported-module-kind", `fieldInsertionContext currently targets domain modules; ${module.sysName}:${module.name} is ${module.kind}.`));
|
|
159
|
+
}
|
|
160
|
+
const moduleIndex = await buildAkanModuleContextIndex(this.#workspace, module, { field: request.field });
|
|
161
|
+
this.#diagnostics.push(...moduleIndex.diagnostics);
|
|
162
|
+
return this.#result("fieldInsertionContext", [
|
|
163
|
+
moduleEvidence(module),
|
|
164
|
+
{
|
|
165
|
+
kind: "field-insertion",
|
|
166
|
+
target: `${module.sysName}:${module.name}.${request.field}`,
|
|
167
|
+
path: module.path,
|
|
168
|
+
summary: "M2 returns source-body-free AST index evidence for constant fields, dictionary model labels, and light projection fields."
|
|
169
|
+
}
|
|
170
|
+
], module.kind === "domain" ? {
|
|
171
|
+
action: "plan_workflow",
|
|
172
|
+
reason: "The module target is unambiguous; create an add-field workflow plan before source edits.",
|
|
173
|
+
tool: "plan_workflow",
|
|
174
|
+
args: {
|
|
175
|
+
workflow: "add-field",
|
|
176
|
+
inputs: {
|
|
177
|
+
app: module.sysName,
|
|
178
|
+
module: module.name,
|
|
179
|
+
field: request.field,
|
|
180
|
+
type: request.fieldType
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
} : {
|
|
184
|
+
action: "escape",
|
|
185
|
+
reason: "This module kind is not a supported add-field target in the P1 context contract."
|
|
186
|
+
}, {
|
|
187
|
+
target: {
|
|
188
|
+
app: module.sysName,
|
|
189
|
+
module: module.name,
|
|
190
|
+
field: request.field,
|
|
191
|
+
fieldType: request.fieldType
|
|
192
|
+
},
|
|
193
|
+
files: moduleIndex.files,
|
|
194
|
+
moduleIndex
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
async#matchingModules(request) {
|
|
198
|
+
const context = await AkanContextAnalyzer.analyze(this.#workspace, {
|
|
199
|
+
app: request.app ?? null,
|
|
200
|
+
module: request.module ?? null,
|
|
201
|
+
includeAbstractContent: false
|
|
202
|
+
});
|
|
203
|
+
return AkanContextAnalyzer.findModules(context, request.module, {
|
|
204
|
+
app: request.app ?? null
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
#unresolvedModule(request, modules) {
|
|
208
|
+
if (modules.length === 0) {
|
|
209
|
+
this.#diagnostics.push(inspectDiagnostic("error", "inspect-module-not-found", `No module matched ${request.app ? `${request.app}:` : ""}${request.module}.`));
|
|
210
|
+
return this.#result(request.type, [], {
|
|
211
|
+
action: "escape",
|
|
212
|
+
reason: "The requested module was not found in the workspace index; inspect workspace files or clarify the target."
|
|
213
|
+
}, { candidates: [] });
|
|
214
|
+
}
|
|
215
|
+
if (!request.app && modules.length > 1) {
|
|
216
|
+
this.#diagnostics.push(inspectDiagnostic("error", "inspect-module-ambiguous", `Multiple modules match "${request.module}". Re-run with app to disambiguate.`));
|
|
217
|
+
return this.#result(request.type, modules.map(moduleEvidence), {
|
|
218
|
+
action: "clarify",
|
|
219
|
+
reason: "Multiple modules have the same name; choose an app before planning a workflow."
|
|
220
|
+
}, { candidates: modules.map(moduleCandidate) });
|
|
221
|
+
}
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
#result(type, evidence, next, data) {
|
|
225
|
+
return {
|
|
226
|
+
schemaVersion: 1,
|
|
227
|
+
type,
|
|
228
|
+
question: this.#question,
|
|
229
|
+
diagnostics: this.#diagnostics,
|
|
230
|
+
evidence,
|
|
231
|
+
next,
|
|
232
|
+
...data ? { data } : {}
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// pkgs/@akanjs/devkit/context/akanMcpToolError.ts
|
|
54
238
|
import { AkanError } from "akanjs/base";
|
|
55
239
|
|
|
56
240
|
class AkanMcpToolError extends AkanError {
|
|
@@ -62,7 +246,7 @@ class AkanMcpToolError extends AkanError {
|
|
|
62
246
|
}
|
|
63
247
|
}
|
|
64
248
|
|
|
65
|
-
// pkgs/@akanjs/devkit/akanMcpContract.ts
|
|
249
|
+
// pkgs/@akanjs/devkit/context/akanMcpContract.ts
|
|
66
250
|
var emptySchema = { type: "object", properties: {} };
|
|
67
251
|
var stringProperty = { type: "string" };
|
|
68
252
|
var booleanProperty = { type: "boolean" };
|
|
@@ -271,21 +455,6 @@ var inspectAkanContextPropsArg = (args) => {
|
|
|
271
455
|
request: { type: "escape", reason: stringArg(request, "reason"), nextStep: optionalString(request, "nextStep") }
|
|
272
456
|
};
|
|
273
457
|
};
|
|
274
|
-
var inspectDiagnostic = (severity, code, message) => ({ severity, code, message });
|
|
275
|
-
var moduleEvidence = (module) => ({
|
|
276
|
-
kind: "module",
|
|
277
|
-
target: `${module.sysName}:${module.name}`,
|
|
278
|
-
path: module.path,
|
|
279
|
-
summary: `${module.kind} module at ${module.path} with ${module.files.length} source file(s).`
|
|
280
|
-
});
|
|
281
|
-
var moduleCandidate = (module) => ({
|
|
282
|
-
app: module.sysName,
|
|
283
|
-
sysType: module.sysType,
|
|
284
|
-
module: module.name,
|
|
285
|
-
kind: module.kind,
|
|
286
|
-
path: module.path,
|
|
287
|
-
files: module.files
|
|
288
|
-
});
|
|
289
458
|
var readonlyMcpTools = [
|
|
290
459
|
{
|
|
291
460
|
name: "inspect_akan_context",
|
|
@@ -472,142 +641,17 @@ var createAkanValidationContract = (listTools = listAkanMcpTools) => ({
|
|
|
472
641
|
});
|
|
473
642
|
var inspectAkanContext = async (workspace, args) => {
|
|
474
643
|
const props = inspectAkanContextPropsArg(args);
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
...data ? { data } : {}
|
|
487
|
-
});
|
|
488
|
-
if (props.request.type === "escape") {
|
|
489
|
-
return baseResult("escape", [{ kind: "escape", summary: props.request.reason }], {
|
|
490
|
-
action: "escape",
|
|
491
|
-
reason: props.request.reason,
|
|
492
|
-
...props.request.nextStep ? { args: { nextStep: props.request.nextStep } } : {}
|
|
493
|
-
}, { reason: props.request.reason, nextStep: props.request.nextStep ?? null });
|
|
494
|
-
}
|
|
495
|
-
if (props.request.type === "workflowDiagnostics") {
|
|
496
|
-
const doctor = await AkanContextAnalyzer.doctor(workspace, {
|
|
497
|
-
strict: true,
|
|
498
|
-
runIdOrPlan: workflowArtifactPath(workspace, props.request.runIdOrPlan)
|
|
499
|
-
});
|
|
500
|
-
const toWorkflowDiagnostic = ({ severity, code, message, scope }, context) => ({ severity, code, message, scope, context });
|
|
501
|
-
const baselineSummary = createWorkflowBaselineSummary((doctor.baselineDiagnostics ?? []).map((diagnostic) => toWorkflowDiagnostic(diagnostic, diagnostic.context)), { detailsIncluded: false });
|
|
502
|
-
diagnostics.push(...(doctor.workflowDiagnostics ?? doctor.diagnostics).map((diagnostic) => toWorkflowDiagnostic(diagnostic, {
|
|
503
|
-
...diagnostic.context,
|
|
504
|
-
...diagnostic.path ? { paths: [diagnostic.path] } : {}
|
|
505
|
-
})));
|
|
506
|
-
return baseResult("workflowDiagnostics", [
|
|
507
|
-
{
|
|
508
|
-
kind: "workflow",
|
|
509
|
-
target: props.request.runIdOrPlan,
|
|
510
|
-
summary: `Workflow diagnostics status is ${doctor.status}.`
|
|
511
|
-
}
|
|
512
|
-
], {
|
|
513
|
-
action: doctor.status === "passed" ? "answer" : "validate",
|
|
514
|
-
reason: doctor.status === "passed" ? "No strict workspace diagnostics were found for the workflow context." : "Review diagnostics before applying or manually editing source files."
|
|
515
|
-
}, {
|
|
516
|
-
status: doctor.status,
|
|
517
|
-
baselineSummary,
|
|
518
|
-
baselineDiagnostics: 0,
|
|
519
|
-
workflowDiagnostics: doctor.workflowDiagnostics?.length ?? 0
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
const moduleRequest = props.request.type === "moduleContext" || props.request.type === "fieldInsertionContext" ? props.request : null;
|
|
523
|
-
const context = await AkanContextAnalyzer.analyze(workspace, {
|
|
524
|
-
app: moduleRequest?.app ?? null,
|
|
525
|
-
module: moduleRequest?.module ?? null,
|
|
526
|
-
includeAbstractContent: false
|
|
527
|
-
});
|
|
528
|
-
if (props.request.type === "workspaceOverview") {
|
|
529
|
-
return baseResult("workspaceOverview", [
|
|
530
|
-
{
|
|
531
|
-
kind: "workspace",
|
|
532
|
-
summary: `${context.repoName} has ${context.apps.length} app(s), ${context.libs.length} lib(s), and ${context.pkgs.length} package(s).`
|
|
533
|
-
}
|
|
534
|
-
], {
|
|
535
|
-
action: "inspect",
|
|
536
|
-
reason: "Choose moduleContext or fieldInsertionContext for module-scoped evidence before planning a workflow.",
|
|
537
|
-
tool: "inspect_akan_context"
|
|
538
|
-
}, {
|
|
539
|
-
repoName: context.repoName,
|
|
540
|
-
apps: context.apps.map((app) => ({ name: app.name, path: app.path, modules: app.modules.length })),
|
|
541
|
-
libs: context.libs.map((lib) => ({ name: lib.name, path: lib.path, modules: lib.modules.length })),
|
|
542
|
-
pkgs: context.pkgs.map((pkg) => ({ name: pkg.name, path: pkg.path, version: pkg.version ?? null })),
|
|
543
|
-
generatedFiles: context.generatedFiles,
|
|
544
|
-
validationCommands: context.validationCommands
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
const modules = AkanContextAnalyzer.findModules(context, props.request.module, {
|
|
548
|
-
app: props.request.app ?? null
|
|
549
|
-
});
|
|
550
|
-
if (modules.length === 0) {
|
|
551
|
-
diagnostics.push(inspectDiagnostic("error", "inspect-module-not-found", `No module matched ${props.request.app ? `${props.request.app}:` : ""}${props.request.module}.`));
|
|
552
|
-
return baseResult(props.request.type, [], {
|
|
553
|
-
action: "escape",
|
|
554
|
-
reason: "The requested module was not found in the workspace index; inspect workspace files or clarify the target."
|
|
555
|
-
}, { candidates: [] });
|
|
556
|
-
}
|
|
557
|
-
if (!props.request.app && modules.length > 1) {
|
|
558
|
-
diagnostics.push(inspectDiagnostic("error", "inspect-module-ambiguous", `Multiple modules match "${props.request.module}". Re-run with app to disambiguate.`));
|
|
559
|
-
return baseResult(props.request.type, modules.map(moduleEvidence), {
|
|
560
|
-
action: "clarify",
|
|
561
|
-
reason: "Multiple modules have the same name; choose an app before planning a workflow."
|
|
562
|
-
}, { candidates: modules.map(moduleCandidate) });
|
|
563
|
-
}
|
|
564
|
-
const module = modules[0];
|
|
565
|
-
if (props.request.type === "moduleContext") {
|
|
566
|
-
return baseResult("moduleContext", [moduleEvidence(module)], {
|
|
567
|
-
action: "inspect",
|
|
568
|
-
reason: "Use fieldInsertionContext when preparing add-field or escape when source body details are required.",
|
|
569
|
-
tool: "inspect_akan_context"
|
|
570
|
-
}, { module: moduleCandidate(module) });
|
|
571
|
-
}
|
|
572
|
-
if (module.kind !== "domain") {
|
|
573
|
-
diagnostics.push(inspectDiagnostic("error", "field-insertion-unsupported-module-kind", `fieldInsertionContext currently targets domain modules; ${module.sysName}:${module.name} is ${module.kind}.`));
|
|
574
|
-
}
|
|
575
|
-
const moduleIndex = await buildAkanModuleContextIndex(workspace, module, { field: props.request.field });
|
|
576
|
-
diagnostics.push(...moduleIndex.diagnostics);
|
|
577
|
-
return baseResult("fieldInsertionContext", [
|
|
578
|
-
moduleEvidence(module),
|
|
579
|
-
{
|
|
580
|
-
kind: "field-insertion",
|
|
581
|
-
target: `${module.sysName}:${module.name}.${props.request.field}`,
|
|
582
|
-
path: module.path,
|
|
583
|
-
summary: "M2 returns source-body-free AST index evidence for constant fields, dictionary model labels, and light projection fields."
|
|
584
|
-
}
|
|
585
|
-
], module.kind === "domain" ? {
|
|
586
|
-
action: "plan_workflow",
|
|
587
|
-
reason: "The module target is unambiguous; create an add-field workflow plan before source edits.",
|
|
588
|
-
tool: "plan_workflow",
|
|
589
|
-
args: {
|
|
590
|
-
workflow: "add-field",
|
|
591
|
-
inputs: {
|
|
592
|
-
app: module.sysName,
|
|
593
|
-
module: module.name,
|
|
594
|
-
field: props.request.field,
|
|
595
|
-
type: props.request.fieldType
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
} : {
|
|
599
|
-
action: "escape",
|
|
600
|
-
reason: "This module kind is not a supported add-field target in the P1 context contract."
|
|
601
|
-
}, {
|
|
602
|
-
target: {
|
|
603
|
-
app: module.sysName,
|
|
604
|
-
module: module.name,
|
|
605
|
-
field: props.request.field,
|
|
606
|
-
fieldType: props.request.fieldType
|
|
607
|
-
},
|
|
608
|
-
files: moduleIndex.files,
|
|
609
|
-
moduleIndex
|
|
610
|
-
});
|
|
644
|
+
const inspection = new AkanContextInspection(workspace, props);
|
|
645
|
+
const { request } = props;
|
|
646
|
+
if (request.type === "escape")
|
|
647
|
+
return inspection.escape(request);
|
|
648
|
+
if (request.type === "workflowDiagnostics")
|
|
649
|
+
return await inspection.workflowDiagnostics(request, workflowArtifactPath(workspace, request.runIdOrPlan));
|
|
650
|
+
if (request.type === "workspaceOverview")
|
|
651
|
+
return await inspection.workspaceOverview();
|
|
652
|
+
if (request.type === "moduleContext")
|
|
653
|
+
return await inspection.moduleContext(request);
|
|
654
|
+
return await inspection.fieldInsertionContext(request);
|
|
611
655
|
};
|
|
612
656
|
|
|
613
657
|
// pkgs/@akanjs/cli/context/context.runner.ts
|
|
@@ -672,7 +716,7 @@ class ContextRunner2 extends runner("context") {
|
|
|
672
716
|
const diagnostics = [];
|
|
673
717
|
let toolchainChecked = false;
|
|
674
718
|
for (const appName of appNames) {
|
|
675
|
-
const app =
|
|
719
|
+
const app = AppExecutor2.from(workspace, appName);
|
|
676
720
|
const config = await app.getConfig();
|
|
677
721
|
if (!config.hasNativeConfig)
|
|
678
722
|
continue;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
AppInfo
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-71y6176j.js";
|
|
5
5
|
|
|
6
|
-
// pkgs/@akanjs/devkit/slicePlanner.ts
|
|
6
|
+
// pkgs/@akanjs/devkit/workspace/slicePlanner.ts
|
|
7
7
|
class SlicePlanner {
|
|
8
8
|
static memberDirs = ["apps", "libs", "pkgs"];
|
|
9
9
|
static toolchainDependencies = [
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script,
|
|
5
|
+
WorkspaceVersionCheck,
|
|
5
6
|
markCliErrorPrinted
|
|
6
|
-
} from "./index-
|
|
7
|
+
} from "./index-2yn3r67f.js";
|
|
7
8
|
import {
|
|
8
9
|
CliError
|
|
9
10
|
} from "./index-j4yvgfhr.js";
|
|
@@ -14,41 +15,45 @@ import {
|
|
|
14
15
|
readDevkitVersion,
|
|
15
16
|
upsertAgentBlock,
|
|
16
17
|
renderRecipeEntries,
|
|
17
|
-
CLAUDE_COMMENT_RULE
|
|
18
|
-
|
|
19
|
-
LibExecutor
|
|
20
|
-
} from "./index-3ghdb7p5.js";
|
|
18
|
+
CLAUDE_COMMENT_RULE
|
|
19
|
+
} from "./index-71y6176j.js";
|
|
21
20
|
import {
|
|
22
|
-
|
|
23
|
-
} from "./index-
|
|
21
|
+
AppExecutor2
|
|
22
|
+
} from "./index-z92zm3wd.js";
|
|
24
23
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} from "./index-j6eeh5d7.js";
|
|
24
|
+
LibExecutor2
|
|
25
|
+
} from "./index-zfnz878d.js";
|
|
28
26
|
import {
|
|
29
27
|
AkanContextAnalyzer
|
|
30
|
-
} from "./index-
|
|
28
|
+
} from "./index-h901f24n.js";
|
|
31
29
|
import {
|
|
32
30
|
collectRecipeSources2,
|
|
33
31
|
scanRecipes2
|
|
34
|
-
} from "./index-
|
|
32
|
+
} from "./index-1p81ecbz.js";
|
|
33
|
+
import {
|
|
34
|
+
akanCodePaths2
|
|
35
|
+
} from "./index-p5zh7pmc.js";
|
|
36
|
+
import {
|
|
37
|
+
ConventionSet,
|
|
38
|
+
Prompter2
|
|
39
|
+
} from "./index-knpm8sdm.js";
|
|
35
40
|
import {
|
|
36
41
|
ApplicationRunner,
|
|
37
42
|
VerifyScope
|
|
38
|
-
} from "./index-
|
|
43
|
+
} from "./index-z96ks033.js";
|
|
39
44
|
import {
|
|
40
45
|
WorkspaceRunner
|
|
41
|
-
} from "./index-
|
|
46
|
+
} from "./index-78y75t0a.js";
|
|
42
47
|
import {
|
|
43
48
|
VerifyComments,
|
|
44
49
|
VerifyPipeline,
|
|
45
50
|
VerifyReport
|
|
46
|
-
} from "./index-
|
|
51
|
+
} from "./index-ybcb9wc8.js";
|
|
47
52
|
|
|
48
53
|
// pkgs/@akanjs/cli/agent/agent.script.ts
|
|
49
54
|
import { Logger as Logger3 } from "akanjs/common";
|
|
50
55
|
|
|
51
|
-
// pkgs/@akanjs/devkit/agentAssets.ts
|
|
56
|
+
// pkgs/@akanjs/devkit/guideline/agentAssets.ts
|
|
52
57
|
import fsPromise from "fs/promises";
|
|
53
58
|
import path from "path";
|
|
54
59
|
class AgentAssets {
|
|
@@ -81,7 +86,7 @@ class AgentAssets {
|
|
|
81
86
|
"modelUtil",
|
|
82
87
|
"framework"
|
|
83
88
|
],
|
|
84
|
-
"akan-err": [],
|
|
89
|
+
"akan-err": ["errorCodes"],
|
|
85
90
|
"akan-deps": [],
|
|
86
91
|
"akan-debug": [],
|
|
87
92
|
"akan-page": ["pageRule", "akanApi"],
|
|
@@ -237,8 +242,10 @@ class AgentHook {
|
|
|
237
242
|
"{apps,libs}/*/{ui,webkit,srvkit,common,plugin}/index.ts"
|
|
238
243
|
];
|
|
239
244
|
#workspace;
|
|
240
|
-
|
|
245
|
+
#cliVersion;
|
|
246
|
+
constructor(workspace, { cliVersion = process.env.AKAN_VERSION } = {}) {
|
|
241
247
|
this.#workspace = workspace;
|
|
248
|
+
this.#cliVersion = cliVersion;
|
|
242
249
|
}
|
|
243
250
|
static isEvent(value) {
|
|
244
251
|
return AgentHook.events.some((event) => event === value);
|
|
@@ -274,14 +281,22 @@ class AgentHook {
|
|
|
274
281
|
return { ...existing, hooks };
|
|
275
282
|
}
|
|
276
283
|
async run(event, input) {
|
|
284
|
+
const file = event === "stop" ? null : this.#relative(input.tool_input?.file_path);
|
|
285
|
+
if (event === "pre-edit")
|
|
286
|
+
return file ? this.#preEdit(file) : { block: false, message: "" };
|
|
287
|
+
if (file)
|
|
288
|
+
await this.#record(input.session_id, file);
|
|
289
|
+
const refusal = WorkspaceVersionCheck.refusal(this.#cliVersion, ["bun", "akan", "verify"], this.#workspace.workspaceRoot);
|
|
290
|
+
if (refusal) {
|
|
291
|
+
process.stderr.write(`${refusal}
|
|
292
|
+
`);
|
|
293
|
+
return { block: false, message: refusal };
|
|
294
|
+
}
|
|
277
295
|
if (event === "stop")
|
|
278
296
|
return await this.#stop(input);
|
|
279
|
-
const file = this.#relative(input.tool_input?.file_path);
|
|
280
297
|
if (!file)
|
|
281
298
|
return { block: false, message: "" };
|
|
282
|
-
|
|
283
|
-
return this.#preEdit(file);
|
|
284
|
-
return await this.#postEdit(file, input.session_id);
|
|
299
|
+
return await this.#verify([file], { lintOnly: true });
|
|
285
300
|
}
|
|
286
301
|
#preEdit(file) {
|
|
287
302
|
const pattern = AgentHook.generated.find((glob) => new Bun.Glob(glob).match(file));
|
|
@@ -292,10 +307,6 @@ class AgentHook {
|
|
|
292
307
|
message: `${file} is generated (${pattern}). Edit the source file it is generated from, then run \`akan sync <app-or-lib>\`.`
|
|
293
308
|
};
|
|
294
309
|
}
|
|
295
|
-
async#postEdit(file, session) {
|
|
296
|
-
await this.#record(session, file);
|
|
297
|
-
return await this.#verify([file], { lintOnly: true });
|
|
298
|
-
}
|
|
299
310
|
async#stop(input) {
|
|
300
311
|
const ledger = this.#ledgerPath(input.session_id);
|
|
301
312
|
const files = await this.#workspace.exists(ledger) ? (await this.#workspace.readFile(ledger)).split(`
|
|
@@ -434,6 +445,21 @@ ${Object.keys(AgentAssets.skillReferences).map((name) => `\`${name}\``).join(",
|
|
|
434
445
|
guideline.
|
|
435
446
|
|
|
436
447
|
`;
|
|
448
|
+
var maxListedChars = 160;
|
|
449
|
+
var renderNames = (names) => {
|
|
450
|
+
if (!names.length)
|
|
451
|
+
return "none";
|
|
452
|
+
const shown = [];
|
|
453
|
+
let length = 0;
|
|
454
|
+
for (const name of names) {
|
|
455
|
+
if (shown.length && length + name.length > maxListedChars)
|
|
456
|
+
break;
|
|
457
|
+
shown.push(name);
|
|
458
|
+
length += name.length + 2;
|
|
459
|
+
}
|
|
460
|
+
const rest = names.length - shown.length;
|
|
461
|
+
return rest ? `${shown.join(", ")}, and ${rest} more` : shown.join(", ");
|
|
462
|
+
};
|
|
437
463
|
var renderManagedBlock = async (workspace) => {
|
|
438
464
|
const context = await AkanContextAnalyzer.analyze(workspace);
|
|
439
465
|
const conventions = await Prompter2.getConventionSet();
|
|
@@ -443,9 +469,9 @@ var renderManagedBlock = async (workspace) => {
|
|
|
443
469
|
const block = `## Workspace
|
|
444
470
|
|
|
445
471
|
- Repo: ${context.repoName}
|
|
446
|
-
- Apps: ${appNames
|
|
447
|
-
- Libraries: ${context.libs.map((lib) => lib.name)
|
|
448
|
-
- Packages: ${context.pkgs.map((pkg) => pkg.name)
|
|
472
|
+
- Apps: ${renderNames(appNames)}
|
|
473
|
+
- Libraries: ${renderNames(context.libs.map((lib) => lib.name))}
|
|
474
|
+
- Packages: ${renderNames(context.pkgs.map((pkg) => pkg.name))}
|
|
449
475
|
|
|
450
476
|
${conventions.core}
|
|
451
477
|
|
|
@@ -595,9 +621,9 @@ class AgentRunner extends runner("agent") {
|
|
|
595
621
|
}
|
|
596
622
|
};
|
|
597
623
|
for (const name of libNames)
|
|
598
|
-
await syncScope(
|
|
624
|
+
await syncScope(LibExecutor2.from(workspace, name));
|
|
599
625
|
for (const name of appNames)
|
|
600
|
-
await syncScope(
|
|
626
|
+
await syncScope(AppExecutor2.from(workspace, name));
|
|
601
627
|
return written;
|
|
602
628
|
}
|
|
603
629
|
}
|