@akanjs/cli 3.1.2-rc.1 → 3.1.2-rc.3
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-dyc45f5w.js → CodeAgent-n2tkg59z.js} +2 -2
- package/{CodeTui-q55b2zrn.js → CodeTui-9wsdx7ap.js} +1 -1
- package/{TunnelShare-hdq9h1hr.js → TunnelShare-6d7z36sr.js} +1 -1
- package/{agent.command-20zaqe60.js → agent.command-tffz6wdn.js} +8 -8
- package/akanCode.js +2 -2
- package/{application.command-nd0fshsk.js → application.command-7bkxbrsp.js} +17 -2
- package/{cloud.command-8kbddsz9.js → cloud.command-a792bc10.js} +3 -3
- package/{cloud.script-hgvvajm3.js → cloud.script-t2n13gv6.js} +3 -3
- package/{code.command-625bg8s8.js → code.command-ma8dtzww.js} +4 -4
- package/commandManifest.json +1 -1
- package/{context.command-p6haqjay.js → context.command-80a1qhps.js} +12 -11
- package/{context.runner-rsnqnk9j.js → context.runner-wxqb3qcy.js} +11 -10
- package/incrementalBuilder.proc.js +22 -2
- package/{index-g841cap9.js → index-361ex3rb.js} +23 -2
- package/{index-raz588b3.js → index-9z3egsmg.js} +8 -7
- package/{index-fhw7yq2d.js → index-aayg4dqf.js} +4 -4
- package/{index-ewbmfarf.js → index-db2nqrad.js} +20 -2
- package/{index-7apsdr5g.js → index-eft5c2mp.js} +1 -1
- package/{index-t1t9wq9a.js → index-gbp1q1b5.js} +1 -1
- package/{index-jc2zbwra.js → index-hapx5myy.js} +1 -1
- package/index-j2dgmzbj.js +1259 -0
- package/{index-j7hwy56s.js → index-j9d3mjx1.js} +1 -1
- package/{index-qw6814m4.js → index-jb2sreps.js} +20 -5
- package/{index-fbewhg4g.js → index-k64mhwbw.js} +60 -1
- package/{index-hm0tn7qv.js → index-m02tdq8a.js} +102 -4
- package/{index-2mwjshz5.js → index-ppvqy5bc.js} +8 -5
- package/{index-tgqameyb.js → index-scck6h6d.js} +3 -3
- package/{index-cjmjvg4r.js → index-sjabnf7j.js} +2 -2
- package/{index-00a7j05x.js → index-sx91nf4z.js} +1 -1
- package/{index-2phm56a1.js → index-tns543wd.js} +2 -2
- package/index-vzpnr12w.js +65 -0
- package/{index-1qsd8ft1.js → index-wrmq92vk.js} +1 -1
- package/{index-a1vb3x7t.js → index-z7kbxdqg.js} +3 -3
- package/{index-t78230d7.js → index-zdpte1pj.js} +2 -1
- package/index.js +16 -16
- package/{localRegistry.command-g3f8k25t.js → localRegistry.command-343ksmn9.js} +2 -2
- package/{module.command-r4sa2khp.js → module.command-2hce9m6k.js} +3 -3
- package/package.json +2 -2
- package/{primitive.command-dfsv4mpe.js → primitive.command-7tdj12wn.js} +4 -4
- package/{quality.command-webzxee2.js → quality.command-29bgarh1.js} +3 -3
- package/{repair.command-3r3j1xre.js → repair.command-yng4rf5d.js} +4 -4
- package/{scalar.command-e8y47j6d.js → scalar.command-1nk4329t.js} +3 -3
- package/skills/akan-scaffold/SKILL.md +1 -0
- package/{subspace.command-a1sf9n5a.js → subspace.command-5cehmcdd.js} +1 -1
- package/{tunnel.command-dcb0wg93.js → tunnel.command-yrd4atqy.js} +1 -1
- package/{verify.command-yyepccbh.js → verify.command-kbq0fcg8.js} +5 -5
- package/{workflow.command-z5pg9ay0.js → workflow.command-274qfa8z.js} +13 -11
- package/{workspace.command-d7x5jttw.js → workspace.command-r6hgmawy.js} +18 -17
- package/index-2nxk8wgs.js +0 -266
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
createWorkflowBaselineSummary,
|
|
8
8
|
buildAkanModuleContextIndex,
|
|
9
9
|
toolingRolloutGate
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-m02tdq8a.js";
|
|
11
11
|
import {
|
|
12
12
|
buildResourceList,
|
|
13
13
|
codexMcpConfigPath,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
upsertCodexMcpServerBlock,
|
|
18
18
|
renderDoctorText,
|
|
19
19
|
AkanContextAnalyzer
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-j9d3mjx1.js";
|
|
21
21
|
import {
|
|
22
22
|
runner
|
|
23
23
|
} from "./index-9zy8479y.js";
|
|
@@ -34,12 +34,15 @@ import {
|
|
|
34
34
|
import {
|
|
35
35
|
Prompter2
|
|
36
36
|
} from "./index-j6eeh5d7.js";
|
|
37
|
+
import {
|
|
38
|
+
WorkspaceGraph
|
|
39
|
+
} from "./index-vzpnr12w.js";
|
|
37
40
|
import {
|
|
38
41
|
RepairRunner
|
|
39
|
-
} from "./index-
|
|
42
|
+
} from "./index-tns543wd.js";
|
|
40
43
|
import {
|
|
41
44
|
WorkflowRunner
|
|
42
|
-
} from "./index-
|
|
45
|
+
} from "./index-9z3egsmg.js";
|
|
43
46
|
|
|
44
47
|
// pkgs/@akanjs/devkit/akanMcpContract.ts
|
|
45
48
|
import { lstatSync, realpathSync } from "fs";
|
|
@@ -182,7 +185,9 @@ var defaultWorkflowPlanPath = (workflow, inputs) => {
|
|
|
182
185
|
slugPart(inputs.scalar),
|
|
183
186
|
slugPart(inputs.surface),
|
|
184
187
|
slugPart(inputs.mutation),
|
|
185
|
-
slugPart(inputs.slice)
|
|
188
|
+
slugPart(inputs.slice),
|
|
189
|
+
slugPart(inputs.query),
|
|
190
|
+
slugPart(inputs.to)
|
|
186
191
|
].filter(Boolean).join("-");
|
|
187
192
|
return `.akan/workflows/plans/${slug || "workflow-plan"}.json`;
|
|
188
193
|
};
|
|
@@ -292,6 +297,11 @@ var readonlyMcpTools = [
|
|
|
292
297
|
description: "Legacy broad module context. Pass app in monorepos; prefer inspect_akan_context.moduleContext or fieldInsertionContext for typed add-field evidence.",
|
|
293
298
|
inputSchema: { type: "object", properties: { app: stringProperty, module: stringProperty }, required: ["module"] }
|
|
294
299
|
},
|
|
300
|
+
{
|
|
301
|
+
name: "get_graph",
|
|
302
|
+
description: "Read-only Akan Graph from source, no dev server needed: models with their fields and relations, slices and endpoints with guards, the service methods and queries each calls, the store actions that fetch them, and the components and pages that use them. Every node and edge carries its source location. Pass app and/or module to scope a large workspace.",
|
|
303
|
+
inputSchema: { type: "object", properties: { app: stringProperty, module: stringProperty } }
|
|
304
|
+
},
|
|
295
305
|
{
|
|
296
306
|
name: "get_guideline",
|
|
297
307
|
description: "Return an Akan agent guideline resource by name.",
|
|
@@ -746,6 +756,11 @@ class ContextRunner2 extends runner("context") {
|
|
|
746
756
|
}
|
|
747
757
|
return modules;
|
|
748
758
|
}
|
|
759
|
+
if (name === "get_graph")
|
|
760
|
+
return WorkspaceGraph.answer(await WorkspaceGraph.build(workspace), {
|
|
761
|
+
app: typeof args.app === "string" ? args.app : null,
|
|
762
|
+
module: typeof args.module === "string" ? args.module : null
|
|
763
|
+
});
|
|
749
764
|
if (name === "get_guideline")
|
|
750
765
|
return await Prompter2.getInstruction(stringArg(args, "name"));
|
|
751
766
|
if (name === "doctor_workspace")
|
|
@@ -575,6 +575,64 @@ var createUiWorkflowSpec = {
|
|
|
575
575
|
completionCriteria: ["Requested UI surface exists.", "UI barrels are refreshed.", "Lint passes."]
|
|
576
576
|
};
|
|
577
577
|
|
|
578
|
+
// pkgs/@akanjs/cli/workflows/renameKey.ts
|
|
579
|
+
var renameKeyWorkflowSpec = {
|
|
580
|
+
schemaVersion: 1,
|
|
581
|
+
name: "rename-key",
|
|
582
|
+
description: "Rename a slice key or a Filter query key together with every name derived from it.",
|
|
583
|
+
whenToUse: "Use when the user renames a slice (inPublic) or a query (byName). A field, method or endpoint keeps its name in every use, so TypeScript's rename covers it.",
|
|
584
|
+
inputs: {
|
|
585
|
+
...sysInputs,
|
|
586
|
+
...moduleInput,
|
|
587
|
+
slice: { type: "string", description: "Slice key to rename; give this or query." },
|
|
588
|
+
query: { type: "string", description: "Filter query key to rename; give this or slice." },
|
|
589
|
+
to: { type: "string", required: true, description: "New key, camelCase." }
|
|
590
|
+
},
|
|
591
|
+
steps: [
|
|
592
|
+
inspectModuleStep("Index the workspace and find the key with every derived name that resolves to it."),
|
|
593
|
+
{
|
|
594
|
+
id: "rename-key",
|
|
595
|
+
title: "Rename key",
|
|
596
|
+
tool: "renameKey",
|
|
597
|
+
description: "Rewrite the key, its derived names in the app and every lib, and its module dictionary entry. A use that could also be another model's is left for the typecheck to report."
|
|
598
|
+
},
|
|
599
|
+
syncGeneratedStep("Refresh generated files after the rename."),
|
|
600
|
+
validateTarget
|
|
601
|
+
],
|
|
602
|
+
predictedChanges: [
|
|
603
|
+
{
|
|
604
|
+
target: "*/lib/<module>/<module>.signal.ts",
|
|
605
|
+
action: "modify",
|
|
606
|
+
applyScope: "auto",
|
|
607
|
+
reason: "The slice key is renamed."
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
target: "*/lib/<module>/<module>.document.ts",
|
|
611
|
+
action: "modify",
|
|
612
|
+
applyScope: "auto",
|
|
613
|
+
reason: "The Filter query key is renamed."
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
target: "*/lib/<module>/<module>.dictionary.ts",
|
|
617
|
+
action: "modify",
|
|
618
|
+
applyScope: "auto",
|
|
619
|
+
reason: "The key's dictionary entry is renamed."
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
target: "{apps,libs}/**/*.{ts,tsx}",
|
|
623
|
+
action: "modify",
|
|
624
|
+
applyScope: "auto",
|
|
625
|
+
reason: "Derived names (initMemoInPublic, listByName) follow the new key."
|
|
626
|
+
},
|
|
627
|
+
{ target: "*/lib/sig.ts", action: "sync", reason: "Generated signal barrel may change after sync." }
|
|
628
|
+
],
|
|
629
|
+
validation: baseValidation,
|
|
630
|
+
completionCriteria: [
|
|
631
|
+
"The key and every derived name use the new key.",
|
|
632
|
+
"Validation passes, so no use the rename left behind still names the old key."
|
|
633
|
+
]
|
|
634
|
+
};
|
|
635
|
+
|
|
578
636
|
// pkgs/@akanjs/cli/workflows/index.ts
|
|
579
637
|
var workflowSpecs = [
|
|
580
638
|
createModuleWorkflowSpec,
|
|
@@ -584,7 +642,8 @@ var workflowSpecs = [
|
|
|
584
642
|
addFieldWorkflowSpec,
|
|
585
643
|
addEnumFieldWorkflowSpec,
|
|
586
644
|
addMutationWorkflowSpec,
|
|
587
|
-
addSliceWorkflowSpec
|
|
645
|
+
addSliceWorkflowSpec,
|
|
646
|
+
renameKeyWorkflowSpec
|
|
588
647
|
];
|
|
589
648
|
|
|
590
649
|
export { sysInputs, workflowSpecs };
|
|
@@ -4,8 +4,9 @@ import {
|
|
|
4
4
|
LibExecutor
|
|
5
5
|
} from "./index-g500c5j9.js";
|
|
6
6
|
import {
|
|
7
|
-
createAst
|
|
8
|
-
|
|
7
|
+
createAst,
|
|
8
|
+
AkanIndex
|
|
9
|
+
} from "./index-j2dgmzbj.js";
|
|
9
10
|
import {
|
|
10
11
|
camelToKebabCase
|
|
11
12
|
} from "./index-9zy8479y.js";
|
|
@@ -2112,6 +2113,7 @@ var createWorkflowStepRegistry = ({
|
|
|
2112
2113
|
addEnumField,
|
|
2113
2114
|
addMutation,
|
|
2114
2115
|
addSlice,
|
|
2116
|
+
renameKey,
|
|
2115
2117
|
createInteraction
|
|
2116
2118
|
}) => {
|
|
2117
2119
|
const inspect = async () => {
|
|
@@ -2213,7 +2215,14 @@ var createWorkflowStepRegistry = ({
|
|
|
2213
2215
|
slice: workflowStringInput(plan.inputs.slice)
|
|
2214
2216
|
})),
|
|
2215
2217
|
[workflowStepKey("add-slice", "update-signal-slice")]: inspect,
|
|
2216
|
-
[workflowStepKey("add-slice", "connect-view-surfaces")]: async (_step, plan) => addSliceViewSurfaceInspection(plan)
|
|
2218
|
+
[workflowStepKey("add-slice", "connect-view-surfaces")]: async (_step, plan) => addSliceViewSurfaceInspection(plan),
|
|
2219
|
+
[workflowStepKey("rename-key", "rename-key")]: async (_step, plan) => primitiveReportToWorkflowStepResult(await renameKey({
|
|
2220
|
+
app: workflowStringInput(plan.inputs.app),
|
|
2221
|
+
module: workflowStringInput(plan.inputs.module),
|
|
2222
|
+
slice: workflowStringInput(plan.inputs.slice),
|
|
2223
|
+
query: workflowStringInput(plan.inputs.query),
|
|
2224
|
+
to: workflowStringInput(plan.inputs.to)
|
|
2225
|
+
}))
|
|
2217
2226
|
};
|
|
2218
2227
|
};
|
|
2219
2228
|
class WorkflowExecutor {
|
|
@@ -2367,6 +2376,75 @@ class GuardCatalog {
|
|
|
2367
2376
|
}));
|
|
2368
2377
|
}
|
|
2369
2378
|
}
|
|
2379
|
+
// pkgs/@akanjs/devkit/workflow/keyRename.ts
|
|
2380
|
+
import { readFile } from "fs/promises";
|
|
2381
|
+
import path2 from "path";
|
|
2382
|
+
import ts5 from "typescript";
|
|
2383
|
+
var indexedPath = /^(apps|libs)\/(?!(?:.*\/)?(?:node_modules|dist|\.akan)\/).*\.tsx?$/;
|
|
2384
|
+
var keyPattern = /^[a-z][A-Za-z0-9]*$/;
|
|
2385
|
+
var slashed = (fileName) => fileName.replace(/\\/g, "/");
|
|
2386
|
+
var refuse = (code, input, message) => ({
|
|
2387
|
+
diagnostics: [{ severity: "error", code, input, message }],
|
|
2388
|
+
files: []
|
|
2389
|
+
});
|
|
2390
|
+
|
|
2391
|
+
class KeyRename {
|
|
2392
|
+
static async build(workspace, input) {
|
|
2393
|
+
const sys = await resolveWorkflowSys(workspace, input.app);
|
|
2394
|
+
if (!sys)
|
|
2395
|
+
return refuse("workflow-target-missing", "app", `No app or library named ${input.app ?? ""}.`);
|
|
2396
|
+
if (!input.module)
|
|
2397
|
+
return refuse("workflow-input-missing", "module", "Module name is required.");
|
|
2398
|
+
if (!input.slice === !input.query)
|
|
2399
|
+
return refuse("rename-key-source-invalid", "slice", "Name exactly one key to rename, as slice or as query.");
|
|
2400
|
+
const family = input.slice ? "slice" : "query";
|
|
2401
|
+
const from = input.slice ?? input.query ?? "";
|
|
2402
|
+
if (!input.to || !keyPattern.test(input.to))
|
|
2403
|
+
return refuse("rename-key-name-invalid", "to", `New key "${input.to ?? ""}" must be camelCase (inFeed, byTitle).`);
|
|
2404
|
+
if (input.to === from)
|
|
2405
|
+
return refuse("rename-key-name-same", "to", `New key is the same as ${from}.`);
|
|
2406
|
+
const root = workspace.workspaceRoot;
|
|
2407
|
+
const paths = moduleSourcePaths(input.module);
|
|
2408
|
+
const sourceRelative = `${getSysRoot(sys)}/${family === "slice" ? paths.signal : paths.document}`;
|
|
2409
|
+
const sourcePath = slashed(path2.join(root, sourceRelative));
|
|
2410
|
+
const texts = new Map;
|
|
2411
|
+
const index = new AkanIndex({ ts: ts5, root });
|
|
2412
|
+
for (const relative of await workspace.getAllFiles("{apps,libs}/**/*.{ts,tsx}")) {
|
|
2413
|
+
if (!indexedPath.test(slashed(relative)))
|
|
2414
|
+
continue;
|
|
2415
|
+
const fileName = slashed(path2.join(root, relative));
|
|
2416
|
+
const text = await readFile(fileName, "utf8");
|
|
2417
|
+
texts.set(fileName, text);
|
|
2418
|
+
index.setFile(fileName, text);
|
|
2419
|
+
}
|
|
2420
|
+
const keys = index.sourceKeysOf(sourcePath).filter((key) => key.family === family);
|
|
2421
|
+
const source = keys.find((key) => key.sourceKey === from);
|
|
2422
|
+
if (!source)
|
|
2423
|
+
return refuse("rename-key-source-missing", family, `${sourceRelative} declares no ${family} key ${from}.`);
|
|
2424
|
+
if (keys.some((key) => key.sourceKey === input.to))
|
|
2425
|
+
return refuse("rename-key-exists", "to", `${sourceRelative} already declares the ${family} key ${input.to}.`);
|
|
2426
|
+
const edits = index.renameAt(sourcePath, source.span.start, input.to, (fileName) => texts.get(fileName)) ?? [];
|
|
2427
|
+
const byFile = new Map;
|
|
2428
|
+
for (const edit of edits)
|
|
2429
|
+
byFile.set(edit.span.fileName, [...byFile.get(edit.span.fileName) ?? [], edit]);
|
|
2430
|
+
const files = [...byFile].map(([fileName, fileEdits]) => {
|
|
2431
|
+
let content = texts.get(fileName) ?? "";
|
|
2432
|
+
for (const { span, newText } of fileEdits.toSorted((a, b) => b.span.start - a.span.start))
|
|
2433
|
+
content = content.slice(0, span.start) + newText + content.slice(span.end);
|
|
2434
|
+
const names = fileEdits.length === 1 ? "1 name changes" : `${fileEdits.length} names change`;
|
|
2435
|
+
return {
|
|
2436
|
+
path: slashed(path2.relative(root, fileName)),
|
|
2437
|
+
content,
|
|
2438
|
+
action: "modify",
|
|
2439
|
+
reason: `${names} with the ${family} key ${from} \u2192 ${input.to}.`
|
|
2440
|
+
};
|
|
2441
|
+
});
|
|
2442
|
+
return { diagnostics: [], files: files.toSorted((a, b) => a.path.localeCompare(b.path)) };
|
|
2443
|
+
}
|
|
2444
|
+
static targetsOf(files) {
|
|
2445
|
+
return [...new Set(files.map((file) => file.path.split("/").slice(0, 2).join("/")))];
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2370
2448
|
// pkgs/@akanjs/devkit/workflow/mutationScaffold.ts
|
|
2371
2449
|
import { lowerlize as lowerlize4, modelNames } from "akanjs/common";
|
|
2372
2450
|
|
|
@@ -2933,6 +3011,8 @@ var nameInputPatterns = {
|
|
|
2933
3011
|
scalar: identifierPattern,
|
|
2934
3012
|
field: identifierPattern,
|
|
2935
3013
|
slice: identifierPattern,
|
|
3014
|
+
query: identifierPattern,
|
|
3015
|
+
to: identifierPattern,
|
|
2936
3016
|
mutation: identifierPattern,
|
|
2937
3017
|
interaction: identifierPattern
|
|
2938
3018
|
};
|
|
@@ -3298,7 +3378,25 @@ var createWorkflowPlan = (spec, rawInputs) => {
|
|
|
3298
3378
|
};
|
|
3299
3379
|
var planString = (inputs, name) => typeof inputs[name] === "string" ? inputs[name] : null;
|
|
3300
3380
|
var planStrings = (inputs, name) => Array.isArray(inputs[name]) ? inputs[name] : null;
|
|
3381
|
+
var inspectRenameKeyPlan = async (workspace, plan) => {
|
|
3382
|
+
if (plan.diagnostics.some((diagnostic) => diagnostic.severity === "error"))
|
|
3383
|
+
return plan;
|
|
3384
|
+
const { diagnostics, files } = await KeyRename.build(workspace, {
|
|
3385
|
+
app: planString(plan.inputs, "app"),
|
|
3386
|
+
module: planString(plan.inputs, "module"),
|
|
3387
|
+
slice: planString(plan.inputs, "slice"),
|
|
3388
|
+
query: planString(plan.inputs, "query"),
|
|
3389
|
+
to: planString(plan.inputs, "to")
|
|
3390
|
+
});
|
|
3391
|
+
return {
|
|
3392
|
+
...plan,
|
|
3393
|
+
diagnostics: [...plan.diagnostics, ...diagnostics],
|
|
3394
|
+
predictedChanges: files.length ? files.map((file) => ({ target: file.path, action: "modify", applyScope: "auto", reason: file.reason })) : plan.predictedChanges
|
|
3395
|
+
};
|
|
3396
|
+
};
|
|
3301
3397
|
var inspectWorkflowPlan = async (workspace, plan) => {
|
|
3398
|
+
if (plan.workflow === "rename-key")
|
|
3399
|
+
return await inspectRenameKeyPlan(workspace, plan);
|
|
3302
3400
|
if (plan.workflow !== "add-mutation" && plan.workflow !== "create-interaction")
|
|
3303
3401
|
return plan;
|
|
3304
3402
|
const app = planString(plan.inputs, "app");
|
|
@@ -3662,4 +3760,4 @@ for (const candidate of toolingRolloutCandidates) {
|
|
|
3662
3760
|
if (isRestrictedCandidate(candidate))
|
|
3663
3761
|
restrictedCandidates.set(candidate.packageName, candidate);
|
|
3664
3762
|
}
|
|
3665
|
-
export { InteractionScaffold, jsonText, workflowStatus, compactDiagnostics, workflowPlanApproval, createWorkflowApplyReport, workflowCommandsForPlan, workflowPathsForPlan, workflowRunArtifactPath, writeWorkflowRunArtifact, workflowSyncDir, generatedFilePathsForTarget, writeGeneratedSyncState, readWorkflowRunArtifact, createWorkflowBaselineSummary, createWorkflowValidationRunReport, createDryRunWorkflowApplyReport, createRepairReport, sourceFile, moduleComponentName, moduleSourcePaths, generatedFilesForSync, validationCommandsForTarget, nextActionsForTarget, createPrimitiveWriteReport, createPassedPrimitiveReport, scalarChangedFiles, bilingualLabelForField, bilingualDescriptionForField, normalizeFieldType, ensureNamedImport, ensureBaseImport, ensureBaseTypeImport, coerceFieldDefault, fieldExpression, viaBuilderParameterName, insertIntoObject, insertLightProjectionField, insertTemplateField, ensureEnumImport, insertEnumClass, insertDictionaryModelField, hasConstantInputField, hasDictionaryModelField, ensureConstantTypeImport, insertDictionaryEnum, parseValues, hasSourceParseErrors, hasClassMethod, insertClassMethod, hasSignalFactoryEntry, insertSignalFactoryEntry, buildAkanModuleContextIndex, addFieldUiPolicyForType, createWorkflowStepRegistry, WorkflowExecutor, MutationScaffold, isWorkflowSysName, isWorkflowModuleName, listWorkflowSpecs, getWorkflowSpec, compactWorkflowInputs, createWorkflowPlan, inspectWorkflowPlan, renderWorkflowList, renderWorkflowExplain, renderWorkflowPlan, renderWorkflowApply, renderWorkflowValidation, renderRepairReport, renderWorkflowRunArtifact, renderPrimitiveReport, toolingRolloutGate };
|
|
3763
|
+
export { InteractionScaffold, jsonText, workflowStatus, compactDiagnostics, workflowPlanApproval, createWorkflowApplyReport, workflowCommandsForPlan, workflowPathsForPlan, workflowRunArtifactPath, writeWorkflowRunArtifact, workflowSyncDir, generatedFilePathsForTarget, writeGeneratedSyncState, readWorkflowRunArtifact, createWorkflowBaselineSummary, createWorkflowValidationRunReport, createDryRunWorkflowApplyReport, createRepairReport, sourceFile, moduleComponentName, moduleSourcePaths, generatedFilesForSync, validationCommandsForTarget, nextActionsForTarget, createPrimitiveWriteReport, createPassedPrimitiveReport, scalarChangedFiles, bilingualLabelForField, bilingualDescriptionForField, normalizeFieldType, ensureNamedImport, ensureBaseImport, ensureBaseTypeImport, coerceFieldDefault, fieldExpression, viaBuilderParameterName, insertIntoObject, insertLightProjectionField, insertTemplateField, ensureEnumImport, insertEnumClass, insertDictionaryModelField, hasConstantInputField, hasDictionaryModelField, ensureConstantTypeImport, insertDictionaryEnum, parseValues, hasSourceParseErrors, hasClassMethod, insertClassMethod, hasSignalFactoryEntry, insertSignalFactoryEntry, buildAkanModuleContextIndex, addFieldUiPolicyForType, createWorkflowStepRegistry, WorkflowExecutor, KeyRename, MutationScaffold, isWorkflowSysName, isWorkflowModuleName, listWorkflowSpecs, getWorkflowSpec, compactWorkflowInputs, createWorkflowPlan, inspectWorkflowPlan, renderWorkflowList, renderWorkflowExplain, renderWorkflowPlan, renderWorkflowApply, renderWorkflowValidation, renderRepairReport, renderWorkflowRunArtifact, renderPrimitiveReport, toolingRolloutGate };
|
|
@@ -331,6 +331,7 @@ import { MemoryLimit } from "akanjs/server/memoryLimit";
|
|
|
331
331
|
var builderMsgTypeSet = new Set([
|
|
332
332
|
"build-route-res",
|
|
333
333
|
"build-csr-res",
|
|
334
|
+
"build-graph-res",
|
|
334
335
|
"builder-ready",
|
|
335
336
|
"invalidate",
|
|
336
337
|
"css-updated",
|
|
@@ -422,7 +423,7 @@ class IncrementalBuilderHost {
|
|
|
422
423
|
return;
|
|
423
424
|
if (!msg || typeof msg !== "object")
|
|
424
425
|
return;
|
|
425
|
-
if (msg.type === "build-route-res" || msg.type === "build-csr-res")
|
|
426
|
+
if (msg.type === "build-route-res" || msg.type === "build-csr-res" || msg.type === "build-graph-res")
|
|
426
427
|
this.#inFlight.delete(msg.id);
|
|
427
428
|
if (builderMsgTypeSet.has(msg.type))
|
|
428
429
|
this.#onMessage(msg);
|
|
@@ -553,7 +554,7 @@ class IncrementalBuilderHost {
|
|
|
553
554
|
}
|
|
554
555
|
try {
|
|
555
556
|
this.#proc.send(message);
|
|
556
|
-
if (message.type === "build-route" || message.type === "build-csr")
|
|
557
|
+
if (message.type === "build-route" || message.type === "build-csr" || message.type === "build-graph")
|
|
557
558
|
this.#inFlight.set(message.id, message.type);
|
|
558
559
|
return true;
|
|
559
560
|
} catch (error) {
|
|
@@ -813,7 +814,7 @@ class DevBootLatch {
|
|
|
813
814
|
}
|
|
814
815
|
|
|
815
816
|
// pkgs/@akanjs/devkit/akanApp/akanApp.host.ts
|
|
816
|
-
var backendMsgTypeSet = new Set(["build-route", "build-csr"]);
|
|
817
|
+
var backendMsgTypeSet = new Set(["build-route", "build-csr", "build-graph"]);
|
|
817
818
|
var asMib = (bytes) => Math.round(bytes / 1024 / 1024);
|
|
818
819
|
var BACKEND_RESTART_DEBOUNCE_MS = 120;
|
|
819
820
|
var BACKEND_GRACEFUL_TIMEOUT_MS = 8000;
|
|
@@ -1235,7 +1236,7 @@ ${this.#backendStderrTail.join(`
|
|
|
1235
1236
|
await this.#handleInvalidate(message);
|
|
1236
1237
|
return;
|
|
1237
1238
|
}
|
|
1238
|
-
if (message.type === "build-route-res" || message.type === "build-csr-res") {
|
|
1239
|
+
if (message.type === "build-route-res" || message.type === "build-csr-res" || message.type === "build-graph-res") {
|
|
1239
1240
|
const answer = this.#builderRequests.settle(message);
|
|
1240
1241
|
if (!answer) {
|
|
1241
1242
|
this.logger.verbose(`[builder] dropped a ${message.type} no live backend is waiting for (id=${message.id})`);
|
|
@@ -1610,6 +1611,8 @@ ${this.#backendStderrTail.join(`
|
|
|
1610
1611
|
this.#sendToBackend({ type: "build-route-res", id: message.id, ok: false, error });
|
|
1611
1612
|
else if (message.type === "build-csr")
|
|
1612
1613
|
this.#sendToBackend({ type: "build-csr-res", id: message.id, ok: false, error });
|
|
1614
|
+
else if (message.type === "build-graph")
|
|
1615
|
+
this.#sendToBackend({ type: "build-graph-res", id: message.id, ok: false, error });
|
|
1613
1616
|
else
|
|
1614
1617
|
return false;
|
|
1615
1618
|
return true;
|
|
@@ -1953,7 +1956,7 @@ ${this.#backendStderrTail.join(`
|
|
|
1953
1956
|
Object.assign(this.env, { AKAN_DEV_CSR_REBUILD: "1" });
|
|
1954
1957
|
this.logger.verbose(`[csr] armed dev CSR rebuilds (${message.reason})`);
|
|
1955
1958
|
}
|
|
1956
|
-
if (message.type === "build-route" || message.type === "build-csr") {
|
|
1959
|
+
if (message.type === "build-route" || message.type === "build-csr" || message.type === "build-graph") {
|
|
1957
1960
|
const outgoing = this.#builderRequests.issue(message);
|
|
1958
1961
|
if (this.#builder?.send(outgoing))
|
|
1959
1962
|
return;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
jsonText
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-m02tdq8a.js";
|
|
5
5
|
import {
|
|
6
6
|
akanMcpInstallTargets
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-j9d3mjx1.js";
|
|
8
8
|
import {
|
|
9
9
|
script
|
|
10
10
|
} from "./index-9zy8479y.js";
|
|
11
11
|
import {
|
|
12
12
|
ContextRunner2
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-jb2sreps.js";
|
|
14
14
|
|
|
15
15
|
// pkgs/@akanjs/cli/context/context.script.ts
|
|
16
16
|
import { Logger } from "akanjs/common";
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
import {
|
|
31
31
|
createAst,
|
|
32
32
|
createFactReader
|
|
33
|
-
} from "./index-
|
|
33
|
+
} from "./index-j2dgmzbj.js";
|
|
34
34
|
import {
|
|
35
35
|
collectRecipeSources2,
|
|
36
36
|
scanRecipes2
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
import {
|
|
43
43
|
sysInputs,
|
|
44
44
|
workflowSpecs
|
|
45
|
-
} from "./index-
|
|
45
|
+
} from "./index-k64mhwbw.js";
|
|
46
46
|
|
|
47
47
|
// pkgs/@akanjs/cli/workspace/workspace.runner.ts
|
|
48
48
|
import { mkdir, writeFile as writeFile2 } from "fs/promises";
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
isWorkflowSysName,
|
|
8
8
|
isWorkflowModuleName,
|
|
9
9
|
renderRepairReport
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-m02tdq8a.js";
|
|
11
11
|
import {
|
|
12
12
|
AkanContextAnalyzer
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-j9d3mjx1.js";
|
|
14
14
|
import {
|
|
15
15
|
runner
|
|
16
16
|
} from "./index-9zy8479y.js";
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
AkanIndex
|
|
4
|
+
} from "./index-j2dgmzbj.js";
|
|
5
|
+
|
|
6
|
+
// pkgs/@akanjs/devkit/workspaceGraph.ts
|
|
7
|
+
import { readFile } from "fs/promises";
|
|
8
|
+
import path from "path";
|
|
9
|
+
import ts from "typescript";
|
|
10
|
+
var indexedPath = /^(apps|libs)\/(?!(?:.*\/)?(?:node_modules|dist|\.akan|env)\/).*\.tsx?$/;
|
|
11
|
+
var unscopedNodeLimit = 600;
|
|
12
|
+
var slashed = (fileName) => fileName.replace(/\\/g, "/");
|
|
13
|
+
|
|
14
|
+
class WorkspaceGraph {
|
|
15
|
+
static async build(workspace) {
|
|
16
|
+
const root = workspace.workspaceRoot;
|
|
17
|
+
const index = new AkanIndex({ ts, root });
|
|
18
|
+
const texts = new Map;
|
|
19
|
+
const files = (await workspace.getAllFiles("{apps,libs}/**/*.{ts,tsx}")).map(slashed).filter((file) => indexedPath.test(file));
|
|
20
|
+
await Promise.all(files.map(async (file) => {
|
|
21
|
+
const fileName = slashed(path.join(root, file));
|
|
22
|
+
const text = await readFile(fileName, "utf8");
|
|
23
|
+
texts.set(fileName, text);
|
|
24
|
+
index.setFile(fileName, text);
|
|
25
|
+
}));
|
|
26
|
+
return index.graph((fileName) => texts.get(fileName));
|
|
27
|
+
}
|
|
28
|
+
static scope(graph, { app, module }) {
|
|
29
|
+
if (!app && !module)
|
|
30
|
+
return graph;
|
|
31
|
+
const owners = app ? new Set([`apps/${app}`, `libs/${app}`]) : null;
|
|
32
|
+
const seeds = new Set(graph.nodes.filter((node) => (!owners || owners.has(node.owner ?? "")) && (!module || node.module === module)).map((node) => node.id));
|
|
33
|
+
const edges = graph.edges.filter((edge) => seeds.has(edge.from) || seeds.has(edge.to));
|
|
34
|
+
const ids = new Set([...seeds, ...edges.flatMap((edge) => [edge.from, edge.to])]);
|
|
35
|
+
return { version: 1, nodes: graph.nodes.filter((node) => ids.has(node.id)), edges };
|
|
36
|
+
}
|
|
37
|
+
static visibleTo(graph, app) {
|
|
38
|
+
const appOwner = `apps/${app}`;
|
|
39
|
+
const isVisible = ({ owner }) => !owner || owner === appOwner || owner.startsWith("libs/");
|
|
40
|
+
const nodes = graph.nodes.filter(isVisible);
|
|
41
|
+
const ids = new Set(nodes.map((node) => node.id));
|
|
42
|
+
return { version: 1, nodes, edges: graph.edges.filter((edge) => ids.has(edge.from) && ids.has(edge.to)) };
|
|
43
|
+
}
|
|
44
|
+
static answer(graph, scope) {
|
|
45
|
+
if (scope.app || scope.module || graph.nodes.length <= unscopedNodeLimit)
|
|
46
|
+
return WorkspaceGraph.scope(graph, scope);
|
|
47
|
+
const owners = new Map;
|
|
48
|
+
for (const node of graph.nodes)
|
|
49
|
+
if (node.owner)
|
|
50
|
+
owners.set(node.owner, (owners.get(node.owner) ?? 0) + 1);
|
|
51
|
+
return {
|
|
52
|
+
diagnostics: [
|
|
53
|
+
{
|
|
54
|
+
severity: "error",
|
|
55
|
+
code: "graph-scope-required",
|
|
56
|
+
message: `The graph has ${graph.nodes.length} nodes. Pass app, module or both to scope it.`,
|
|
57
|
+
input: "app"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
owners: Object.fromEntries([...owners].sort(([a], [b]) => a < b ? -1 : 1))
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { WorkspaceGraph };
|
|
@@ -157,7 +157,7 @@ class SubagentPool2 {
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
async#run(id, kind, prompt, signal) {
|
|
160
|
-
const { CodeAgent } = await import("./CodeAgent-
|
|
160
|
+
const { CodeAgent } = await import("./CodeAgent-n2tkg59z.js");
|
|
161
161
|
const budget = this.#options.parent.tools.subagent;
|
|
162
162
|
const child = SubagentPool2.childOf(this.#options.parent, kind);
|
|
163
163
|
const model = this.#options.model?.();
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
SubagentPool2,
|
|
16
16
|
McpSignIn,
|
|
17
17
|
AkanCodeCompaction2
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-wrmq92vk.js";
|
|
19
19
|
import {
|
|
20
20
|
PreviewView2,
|
|
21
21
|
stripAnsi
|
|
@@ -659,7 +659,7 @@ class AkanToolPack2 {
|
|
|
659
659
|
return { name: "akan-tools", factory: async (pi) => await this.#register(pi) };
|
|
660
660
|
}
|
|
661
661
|
async names() {
|
|
662
|
-
const { ContextRunner } = await import("./context.runner-
|
|
662
|
+
const { ContextRunner } = await import("./context.runner-wxqb3qcy.js");
|
|
663
663
|
return [
|
|
664
664
|
...new ContextRunner().listMcpTools(this.#options.mode).map((tool) => tool.name),
|
|
665
665
|
AkanToolPack2.verifyToolName
|
|
@@ -667,7 +667,7 @@ class AkanToolPack2 {
|
|
|
667
667
|
}
|
|
668
668
|
static verifyToolName = "akan_verify";
|
|
669
669
|
async#register(pi) {
|
|
670
|
-
const { ContextRunner } = await import("./context.runner-
|
|
670
|
+
const { ContextRunner } = await import("./context.runner-wxqb3qcy.js");
|
|
671
671
|
const runner = new ContextRunner;
|
|
672
672
|
const guidelineNames = await AkanToolPack2.#guidelineNames();
|
|
673
673
|
for (const tool of runner.listMcpTools(this.#options.mode, { guidelineNames })) {
|
package/index.js
CHANGED
|
@@ -22,27 +22,27 @@ import path from "path";
|
|
|
22
22
|
|
|
23
23
|
// pkgs/@akanjs/cli/commandModules.ts
|
|
24
24
|
var commandModules = {
|
|
25
|
-
workspace: async () => (await import("./workspace.command-
|
|
26
|
-
agent: async () => (await import("./agent.command-
|
|
27
|
-
code: async () => (await import("./code.command-
|
|
28
|
-
application: async () => (await import("./application.command-
|
|
25
|
+
workspace: async () => (await import("./workspace.command-r6hgmawy.js")).WorkspaceCommand,
|
|
26
|
+
agent: async () => (await import("./agent.command-tffz6wdn.js")).AgentCommand,
|
|
27
|
+
code: async () => (await import("./code.command-ma8dtzww.js")).CodeCommand,
|
|
28
|
+
application: async () => (await import("./application.command-7bkxbrsp.js")).ApplicationCommand,
|
|
29
29
|
library: async () => (await import("./library.command-63hgt9te.js")).LibraryCommand,
|
|
30
|
-
localRegistry: async () => (await import("./localRegistry.command-
|
|
30
|
+
localRegistry: async () => (await import("./localRegistry.command-343ksmn9.js")).LocalRegistryCommand,
|
|
31
31
|
package: async () => (await import("./package.command-96eheyvd.js")).PackageCommand,
|
|
32
|
-
module: async () => (await import("./module.command-
|
|
32
|
+
module: async () => (await import("./module.command-2hce9m6k.js")).ModuleCommand,
|
|
33
33
|
page: async () => (await import("./page.command-gs6d841d.js")).PageCommand,
|
|
34
|
-
context: async () => (await import("./context.command-
|
|
35
|
-
cloud: async () => (await import("./cloud.command-
|
|
36
|
-
subspace: async () => (await import("./subspace.command-
|
|
34
|
+
context: async () => (await import("./context.command-80a1qhps.js")).ContextCommand,
|
|
35
|
+
cloud: async () => (await import("./cloud.command-a792bc10.js")).CloudCommand,
|
|
36
|
+
subspace: async () => (await import("./subspace.command-5cehmcdd.js")).SubspaceCommand,
|
|
37
37
|
guideline: async () => (await import("./guideline.command-195g0h9a.js")).GuidelineCommand,
|
|
38
|
-
scalar: async () => (await import("./scalar.command-
|
|
39
|
-
primitive: async () => (await import("./primitive.command-
|
|
40
|
-
quality: async () => (await import("./quality.command-
|
|
41
|
-
verify: async () => (await import("./verify.command-
|
|
42
|
-
repair: async () => (await import("./repair.command-
|
|
43
|
-
workflow: async () => (await import("./workflow.command-
|
|
38
|
+
scalar: async () => (await import("./scalar.command-1nk4329t.js")).ScalarCommand,
|
|
39
|
+
primitive: async () => (await import("./primitive.command-7tdj12wn.js")).PrimitiveCommand,
|
|
40
|
+
quality: async () => (await import("./quality.command-29bgarh1.js")).QualityCommand,
|
|
41
|
+
verify: async () => (await import("./verify.command-kbq0fcg8.js")).VerifyCommand,
|
|
42
|
+
repair: async () => (await import("./repair.command-yng4rf5d.js")).RepairCommand,
|
|
43
|
+
workflow: async () => (await import("./workflow.command-274qfa8z.js")).WorkflowCommand,
|
|
44
44
|
pipeline: async () => (await import("./pipeline.command-wdfvdbfj.js")).PipelineCommand,
|
|
45
|
-
tunnel: async () => (await import("./tunnel.command-
|
|
45
|
+
tunnel: async () => (await import("./tunnel.command-yrd4atqy.js")).TunnelCommand
|
|
46
46
|
};
|
|
47
47
|
var commandModuleIds = Object.keys(commandModules);
|
|
48
48
|
|
|
@@ -21,10 +21,10 @@ import"./index-m9jj544v.js";
|
|
|
21
21
|
import"./index-zbrwnmf1.js";
|
|
22
22
|
import"./index-sveq36gh.js";
|
|
23
23
|
import"./index-y4kcmbt2.js";
|
|
24
|
-
import"./index-
|
|
24
|
+
import"./index-ppvqy5bc.js";
|
|
25
25
|
import {
|
|
26
26
|
ApplicationScript
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-db2nqrad.js";
|
|
28
28
|
import"./index-tenw3mah.js";
|
|
29
29
|
import"./index-gr9thy79.js";
|
|
30
30
|
import {
|
|
@@ -8,12 +8,12 @@ import"./index-bns3wcpc.js";
|
|
|
8
8
|
import"./index-g500c5j9.js";
|
|
9
9
|
import {
|
|
10
10
|
renderPrimitiveReport
|
|
11
|
-
} from "./index-
|
|
12
|
-
import"./index-
|
|
11
|
+
} from "./index-m02tdq8a.js";
|
|
12
|
+
import"./index-j2dgmzbj.js";
|
|
13
13
|
import"./index-khk05tsf.js";
|
|
14
14
|
import {
|
|
15
15
|
ModuleScript
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-gbp1q1b5.js";
|
|
17
17
|
|
|
18
18
|
// pkgs/@akanjs/cli/module/module.command.ts
|
|
19
19
|
import { Logger, lowerlize } from "akanjs/common";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/cli",
|
|
3
|
-
"version": "3.1.2-rc.
|
|
3
|
+
"version": "3.1.2-rc.3",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@earendil-works/pi-tui": "1.3.0",
|
|
40
40
|
"@inquirer/prompts": "^8.7.3",
|
|
41
41
|
"@tailwindcss/node": "^4.3.3",
|
|
42
|
-
"akanjs": "3.1.2-rc.
|
|
42
|
+
"akanjs": "3.1.2-rc.3",
|
|
43
43
|
"chalk": "^6.0.1",
|
|
44
44
|
"commander": "^15.0.0",
|
|
45
45
|
"dayjs": "^1.11.23",
|