@akanjs/cli 3.1.1 → 3.1.2-rc.0
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 +11 -0
- package/{CodeAgentRpcHost-9g27hmer.js → CodeAgentRpcHost-6dzfkvsc.js} +1 -1
- package/CodeAgentRpcListener-tcwrdvst.js +182 -0
- package/{CodeTui-h6yz2kvq.js → CodeTui-q55b2zrn.js} +25 -8
- package/TunnelShare-hdq9h1hr.js +14 -0
- package/{agent.command-3r4jsck8.js → agent.command-20zaqe60.js} +18 -15
- package/akanCode.js +8 -7
- package/{application.command-g7xv6ad0.js → application.command-nd0fshsk.js} +11 -11
- package/{applicationBuildRunner-qvjnhr9j.js → applicationBuildRunner-s13x3zqb.js} +10 -9
- package/buildBatch.proc.js +6 -6
- package/{cloud.command-6ebygmhw.js → cloud.command-8kbddsz9.js} +25 -18
- package/cloud.script-hgvvajm3.js +27 -0
- package/code.command-625bg8s8.js +345 -0
- package/{context.command-svdh6b2w.js → context.command-p6haqjay.js} +19 -18
- package/context.runner-rsnqnk9j.js +27 -0
- package/{dependencyScanner-3afj2vt1.js → dependencyScanner-78sq8m4q.js} +2 -2
- package/{fileSys-wzzrntkw.js → fileSys-zpvt5gtf.js} +1 -1
- package/{guideline.command-qwp3tnjx.js → guideline.command-195g0h9a.js} +4 -4
- package/guidelines/agentRule/agentRule.instruction.md +22 -8
- package/guidelines/conventions/rules/auth.md +5 -4
- package/guidelines/conventions/rules/config.md +5 -1
- package/guidelines/conventions/rules/gates.md +2 -1
- package/guidelines/conventions/rules/module.md +1 -1
- package/guidelines/conventions/rules/server.md +8 -3
- package/guidelines/conventions/rules/ssr.md +2 -2
- package/guidelines/conventions/rules/tsx.md +2 -1
- package/guidelines/pageRule/pageRule.instruction.md +4 -4
- package/guidelines/runtimeRule/runtimeRule.instruction.md +35 -25
- package/guidelines/ssrRule/ssrRule.instruction.md +11 -10
- package/guidelines/transportRule/transportRule.instruction.md +5 -4
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +1 -1
- package/incrementalBuilder.proc.js +4 -4
- package/{index-w4k2ragk.js → index-00a7j05x.js} +7 -7
- package/{index-w7q6h97v.js → index-0j1t1h2b.js} +3 -1
- package/{index-payhwt51.js → index-1h2jc0x3.js} +141 -67
- package/{index-vxmy1p4f.js → index-1qsd8ft1.js} +63 -123
- package/{index-s6da8ta9.js → index-2mwjshz5.js} +158 -51
- package/index-2nxk8wgs.js +266 -0
- package/{index-k5jbcxyh.js → index-2phm56a1.js} +49 -8
- package/{index-jje9qzyq.js → index-35j83zkd.js} +37 -3
- package/{index-m5n3ka0p.js → index-4am4dvmf.js} +13 -2
- package/index-75y7bcz4.js +28 -0
- package/{index-b8c289dx.js → index-7apsdr5g.js} +55 -12
- package/{index-8559hsz4.js → index-84h43kg6.js} +6 -5
- package/{index-eja64h28.js → index-9zy8479y.js} +5 -3
- package/{index-96wzdhfh.js → index-a1vb3x7t.js} +209 -36
- package/{index-52w0fvh8.js → index-bns3wcpc.js} +15 -0
- package/{index-am36s3jh.js → index-cjmjvg4r.js} +157 -117
- package/{index-1p0qbq3m.js → index-defp4gmb.js} +1 -1
- package/{index-4pdts00b.js → index-ewbmfarf.js} +10 -8
- package/{index-9rvcs76p.js → index-fhw7yq2d.js} +10 -10
- package/{index-8scw1pjk.js → index-g500c5j9.js} +178 -82
- package/{index-qxzrp5xt.js → index-g841cap9.js} +4 -4
- package/{index-qkkdhjm6.js → index-gr9thy79.js} +5 -5
- package/{index-4pf8g7ff.js → index-h7hehkw6.js} +3 -0
- package/{index-4mj92tsh.js → index-hm0tn7qv.js} +73 -68
- package/{index-r2wedvqn.js → index-j6eeh5d7.js} +1 -1
- package/{index-tgt2fnd6.js → index-j7hwy56s.js} +3 -3
- package/{index-rnphv731.js → index-jc2zbwra.js} +2 -2
- package/{index-z4b84y6k.js → index-khk05tsf.js} +1 -1
- package/{index-tvehn2sp.js → index-qd7xn2bk.js} +1 -1
- package/{index-266dewjs.js → index-qw6814m4.js} +53 -15
- package/{index-zcf6k8a5.js → index-raz588b3.js} +47 -12
- package/{index-at7bz0xq.js → index-s4nvxpzm.js} +2 -0
- package/{index-3yz30c07.js → index-sp0qsr7a.js} +114 -12
- package/{index-1shvxzt0.js → index-sveq36gh.js} +39 -42
- package/{index-r2w2eh93.js → index-t1t9wq9a.js} +4 -4
- package/index-t78230d7.js +191 -0
- package/{index-r0k3ham2.js → index-tgqameyb.js} +4 -4
- package/{index-dd44g6vz.js → index-tp56652m.js} +5 -5
- package/index-w15mg3km.js +389 -0
- package/{index-xq543a5y.js → index-y4kcmbt2.js} +2 -2
- package/index-yf9wc28h.js +52 -0
- package/{index-xqgwjz7a.js → index-zbrwnmf1.js} +9 -7
- package/{index-xxfy1jp2.js → index-zttm13c3.js} +4 -4
- package/index.js +24 -24
- package/{library.command-2853y6mk.js → library.command-63hgt9te.js} +4 -4
- package/{localRegistry.command-76ds31p4.js → localRegistry.command-g3f8k25t.js} +43 -23
- package/{module.command-yfnb0abs.js → module.command-r4sa2khp.js} +7 -6
- package/{package.command-d9s86hp9.js → package.command-96eheyvd.js} +5 -5
- package/package.json +2 -2
- package/{page.command-6a8a8rd1.js → page.command-gs6d841d.js} +4 -4
- package/{pipeline.command-rt3rwd2z.js → pipeline.command-wdfvdbfj.js} +3 -3
- package/{primitive.command-emcebgrq.js → primitive.command-dfsv4mpe.js} +8 -7
- package/{projectTypecheck-51m7eh1f.js → projectTypecheck-kqj1t6hb.js} +1 -1
- package/{prompter-hgcta8pb.js → prompter-qrwx1p17.js} +2 -2
- package/{quality.command-xtrk0n3x.js → quality.command-webzxee2.js} +6 -4
- package/{repair.command-51szxnxx.js → repair.command-3r3j1xre.js} +7 -6
- package/{scalar.command-8qv27t82.js → scalar.command-e8y47j6d.js} +6 -5
- package/skills/akan-agent/SKILL.md +8 -1
- package/skills/akan-code/SKILL.md +37 -11
- package/skills/akan-debug/SKILL.md +2 -1
- package/skills/akan-err/SKILL.md +2 -1
- package/skills/akan-query/SKILL.md +3 -2
- package/skills/akan-runtime/SKILL.md +3 -0
- package/{subspace.command-pn56pnh8.js → subspace.command-a1sf9n5a.js} +12 -10
- package/templates/appSample/lib/task/task.signal.ts +14 -9
- package/templates/appSample/srvkit/guards.ts +11 -0
- package/templates/service/__model__.dictionary.ts +3 -5
- package/templates/workspaceRoot/.gitignore.template +1 -0
- package/{tunnel.command-q2h0j2en.js → tunnel.command-dcb0wg93.js} +25 -13
- package/{verify.command-z1dsbmrt.js → verify.command-yyepccbh.js} +13 -11
- package/{workflow.command-r3y67jeq.js → workflow.command-z5pg9ay0.js} +12 -11
- package/{workspace.command-t2f0xsrw.js → workspace.command-d7x5jttw.js} +74 -47
- package/CodeAgent-35wnb7w5.js +0 -9
- package/CodeAgentRpcListener-7p7z5dd7.js +0 -97
- package/TunnelShare-xyjpa7gx.js +0 -14
- package/cloud.script-0s1jybd5.js +0 -26
- package/code.command-mpkm2emr.js +0 -167
- package/context.runner-ch0z3a8g.js +0 -26
- package/index-c6eggbee.js +0 -123
- package/index-ksfgqq1x.js +0 -49
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
script
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-9zy8479y.js";
|
|
5
5
|
import {
|
|
6
6
|
AppExecutor,
|
|
7
7
|
LibExecutor,
|
|
8
8
|
ModuleExecutor
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-g500c5j9.js";
|
|
10
10
|
import {
|
|
11
11
|
InteractionScaffold,
|
|
12
12
|
workflowStatus,
|
|
@@ -43,10 +43,10 @@ import {
|
|
|
43
43
|
insertSignalFactoryEntry,
|
|
44
44
|
addFieldUiPolicyForType,
|
|
45
45
|
MutationScaffold
|
|
46
|
-
} from "./index-
|
|
46
|
+
} from "./index-hm0tn7qv.js";
|
|
47
47
|
import {
|
|
48
48
|
ModuleScript
|
|
49
|
-
} from "./index-
|
|
49
|
+
} from "./index-t1t9wq9a.js";
|
|
50
50
|
|
|
51
51
|
// pkgs/@akanjs/cli/primitive/primitive.script.ts
|
|
52
52
|
import { capitalize, lowerlize } from "akanjs/common";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
FileSys2
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-bns3wcpc.js";
|
|
5
5
|
import {
|
|
6
6
|
resolveMobileTargets
|
|
7
7
|
} from "./index-m9jj544v.js";
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
UpdatePackFolder,
|
|
10
10
|
NativePublicEnv,
|
|
11
11
|
NativeApp
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-sp0qsr7a.js";
|
|
13
13
|
import {
|
|
14
14
|
ExitCodeError
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-9zy8479y.js";
|
|
16
16
|
import {
|
|
17
17
|
ConfigLock
|
|
18
18
|
} from "./index-bqbf654f.js";
|
|
@@ -78,7 +78,7 @@ class CloudHttpError extends Error {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
// pkgs/@akanjs/devkit/cloud/globalConfig.ts
|
|
81
|
-
import {
|
|
81
|
+
import { rm, writeFile } from "fs/promises";
|
|
82
82
|
import { trimTrailingSlashes } from "akanjs/common";
|
|
83
83
|
import dayjs from "dayjs";
|
|
84
84
|
|
|
@@ -108,7 +108,7 @@ class GlobalConfig {
|
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
110
|
static async#setAkanGlobalConfig(akanConfig) {
|
|
111
|
-
|
|
111
|
+
FileSys2.ensurePrivateDir(basePath);
|
|
112
112
|
const temp = `${configPath}.${process.pid}.${crypto.randomUUID()}.tmp`;
|
|
113
113
|
try {
|
|
114
114
|
await writeFile(temp, JSON.stringify(akanConfig, null, 2), { mode: 384 });
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
class SubspaceConfig {
|
|
4
4
|
static source = "subspace in the workspace root akan.config.ts";
|
|
5
5
|
static defaultPushableBranches = ["main", "develop", "debug"];
|
|
6
|
+
static namePattern = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
6
7
|
static async from(workspace) {
|
|
7
8
|
const { subspace } = await workspace.getConfig();
|
|
8
9
|
return subspace ? new SubspaceConfig(subspace) : null;
|
|
@@ -23,6 +24,8 @@ class SubspaceConfig {
|
|
|
23
24
|
for (const subspace of this.subspaces) {
|
|
24
25
|
if (!subspace.name || !subspace.repo)
|
|
25
26
|
throw new Error(`${SubspaceConfig.source}: every subspace needs a name and a repo`);
|
|
27
|
+
if (!SubspaceConfig.namePattern.test(subspace.name))
|
|
28
|
+
throw new Error(`${SubspaceConfig.source}: subspace name "${subspace.name}" takes letters, digits, ".", "_" and "-", starting with a letter or digit`);
|
|
26
29
|
if (seenNames.has(subspace.name))
|
|
27
30
|
throw new Error(`${SubspaceConfig.source}: duplicate subspace "${subspace.name}"`);
|
|
28
31
|
seenNames.add(subspace.name);
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
AppExecutor,
|
|
4
4
|
LibExecutor
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-g500c5j9.js";
|
|
6
|
+
import {
|
|
7
|
+
createAst
|
|
8
|
+
} from "./index-2nxk8wgs.js";
|
|
6
9
|
import {
|
|
7
10
|
camelToKebabCase
|
|
8
|
-
} from "./index-
|
|
11
|
+
} from "./index-9zy8479y.js";
|
|
9
12
|
|
|
10
13
|
// pkgs/@akanjs/devkit/workflow/artifacts.ts
|
|
11
14
|
import { capitalize as capitalize2 } from "akanjs/common";
|
|
@@ -524,50 +527,15 @@ import ts2 from "typescript";
|
|
|
524
527
|
|
|
525
528
|
// pkgs/@akanjs/devkit/workflow/sourceAst.ts
|
|
526
529
|
import ts from "typescript";
|
|
527
|
-
var
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
var expressionName = (expression) => {
|
|
537
|
-
if (ts.isIdentifier(expression))
|
|
538
|
-
return expression.text;
|
|
539
|
-
if (ts.isPropertyAccessExpression(expression))
|
|
540
|
-
return expression.name.text;
|
|
541
|
-
if (ts.isCallExpression(expression))
|
|
542
|
-
return expressionName(expression.expression);
|
|
543
|
-
if (ts.isAsExpression(expression))
|
|
544
|
-
return expressionName(expression.expression);
|
|
545
|
-
return null;
|
|
546
|
-
};
|
|
547
|
-
var callExpressionName = (node) => ts.isPropertyAccessExpression(node.expression) ? node.expression.name.text : expressionName(node.expression);
|
|
548
|
-
var firstObjectReturnedByArrow = (node) => {
|
|
549
|
-
if (!ts.isArrowFunction(node) && !ts.isFunctionExpression(node))
|
|
550
|
-
return null;
|
|
551
|
-
if (ts.isObjectLiteralExpression(node.body))
|
|
552
|
-
return node.body;
|
|
553
|
-
if (ts.isParenthesizedExpression(node.body) && ts.isObjectLiteralExpression(node.body.expression)) {
|
|
554
|
-
return node.body.expression;
|
|
555
|
-
}
|
|
556
|
-
if (!ts.isBlock(node.body))
|
|
557
|
-
return null;
|
|
558
|
-
for (const statement of node.body.statements) {
|
|
559
|
-
if (ts.isReturnStatement(statement) && statement.expression && ts.isObjectLiteralExpression(statement.expression)) {
|
|
560
|
-
return statement.expression;
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
return null;
|
|
564
|
-
};
|
|
565
|
-
var isViaCall = (expression) => ts.isCallExpression(expression) && expressionName(expression.expression) === "via";
|
|
566
|
-
var heritageCall = (node) => {
|
|
567
|
-
const heritage = node.heritageClauses?.flatMap((clause) => [...clause.types]) ?? [];
|
|
568
|
-
const expression = heritage.find((clause) => isViaCall(clause.expression))?.expression;
|
|
569
|
-
return expression && ts.isCallExpression(expression) ? expression : null;
|
|
570
|
-
};
|
|
530
|
+
var {
|
|
531
|
+
sourceFileFor,
|
|
532
|
+
nodeName,
|
|
533
|
+
propertyName,
|
|
534
|
+
expressionName,
|
|
535
|
+
callExpressionName,
|
|
536
|
+
firstObjectReturnedByArrow,
|
|
537
|
+
heritageCall
|
|
538
|
+
} = createAst(ts);
|
|
571
539
|
|
|
572
540
|
// pkgs/@akanjs/devkit/workflow/source.ts
|
|
573
541
|
var getSysRoot = (sys) => `${sys.type}s/${sys.name}`;
|
|
@@ -2400,7 +2368,7 @@ class GuardCatalog {
|
|
|
2400
2368
|
}
|
|
2401
2369
|
}
|
|
2402
2370
|
// pkgs/@akanjs/devkit/workflow/mutationScaffold.ts
|
|
2403
|
-
import { lowerlize as lowerlize4 } from "akanjs/common";
|
|
2371
|
+
import { lowerlize as lowerlize4, modelNames } from "akanjs/common";
|
|
2404
2372
|
|
|
2405
2373
|
// pkgs/@akanjs/devkit/workflow/mutationSource.ts
|
|
2406
2374
|
import { lowerlize as lowerlize3 } from "akanjs/common";
|
|
@@ -2598,20 +2566,34 @@ class MutationScaffold {
|
|
|
2598
2566
|
this.#strict = strict;
|
|
2599
2567
|
}
|
|
2600
2568
|
static reservedNamesOf(modelClassName) {
|
|
2601
|
-
const
|
|
2602
|
-
const prefixed = ["light", "create", "update", "remove", "view", "edit", "merge", "get", "load", "set", "reset"];
|
|
2569
|
+
const names = modelNames(lowerlize4(modelClassName));
|
|
2603
2570
|
return new Set([
|
|
2604
|
-
model,
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2571
|
+
names.model,
|
|
2572
|
+
names.lightModel,
|
|
2573
|
+
names.createModel,
|
|
2574
|
+
names.updateModel,
|
|
2575
|
+
names.removeModel,
|
|
2576
|
+
names.viewModel,
|
|
2577
|
+
names.editModel,
|
|
2578
|
+
names.mergeModel,
|
|
2579
|
+
names.getModel,
|
|
2580
|
+
names.loadModel,
|
|
2581
|
+
names.setModel,
|
|
2582
|
+
names.resetModel,
|
|
2583
|
+
names.newModel,
|
|
2584
|
+
names.submitModel,
|
|
2585
|
+
names.invalidateModel,
|
|
2586
|
+
names.createModelInForm,
|
|
2587
|
+
names.updateModelInForm,
|
|
2588
|
+
names.loadModelMany,
|
|
2589
|
+
names.getModelView,
|
|
2590
|
+
names.getModelEdit,
|
|
2591
|
+
names.addModelFiles,
|
|
2592
|
+
names.checkModelSubmitable,
|
|
2593
|
+
names.writeOnModel,
|
|
2594
|
+
names.loadModelFormDraft,
|
|
2595
|
+
names.restoreModelFormDraft,
|
|
2596
|
+
names.discardModelFormDraft
|
|
2615
2597
|
]);
|
|
2616
2598
|
}
|
|
2617
2599
|
static generates(modelClassName, name) {
|
|
@@ -2872,17 +2854,17 @@ class MutationScaffold {
|
|
|
2872
2854
|
const declared = classMethodParameters(service.content, service.className, method);
|
|
2873
2855
|
if (declared)
|
|
2874
2856
|
return declared;
|
|
2875
|
-
const
|
|
2857
|
+
const names = modelNames(lowerlize4(moduleComponentName(ref)));
|
|
2876
2858
|
const generated = {
|
|
2877
|
-
[
|
|
2878
|
-
[
|
|
2879
|
-
[
|
|
2880
|
-
[
|
|
2881
|
-
[
|
|
2859
|
+
[names.getModel]: [{ name: "id", optional: false }],
|
|
2860
|
+
[names.loadModel]: [{ name: "id", optional: true }],
|
|
2861
|
+
[names.loadModelMany]: [{ name: "ids", optional: false }],
|
|
2862
|
+
[names.createModel]: [{ name: "data", optional: false }],
|
|
2863
|
+
[names.updateModel]: [
|
|
2882
2864
|
{ name: "id", optional: false },
|
|
2883
2865
|
{ name: "data", optional: false }
|
|
2884
2866
|
],
|
|
2885
|
-
[
|
|
2867
|
+
[names.removeModel]: [{ name: "id", optional: false }]
|
|
2886
2868
|
};
|
|
2887
2869
|
return generated[method] ?? null;
|
|
2888
2870
|
}
|
|
@@ -2943,6 +2925,19 @@ class MutationScaffold {
|
|
|
2943
2925
|
// pkgs/@akanjs/devkit/workflow/plan.ts
|
|
2944
2926
|
import { capitalize as capitalize4 } from "akanjs/common";
|
|
2945
2927
|
var surfaceModes = new Set(["infer", "include", "skip"]);
|
|
2928
|
+
var sysNamePattern = /^[a-z0-9][a-zA-Z0-9_-]*$/;
|
|
2929
|
+
var identifierPattern = /^_{0,2}[a-zA-Z][a-zA-Z0-9_-]*$/;
|
|
2930
|
+
var nameInputPatterns = {
|
|
2931
|
+
app: sysNamePattern,
|
|
2932
|
+
module: identifierPattern,
|
|
2933
|
+
scalar: identifierPattern,
|
|
2934
|
+
field: identifierPattern,
|
|
2935
|
+
slice: identifierPattern,
|
|
2936
|
+
mutation: identifierPattern,
|
|
2937
|
+
interaction: identifierPattern
|
|
2938
|
+
};
|
|
2939
|
+
var isWorkflowSysName = (value) => typeof value === "string" && sysNamePattern.test(value);
|
|
2940
|
+
var isWorkflowModuleName = (value) => typeof value === "string" && identifierPattern.test(value);
|
|
2946
2941
|
var parseStringList = (value) => {
|
|
2947
2942
|
if (Array.isArray(value)) {
|
|
2948
2943
|
const values = value.filter((item) => typeof item === "string" && item.trim().length > 0);
|
|
@@ -3238,6 +3233,16 @@ var createWorkflowPlan = (spec, rawInputs) => {
|
|
|
3238
3233
|
});
|
|
3239
3234
|
continue;
|
|
3240
3235
|
}
|
|
3236
|
+
const namePattern = nameInputPatterns[name];
|
|
3237
|
+
if (namePattern && typeof value === "string" && !namePattern.test(value)) {
|
|
3238
|
+
diagnostics.push({
|
|
3239
|
+
severity: "error",
|
|
3240
|
+
code: "workflow-input-invalid",
|
|
3241
|
+
input: name,
|
|
3242
|
+
message: `Workflow ${spec.name} input "${name}" must be a plain name without dots, slashes or spaces, not ${JSON.stringify(value)}.`
|
|
3243
|
+
});
|
|
3244
|
+
continue;
|
|
3245
|
+
}
|
|
3241
3246
|
if (inputSpec.allowedValues && typeof value === "string" && !inputSpec.allowedValues.includes(value)) {
|
|
3242
3247
|
diagnostics.push({
|
|
3243
3248
|
severity: "error",
|
|
@@ -3657,4 +3662,4 @@ for (const candidate of toolingRolloutCandidates) {
|
|
|
3657
3662
|
if (isRestrictedCandidate(candidate))
|
|
3658
3663
|
restrictedCandidates.set(candidate.packageName, candidate);
|
|
3659
3664
|
}
|
|
3660
|
-
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, listWorkflowSpecs, getWorkflowSpec, compactWorkflowInputs, createWorkflowPlan, inspectWorkflowPlan, renderWorkflowList, renderWorkflowExplain, renderWorkflowPlan, renderWorkflowApply, renderWorkflowValidation, renderRepairReport, renderWorkflowRunArtifact, renderPrimitiveReport, toolingRolloutGate };
|
|
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 };
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
isScannedRootEntry,
|
|
11
11
|
AppExecutor,
|
|
12
12
|
LibExecutor
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-g500c5j9.js";
|
|
14
14
|
import {
|
|
15
15
|
FileSys2
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-bns3wcpc.js";
|
|
17
17
|
import {
|
|
18
18
|
collectRecipeSources2,
|
|
19
19
|
scanRecipes2,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
workflowPathsForPlan,
|
|
24
24
|
workflowRunArtifactPath,
|
|
25
25
|
workflowSyncDir
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-hm0tn7qv.js";
|
|
27
27
|
|
|
28
28
|
// pkgs/@akanjs/devkit/akanContext.ts
|
|
29
29
|
import { readdir } from "fs/promises";
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-9zy8479y.js";
|
|
6
6
|
import {
|
|
7
7
|
generatedFilesForSync,
|
|
8
8
|
createPassedPrimitiveReport,
|
|
9
9
|
scalarChangedFiles
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-hm0tn7qv.js";
|
|
11
11
|
import {
|
|
12
12
|
pluralizeName
|
|
13
13
|
} from "./index-nz8prx9g.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
AppExecutor
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-g500c5j9.js";
|
|
5
5
|
import {
|
|
6
6
|
jsonText,
|
|
7
7
|
createWorkflowBaselineSummary,
|
|
8
8
|
buildAkanModuleContextIndex,
|
|
9
9
|
toolingRolloutGate
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-hm0tn7qv.js";
|
|
11
11
|
import {
|
|
12
12
|
buildResourceList,
|
|
13
13
|
codexMcpConfigPath,
|
|
@@ -17,31 +17,32 @@ import {
|
|
|
17
17
|
upsertCodexMcpServerBlock,
|
|
18
18
|
renderDoctorText,
|
|
19
19
|
AkanContextAnalyzer
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-j7hwy56s.js";
|
|
21
21
|
import {
|
|
22
22
|
runner
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-9zy8479y.js";
|
|
24
24
|
import {
|
|
25
25
|
NativeApp
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-sp0qsr7a.js";
|
|
27
27
|
import {
|
|
28
28
|
isPlaceholderAppId
|
|
29
|
-
} from "./index-
|
|
29
|
+
} from "./index-0j1t1h2b.js";
|
|
30
30
|
import {
|
|
31
31
|
getMobileTargets,
|
|
32
32
|
appIdsOf
|
|
33
33
|
} from "./index-m9jj544v.js";
|
|
34
34
|
import {
|
|
35
35
|
Prompter2
|
|
36
|
-
} from "./index-
|
|
36
|
+
} from "./index-j6eeh5d7.js";
|
|
37
37
|
import {
|
|
38
38
|
RepairRunner
|
|
39
|
-
} from "./index-
|
|
39
|
+
} from "./index-2phm56a1.js";
|
|
40
40
|
import {
|
|
41
41
|
WorkflowRunner
|
|
42
|
-
} from "./index-
|
|
42
|
+
} from "./index-raz588b3.js";
|
|
43
43
|
|
|
44
44
|
// pkgs/@akanjs/devkit/akanMcpContract.ts
|
|
45
|
+
import { lstatSync, realpathSync } from "fs";
|
|
45
46
|
import path from "path";
|
|
46
47
|
import { isRecord } from "akanjs/common";
|
|
47
48
|
var emptySchema = { type: "object", properties: {} };
|
|
@@ -134,7 +135,44 @@ var optionalString = (args, key) => {
|
|
|
134
135
|
};
|
|
135
136
|
var isInspectAkanContextRequestType = (value) => typeof value === "string" && inspectAkanContextRequestTypes.includes(value);
|
|
136
137
|
var parseJsonOutput = (output) => JSON.parse(output);
|
|
137
|
-
var
|
|
138
|
+
var workflowArtifactDir = ".akan/workflows";
|
|
139
|
+
var workflowRunIdPattern = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
140
|
+
var isInside = (base, target) => {
|
|
141
|
+
const relative = path.relative(base, target);
|
|
142
|
+
return !!relative && !relative.startsWith("..") && !path.isAbsolute(relative);
|
|
143
|
+
};
|
|
144
|
+
var hasEntry = (filePath) => {
|
|
145
|
+
try {
|
|
146
|
+
lstatSync(filePath);
|
|
147
|
+
return true;
|
|
148
|
+
} catch {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
var realPathOfNearest = (filePath) => {
|
|
153
|
+
const rest = [];
|
|
154
|
+
let current = filePath;
|
|
155
|
+
while (!hasEntry(current) && path.dirname(current) !== current) {
|
|
156
|
+
rest.unshift(path.basename(current));
|
|
157
|
+
current = path.dirname(current);
|
|
158
|
+
}
|
|
159
|
+
return path.join(realpathSync(current), ...rest);
|
|
160
|
+
};
|
|
161
|
+
var staysInside = (workspaceRoot, root, resolved) => {
|
|
162
|
+
try {
|
|
163
|
+
const realRoot = realPathOfNearest(root);
|
|
164
|
+
return isInside(realPathOfNearest(workspaceRoot), realRoot) && isInside(realRoot, realPathOfNearest(resolved));
|
|
165
|
+
} catch {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
var workflowArtifactPath = (workspace, filePath) => {
|
|
170
|
+
const root = path.resolve(workspace.workspaceRoot, workflowArtifactDir);
|
|
171
|
+
const resolved = workflowRunIdPattern.test(filePath) && !filePath.endsWith(".json") ? path.join(root, "runs", `${filePath}.json`) : path.resolve(workspace.workspaceRoot, filePath);
|
|
172
|
+
if (!isInside(root, resolved) || !staysInside(workspace.workspaceRoot, root, resolved))
|
|
173
|
+
throw new Error(`MCP workflow files live under ${workflowArtifactDir}/ of the workspace, not ${JSON.stringify(filePath)}.`);
|
|
174
|
+
return resolved;
|
|
175
|
+
};
|
|
138
176
|
var defaultWorkflowPlanPath = (workflow, inputs) => {
|
|
139
177
|
const slug = [
|
|
140
178
|
slugPart(workflow),
|
|
@@ -432,7 +470,7 @@ var inspectAkanContext = async (workspace, args) => {
|
|
|
432
470
|
if (props.request.type === "workflowDiagnostics") {
|
|
433
471
|
const doctor = await AkanContextAnalyzer.doctor(workspace, {
|
|
434
472
|
strict: true,
|
|
435
|
-
runIdOrPlan:
|
|
473
|
+
runIdOrPlan: workflowArtifactPath(workspace, props.request.runIdOrPlan)
|
|
436
474
|
});
|
|
437
475
|
const toWorkflowDiagnostic = ({ severity, code, message, scope }, context) => ({ severity, code, message, scope, context });
|
|
438
476
|
const baselineSummary = createWorkflowBaselineSummary((doctor.baselineDiagnostics ?? []).map((diagnostic) => toWorkflowDiagnostic(diagnostic, diagnostic.context)), { detailsIncluded: false });
|
|
@@ -713,7 +751,7 @@ class ContextRunner2 extends runner("context") {
|
|
|
713
751
|
if (name === "doctor_workspace")
|
|
714
752
|
return compactDoctorWorkspaceResult(await AkanContextAnalyzer.doctor(workspace, {
|
|
715
753
|
strict: !!args.strict,
|
|
716
|
-
runIdOrPlan: typeof args.runIdOrPlan === "string" ?
|
|
754
|
+
runIdOrPlan: typeof args.runIdOrPlan === "string" ? workflowArtifactPath(workspace, args.runIdOrPlan) : null,
|
|
717
755
|
changedFiles: Array.isArray(args.changedFiles) ? args.changedFiles.filter((file) => typeof file === "string") : []
|
|
718
756
|
}), !!args.includeBaselineDetails);
|
|
719
757
|
if (name === "explain_command")
|
|
@@ -730,7 +768,7 @@ class ContextRunner2 extends runner("context") {
|
|
|
730
768
|
const planPath = typeof args.out === "string" && args.out ? args.out : defaultWorkflowPlanPath(workflow, inputs);
|
|
731
769
|
const plan = parseJsonOutput(await new WorkflowRunner().plan(workflow, inputs, {
|
|
732
770
|
format: "json",
|
|
733
|
-
out:
|
|
771
|
+
out: workflowArtifactPath(workspace, planPath)
|
|
734
772
|
}));
|
|
735
773
|
return {
|
|
736
774
|
...plan,
|
|
@@ -741,7 +779,7 @@ class ContextRunner2 extends runner("context") {
|
|
|
741
779
|
};
|
|
742
780
|
}
|
|
743
781
|
if (name === "apply_workflow") {
|
|
744
|
-
const report = parseJsonOutput(await new WorkflowRunner().apply(
|
|
782
|
+
const report = parseJsonOutput(await new WorkflowRunner().apply(workflowArtifactPath(workspace, stringArg(args, "planPath")), {
|
|
745
783
|
format: "json",
|
|
746
784
|
dryRun: !!args.dryRun,
|
|
747
785
|
workspace,
|
|
@@ -756,7 +794,7 @@ class ContextRunner2 extends runner("context") {
|
|
|
756
794
|
};
|
|
757
795
|
}
|
|
758
796
|
if (name === "run_validation")
|
|
759
|
-
return parseJsonOutput(await new WorkflowRunner().validate(
|
|
797
|
+
return parseJsonOutput(await new WorkflowRunner().validate(workflowArtifactPath(workspace, stringArg(args, "runIdOrPlan")), {
|
|
760
798
|
format: "json",
|
|
761
799
|
workspace,
|
|
762
800
|
includeBaselineDetails: !!args.includeBaselineDetails
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
WorkspaceExecutor
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-g500c5j9.js";
|
|
5
5
|
import {
|
|
6
6
|
jsonText,
|
|
7
7
|
workflowPlanApproval,
|
|
@@ -26,26 +26,27 @@ import {
|
|
|
26
26
|
renderWorkflowApply,
|
|
27
27
|
renderWorkflowValidation,
|
|
28
28
|
renderWorkflowRunArtifact
|
|
29
|
-
} from "./index-
|
|
29
|
+
} from "./index-hm0tn7qv.js";
|
|
30
30
|
import {
|
|
31
31
|
AkanContextAnalyzer
|
|
32
|
-
} from "./index-
|
|
32
|
+
} from "./index-j7hwy56s.js";
|
|
33
33
|
import {
|
|
34
34
|
CommandContainer,
|
|
35
35
|
runner
|
|
36
|
-
} from "./index-
|
|
36
|
+
} from "./index-9zy8479y.js";
|
|
37
37
|
import {
|
|
38
38
|
ModuleScript
|
|
39
|
-
} from "./index-
|
|
39
|
+
} from "./index-t1t9wq9a.js";
|
|
40
40
|
import {
|
|
41
41
|
PrimitiveScript
|
|
42
|
-
} from "./index-
|
|
42
|
+
} from "./index-g841cap9.js";
|
|
43
43
|
import {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
spawnAkan,
|
|
45
|
+
isWorkspaceTarget
|
|
46
|
+
} from "./index-2phm56a1.js";
|
|
46
47
|
import {
|
|
47
48
|
ScalarScript
|
|
48
|
-
} from "./index-
|
|
49
|
+
} from "./index-jc2zbwra.js";
|
|
49
50
|
import {
|
|
50
51
|
workflowSpecs
|
|
51
52
|
} from "./index-fbewhg4g.js";
|
|
@@ -130,7 +131,7 @@ ${error.message ?? ""}`.toLowerCase();
|
|
|
130
131
|
var defaultValidationExecutor = (workspace) => async (command) => {
|
|
131
132
|
const base = { command: command.command, reason: command.reason, kind: inferValidationKind(command) };
|
|
132
133
|
try {
|
|
133
|
-
return { ...base, status: "passed", exitCode: 0, stdout: await
|
|
134
|
+
return { ...base, status: "passed", exitCode: 0, stdout: await spawnAkan(workspace, command.command) };
|
|
134
135
|
} catch (error) {
|
|
135
136
|
const commandError = error;
|
|
136
137
|
return {
|
|
@@ -144,6 +145,33 @@ var defaultValidationExecutor = (workspace) => async (command) => {
|
|
|
144
145
|
}
|
|
145
146
|
};
|
|
146
147
|
var readJsonFile = async (filePath) => JSON.parse(await readFile(resolvePath(filePath), "utf8"));
|
|
148
|
+
var toMessage = (error) => error instanceof Error ? error.message : String(error);
|
|
149
|
+
var inputShapeCodes = new Set(["workflow-input-invalid", "workflow-input-not-allowed"]);
|
|
150
|
+
var inputErrorsOf = (spec, plan) => {
|
|
151
|
+
try {
|
|
152
|
+
return createWorkflowPlan(spec, isRecord(plan.inputs) ? plan.inputs : {}).diagnostics.filter((diagnostic) => inputShapeCodes.has(diagnostic.code));
|
|
153
|
+
} catch (error) {
|
|
154
|
+
return [{ severity: "error", code: "workflow-input-invalid", message: toMessage(error) }];
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
var specValidationOf = async (workspace, plan) => {
|
|
158
|
+
if (!plan)
|
|
159
|
+
return { commands: [], diagnostics: [] };
|
|
160
|
+
const refused = (code, message) => ({
|
|
161
|
+
commands: [],
|
|
162
|
+
diagnostics: [{ severity: "error", code, message }]
|
|
163
|
+
});
|
|
164
|
+
const spec = getWorkflowSpec(workflowSpecs, plan.workflow);
|
|
165
|
+
if (!spec)
|
|
166
|
+
return refused("workflow-unknown", `Unknown workflow in plan: ${JSON.stringify(plan.workflow)}.`);
|
|
167
|
+
const target = plan.inputs.app;
|
|
168
|
+
if (typeof target !== "string" || !await isWorkspaceTarget(workspace, target))
|
|
169
|
+
return refused("workflow-target-missing", `Workflow plan input "app" is not an app or library of this workspace: ${JSON.stringify(target)}.`);
|
|
170
|
+
return {
|
|
171
|
+
commands: workflowCommandsForPlan({ ...plan, inputs: { app: target }, validation: spec.validation }),
|
|
172
|
+
diagnostics: []
|
|
173
|
+
};
|
|
174
|
+
};
|
|
147
175
|
var workflowDiagnosticFromDoctor = ({
|
|
148
176
|
severity,
|
|
149
177
|
code,
|
|
@@ -286,6 +314,12 @@ class WorkflowRunner extends runner("workflow") {
|
|
|
286
314
|
const message = `Unknown workflow in plan: ${plan.workflow}.`;
|
|
287
315
|
return await renderApplyReport(failedApplyReport(plan.workflow, "workflow-unknown", message, plan));
|
|
288
316
|
}
|
|
317
|
+
const inputErrors = inputErrorsOf(spec, plan);
|
|
318
|
+
if (inputErrors.length) {
|
|
319
|
+
const message = inputErrors.map((diagnostic) => diagnostic.message).join(" ");
|
|
320
|
+
return await renderApplyReport(failedApplyReport(plan.workflow, "workflow-plan-inputs-invalid", message, plan));
|
|
321
|
+
}
|
|
322
|
+
plan = { ...plan, steps: spec.steps, validation: spec.validation };
|
|
289
323
|
if (dryRun)
|
|
290
324
|
return await renderApplyReport(createDryRunWorkflowApplyReport(plan));
|
|
291
325
|
if (!registry) {
|
|
@@ -301,6 +335,7 @@ class WorkflowRunner extends runner("workflow") {
|
|
|
301
335
|
includeBaselineDetails = false
|
|
302
336
|
}) {
|
|
303
337
|
const loaded = await this.loadValidationTarget(runIdOrPlan, workspace);
|
|
338
|
+
const trusted = await specValidationOf(workspace, loaded.plan);
|
|
304
339
|
const doctor = await AkanContextAnalyzer.doctor(workspace, {
|
|
305
340
|
strict: true,
|
|
306
341
|
runIdOrPlan,
|
|
@@ -310,9 +345,9 @@ class WorkflowRunner extends runner("workflow") {
|
|
|
310
345
|
workflow: loaded.plan?.workflow ?? loaded.workflow,
|
|
311
346
|
source: loaded.source,
|
|
312
347
|
plan: loaded.plan,
|
|
313
|
-
commands:
|
|
348
|
+
commands: trusted.commands,
|
|
314
349
|
execute: execute ?? defaultValidationExecutor(workspace),
|
|
315
|
-
diagnostics: loaded.diagnostics,
|
|
350
|
+
diagnostics: [...loaded.diagnostics, ...trusted.diagnostics],
|
|
316
351
|
baselineDiagnostics: (doctor.baselineDiagnostics ?? []).map((diagnostic) => workflowDiagnosticFromDoctor(diagnostic, "baseline")),
|
|
317
352
|
workflowDiagnostics: (doctor.workflowDiagnostics ?? []).map((diagnostic) => workflowDiagnosticFromDoctor(diagnostic, "workflow")),
|
|
318
353
|
repairActions: loaded.repairActions
|
|
@@ -51,6 +51,8 @@ class CodeAgentRpcHost2 {
|
|
|
51
51
|
} catch {
|
|
52
52
|
return this.#emit({ type: "error", message: "malformed command frame", fatal: false, seq: -1 });
|
|
53
53
|
}
|
|
54
|
+
if (request && typeof request === "object" && "auth" in request && !request.command)
|
|
55
|
+
return this.#reply({ type: "reply", id: "auth", ok: true });
|
|
54
56
|
try {
|
|
55
57
|
this.#reply({ type: "reply", id: request.id, ok: true, data: await this.#run(request.command) });
|
|
56
58
|
} catch (error) {
|