@akanjs/cli 3.1.2-rc.4 → 3.2.0-rc.1
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-z34p8m91.js → CodeAgent-vmd9k4ak.js} +3 -3
- package/{CodeTui-nvd9fk3g.js → CodeTui-zka44v52.js} +1 -1
- package/README.ko.md +9 -0
- package/README.md +9 -0
- package/TunnelShare-k3ja4w9x.js +14 -0
- package/{agent.command-962mp3kg.js → agent.command-2f657613.js} +19 -17
- package/akanCode.js +6 -6
- package/{application.command-1nr0bqq1.js → application.command-q6skd3am.js} +36 -22
- package/{applicationBuildRunner-xy7hnfzq.js → applicationBuildRunner-sctcmkyx.js} +55 -16
- package/buildBatch.proc.js +7 -7
- package/{cloud.command-cj7b3m6y.js → cloud.command-7642pks6.js} +36 -19
- package/cloud.script-1sfseznn.js +30 -0
- package/{code.command-asq7xrr6.js → code.command-7s4ndq2k.js} +6 -6
- package/commandManifest.json +1 -1
- package/{context.command-fw4g2pw1.js → context.command-569z0rqf.js} +20 -19
- package/context.runner-ms8v1rxy.js +29 -0
- package/{devTui-evr3b35y.js → devTui-w38ch13a.js} +1 -1
- package/{guideline.command-43gfjsjv.js → guideline.command-gnv3e8p8.js} +2 -2
- package/guidelines/akanApi/akanApi.instruction.md +317 -0
- package/guidelines/conventions/rules/app.md +5 -5
- package/guidelines/conventions/rules/config.md +1 -1
- package/guidelines/conventions/rules/gates.md +10 -5
- package/incrementalBuilder.proc.js +69 -39
- package/{index-0tkj05cz.js → index-0fb3cpbt.js} +3 -3
- package/{index-6t7fkx73.js → index-1q1cjn8s.js} +21 -11
- package/{index-tenw3mah.js → index-23860fej.js} +16 -6
- package/{index-6zgt7zmx.js → index-48d5qsj3.js} +4 -4
- package/{index-z47rw9ez.js → index-5w9my9qe.js} +8 -8
- package/{index-qwe079ww.js → index-6wpaq392.js} +61 -15
- package/{index-kc871vpc.js → index-7xdpww43.js} +69 -12
- package/index-7y5yghjg.js +2969 -0
- package/{index-38patcx6.js → index-8g7tdsk4.js} +249 -696
- package/{index-90q0w90q.js → index-8kczhnmv.js} +1 -1
- package/{index-kdswbvys.js → index-8pb9yvp8.js} +63 -21
- package/{index-hmj94es2.js → index-8ts9774g.js} +4 -4
- package/{index-r0q2ka2b.js → index-93ewzmp6.js} +43 -14
- package/{index-y0y0pnx8.js → index-9tbgb4d8.js} +1 -1
- package/{index-jzpeny42.js → index-a8a9ede9.js} +7 -7
- package/index-abgh0jve.js +126 -0
- package/{index-t0hk1kxq.js → index-aj3ehkcx.js} +1 -1
- package/{index-demt944k.js → index-d4n1wmrz.js} +37 -4
- package/{index-sra1a5f8.js → index-drz9e84d.js} +22 -8
- package/{index-gfh90r3t.js → index-e3vmjtph.js} +2 -2
- package/{index-k64mhwbw.js → index-eajbmk10.js} +2 -1
- package/{index-g0yds382.js → index-ed6ea0qp.js} +1 -1
- package/{index-ap6ac70m.js → index-fjr4d6yd.js} +444 -368
- package/index-hqrkqxx2.js +176 -0
- package/{index-ampz4vgv.js → index-kpdv34rq.js} +4 -4
- package/{index-kc6ffq0s.js → index-ktb3wcqz.js} +73 -34
- package/{index-dcm66hss.js → index-mmym5xmb.js} +4 -2
- package/{index-8d9r465x.js → index-mqntfzv5.js} +2 -2
- package/{index-4am4dvmf.js → index-ny2k80mv.js} +15 -3
- package/index-p6hjwt2d.js +1668 -0
- package/{index-53h0053j.js → index-rc5fvqj2.js} +12 -14
- package/{index-jzz6ye8x.js → index-s2grpzef.js} +40 -8
- package/{index-38by07nw.js → index-sr5da35e.js} +32 -9
- package/{index-qev8p5wp.js → index-sy481q2x.js} +1 -1
- package/{index-ck64kxrn.js → index-thckcabc.js} +2 -2
- package/{index-2yan1ajk.js → index-v4p1zye8.js} +18 -9
- package/{index-wymcdsas.js → index-vkzfk7qt.js} +25 -23
- package/{index-r8t5sq7z.js → index-vr68mxj5.js} +68 -21
- package/{index-vkpqe29t.js → index-w639tvkd.js} +24 -125
- package/index-ygdbn9jn.js +122 -0
- package/{index-w60zxxye.js → index-zpv14wpy.js} +3 -3
- package/index.js +24 -23
- package/{library.command-zh29tjdd.js → library.command-1gp5qe3r.js} +3 -3
- package/{localRegistry.command-k9pn9ahj.js → localRegistry.command-x7jptkd3.js} +26 -17
- package/{module.command-dgpqs9fz.js → module.command-4xz9he6h.js} +6 -6
- package/{package.command-1je4hsca.js → package.command-s7qpnn1g.js} +12 -3
- package/package.json +2 -2
- package/{page.command-cgsasanh.js → page.command-fan34c49.js} +3 -3
- package/{pipeline.command-tb46sa8v.js → pipeline.command-ph4fnn9w.js} +2 -2
- package/{primitive.command-bzsy23x5.js → primitive.command-3fqh8emf.js} +7 -7
- package/{projectTypecheck-h8rgaczy.js → projectTypecheck-vkb40hjc.js} +1 -1
- package/{quality.command-120m9h6v.js → quality.command-ecj6exsh.js} +15 -10
- package/{repair.command-6m4wd0qv.js → repair.command-fe9jw719.js} +6 -6
- package/{scalar.command-3dn5hsc6.js → scalar.command-cnvfhk0n.js} +5 -5
- package/skills/akan-debug/SKILL.md +2 -1
- package/skills/akan-page/SKILL.md +16 -7
- package/skills/akan-service/SKILL.md +48 -19
- package/{subspace.command-s8nyfqbn.js → subspace.command-qw5ddd6y.js} +8 -8
- package/templates/app/lib/___appName__/__appName__.abstract.md.template +6 -0
- package/templates/app/page/_index.tsx +4 -284
- package/templates/app/page/_layout.tsx +1 -26
- package/templates/app/page/styles.css.template +58 -318
- package/templates/appSample/page/_index.tsx +281 -0
- package/templates/appSample/page/_layout.tsx +55 -0
- package/templates/appSample/page/styles.css.template +327 -0
- package/templates/libRoot/lib/___libName__/__libName__.abstract.md.template +6 -0
- package/templates/workspaceRoot/package.json.template +1 -12
- package/{tunnel.command-8mwrqkr3.js → tunnel.command-ggj38mqf.js} +7 -7
- package/{verify.command-2pspfy7k.js → verify.command-w9ttxkdz.js} +16 -14
- package/{workflow.command-7sy5vnsj.js → workflow.command-ss8devj0.js} +12 -12
- package/{workspace.command-x518tdv4.js → workspace.command-6z2rh8ze.js} +51 -39
- package/TunnelShare-jwbb50kz.js +0 -14
- package/cloud.script-8kr7qgfa.js +0 -27
- package/context.runner-p6m5cxk3.js +0 -28
- package/index-d894868w.js +0 -842
- package/index-re2kfscb.js +0 -1363
- /package/templates/{app → appSample}/page/_overrides.tsx +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Black.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Bold.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraBold.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraLight.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Light.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Medium.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Regular.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-SemiBold.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Thin.woff2 +0 -0
- /package/templates/{app → appSample}/public/jelly/cloud.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/comet.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/moon.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/planet.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/rocket.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/star.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/sugar.webp +0 -0
- /package/templates/{app → appSample}/public/logo.png +0 -0
- /package/templates/{app → appSample}/ui/Recipe/index.ts +0 -0
- /package/templates/{app → appSample}/ui/Recipe/jellyButton.ts +0 -0
|
@@ -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-vmd9k4ak.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?.();
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import {
|
|
3
3
|
AppExecutor,
|
|
4
4
|
LibExecutor
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-sr5da35e.js";
|
|
6
6
|
import {
|
|
7
7
|
createAst,
|
|
8
8
|
AkanIndex
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-7y5yghjg.js";
|
|
10
10
|
import {
|
|
11
11
|
camelToKebabCase
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-93ewzmp6.js";
|
|
13
13
|
|
|
14
14
|
// pkgs/@akanjs/devkit/workflow/artifacts.ts
|
|
15
15
|
import { capitalize as capitalize2 } from "akanjs/common";
|
|
@@ -3394,28 +3394,70 @@ var inspectRenameKeyPlan = async (workspace, plan) => {
|
|
|
3394
3394
|
predictedChanges: files.length ? files.map((file) => ({ target: file.path, action: "modify", applyScope: "auto", reason: file.reason })) : plan.predictedChanges
|
|
3395
3395
|
};
|
|
3396
3396
|
};
|
|
3397
|
-
var
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3397
|
+
var syssHolding = async (workspace, module, except) => {
|
|
3398
|
+
const [apps, libs] = await workspace.getSyss();
|
|
3399
|
+
const others = await Promise.all([...apps, ...libs].filter((name) => name !== except.name).map(async (name) => await resolveWorkflowSys(workspace, name)));
|
|
3400
|
+
const holding = await Promise.all(others.map(async (other) => other && (await other.readdir("lib")).includes(module) ? other : null));
|
|
3401
|
+
return holding.filter((other) => other !== null);
|
|
3402
|
+
};
|
|
3403
|
+
var moduleMissing = async (workspace, sys, module) => {
|
|
3404
|
+
if ((await sys.readdir("lib")).includes(module))
|
|
3405
|
+
return null;
|
|
3406
|
+
const root = getSysRoot(sys);
|
|
3407
|
+
const modules = [...await sys.getDatabaseModules(), ...await sys.getServiceModules()];
|
|
3408
|
+
const sameName = modules.find((name) => name.replace(/^_/, "").toLowerCase() === module.toLowerCase());
|
|
3409
|
+
const isScalar = (await sys.getScalarModules()).includes(module);
|
|
3410
|
+
const [holder] = sameName || isScalar ? [] : await syssHolding(workspace, module, sys);
|
|
3411
|
+
return {
|
|
3412
|
+
severity: "error",
|
|
3413
|
+
code: "workflow-module-missing",
|
|
3414
|
+
input: "module",
|
|
3415
|
+
message: [
|
|
3416
|
+
`No module named ${module} in ${root}: ${root}/lib/${module} does not exist.`,
|
|
3417
|
+
modules.length ? `Its modules are ${modules.join(", ")}.` : `${root} has no modules yet.`,
|
|
3418
|
+
sameName ? `Did you mean ${sameName}?` : isScalar ? `${root}/lib/__scalar/${module} is a scalar, and this workflow writes only into a module under ${root}/lib.` : holder ? `${module} is in ${getSysRoot(holder)}, so plan this with --app ${holder.name}.` : `If ${module} is a new model, create it with the create-module workflow first, then plan this again.`
|
|
3419
|
+
].join(" ")
|
|
3420
|
+
};
|
|
3421
|
+
};
|
|
3422
|
+
var workflowTargetDiagnostics = async (workspace, spec, inputs) => {
|
|
3423
|
+
const app = planString(inputs, "app");
|
|
3403
3424
|
if (!app)
|
|
3404
|
-
return
|
|
3425
|
+
return [];
|
|
3405
3426
|
const sys = await resolveWorkflowSys(workspace, app).catch(() => null);
|
|
3406
|
-
if (!sys)
|
|
3427
|
+
if (!sys) {
|
|
3428
|
+
const [apps, libs] = await workspace.getSyss();
|
|
3429
|
+
return [
|
|
3430
|
+
{
|
|
3431
|
+
severity: "error",
|
|
3432
|
+
code: "workflow-target-missing",
|
|
3433
|
+
input: "app",
|
|
3434
|
+
message: `No app or library named ${app}. Apps: ${apps.join(", ") || "none"}. Libraries: ${libs.join(", ") || "none"}.`
|
|
3435
|
+
}
|
|
3436
|
+
];
|
|
3437
|
+
}
|
|
3438
|
+
const module = planString(inputs, "module");
|
|
3439
|
+
const moduleSpec = spec.inputs.module;
|
|
3440
|
+
if (!module || !moduleSpec?.mustExist)
|
|
3441
|
+
return [];
|
|
3442
|
+
const missing = await moduleMissing(workspace, sys, module);
|
|
3443
|
+
return missing ? [missing] : [];
|
|
3444
|
+
};
|
|
3445
|
+
var inspectWorkflowPlan = async (workspace, spec, plan) => {
|
|
3446
|
+
const targetDiagnostics = await workflowTargetDiagnostics(workspace, spec, plan.inputs);
|
|
3447
|
+
if (targetDiagnostics.length)
|
|
3407
3448
|
return {
|
|
3408
3449
|
...plan,
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
severity: "error",
|
|
3413
|
-
code: "workflow-target-missing",
|
|
3414
|
-
input: "app",
|
|
3415
|
-
message: `No app or library named ${app}.`
|
|
3416
|
-
}
|
|
3417
|
-
]
|
|
3450
|
+
predictedChanges: [],
|
|
3451
|
+
diagnostics: [...plan.diagnostics, ...targetDiagnostics],
|
|
3452
|
+
recommendations: []
|
|
3418
3453
|
};
|
|
3454
|
+
if (plan.workflow === "rename-key")
|
|
3455
|
+
return await inspectRenameKeyPlan(workspace, plan);
|
|
3456
|
+
if (plan.workflow !== "add-mutation" && plan.workflow !== "create-interaction")
|
|
3457
|
+
return plan;
|
|
3458
|
+
const sys = await resolveWorkflowSys(workspace, planString(plan.inputs, "app")).catch(() => null);
|
|
3459
|
+
if (!sys)
|
|
3460
|
+
return plan;
|
|
3419
3461
|
const inspected = plan.workflow === "add-mutation" ? await MutationScaffold.build(sys, {
|
|
3420
3462
|
module: planString(plan.inputs, "module"),
|
|
3421
3463
|
mutation: planString(plan.inputs, "mutation"),
|
|
@@ -3760,4 +3802,4 @@ for (const candidate of toolingRolloutCandidates) {
|
|
|
3760
3802
|
if (isRestrictedCandidate(candidate))
|
|
3761
3803
|
restrictedCandidates.set(candidate.packageName, candidate);
|
|
3762
3804
|
}
|
|
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 };
|
|
3805
|
+
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, workflowTargetDiagnostics, inspectWorkflowPlan, renderWorkflowList, renderWorkflowExplain, renderWorkflowPlan, renderWorkflowApply, renderWorkflowValidation, renderRepairReport, renderWorkflowRunArtifact, renderPrimitiveReport, toolingRolloutGate };
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-93ewzmp6.js";
|
|
6
6
|
import {
|
|
7
7
|
ModuleExecutor
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-sr5da35e.js";
|
|
9
9
|
import {
|
|
10
10
|
sourceFile,
|
|
11
11
|
moduleSourcePaths,
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
createPassedPrimitiveReport,
|
|
14
14
|
bilingualLabelForField,
|
|
15
15
|
bilingualDescriptionForField
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-8pb9yvp8.js";
|
|
17
17
|
import {
|
|
18
18
|
PageScript
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-aj3ehkcx.js";
|
|
20
20
|
import {
|
|
21
21
|
pluralizeName
|
|
22
22
|
} from "./index-nz8prx9g.js";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
LibExecutor,
|
|
11
11
|
PkgExecutor,
|
|
12
12
|
ModuleExecutor
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-sr5da35e.js";
|
|
14
14
|
|
|
15
15
|
// pkgs/@akanjs/devkit/commandDecorators/camelToKebabCase.ts
|
|
16
16
|
var camelToKebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
@@ -538,8 +538,25 @@ var assertCurrentDirectoryIsWorkspaceRoot = async () => {
|
|
|
538
538
|
].join(`
|
|
539
539
|
`));
|
|
540
540
|
};
|
|
541
|
+
var shellWordOf = (word) => /^[\w@%+=:,./-]+$/.test(word) ? word : `'${word.replaceAll("'", "'\\''")}'`;
|
|
542
|
+
var rerunCommandOf = (argv, operands, slot) => (target) => {
|
|
543
|
+
const [commandName = "", ...words] = argv;
|
|
544
|
+
let at = 0;
|
|
545
|
+
for (const operand of operands.slice(0, slot))
|
|
546
|
+
if (typeof operand === "string")
|
|
547
|
+
at = words.indexOf(operand, at) + 1;
|
|
548
|
+
const given = operands[slot];
|
|
549
|
+
const givenAt = typeof given === "string" ? words.indexOf(given, at) : -1;
|
|
550
|
+
const rerun = words.map(shellWordOf);
|
|
551
|
+
if (givenAt >= 0)
|
|
552
|
+
rerun.splice(givenAt, 1, target);
|
|
553
|
+
else
|
|
554
|
+
rerun.splice(at, 0, target);
|
|
555
|
+
return ["akan", commandName, ...rerun].join(" ");
|
|
556
|
+
};
|
|
557
|
+
var rerunRemedyOf = (rerun, placeholder) => rerun ? { remedy: `rerun it as \`${rerun(placeholder)}\`` } : {};
|
|
541
558
|
var parseAppNameList = (value) => (Array.isArray(value) ? value : value === undefined ? [] : [value]).flatMap((entry) => entry.split(",")).map((entry) => entry.trim()).filter(Boolean);
|
|
542
|
-
var getAppsArgumentValue = async (value, workspace) => {
|
|
559
|
+
var getAppsArgumentValue = async (value, workspace, rerun) => {
|
|
543
560
|
const appNames = await workspace.getApps();
|
|
544
561
|
if (appNames.length === 0)
|
|
545
562
|
throw new Error("No apps found in this workspace (apps/<appName>/akan.config.ts)");
|
|
@@ -554,7 +571,7 @@ var getAppsArgumentValue = async (value, workspace) => {
|
|
|
554
571
|
}
|
|
555
572
|
if (appNames.length === 1 && appNames[0])
|
|
556
573
|
return [AppExecutor.from(workspace, appNames[0])];
|
|
557
|
-
assertPromptable("Missing apps", { choices: [...appNames, "all"] });
|
|
574
|
+
assertPromptable("Missing apps", { choices: [...appNames, "all"], ...rerunRemedyOf(rerun, "<apps...>") });
|
|
558
575
|
const remembered = new Set(await AppSelectionMemory.read(workspace.workspaceRoot));
|
|
559
576
|
const picked = await checkbox({
|
|
560
577
|
message: "Select the apps to run (space to toggle, enter to confirm)",
|
|
@@ -564,7 +581,7 @@ var getAppsArgumentValue = async (value, workspace) => {
|
|
|
564
581
|
await AppSelectionMemory.write(workspace.workspaceRoot, picked);
|
|
565
582
|
return picked.map((name) => AppExecutor.from(workspace, name));
|
|
566
583
|
};
|
|
567
|
-
var getInternalArgumentValue = async (argMeta, value, workspace) => {
|
|
584
|
+
var getInternalArgumentValue = async (argMeta, value, workspace, rerun) => {
|
|
568
585
|
if (argMeta.type === "Workspace")
|
|
569
586
|
return workspace;
|
|
570
587
|
const sysType = argMeta.type.toLowerCase();
|
|
@@ -586,12 +603,18 @@ var getInternalArgumentValue = async (argMeta, value, workspace) => {
|
|
|
586
603
|
return found;
|
|
587
604
|
if (!value && argMeta.option?.onlyApp && appNames.length === 1 && appNames[0])
|
|
588
605
|
return AppExecutor.from(workspace, appNames[0]);
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
606
|
+
const [kind, placeholder] = sysType === "exec" ? ["app, lib or pkg", "<app-lib-or-pkg>"] : ["app or lib", "<app-or-lib>"];
|
|
607
|
+
const choices = [...appNames, ...libNames, ...pkgChoices];
|
|
608
|
+
const only = choices.length === 1 ? execOf(choices[0] ?? "") : null;
|
|
609
|
+
if (!value && only && !process.stdin.isTTY) {
|
|
610
|
+
const how = rerun ? `: ${rerun(only.name)}` : "";
|
|
611
|
+
Logger.rawLog(`No ${kind} named, so this runs on '${only.name}', the only one in this workspace${how}`, undefined, "error");
|
|
612
|
+
return only;
|
|
613
|
+
}
|
|
614
|
+
assertPromptable(problemOf(kind), { choices, ...rerunRemedyOf(rerun, placeholder) });
|
|
592
615
|
const name = await select({
|
|
593
616
|
message: sysType === "exec" ? `Select the App or Lib or Pkg name` : `Select the App or Lib name`,
|
|
594
|
-
choices
|
|
617
|
+
choices
|
|
595
618
|
});
|
|
596
619
|
const picked = execOf(name);
|
|
597
620
|
if (!picked)
|
|
@@ -602,20 +625,20 @@ var getInternalArgumentValue = async (argMeta, value, workspace) => {
|
|
|
602
625
|
return AppExecutor.from(workspace, value);
|
|
603
626
|
if (!value && appNames.length === 1 && appNames[0])
|
|
604
627
|
return AppExecutor.from(workspace, appNames[0]);
|
|
605
|
-
assertPromptable(problemOf("app"), { choices: appNames });
|
|
628
|
+
assertPromptable(problemOf("app"), { choices: appNames, ...rerunRemedyOf(rerun, "<app>") });
|
|
606
629
|
const appName = await select({ message: `Select the ${sysType} name`, choices: appNames });
|
|
607
630
|
return AppExecutor.from(workspace, appName);
|
|
608
631
|
} else if (sysType === "lib") {
|
|
609
632
|
if (value && libNames.includes(value))
|
|
610
633
|
return LibExecutor.from(workspace, value);
|
|
611
|
-
assertPromptable(problemOf("lib"), { choices: libNames });
|
|
634
|
+
assertPromptable(problemOf("lib"), { choices: libNames, ...rerunRemedyOf(rerun, "<lib>") });
|
|
612
635
|
const libName = await select({ message: `Select the ${sysType} name`, choices: libNames });
|
|
613
636
|
return LibExecutor.from(workspace, libName);
|
|
614
637
|
} else if (sysType === "pkg") {
|
|
615
638
|
const pkgs = await workspace.getPkgs();
|
|
616
639
|
if (value && pkgs.includes(value))
|
|
617
640
|
return PkgExecutor.from(workspace, value);
|
|
618
|
-
assertPromptable(problemOf("pkg"), { choices: pkgs });
|
|
641
|
+
assertPromptable(problemOf("pkg"), { choices: pkgs, ...rerunRemedyOf(rerun, "<pkg>") });
|
|
619
642
|
const pkgName = await select({ message: `Select the ${sysType} name`, choices: pkgs });
|
|
620
643
|
return PkgExecutor.from(workspace, pkgName);
|
|
621
644
|
} else if (sysType === "module") {
|
|
@@ -638,7 +661,12 @@ var getInternalArgumentValue = async (argMeta, value, workspace) => {
|
|
|
638
661
|
} else
|
|
639
662
|
throw new Error(`Invalid system name: ${sysName}`);
|
|
640
663
|
}
|
|
641
|
-
|
|
664
|
+
const systems = [
|
|
665
|
+
...appNames.map((name) => AppExecutor.from(workspace, name)),
|
|
666
|
+
...libNames.map((name) => LibExecutor.from(workspace, name))
|
|
667
|
+
];
|
|
668
|
+
const choices = process.stdin.isTTY ? [] : (await Promise.all(systems.map(async (sys) => (await sys.getModules()).map((m) => `${sys.name}:${m}`)))).flat();
|
|
669
|
+
assertPromptable(problemOf("module"), { choices, ...rerunRemedyOf(rerun, "<sys:module>") });
|
|
642
670
|
const { type, name } = await select({
|
|
643
671
|
message: `select the App or Lib name`,
|
|
644
672
|
choices: [
|
|
@@ -745,14 +773,15 @@ ${versionWarning}`), undefined, "error");
|
|
|
745
773
|
const workspace = WorkspaceExecutor.fromRoot();
|
|
746
774
|
const commandContext = { values: {} };
|
|
747
775
|
for (const argMeta of allArgMetas) {
|
|
776
|
+
const rerun = rerunCommandOf(process.argv.slice(2), cmdArgs, argMeta.idx);
|
|
748
777
|
if (argMeta.type === "Option")
|
|
749
778
|
commandArgs[argMeta.idx] = await getOptionValue(argMeta, opt, commandContext);
|
|
750
779
|
else if (argMeta.type === "Argument")
|
|
751
780
|
commandArgs[argMeta.idx] = await getArgumentValue(argMeta, cmdArgs[argMeta.idx]);
|
|
752
781
|
else if (argMeta.type === "Apps")
|
|
753
|
-
commandArgs[argMeta.idx] = await getAppsArgumentValue(cmdArgs[argMeta.idx], workspace);
|
|
782
|
+
commandArgs[argMeta.idx] = await getAppsArgumentValue(cmdArgs[argMeta.idx], workspace, rerun);
|
|
754
783
|
else
|
|
755
|
-
commandArgs[argMeta.idx] = await getInternalArgumentValue(argMeta, cmdArgs[argMeta.idx], workspace);
|
|
784
|
+
commandArgs[argMeta.idx] = await getInternalArgumentValue(argMeta, cmdArgs[argMeta.idx], workspace, rerun);
|
|
756
785
|
if (commandArgs[argMeta.idx] instanceof AppExecutor)
|
|
757
786
|
process.env.AKAN_PUBLIC_APP_NAME = commandArgs[argMeta.idx].name;
|
|
758
787
|
else if (Array.isArray(commandArgs[argMeta.idx])) {
|
|
@@ -11,15 +11,15 @@ import {
|
|
|
11
11
|
McpServerConfig,
|
|
12
12
|
WorkspaceTrust
|
|
13
13
|
} from "./index-w15mg3km.js";
|
|
14
|
+
import {
|
|
15
|
+
PreviewView2,
|
|
16
|
+
stripAnsi
|
|
17
|
+
} from "./index-23860fej.js";
|
|
14
18
|
import {
|
|
15
19
|
SubagentPool2,
|
|
16
20
|
McpSignIn,
|
|
17
21
|
AkanCodeCompaction2
|
|
18
|
-
} from "./index-
|
|
19
|
-
import {
|
|
20
|
-
PreviewView2,
|
|
21
|
-
stripAnsi
|
|
22
|
-
} from "./index-tenw3mah.js";
|
|
22
|
+
} from "./index-8kczhnmv.js";
|
|
23
23
|
import {
|
|
24
24
|
codeAgentIsLoopback,
|
|
25
25
|
codeAgentHostListed,
|
|
@@ -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-ms8v1rxy.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-ms8v1rxy.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 })) {
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
FrameworkMapBuilder,
|
|
4
|
+
FrameworkMapDoc
|
|
5
|
+
} from "./index-7y5yghjg.js";
|
|
6
|
+
|
|
7
|
+
// pkgs/@akanjs/devkit/frameworkGraph.ts
|
|
8
|
+
import { readdir, readFile, realpath, stat } from "fs/promises";
|
|
9
|
+
import path from "path";
|
|
10
|
+
import ts from "typescript";
|
|
11
|
+
var packageSpecs = [
|
|
12
|
+
{ name: "akanjs", split: true },
|
|
13
|
+
{ name: "@akanjs/devkit", split: false }
|
|
14
|
+
];
|
|
15
|
+
var channelSpecs = [
|
|
16
|
+
{ file: "service/ipcTypes.ts", union: "AkanIpcMessage", label: "gateway \u21C4 child" },
|
|
17
|
+
{ file: "server/artifact/ipcTypes.ts", union: "BuilderMessage", label: "dev host \u21C4 builder, relayed to the child" },
|
|
18
|
+
{ file: "server/rscWorker.tsx", union: "InMsg", label: "server \u2192 RSC worker" },
|
|
19
|
+
{ file: "server/rscWorkerHost.ts", union: "RscInMsg", label: "RSC worker \u2192 server" },
|
|
20
|
+
{ file: "server/hmr/wsHub.ts", union: "HmrMessage", label: "dev server \u2192 browser tab", relays: ["HmrWsHub"] }
|
|
21
|
+
];
|
|
22
|
+
var skippedDirs = new Set(["node_modules", "vendor", "types", "integration", "csrE2e", "platformTest"]);
|
|
23
|
+
|
|
24
|
+
class FrameworkGraph {
|
|
25
|
+
static architectureFile = "pkgs/akanjs/ARCHITECTURE.md";
|
|
26
|
+
static #cache = new Map;
|
|
27
|
+
static #edits = new Map;
|
|
28
|
+
static async packagesOf(workspaceRoot) {
|
|
29
|
+
const found = await Promise.all(packageSpecs.map(async ({ name, split }) => {
|
|
30
|
+
const root = await FrameworkGraph.#isDir(path.join(workspaceRoot, "pkgs", name)) ? `pkgs/${name}` : await FrameworkGraph.#installedRoot(workspaceRoot, name);
|
|
31
|
+
return root ? [{ name, root, split }] : [];
|
|
32
|
+
}));
|
|
33
|
+
return found.flat();
|
|
34
|
+
}
|
|
35
|
+
static async build(workspaceRoot) {
|
|
36
|
+
const packages = await FrameworkGraph.packagesOf(workspaceRoot);
|
|
37
|
+
const akanjs = packages.find(({ name }) => name === "akanjs");
|
|
38
|
+
if (!akanjs)
|
|
39
|
+
return null;
|
|
40
|
+
const files = (await Promise.all(packages.map(({ root }) => FrameworkGraph.#filesUnder(workspaceRoot, root)))).flat();
|
|
41
|
+
const texts = await Promise.all(files.map(async (file) => [file, await readFile(path.join(workspaceRoot, file), "utf8")]));
|
|
42
|
+
return new FrameworkMapBuilder({
|
|
43
|
+
ts,
|
|
44
|
+
packages,
|
|
45
|
+
files: texts,
|
|
46
|
+
channels: channelSpecs.map((spec) => ({ ...spec, file: `${akanjs.root}/${spec.file}` }))
|
|
47
|
+
}).build();
|
|
48
|
+
}
|
|
49
|
+
static async architecture(workspaceRoot) {
|
|
50
|
+
const file = path.join(workspaceRoot, FrameworkGraph.architectureFile);
|
|
51
|
+
const current = await readFile(file, "utf8").then((text) => text.replace(/\r\n/g, `
|
|
52
|
+
`)).catch(() => null);
|
|
53
|
+
const map = current === null ? null : await FrameworkGraph.build(workspaceRoot);
|
|
54
|
+
if (current === null || !map || map.packages.find(({ name }) => name === "akanjs")?.root !== "pkgs/akanjs")
|
|
55
|
+
return null;
|
|
56
|
+
const next = FrameworkMapDoc.splice(current, FrameworkMapDoc.render(map, path.posix.dirname(FrameworkGraph.architectureFile)));
|
|
57
|
+
return {
|
|
58
|
+
file,
|
|
59
|
+
current,
|
|
60
|
+
next,
|
|
61
|
+
unknownClasses: FrameworkMapDoc.unknownClasses(next, map),
|
|
62
|
+
map
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
static touched(workspaceRoot, files) {
|
|
66
|
+
const roots = packageSpecs.map(({ name }) => path.join(workspaceRoot, "pkgs", name) + path.sep);
|
|
67
|
+
if (files.some((file) => roots.some((root) => path.resolve(workspaceRoot, file).startsWith(root))))
|
|
68
|
+
FrameworkGraph.#edits.set(workspaceRoot, (FrameworkGraph.#edits.get(workspaceRoot) ?? 0) + 1);
|
|
69
|
+
}
|
|
70
|
+
static async cached(workspaceRoot) {
|
|
71
|
+
const packages = await FrameworkGraph.packagesOf(workspaceRoot);
|
|
72
|
+
const stamps = await Promise.all(packages.map(async ({ name, root }) => root.startsWith("pkgs/") ? `${name}#${FrameworkGraph.#edits.get(workspaceRoot) ?? 0}` : `${name}@${await FrameworkGraph.#versionOf(path.join(workspaceRoot, root))}`));
|
|
73
|
+
const cacheKey = [workspaceRoot, ...stamps].join(`
|
|
74
|
+
`);
|
|
75
|
+
const existing = FrameworkGraph.#cache.get(cacheKey);
|
|
76
|
+
if (existing)
|
|
77
|
+
return await existing;
|
|
78
|
+
const built = FrameworkGraph.build(workspaceRoot);
|
|
79
|
+
built.catch(() => FrameworkGraph.#cache.delete(cacheKey));
|
|
80
|
+
FrameworkGraph.#cache.clear();
|
|
81
|
+
FrameworkGraph.#cache.set(cacheKey, built);
|
|
82
|
+
return await built;
|
|
83
|
+
}
|
|
84
|
+
static async#installedRoot(workspaceRoot, name) {
|
|
85
|
+
if (!await FrameworkGraph.#isDir(path.join(workspaceRoot, "node_modules")))
|
|
86
|
+
return null;
|
|
87
|
+
const resolved = await (async () => {
|
|
88
|
+
try {
|
|
89
|
+
return path.dirname(await realpath(Bun.resolveSync(`${name}/package.json`, workspaceRoot)));
|
|
90
|
+
} catch {
|
|
91
|
+
const dir = path.join(workspaceRoot, "node_modules", name);
|
|
92
|
+
return await FrameworkGraph.#isDir(dir) ? await realpath(dir) : null;
|
|
93
|
+
}
|
|
94
|
+
})();
|
|
95
|
+
if (!resolved)
|
|
96
|
+
return null;
|
|
97
|
+
const root = path.relative(await realpath(workspaceRoot), resolved).split(path.sep).join("/");
|
|
98
|
+
return root && !root.startsWith("..") && !path.isAbsolute(root) ? root : null;
|
|
99
|
+
}
|
|
100
|
+
static async#versionOf(dir) {
|
|
101
|
+
return await readFile(path.join(dir, "package.json"), "utf8").then((text) => JSON.parse(text).version ?? "").catch(() => "");
|
|
102
|
+
}
|
|
103
|
+
static async#isDir(dir) {
|
|
104
|
+
return await stat(dir).then((info) => info.isDirectory()).catch(() => false);
|
|
105
|
+
}
|
|
106
|
+
static async#filesUnder(workspaceRoot, root) {
|
|
107
|
+
const entries = await readdir(path.join(workspaceRoot, root), { withFileTypes: true });
|
|
108
|
+
const files = [];
|
|
109
|
+
for (const entry of entries) {
|
|
110
|
+
if (entry.name.startsWith(".") || skippedDirs.has(entry.name))
|
|
111
|
+
continue;
|
|
112
|
+
if (entry.isFile())
|
|
113
|
+
files.push(`${root}/${entry.name}`);
|
|
114
|
+
else if (entry.isDirectory()) {
|
|
115
|
+
for await (const file of new Bun.Glob("**/*.{ts,tsx}").scan({
|
|
116
|
+
cwd: path.join(workspaceRoot, root, entry.name)
|
|
117
|
+
}))
|
|
118
|
+
if (!file.split(path.sep).includes("node_modules"))
|
|
119
|
+
files.push(`${root}/${entry.name}/${file.split(path.sep).join("/")}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return files.filter((file) => FrameworkMapBuilder.isSourcePath(file)).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { FrameworkGraph };
|
|
@@ -2,16 +2,22 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-93ewzmp6.js";
|
|
6
6
|
import {
|
|
7
7
|
FileSys2
|
|
8
8
|
} from "./index-bns3wcpc.js";
|
|
9
9
|
import {
|
|
10
10
|
PkgExecutor
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-sr5da35e.js";
|
|
12
12
|
import {
|
|
13
13
|
TypeScriptDependencyScanner2
|
|
14
14
|
} from "./index-qd7xn2bk.js";
|
|
15
|
+
import {
|
|
16
|
+
FrameworkGraph
|
|
17
|
+
} from "./index-abgh0jve.js";
|
|
18
|
+
import {
|
|
19
|
+
MaintainabilityBaseline
|
|
20
|
+
} from "./index-hqrkqxx2.js";
|
|
15
21
|
|
|
16
22
|
// pkgs/@akanjs/cli/package/package.runner.ts
|
|
17
23
|
import path2 from "path";
|
|
@@ -213,7 +219,7 @@ class PackageRunner extends runner("package") {
|
|
|
213
219
|
});
|
|
214
220
|
} else {
|
|
215
221
|
await pkg.dist.cp(pkg.cwdPath, pkg.dist.cwdPath);
|
|
216
|
-
await $`rm -rf ${pkg.dist.cwdPath}/local`;
|
|
222
|
+
await $`rm -rf ${pkg.dist.cwdPath}/local ${pkg.dist.cwdPath}/akan.baseline.json`;
|
|
217
223
|
await Promise.all([
|
|
218
224
|
pkg.generateDistPackageJson(packageRuntimeDeps, packageRuntimeDevDeps),
|
|
219
225
|
pkg.generateTsconfigJson()
|
|
@@ -331,9 +337,13 @@ class PackageRunner extends runner("package") {
|
|
|
331
337
|
cwd: pkg.workspace.workspaceRoot
|
|
332
338
|
});
|
|
333
339
|
const [packResult] = JSON.parse(packOutput);
|
|
334
|
-
const
|
|
340
|
+
const packedPaths = (packResult?.files ?? []).map((file) => file.path ?? "");
|
|
341
|
+
const localFiles = packedPaths.filter((filePath) => filePath.startsWith("local/"));
|
|
335
342
|
if (localFiles.length > 0)
|
|
336
343
|
throw new Error(`[package] ${pkg.name} would publish ${localFiles.length} test-run files under local/`);
|
|
344
|
+
const baselines = packedPaths.filter((filePath) => path2.posix.basename(filePath) === MaintainabilityBaseline.fileName);
|
|
345
|
+
if (baselines.length > 0)
|
|
346
|
+
throw new Error(`[package] ${pkg.name} would publish its workspace's lint baseline: ${baselines.join(", ")}`);
|
|
337
347
|
return {
|
|
338
348
|
name: pkg.name,
|
|
339
349
|
version: pkgJson.version,
|
|
@@ -341,6 +351,24 @@ class PackageRunner extends runner("package") {
|
|
|
341
351
|
size: packResult?.size ?? 0
|
|
342
352
|
};
|
|
343
353
|
}
|
|
354
|
+
async syncArchitecture(workspace) {
|
|
355
|
+
const architecture = await FrameworkGraph.architecture(workspace.workspaceRoot);
|
|
356
|
+
if (!architecture)
|
|
357
|
+
throw new Error(`${FrameworkGraph.architectureFile} is only kept in the akanjs repository`);
|
|
358
|
+
const { file, current, next, unknownClasses, map } = architecture;
|
|
359
|
+
if (next !== current)
|
|
360
|
+
await Bun.write(file, next);
|
|
361
|
+
const problems = [
|
|
362
|
+
...unknownClasses.map((name) => `\`${name}\` is cited outside the generated part but is no framework class`),
|
|
363
|
+
...map.missing.map((channel) => `channel ${channel} was not found`),
|
|
364
|
+
...map.cycles.map((cycle) => `facets ${cycle.join(", ")} load values from each other`)
|
|
365
|
+
];
|
|
366
|
+
if (problems.length)
|
|
367
|
+
throw new Error(`${FrameworkGraph.architectureFile}:
|
|
368
|
+
${problems.join(`
|
|
369
|
+
`)}`);
|
|
370
|
+
return { file: FrameworkGraph.architectureFile, changed: next !== current };
|
|
371
|
+
}
|
|
344
372
|
async verifyAkanPublishPackages(workspace) {
|
|
345
373
|
const pkgs = PackageRunner.publishableAkanPackages.map((pkgName) => PkgExecutor.from(workspace, pkgName));
|
|
346
374
|
const peerExportsMaps = new Map;
|
|
@@ -403,6 +431,11 @@ class PackageScript extends script("package", [PackageRunner]) {
|
|
|
403
431
|
spinner.succeed(`Package verified (${result.files} files, ${result.size} bytes packed)`);
|
|
404
432
|
return result;
|
|
405
433
|
}
|
|
434
|
+
async syncArchitecture(workspace) {
|
|
435
|
+
const spinner = workspace.spinning("Mapping the framework...");
|
|
436
|
+
const { file, changed } = await this.packageRunner.syncArchitecture(workspace);
|
|
437
|
+
spinner.succeed(changed ? `${file} regenerated` : `${file} is current`);
|
|
438
|
+
}
|
|
406
439
|
async verifyAkanPublishPackages(workspace) {
|
|
407
440
|
const spinner = workspace.spinning("Verifying Akan publish packages...");
|
|
408
441
|
const results = await this.packageRunner.verifyAkanPublishPackages(workspace);
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
UpdatePackFolder,
|
|
10
10
|
NativePublicEnv,
|
|
11
11
|
NativeApp
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-zpv14wpy.js";
|
|
13
13
|
import {
|
|
14
14
|
ExitCodeError
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-93ewzmp6.js";
|
|
16
16
|
import {
|
|
17
17
|
ConfigLock
|
|
18
18
|
} from "./index-bqbf654f.js";
|
|
@@ -193,21 +193,31 @@ class GlobalConfig {
|
|
|
193
193
|
testTargets: { ...akanConfig.testTargets, ...testTargets }
|
|
194
194
|
}));
|
|
195
195
|
}
|
|
196
|
+
static #refreshMarginMs = 60 * 60000;
|
|
196
197
|
static needRefreshToken(accessToken) {
|
|
197
|
-
|
|
198
|
+
const { expiresAt, issuedAt } = accessToken;
|
|
199
|
+
if (!expiresAt)
|
|
200
|
+
return false;
|
|
201
|
+
const lifetimeMs = issuedAt?.isValid() ? expiresAt.diff(issuedAt) : Number.POSITIVE_INFINITY;
|
|
202
|
+
return expiresAt.isBefore(dayjs().add(Math.min(GlobalConfig.#refreshMarginMs, lifetimeMs / 2), "ms"));
|
|
203
|
+
}
|
|
204
|
+
static isExpired(accessToken) {
|
|
205
|
+
return !!accessToken.expiresAt && !accessToken.expiresAt.isAfter(dayjs());
|
|
198
206
|
}
|
|
199
207
|
static toAccessToken(accessToken) {
|
|
200
208
|
return {
|
|
201
209
|
jwt: accessToken.jwt,
|
|
202
210
|
refreshToken: accessToken.refreshToken ?? null,
|
|
203
|
-
expiresAt: accessToken.expiresAt ? dayjs(accessToken.expiresAt) : null
|
|
211
|
+
expiresAt: accessToken.expiresAt ? dayjs(accessToken.expiresAt) : null,
|
|
212
|
+
...accessToken.issuedAt ? { issuedAt: dayjs(accessToken.issuedAt) } : {}
|
|
204
213
|
};
|
|
205
214
|
}
|
|
206
215
|
static toAccessTokenDto(accessToken) {
|
|
207
216
|
return {
|
|
208
217
|
jwt: accessToken.jwt,
|
|
209
218
|
refreshToken: accessToken.refreshToken ?? null,
|
|
210
|
-
expiresAt: accessToken.expiresAt?.toString() ?? null
|
|
219
|
+
expiresAt: accessToken.expiresAt?.toString() ?? null,
|
|
220
|
+
...accessToken.issuedAt ? { issuedAt: accessToken.issuedAt.toString() } : {}
|
|
211
221
|
};
|
|
212
222
|
}
|
|
213
223
|
static toHostConfigDto(hostConfig) {
|
|
@@ -303,7 +313,7 @@ class CloudApi {
|
|
|
303
313
|
const accessToken = hostConfig.auth?.accessToken;
|
|
304
314
|
if (!accessToken || !GlobalConfig.needRefreshToken(accessToken))
|
|
305
315
|
return new CloudApi(workspace, hostConfig);
|
|
306
|
-
const tokenless = new CloudApi(workspace, hostConfig);
|
|
316
|
+
const tokenless = new CloudApi(workspace, { host: hostConfig.host });
|
|
307
317
|
const refreshed = await GlobalConfig.refreshHostAuth(hostConfig.host, (refreshToken) => tokenless.refreshAuthToken(refreshToken));
|
|
308
318
|
return new CloudApi(workspace, refreshed);
|
|
309
319
|
}
|
|
@@ -313,11 +323,15 @@ class CloudApi {
|
|
|
313
323
|
this.host = hostConfig.host;
|
|
314
324
|
this.url = `${this.host}/api`;
|
|
315
325
|
this.#api = new HttpClient(this.url);
|
|
316
|
-
if (this.#accessToken && !GlobalConfig.
|
|
326
|
+
if (this.#accessToken && !GlobalConfig.isExpired(this.#accessToken))
|
|
317
327
|
this.#api.setHeaders({ Authorization: `Bearer ${this.#accessToken.jwt}` });
|
|
318
328
|
}
|
|
329
|
+
get needsSignIn() {
|
|
330
|
+
const accessToken = this.#accessToken;
|
|
331
|
+
return !!accessToken && !accessToken.refreshToken && GlobalConfig.needRefreshToken(accessToken);
|
|
332
|
+
}
|
|
319
333
|
#authorize(accessTokenDto) {
|
|
320
|
-
this.#accessToken = GlobalConfig.toAccessToken(accessTokenDto);
|
|
334
|
+
this.#accessToken = GlobalConfig.toAccessToken({ ...accessTokenDto, issuedAt: new Date().toISOString() });
|
|
321
335
|
this.#api.setHeaders({ Authorization: `Bearer ${this.#accessToken.jwt}` });
|
|
322
336
|
return this.#accessToken;
|
|
323
337
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-93ewzmp6.js";
|
|
6
6
|
import {
|
|
7
7
|
generatedFilesForSync,
|
|
8
8
|
createPassedPrimitiveReport,
|
|
9
9
|
scalarChangedFiles
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-8pb9yvp8.js";
|
|
11
11
|
import {
|
|
12
12
|
pluralizeName
|
|
13
13
|
} from "./index-nz8prx9g.js";
|