@akanjs/cli 3.0.0-alpha.8 → 3.0.0-alpha.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.build-stamp +1 -1
- package/README.ko.md +1 -1
- package/README.md +1 -1
- package/{abstractCompactor-e5yq60qz.js → abstractCompactor-pwc6d6yk.js} +3 -5
- package/{agent.command-pggr92jj.js → agent.command-180hh0ye.js} +11 -12
- package/{application.command-692yap1d.js → application.command-4fq5pmdd.js} +59 -35
- package/{applicationBuildRunner-ha3y8ew8.js → applicationBuildRunner-tavpx3fv.js} +22 -20
- package/{applicationReleasePackager-gg8ccbeh.js → applicationReleasePackager-ktjt0erc.js} +8 -9
- package/buildBatch.proc.js +12 -13
- package/capacitorApp-kwa67kzs.js +12 -0
- package/{cloud.command-wqfsyzv2.js → cloud.command-wm3mtfve.js} +15 -17
- package/commandManifest.json +1 -1
- package/{context.command-9bxtdn0w.js → context.command-dk2m2sjx.js} +19 -22
- package/dependencyScanner-c64m6fxp.js +8 -0
- package/getDirname-dr3jz1xg.js +7 -0
- package/{guideline.command-nfqahxex.js → guideline.command-w6ddv13r.js} +16 -17
- package/guidelines/agentRule/agentRule.generate.json +31 -0
- package/guidelines/agentRule/agentRule.instruction.md +525 -0
- package/guidelines/conventions/conventions.generate.json +25 -0
- package/guidelines/conventions/conventions.instruction.md +847 -0
- package/guidelines/cssRule/cssRule.instruction.md +7 -0
- package/guidelines/framework/framework.generate.json +3 -2
- package/guidelines/framework/framework.instruction.md +1 -9
- package/guidelines/mcpRule/mcpRule.generate.json +25 -0
- package/guidelines/mcpRule/mcpRule.instruction.md +217 -0
- package/guidelines/queryRule/queryRule.generate.json +31 -0
- package/guidelines/queryRule/queryRule.instruction.md +143 -0
- package/guidelines/runtimeRule/runtimeRule.generate.json +25 -0
- package/guidelines/runtimeRule/runtimeRule.instruction.md +176 -0
- package/guidelines/ssrRule/ssrRule.instruction.md +49 -5
- package/guidelines/transportRule/transportRule.generate.json +31 -0
- package/guidelines/transportRule/transportRule.instruction.md +60 -0
- package/guidelines/workspaceOnboarding/workspaceOnboarding.generate.json +24 -0
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +263 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.generate.json +33 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +402 -0
- package/incrementalBuilder.proc.js +21 -22
- package/{index-4hek879p.js → index-1kzsn94d.js} +1 -1
- package/{index-p3f4q532.js → index-1tgp56ke.js} +31 -30
- package/index-3d9y066c.js +76 -0
- package/{index-76rn3g2c.js → index-47pj3aee.js} +4 -4
- package/{index-gex7c8kd.js → index-5n0hf8r9.js} +65 -38
- package/{index-mssqn2sq.js → index-5y7qba1c.js} +79 -33
- package/index-6wwzs1bc.js +7 -0
- package/{index-wnp7hwq7.js → index-92zztqy1.js} +7 -7
- package/{index-fgc8r6dj.js → index-a5vmm6x4.js} +3 -1
- package/{index-azv0xjb5.js → index-a8h184wr.js} +15 -11
- package/{index-67546d0j.js → index-ayy5ecax.js} +1 -1
- package/{index-xhgtkekh.js → index-b2nt0w0k.js} +27 -27
- package/{index-xys926f2.js → index-by5gpp8x.js} +4 -4
- package/{index-bz2sfzzt.js → index-cd5x18qh.js} +32 -32
- package/{index-bjpxzr6s.js → index-ctphds8v.js} +1 -1
- package/{index-w6wbb612.js → index-dq6wq1tv.js} +94 -61
- package/{index-6rhabeev.js → index-ft1sfjz0.js} +36 -25
- package/{index-7myvn0f0.js → index-h7yw2z9n.js} +7 -7
- package/{index-5pmx7bkg.js → index-j9vnq8tr.js} +18 -18
- package/{index-vg0sj9nc.js → index-k1n0h7dk.js} +840 -201
- package/{index-vtj3zps1.js → index-k86zc21w.js} +57 -57
- package/{index-5dw57f0d.js → index-m7e0f1sy.js} +155 -76
- package/index-m9c7k0gm.js +159 -0
- package/{index-46tjzh6s.js → index-mfm35dhh.js} +29 -29
- package/{index-xjd3rqzj.js → index-n68jx79w.js} +6 -15
- package/{index-ztpw544k.js → index-qcracvc9.js} +8 -8
- package/{index-2c3e2xh8.js → index-saheq2bs.js} +4 -4
- package/{index-gmy45vz2.js → index-v0s24t8j.js} +14 -14
- package/{index-0cj2zxbm.js → index-wet2ytnr.js} +12 -11
- package/{index-j9cxndc0.js → index-x23688ar.js} +12 -7
- package/{index-a1e0j63x.js → index-xxe90kqy.js} +58 -25
- package/{index-js368gk9.js → index-ypvdw8nr.js} +13 -13
- package/{index-qb61h0k7.js → index-z3c9mmw4.js} +1098 -1360
- package/index.js +22 -24
- package/{library.command-md9715jz.js → library.command-wpedct6c.js} +11 -9
- package/{localRegistry.command-exkbamyj.js → localRegistry.command-gk773cte.js} +20 -22
- package/{module.command-w5aaddxk.js → module.command-8n4kct3e.js} +13 -15
- package/{package.command-yfkrcy0z.js → package.command-fcbd0b1d.js} +8 -9
- package/package.json +5 -7
- package/{page.command-echbavp4.js → page.command-x4379grq.js} +7 -8
- package/{primitive.command-9fbhspw2.js → primitive.command-8etmnqhq.js} +13 -15
- package/{quality.command-3pnt9yep.js → quality.command-hfx7z8yr.js} +226 -104
- package/recipeScanner-fpagtgc1.js +11 -0
- package/{repair.command-carj4vax.js → repair.command-j0fs5qkz.js} +12 -13
- package/{routeSourceValidator-e4jmbfcx.js → routeSourceValidator-ze6x894c.js} +0 -2
- package/{scalar.command-51ryzypc.js → scalar.command-2emk89eh.js} +11 -13
- package/subspace.command-3w3s1zas.js +714 -0
- package/templates/app/env/env.client.debug.ts.template +1 -5
- package/templates/app/env/env.client.develop.ts.template +1 -5
- package/templates/app/env/env.client.local.ts.template +1 -5
- package/templates/app/env/env.client.main.ts.template +1 -5
- package/templates/app/env/env.client.testing.ts.template +1 -5
- package/templates/app/env/env.client.type.ts +2 -6
- package/templates/app/env/env.server.debug.ts.template +1 -5
- package/templates/app/env/env.server.develop.ts.template +1 -5
- package/templates/app/env/env.server.local.ts.template +1 -5
- package/templates/app/env/env.server.main.ts.template +1 -5
- package/templates/app/main.ts +3 -1
- package/templates/appSample/lib/task/task.signal.ts +11 -6
- package/templates/appSample/srvkit/AuthGuard.ts +9 -5
- package/templates/appSample/srvkit/SessionInternalArg.ts +4 -3
- package/templates/crudPages/[__model__Id]/edit/page.tsx +6 -6
- package/templates/crudPages/[__model__Id]/page.tsx +10 -13
- package/templates/crudPages/new/page.tsx +6 -6
- package/templates/crudPages/page.tsx +9 -9
- package/templates/crudSinglePage/page.tsx +11 -7
- package/templates/env/_env.server.type.ts +7 -5
- package/templates/lib/db.ts +1 -1
- package/templates/lib/dict.ts +1 -1
- package/templates/lib/sig.ts +1 -1
- package/templates/lib/srv.ts +6 -2
- package/templates/module/__Model__.Util.tsx +1 -1
- package/templates/module/__Model__.Zone.tsx +3 -5
- package/templates/module/__model__.dictionary.ts +4 -1
- package/templates/module/__model__.signal.ts +2 -3
- package/templates/module/__model__.store.ts +1 -2
- package/templates/workspaceRoot/.gitignore.template +0 -1
- package/templates/workspaceRoot/AGENTS.md.template +4 -972
- package/templates/workspaceRoot/CLAUDE.md.template +19 -0
- package/templates/workspaceRoot/biome.json.template +4 -244
- package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +10 -14
- package/templates/workspaceRoot/docs/GENERATED.md.template +12 -10
- package/templates/workspaceRoot/package.json.template +2 -4
- package/typeChecker-3xgrzc2v.js +7 -0
- package/typecheck.proc.js +4 -5
- package/{workflow.command-91wmvm8k.js → workflow.command-cvpmzwjg.js} +21 -23
- package/{workspace.command-wa10mfd9.js → workspace.command-4ztb4fdh.js} +108 -91
- package/capacitorApp-p0z5yab2.js +0 -60
- package/dependencyScanner-f6grrep3.js +0 -9
- package/index-mxvakhsm.js +0 -66
- package/index-r24hmh0q.js +0 -4
- package/recipeScanner-tghkzrrt.js +0 -12
- package/templates/workspaceRoot/.cursor/rules/akan-page-routing.mdc.template +0 -43
- package/templates/workspaceRoot/.cursor/rules/akan-sync-conventions.mdc.template +0 -34
- package/templates/workspaceRoot/.cursor/rules/application-test-commands.mdc.template +0 -16
- package/templates/workspaceRoot/.cursor/rules/change-scope.mdc.template +0 -12
- package/templates/workspaceRoot/.cursor/rules/client-server-boundaries.mdc.template +0 -18
- package/templates/workspaceRoot/.cursor/rules/coding-comments.mdc.template +0 -25
- package/templates/workspaceRoot/.cursor/rules/coding-style.mdc.template +0 -44
- package/templates/workspaceRoot/.cursor/rules/domain-module-conventions.mdc.template +0 -17
- package/templates/workspaceRoot/.cursor/rules/format-lint.mdc.template +0 -12
- package/templates/workspaceRoot/.cursor/rules/lint-enforced-rules.mdc.template +0 -19
- package/templates/workspaceRoot/.cursor/rules/module-file-playbook.mdc.template +0 -62
- package/templates/workspaceRoot/.cursor/rules/naming-conventions.mdc.template +0 -15
- package/templates/workspaceRoot/.cursor/rules/react-component-style.mdc.template +0 -21
- package/templates/workspaceRoot/.cursor/rules/repo-overview.mdc.template +0 -17
- package/templates/workspaceRoot/.cursor/rules/scalar-modeling.mdc.template +0 -99
- package/templates/workspaceRoot/.cursor/rules/secrets-and-env.mdc.template +0 -13
- package/templates/workspaceRoot/.cursor/rules/service-signal-conventions.mdc.template +0 -83
- package/templates/workspaceRoot/.cursor/rules/srvkit-adapters-and-guards.mdc.template +0 -50
- package/templates/workspaceRoot/.cursor/rules/ssr-first.mdc.template +0 -59
- package/templates/workspaceRoot/.cursor/rules/typescript-imports.mdc.template +0 -16
- package/typeChecker-kravn7ns.js +0 -8
- /package/{index-0wae5ebk.js → index-meh558jy.js} +0 -0
- /package/{index-ss469dec.js → index-nz8prx9g.js} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
CommandExecutionError
|
|
4
|
+
} from "./index-k1n0h7dk.js";
|
|
2
5
|
import {
|
|
3
6
|
resolveMobilePath,
|
|
4
7
|
targetHtmlFilename
|
|
5
|
-
} from "./index-
|
|
6
|
-
import {
|
|
7
|
-
CommandExecutionError
|
|
8
|
-
} from "./index-vg0sj9nc.js";
|
|
8
|
+
} from "./index-47pj3aee.js";
|
|
9
9
|
|
|
10
10
|
// pkgs/@akanjs/devkit/capacitorApp.ts
|
|
11
11
|
import { cp, mkdir, readFile, rm, writeFile } from "fs/promises";
|
|
@@ -17,22 +17,22 @@ import { capitalize } from "akanjs/common";
|
|
|
17
17
|
|
|
18
18
|
// pkgs/@akanjs/devkit/fileEditor.ts
|
|
19
19
|
class FileEditor {
|
|
20
|
-
filePath;
|
|
21
|
-
content;
|
|
20
|
+
#filePath;
|
|
21
|
+
#content;
|
|
22
22
|
constructor(filePath, content) {
|
|
23
|
-
this
|
|
24
|
-
this
|
|
23
|
+
this.#filePath = filePath;
|
|
24
|
+
this.#content = content;
|
|
25
25
|
}
|
|
26
26
|
static async create(filePath) {
|
|
27
27
|
try {
|
|
28
28
|
const content = await Bun.file(filePath).text();
|
|
29
29
|
return new FileEditor(filePath, content);
|
|
30
|
-
} catch (
|
|
30
|
+
} catch (_error) {
|
|
31
31
|
throw new Error(`Failed to read file: ${filePath}`);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
find(pattern) {
|
|
35
|
-
const lines = this
|
|
35
|
+
const lines = this.#content.split(`
|
|
36
36
|
`);
|
|
37
37
|
const regex = typeof pattern === "string" ? new RegExp(pattern) : pattern;
|
|
38
38
|
for (let i = 0;i < lines.length; i++) {
|
|
@@ -45,7 +45,7 @@ class FileEditor {
|
|
|
45
45
|
return -1;
|
|
46
46
|
}
|
|
47
47
|
findAll(pattern) {
|
|
48
|
-
const lines = this
|
|
48
|
+
const lines = this.#content.split(`
|
|
49
49
|
`);
|
|
50
50
|
const regex = typeof pattern === "string" ? new RegExp(pattern) : pattern;
|
|
51
51
|
const matches = [];
|
|
@@ -63,10 +63,10 @@ class FileEditor {
|
|
|
63
63
|
if (lineIndex === -1) {
|
|
64
64
|
throw new Error(`Pattern not found: ${pattern}`);
|
|
65
65
|
}
|
|
66
|
-
const lines = this
|
|
66
|
+
const lines = this.#content.split(`
|
|
67
67
|
`);
|
|
68
68
|
lines.splice(lineIndex + 1, 0, data);
|
|
69
|
-
this
|
|
69
|
+
this.#content = lines.join(`
|
|
70
70
|
`);
|
|
71
71
|
return this;
|
|
72
72
|
}
|
|
@@ -75,40 +75,40 @@ class FileEditor {
|
|
|
75
75
|
if (lineIndex === -1) {
|
|
76
76
|
throw new Error(`Pattern not found: ${pattern}`);
|
|
77
77
|
}
|
|
78
|
-
const lines = this
|
|
78
|
+
const lines = this.#content.split(`
|
|
79
79
|
`);
|
|
80
80
|
lines.splice(lineIndex, 0, data);
|
|
81
|
-
this
|
|
81
|
+
this.#content = lines.join(`
|
|
82
82
|
`);
|
|
83
83
|
return this;
|
|
84
84
|
}
|
|
85
85
|
replace(pattern, replacement) {
|
|
86
86
|
const regex = typeof pattern === "string" ? new RegExp(pattern, "g") : pattern;
|
|
87
|
-
this
|
|
87
|
+
this.#content = this.#content.replace(regex, replacement);
|
|
88
88
|
return this;
|
|
89
89
|
}
|
|
90
90
|
append(data) {
|
|
91
|
-
this
|
|
91
|
+
this.#content += `
|
|
92
92
|
${data}`;
|
|
93
93
|
return this;
|
|
94
94
|
}
|
|
95
95
|
prepend(data) {
|
|
96
|
-
this
|
|
97
|
-
${this
|
|
96
|
+
this.#content = `${data}
|
|
97
|
+
${this.#content}`;
|
|
98
98
|
return this;
|
|
99
99
|
}
|
|
100
100
|
async save() {
|
|
101
101
|
try {
|
|
102
|
-
await Bun.write(this
|
|
103
|
-
} catch (
|
|
104
|
-
throw new Error(`Failed to save file: ${this
|
|
102
|
+
await Bun.write(this.#filePath, this.#content);
|
|
103
|
+
} catch (_error) {
|
|
104
|
+
throw new Error(`Failed to save file: ${this.#filePath}`);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
getContent() {
|
|
108
|
-
return this
|
|
108
|
+
return this.#content;
|
|
109
109
|
}
|
|
110
110
|
setContent(content) {
|
|
111
|
-
this
|
|
111
|
+
this.#content = content;
|
|
112
112
|
return this;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -474,7 +474,7 @@ var PLACEHOLDER_APP_IDS = [
|
|
|
474
474
|
"com.example.myapp"
|
|
475
475
|
];
|
|
476
476
|
var placeholderAppIdSegment = /^(example|examples|myorg|myapp|mycompany|myorganization|changeme|todo|sample|test)$/;
|
|
477
|
-
var
|
|
477
|
+
var isPlaceholderAppId2 = (appId) => {
|
|
478
478
|
const normalized = appId?.trim().toLowerCase() ?? "";
|
|
479
479
|
if (!normalized)
|
|
480
480
|
return true;
|
|
@@ -641,7 +641,7 @@ function materializeCapacitorConfig(target, { operation, localServerUrl, localIp
|
|
|
641
641
|
return config;
|
|
642
642
|
}
|
|
643
643
|
|
|
644
|
-
class
|
|
644
|
+
class CapacitorApp2 {
|
|
645
645
|
app;
|
|
646
646
|
target;
|
|
647
647
|
project;
|
|
@@ -1513,4 +1513,4 @@ ${filter}$1`);
|
|
|
1513
1513
|
}
|
|
1514
1514
|
}
|
|
1515
1515
|
|
|
1516
|
-
export {
|
|
1516
|
+
export { isPlaceholderAppId2, CapacitorApp2 };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// pkgs/@akanjs/devkit/recipeScanner.ts
|
|
3
3
|
import { readdir } from "fs/promises";
|
|
4
4
|
import ts from "typescript";
|
|
5
|
-
var
|
|
5
|
+
var collectRecipeSources2 = async (uiDirPath, importFrom, basename = "Recipe") => {
|
|
6
6
|
const read = async (filePath) => {
|
|
7
7
|
const content = await Bun.file(filePath).text().catch(() => "");
|
|
8
8
|
return content ? { path: filePath, content, importFrom } : null;
|
|
@@ -12,7 +12,7 @@ var collectRecipeSources = async (uiDirPath, importFrom, basename = "Recipe") =>
|
|
|
12
12
|
const fromDir = await Promise.all(dirEntries.filter((entry) => entry.endsWith(".ts") && entry !== "index.ts" && !/\.(test|spec)\.ts$/.test(entry)).sort().map((entry) => read(`${uiDirPath}/${basename}/${entry}`)));
|
|
13
13
|
return [flat, ...fromDir].filter((source) => !!source);
|
|
14
14
|
};
|
|
15
|
-
var
|
|
15
|
+
var scanRecipes2 = (sources) => {
|
|
16
16
|
const recipes = [];
|
|
17
17
|
for (const source of sources) {
|
|
18
18
|
const sourceFile = ts.createSourceFile(source.path, source.content, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX);
|
|
@@ -87,7 +87,7 @@ var isNamed = (name) => ts.isIdentifier(name) || ts.isStringLiteral(name);
|
|
|
87
87
|
var propName = (name) => name.text;
|
|
88
88
|
var DUPLICATE_TOKEN_RATIO = 0.7;
|
|
89
89
|
var MIN_FINGERPRINT_TOKENS = 3;
|
|
90
|
-
var
|
|
90
|
+
var findInlineRecipeDuplicates2 = (recipes, files) => {
|
|
91
91
|
const fingerprints = recipes.map((recipe) => ({ recipe: recipe.name, tokens: (recipe.base ?? "").split(/\s+/).filter(Boolean) })).filter((fingerprint) => fingerprint.tokens.length >= MIN_FINGERPRINT_TOKENS).map((fingerprint) => ({ ...fingerprint, needed: Math.ceil(fingerprint.tokens.length * DUPLICATE_TOKEN_RATIO) }));
|
|
92
92
|
if (fingerprints.length === 0)
|
|
93
93
|
return [];
|
|
@@ -133,4 +133,4 @@ var getLeadingDoc = (fullText, node) => {
|
|
|
133
133
|
return line || undefined;
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
-
export {
|
|
136
|
+
export { collectRecipeSources2, scanRecipes2, findInlineRecipeDuplicates2 };
|
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./index-
|
|
3
|
+
script
|
|
4
|
+
} from "./index-ft1sfjz0.js";
|
|
5
|
+
import {
|
|
6
|
+
AppExecutor,
|
|
7
|
+
LibExecutor,
|
|
8
|
+
ModuleExecutor
|
|
9
|
+
} from "./index-k1n0h7dk.js";
|
|
5
10
|
import {
|
|
6
|
-
addFieldUiPolicyForType,
|
|
7
|
-
coerceFieldDefault,
|
|
8
11
|
compactDiagnostics,
|
|
9
12
|
createPrimitiveWriteReport,
|
|
13
|
+
sourceFile,
|
|
14
|
+
moduleComponentName,
|
|
15
|
+
moduleSourcePaths,
|
|
16
|
+
generatedFilesForSync,
|
|
17
|
+
validationCommandsForTarget,
|
|
18
|
+
nextActionsForTarget,
|
|
19
|
+
lowerlize,
|
|
20
|
+
normalizeFieldType,
|
|
10
21
|
ensureBaseTypeImport,
|
|
11
|
-
|
|
12
|
-
ensureEnumImport,
|
|
22
|
+
coerceFieldDefault,
|
|
13
23
|
fieldExpression,
|
|
14
|
-
|
|
15
|
-
|
|
24
|
+
viaBuilderParameterName,
|
|
25
|
+
insertIntoObject,
|
|
26
|
+
insertLightProjectionField,
|
|
27
|
+
insertTemplateField,
|
|
28
|
+
ensureEnumImport,
|
|
29
|
+
insertEnumClass,
|
|
30
|
+
insertDictionaryModelField,
|
|
16
31
|
hasConstantInputField,
|
|
17
32
|
hasDictionaryModelField,
|
|
18
|
-
|
|
33
|
+
ensureConstantTypeImport,
|
|
34
|
+
insertDictionaryEnum,
|
|
35
|
+
parseValues,
|
|
19
36
|
hasSourceParseErrors,
|
|
37
|
+
hasClassMethod,
|
|
20
38
|
insertClassMethod,
|
|
21
|
-
|
|
22
|
-
insertDictionaryModelField,
|
|
23
|
-
insertEnumClass,
|
|
24
|
-
insertIntoObject,
|
|
25
|
-
insertLightProjectionField,
|
|
39
|
+
hasSignalFactoryEntry,
|
|
26
40
|
insertSignalFactoryEntry,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
moduleComponentName,
|
|
30
|
-
moduleSourcePaths,
|
|
31
|
-
nextActionsForTarget,
|
|
32
|
-
normalizeFieldType,
|
|
33
|
-
parseValues,
|
|
34
|
-
sourceFile,
|
|
35
|
-
validationCommandsForTarget,
|
|
36
|
-
viaBuilderParameterName
|
|
37
|
-
} from "./index-2c3e2xh8.js";
|
|
41
|
+
addFieldUiPolicyForType
|
|
42
|
+
} from "./index-saheq2bs.js";
|
|
38
43
|
import {
|
|
39
|
-
|
|
40
|
-
} from "./index-
|
|
41
|
-
import {
|
|
42
|
-
AppExecutor,
|
|
43
|
-
LibExecutor,
|
|
44
|
-
ModuleExecutor
|
|
45
|
-
} from "./index-vg0sj9nc.js";
|
|
44
|
+
ModuleScript
|
|
45
|
+
} from "./index-k86zc21w.js";
|
|
46
46
|
|
|
47
47
|
// pkgs/@akanjs/cli/primitive/primitive.script.ts
|
|
48
48
|
import { capitalize } from "akanjs/common";
|
|
@@ -422,7 +422,7 @@ class HmrWatcher {
|
|
|
422
422
|
this.#unreportedChanges += unreported;
|
|
423
423
|
if (!this.#reportedCompensating) {
|
|
424
424
|
this.#reportedCompensating = true;
|
|
425
|
-
this.#logger.
|
|
425
|
+
this.#logger.verbose(`[hmr] recovered ${unreported} change(s) that fs.watch did not report; Bun coalesces concurrent saves and drops all but one, so changes are resolved by mtime`);
|
|
426
426
|
}
|
|
427
427
|
this.#logger.verbose(`[hmr] mtime scan found ${unreported} change(s) fs.watch never reported (${this.#unreportedChanges} total)`);
|
|
428
428
|
}
|
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./index-
|
|
5
|
-
import {
|
|
6
|
-
WorkflowRunner
|
|
7
|
-
} from "./index-5pmx7bkg.js";
|
|
8
|
-
import {
|
|
9
|
-
PrimitiveScript
|
|
10
|
-
} from "./index-bz2sfzzt.js";
|
|
11
|
-
import {
|
|
12
|
-
ModuleScript
|
|
13
|
-
} from "./index-vtj3zps1.js";
|
|
14
|
-
import {
|
|
15
|
-
ScalarScript
|
|
16
|
-
} from "./index-gmy45vz2.js";
|
|
3
|
+
AppExecutor
|
|
4
|
+
} from "./index-k1n0h7dk.js";
|
|
17
5
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
jsonText,
|
|
7
|
+
createWorkflowBaselineSummary,
|
|
8
|
+
buildAkanModuleContextIndex,
|
|
9
|
+
createWorkflowStepRegistry,
|
|
10
|
+
toolingRolloutGate
|
|
11
|
+
} from "./index-saheq2bs.js";
|
|
20
12
|
import {
|
|
21
|
-
|
|
22
|
-
akanMcpInstallConfigPaths,
|
|
23
|
-
akanMcpInstallTargets,
|
|
13
|
+
buildResourceList,
|
|
24
14
|
codexMcpConfigPath,
|
|
25
|
-
|
|
15
|
+
akanMcpInstallTargets,
|
|
16
|
+
akanMcpInstallConfigPaths,
|
|
26
17
|
createAkanMcpServer,
|
|
18
|
+
createAkanCodexMcpServerBlock,
|
|
19
|
+
upsertCodexMcpServerBlock,
|
|
27
20
|
renderDoctorText,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} from "./index-mssqn2sq.js";
|
|
21
|
+
AkanContextAnalyzer
|
|
22
|
+
} from "./index-5y7qba1c.js";
|
|
31
23
|
import {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
CommandContainer,
|
|
25
|
+
runner,
|
|
26
|
+
script
|
|
27
|
+
} from "./index-ft1sfjz0.js";
|
|
28
|
+
import {
|
|
29
|
+
isPlaceholderAppId2
|
|
30
|
+
} from "./index-b2nt0w0k.js";
|
|
38
31
|
import {
|
|
39
32
|
Prompter
|
|
40
|
-
} from "./index-
|
|
33
|
+
} from "./index-h7yw2z9n.js";
|
|
41
34
|
import {
|
|
42
|
-
|
|
43
|
-
} from "./index-
|
|
35
|
+
RepairRunner
|
|
36
|
+
} from "./index-qcracvc9.js";
|
|
44
37
|
import {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
script
|
|
48
|
-
} from "./index-6rhabeev.js";
|
|
38
|
+
WorkflowRunner
|
|
39
|
+
} from "./index-j9vnq8tr.js";
|
|
49
40
|
import {
|
|
50
|
-
|
|
51
|
-
} from "./index-
|
|
41
|
+
ModuleScript
|
|
42
|
+
} from "./index-k86zc21w.js";
|
|
43
|
+
import {
|
|
44
|
+
PrimitiveScript
|
|
45
|
+
} from "./index-cd5x18qh.js";
|
|
46
|
+
import {
|
|
47
|
+
ScalarScript
|
|
48
|
+
} from "./index-v0s24t8j.js";
|
|
49
|
+
import {
|
|
50
|
+
getMobileTargets
|
|
51
|
+
} from "./index-47pj3aee.js";
|
|
52
52
|
|
|
53
53
|
// pkgs/@akanjs/cli/context/context.script.ts
|
|
54
54
|
import { Logger } from "akanjs/common";
|
|
@@ -380,12 +380,15 @@ var applyMcpTools = [
|
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
];
|
|
383
|
-
var listAkanMcpTools = (mode = "readonly") => {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
383
|
+
var listAkanMcpTools = (mode = "readonly", { guidelineNames = [] } = {}) => {
|
|
384
|
+
const tools = mode === "readonly" ? readonlyMcpTools : mode === "plan" ? [...readonlyMcpTools, ...planMcpTools] : [...readonlyMcpTools, ...planMcpTools, ...applyMcpTools];
|
|
385
|
+
if (guidelineNames.length === 0)
|
|
386
|
+
return tools;
|
|
387
|
+
return tools.map((tool) => tool.name === "get_guideline" ? {
|
|
388
|
+
...tool,
|
|
389
|
+
description: `${tool.description ?? ""} One of: ${guidelineNames.join(", ")}.`.trim(),
|
|
390
|
+
inputSchema: { ...tool.inputSchema, properties: { name: { type: "string", enum: [...guidelineNames] } } }
|
|
391
|
+
} : tool);
|
|
389
392
|
};
|
|
390
393
|
var createAkanValidationContract = (listTools = listAkanMcpTools) => ({
|
|
391
394
|
schemaVersion: 1,
|
|
@@ -604,6 +607,10 @@ var createCliWorkflowStepRegistry = (workspace) => createWorkflowStepRegistry({
|
|
|
604
607
|
});
|
|
605
608
|
|
|
606
609
|
// pkgs/@akanjs/cli/context/context.runner.ts
|
|
610
|
+
var toolErrorText = (error) => {
|
|
611
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
612
|
+
return message.replace(/\/(?:[^\s"'/]+\/)*(?=(?:pkgs|apps|libs|infra)\/)/g, "<workspace>/");
|
|
613
|
+
};
|
|
607
614
|
var workflowDiagnosticFromContext = (diagnostic) => ({
|
|
608
615
|
severity: diagnostic.severity,
|
|
609
616
|
code: diagnostic.code,
|
|
@@ -662,7 +669,7 @@ class ContextRunner extends runner("context") {
|
|
|
662
669
|
if (!config.hasMobileConfig)
|
|
663
670
|
continue;
|
|
664
671
|
for (const { name, config: target } of await getMobileTargets(app)) {
|
|
665
|
-
if (!
|
|
672
|
+
if (!isPlaceholderAppId2(target.appId))
|
|
666
673
|
continue;
|
|
667
674
|
diagnostics.push({
|
|
668
675
|
severity: "warning",
|
|
@@ -720,8 +727,8 @@ class ContextRunner extends runner("context") {
|
|
|
720
727
|
await workspace.writeFile(codexMcpConfigPath, merged);
|
|
721
728
|
return codexMcpConfigPath;
|
|
722
729
|
}
|
|
723
|
-
listMcpTools(mode = "readonly") {
|
|
724
|
-
return listAkanMcpTools(mode);
|
|
730
|
+
listMcpTools(mode = "readonly", { guidelineNames = [] } = {}) {
|
|
731
|
+
return listAkanMcpTools(mode, { guidelineNames });
|
|
725
732
|
}
|
|
726
733
|
async callMcpTool(workspace, name, args = {}, { mode = "readonly" } = {}) {
|
|
727
734
|
const availableTools = this.listMcpTools(mode);
|
|
@@ -776,7 +783,7 @@ class ContextRunner extends runner("context") {
|
|
|
776
783
|
if (name === "explain_command")
|
|
777
784
|
return this.explainCommand(stringArg(args, "command"));
|
|
778
785
|
if (name === "get_validation_contract")
|
|
779
|
-
return createAkanValidationContract((
|
|
786
|
+
return createAkanValidationContract((mode) => this.listMcpTools(mode));
|
|
780
787
|
if (name === "list_workflows")
|
|
781
788
|
return parseJsonOutput(new WorkflowRunner().list({ format: "json" }));
|
|
782
789
|
if (name === "explain_workflow")
|
|
@@ -851,17 +858,20 @@ class ContextRunner extends runner("context") {
|
|
|
851
858
|
${payload}`);
|
|
852
859
|
};
|
|
853
860
|
const respond = (id, result, framing) => {
|
|
854
|
-
writeMessage({ jsonrpc: "2.0", id, result }, framing);
|
|
861
|
+
writeMessage({ jsonrpc: "2.0", id: id ?? null, result }, framing);
|
|
855
862
|
};
|
|
856
863
|
const respondError = (id, code, message, framing) => {
|
|
857
|
-
writeMessage({ jsonrpc: "2.0", id, error: { code, message } }, framing);
|
|
864
|
+
writeMessage({ jsonrpc: "2.0", id: id ?? null, error: { code, message } }, framing);
|
|
858
865
|
};
|
|
866
|
+
const guidelineNames = await Prompter.listGuidelines();
|
|
867
|
+
const resources = buildResourceList(guidelineNames);
|
|
859
868
|
const readResource = async (uri) => {
|
|
860
|
-
|
|
861
|
-
if (uri === "akan://docs/framework" || uri === "akan://guidelines/framework")
|
|
869
|
+
if (uri === "akan://docs/framework")
|
|
862
870
|
return { uri, mimeType: "text/markdown", text: await Prompter.getInstruction("framework") };
|
|
863
|
-
|
|
864
|
-
|
|
871
|
+
const guideline = /^akan:\/\/guidelines\/(.+)$/.exec(uri)?.[1];
|
|
872
|
+
if (guideline)
|
|
873
|
+
return { uri, mimeType: "text/markdown", text: await Prompter.getInstruction(guideline) };
|
|
874
|
+
const context = await AkanContextAnalyzer.analyze(workspace);
|
|
865
875
|
if (uri === "akan://workspace/summary")
|
|
866
876
|
return { uri, mimeType: "application/json", text: jsonText(context, { trailingNewline: false }) };
|
|
867
877
|
if (uri === "akan://workspace/apps")
|
|
@@ -883,7 +893,7 @@ ${payload}`);
|
|
|
883
893
|
}
|
|
884
894
|
throw new Error(`Unknown resource: ${uri}`);
|
|
885
895
|
};
|
|
886
|
-
const
|
|
896
|
+
const handleRequest = async (request, framing) => {
|
|
887
897
|
const params = request.params ?? {};
|
|
888
898
|
if (request.method === "initialize") {
|
|
889
899
|
respond(request.id, {
|
|
@@ -893,7 +903,7 @@ ${payload}`);
|
|
|
893
903
|
}, framing);
|
|
894
904
|
} else if (request.method === "tools/list") {
|
|
895
905
|
respond(request.id, {
|
|
896
|
-
tools: this.listMcpTools(mode)
|
|
906
|
+
tools: this.listMcpTools(mode, { guidelineNames })
|
|
897
907
|
}, framing);
|
|
898
908
|
} else if (request.method === "tools/call") {
|
|
899
909
|
const name = params.name;
|
|
@@ -909,16 +919,39 @@ ${payload}`);
|
|
|
909
919
|
]
|
|
910
920
|
}, framing);
|
|
911
921
|
} catch (error) {
|
|
912
|
-
|
|
922
|
+
respond(request.id, { content: [{ type: "text", text: toolErrorText(error) }], isError: true }, framing);
|
|
913
923
|
}
|
|
914
924
|
} else if (request.method === "resources/list") {
|
|
915
|
-
respond(request.id, { resources
|
|
925
|
+
respond(request.id, { resources }, framing);
|
|
916
926
|
} else if (request.method === "resources/read") {
|
|
917
927
|
respond(request.id, { contents: [await readResource(params.uri)] }, framing);
|
|
918
|
-
} else
|
|
928
|
+
} else {
|
|
919
929
|
respondError(request.id, -32601, `Unknown method: ${request.method}`, framing);
|
|
920
930
|
}
|
|
921
931
|
};
|
|
932
|
+
const handle = async (request, framing) => {
|
|
933
|
+
if (request.id === undefined || request.id === null)
|
|
934
|
+
return;
|
|
935
|
+
try {
|
|
936
|
+
await handleRequest(request, framing);
|
|
937
|
+
} catch (error) {
|
|
938
|
+
respondError(request.id, -32603, error instanceof Error ? error.message : String(error), framing);
|
|
939
|
+
}
|
|
940
|
+
};
|
|
941
|
+
const handleFrame = async (payload, framing) => {
|
|
942
|
+
let request;
|
|
943
|
+
try {
|
|
944
|
+
request = JSON.parse(payload);
|
|
945
|
+
} catch (error) {
|
|
946
|
+
respondError(null, -32700, error instanceof Error ? error.message : String(error), framing);
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
if (!request || typeof request !== "object" || typeof request.method !== "string") {
|
|
950
|
+
respondError(null, -32600, "Invalid Request: expected a JSON-RPC 2.0 object with a method", framing);
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
953
|
+
await handle(request, framing);
|
|
954
|
+
};
|
|
922
955
|
const parseContentLengthMessage = async () => {
|
|
923
956
|
const headerEnd = buffer.indexOf(`\r
|
|
924
957
|
\r
|
|
@@ -938,7 +971,7 @@ ${payload}`);
|
|
|
938
971
|
return false;
|
|
939
972
|
const body = buffer.slice(bodyStart, bodyEnd);
|
|
940
973
|
buffer = buffer.slice(bodyEnd);
|
|
941
|
-
await
|
|
974
|
+
await handleFrame(body, "content-length");
|
|
942
975
|
return true;
|
|
943
976
|
};
|
|
944
977
|
const parseLineMessage = async () => {
|
|
@@ -950,7 +983,7 @@ ${payload}`);
|
|
|
950
983
|
buffer = buffer.slice(lineEnd + 1);
|
|
951
984
|
if (!line)
|
|
952
985
|
return true;
|
|
953
|
-
await
|
|
986
|
+
await handleFrame(line, "newline");
|
|
954
987
|
return true;
|
|
955
988
|
};
|
|
956
989
|
const parse = async () => {
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
AppExecutor,
|
|
4
3
|
Executor,
|
|
4
|
+
WorkspaceExecutor,
|
|
5
|
+
AppExecutor,
|
|
5
6
|
LibExecutor,
|
|
6
|
-
ModuleExecutor,
|
|
7
7
|
PkgExecutor,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "./index-vg0sj9nc.js";
|
|
8
|
+
ModuleExecutor
|
|
9
|
+
} from "./index-k1n0h7dk.js";
|
|
11
10
|
import {
|
|
12
11
|
FileSys
|
|
13
|
-
} from "./index-
|
|
12
|
+
} from "./index-ayy5ecax.js";
|
|
14
13
|
import {
|
|
15
|
-
|
|
16
|
-
} from "./index-
|
|
14
|
+
getDirname2
|
|
15
|
+
} from "./index-6wwzs1bc.js";
|
|
17
16
|
|
|
18
17
|
// pkgs/@akanjs/devkit/commandDecorators/targetMeta.ts
|
|
19
18
|
var COMMAND_META = Symbol("akan.command.meta");
|
|
@@ -381,6 +380,16 @@ var prompts = async () => await import("@inquirer/prompts");
|
|
|
381
380
|
var select = (config, context) => prompts().then((m) => m.select(config, context));
|
|
382
381
|
var confirm = (config, context) => prompts().then((m) => m.confirm(config, context));
|
|
383
382
|
var input = (config, context) => prompts().then((m) => m.input(config, context));
|
|
383
|
+
var assertEnumChoice = (argMeta, value) => {
|
|
384
|
+
const enumChoices = argMeta.argsOption.enum;
|
|
385
|
+
if (!enumChoices || typeof enumChoices === "function")
|
|
386
|
+
return;
|
|
387
|
+
const choices = normalizeEnumChoices(enumChoices);
|
|
388
|
+
if (choices.some((choice) => String(choice.value) === String(value)))
|
|
389
|
+
return;
|
|
390
|
+
const label = argMeta.type === "Option" ? `option '--${camelToKebabCase3(argMeta.name)}'` : `argument '${argMeta.name}'`;
|
|
391
|
+
throw new Error(`${label} argument '${String(value)}' is invalid. Allowed choices are ${choices.map((choice) => choice.name).join(", ")}.`);
|
|
392
|
+
};
|
|
384
393
|
var resolveEnumChoices = async (argMeta, context) => {
|
|
385
394
|
const enumChoices = argMeta.argsOption.enum;
|
|
386
395
|
if (!enumChoices)
|
|
@@ -394,9 +403,10 @@ var getOptionValue = async (argMeta, opt, context) => {
|
|
|
394
403
|
name,
|
|
395
404
|
argsOption: { enum: enumChoices, default: defaultValue, type, desc, nullable, example, ask }
|
|
396
405
|
} = argMeta;
|
|
397
|
-
if (opt[argMeta.name] !== undefined)
|
|
406
|
+
if (opt[argMeta.name] !== undefined) {
|
|
407
|
+
assertEnumChoice(argMeta, opt[argMeta.name]);
|
|
398
408
|
return convertArgValue(opt[argMeta.name], type ?? "string");
|
|
399
|
-
else if (defaultValue !== undefined)
|
|
409
|
+
} else if (defaultValue !== undefined)
|
|
400
410
|
return defaultValue;
|
|
401
411
|
if (enumChoices) {
|
|
402
412
|
const choices = normalizeEnumChoices(await resolveEnumChoices(argMeta, context) ?? []);
|
|
@@ -422,9 +432,10 @@ var getArgumentValue = async (argMeta, value) => {
|
|
|
422
432
|
name,
|
|
423
433
|
argsOption: { default: defaultValue, type, desc, nullable, example, ask }
|
|
424
434
|
} = argMeta;
|
|
425
|
-
if (value !== undefined)
|
|
435
|
+
if (value !== undefined) {
|
|
436
|
+
assertEnumChoice(argMeta, value);
|
|
426
437
|
return convertArgValue(value, type ?? "string");
|
|
427
|
-
else if (defaultValue !== undefined)
|
|
438
|
+
} else if (defaultValue !== undefined)
|
|
428
439
|
return defaultValue;
|
|
429
440
|
else if (nullable)
|
|
430
441
|
return null;
|
|
@@ -526,36 +537,36 @@ var getInternalArgumentValue = async (argMeta, value, workspace) => {
|
|
|
526
537
|
return PkgExecutor.from(workspace, pkgName);
|
|
527
538
|
} else if (sysType === "module") {
|
|
528
539
|
if (value) {
|
|
529
|
-
const [sysName,
|
|
530
|
-
if (!sysName || !
|
|
540
|
+
const [sysName, moduleName] = value.split(":");
|
|
541
|
+
if (!sysName || !moduleName)
|
|
531
542
|
throw new Error(`Invalid module name: ${value}`);
|
|
532
543
|
if (appNames.includes(sysName)) {
|
|
533
544
|
const app = AppExecutor.from(workspace, sysName);
|
|
534
|
-
const
|
|
535
|
-
if (
|
|
536
|
-
return ModuleExecutor.from(app,
|
|
545
|
+
const modules = await app.getModules();
|
|
546
|
+
if (modules.includes(moduleName))
|
|
547
|
+
return ModuleExecutor.from(app, moduleName);
|
|
537
548
|
else
|
|
538
|
-
throw new Error(`Invalid module name: ${
|
|
549
|
+
throw new Error(`Invalid module name: ${moduleName}`);
|
|
539
550
|
} else if (libNames.includes(sysName)) {
|
|
540
551
|
const lib = LibExecutor.from(workspace, sysName);
|
|
541
|
-
const
|
|
542
|
-
if (
|
|
543
|
-
return ModuleExecutor.from(lib,
|
|
552
|
+
const modules = await lib.getModules();
|
|
553
|
+
if (modules.includes(moduleName))
|
|
554
|
+
return ModuleExecutor.from(lib, moduleName);
|
|
544
555
|
} else
|
|
545
556
|
throw new Error(`Invalid system name: ${sysName}`);
|
|
546
557
|
}
|
|
547
558
|
const { type, name } = await select({
|
|
548
559
|
message: `select the App or Lib name`,
|
|
549
560
|
choices: [
|
|
550
|
-
...appNames.map((
|
|
551
|
-
...libNames.map((
|
|
561
|
+
...appNames.map((name) => ({ name, value: { type: "app", name } })),
|
|
562
|
+
...libNames.map((name) => ({ name, value: { type: "lib", name } }))
|
|
552
563
|
]
|
|
553
564
|
});
|
|
554
565
|
const executor = type === "app" ? AppExecutor.from(workspace, name) : LibExecutor.from(workspace, name);
|
|
555
566
|
const modules = await executor.getModules();
|
|
556
567
|
const moduleName = await select({
|
|
557
568
|
message: `Select the module name`,
|
|
558
|
-
choices: modules.map((
|
|
569
|
+
choices: modules.map((name) => ({ name: `${executor.name}:${name}`, value: name }))
|
|
559
570
|
});
|
|
560
571
|
return ModuleExecutor.from(executor, moduleName);
|
|
561
572
|
} else
|
|
@@ -566,7 +577,7 @@ var runCommands = async (...commands) => {
|
|
|
566
577
|
printCliError(error);
|
|
567
578
|
process.exit(1);
|
|
568
579
|
});
|
|
569
|
-
const __dirname2 =
|
|
580
|
+
const __dirname2 = getDirname2(import.meta.url);
|
|
570
581
|
const packageJsonCandidates = [`${path.dirname(Bun.main)}/package.json`, `${__dirname2}/../package.json`];
|
|
571
582
|
let cliPackageJson = null;
|
|
572
583
|
for (const packageJsonPath of packageJsonCandidates) {
|