@akanjs/cli 3.0.0-beta.13 → 3.0.0-beta.15
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-d3wvbq8q.js +9 -0
- package/CodeAgentRpcHost-qvwfv0n9.js +7 -0
- package/CodeTui-6c9a2wtk.js +1103 -0
- package/README.md +3 -0
- package/{TunnelShare-2kwqb1j6.js → TunnelShare-r5tc2qk5.js} +2 -2
- package/{agent.command-7357vxd8.js → agent.command-9cg8m87z.js} +6 -6
- package/akanCode.js +100 -0
- package/{application.command-8s8ns95d.js → application.command-x75men32.js} +6 -15
- package/{applicationBuildRunner-4f1wrba0.js → applicationBuildRunner-d3702f1w.js} +2 -2
- package/{applicationReleasePackager-jkjmy5ee.js → applicationReleasePackager-2kdyj3te.js} +1 -1
- package/buildBatch.proc.js +2 -2
- package/{capacitorApp-hqvsrec4.js → capacitorApp-qk975zyz.js} +2 -2
- package/{cloud.command-p5dnhft9.js → cloud.command-a09wggfq.js} +10 -22
- package/cloud.script-qd3hpybf.js +20 -0
- package/code.command-ca7rpmez.js +147 -0
- package/commandManifest.json +1 -1
- package/consoleToStderr-h5bryj94.js +7 -0
- package/{context.command-wsjt98c1.js → context.command-9kbm0527.js} +14 -15
- package/context.runner-wtqpw7mh.js +22 -0
- package/{devTui-myg3pqeg.js → devTui-v19fbnpk.js} +114 -8
- package/{devTuiView-gz2fbf4v.js → devTuiView-pa63jrjq.js} +1 -1
- package/guideline.command-qvrh5pnx.js +48 -0
- package/guidelines/agentRule/agentRule.instruction.md +46 -15
- package/guidelines/conventions/conventions.instruction.md +9 -4
- package/guidelines/moduleCodegen/moduleCodegen.instruction.md +1 -1
- package/guidelines/workspaceRecipes/workspaceRecipes.generate.json +1 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +62 -0
- package/incrementalBuilder.proc.js +1 -1
- package/{index-bz10w9t2.js → index-0qvq9aeb.js} +6 -16
- package/{index-jwjaf9fy.js → index-1p146w4s.js} +44 -44
- package/{index-7f4dsf9v.js → index-1sggq0m8.js} +1 -1
- package/{index-15r9a10e.js → index-3dmebxnk.js} +2 -2
- package/{index-vrwdx0zx.js → index-3hr7cpy1.js} +1 -1
- package/{index-s3fvrydw.js → index-5hy11qaq.js} +9 -9
- package/{index-8pkvrcv1.js → index-658xafm1.js} +3 -3
- package/index-7md2g9vw.js +6 -0
- package/{index-ys7dvdb3.js → index-84b080zh.js} +1 -1
- package/index-8k16atqy.js +82 -0
- package/{index-t3c045et.js → index-91brpnzb.js} +8 -21
- package/{index-em4swemt.js → index-bchkysja.js} +3 -3
- package/{index-j7rwsd23.js → index-bzjnp9ap.js} +22 -80
- package/{index-cnzm1wn5.js → index-chp5gqmm.js} +88 -169
- package/{index-h3g1152j.js → index-d35a8vc0.js} +4 -4
- package/{index-1nwxbr2y.js → index-ea1smknd.js} +2 -2
- package/index-egt4vfgb.js +69 -0
- package/index-erzcytap.js +2434 -0
- package/{index-sh88vtye.js → index-f4gpcp98.js} +1 -1
- package/{index-b3ae16mg.js → index-gca9y01h.js} +1 -1
- package/{index-wmb05v4q.js → index-gm76f0qb.js} +1 -1
- package/{index-649svkyt.js → index-myj01w9r.js} +8 -15
- package/index-sxg87a8f.js +727 -0
- package/{index-h7yw2z9n.js → index-twq9p2sp.js} +8 -8
- package/index-v156f836.js +234 -0
- package/index-v1y3cx0k.js +61 -0
- package/{index-t8gvwcrx.js → index-va2je2qm.js} +2 -2
- package/index-wfwknnje.js +124 -0
- package/index-x7g1qzpt.js +121 -0
- package/index.js +21 -20
- package/{library.command-1f9h2ex6.js → library.command-n89re6cx.js} +3 -3
- package/{localRegistry.command-w6w35j4r.js → localRegistry.command-1mmnegph.js} +9 -9
- package/{module.command-8zkq0q9q.js → module.command-4m82zgfp.js} +7 -10
- package/{package.command-y2rh4np7.js → package.command-9dv0p6zq.js} +3 -3
- package/package.json +9 -5
- package/{page.command-e5h29fyt.js → page.command-q86b0m0z.js} +3 -3
- package/{primitive.command-qm7tybpn.js → primitive.command-kaneasq6.js} +6 -9
- package/prompter-9mn3kp36.js +8 -0
- package/{quality.command-5evdd263.js → quality.command-sgapx315.js} +65 -5
- package/{repair.command-c2amvt74.js → repair.command-efc5gdbq.js} +5 -5
- package/{scalar.command-a1ewkmab.js → scalar.command-e2rpkhqy.js} +6 -9
- 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 +63 -0
- package/skills/akan-ui/SKILL.md +63 -0
- package/skills/akan-validate/SKILL.md +44 -0
- package/{subspace.command-3w5x13a1.js → subspace.command-005rz1x6.js} +5 -5
- package/{tunnel.command-09n8h4s1.js → tunnel.command-66j9estx.js} +4 -4
- package/{workflow.command-y3fct1rq.js → workflow.command-z1xcm4c7.js} +9 -12
- package/{workspace.command-p6td4qad.js → workspace.command-4ahrhp3k.js} +23 -22
- package/abstractCompactor-g04vqcff.js +0 -102
- package/cloud.script-gxpbhras.js +0 -20
- package/guideline.command-snqzfyt0.js +0 -360
- package/index-5tw8t1ts.js +0 -338
- package/index-j1tajctp.js +0 -229
- package/index-kpnp2e10.js +0 -841
- package/index-meh558jy.js +0 -65
- /package/{index-5nyznra1.js → index-p1j0cyvd.js} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-gca9y01h.js";
|
|
6
6
|
import {
|
|
7
7
|
AGENT_BLOCK_START,
|
|
8
8
|
AGENT_BLOCK_END,
|
|
@@ -13,17 +13,17 @@ import {
|
|
|
13
13
|
CLAUDE_COMMENT_RULE,
|
|
14
14
|
AppExecutor,
|
|
15
15
|
LibExecutor
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-p1j0cyvd.js";
|
|
17
17
|
import {
|
|
18
18
|
collectRecipeSources2,
|
|
19
19
|
scanRecipes2
|
|
20
20
|
} from "./index-by5gpp8x.js";
|
|
21
21
|
import {
|
|
22
22
|
AkanContextAnalyzer
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-3dmebxnk.js";
|
|
24
24
|
import {
|
|
25
|
-
|
|
26
|
-
} from "./index-
|
|
25
|
+
Prompter2
|
|
26
|
+
} from "./index-twq9p2sp.js";
|
|
27
27
|
|
|
28
28
|
// pkgs/@akanjs/cli/agent/agent.script.ts
|
|
29
29
|
import { Logger as Logger2 } from "akanjs/common";
|
|
@@ -106,10 +106,10 @@ ${scopeIndexPointer}
|
|
|
106
106
|
`;
|
|
107
107
|
};
|
|
108
108
|
var renderGuides = async (context) => {
|
|
109
|
-
const conventions = (await
|
|
109
|
+
const conventions = (await Prompter2.getInstruction("conventions")).trim();
|
|
110
110
|
if (context.pkgs.some((pkg) => pkg.name === "akanjs"))
|
|
111
111
|
return conventions;
|
|
112
|
-
const onboarding = (await
|
|
112
|
+
const onboarding = (await Prompter2.getInstruction("workspaceOnboarding")).trim();
|
|
113
113
|
const appName = context.apps[0]?.name ?? "app";
|
|
114
114
|
return `${conventions}
|
|
115
115
|
|
|
@@ -117,7 +117,7 @@ ${onboarding.replaceAll("<%= appName %>", appName)}`;
|
|
|
117
117
|
};
|
|
118
118
|
var renderManagedBlock = async (workspace) => {
|
|
119
119
|
const context = await AkanContextAnalyzer.analyze(workspace);
|
|
120
|
-
const frameworkGuide = await
|
|
120
|
+
const frameworkGuide = await Prompter2.getInstruction("framework");
|
|
121
121
|
const appNames = context.apps.map((app) => app.name);
|
|
122
122
|
const sampleCleanup = await renderSampleCleanup(workspace, appNames);
|
|
123
123
|
const recipeIndex = await renderRecipeIndex(workspace);
|
|
@@ -138,7 +138,7 @@ ${sampleCleanup}## Akan Module Abstracts
|
|
|
138
138
|
- Update the abstract when business invariants, workflows, or public behavior change.
|
|
139
139
|
- Do not update the abstract for formatting-only, import-only, or style-only changes.
|
|
140
140
|
- Service modules live in \`lib/_<service>\`, but their abstract file is \`<service>.abstract.md\`.
|
|
141
|
-
- Keep an abstract short
|
|
141
|
+
- Keep an abstract short \u2014 the invariants the code cannot show, and nothing it already states. \`akan quality scan\` warns past 300 lines.
|
|
142
142
|
|
|
143
143
|
## Generated Files
|
|
144
144
|
|
|
@@ -20,13 +20,13 @@ import {
|
|
|
20
20
|
renderWorkflowApply,
|
|
21
21
|
renderWorkflowValidation,
|
|
22
22
|
renderWorkflowRunArtifact
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-1p146w4s.js";
|
|
24
24
|
import {
|
|
25
25
|
AkanContextAnalyzer
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-3dmebxnk.js";
|
|
27
27
|
import {
|
|
28
28
|
runner
|
|
29
|
-
} from "./index-
|
|
29
|
+
} from "./index-gca9y01h.js";
|
|
30
30
|
|
|
31
31
|
// pkgs/@akanjs/cli/workflow/workflow.runner.ts
|
|
32
32
|
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// pkgs/@akanjs/devkit/codeAgent/agent/CodeAgentRpcHost.ts
|
|
3
|
+
class CodeAgentRpcHost2 {
|
|
4
|
+
#agent;
|
|
5
|
+
#write;
|
|
6
|
+
#buffer = "";
|
|
7
|
+
constructor(agent, write = (line) => process.stdout.write(line)) {
|
|
8
|
+
this.#agent = agent;
|
|
9
|
+
this.#write = write;
|
|
10
|
+
}
|
|
11
|
+
async serve(input = process.stdin) {
|
|
12
|
+
this.#agent.on((event) => this.#emit(event));
|
|
13
|
+
this.#agent.announce();
|
|
14
|
+
const decoder = new TextDecoder;
|
|
15
|
+
for await (const chunk of input)
|
|
16
|
+
await this.#push(decoder.decode(chunk, { stream: true }));
|
|
17
|
+
await this.#agent.abort().catch(() => {});
|
|
18
|
+
}
|
|
19
|
+
async#push(text) {
|
|
20
|
+
this.#buffer += text;
|
|
21
|
+
let index = this.#buffer.indexOf(`
|
|
22
|
+
`);
|
|
23
|
+
while (index >= 0) {
|
|
24
|
+
const line = this.#buffer.slice(0, index).trim();
|
|
25
|
+
this.#buffer = this.#buffer.slice(index + 1);
|
|
26
|
+
if (line)
|
|
27
|
+
await this.#handle(line);
|
|
28
|
+
index = this.#buffer.indexOf(`
|
|
29
|
+
`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async#handle(line) {
|
|
33
|
+
let request;
|
|
34
|
+
try {
|
|
35
|
+
request = JSON.parse(line);
|
|
36
|
+
} catch {
|
|
37
|
+
return this.#emit({ type: "error", message: "malformed command frame", fatal: false, seq: -1 });
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
this.#reply({ type: "reply", id: request.id, ok: true, data: await this.#run(request.command) });
|
|
41
|
+
} catch (error) {
|
|
42
|
+
this.#reply({ type: "reply", id: request.id, ok: false, error: String(error) });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async#run(command) {
|
|
46
|
+
switch (command.type) {
|
|
47
|
+
case "prompt":
|
|
48
|
+
this.#agent.prompt(command.message, command.images);
|
|
49
|
+
return { accepted: true };
|
|
50
|
+
case "answer":
|
|
51
|
+
return { handled: await this.#agent.answer(command.questionId, command.answer) };
|
|
52
|
+
case "approve":
|
|
53
|
+
return { handled: await this.#agent.approve(command.approvalId, command.approved) };
|
|
54
|
+
case "abort":
|
|
55
|
+
await this.#agent.abort();
|
|
56
|
+
return { aborted: true };
|
|
57
|
+
case "compact":
|
|
58
|
+
await this.#agent.compact(command.instructions);
|
|
59
|
+
return { compacted: true };
|
|
60
|
+
case "set_model":
|
|
61
|
+
await this.#agent.setModel({ provider: command.provider, id: command.modelId });
|
|
62
|
+
return await this.#agent.state();
|
|
63
|
+
case "get_state":
|
|
64
|
+
return await this.#agent.state(command.sinceSeq === undefined ? {} : { sinceSeq: command.sinceSeq });
|
|
65
|
+
case "shutdown":
|
|
66
|
+
this.#agent.dispose();
|
|
67
|
+
return { shutdown: true };
|
|
68
|
+
default:
|
|
69
|
+
throw new Error(`Unsupported command: ${command.type}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
#emit(event) {
|
|
73
|
+
this.#write(`${JSON.stringify({ type: "event", event })}
|
|
74
|
+
`);
|
|
75
|
+
}
|
|
76
|
+
#reply(reply) {
|
|
77
|
+
this.#write(`${JSON.stringify(reply)}
|
|
78
|
+
`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { CodeAgentRpcHost2 };
|
|
@@ -2,25 +2,22 @@
|
|
|
2
2
|
import {
|
|
3
3
|
GlobalConfig,
|
|
4
4
|
CloudApi
|
|
5
|
-
} from "./index-
|
|
6
|
-
import {
|
|
7
|
-
PkgExecutor
|
|
8
|
-
} from "./index-5nyznra1.js";
|
|
9
|
-
import {
|
|
10
|
-
AiSession
|
|
11
|
-
} from "./index-5tw8t1ts.js";
|
|
5
|
+
} from "./index-myj01w9r.js";
|
|
12
6
|
import {
|
|
13
7
|
script
|
|
14
|
-
} from "./index-
|
|
8
|
+
} from "./index-gca9y01h.js";
|
|
9
|
+
import {
|
|
10
|
+
PkgExecutor
|
|
11
|
+
} from "./index-p1j0cyvd.js";
|
|
15
12
|
import {
|
|
16
13
|
ApplicationScript
|
|
17
|
-
} from "./index-
|
|
14
|
+
} from "./index-chp5gqmm.js";
|
|
18
15
|
import {
|
|
19
16
|
PackageScript
|
|
20
|
-
} from "./index-
|
|
17
|
+
} from "./index-va2je2qm.js";
|
|
21
18
|
import {
|
|
22
19
|
CloudRunner
|
|
23
|
-
} from "./index-
|
|
20
|
+
} from "./index-0qvq9aeb.js";
|
|
24
21
|
|
|
25
22
|
// pkgs/@akanjs/cli/cloud/cloud.script.ts
|
|
26
23
|
import { Logger } from "akanjs/common";
|
|
@@ -31,16 +28,6 @@ class CloudScript2 extends script("cloud", [CloudRunner, ApplicationScript, Pack
|
|
|
31
28
|
async logout(workspace, host = GlobalConfig.akanCloudHost) {
|
|
32
29
|
await this.cloudRunner.logout(host);
|
|
33
30
|
}
|
|
34
|
-
async setLlm(workspace) {
|
|
35
|
-
await this.cloudRunner.setLlm();
|
|
36
|
-
}
|
|
37
|
-
resetLlm(workspace) {
|
|
38
|
-
this.cloudRunner.resetLlm();
|
|
39
|
-
}
|
|
40
|
-
async ask(question, workspace) {
|
|
41
|
-
const session = new AiSession("general", { workspace, isContinued: true });
|
|
42
|
-
await session.ask(question);
|
|
43
|
-
}
|
|
44
31
|
async downloadEnv(workspace, workspaceId = workspace.getWorkspaceId({ allowEmpty: true }), { host = GlobalConfig.akanCloudHost } = {}) {
|
|
45
32
|
if (workspaceId) {
|
|
46
33
|
await this.login(workspace, host);
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
writeGeneratedSyncState,
|
|
6
6
|
createRepairReport,
|
|
7
7
|
renderRepairReport
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-1p146w4s.js";
|
|
9
9
|
import {
|
|
10
10
|
AkanContextAnalyzer
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-3dmebxnk.js";
|
|
12
12
|
import {
|
|
13
13
|
runner
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-gca9y01h.js";
|
|
15
15
|
|
|
16
16
|
// pkgs/@akanjs/cli/repair/repair.runner.ts
|
|
17
17
|
var commandForShell = (command) => command.startsWith("akan ") ? `bun run ${command}` : command;
|
|
@@ -1,58 +1,53 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
AppExecutor
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-p1j0cyvd.js";
|
|
5
5
|
import {
|
|
6
6
|
jsonText,
|
|
7
7
|
createWorkflowBaselineSummary,
|
|
8
8
|
buildAkanModuleContextIndex,
|
|
9
9
|
createWorkflowStepRegistry,
|
|
10
10
|
toolingRolloutGate
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-1p146w4s.js";
|
|
12
12
|
import {
|
|
13
13
|
buildResourceList,
|
|
14
14
|
codexMcpConfigPath,
|
|
15
|
-
akanMcpInstallTargets,
|
|
16
15
|
akanMcpInstallConfigPaths,
|
|
17
16
|
createAkanMcpServer,
|
|
18
17
|
createAkanCodexMcpServerBlock,
|
|
19
18
|
upsertCodexMcpServerBlock,
|
|
20
19
|
renderDoctorText,
|
|
21
20
|
AkanContextAnalyzer
|
|
22
|
-
} from "./index-
|
|
23
|
-
import {
|
|
24
|
-
CommandContainer,
|
|
25
|
-
runner,
|
|
26
|
-
script
|
|
27
|
-
} from "./index-b3ae16mg.js";
|
|
21
|
+
} from "./index-3dmebxnk.js";
|
|
28
22
|
import {
|
|
29
23
|
isPlaceholderAppId2
|
|
30
|
-
} from "./index-
|
|
24
|
+
} from "./index-1sggq0m8.js";
|
|
31
25
|
import {
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
CommandContainer,
|
|
27
|
+
runner
|
|
28
|
+
} from "./index-gca9y01h.js";
|
|
29
|
+
import {
|
|
30
|
+
Prompter2
|
|
31
|
+
} from "./index-twq9p2sp.js";
|
|
34
32
|
import {
|
|
35
33
|
RepairRunner
|
|
36
|
-
} from "./index-
|
|
34
|
+
} from "./index-bchkysja.js";
|
|
37
35
|
import {
|
|
38
36
|
WorkflowRunner
|
|
39
|
-
} from "./index-
|
|
37
|
+
} from "./index-658xafm1.js";
|
|
40
38
|
import {
|
|
41
39
|
ModuleScript
|
|
42
|
-
} from "./index-
|
|
40
|
+
} from "./index-v156f836.js";
|
|
43
41
|
import {
|
|
44
42
|
PrimitiveScript
|
|
45
|
-
} from "./index-
|
|
43
|
+
} from "./index-d35a8vc0.js";
|
|
46
44
|
import {
|
|
47
45
|
ScalarScript
|
|
48
|
-
} from "./index-
|
|
46
|
+
} from "./index-v1y3cx0k.js";
|
|
49
47
|
import {
|
|
50
48
|
getMobileTargets
|
|
51
49
|
} from "./index-47pj3aee.js";
|
|
52
50
|
|
|
53
|
-
// pkgs/@akanjs/cli/context/context.script.ts
|
|
54
|
-
import { Logger } from "akanjs/common";
|
|
55
|
-
|
|
56
51
|
// pkgs/@akanjs/devkit/akanMcpContract.ts
|
|
57
52
|
import path from "path";
|
|
58
53
|
var emptySchema = { type: "object", properties: {} };
|
|
@@ -637,7 +632,7 @@ var compactDoctorWorkspaceResult = (result, includeBaselineDetails) => {
|
|
|
637
632
|
};
|
|
638
633
|
};
|
|
639
634
|
|
|
640
|
-
class
|
|
635
|
+
class ContextRunner2 extends runner("context") {
|
|
641
636
|
async getContext(workspace, {
|
|
642
637
|
format = "markdown",
|
|
643
638
|
app = null,
|
|
@@ -694,7 +689,7 @@ class ContextRunner extends runner("context") {
|
|
|
694
689
|
`);
|
|
695
690
|
}
|
|
696
691
|
async getGuidelineResource(name) {
|
|
697
|
-
return await
|
|
692
|
+
return await Prompter2.getInstruction(name);
|
|
698
693
|
}
|
|
699
694
|
async installMcp(workspace, target, { force = false, mode = "readonly" } = {}) {
|
|
700
695
|
if (target === "codex")
|
|
@@ -773,7 +768,7 @@ class ContextRunner extends runner("context") {
|
|
|
773
768
|
return modules;
|
|
774
769
|
}
|
|
775
770
|
if (name === "get_guideline")
|
|
776
|
-
return await
|
|
771
|
+
return await Prompter2.getInstruction(stringArg(args, "name"));
|
|
777
772
|
if (name === "doctor_workspace")
|
|
778
773
|
return compactDoctorWorkspaceResult(await AkanContextAnalyzer.doctor(workspace, {
|
|
779
774
|
strict: !!args.strict,
|
|
@@ -863,14 +858,14 @@ ${payload}`);
|
|
|
863
858
|
const respondError = (id, code, message, framing) => {
|
|
864
859
|
writeMessage({ jsonrpc: "2.0", id: id ?? null, error: { code, message } }, framing);
|
|
865
860
|
};
|
|
866
|
-
const guidelineNames = await
|
|
861
|
+
const guidelineNames = await Prompter2.listGuidelines();
|
|
867
862
|
const resources = buildResourceList(guidelineNames);
|
|
868
863
|
const readResource = async (uri) => {
|
|
869
864
|
if (uri === "akan://docs/framework")
|
|
870
|
-
return { uri, mimeType: "text/markdown", text: await
|
|
865
|
+
return { uri, mimeType: "text/markdown", text: await Prompter2.getInstruction("framework") };
|
|
871
866
|
const guideline = /^akan:\/\/guidelines\/(.+)$/.exec(uri)?.[1];
|
|
872
867
|
if (guideline)
|
|
873
|
-
return { uri, mimeType: "text/markdown", text: await
|
|
868
|
+
return { uri, mimeType: "text/markdown", text: await Prompter2.getInstruction(guideline) };
|
|
874
869
|
const context = await AkanContextAnalyzer.analyze(workspace);
|
|
875
870
|
if (uri === "akan://workspace/summary")
|
|
876
871
|
return { uri, mimeType: "application/json", text: jsonText(context, { trailingNewline: false }) };
|
|
@@ -1049,57 +1044,4 @@ ${payload}`);
|
|
|
1049
1044
|
}
|
|
1050
1045
|
}
|
|
1051
1046
|
|
|
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 };
|
|
1047
|
+
export { ContextRunner2 };
|