@akanjs/cli 3.2.0-rc.1 → 3.2.0-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-vmd9k4ak.js → CodeAgent-e9c712an.js} +3 -3
- package/{CodeTui-zka44v52.js → CodeTui-wv9yf7eq.js} +1 -1
- package/TunnelShare-zkfkrw8w.js +14 -0
- package/{agent.command-2f657613.js → agent.command-9erafkcb.js} +17 -17
- package/akanCode.js +3 -3
- package/{application.command-q6skd3am.js → application.command-6515t682.js} +13 -13
- package/{applicationBuildRunner-sctcmkyx.js → applicationBuildRunner-bqbyeg84.js} +6 -6
- package/buildBatch.proc.js +6 -6
- package/{cloud.command-7642pks6.js → cloud.command-32esk0v1.js} +19 -19
- package/cloud.script-arsagnq6.js +30 -0
- package/{code.command-7s4ndq2k.js → code.command-xk7rwq2x.js} +6 -6
- package/{context.command-569z0rqf.js → context.command-jwenkkf0.js} +19 -19
- package/context.runner-mqpp67br.js +29 -0
- package/{devTui-w38ch13a.js → devTui-cd03z4mx.js} +1 -1
- package/{guideline.command-gnv3e8p8.js → guideline.command-w6yqpdec.js} +2 -2
- package/incrementalBuilder.proc.js +7 -7
- package/{index-48d5qsj3.js → index-0ba8nj4d.js} +4 -4
- package/{index-ed6ea0qp.js → index-20wvskt8.js} +1 -1
- package/{index-rc5fvqj2.js → index-2eym1yjb.js} +29 -27
- package/{index-5w9my9qe.js → index-2rqyrvcy.js} +8 -8
- package/{index-93ewzmp6.js → index-386canwe.js} +21 -14
- package/{index-w639tvkd.js → index-39jz41jb.js} +29 -8
- package/{index-vkzfk7qt.js → index-43acpsc7.js} +40 -30
- package/{index-mqntfzv5.js → index-54s6knqe.js} +7 -2
- package/{index-6wpaq392.js → index-6h775rv3.js} +4 -4
- package/{index-aj3ehkcx.js → index-7kmbqp0b.js} +1 -1
- package/{index-1q1cjn8s.js → index-84c2pgak.js} +93 -53
- package/{index-0fb3cpbt.js → index-8gm4yag8.js} +9 -7
- package/{index-sy481q2x.js → index-8jpc5fqv.js} +1 -1
- package/{index-7y5yghjg.js → index-9p260r4e.js} +1000 -409
- package/{index-d4n1wmrz.js → index-bak9f2br.js} +4 -4
- package/{index-8g7tdsk4.js → index-bdmgqzb5.js} +4 -4
- package/{index-abgh0jve.js → index-cmg5ngqa.js} +1 -1
- package/{index-vr68mxj5.js → index-ddk49ypz.js} +14 -10
- package/{index-zpv14wpy.js → index-djc5nxpy.js} +3 -3
- package/{index-s2grpzef.js → index-dpgywgeq.js} +3 -3
- package/{index-drz9e84d.js → index-e22zedc2.js} +2 -2
- package/{index-e3vmjtph.js → index-h0p6n4k1.js} +7 -2
- package/{index-9tbgb4d8.js → index-j1hjb477.js} +1 -1
- package/{index-kpdv34rq.js → index-j4hkbzj6.js} +10 -7
- package/{index-ktb3wcqz.js → index-kcpk2d20.js} +8 -8
- package/{index-thckcabc.js → index-ngpt3zz3.js} +18 -3
- package/{index-8kczhnmv.js → index-qrk06tfp.js} +1 -1
- package/{index-8ts9774g.js → index-s34v3y28.js} +9 -4
- package/{index-23860fej.js → index-sc0g6zbm.js} +2 -0
- package/{index-eajbmk10.js → index-v50xjbbe.js} +1 -1
- package/{index-7xdpww43.js → index-vbhx60x5.js} +323 -129
- package/{index-sr5da35e.js → index-wfmpxke3.js} +2 -2
- package/{index-mmym5xmb.js → index-wr9magsr.js} +5 -3
- package/index-x3x31df8.js +14 -0
- package/{index-8pb9yvp8.js → index-xrmrvafh.js} +54 -17
- package/{index-p6hjwt2d.js → index-y725zb1a.js} +1 -1
- package/{index-hqrkqxx2.js → index-ygrdw6jw.js} +1 -1
- package/{index-a8a9ede9.js → index-ytpmk3pb.js} +4 -4
- package/{index-v4p1zye8.js → index-zcdmnfrf.js} +7 -7
- package/{index-fjr4d6yd.js → index-zhkcab5a.js} +5 -5
- package/index.js +23 -23
- package/{library.command-1gp5qe3r.js → library.command-qs8beggh.js} +4 -4
- package/{localRegistry.command-x7jptkd3.js → localRegistry.command-hz4ged9n.js} +18 -18
- package/{module.command-4xz9he6h.js → module.command-z9js77m2.js} +7 -7
- package/{package.command-s7qpnn1g.js → package.command-zqenq8c0.js} +7 -7
- package/package.json +2 -2
- package/{page.command-fan34c49.js → page.command-t0nx1jat.js} +3 -3
- package/{pipeline.command-ph4fnn9w.js → pipeline.command-2yjeas7m.js} +2 -2
- package/{primitive.command-3fqh8emf.js → primitive.command-v5kypwy4.js} +7 -7
- package/{projectTypecheck-vkb40hjc.js → projectTypecheck-s9hhe5sa.js} +1 -1
- package/{quality.command-ecj6exsh.js → quality.command-q55j2htd.js} +6 -6
- package/{repair.command-fe9jw719.js → repair.command-7ssbbdq2.js} +6 -6
- package/{scalar.command-cnvfhk0n.js → scalar.command-p5jb7z57.js} +6 -6
- package/skills/akan-scaffold/SKILL.md +2 -1
- package/{subspace.command-qw5ddd6y.js → subspace.command-7wxy6ptj.js} +8 -8
- package/{tunnel.command-ggj38mqf.js → tunnel.command-22g11n0x.js} +7 -7
- package/{verify.command-w9ttxkdz.js → verify.command-m0wnndd7.js} +14 -14
- package/{workflow.command-ss8devj0.js → workflow.command-jx8dqs9n.js} +30 -15
- package/{workspace.command-6z2rh8ze.js → workspace.command-ca9kfyt3.js} +38 -34
- package/TunnelShare-k3ja4w9x.js +0 -14
- package/cloud.script-1sfseznn.js +0 -30
- package/context.runner-ms8v1rxy.js +0 -29
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import {
|
|
3
|
-
AppExecutor
|
|
4
|
-
} from "./index-sr5da35e.js";
|
|
5
|
-
import {
|
|
6
|
-
jsonText,
|
|
7
|
-
createWorkflowBaselineSummary,
|
|
8
|
-
buildAkanModuleContextIndex,
|
|
9
|
-
toolingRolloutGate
|
|
10
|
-
} from "./index-8pb9yvp8.js";
|
|
11
2
|
import {
|
|
12
3
|
buildResourceList,
|
|
13
4
|
codexMcpConfigPath,
|
|
@@ -17,16 +8,26 @@ import {
|
|
|
17
8
|
upsertCodexMcpServerBlock,
|
|
18
9
|
renderDoctorText,
|
|
19
10
|
AkanContextAnalyzer
|
|
20
|
-
} from "./index-
|
|
11
|
+
} from "./index-ngpt3zz3.js";
|
|
12
|
+
import {
|
|
13
|
+
AppExecutor
|
|
14
|
+
} from "./index-wfmpxke3.js";
|
|
15
|
+
import {
|
|
16
|
+
jsonText,
|
|
17
|
+
workflowStatus,
|
|
18
|
+
createWorkflowBaselineSummary,
|
|
19
|
+
buildAkanModuleContextIndex,
|
|
20
|
+
toolingRolloutGate
|
|
21
|
+
} from "./index-xrmrvafh.js";
|
|
21
22
|
import {
|
|
22
23
|
runner
|
|
23
|
-
} from "./index-
|
|
24
|
+
} from "./index-386canwe.js";
|
|
24
25
|
import {
|
|
25
26
|
NativeApp
|
|
26
|
-
} from "./index-
|
|
27
|
+
} from "./index-djc5nxpy.js";
|
|
27
28
|
import {
|
|
28
29
|
isPlaceholderAppId
|
|
29
|
-
} from "./index-
|
|
30
|
+
} from "./index-20wvskt8.js";
|
|
30
31
|
import {
|
|
31
32
|
getMobileTargets,
|
|
32
33
|
appIdsOf
|
|
@@ -36,13 +37,13 @@ import {
|
|
|
36
37
|
} from "./index-j6eeh5d7.js";
|
|
37
38
|
import {
|
|
38
39
|
WorkspaceGraph
|
|
39
|
-
} from "./index-
|
|
40
|
+
} from "./index-39jz41jb.js";
|
|
40
41
|
import {
|
|
41
42
|
RepairRunner
|
|
42
|
-
} from "./index-
|
|
43
|
+
} from "./index-8gm4yag8.js";
|
|
43
44
|
import {
|
|
44
45
|
WorkflowRunner
|
|
45
|
-
} from "./index-
|
|
46
|
+
} from "./index-43acpsc7.js";
|
|
46
47
|
|
|
47
48
|
// pkgs/@akanjs/devkit/akanMcpContract.ts
|
|
48
49
|
import { lstatSync, realpathSync } from "fs";
|
|
@@ -194,7 +195,7 @@ var defaultWorkflowPlanPath = (workflow, inputs) => {
|
|
|
194
195
|
var applyFirstPolicy = {
|
|
195
196
|
mode: "apply-first",
|
|
196
197
|
directSourceEdits: "fallback-only",
|
|
197
|
-
applyRequiredWhen: ["plan_workflow returns
|
|
198
|
+
applyRequiredWhen: ["plan_workflow returns next.tool=apply_workflow"],
|
|
198
199
|
approvalMeaning: "requiresApproval is an agent/user review signal before apply_workflow mutates files; it is not a separate MCP permission gate.",
|
|
199
200
|
validationRequiredAfterApply: ["validationTarget", "applyReportPath"],
|
|
200
201
|
fallbackAllowedWhen: [
|
|
@@ -299,7 +300,7 @@ var readonlyMcpTools = [
|
|
|
299
300
|
},
|
|
300
301
|
{
|
|
301
302
|
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 the guards they name (each guard keyed by the app or lib that declares it, with its scope and the comment that says what it checks), the service methods and queries each calls, the store actions that fetch them, and the components and routes that use them. A module's jobs (internal: interval, cron, timeout, initialize, destroy, process) read their schedule and server or operation modes and call service methods like endpoints do; each adaptor a service plugs (an adapt() class, or an akanjs role) is a node, a method that calls it links to it,
|
|
303
|
+
description: "Read-only Akan Graph from source, no dev server needed: models with their fields and relations, slices and endpoints with the guards they name (each guard keyed by the app or lib that declares it, with its scope and the comment that says what it checks), the service methods and queries each calls, the store actions that fetch them, and the components and routes that use them. A module's jobs (internal: interval, cron, timeout, initialize, destroy, process) read their schedule and server or operation modes and call service methods like endpoints do; each adaptor a service plugs (an adapt() class, or an akanjs role) is a node, a method that calls it links to it (an app service holds the fields its module's lib services plug, unless it declares the field itself), an adaptor links to the adaptors it plugs itself, a class from a package outside the workspace is adaptor:<package>:<Name>, and a role an app binds with applyAdaptor(Role, Impl) links to that implementation (binds, labelled with the app; a scope keeps its app's bindings). Each page/ file is a route (its URL pattern after the locale) or a layout, layouts wrap what they contain, and a route or layout that runs .guard() reads `guard` and links each function its guard calls; a layout's guard gates every route it wraps. A graph too large to answer unscoped drops first the routes and layouts that neither changed nor use a change; app or module brings them back. Every node and edge carries its source location. Pass app and/or module to scope a large workspace. Pass since (a git revision such as main, or HEAD for uncommitted work) for the Change Map instead: what changed since HEAD forked from it, working tree included, with each node, field and edge marked added, removed or changed, the unchanged neighbours they call or are called by, and the changed files no node covers, each marked the same way.",
|
|
303
304
|
inputSchema: { type: "object", properties: { app: stringProperty, module: stringProperty, since: stringProperty } }
|
|
304
305
|
},
|
|
305
306
|
{
|
|
@@ -344,7 +345,7 @@ var planMcpTools = [
|
|
|
344
345
|
},
|
|
345
346
|
{
|
|
346
347
|
name: "plan_workflow",
|
|
347
|
-
description: "Create a read-only workflow plan after context inspection and return planPath plus next.tool=apply_workflow.",
|
|
348
|
+
description: "Create a read-only workflow plan after context inspection and return planPath, plus next.tool=apply_workflow unless a diagnostic is an error.",
|
|
348
349
|
inputSchema: {
|
|
349
350
|
type: "object",
|
|
350
351
|
properties: { workflow: stringProperty, inputs: objectProperty, out: stringProperty },
|
|
@@ -355,7 +356,7 @@ var planMcpTools = [
|
|
|
355
356
|
var applyMcpTools = [
|
|
356
357
|
{
|
|
357
358
|
name: "apply_workflow",
|
|
358
|
-
description: "Apply a stored workflow plan before direct edits and return validationTarget
|
|
359
|
+
description: "Apply a stored workflow plan before direct edits and return validationTarget, plus next.tool=run_validation unless the apply failed.",
|
|
359
360
|
inputSchema: {
|
|
360
361
|
type: "object",
|
|
361
362
|
properties: { planPath: stringProperty, dryRun: booleanProperty },
|
|
@@ -636,7 +637,7 @@ class ContextRunner2 extends runner("context") {
|
|
|
636
637
|
if (ios)
|
|
637
638
|
return await this.#doctorIos(workspace, format);
|
|
638
639
|
const result = await AkanContextAnalyzer.doctor(workspace, { strict });
|
|
639
|
-
return format === "json" ? jsonText(result) : renderDoctorText(result);
|
|
640
|
+
return { status: result.status, output: format === "json" ? jsonText(result) : renderDoctorText(result) };
|
|
640
641
|
}
|
|
641
642
|
async#doctorIos(workspace, format) {
|
|
642
643
|
const appNames = await workspace.getApps();
|
|
@@ -672,7 +673,7 @@ class ContextRunner2 extends runner("context") {
|
|
|
672
673
|
}
|
|
673
674
|
const status = diagnostics.some((diagnostic) => diagnostic.severity === "error") ? "failed" : "passed";
|
|
674
675
|
if (format === "json")
|
|
675
|
-
return jsonText({ schemaVersion: 1, kind: "ios", status, diagnostics });
|
|
676
|
+
return { status, output: jsonText({ schemaVersion: 1, kind: "ios", status, diagnostics }) };
|
|
676
677
|
const lines = [`Akan iOS diagnostics for ${workspace.repoName}`];
|
|
677
678
|
if (diagnostics.length === 0)
|
|
678
679
|
lines.push(" No native configuration issues found.");
|
|
@@ -681,8 +682,8 @@ class ContextRunner2 extends runner("context") {
|
|
|
681
682
|
lines.push(` [${diagnostic.severity}] ${diagnostic.code}: ${diagnostic.message}`);
|
|
682
683
|
lines.push(` ${diagnostic.path}`);
|
|
683
684
|
}
|
|
684
|
-
return lines.join(`
|
|
685
|
-
`);
|
|
685
|
+
return { status, output: lines.join(`
|
|
686
|
+
`) };
|
|
686
687
|
}
|
|
687
688
|
async getGuidelineResource(name) {
|
|
688
689
|
return await Prompter2.getInstruction(name);
|
|
@@ -785,11 +786,12 @@ class ContextRunner2 extends runner("context") {
|
|
|
785
786
|
const planPath = typeof args.out === "string" && args.out ? args.out : defaultWorkflowPlanPath(workflow, inputs);
|
|
786
787
|
const out = workflowArtifactPath(workspace, planPath);
|
|
787
788
|
const plan = parseJsonOutput(await new WorkflowRunner().plan(workflow, inputs, { format: "json", out, workspace }));
|
|
789
|
+
const applicable = workflowStatus(plan.diagnostics) === "passed";
|
|
788
790
|
return {
|
|
789
791
|
...plan,
|
|
790
792
|
planPath,
|
|
791
|
-
approval:
|
|
792
|
-
next: { tool: "apply_workflow", args: { planPath } },
|
|
793
|
+
approval: plan.approval && applicable ? { ...plan.approval, canApplyWith: { planPath } } : plan.approval,
|
|
794
|
+
...applicable ? { next: { tool: "apply_workflow", args: { planPath } } } : {},
|
|
793
795
|
policy: applyFirstPolicy
|
|
794
796
|
};
|
|
795
797
|
}
|
|
@@ -804,7 +806,7 @@ class ContextRunner2 extends runner("context") {
|
|
|
804
806
|
return {
|
|
805
807
|
...report,
|
|
806
808
|
validationTarget,
|
|
807
|
-
next: { tool: "run_validation", args: { runIdOrPlan: validationTarget } },
|
|
809
|
+
...report.status === "failed" ? {} : { next: { tool: "run_validation", args: { runIdOrPlan: validationTarget } } },
|
|
808
810
|
policy: applyFirstPolicy
|
|
809
811
|
};
|
|
810
812
|
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
script,
|
|
5
5
|
ExitCodeError,
|
|
6
6
|
markCliErrorPrinted
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-386canwe.js";
|
|
8
8
|
import {
|
|
9
9
|
AGENT_BLOCK_START,
|
|
10
10
|
AGENT_BLOCK_END,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
CLAUDE_COMMENT_RULE,
|
|
16
16
|
AppExecutor,
|
|
17
17
|
LibExecutor
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-wfmpxke3.js";
|
|
19
19
|
import {
|
|
20
20
|
akanCodePaths2
|
|
21
21
|
} from "./index-35j83zkd.js";
|
|
@@ -23,25 +23,25 @@ import {
|
|
|
23
23
|
ConventionSet,
|
|
24
24
|
Prompter2
|
|
25
25
|
} from "./index-j6eeh5d7.js";
|
|
26
|
+
import {
|
|
27
|
+
AkanContextAnalyzer
|
|
28
|
+
} from "./index-ngpt3zz3.js";
|
|
26
29
|
import {
|
|
27
30
|
collectRecipeSources2,
|
|
28
31
|
scanRecipes2
|
|
29
32
|
} from "./index-hj6w4ka1.js";
|
|
30
|
-
import {
|
|
31
|
-
AkanContextAnalyzer
|
|
32
|
-
} from "./index-thckcabc.js";
|
|
33
33
|
import {
|
|
34
34
|
ApplicationRunner,
|
|
35
35
|
VerifyScope
|
|
36
|
-
} from "./index-
|
|
36
|
+
} from "./index-kcpk2d20.js";
|
|
37
37
|
import {
|
|
38
38
|
WorkspaceRunner
|
|
39
|
-
} from "./index-
|
|
39
|
+
} from "./index-zhkcab5a.js";
|
|
40
40
|
import {
|
|
41
41
|
VerifyComments,
|
|
42
42
|
VerifyPipeline,
|
|
43
43
|
VerifyReport
|
|
44
|
-
} from "./index-
|
|
44
|
+
} from "./index-dpgywgeq.js";
|
|
45
45
|
|
|
46
46
|
// pkgs/@akanjs/cli/agent/agent.script.ts
|
|
47
47
|
import { Logger as Logger3 } from "akanjs/common";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
LibExecutor,
|
|
11
11
|
PkgExecutor,
|
|
12
12
|
ModuleExecutor
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-wfmpxke3.js";
|
|
14
14
|
|
|
15
15
|
// pkgs/@akanjs/devkit/commandDecorators/camelToKebabCase.ts
|
|
16
16
|
var camelToKebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
@@ -453,11 +453,12 @@ var assertEnumChoice = (argMeta, value) => {
|
|
|
453
453
|
return;
|
|
454
454
|
throw new Error(`${argLabelOf(argMeta)} argument '${String(value)}' is invalid. Allowed choices are ${choices.map((choice) => choice.name).join(", ")}.`);
|
|
455
455
|
};
|
|
456
|
-
var assertPromptable = (problem,
|
|
456
|
+
var assertPromptable = (problem, refusal = {}) => {
|
|
457
457
|
if (process.stdin.isTTY)
|
|
458
458
|
return;
|
|
459
|
-
throw
|
|
459
|
+
throw refusalOf(problem, "stdin is not a terminal to prompt on", refusal);
|
|
460
460
|
};
|
|
461
|
+
var refusalOf = (problem, reason, { choices = [], remedy = "pass it on the command line" }) => new Error(`${problem}: ${reason}, so ${remedy}${choices.length ? ` (choices: ${choices.join(", ")})` : ""}.`);
|
|
461
462
|
var inputMessageOf = ({ name, argsOption: { desc, example, ask } }) => ask ? `${ask}: ` : desc ? `${desc}: ` : `Enter the ${name} value${example ? ` (example: ${example})` : ""}: `;
|
|
462
463
|
var getOptionValue = async (argMeta, opt, context) => {
|
|
463
464
|
const {
|
|
@@ -581,12 +582,18 @@ var getAppsArgumentValue = async (value, workspace, rerun) => {
|
|
|
581
582
|
await AppSelectionMemory.write(workspace.workspaceRoot, picked);
|
|
582
583
|
return picked.map((name) => AppExecutor.from(workspace, name));
|
|
583
584
|
};
|
|
584
|
-
var getInternalArgumentValue = async (argMeta, value, workspace, rerun) => {
|
|
585
|
+
var getInternalArgumentValue = async (argMeta, value, workspace, rerun, { destructive = false } = {}) => {
|
|
585
586
|
if (argMeta.type === "Workspace")
|
|
586
587
|
return workspace;
|
|
587
588
|
const sysType = argMeta.type.toLowerCase();
|
|
588
589
|
const [appNames, libNames, pkgNames] = await workspace.getExecs();
|
|
589
590
|
const problemOf = (kind) => value ? `Unknown ${kind} '${value}'` : `Missing ${kind}`;
|
|
591
|
+
const assertAskable = (kind, choices, placeholder) => {
|
|
592
|
+
const refusal = { choices, ...rerunRemedyOf(rerun, placeholder) };
|
|
593
|
+
if (destructive)
|
|
594
|
+
throw refusalOf(problemOf(kind), "this command deletes files and never picks its target", refusal);
|
|
595
|
+
assertPromptable(problemOf(kind), refusal);
|
|
596
|
+
};
|
|
590
597
|
if (sysType === "sys" || sysType === "exec") {
|
|
591
598
|
const pkgChoices = sysType === "exec" ? pkgNames : [];
|
|
592
599
|
const execOf = (name) => {
|
|
@@ -601,17 +608,17 @@ var getInternalArgumentValue = async (argMeta, value, workspace, rerun) => {
|
|
|
601
608
|
const found = value ? execOf(value) : null;
|
|
602
609
|
if (found)
|
|
603
610
|
return found;
|
|
604
|
-
if (!value && argMeta.option?.onlyApp && appNames.length === 1 && appNames[0])
|
|
611
|
+
if (!value && !destructive && argMeta.option?.onlyApp && appNames.length === 1 && appNames[0])
|
|
605
612
|
return AppExecutor.from(workspace, appNames[0]);
|
|
606
613
|
const [kind, placeholder] = sysType === "exec" ? ["app, lib or pkg", "<app-lib-or-pkg>"] : ["app or lib", "<app-or-lib>"];
|
|
607
614
|
const choices = [...appNames, ...libNames, ...pkgChoices];
|
|
608
615
|
const only = choices.length === 1 ? execOf(choices[0] ?? "") : null;
|
|
609
|
-
if (!value && only && !process.stdin.isTTY) {
|
|
616
|
+
if (!value && !destructive && only && !process.stdin.isTTY) {
|
|
610
617
|
const how = rerun ? `: ${rerun(only.name)}` : "";
|
|
611
618
|
Logger.rawLog(`No ${kind} named, so this runs on '${only.name}', the only one in this workspace${how}`, undefined, "error");
|
|
612
619
|
return only;
|
|
613
620
|
}
|
|
614
|
-
|
|
621
|
+
assertAskable(kind, choices, placeholder);
|
|
615
622
|
const name = await select({
|
|
616
623
|
message: sysType === "exec" ? `Select the App or Lib or Pkg name` : `Select the App or Lib name`,
|
|
617
624
|
choices
|
|
@@ -623,22 +630,22 @@ var getInternalArgumentValue = async (argMeta, value, workspace, rerun) => {
|
|
|
623
630
|
} else if (sysType === "app") {
|
|
624
631
|
if (value && appNames.includes(value))
|
|
625
632
|
return AppExecutor.from(workspace, value);
|
|
626
|
-
if (!value && appNames.length === 1 && appNames[0])
|
|
633
|
+
if (!value && !destructive && appNames.length === 1 && appNames[0])
|
|
627
634
|
return AppExecutor.from(workspace, appNames[0]);
|
|
628
|
-
|
|
635
|
+
assertAskable("app", appNames, "<app>");
|
|
629
636
|
const appName = await select({ message: `Select the ${sysType} name`, choices: appNames });
|
|
630
637
|
return AppExecutor.from(workspace, appName);
|
|
631
638
|
} else if (sysType === "lib") {
|
|
632
639
|
if (value && libNames.includes(value))
|
|
633
640
|
return LibExecutor.from(workspace, value);
|
|
634
|
-
|
|
641
|
+
assertAskable("lib", libNames, "<lib>");
|
|
635
642
|
const libName = await select({ message: `Select the ${sysType} name`, choices: libNames });
|
|
636
643
|
return LibExecutor.from(workspace, libName);
|
|
637
644
|
} else if (sysType === "pkg") {
|
|
638
645
|
const pkgs = await workspace.getPkgs();
|
|
639
646
|
if (value && pkgs.includes(value))
|
|
640
647
|
return PkgExecutor.from(workspace, value);
|
|
641
|
-
|
|
648
|
+
assertAskable("pkg", pkgs, "<pkg>");
|
|
642
649
|
const pkgName = await select({ message: `Select the ${sysType} name`, choices: pkgs });
|
|
643
650
|
return PkgExecutor.from(workspace, pkgName);
|
|
644
651
|
} else if (sysType === "module") {
|
|
@@ -665,8 +672,8 @@ var getInternalArgumentValue = async (argMeta, value, workspace, rerun) => {
|
|
|
665
672
|
...appNames.map((name) => AppExecutor.from(workspace, name)),
|
|
666
673
|
...libNames.map((name) => LibExecutor.from(workspace, name))
|
|
667
674
|
];
|
|
668
|
-
const choices = process.stdin.isTTY ? [] : (await Promise.all(systems.map(async (sys) => (await sys.getModules()).map((m) => `${sys.name}:${m}`)))).flat();
|
|
669
|
-
|
|
675
|
+
const choices = process.stdin.isTTY && !destructive ? [] : (await Promise.all(systems.map(async (sys) => (await sys.getModules()).map((m) => `${sys.name}:${m}`)))).flat();
|
|
676
|
+
assertAskable("module", choices, "<sys:module>");
|
|
670
677
|
const { type, name } = await select({
|
|
671
678
|
message: `select the App or Lib name`,
|
|
672
679
|
choices: [
|
|
@@ -781,7 +788,7 @@ ${versionWarning}`), undefined, "error");
|
|
|
781
788
|
else if (argMeta.type === "Apps")
|
|
782
789
|
commandArgs[argMeta.idx] = await getAppsArgumentValue(cmdArgs[argMeta.idx], workspace, rerun);
|
|
783
790
|
else
|
|
784
|
-
commandArgs[argMeta.idx] = await getInternalArgumentValue(argMeta, cmdArgs[argMeta.idx], workspace, rerun);
|
|
791
|
+
commandArgs[argMeta.idx] = await getInternalArgumentValue(argMeta, cmdArgs[argMeta.idx], workspace, rerun, { destructive: targetMeta.targetOption.destructive });
|
|
785
792
|
if (commandArgs[argMeta.idx] instanceof AppExecutor)
|
|
786
793
|
process.env.AKAN_PUBLIC_APP_NAME = commandArgs[argMeta.idx].name;
|
|
787
794
|
else if (Array.isArray(commandArgs[argMeta.idx])) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
AkanGraphDiff,
|
|
4
4
|
AkanIndex
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-9p260r4e.js";
|
|
6
6
|
import {
|
|
7
7
|
GitRevision
|
|
8
8
|
} from "./index-ygdbn9jn.js";
|
|
@@ -47,12 +47,14 @@ class WorkspaceGraph {
|
|
|
47
47
|
const mapped = new Set([
|
|
48
48
|
...changes.nodes.filter((node) => node.change).flatMap((node) => [
|
|
49
49
|
node.at?.file,
|
|
50
|
+
...node.sources ?? [],
|
|
50
51
|
...(node.fields ?? []).filter((field) => field.change).map(({ at }) => at.file)
|
|
51
52
|
]),
|
|
52
53
|
...changes.edges.filter((edge) => edge.change).map((edge) => edge.at?.file)
|
|
53
54
|
]);
|
|
54
55
|
const unmapped = files.filter(({ file }) => !mapped.has(file) && !hiddenPath.test(file));
|
|
55
|
-
|
|
56
|
+
const nodes = changes.nodes.map(({ sources: _sources, ...node }) => node);
|
|
57
|
+
return { ...changes, nodes, since: sha.slice(0, 12), unmapped };
|
|
56
58
|
}
|
|
57
59
|
static #baseAt(root, sha) {
|
|
58
60
|
const key = `${root}
|
|
@@ -84,9 +86,22 @@ ${sha}`;
|
|
|
84
86
|
const seeds = new Set(graph.nodes.filter((node) => (!owners || owners.has(node.owner ?? "")) && (!module || node.module === module)).map((node) => node.id));
|
|
85
87
|
const guards = new Set(graph.nodes.filter((node) => node.kind === "guard").map((node) => node.id));
|
|
86
88
|
const reaches = (id) => seeds.has(id) && !guards.has(id);
|
|
87
|
-
const edges = graph.edges.filter((edge) => reaches(edge.from) || reaches(edge.to));
|
|
88
|
-
const
|
|
89
|
-
|
|
89
|
+
const edges = graph.edges.filter((edge) => edge.kind !== "binds" && (reaches(edge.from) || reaches(edge.to)));
|
|
90
|
+
const kept = new Set([...seeds, ...edges.flatMap((edge) => [edge.from, edge.to])]);
|
|
91
|
+
const isLib = !!app && graph.nodes.some((node) => node.owner === `libs/${app}`) && !graph.nodes.some((node) => node.owner === `apps/${app}`);
|
|
92
|
+
const applicable = WorkspaceGraph.#bindingsOf(graph, app && !isLib ? `apps/${app}` : null);
|
|
93
|
+
const isOwn = (edge) => !module && !!owners?.has(edge.label ?? "");
|
|
94
|
+
const roles = new Set(applicable.filter((edge) => isOwn(edge) || kept.has(edge.from) || reaches(edge.to)).map((edge) => edge.from));
|
|
95
|
+
const bindings = applicable.filter((edge) => roles.has(edge.from));
|
|
96
|
+
const ids = new Set([...kept, ...bindings.flatMap((edge) => [edge.from, edge.to])]);
|
|
97
|
+
return { version: 1, nodes: graph.nodes.filter((node) => ids.has(node.id)), edges: [...edges, ...bindings] };
|
|
98
|
+
}
|
|
99
|
+
static #bindingsOf(graph, appOwner) {
|
|
100
|
+
const binds = graph.edges.filter((edge) => edge.kind === "binds");
|
|
101
|
+
if (!appOwner)
|
|
102
|
+
return binds;
|
|
103
|
+
const own = new Set(binds.filter((edge) => edge.label === appOwner && edge.change !== "removed").map((edge) => edge.from));
|
|
104
|
+
return binds.filter((edge) => edge.label === appOwner || !edge.label?.startsWith("apps/") && !own.has(edge.from));
|
|
90
105
|
}
|
|
91
106
|
static #withoutPages(graph) {
|
|
92
107
|
const changed = new Set(graph.nodes.filter((node) => node.change).map((node) => node.id));
|
|
@@ -103,7 +118,12 @@ ${sha}`;
|
|
|
103
118
|
const isVisible = ({ owner }) => !owner || owner === appOwner || owner.startsWith("libs/");
|
|
104
119
|
const nodes = graph.nodes.filter(isVisible);
|
|
105
120
|
const ids = new Set(nodes.map((node) => node.id));
|
|
106
|
-
|
|
121
|
+
const bindings = new Set(WorkspaceGraph.#bindingsOf(graph, appOwner));
|
|
122
|
+
return {
|
|
123
|
+
version: 1,
|
|
124
|
+
nodes,
|
|
125
|
+
edges: graph.edges.filter((edge) => ids.has(edge.from) && ids.has(edge.to) && (edge.kind !== "binds" || bindings.has(edge)))
|
|
126
|
+
};
|
|
107
127
|
}
|
|
108
128
|
static changesVisibleTo(changes, app) {
|
|
109
129
|
const visible = WorkspaceGraph.visibleTo(changes, app);
|
|
@@ -145,16 +165,17 @@ ${sha}`;
|
|
|
145
165
|
const unscoped = WorkspaceGraph.#withoutPages(graph);
|
|
146
166
|
if (unscoped.nodes.length <= unscopedNodeLimit)
|
|
147
167
|
return unscoped;
|
|
168
|
+
const kept = new Set(unscoped.nodes.map((node) => node.id));
|
|
148
169
|
const owners = new Map;
|
|
149
170
|
for (const node of counted)
|
|
150
|
-
if (node.owner &&
|
|
171
|
+
if (node.owner && kept.has(node.id))
|
|
151
172
|
owners.set(node.owner, (owners.get(node.owner) ?? 0) + 1);
|
|
152
173
|
return {
|
|
153
174
|
diagnostics: [
|
|
154
175
|
{
|
|
155
176
|
severity: "error",
|
|
156
177
|
code: "graph-scope-required",
|
|
157
|
-
message: `The graph has ${unscoped.nodes.length} nodes
|
|
178
|
+
message: `The graph has ${unscoped.nodes.length} nodes once unchanged pages are set aside. Pass app, module or both to scope it.`,
|
|
158
179
|
input: "app"
|
|
159
180
|
}
|
|
160
181
|
],
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
AkanContextAnalyzer
|
|
4
|
+
} from "./index-ngpt3zz3.js";
|
|
2
5
|
import {
|
|
3
6
|
WorkspaceExecutor
|
|
4
|
-
} from "./index-
|
|
7
|
+
} from "./index-wfmpxke3.js";
|
|
5
8
|
import {
|
|
6
9
|
jsonText,
|
|
7
10
|
workflowPlanApproval,
|
|
@@ -27,30 +30,27 @@ import {
|
|
|
27
30
|
renderWorkflowApply,
|
|
28
31
|
renderWorkflowValidation,
|
|
29
32
|
renderWorkflowRunArtifact
|
|
30
|
-
} from "./index-
|
|
31
|
-
import {
|
|
32
|
-
AkanContextAnalyzer
|
|
33
|
-
} from "./index-thckcabc.js";
|
|
33
|
+
} from "./index-xrmrvafh.js";
|
|
34
34
|
import {
|
|
35
35
|
CommandContainer,
|
|
36
36
|
runner
|
|
37
|
-
} from "./index-
|
|
37
|
+
} from "./index-386canwe.js";
|
|
38
38
|
import {
|
|
39
39
|
ModuleScript
|
|
40
|
-
} from "./index-
|
|
40
|
+
} from "./index-s34v3y28.js";
|
|
41
41
|
import {
|
|
42
42
|
PrimitiveScript
|
|
43
|
-
} from "./index-
|
|
43
|
+
} from "./index-0ba8nj4d.js";
|
|
44
44
|
import {
|
|
45
45
|
spawnAkan,
|
|
46
46
|
isWorkspaceTarget
|
|
47
|
-
} from "./index-
|
|
47
|
+
} from "./index-8gm4yag8.js";
|
|
48
48
|
import {
|
|
49
49
|
ScalarScript
|
|
50
|
-
} from "./index-
|
|
50
|
+
} from "./index-h0p6n4k1.js";
|
|
51
51
|
import {
|
|
52
52
|
workflowSpecs
|
|
53
|
-
} from "./index-
|
|
53
|
+
} from "./index-v50xjbbe.js";
|
|
54
54
|
|
|
55
55
|
// pkgs/@akanjs/cli/workflow/workflow.runner.ts
|
|
56
56
|
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
@@ -271,11 +271,11 @@ class WorkflowRunner extends runner("workflow") {
|
|
|
271
271
|
throw new Error(`Unknown workflow: ${workflow}. Run \`akan workflow list\` to see available workflows.`);
|
|
272
272
|
return format === "json" ? jsonText(spec) : renderWorkflowExplain(spec);
|
|
273
273
|
}
|
|
274
|
-
async plan(workflow, inputs, {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
} = {}) {
|
|
274
|
+
async plan(workflow, inputs, { format = "markdown", ...options } = {}) {
|
|
275
|
+
const plan = await this.planReport(workflow, inputs, options);
|
|
276
|
+
return format === "json" ? jsonText(plan) : renderWorkflowPlan(plan);
|
|
277
|
+
}
|
|
278
|
+
async planReport(workflow, inputs, { out = null, workspace } = {}) {
|
|
279
279
|
const spec = getWorkflowSpec(workflowSpecs, workflow);
|
|
280
280
|
if (!spec)
|
|
281
281
|
throw new Error(`Unknown workflow: ${workflow}. Run \`akan workflow list\` to see available workflows.`);
|
|
@@ -285,54 +285,64 @@ class WorkflowRunner extends runner("workflow") {
|
|
|
285
285
|
await mkdir(path.dirname(outPath), { recursive: true });
|
|
286
286
|
await writeFile(outPath, jsonText(plan));
|
|
287
287
|
}
|
|
288
|
-
return
|
|
288
|
+
return plan;
|
|
289
289
|
}
|
|
290
290
|
async apply(planPath, {
|
|
291
|
-
dryRun = false,
|
|
292
291
|
format = "markdown",
|
|
292
|
+
...options
|
|
293
|
+
} = {}) {
|
|
294
|
+
return renderWorkflowApply(await this.applyReport(planPath, options), format);
|
|
295
|
+
}
|
|
296
|
+
async applyReport(planPath, {
|
|
297
|
+
dryRun = false,
|
|
293
298
|
registry,
|
|
294
299
|
workspace
|
|
295
300
|
} = {}) {
|
|
296
|
-
const
|
|
301
|
+
const recordApplyReport = async (report) => {
|
|
297
302
|
if (!workspace)
|
|
298
|
-
return
|
|
303
|
+
return report;
|
|
299
304
|
const { artifact } = await writeWorkflowRunArtifact(workspace, report);
|
|
300
|
-
return
|
|
305
|
+
return artifact;
|
|
301
306
|
};
|
|
302
307
|
let plan;
|
|
303
308
|
try {
|
|
304
309
|
const parsed = await readJsonFile(planPath);
|
|
305
310
|
if (!isWorkflowPlan(parsed))
|
|
306
|
-
return await
|
|
311
|
+
return await recordApplyReport(failedApplyReport("unknown", "workflow-plan-invalid", `Workflow plan file is invalid: ${planPath}.`));
|
|
307
312
|
plan = parsed;
|
|
308
313
|
} catch (error) {
|
|
309
314
|
const message = `Could not read workflow plan file: ${planPath}. ${error instanceof Error ? error.message : ""}`;
|
|
310
|
-
return await
|
|
315
|
+
return await recordApplyReport(failedApplyReport("unknown", "workflow-plan-read-failed", message.trim()));
|
|
311
316
|
}
|
|
312
317
|
const spec = getWorkflowSpec(workflowSpecs, plan.workflow);
|
|
313
318
|
if (!spec) {
|
|
314
319
|
const message = `Unknown workflow in plan: ${plan.workflow}.`;
|
|
315
|
-
return await
|
|
320
|
+
return await recordApplyReport(failedApplyReport(plan.workflow, "workflow-unknown", message, plan));
|
|
316
321
|
}
|
|
317
322
|
const inputErrors = inputErrorsOf(spec, plan);
|
|
318
323
|
if (inputErrors.length) {
|
|
319
324
|
const message = inputErrors.map((diagnostic) => diagnostic.message).join(" ");
|
|
320
|
-
return await
|
|
325
|
+
return await recordApplyReport(failedApplyReport(plan.workflow, "workflow-plan-inputs-invalid", message, plan));
|
|
321
326
|
}
|
|
322
327
|
const targetErrors = await workflowTargetDiagnostics(workspace ?? WorkspaceExecutor.fromRoot(), spec, plan.inputs);
|
|
323
328
|
if (targetErrors.length)
|
|
324
|
-
return await
|
|
329
|
+
return await recordApplyReport(refusedApplyReport(plan.workflow, targetErrors, { plan, mode: dryRun ? "dry-run" : "apply" }));
|
|
325
330
|
plan = { ...plan, steps: spec.steps, validation: spec.validation };
|
|
326
331
|
if (dryRun)
|
|
327
|
-
return await
|
|
332
|
+
return await recordApplyReport(createDryRunWorkflowApplyReport(plan));
|
|
328
333
|
if (!registry) {
|
|
329
334
|
const message = "Workflow apply requires a step runner registry.";
|
|
330
|
-
return await
|
|
335
|
+
return await recordApplyReport(failedApplyReport(plan.workflow, "workflow-registry-missing", message, plan));
|
|
331
336
|
}
|
|
332
|
-
return await
|
|
337
|
+
return await recordApplyReport(await new WorkflowExecutor(registry, workspace).apply(plan));
|
|
333
338
|
}
|
|
334
339
|
async validate(runIdOrPlan, {
|
|
335
340
|
format = "markdown",
|
|
341
|
+
...options
|
|
342
|
+
}) {
|
|
343
|
+
return renderWorkflowValidation(await this.validateReport(runIdOrPlan, options), format);
|
|
344
|
+
}
|
|
345
|
+
async validateReport(runIdOrPlan, {
|
|
336
346
|
workspace,
|
|
337
347
|
execute,
|
|
338
348
|
includeBaselineDetails = false
|
|
@@ -356,7 +366,7 @@ class WorkflowRunner extends runner("workflow") {
|
|
|
356
366
|
repairActions: loaded.repairActions
|
|
357
367
|
})), includeBaselineDetails);
|
|
358
368
|
await writeWorkflowRunArtifact(workspace, report);
|
|
359
|
-
return
|
|
369
|
+
return report;
|
|
360
370
|
}
|
|
361
371
|
async report(runId, { format = "markdown", workspace }) {
|
|
362
372
|
try {
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-386canwe.js";
|
|
6
6
|
import {
|
|
7
7
|
LibSource,
|
|
8
8
|
formatLibStatuses,
|
|
9
9
|
CommandExecutionError,
|
|
10
10
|
LibExecutor
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-wfmpxke3.js";
|
|
12
|
+
import {
|
|
13
|
+
assertPlainName
|
|
14
|
+
} from "./index-x3x31df8.js";
|
|
12
15
|
|
|
13
16
|
// pkgs/@akanjs/cli/library/library.script.ts
|
|
14
17
|
import { Logger } from "akanjs/common";
|
|
@@ -148,6 +151,7 @@ class LibraryScript extends script("library", [LibraryRunner]) {
|
|
|
148
151
|
return scanInfo;
|
|
149
152
|
}
|
|
150
153
|
async createLibrary(libName, workspace) {
|
|
154
|
+
assertPlainName("lib", libName);
|
|
151
155
|
const spinner = workspace.spinning(`Creating ${libName} library`);
|
|
152
156
|
const lib = await this.libraryRunner.createLibrary(libName, workspace);
|
|
153
157
|
spinner.succeed(`${libName} library (libs/${libName}) is created`);
|
|
@@ -166,6 +170,7 @@ class LibraryScript extends script("library", [LibraryRunner]) {
|
|
|
166
170
|
Logger.rawLog(format === "json" ? JSON.stringify(statuses, null, 2) : formatLibStatuses(statuses));
|
|
167
171
|
}
|
|
168
172
|
async installLibrary(workspace, libName) {
|
|
173
|
+
assertPlainName("lib", libName);
|
|
169
174
|
const installSpinner = workspace.spinning(`Installing ${libName} library`);
|
|
170
175
|
const lib = await this.libraryRunner.installLibrary(workspace, libName);
|
|
171
176
|
installSpinner.succeed(`${libName} library (libs/${libName}) is installed`);
|
|
@@ -6,21 +6,21 @@ import {
|
|
|
6
6
|
CloudApi,
|
|
7
7
|
CloudUpdates,
|
|
8
8
|
PipelineSecrets
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-e22zedc2.js";
|
|
10
10
|
import {
|
|
11
11
|
resolveMobileTargets
|
|
12
12
|
} from "./index-m9jj544v.js";
|
|
13
13
|
import {
|
|
14
14
|
WorkspaceExecutor,
|
|
15
15
|
AppExecutor
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-wfmpxke3.js";
|
|
17
17
|
import {
|
|
18
18
|
NativeApp
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-djc5nxpy.js";
|
|
20
20
|
import {
|
|
21
21
|
runner,
|
|
22
22
|
assertPromptable
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-386canwe.js";
|
|
24
24
|
import {
|
|
25
25
|
getNpmRegistryUrl,
|
|
26
26
|
getPublishedVersions,
|