@akanjs/cli 3.2.0-rc.18 → 3.2.0-rc.19
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-w96z7fm7.js → CodeAgent-q0xkt4at.js} +2 -2
- package/{CodeTui-496f55hh.js → CodeTui-n56kpaca.js} +819 -663
- package/TunnelShare-844s9te4.js +18 -0
- package/{agent.command-81h65wcv.js → agent.command-k07raqft.js} +20 -20
- package/akanCode.js +8 -8
- package/{appExecutor-g4wq24v1.js → appExecutor-xav1zemr.js} +3 -3
- package/{application.command-rcw4h1gh.js → application.command-dv8y8r12.js} +52 -25
- package/{applicationBuildRunner-emhp6rh0.js → applicationBuildRunner-vhx7zq97.js} +9 -10
- package/buildBatch.proc.js +20 -11
- package/{cloud.command-k47h3kma.js → cloud.command-0vjy3x96.js} +22 -22
- package/cloud.script-jp48r0kw.js +35 -0
- package/{code.command-dam01a2f.js → code.command-xc5exq4b.js} +10 -10
- package/{context.command-44carkt5.js → context.command-etsat8yk.js} +22 -22
- package/context.runner-e52ak0cx.js +34 -0
- package/{guideline.command-ccxs69br.js → guideline.command-zqkntk7b.js} +6 -6
- package/guidelines/agentRule/agentRule.instruction.md +5 -4
- package/guidelines/conventions/core.md +18 -0
- package/guidelines/errorCodes/errorCodes.instruction.md +6 -0
- package/guidelines/mcpRule/mcpRule.instruction.md +4 -2
- package/guidelines/transportRule/transportRule.instruction.md +3 -1
- package/incrementalBuilder.proc.js +559 -409
- package/{index-aw7at6j6.js → index-12js5pj4.js} +1 -1
- package/{index-tpr9nqkj.js → index-12vv4g80.js} +1 -1
- package/index-4zqebbqb.js +80 -0
- package/{index-rxxjkbj2.js → index-6bryy19d.js} +499 -421
- package/{index-2hwjhe8r.js → index-6pzncry1.js} +4 -4
- package/{index-jeqq717b.js → index-6rrh0ffr.js} +44 -32
- package/{index-a42cf737.js → index-7jr9mfp2.js} +235 -105
- package/{index-pcqr0r0m.js → index-81qt1jyj.js} +1 -1
- package/{index-2mrn1mrg.js → index-9f3reh2y.js} +1 -1
- package/{index-h9356zmz.js → index-a05ewnnp.js} +1 -1
- package/{index-ptpdd9hw.js → index-bxevbjw7.js} +8 -8
- package/{index-g95rbz83.js → index-c1vym3gx.js} +2 -2
- package/{index-vh8q7mrq.js → index-c9hd79py.js} +4 -4
- package/{index-wy7qcqsd.js → index-c9mnfy9r.js} +38 -23
- package/{index-a85n83t6.js → index-cc9pevta.js} +1 -1
- package/{index-4279crca.js → index-cet2s7xk.js} +2 -2
- package/{index-k1p29hdp.js → index-dasa0kbj.js} +2 -2
- package/{index-y27cxjd6.js → index-ddc2zjj5.js} +1 -1
- package/{index-r790hx48.js → index-dz7z9n9t.js} +25 -25
- package/{index-mgvvtjp1.js → index-e4vna9dn.js} +4 -4
- package/{index-ggmwp14t.js → index-ean2tff1.js} +723 -691
- package/{index-s21zxj7p.js → index-fgp04fh7.js} +6 -6
- package/{index-cef0fxf2.js → index-g541mhzw.js} +3 -3
- package/{index-rj406y9n.js → index-gh741qft.js} +8 -8
- package/{index-sa8g94se.js → index-k51718xz.js} +2138 -2138
- package/{index-286djj0d.js → index-m6r3pvf5.js} +2 -2
- package/{index-kqf2s304.js → index-my17308p.js} +7 -7
- package/{index-pqf6d5ff.js → index-nd8bq17n.js} +6 -6
- package/{index-her656ng.js → index-nxcmgqk3.js} +3 -3
- package/{index-gd9tkq2k.js → index-pkgha3rt.js} +5 -5
- package/{index-tkrg58qv.js → index-q2t2w996.js} +1 -1
- package/{index-b061e6fn.js → index-qtqhsb33.js} +204 -160
- package/{index-nwbdpnna.js → index-rj2n5kfk.js} +67 -67
- package/{index-ktvyva62.js → index-s5gvwvkb.js} +103 -138
- package/{index-bbd1727m.js → index-sh3yzse2.js} +8 -7
- package/{index-y71v7grx.js → index-syn4vm3y.js} +1 -1
- package/{index-gkfpqdm8.js → index-t00xrkey.js} +1 -1
- package/{index-hw2eammf.js → index-v72mh89f.js} +5 -6
- package/{index-qrh7kdb1.js → index-wq8pnev4.js} +3 -3
- package/{index-1j1jmmac.js → index-wxr3941g.js} +8 -8
- package/{index-e4w015qt.js → index-y8mqkhcf.js} +1 -1
- package/{index-ctrx7asj.js → index-zk1gjk46.js} +4 -4
- package/index.js +27 -27
- package/{libExecutor-mmrzd606.js → libExecutor-mr3vxtnr.js} +2 -2
- package/{library.command-brkcat13.js → library.command-ps9q5t37.js} +7 -7
- package/{localRegistry.command-qwzy3t7w.js → localRegistry.command-rszxmvd0.js} +21 -21
- package/{module.command-t5emqxkr.js → module.command-fcybnn1a.js} +10 -10
- package/{package.command-xv04dbxf.js → package.command-zen3rhye.js} +10 -10
- package/package.json +2 -2
- package/{page.command-yhgq9tj8.js → page.command-gwrxymms.js} +7 -7
- package/{pipeline.command-x3nkf9kc.js → pipeline.command-m1brkqqw.js} +6 -6
- package/{pkgExecutor-4cbe3sgr.js → pkgExecutor-x51agavp.js} +2 -2
- package/{primitive.command-jv60b759.js → primitive.command-5vkxvvmk.js} +11 -11
- package/{projectTypecheck-fbfq9rm9.js → projectTypecheck-9dzfah37.js} +1 -1
- package/{quality.command-mdjardf1.js → quality.command-gqry7eas.js} +9 -9
- package/{repair.command-s22j5xbe.js → repair.command-qs4ejcrg.js} +10 -10
- package/{scalar.command-a6qs7012.js → scalar.command-ny0vchqq.js} +9 -9
- package/skills/akan-scaffold/SKILL.md +1 -1
- package/{subspace.command-26hkjqf9.js → subspace.command-5pxqjgmw.js} +12 -12
- package/templates/workspaceRoot/AGENTS.md.template +2 -1
- package/{tunnel.command-83sfgz5z.js → tunnel.command-ndajt0xk.js} +11 -11
- package/{verify.command-krm1rrf1.js → verify.command-m59ashc7.js} +17 -17
- package/{workflow.command-z05y7amj.js → workflow.command-jchqey88.js} +15 -15
- package/{workspace.command-qga6cn1n.js → workspace.command-g0gzxkpd.js} +36 -36
- package/TunnelShare-tyj8nb0z.js +0 -19
- package/cloud.script-b4smdpa5.js +0 -35
- package/context.runner-xtr9ngpa.js +0 -34
- package/index-k2kr1wd4.js +0 -18
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-sh3yzse2.js";
|
|
6
6
|
import {
|
|
7
7
|
generatedFilesForSync,
|
|
8
8
|
createPassedPrimitiveReport,
|
|
9
9
|
scalarChangedFiles
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-ean2tff1.js";
|
|
11
11
|
import {
|
|
12
12
|
pluralizeName
|
|
13
13
|
} from "./index-nz8prx9g.js";
|
|
@@ -4,27 +4,27 @@ import {
|
|
|
4
4
|
CloudApi,
|
|
5
5
|
CloudUpdates,
|
|
6
6
|
PipelineSecrets
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-c1vym3gx.js";
|
|
8
8
|
import {
|
|
9
9
|
PkgExecutor2
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-cc9pevta.js";
|
|
11
11
|
import {
|
|
12
12
|
UpdatePackFolder,
|
|
13
13
|
NativePublicEnv,
|
|
14
14
|
NativeApp
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-wq8pnev4.js";
|
|
16
16
|
import {
|
|
17
17
|
script
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-sh3yzse2.js";
|
|
19
19
|
import {
|
|
20
20
|
ApplicationScript
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-6rrh0ffr.js";
|
|
22
22
|
import {
|
|
23
23
|
PackageScript
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-e4vna9dn.js";
|
|
25
25
|
import {
|
|
26
26
|
CloudRunner
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-pkgha3rt.js";
|
|
28
28
|
|
|
29
29
|
// pkgs/@akanjs/cli/cloud/cloud.script.ts
|
|
30
30
|
import { Logger } from "akanjs/common";
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
ApplicationBuildReporter
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-s5gvwvkb.js";
|
|
5
5
|
import {
|
|
6
6
|
parseBiomeReport,
|
|
7
7
|
Linter,
|
|
8
8
|
ProjectTypecheck2
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-v72mh89f.js";
|
|
10
10
|
import {
|
|
11
11
|
TypecheckFailure
|
|
12
12
|
} from "./index-j4yvgfhr.js";
|
|
13
13
|
import {
|
|
14
14
|
AppExecutor2
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-cet2s7xk.js";
|
|
16
16
|
import {
|
|
17
17
|
LibExecutor2
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-t00xrkey.js";
|
|
19
19
|
import {
|
|
20
20
|
PkgExecutor2
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-cc9pevta.js";
|
|
22
22
|
import {
|
|
23
23
|
WorkspaceRunner,
|
|
24
24
|
AkanQualityScanner
|
|
25
|
-
} from "./index-
|
|
25
|
+
} from "./index-fgp04fh7.js";
|
|
26
26
|
|
|
27
27
|
// pkgs/@akanjs/cli/verify/verifyComments.ts
|
|
28
28
|
import { existsSync } from "fs";
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-sh3yzse2.js";
|
|
6
6
|
import {
|
|
7
7
|
CommandExecutionError,
|
|
8
8
|
LibSource,
|
|
9
9
|
formatLibStatuses
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-v72mh89f.js";
|
|
11
11
|
import {
|
|
12
12
|
LibExecutor2
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-t00xrkey.js";
|
|
14
14
|
import {
|
|
15
15
|
assertPlainName
|
|
16
16
|
} from "./index-va90m8nd.js";
|
|
@@ -6,23 +6,23 @@ import {
|
|
|
6
6
|
CloudApi,
|
|
7
7
|
CloudUpdates,
|
|
8
8
|
PipelineSecrets
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-c1vym3gx.js";
|
|
10
10
|
import {
|
|
11
11
|
resolveMobileTargets
|
|
12
12
|
} from "./index-m9jj544v.js";
|
|
13
13
|
import {
|
|
14
14
|
WorkspaceExecutor
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-v72mh89f.js";
|
|
16
16
|
import {
|
|
17
17
|
AppExecutor2
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-cet2s7xk.js";
|
|
19
19
|
import {
|
|
20
20
|
NativeApp
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-wq8pnev4.js";
|
|
22
22
|
import {
|
|
23
23
|
runner,
|
|
24
24
|
assertPromptable
|
|
25
|
-
} from "./index-
|
|
25
|
+
} from "./index-sh3yzse2.js";
|
|
26
26
|
import {
|
|
27
27
|
getNpmRegistryUrl,
|
|
28
28
|
getPublishedVersions,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
runner
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-sh3yzse2.js";
|
|
5
5
|
import {
|
|
6
6
|
AppExecutor2
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-cet2s7xk.js";
|
|
8
8
|
import {
|
|
9
9
|
jsonText,
|
|
10
10
|
workflowStatus,
|
|
11
11
|
createWorkflowBaselineSummary,
|
|
12
12
|
buildAkanModuleContextIndex,
|
|
13
13
|
toolingRolloutGate
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-ean2tff1.js";
|
|
15
15
|
import {
|
|
16
16
|
buildResourceList,
|
|
17
17
|
codexMcpConfigPath,
|
|
@@ -21,35 +21,219 @@ import {
|
|
|
21
21
|
upsertCodexMcpServerBlock,
|
|
22
22
|
renderDoctorText,
|
|
23
23
|
AkanContextAnalyzer
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-6bryy19d.js";
|
|
25
25
|
import {
|
|
26
26
|
Prompter2
|
|
27
27
|
} from "./index-89x8tp7z.js";
|
|
28
28
|
import {
|
|
29
29
|
NativeApp
|
|
30
|
-
} from "./index-
|
|
30
|
+
} from "./index-wq8pnev4.js";
|
|
31
31
|
import {
|
|
32
32
|
isPlaceholderAppId
|
|
33
|
-
} from "./index-
|
|
33
|
+
} from "./index-12vv4g80.js";
|
|
34
34
|
import {
|
|
35
35
|
getMobileTargets,
|
|
36
36
|
appIdsOf
|
|
37
37
|
} from "./index-m9jj544v.js";
|
|
38
38
|
import {
|
|
39
39
|
WorkspaceGraph
|
|
40
|
-
} from "./index-
|
|
40
|
+
} from "./index-81qt1jyj.js";
|
|
41
41
|
import {
|
|
42
42
|
RepairRunner
|
|
43
|
-
} from "./index-
|
|
43
|
+
} from "./index-g541mhzw.js";
|
|
44
44
|
import {
|
|
45
45
|
WorkflowRunner
|
|
46
|
-
} from "./index-
|
|
46
|
+
} from "./index-gh741qft.js";
|
|
47
47
|
|
|
48
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/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
|
+
|
|
53
237
|
// pkgs/@akanjs/devkit/context/akanMcpToolError.ts
|
|
54
238
|
import { AkanError } from "akanjs/base";
|
|
55
239
|
|
|
@@ -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
|