@akanjs/cli 3.0.0-beta.2 → 3.0.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.build-stamp +1 -1
- package/CodeAgent-awv258wb.js +9 -0
- package/CodeAgentRpcHost-p7h6n2hp.js +7 -0
- package/CodeAgentRpcListener-7p7z5dd7.js +97 -0
- package/CodeTui-1nqh35ez.js +1457 -0
- package/README.md +3 -0
- package/TunnelShare-scf4e4pd.js +9 -0
- package/{agent.command-d2gfxfck.js → agent.command-1s9ag7sb.js} +8 -9
- package/akanCode.js +102 -0
- package/{application.command-pj2m7584.js → application.command-49hwy6va.js} +51 -78
- package/{applicationBuildRunner-kxwbssgn.js → applicationBuildRunner-ybyp97pv.js} +63 -64
- package/{applicationReleasePackager-4yasxwv9.js → applicationReleasePackager-esnrphw8.js} +40 -60
- package/buildBatch.proc.js +19 -24
- package/{capacitorApp-36rbr858.js → capacitorApp-1synz4en.js} +3 -4
- package/cloud.command-d7rqtzt9.js +94 -0
- package/cloud.script-bkbpcr96.js +19 -0
- package/code.command-nn48xzej.js +154 -0
- package/commandManifest.json +1 -1
- package/consoleToStderr-h5bryj94.js +7 -0
- package/context.command-s3mcmvpa.js +48 -0
- package/context.runner-k99nb5pk.js +21 -0
- package/{dependencyScanner-shs82ynp.js → dependencyScanner-ye2e6pdz.js} +2 -2
- package/{devTui-40ggmd99.js → devTui-q7k7bakd.js} +122 -40
- package/fileSys-5ngz93ga.js +9 -0
- package/guideline.command-sct4qnt5.js +42 -0
- package/guidelines/agentRule/agentRule.instruction.md +206 -25
- package/guidelines/conventions/conventions.instruction.md +79 -24
- package/guidelines/fieldRule/fieldRule.instruction.md +1 -0
- package/guidelines/mcpRule/mcpRule.instruction.md +7 -5
- package/guidelines/queryRule/queryRule.instruction.md +17 -7
- package/guidelines/runtimeRule/runtimeRule.instruction.md +74 -0
- package/guidelines/ssrRule/ssrRule.instruction.md +4 -2
- package/guidelines/transportRule/transportRule.instruction.md +51 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +66 -3
- package/incrementalBuilder.proc.js +31 -48
- package/{index-h7yw2z9n.js → index-0bq14vr1.js} +8 -14
- package/index-13ffe9wp.js +69 -0
- package/index-22d57v4c.js +266 -0
- package/{index-fz5q3gd7.js → index-31yr441d.js} +10 -17
- package/index-3hx1z96c.js +87 -0
- package/index-3sq321ak.js +53 -0
- package/{index-kcxmv48c.js → index-3t7g9e4r.js} +45 -79
- package/{index-q0y2jq9j.js → index-5b6tavv3.js} +6 -3
- package/{index-47pj3aee.js → index-5e0n4hqx.js} +11 -12
- package/{index-259dsnz3.js → index-5pc1qrbv.js} +5 -8
- package/index-7md2g9vw.js +6 -0
- package/index-8mna0947.js +187 -0
- package/{index-zry5nz81.js → index-8sf7wmdr.js} +51 -30
- package/{index-2tv3fdx4.js → index-9d9bgcx4.js} +342 -765
- package/index-9dp031by.js +12 -0
- package/{index-ne2qy0nk.js → index-ahemdr5n.js} +12 -12
- package/{index-ws5e0j51.js → index-as7xmyz8.js} +40 -24
- package/index-axzjaqve.js +1118 -0
- package/{index-3d9y066c.js → index-bjwxs904.js} +9 -8
- package/index-c6eggbee.js +123 -0
- package/index-d2242ksy.js +99 -0
- package/{index-a64esmtb.js → index-ddxvdd1p.js} +169 -305
- package/{index-92zztqy1.js → index-dy0jx9ay.js} +2 -17
- package/{index-pnqbkf5p.js → index-dzf3r49a.js} +6 -2
- package/{index-w8kmx1b6.js → index-fgq75haa.js} +198 -290
- package/{index-by5gpp8x.js → index-hj6w4ka1.js} +2 -1
- package/{index-hwkygn9s.js → index-khpfpcsd.js} +302 -33
- package/{index-wt7qrtd4.js → index-mxav6j3c.js} +93 -232
- package/{index-gyd220p2.js → index-myhc3c1j.js} +554 -577
- package/{index-600zhnve.js → index-nv5976x3.js} +56 -197
- package/index-p6pbz9n5.js +25 -0
- package/{index-4edzf1gr.js → index-przybvy5.js} +77 -150
- package/index-smme4r47.js +49 -0
- package/{index-mak3cd28.js → index-w2zdcw3k.js} +137 -255
- package/index-wa5jbxj1.js +760 -0
- package/{index-v0qh106m.js → index-ww4z397j.js} +527 -723
- package/{index-j9yhg404.js → index-xqjwd384.js} +4 -7
- package/{index-7737gxcp.js → index-xqpzbab5.js} +107 -241
- package/index-xsjh6nzh.js +2729 -0
- package/{index-ktb5njgy.js → index-ygn77a5w.js} +47 -99
- package/index-ztp3e73t.js +700 -0
- package/index.js +23 -22
- package/{library.command-nbsky672.js → library.command-1gx04jgn.js} +4 -5
- package/{localRegistry.command-yeq57wjr.js → localRegistry.command-zndxj1q6.js} +22 -42
- package/{module.command-29vqzrh8.js → module.command-3waddk95.js} +8 -11
- package/{package.command-axv0abmn.js → package.command-zrc7br1y.js} +6 -7
- package/package.json +14 -5
- package/{page.command-vs9s3zrh.js → page.command-vpjgardh.js} +4 -5
- package/{primitive.command-cbxmqbtc.js → primitive.command-sz84tk4t.js} +9 -22
- package/prompter-ptaa3nk0.js +8 -0
- package/{quality.command-gmbs7nws.js → quality.command-g869hafs.js} +203 -376
- package/{recipeScanner-fpagtgc1.js → recipeScanner-4b69ybe0.js} +1 -1
- package/{repair.command-bqsjptsj.js → repair.command-chsnjvvv.js} +11 -35
- package/{routeSourceValidator-apyqw7wk.js → routeSourceValidator-7ycnfz0e.js} +0 -6
- package/{scalar.command-6k1vhe9s.js → scalar.command-2v21newx.js} +7 -10
- package/skills/akan-code/SKILL.md +130 -0
- package/skills/akan-debug/SKILL.md +42 -0
- package/skills/akan-deps/SKILL.md +50 -0
- package/skills/akan-err/SKILL.md +39 -0
- package/skills/akan-module/SKILL.md +45 -0
- package/skills/akan-scaffold/SKILL.md +76 -0
- package/skills/akan-scalar/SKILL.md +52 -0
- package/skills/akan-service/SKILL.md +34 -0
- package/skills/akan-store/SKILL.md +67 -0
- package/skills/akan-ui/SKILL.md +63 -0
- package/skills/akan-validate/SKILL.md +44 -0
- package/{subspace.command-fwjfcts7.js → subspace.command-ckcbwfp1.js} +138 -67
- package/templates/__scalar/__model__/__model__.abstract.md.template +8 -0
- package/templates/appSample/lib/__scalar/workHistory/workHistory.abstract.ts +8 -39
- package/templates/appSample/lib/_noti/noti.abstract.ts +6 -29
- package/templates/appSample/lib/task/task.abstract.ts +12 -32
- package/templates/appSample/lib/task/task.signal.spec.ts +15 -18
- package/templates/appSample/lib/task/task.signal.test.ts +15 -1
- package/templates/appSample/lib/task/task.signal.ts +1 -1
- package/templates/appSample/srvkit/{AuthGuard.ts → guards.ts} +7 -4
- package/templates/appSample/srvkit/{SessionInternalArg.ts → internalArgs.ts} +6 -4
- package/templates/client.ts +7 -30
- package/templates/crudPages/[__model__Id]/edit/page.tsx +2 -1
- package/templates/crudPages/[__model__Id]/page.tsx +2 -1
- package/templates/crudPages/new/page.tsx +2 -1
- package/templates/crudPages/page.tsx +2 -1
- package/templates/crudSinglePage/page.tsx +2 -1
- package/templates/lib/__lib/lib.dictionary.ts +0 -2
- package/templates/lib/__lib/lib.document.ts +0 -2
- package/templates/lib/sig.ts +8 -30
- package/templates/localDev/docker-compose.yaml.template +3 -14
- package/templates/module/__model__.signal.ts +12 -4
- package/templates/pkgRoot/tsconfig.json.template +2 -7
- package/templates/server.ts +0 -2
- package/templates/service/__model__.abstract.md.template +8 -0
- package/tunnel.command-kd2yr4fx.js +129 -0
- package/{typeChecker-3xgrzc2v.js → typeChecker-px49mezc.js} +1 -1
- package/typecheck.proc.js +1 -1
- package/workflow.command-44252cqv.js +79 -0
- package/{workspace.command-8s050m0h.js → workspace.command-fqcztt5p.js} +77 -109
- package/abstractCompactor-mjh5ppsq.js +0 -101
- package/cloud.command-jshwdq22.js +0 -93
- package/context.command-ez8a0zyz.js +0 -80
- package/devTuiView-c08ccbat.js +0 -9
- package/getDirname-dr3jz1xg.js +0 -7
- package/guideline.command-xmqwx8zm.js +0 -359
- package/guidelines/agentRule/agentRule.generate.json +0 -31
- package/guidelines/componentRule/componentRule.generate.json +0 -31
- package/guidelines/conventions/conventions.generate.json +0 -25
- package/guidelines/cssRule/cssRule.generate.json +0 -31
- package/guidelines/docPageRule/docPageRule.generate.json +0 -31
- package/guidelines/docPageRule/docPageRule.instruction.md +0 -25
- package/guidelines/docSyncRule/docSyncRule.generate.json +0 -31
- package/guidelines/docSyncRule/docSyncRule.instruction.md +0 -25
- package/guidelines/enumConstant/enumConstant.generate.json +0 -31
- package/guidelines/enumConstant/enumConstant.instruction.md +0 -28
- package/guidelines/fieldRule/fieldRule.generate.json +0 -31
- package/guidelines/framework/framework.generate.json +0 -32
- package/guidelines/mcpRule/mcpRule.generate.json +0 -35
- package/guidelines/modelConstant/modelConstant.generate.json +0 -32
- package/guidelines/modelDictionary/modelDictionary.generate.json +0 -32
- package/guidelines/modelDocument/modelDocument.generate.json +0 -31
- package/guidelines/modelService/modelService.generate.json +0 -31
- package/guidelines/modelSignal/modelSignal.generate.json +0 -31
- package/guidelines/modelStore/modelStore.generate.json +0 -31
- package/guidelines/modelTemplate/modelTemplate.generate.json +0 -31
- package/guidelines/modelUnit/modelUnit.generate.json +0 -31
- package/guidelines/modelUtil/modelUtil.generate.json +0 -31
- package/guidelines/modelView/modelView.generate.json +0 -31
- package/guidelines/modelZone/modelZone.generate.json +0 -31
- package/guidelines/moduleCodegen/moduleCodegen.generate.json +0 -31
- package/guidelines/moduleCodegen/moduleCodegen.instruction.md +0 -28
- package/guidelines/moduleOverview/moduleOverview.generate.json +0 -31
- package/guidelines/queryRule/queryRule.generate.json +0 -31
- package/guidelines/recipeRule/recipeRule.generate.json +0 -31
- package/guidelines/runtimeRule/runtimeRule.generate.json +0 -25
- package/guidelines/scalarConstant/scalarConstant.generate.json +0 -32
- package/guidelines/scalarDictionary/scalarDictionary.generate.json +0 -32
- package/guidelines/scalarModule/scalarModule.generate.json +0 -31
- package/guidelines/sharedUiUsage/sharedUiUsage.generate.json +0 -31
- package/guidelines/sharedUiUsage/sharedUiUsage.instruction.md +0 -25
- package/guidelines/ssrRule/ssrRule.generate.json +0 -31
- package/guidelines/transportRule/transportRule.generate.json +0 -31
- package/guidelines/utilUiUsage/utilUiUsage.generate.json +0 -31
- package/guidelines/utilUiUsage/utilUiUsage.instruction.md +0 -25
- package/guidelines/workspaceOnboarding/workspaceOnboarding.generate.json +0 -24
- package/guidelines/workspaceRecipes/workspaceRecipes.generate.json +0 -33
- package/index-2hq52jq3.js +0 -465
- package/index-6wwzs1bc.js +0 -7
- package/index-8pm30m73.js +0 -841
- package/index-kn1h7p1x.js +0 -560
- package/index-meh558jy.js +0 -65
- package/index-rwg2aa4f.js +0 -229
- package/templates/__scalar/__model__/__model__.abstract.md +0 -28
- package/templates/module/__model__.abstract.md +0 -28
- package/templates/service/__model__.abstract.md +0 -28
- package/workflow.command-nwpcdc8p.js +0 -107
|
@@ -1,60 +1,45 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
AppExecutor
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-9d9bgcx4.js";
|
|
5
5
|
import {
|
|
6
6
|
jsonText,
|
|
7
7
|
createWorkflowBaselineSummary,
|
|
8
8
|
buildAkanModuleContextIndex,
|
|
9
|
-
createWorkflowStepRegistry,
|
|
10
9
|
toolingRolloutGate
|
|
11
|
-
} from "./index-
|
|
10
|
+
} from "./index-myhc3c1j.js";
|
|
12
11
|
import {
|
|
13
12
|
buildResourceList,
|
|
14
13
|
codexMcpConfigPath,
|
|
15
|
-
akanMcpInstallTargets,
|
|
16
14
|
akanMcpInstallConfigPaths,
|
|
17
15
|
createAkanMcpServer,
|
|
18
16
|
createAkanCodexMcpServerBlock,
|
|
19
17
|
upsertCodexMcpServerBlock,
|
|
20
18
|
renderDoctorText,
|
|
21
19
|
AkanContextAnalyzer
|
|
22
|
-
} from "./index-
|
|
23
|
-
import {
|
|
24
|
-
CommandContainer,
|
|
25
|
-
runner,
|
|
26
|
-
script
|
|
27
|
-
} from "./index-mak3cd28.js";
|
|
20
|
+
} from "./index-ygn77a5w.js";
|
|
28
21
|
import {
|
|
29
22
|
isPlaceholderAppId2
|
|
30
|
-
} from "./index-
|
|
23
|
+
} from "./index-mxav6j3c.js";
|
|
24
|
+
import {
|
|
25
|
+
runner
|
|
26
|
+
} from "./index-w2zdcw3k.js";
|
|
31
27
|
import {
|
|
32
|
-
|
|
33
|
-
} from "./index-
|
|
28
|
+
Prompter2
|
|
29
|
+
} from "./index-0bq14vr1.js";
|
|
34
30
|
import {
|
|
35
31
|
RepairRunner
|
|
36
|
-
} from "./index-
|
|
32
|
+
} from "./index-31yr441d.js";
|
|
37
33
|
import {
|
|
38
34
|
WorkflowRunner
|
|
39
|
-
} from "./index-
|
|
40
|
-
import {
|
|
41
|
-
ModuleScript
|
|
42
|
-
} from "./index-8pm30m73.js";
|
|
43
|
-
import {
|
|
44
|
-
PrimitiveScript
|
|
45
|
-
} from "./index-4edzf1gr.js";
|
|
46
|
-
import {
|
|
47
|
-
ScalarScript
|
|
48
|
-
} from "./index-rwg2aa4f.js";
|
|
35
|
+
} from "./index-xqpzbab5.js";
|
|
49
36
|
import {
|
|
50
37
|
getMobileTargets
|
|
51
|
-
} from "./index-
|
|
52
|
-
|
|
53
|
-
// pkgs/@akanjs/cli/context/context.script.ts
|
|
54
|
-
import { Logger } from "akanjs/common";
|
|
38
|
+
} from "./index-5e0n4hqx.js";
|
|
55
39
|
|
|
56
40
|
// pkgs/@akanjs/devkit/akanMcpContract.ts
|
|
57
41
|
import path from "path";
|
|
42
|
+
import { isRecord } from "akanjs/common";
|
|
58
43
|
var emptySchema = { type: "object", properties: {} };
|
|
59
44
|
var stringProperty = { type: "string" };
|
|
60
45
|
var booleanProperty = { type: "boolean" };
|
|
@@ -138,18 +123,11 @@ var inspectAkanContextInputSchema = {
|
|
|
138
123
|
},
|
|
139
124
|
required: ["question", "draft", "review", "request"]
|
|
140
125
|
};
|
|
141
|
-
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
142
126
|
var slugPart = (value) => typeof value === "string" ? value.trim().replace(/[^a-zA-Z0-9]+/g, "-").replace(/^-+|-+$/g, "").toLowerCase() : "";
|
|
143
127
|
var optionalString = (args, key) => {
|
|
144
128
|
const value = args[key];
|
|
145
129
|
return typeof value === "string" && value ? value : undefined;
|
|
146
130
|
};
|
|
147
|
-
var nestedStringArg = (args, key) => {
|
|
148
|
-
const value = args[key];
|
|
149
|
-
if (typeof value !== "string" || !value)
|
|
150
|
-
throw new Error(`MCP tool argument "${key}" is required.`);
|
|
151
|
-
return value;
|
|
152
|
-
};
|
|
153
131
|
var isInspectAkanContextRequestType = (value) => typeof value === "string" && inspectAkanContextRequestTypes.includes(value);
|
|
154
132
|
var parseJsonOutput = (output) => JSON.parse(output);
|
|
155
133
|
var workspacePath = (workspace, filePath) => path.isAbsolute(filePath) ? filePath : path.join(workspace.workspaceRoot, filePath);
|
|
@@ -204,50 +182,31 @@ var inspectAkanContextPropsArg = (args) => {
|
|
|
204
182
|
if (!isInspectAkanContextRequestType(args.request.type)) {
|
|
205
183
|
throw new Error('MCP tool argument "request.type" must be a supported inspect_akan_context request type.');
|
|
206
184
|
}
|
|
207
|
-
const
|
|
185
|
+
const base = { question, draft: { reason: stringArg(args.draft, "reason"), type: args.draft.type }, review };
|
|
208
186
|
const request = args.request;
|
|
209
187
|
if (request.type === "workspaceOverview")
|
|
210
|
-
return {
|
|
188
|
+
return { ...base, request: { type: request.type } };
|
|
211
189
|
if (request.type === "moduleContext")
|
|
212
190
|
return {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
review,
|
|
216
|
-
request: {
|
|
217
|
-
type: request.type,
|
|
218
|
-
app: nestedStringArg(request, "app"),
|
|
219
|
-
module: nestedStringArg(request, "module")
|
|
220
|
-
}
|
|
191
|
+
...base,
|
|
192
|
+
request: { type: request.type, app: stringArg(request, "app"), module: stringArg(request, "module") }
|
|
221
193
|
};
|
|
222
194
|
if (request.type === "fieldInsertionContext")
|
|
223
195
|
return {
|
|
224
|
-
|
|
225
|
-
draft,
|
|
226
|
-
review,
|
|
196
|
+
...base,
|
|
227
197
|
request: {
|
|
228
198
|
type: request.type,
|
|
229
|
-
app:
|
|
230
|
-
module:
|
|
231
|
-
field:
|
|
232
|
-
fieldType:
|
|
199
|
+
app: stringArg(request, "app"),
|
|
200
|
+
module: stringArg(request, "module"),
|
|
201
|
+
field: stringArg(request, "field"),
|
|
202
|
+
fieldType: stringArg(request, "fieldType")
|
|
233
203
|
}
|
|
234
204
|
};
|
|
235
205
|
if (request.type === "workflowDiagnostics")
|
|
236
|
-
return {
|
|
237
|
-
question,
|
|
238
|
-
draft,
|
|
239
|
-
review,
|
|
240
|
-
request: { type: request.type, runIdOrPlan: nestedStringArg(request, "runIdOrPlan") }
|
|
241
|
-
};
|
|
206
|
+
return { ...base, request: { type: request.type, runIdOrPlan: stringArg(request, "runIdOrPlan") } };
|
|
242
207
|
return {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
review,
|
|
246
|
-
request: {
|
|
247
|
-
type: "escape",
|
|
248
|
-
reason: nestedStringArg(request, "reason"),
|
|
249
|
-
nextStep: optionalString(request, "nextStep")
|
|
250
|
-
}
|
|
208
|
+
...base,
|
|
209
|
+
request: { type: "escape", reason: stringArg(request, "reason"), nextStep: optionalString(request, "nextStep") }
|
|
251
210
|
};
|
|
252
211
|
};
|
|
253
212
|
var inspectDiagnostic = (severity, code, message) => ({ severity, code, message });
|
|
@@ -471,22 +430,11 @@ var inspectAkanContext = async (workspace, args) => {
|
|
|
471
430
|
strict: true,
|
|
472
431
|
runIdOrPlan: workspacePath(workspace, props.request.runIdOrPlan)
|
|
473
432
|
});
|
|
474
|
-
const
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
context: diagnostic.context
|
|
480
|
-
})), { detailsIncluded: false });
|
|
481
|
-
diagnostics.push(...(doctor.workflowDiagnostics ?? doctor.diagnostics).map((diagnostic) => ({
|
|
482
|
-
severity: diagnostic.severity,
|
|
483
|
-
code: diagnostic.code,
|
|
484
|
-
message: diagnostic.message,
|
|
485
|
-
scope: diagnostic.scope,
|
|
486
|
-
context: {
|
|
487
|
-
...diagnostic.context,
|
|
488
|
-
...diagnostic.path ? { paths: [diagnostic.path] } : {}
|
|
489
|
-
}
|
|
433
|
+
const toWorkflowDiagnostic = ({ severity, code, message, scope }, context) => ({ severity, code, message, scope, context });
|
|
434
|
+
const baselineSummary = createWorkflowBaselineSummary((doctor.baselineDiagnostics ?? []).map((diagnostic) => toWorkflowDiagnostic(diagnostic, diagnostic.context)), { detailsIncluded: false });
|
|
435
|
+
diagnostics.push(...(doctor.workflowDiagnostics ?? doctor.diagnostics).map((diagnostic) => toWorkflowDiagnostic(diagnostic, {
|
|
436
|
+
...diagnostic.context,
|
|
437
|
+
...diagnostic.path ? { paths: [diagnostic.path] } : {}
|
|
490
438
|
})));
|
|
491
439
|
return baseResult("workflowDiagnostics", [
|
|
492
440
|
{
|
|
@@ -504,9 +452,10 @@ var inspectAkanContext = async (workspace, args) => {
|
|
|
504
452
|
workflowDiagnostics: doctor.workflowDiagnostics?.length ?? 0
|
|
505
453
|
});
|
|
506
454
|
}
|
|
455
|
+
const moduleRequest = props.request.type === "moduleContext" || props.request.type === "fieldInsertionContext" ? props.request : null;
|
|
507
456
|
const context = await AkanContextAnalyzer.analyze(workspace, {
|
|
508
|
-
app:
|
|
509
|
-
module:
|
|
457
|
+
app: moduleRequest?.app ?? null,
|
|
458
|
+
module: moduleRequest?.module ?? null,
|
|
510
459
|
includeAbstractContent: false
|
|
511
460
|
});
|
|
512
461
|
if (props.request.type === "workspaceOverview") {
|
|
@@ -594,41 +543,22 @@ var inspectAkanContext = async (workspace, args) => {
|
|
|
594
543
|
});
|
|
595
544
|
};
|
|
596
545
|
|
|
597
|
-
// pkgs/@akanjs/cli/context/context.workflowRegistry.ts
|
|
598
|
-
var createCliWorkflowStepRegistry = (workspace) => createWorkflowStepRegistry({
|
|
599
|
-
workspace,
|
|
600
|
-
createModule: (sys, module) => CommandContainer.get(ModuleScript).createModuleTemplate(sys, module),
|
|
601
|
-
createScalar: (sys, scalar) => CommandContainer.get(ScalarScript).createScalar(sys, scalar),
|
|
602
|
-
createUi: (input) => CommandContainer.get(PrimitiveScript).createUi(workspace, input),
|
|
603
|
-
addField: (input) => CommandContainer.get(PrimitiveScript).addField(workspace, input),
|
|
604
|
-
addEnumField: (input) => CommandContainer.get(PrimitiveScript).addEnumField(workspace, input),
|
|
605
|
-
addMutation: (input) => CommandContainer.get(PrimitiveScript).addMutation(workspace, input),
|
|
606
|
-
addSlice: (input) => CommandContainer.get(PrimitiveScript).addSlice(workspace, input)
|
|
607
|
-
});
|
|
608
|
-
|
|
609
546
|
// pkgs/@akanjs/cli/context/context.runner.ts
|
|
610
547
|
var toolErrorText = (error) => {
|
|
611
548
|
const message = error instanceof Error ? error.message : String(error);
|
|
612
549
|
return message.replace(/\/(?:[^\s"'/]+\/)*(?=(?:pkgs|apps|libs|infra)\/)/g, "<workspace>/");
|
|
613
550
|
};
|
|
614
|
-
var workflowDiagnosticFromContext = (diagnostic) => ({
|
|
615
|
-
severity: diagnostic.severity,
|
|
616
|
-
code: diagnostic.code,
|
|
617
|
-
message: diagnostic.message,
|
|
618
|
-
scope: diagnostic.scope,
|
|
619
|
-
context: diagnostic.context
|
|
620
|
-
});
|
|
621
551
|
var compactDoctorWorkspaceResult = (result, includeBaselineDetails) => {
|
|
622
552
|
const baselineDiagnostics = result.baselineDiagnostics ?? [];
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
553
|
+
const baselineSummary = createWorkflowBaselineSummary(baselineDiagnostics.map(({ severity, code, message, scope, context }) => ({
|
|
554
|
+
severity,
|
|
555
|
+
code,
|
|
556
|
+
message,
|
|
557
|
+
scope,
|
|
558
|
+
context
|
|
559
|
+
})), { detailsIncluded: includeBaselineDetails });
|
|
560
|
+
if (baselineDiagnostics.length === 0)
|
|
561
|
+
return { ...result, baselineSummary };
|
|
632
562
|
return {
|
|
633
563
|
...result,
|
|
634
564
|
baselineSummary,
|
|
@@ -637,17 +567,13 @@ var compactDoctorWorkspaceResult = (result, includeBaselineDetails) => {
|
|
|
637
567
|
};
|
|
638
568
|
};
|
|
639
569
|
|
|
640
|
-
class
|
|
570
|
+
class ContextRunner2 extends runner("context") {
|
|
641
571
|
async getContext(workspace, {
|
|
642
572
|
format = "markdown",
|
|
643
573
|
app = null,
|
|
644
574
|
module = null
|
|
645
575
|
} = {}) {
|
|
646
|
-
const context = await AkanContextAnalyzer.analyze(workspace, {
|
|
647
|
-
app,
|
|
648
|
-
module,
|
|
649
|
-
includeAbstractContent: !!module
|
|
650
|
-
});
|
|
576
|
+
const context = await AkanContextAnalyzer.analyze(workspace, { app, module, includeAbstractContent: !!module });
|
|
651
577
|
return format === "json" ? jsonText(context) : AkanContextAnalyzer.renderMarkdown(context, { module });
|
|
652
578
|
}
|
|
653
579
|
async doctor(workspace, {
|
|
@@ -694,7 +620,7 @@ class ContextRunner extends runner("context") {
|
|
|
694
620
|
`);
|
|
695
621
|
}
|
|
696
622
|
async getGuidelineResource(name) {
|
|
697
|
-
return await
|
|
623
|
+
return await Prompter2.getInstruction(name);
|
|
698
624
|
}
|
|
699
625
|
async installMcp(workspace, target, { force = false, mode = "readonly" } = {}) {
|
|
700
626
|
if (target === "codex")
|
|
@@ -710,13 +636,7 @@ class ContextRunner extends runner("context") {
|
|
|
710
636
|
if (currentAkanServer && !force && JSON.stringify(currentAkanServer) !== JSON.stringify(nextAkanServer)) {
|
|
711
637
|
throw new Error(`${configPath} already has an "akan" MCP server. Re-run with --force to overwrite it.`);
|
|
712
638
|
}
|
|
713
|
-
const nextConfig = {
|
|
714
|
-
...existing,
|
|
715
|
-
mcpServers: {
|
|
716
|
-
...mcpServers,
|
|
717
|
-
akan: nextAkanServer
|
|
718
|
-
}
|
|
719
|
-
};
|
|
639
|
+
const nextConfig = { ...existing, mcpServers: { ...mcpServers, akan: nextAkanServer } };
|
|
720
640
|
await workspace.writeFile(configPath, `${JSON.stringify(nextConfig, null, 2)}
|
|
721
641
|
`);
|
|
722
642
|
return configPath;
|
|
@@ -773,7 +693,7 @@ class ContextRunner extends runner("context") {
|
|
|
773
693
|
return modules;
|
|
774
694
|
}
|
|
775
695
|
if (name === "get_guideline")
|
|
776
|
-
return await
|
|
696
|
+
return await Prompter2.getInstruction(stringArg(args, "name"));
|
|
777
697
|
if (name === "doctor_workspace")
|
|
778
698
|
return compactDoctorWorkspaceResult(await AkanContextAnalyzer.doctor(workspace, {
|
|
779
699
|
strict: !!args.strict,
|
|
@@ -809,7 +729,7 @@ class ContextRunner extends runner("context") {
|
|
|
809
729
|
format: "json",
|
|
810
730
|
dryRun: !!args.dryRun,
|
|
811
731
|
workspace,
|
|
812
|
-
registry:
|
|
732
|
+
registry: WorkflowRunner.stepRegistry(workspace)
|
|
813
733
|
}));
|
|
814
734
|
const validationTarget = typeof report.validationTarget === "string" ? report.validationTarget : typeof report.applyReportPath === "string" ? report.applyReportPath : stringArg(args, "planPath");
|
|
815
735
|
return {
|
|
@@ -863,14 +783,14 @@ ${payload}`);
|
|
|
863
783
|
const respondError = (id, code, message, framing) => {
|
|
864
784
|
writeMessage({ jsonrpc: "2.0", id: id ?? null, error: { code, message } }, framing);
|
|
865
785
|
};
|
|
866
|
-
const guidelineNames = await
|
|
786
|
+
const guidelineNames = await Prompter2.listGuidelines();
|
|
867
787
|
const resources = buildResourceList(guidelineNames);
|
|
868
788
|
const readResource = async (uri) => {
|
|
869
789
|
if (uri === "akan://docs/framework")
|
|
870
|
-
return { uri, mimeType: "text/markdown", text: await
|
|
790
|
+
return { uri, mimeType: "text/markdown", text: await Prompter2.getInstruction("framework") };
|
|
871
791
|
const guideline = /^akan:\/\/guidelines\/(.+)$/.exec(uri)?.[1];
|
|
872
792
|
if (guideline)
|
|
873
|
-
return { uri, mimeType: "text/markdown", text: await
|
|
793
|
+
return { uri, mimeType: "text/markdown", text: await Prompter2.getInstruction(guideline) };
|
|
874
794
|
const context = await AkanContextAnalyzer.analyze(workspace);
|
|
875
795
|
if (uri === "akan://workspace/summary")
|
|
876
796
|
return { uri, mimeType: "application/json", text: jsonText(context, { trailingNewline: false }) };
|
|
@@ -902,22 +822,14 @@ ${payload}`);
|
|
|
902
822
|
serverInfo: { name: "akan", version: process.env.AKAN_VERSION ?? "0.0.0" }
|
|
903
823
|
}, framing);
|
|
904
824
|
} else if (request.method === "tools/list") {
|
|
905
|
-
respond(request.id, {
|
|
906
|
-
tools: this.listMcpTools(mode, { guidelineNames })
|
|
907
|
-
}, framing);
|
|
825
|
+
respond(request.id, { tools: this.listMcpTools(mode, { guidelineNames }) }, framing);
|
|
908
826
|
} else if (request.method === "tools/call") {
|
|
909
827
|
const name = params.name;
|
|
910
828
|
const args = params.arguments ?? {};
|
|
911
829
|
try {
|
|
912
830
|
const result = await this.callMcpTool(workspace, name, args, { mode });
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
{
|
|
916
|
-
type: "text",
|
|
917
|
-
text: typeof result === "string" ? result : jsonText(result, { trailingNewline: false })
|
|
918
|
-
}
|
|
919
|
-
]
|
|
920
|
-
}, framing);
|
|
831
|
+
const text = typeof result === "string" ? result : jsonText(result, { trailingNewline: false });
|
|
832
|
+
respond(request.id, { content: [{ type: "text", text }] }, framing);
|
|
921
833
|
} catch (error) {
|
|
922
834
|
respond(request.id, { content: [{ type: "text", text: toolErrorText(error) }], isError: true }, framing);
|
|
923
835
|
}
|
|
@@ -1026,7 +938,7 @@ ${payload}`);
|
|
|
1026
938
|
test: "`akan test <app-or-lib-or-pkg>` prepares the target and runs its tests.",
|
|
1027
939
|
build: "`akan build <app-name>` creates a production build after preparing generated files.",
|
|
1028
940
|
doctor: "`akan doctor --strict --format json` reports agent-readable workspace convention diagnostics and validation hints.",
|
|
1029
|
-
"guideline show": "`akan guideline show <name>` prints an Akan
|
|
941
|
+
"guideline show": "`akan guideline show <name>` prints an Akan guideline instruction.",
|
|
1030
942
|
workflow: "`akan workflow list|explain|plan|apply|validate|report` lists, plans, applies, validates, and reports agent-readable Akan workflows.",
|
|
1031
943
|
"workflow list": "`akan workflow list` lists parseable read-only workflow specs.",
|
|
1032
944
|
"workflow explain": "`akan workflow explain <workflow>` explains inputs, optional surfaces, steps, and validation.",
|
|
@@ -1049,57 +961,4 @@ ${payload}`);
|
|
|
1049
961
|
}
|
|
1050
962
|
}
|
|
1051
963
|
|
|
1052
|
-
|
|
1053
|
-
var resolveMcpInstallTargets = (target) => {
|
|
1054
|
-
if (!target || target === "all")
|
|
1055
|
-
return [...akanMcpInstallTargets];
|
|
1056
|
-
if (akanMcpInstallTargets.includes(target))
|
|
1057
|
-
return [target];
|
|
1058
|
-
throw new Error(`Unknown MCP install target: ${target}. Use cursor, claude, codex, or all.`);
|
|
1059
|
-
};
|
|
1060
|
-
var mcpTargetLabels = {
|
|
1061
|
-
cursor: "Cursor",
|
|
1062
|
-
claude: "Claude Code",
|
|
1063
|
-
codex: "Codex"
|
|
1064
|
-
};
|
|
1065
|
-
|
|
1066
|
-
class ContextScript extends script("context", [ContextRunner]) {
|
|
1067
|
-
async context(workspace, options = {}) {
|
|
1068
|
-
Logger.rawLog(await this.contextRunner.getContext(workspace, options));
|
|
1069
|
-
}
|
|
1070
|
-
async doctor(workspace, options = {}) {
|
|
1071
|
-
Logger.rawLog(await this.contextRunner.doctor(workspace, options));
|
|
1072
|
-
}
|
|
1073
|
-
async mcpInstall(workspace, target, { force = false, mode = "apply" } = {}) {
|
|
1074
|
-
const targets = resolveMcpInstallTargets(target);
|
|
1075
|
-
const written = [];
|
|
1076
|
-
for (const t of targets) {
|
|
1077
|
-
const configPath = await this.contextRunner.installMcp(workspace, t, { force, mode });
|
|
1078
|
-
written.push(`${mcpTargetLabels[t]}: ${configPath}`);
|
|
1079
|
-
}
|
|
1080
|
-
Logger.rawLog(`Akan MCP server installed (${mode} mode):
|
|
1081
|
-
${written.map((line) => `- ${line}`).join(`
|
|
1082
|
-
`)}`);
|
|
1083
|
-
}
|
|
1084
|
-
async mcp(workspace, { mode = "apply" } = {}) {
|
|
1085
|
-
await this.contextRunner.runMcp(workspace, { mode });
|
|
1086
|
-
}
|
|
1087
|
-
async mcpCall(workspace, tool, {
|
|
1088
|
-
mode = "readonly",
|
|
1089
|
-
args = null,
|
|
1090
|
-
format = "json"
|
|
1091
|
-
} = {}) {
|
|
1092
|
-
let parsedArgs = {};
|
|
1093
|
-
if (args) {
|
|
1094
|
-
const parsed = JSON.parse(args);
|
|
1095
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
1096
|
-
throw new Error("MCP call args must be a JSON object.");
|
|
1097
|
-
}
|
|
1098
|
-
parsedArgs = parsed;
|
|
1099
|
-
}
|
|
1100
|
-
const result = await this.contextRunner.callMcpTool(workspace, tool, parsedArgs, { mode });
|
|
1101
|
-
Logger.rawLog(format === "json" ? jsonText(result) : String(result));
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
export { ContextScript };
|
|
964
|
+
export { ContextRunner2 };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// pkgs/@akanjs/cli/clipboard.ts
|
|
3
|
+
var clipboardCommands = () => {
|
|
4
|
+
if (process.platform === "darwin")
|
|
5
|
+
return [["pbcopy"]];
|
|
6
|
+
if (process.platform === "win32")
|
|
7
|
+
return [["clip"]];
|
|
8
|
+
return [["wl-copy"], ["xclip", "-selection", "clipboard"], ["xsel", "--clipboard", "--input"]];
|
|
9
|
+
};
|
|
10
|
+
var writeClipboard = async (text) => {
|
|
11
|
+
for (const command of clipboardCommands()) {
|
|
12
|
+
try {
|
|
13
|
+
const proc = Bun.spawn(command, {
|
|
14
|
+
stdin: new TextEncoder().encode(text),
|
|
15
|
+
stdout: "ignore",
|
|
16
|
+
stderr: "ignore"
|
|
17
|
+
});
|
|
18
|
+
if (await proc.exited === 0)
|
|
19
|
+
return true;
|
|
20
|
+
} catch {}
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { writeClipboard };
|