@akanjs/devkit 3.2.0-rc.9 → 3.2.1-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/CHANGELOG.md +0 -529
- package/DEV_RUNTIME_KNOBS.md +4 -3
- package/README.ko.md +3 -2
- package/README.md +4 -2
- package/akanApp/BackendImportGraph.test.ts +1 -1
- package/akanApp/akanApp.host.test.ts +152 -6
- package/akanApp/akanApp.host.ts +187 -1220
- package/akanApp/akanApp.host.wiring.test.ts +931 -0
- package/akanApp/builderGap.ts +68 -0
- package/akanApp/builderRequestRelay.test.ts +93 -0
- package/akanApp/builderRequestRelay.ts +100 -0
- package/akanApp/builderRssRecycler.ts +182 -0
- package/akanApp/devBackend.ts +394 -0
- package/akanApp/devBuildStatusBoard.ts +128 -0
- package/akanApp/devBuilder.ts +200 -0
- package/akanApp/devIdleSuspend.test.ts +221 -0
- package/akanApp/devIdleSuspend.ts +192 -0
- package/akanApp/devIdleSuspend.watcher.test.ts +120 -0
- package/akanApp/devRecycler.test.ts +66 -0
- package/akanApp/devRecycler.ts +305 -0
- package/akanApp/devStartTimeline.test.ts +115 -0
- package/akanApp/devStartTimeline.ts +69 -0
- package/akanApp/processRss.ts +61 -0
- package/akanConfig/akanConfig.test.ts +45 -17
- package/akanConfig/akanConfig.ts +10 -10
- package/akanConfig/akanWorkspaceConfig.ts +1 -1
- package/akanConfig/productionLockfile.ts +1 -1
- package/apiReport/apiReport.test.ts +34 -3
- package/apiReport/apiReportDiff.ts +35 -1
- package/apiReport/apiReportPolicy.ts +3 -2
- package/{applicationBuildReporter.ts → app/applicationBuildReporter.ts} +2 -49
- package/{applicationBuildRunner.test.ts → app/applicationBuildRunner.test.ts} +71 -8
- package/{applicationBuildRunner.ts → app/applicationBuildRunner.ts} +60 -21
- package/{applicationTestPreload.ts → app/applicationTestPreload.ts} +1 -1
- package/{routeJsBudget.test.ts → app/routeJsBudget.test.ts} +17 -1
- package/{routeJsBudget.ts → app/routeJsBudget.ts} +9 -3
- package/{routeSourceValidator.test.ts → app/routeSourceValidator.test.ts} +17 -0
- package/{routeSourceValidator.ts → app/routeSourceValidator.ts} +5 -1
- package/artifact/implicitRootLayout.test.ts +71 -3
- package/artifact/implicitRootLayout.ts +9 -3
- package/artifact/implicitRootLayoutRender.test.tsx +297 -0
- package/biome.base.json +2 -1
- package/cloud/cloudApi.test.ts +1 -1
- package/cloud/configLock.test.ts +1 -1
- package/cloud/globalConfig.test.ts +1 -1
- package/cloud/globalConfig.ts +1 -1
- package/cloud/updatePackUpload.test.ts +1 -1
- package/codeAgent/agent/AkanCodeEnv.ts +1 -1
- package/codeAgent/agent/AkanCodeServices.ts +23 -0
- package/codeAgent/agent/akanCodePaths.ts +1 -1
- package/codeAgent/agent/akanCodeServices.test.ts +54 -0
- package/codeAgent/agent/akanSystemPrompt.ts +1 -1
- package/codeAgent/agent/codeAgent.test.ts +1 -1
- package/codeAgent/skills/akan-debug/SKILL.md +8 -5
- package/codeAgent/skills/akan-err/SKILL.md +7 -0
- package/codeAgent/skills/akan-mcp/SKILL.md +19 -1
- package/codeAgent/skills/akan-scaffold/SKILL.md +1 -1
- package/codeAgent/skills/akan-validate/SKILL.md +3 -3
- package/codeAgent/tools/AkanCli.ts +1 -1
- package/codeAgent/tools/AkanToolPack.ts +2 -2
- package/codeAgent/tools/akanCodePlugins.test.ts +1 -1
- package/commandDecorators/command.ts +35 -6
- package/commandDecorators/commandBuilder.ts +1 -1
- package/commandDecorators/commandDecorators.test.ts +107 -6
- package/commandDecorators/targetMeta.ts +2 -0
- package/commandDecorators/workspaceVersionCheck.test.ts +70 -1
- package/commandDecorators/workspaceVersionCheck.ts +64 -14
- package/context/akanContext.ts +576 -0
- package/context/akanContextInspection.ts +296 -0
- package/{akanMcpContract.test.ts → context/akanMcpContract.test.ts} +1 -1
- package/{akanMcpContract.ts → context/akanMcpContract.ts} +16 -256
- package/context/doctor/agentGuideCheck.ts +81 -0
- package/context/doctor/configLeftoverCheck.ts +35 -0
- package/context/doctor/doctorFindings.ts +70 -0
- package/context/doctor/generatedFreshness.ts +56 -0
- package/context/doctor/moduleShapeCheck.ts +88 -0
- package/context/doctor/recipeDuplicateCheck.ts +42 -0
- package/context/doctor/recipeIndexCheck.ts +87 -0
- package/context/doctor/rootShapeCheck.ts +55 -0
- package/context/doctor/workflowScope.ts +97 -0
- package/{recipeScanner.test.ts → context/recipeScanner.test.ts} +1 -1
- package/context/safeRead.ts +9 -0
- package/csrE2e/csrE2eHarness.fixture.ts +1 -1
- package/devkitUtils.test.ts +39 -5
- package/{apiReference.test.ts → docs/apiReference.test.ts} +4 -4
- package/{apiReference.ts → docs/apiReference.ts} +2 -2
- package/docs/errorCodeReference.test.ts +282 -0
- package/docs/errorCodeReference.ts +71 -0
- package/docs/errorCodeScan.ts +551 -0
- package/{frameworkGraph.test.ts → docs/frameworkGraph.test.ts} +1 -1
- package/executors/appExecutor.ts +463 -0
- package/executors/commandExecutionError.ts +53 -0
- package/executors/executor.ts +527 -0
- package/{executors.linkFallback.test.ts → executors/executors.linkFallback.test.ts} +1 -1
- package/{executors.test.ts → executors/executors.test.ts} +106 -18
- package/executors/index.ts +8 -0
- package/executors/libExecutor.ts +23 -0
- package/executors/moduleExecutor.ts +18 -0
- package/executors/pkgExecutor.ts +129 -0
- package/executors/sysExecutor.ts +301 -0
- package/executors/workspaceExecutor.ts +277 -0
- package/frontendBuild/allRoutesBuilder.test.ts +1 -1
- package/frontendBuild/autoImportSync.test.ts +1 -1
- package/frontendBuild/autoImportSync.ts +1 -1
- package/frontendBuild/buildCacheStamp.test.ts +42 -0
- package/frontendBuild/buildCacheStamp.ts +23 -0
- package/frontendBuild/buildRouteClient.test.ts +1 -1
- package/frontendBuild/clientEntriesBundler.test.ts +1 -1
- package/frontendBuild/csrArtifactBuilder.test.ts +1 -1
- package/frontendBuild/csrDevArtifactWriter.ts +1 -1
- package/frontendBuild/cssCandidateCache.test.ts +70 -1
- package/frontendBuild/cssCandidateCache.ts +17 -10
- package/frontendBuild/cssCompiler.test.ts +3 -2
- package/frontendBuild/devGeneratedIndexSync.test.ts +1 -1
- package/frontendBuild/devGeneratedIndexSync.ts +7 -38
- package/frontendBuild/dictionaryAssetBuilder.test.ts +1 -1
- package/frontendBuild/fontOptimizer.test.ts +145 -4
- package/frontendBuild/fontOptimizer.ts +103 -18
- package/frontendBuild/fontPruner.test.ts +1 -1
- package/frontendBuild/frontendBuild.test.ts +3 -3
- package/frontendBuild/hmrWatcher.stop.test.ts +63 -0
- package/frontendBuild/hmrWatcher.test.ts +1 -1
- package/frontendBuild/hmrWatcher.ts +22 -1
- package/frontendBuild/mcpAppViewBuilder.test.ts +1 -1
- package/frontendBuild/mcpAppViewBuilder.ts +1 -1
- package/frontendBuild/nativeCore.test.ts +1 -1
- package/frontendBuild/optionalPeers.test.ts +36 -8
- package/frontendBuild/pagesBundleBuilder.test.ts +2 -3
- package/frontendBuild/pagesBundleBuilder.ts +1 -1
- package/frontendBuild/precompressArtifacts.test.ts +1 -1
- package/frontendBuild/precompressArtifacts.ts +19 -6
- package/frontendBuild/serverGraphFile.ts +1 -1
- package/frontendBuild/sourceMtimeIndex.test.ts +1 -1
- package/frontendBuild/ssrBaseArtifactBuilder.test.ts +30 -1
- package/frontendBuild/ssrBaseArtifactBuilder.ts +40 -12
- package/frontendBuild/ssrDevBundler.test.ts +1 -1
- package/frontendBuild/vendorImportScanner.test.ts +1 -1
- package/frontendBuild/vendorNarrowing.test.ts +1 -1
- package/frontendBuild/watchRootResolver.test.ts +1 -1
- package/{agentAssets.test.ts → guideline/agentAssets.test.ts} +1 -1
- package/{agentAssets.ts → guideline/agentAssets.ts} +2 -2
- package/{agentsIndex.test.ts → guideline/agentsIndex.test.ts} +2 -2
- package/{agentsIndex.ts → guideline/agentsIndex.ts} +13 -10
- package/{conventionSet.test.ts → guideline/conventionSet.test.ts} +7 -4
- package/{conventionSet.ts → guideline/conventionSet.ts} +1 -1
- package/{prompter.ts → guideline/prompter.ts} +2 -3
- package/incrementalBuilder/buildBatch.proc.ts +16 -5
- package/incrementalBuilder/buildBatchProtocol.ts +3 -0
- package/incrementalBuilder/buildBatchRunner.test.ts +122 -2
- package/incrementalBuilder/buildBatchRunner.ts +17 -4
- package/incrementalBuilder/builderBoot.ts +113 -0
- package/incrementalBuilder/builderBuildStatus.ts +23 -0
- package/incrementalBuilder/builderChannel.test.ts +1 -1
- package/incrementalBuilder/builderChannel.ts +19 -2
- package/incrementalBuilder/builderGraphPayloads.ts +3 -3
- package/incrementalBuilder/builderLanes.ts +157 -0
- package/incrementalBuilder/builderWatch.ts +213 -0
- package/incrementalBuilder/csrRegistry.ts +234 -0
- package/incrementalBuilder/incrementalBuilder.host.test.ts +16 -0
- package/incrementalBuilder/incrementalBuilder.host.ts +7 -1
- package/incrementalBuilder/incrementalBuilder.proc.test.ts +142 -7
- package/incrementalBuilder/incrementalBuilder.proc.ts +82 -823
- package/incrementalBuilder/ssrRegistry.ts +282 -0
- package/index.ts +22 -22
- package/integration/devStability.integration.test.ts +62 -56
- package/integration/devStabilityHarness.test.ts +1 -1
- package/lint/__fixtures__/no-import-common-err/bad.tsx +13 -0
- package/lint/__fixtures__/no-import-common-err/good.tsx +12 -0
- package/{biomeBase.test.ts → lint/biomeBase.test.ts} +1 -1
- package/lint/gritRules.test.ts +1 -1
- package/{linter.test.ts → lint/linter.test.ts} +1 -1
- package/lint/no-import-common-err.grit +31 -0
- package/lint/no-init-fetch-in-client.grit +1 -1
- package/mobile/desktopBin.test.ts +1 -1
- package/mobile/desktopRelease.test.ts +1 -1
- package/mobile/desktopServerStage.test.ts +2 -2
- package/mobile/desktopServerStage.ts +1 -1
- package/mobile/nativeApi.test.ts +1 -1
- package/mobile/nativeApp.test.ts +1 -1
- package/mobile/nativeConfig.test.ts +1 -1
- package/mobile/nativePluginFolders.test.ts +1 -1
- package/mobile/nativePublicEnv.test.ts +1 -1
- package/mobile/nativePublicEnv.ts +2 -1
- package/mobile/nativeWebDir.test.ts +1 -1
- package/mobile/serverBundleSecrets.test.ts +1 -1
- package/mobile/tarWriter.test.ts +1 -1
- package/mobile/updatePackFolder.test.ts +1 -1
- package/package.json +173 -9
- package/packageExports.test.ts +20 -2
- package/piDependencyPins.test.ts +1 -1
- package/pipeline/PipelineDefinition.ts +1 -1
- package/platformTest/IdleWatchedProcess.test.ts +1 -1
- package/platformTest/LinuxDockerTarget.ts +1 -1
- package/platformTest/PlatformTestRun.test.ts +1 -1
- package/platformTest/TestSnapshot.test.ts +1 -1
- package/platformTest/WindowsSshTarget.ts +1 -1
- package/preview/previewView.test.ts +23 -1
- package/{abstractDoc.test.ts → quality/abstractDoc.test.ts} +2 -2
- package/{abstractDoc.ts → quality/abstractDoc.ts} +1 -1
- package/quality/bareErrorScanner.ts +126 -0
- package/{maintainabilityBaseline.test.ts → quality/maintainabilityBaseline.test.ts} +73 -0
- package/{maintainabilityBaseline.ts → quality/maintainabilityBaseline.ts} +97 -9
- package/{maintainabilityContract.test.ts → quality/maintainabilityContract.test.ts} +383 -2
- package/{maintainabilityContract.ts → quality/maintainabilityContract.ts} +151 -29
- package/{maintainabilityExceptionScanner.test.ts → quality/maintainabilityExceptionScanner.test.ts} +15 -1
- package/{maintainabilityExceptionScanner.ts → quality/maintainabilityExceptionScanner.ts} +5 -1
- package/{maintainabilityLimits.ts → quality/maintainabilityLimits.ts} +12 -0
- package/{maintainabilityReport.ts → quality/maintainabilityReport.ts} +20 -3
- package/{qualityScanner.test.ts → quality/qualityScanner.test.ts} +41 -1
- package/{qualityScanner.ts → quality/qualityScanner.ts} +25 -91
- package/{storeAccessScanner.ts → quality/storeAccessScanner.ts} +15 -2
- package/quality/workspaceSourceFiles.ts +82 -0
- package/{subspace.test.ts → subspace/subspace.test.ts} +25 -4
- package/{subspace.ts → subspace/subspace.ts} +5 -5
- package/{subspaceClone.ts → subspace/subspaceClone.ts} +8 -8
- package/{subspaceConfig.ts → subspace/subspaceConfig.ts} +5 -1
- package/{testHelpers.ts → test/testHelpers.ts} +37 -1
- package/transforms/barrelAnalyzer.ts +31 -10
- package/transforms/browserDirnamePlugin.test.ts +1 -1
- package/transforms/externalizeFrameworkPlugin.test.ts +1 -1
- package/transforms/mcpAppPageTrimmer.test.ts +1 -1
- package/transforms/pureLazyMarker.test.ts +1 -1
- package/transforms/serverEnvPlugin.test.ts +1 -1
- package/transforms/serverEnvProfile.test.ts +1 -1
- package/transforms/sideEffectImportOrder.test.ts +1 -1
- package/transforms/transforms.test.ts +52 -2
- package/transforms/tsconfigPackageResolver.test.ts +1 -1
- package/{createTunnel.test.ts → tunnel/createTunnel.test.ts} +1 -1
- package/{createTunnel.ts → tunnel/createTunnel.ts} +2 -2
- package/{sshHostKeys.ts → tunnel/sshHostKeys.ts} +2 -2
- package/typecheck/projectTypecheck.test.ts +23 -1
- package/typecheck/projectTypecheck.ts +10 -2
- package/{typeChecker.test.ts → typecheck/typeChecker.test.ts} +1 -1
- package/{typeChecker.ts → typecheck/typeChecker.ts} +5 -4
- package/typecheck/typecheck.proc.ts +6 -2
- package/typecheck/typecheckFailure.ts +1 -1
- package/util/errorReport.ts +66 -0
- package/{fileSys.test.ts → util/fileSys.test.ts} +13 -0
- package/{fileSys.ts → util/fileSys.ts} +2 -2
- package/{jsonFormatter.test.ts → util/jsonFormatter.test.ts} +1 -1
- package/workflow/constantSource.ts +187 -0
- package/workflow/dictionarySource.ts +184 -0
- package/workflow/executor.ts +6 -9
- package/workflow/fieldExpression.ts +153 -0
- package/workflow/fieldLabel.ts +61 -0
- package/workflow/fieldOrder.ts +117 -0
- package/workflow/fieldType.ts +2 -1
- package/workflow/guardCatalog.test.ts +1 -1
- package/workflow/keyRename.ts +1 -1
- package/workflow/moduleIndex.test.ts +2 -2
- package/workflow/moduleIndex.ts +2 -2
- package/workflow/modulePaths.ts +27 -0
- package/workflow/mutationScaffold.ts +7 -15
- package/workflow/mutationSource.ts +2 -1
- package/workflow/plan.ts +2 -1
- package/workflow/primitiveReport.ts +78 -0
- package/workflow/rolloutGate.test.ts +1 -1
- package/workflow/rolloutGate.ts +1 -1
- package/workflow/serviceSource.ts +33 -0
- package/workflow/signalSource.ts +96 -0
- package/workflow/source.ts +50 -1100
- package/workflow/sourceAst.ts +30 -0
- package/workflow/sourceImports.ts +105 -0
- package/workflow/sourceText.ts +13 -0
- package/workflow/templateSource.ts +30 -0
- package/workflow/testSource.ts +31 -0
- package/workflow/types.ts +1 -1
- package/workflow/uiPolicy.ts +1 -1
- package/{appSelectionMemory.ts → workspace/appSelectionMemory.ts} +1 -1
- package/{codegenLock.test.ts → workspace/codegenLock.test.ts} +1 -1
- package/{dependencyScanner.test.ts → workspace/dependencyScanner.test.ts} +1 -1
- package/{dependencyScanner.ts → workspace/dependencyScanner.ts} +2 -2
- package/{envSeed.test.ts → workspace/envSeed.test.ts} +2 -2
- package/{envSeed.ts → workspace/envSeed.ts} +1 -1
- package/{libSource.test.ts → workspace/libSource.test.ts} +2 -2
- package/{libSource.ts → workspace/libSource.ts} +1 -1
- package/{scanInfo.ts → workspace/scanInfo.ts} +21 -10
- package/{slicePlanner.test.ts → workspace/slicePlanner.test.ts} +2 -2
- package/{slicePlanner.ts → workspace/slicePlanner.ts} +1 -1
- package/{workspaceGraph.test.ts → workspace/workspaceGraph.test.ts} +1 -1
- package/{workspaceGraph.ts → workspace/workspaceGraph.ts} +1 -1
- package/{workspaceLayout.test.ts → workspace/workspaceLayout.test.ts} +1 -1
- package/{workspaceLayout.ts → workspace/workspaceLayout.ts} +3 -1
- package/akanContext.ts +0 -1083
- package/executors.ts +0 -1749
- /package/{applicationBuildReporter.test.ts → app/applicationBuildReporter.test.ts} +0 -0
- /package/{akanMcpToolError.ts → context/akanMcpToolError.ts} +0 -0
- /package/{moduleFieldNames.test.ts → context/moduleFieldNames.test.ts} +0 -0
- /package/{moduleFieldNames.ts → context/moduleFieldNames.ts} +0 -0
- /package/{recipeScanner.ts → context/recipeScanner.ts} +0 -0
- /package/{declarationReader.ts → docs/declarationReader.ts} +0 -0
- /package/{frameworkGraph.ts → docs/frameworkGraph.ts} +0 -0
- /package/{biomeBase.ts → lint/biomeBase.ts} +0 -0
- /package/{linter.ts → lint/linter.ts} +0 -0
- /package/{commentDensityScanner.test.ts → quality/commentDensityScanner.test.ts} +0 -0
- /package/{commentDensityScanner.ts → quality/commentDensityScanner.ts} +0 -0
- /package/{componentSizeScanner.test.ts → quality/componentSizeScanner.test.ts} +0 -0
- /package/{componentSizeScanner.ts → quality/componentSizeScanner.ts} +0 -0
- /package/{componentWriteChainScanner.test.ts → quality/componentWriteChainScanner.test.ts} +0 -0
- /package/{componentWriteChainScanner.ts → quality/componentWriteChainScanner.ts} +0 -0
- /package/{deprecatedCommentScanner.test.ts → quality/deprecatedCommentScanner.test.ts} +0 -0
- /package/{deprecatedCommentScanner.ts → quality/deprecatedCommentScanner.ts} +0 -0
- /package/{endpointReach.test.ts → quality/endpointReach.test.ts} +0 -0
- /package/{endpointReach.ts → quality/endpointReach.ts} +0 -0
- /package/{formSetterScanner.test.ts → quality/formSetterScanner.test.ts} +0 -0
- /package/{formSetterScanner.ts → quality/formSetterScanner.ts} +0 -0
- /package/{kindBranchScanner.test.ts → quality/kindBranchScanner.test.ts} +0 -0
- /package/{kindBranchScanner.ts → quality/kindBranchScanner.ts} +0 -0
- /package/{maintainabilityReport.test.ts → quality/maintainabilityReport.test.ts} +0 -0
- /package/{renderMutationScanner.test.ts → quality/renderMutationScanner.test.ts} +0 -0
- /package/{renderMutationScanner.ts → quality/renderMutationScanner.ts} +0 -0
- /package/{serviceLoopCallScanner.test.ts → quality/serviceLoopCallScanner.test.ts} +0 -0
- /package/{serviceLoopCallScanner.ts → quality/serviceLoopCallScanner.ts} +0 -0
- /package/{signalMutationIndex.test.ts → quality/signalMutationIndex.test.ts} +0 -0
- /package/{signalMutationIndex.ts → quality/signalMutationIndex.ts} +0 -0
- /package/{sourceComments.test.ts → quality/sourceComments.test.ts} +0 -0
- /package/{sourceComments.ts → quality/sourceComments.ts} +0 -0
- /package/{ssrScanner.test.ts → quality/ssrScanner.test.ts} +0 -0
- /package/{ssrScanner.ts → quality/ssrScanner.ts} +0 -0
- /package/{storeAccessScanner.test.ts → quality/storeAccessScanner.test.ts} +0 -0
- /package/{storeSource.ts → quality/storeSource.ts} +0 -0
- /package/{storeWriteScanner.test.ts → quality/storeWriteScanner.test.ts} +0 -0
- /package/{storeWriteScanner.ts → quality/storeWriteScanner.ts} +0 -0
- /package/{structureScanner.test.ts → quality/structureScanner.test.ts} +0 -0
- /package/{structureScanner.ts → quality/structureScanner.ts} +0 -0
- /package/{testOnlyExportScanner.test.ts → quality/testOnlyExportScanner.test.ts} +0 -0
- /package/{testOnlyExportScanner.ts → quality/testOnlyExportScanner.ts} +0 -0
- /package/{writePath.test.ts → quality/writePath.test.ts} +0 -0
- /package/{writePath.ts → quality/writePath.ts} +0 -0
- /package/{writePlacementScanner.test.ts → quality/writePlacementScanner.test.ts} +0 -0
- /package/{writePlacementScanner.ts → quality/writePlacementScanner.ts} +0 -0
- /package/{writingActionIndex.test.ts → quality/writingActionIndex.test.ts} +0 -0
- /package/{writingActionIndex.ts → quality/writingActionIndex.ts} +0 -0
- /package/{subspaceReport.ts → subspace/subspaceReport.ts} +0 -0
- /package/{sshTunnel.ts → tunnel/sshTunnel.ts} +0 -0
- /package/{fileEditor.ts → util/fileEditor.ts} +0 -0
- /package/{jsonFormatter.ts → util/jsonFormatter.ts} +0 -0
- /package/{selectModel.ts → util/selectModel.ts} +0 -0
- /package/{semver.test.ts → util/semver.test.ts} +0 -0
- /package/{semver.ts → util/semver.ts} +0 -0
- /package/{shellOnlyEnv.test.ts → util/shellOnlyEnv.test.ts} +0 -0
- /package/{shellOnlyEnv.ts → util/shellOnlyEnv.ts} +0 -0
- /package/{spinner.test.ts → util/spinner.test.ts} +0 -0
- /package/{spinner.ts → util/spinner.ts} +0 -0
- /package/{stripAnsi.ts → util/stripAnsi.ts} +0 -0
- /package/{codegenLock.ts → workspace/codegenLock.ts} +0 -0
- /package/{getRelatedCnsts.ts → workspace/getRelatedCnsts.ts} +0 -0
- /package/{gitRevision.test.ts → workspace/gitRevision.test.ts} +0 -0
- /package/{gitRevision.ts → workspace/gitRevision.ts} +0 -0
- /package/{manifestDependencies.ts → workspace/manifestDependencies.ts} +0 -0
- /package/{packageExportsMap.ts → workspace/packageExportsMap.ts} +0 -0
- /package/{repoIdentity.ts → workspace/repoIdentity.ts} +0 -0
- /package/{types.ts → workspace/types.ts} +0 -0
|
@@ -3,7 +3,7 @@ import { mkdir, symlink } from "node:fs/promises";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import type { BunPlugin } from "bun";
|
|
5
5
|
import { resolveSsrPageEntries } from "../artifact/implicitRootLayout";
|
|
6
|
-
import { tempDirs, writeText as write } from "../testHelpers";
|
|
6
|
+
import { tempDirs, writeText as write } from "../test/testHelpers";
|
|
7
7
|
import { CsrArtifactBuilder } from "./csrArtifactBuilder";
|
|
8
8
|
import { VENDOR_SPECIFIERS } from "./vendorSpecifiers";
|
|
9
9
|
|
|
@@ -69,19 +69,37 @@ const buildCsr = async (indexPage: string) => {
|
|
|
69
69
|
logger: { warn: () => undefined },
|
|
70
70
|
};
|
|
71
71
|
const reached: string[] = [];
|
|
72
|
+
const metafiles: Bun.BuildMetafile[] = [];
|
|
72
73
|
const build = Bun.build;
|
|
73
|
-
const recorded = spyOn(Bun, "build").mockImplementation((config) =>
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
const recorded = spyOn(Bun, "build").mockImplementation(async (config) => {
|
|
75
|
+
const result = await build({
|
|
76
|
+
...config,
|
|
77
|
+
metafile: true,
|
|
78
|
+
plugins: [recordOptionalPeers(reached), ...(config.plugins ?? [])],
|
|
79
|
+
});
|
|
80
|
+
if (result.metafile) metafiles.push(result.metafile);
|
|
81
|
+
return result;
|
|
82
|
+
});
|
|
76
83
|
|
|
77
84
|
try {
|
|
78
85
|
await new CsrArtifactBuilder(app as never, "build").build();
|
|
79
86
|
} finally {
|
|
80
87
|
recorded.mockRestore();
|
|
81
88
|
}
|
|
82
|
-
return { root, reached };
|
|
89
|
+
return { root, reached, metafiles };
|
|
83
90
|
};
|
|
84
91
|
|
|
92
|
+
const mcpAppPage =
|
|
93
|
+
'import { page } from "akanjs/client";\nimport { Link } from "akanjs/ui";\n\nexport default page()\n .app("showHome", "Show the home link.", () => <Link href="/">home</Link>)\n .render(() => null);\n';
|
|
94
|
+
|
|
95
|
+
const bytesFrom = (metafiles: Bun.BuildMetafile[], entry: string, input: string) =>
|
|
96
|
+
metafiles
|
|
97
|
+
.flatMap((metafile) => Object.values(metafile.outputs))
|
|
98
|
+
.filter((output) => output.entryPoint?.endsWith(entry))
|
|
99
|
+
.flatMap((output) => Object.entries(output.inputs))
|
|
100
|
+
.filter(([file]) => file.endsWith(input))
|
|
101
|
+
.reduce((sum, [, { bytesInOutput }]) => sum + bytesInOutput, 0);
|
|
102
|
+
|
|
85
103
|
describe("optional peers of akanjs", () => {
|
|
86
104
|
test("the generated root layout, the _overrides.tsx wrapper and the runtime entries import none", async () => {
|
|
87
105
|
const { appDir, pageKeys } = await writeApp("export default function Page() {\n return null;\n}\n");
|
|
@@ -122,11 +140,21 @@ describe("optional peers of akanjs", () => {
|
|
|
122
140
|
});
|
|
123
141
|
|
|
124
142
|
test("the MCP App view build of a page drawing akanjs/ui components imports none", async () => {
|
|
125
|
-
const { root, reached } = await buildCsr(
|
|
126
|
-
'import { page } from "akanjs/client";\nimport { Link } from "akanjs/ui";\n\nexport default page()\n .app("showHome", "Show the home link.", () => <Link href="/">home</Link>)\n .render(() => null);\n',
|
|
127
|
-
);
|
|
143
|
+
const { root, reached } = await buildCsr(mcpAppPage);
|
|
128
144
|
|
|
129
145
|
expect(await Bun.file(path.join(root, "dist/apps/demo/mcp-apps/showHome.html")).exists()).toBe(true);
|
|
130
146
|
expect(reached).toEqual([]);
|
|
131
147
|
});
|
|
132
148
|
});
|
|
149
|
+
|
|
150
|
+
describe("the CSR shell and the MCP App view", () => {
|
|
151
|
+
test("leave out the route-level boundary class, which only a server render draws, and keep RenderFailure", async () => {
|
|
152
|
+
const { metafiles } = await buildCsr(mcpAppPage);
|
|
153
|
+
|
|
154
|
+
for (const entry of ["generated/csr/index.html", "generated/mcp-apps/showHome.html"]) {
|
|
155
|
+
expect(bytesFrom(metafiles, entry, "webkit/RenderFailure.tsx")).toBeGreaterThan(0);
|
|
156
|
+
//? What stays of the module is its React import binding; the class alone is several hundred bytes.
|
|
157
|
+
expect(bytesFrom(metafiles, entry, "webkit/RouteLevelBoundary.tsx")).toBeLessThan(40);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
});
|
|
@@ -2,11 +2,10 @@ import { describe, expect, test } from "bun:test";
|
|
|
2
2
|
import { PagesBundleBuilder } from "./pagesBundleBuilder";
|
|
3
3
|
|
|
4
4
|
const macroImport = `import { getSerializedSignal } from "./sig" with { type: "macro" };`;
|
|
5
|
-
const macroFetchProto =
|
|
6
|
-
"const fetchProto = FetchClient.build<typeof signal>(cnst, getSerializedSignal(), { Err: pageProto.Err });";
|
|
5
|
+
const macroFetchProto = "const fetchProto = FetchClient.build<typeof signal>(cnst, getSerializedSignal());";
|
|
7
6
|
const serverImport = `import { fetch as serverFetch } from "./sig";`;
|
|
8
7
|
const serverFetchProto =
|
|
9
|
-
"const fetchProto = FetchClient.build<typeof signal>(cnst, serverFetch.serializedSignal, {
|
|
8
|
+
"const fetchProto = FetchClient.build<typeof signal>(cnst, serverFetch.serializedSignal, { base: serverFetch });";
|
|
10
9
|
|
|
11
10
|
const generatedUseClient = (lines: { importLine?: string; fetchProtoLine?: string } = {}) =>
|
|
12
11
|
[
|
|
@@ -196,7 +196,7 @@ export class PagesBundleBuilder {
|
|
|
196
196
|
edits.push({
|
|
197
197
|
start: tokens[fetchProtoAt].start,
|
|
198
198
|
end: fetchProtoEnd.end,
|
|
199
|
-
text: "const fetchProto = FetchClient.build<typeof signal>(cnst, serverFetch.serializedSignal, {
|
|
199
|
+
text: "const fetchProto = FetchClient.build<typeof signal>(cnst, serverFetch.serializedSignal, { base: serverFetch });",
|
|
200
200
|
});
|
|
201
201
|
let transformed = source;
|
|
202
202
|
for (const { start, end, text } of edits.sort((a, b) => b.start - a.start))
|
|
@@ -3,7 +3,7 @@ import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import zlib from "node:zlib";
|
|
5
5
|
import type { App } from "../commandDecorators";
|
|
6
|
-
import { tempDirs } from "../testHelpers";
|
|
6
|
+
import { tempDirs } from "../test/testHelpers";
|
|
7
7
|
import { precompressArtifacts } from "./precompressArtifacts";
|
|
8
8
|
|
|
9
9
|
const tempRoot = tempDirs("akan-devkit-precompress-");
|
|
@@ -12,6 +12,11 @@ const MAX_BROTLI_QUALITY = 11;
|
|
|
12
12
|
const BROTLI_QUALITY_BY_EXT = { ".css": MAX_BROTLI_QUALITY } as const;
|
|
13
13
|
const DEFAULT_BROTLI_QUALITY = 9;
|
|
14
14
|
const GZIP_LEVEL = 9;
|
|
15
|
+
const ROOT_BROTLI_QUALITY: Record<string, number | undefined> = {
|
|
16
|
+
client: undefined,
|
|
17
|
+
styles: undefined,
|
|
18
|
+
dict: MAX_BROTLI_QUALITY,
|
|
19
|
+
};
|
|
15
20
|
const { formatBytes } = FontPruner;
|
|
16
21
|
|
|
17
22
|
export interface PrecompressArtifactsResult {
|
|
@@ -22,13 +27,12 @@ export interface PrecompressArtifactsResult {
|
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
export async function precompressArtifacts(app: App): Promise<PrecompressArtifactsResult> {
|
|
25
|
-
//* WebRouter serves client/, styles/ and dict/ through the same sidecar-aware
|
|
30
|
+
//* WebRouter serves client/, styles/ and dict/ through the same sidecar-aware WebRouteContext.fileResponse.
|
|
26
31
|
const artifactDir = path.join(app.dist.cwdPath, ".akan/artifact");
|
|
27
|
-
const roots = [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
];
|
|
32
|
+
const roots = Object.entries(ROOT_BROTLI_QUALITY).map(([dir, brotliQuality]) => ({
|
|
33
|
+
root: path.join(artifactDir, dir),
|
|
34
|
+
brotliQuality,
|
|
35
|
+
}));
|
|
32
36
|
const result: PrecompressArtifactsResult = { files: 0, inputBytes: 0, outputBytes: 0, brotliBytes: 0 };
|
|
33
37
|
|
|
34
38
|
await Promise.all(roots.map(({ root, brotliQuality }) => precompressRoot(root, result, brotliQuality)));
|
|
@@ -63,6 +67,15 @@ async function precompressRoot(
|
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
|
|
70
|
+
export async function servedBrotliBytesOf(artifactDir: string, filePath: string): Promise<number> {
|
|
71
|
+
const root = path.relative(artifactDir, filePath).split(path.sep)[0] ?? "";
|
|
72
|
+
if (!Object.hasOwn(ROOT_BROTLI_QUALITY, root) || !(await shouldPrecompress(filePath))) return Bun.file(filePath).size;
|
|
73
|
+
const bytes = await Bun.file(filePath).bytes();
|
|
74
|
+
const buffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) as ArrayBuffer;
|
|
75
|
+
const quality = ROOT_BROTLI_QUALITY[root] ?? brotliQualityOf(path.extname(filePath).toLowerCase());
|
|
76
|
+
return brotliCompress(buffer, quality).byteLength;
|
|
77
|
+
}
|
|
78
|
+
|
|
66
79
|
function brotliQualityOf(ext: string): number {
|
|
67
80
|
return BROTLI_QUALITY_BY_EXT[ext as keyof typeof BROTLI_QUALITY_BY_EXT] ?? DEFAULT_BROTLI_QUALITY;
|
|
68
81
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { FileSys } from "../fileSys";
|
|
4
3
|
import { hasUseClientDirective, scanUseClientExports } from "../transforms/rscUseClientTransform";
|
|
4
|
+
import { FileSys } from "../util/fileSys";
|
|
5
5
|
import { CsrDevPaths } from "./csrDevPaths";
|
|
6
6
|
|
|
7
7
|
export interface ServerGraph {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import { chmod, mkdir, readdir, rm, stat, utimes, writeFile } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { tempDirs } from "../testHelpers";
|
|
4
|
+
import { tempDirs } from "../test/testHelpers";
|
|
5
5
|
import { SourceMtimeIndex } from "./sourceMtimeIndex";
|
|
6
6
|
|
|
7
7
|
const seed = async (root: string, rel: string, content = "export const x = 1;\n") => {
|
|
@@ -1,6 +1,35 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
1
|
+
import { describe, expect, spyOn, test } from "bun:test";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { mkdtemp, readdir, rm } from "node:fs/promises";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import type { BaseBuildArtifact } from "akanjs/server";
|
|
2
7
|
import { SsrBaseArtifactBuilder } from "./ssrBaseArtifactBuilder";
|
|
3
8
|
|
|
9
|
+
describe("SsrBaseArtifactBuilder.writeArtifact", () => {
|
|
10
|
+
test("writes beside the final path and renames into it, so a reader never finds a half-written artifact", async () => {
|
|
11
|
+
const dir = await mkdtemp(path.join(os.tmpdir(), "akan-base-artifact-"));
|
|
12
|
+
const finalPath = path.join(dir, "base-artifact.json");
|
|
13
|
+
const artifact = { domains: ["a.example.com"], pagesBundlePath: "/app/pages.js" } as unknown as BaseBuildArtifact;
|
|
14
|
+
const write = Bun.write;
|
|
15
|
+
const seen: { target: string; finalExisted: boolean }[] = [];
|
|
16
|
+
const written = spyOn(Bun, "write").mockImplementation(((target: string, data: string) => {
|
|
17
|
+
seen.push({ target: String(target), finalExisted: existsSync(finalPath) });
|
|
18
|
+
return write(target, data);
|
|
19
|
+
}) as typeof Bun.write);
|
|
20
|
+
try {
|
|
21
|
+
await SsrBaseArtifactBuilder.writeArtifact(dir, artifact);
|
|
22
|
+
} finally {
|
|
23
|
+
written.mockRestore();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
expect(seen).toEqual([{ target: `${finalPath}.tmp`, finalExisted: false }]);
|
|
27
|
+
expect(await Bun.file(finalPath).json()).toEqual(artifact);
|
|
28
|
+
expect(await readdir(dir)).toEqual(["base-artifact.json"]);
|
|
29
|
+
await rm(dir, { recursive: true, force: true });
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
4
33
|
describe("SsrBaseArtifactBuilder.outletModuleMap", () => {
|
|
5
34
|
const outlet = "pkgs/akanjs/server/rscSegmentOutlet.tsx";
|
|
6
35
|
const ssrOutput = "/dist/client-ssr/rscSegmentOutlet.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { rename } from "node:fs/promises";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import { optimize } from "@tailwindcss/node";
|
|
3
4
|
import type { AkanNativeAppId, AkanWebConfig } from "akanjs";
|
|
@@ -16,12 +17,15 @@ import type { RuntimeChunks } from "./routeModulePreloads";
|
|
|
16
17
|
import { VendorNarrowing } from "./vendorNarrowing";
|
|
17
18
|
import type { VendorSpecifier } from "./vendorSpecifiers";
|
|
18
19
|
|
|
20
|
+
export type BaseBuildPhase = "runtime" | "routes" | "styles" | "dictionary" | "pages" | "total";
|
|
21
|
+
|
|
19
22
|
export interface BuildSsrBaseArtifactResult {
|
|
20
23
|
artifact: BaseBuildArtifact;
|
|
21
24
|
seedIndex: RouteSeedIndex;
|
|
22
25
|
cssCompiler: CssCompiler;
|
|
23
26
|
optimizedFonts: Awaited<ReturnType<FontOptimizer["optimize"]>>;
|
|
24
27
|
runtimeChunks: RuntimeChunks;
|
|
28
|
+
phaseMs: Record<BaseBuildPhase, number>;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
export function prepareCssAsset(command: "build" | "start", basePath: string, cssText: string): string {
|
|
@@ -65,15 +69,31 @@ export class SsrBaseArtifactBuilder {
|
|
|
65
69
|
|
|
66
70
|
async build(): Promise<BuildSsrBaseArtifactResult> {
|
|
67
71
|
const akanConfig = await this.#app.getConfig();
|
|
68
|
-
const {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
const phaseMs = { runtime: 0, routes: 0, styles: 0, dictionary: 0, pages: 0, total: 0 };
|
|
73
|
+
const timed = async <T>(phase: BaseBuildPhase, run: () => Promise<T>): Promise<T> => {
|
|
74
|
+
const started = performance.now();
|
|
75
|
+
try {
|
|
76
|
+
return await run();
|
|
77
|
+
} finally {
|
|
78
|
+
phaseMs[phase] = Math.round(performance.now() - started);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const { rscClientUrl, rscRuntimeClientManifest, rscRuntimeSsrManifest, vendorMap, runtimeChunks } = await timed(
|
|
82
|
+
"runtime",
|
|
83
|
+
() => this.#buildRuntimeClientEntries(),
|
|
84
|
+
);
|
|
85
|
+
const pageEntries = await timed("routes", async () => {
|
|
86
|
+
const pageKeys = await this.#app.getPageKeys();
|
|
87
|
+
this.#app.verbose(`[base-artifact] discovered ${pageKeys.length} route files under ${this.#app.cwdPath}/page`);
|
|
88
|
+
return await resolveSsrPageEntriesForApp(this.#app, pageKeys);
|
|
89
|
+
});
|
|
90
|
+
const { cssCompiler, optimizedFonts, cssAssets } = await timed("styles", () => this.#buildStyleAssets());
|
|
91
|
+
const dictAssets = await timed("dictionary", () =>
|
|
92
|
+
new DictionaryAssetBuilder(this.#app, this.#absArtifactDir).build(akanConfig.i18n),
|
|
93
|
+
);
|
|
94
|
+
const pagesBundle = await timed("pages", () =>
|
|
95
|
+
new PagesBundleBuilder(this.#app, this.#command, pageEntries, this.#serverEnv).build(),
|
|
96
|
+
);
|
|
77
97
|
this.#app.verbose(
|
|
78
98
|
`[base-artifact] pages bundle -> ${pagesBundle.bundlePath} (buildId=${pagesBundle.buildId}, splitting=${pagesBundle.splitting}, entry=${pagesBundle.entryBytes} bytes, outputs=${pagesBundle.outputCount}, chunks=${pagesBundle.chunkCount}, total=${pagesBundle.outputBytes} bytes)`,
|
|
79
99
|
);
|
|
@@ -118,10 +138,18 @@ export class SsrBaseArtifactBuilder {
|
|
|
118
138
|
androidSha256CertFingerprints: target.android?.sha256CertFingerprints,
|
|
119
139
|
})),
|
|
120
140
|
};
|
|
121
|
-
await
|
|
122
|
-
|
|
141
|
+
await SsrBaseArtifactBuilder.writeArtifact(this.#absArtifactDir, artifact);
|
|
142
|
+
phaseMs.total = Date.now() - this.#started;
|
|
143
|
+
this.#app.verbose(`[base-artifact] complete in ${phaseMs.total}ms`);
|
|
144
|
+
|
|
145
|
+
return { artifact, seedIndex, cssCompiler, optimizedFonts, runtimeChunks, phaseMs };
|
|
146
|
+
}
|
|
123
147
|
|
|
124
|
-
|
|
148
|
+
//? Renamed into place, last: a dev backend booted beside this build starts on the file the moment it exists.
|
|
149
|
+
static async writeArtifact(absArtifactDir: string, artifact: BaseBuildArtifact): Promise<void> {
|
|
150
|
+
const artifactPath = path.join(absArtifactDir, "base-artifact.json");
|
|
151
|
+
await Bun.write(`${artifactPath}.tmp`, `${JSON.stringify(artifact, null, 2)}\n`);
|
|
152
|
+
await rename(`${artifactPath}.tmp`, artifactPath);
|
|
125
153
|
}
|
|
126
154
|
|
|
127
155
|
async #buildRuntimeClientEntries(): Promise<
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { tempDirs, writeText as write } from "../testHelpers";
|
|
3
|
+
import { tempDirs, writeText as write } from "../test/testHelpers";
|
|
4
4
|
import { SsrDevBundler } from "./ssrDevBundler";
|
|
5
5
|
|
|
6
6
|
const makeTempRoot = tempDirs("akan-ssr-dev-bundler-");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { tempDirs, writeText as write } from "../testHelpers";
|
|
3
|
+
import { tempDirs, writeText as write } from "../test/testHelpers";
|
|
4
4
|
import { VendorImportScanner } from "./vendorImportScanner";
|
|
5
5
|
|
|
6
6
|
const makeTempRoot = tempDirs("akan-vendor-imports-");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { tempDirs, writeText as write } from "../testHelpers";
|
|
4
|
+
import { tempDirs, writeText as write } from "../test/testHelpers";
|
|
5
5
|
import { ClientEntriesBundler } from "./clientEntriesBundler";
|
|
6
6
|
import { VendorNarrowing } from "./vendorNarrowing";
|
|
7
7
|
|
|
@@ -2,7 +2,7 @@ import { describe, expect, test } from "bun:test";
|
|
|
2
2
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import type { App } from "../commandDecorators";
|
|
5
|
-
import { tempDirs } from "../testHelpers";
|
|
5
|
+
import { tempDirs } from "../test/testHelpers";
|
|
6
6
|
import { WatchRootResolver } from "./watchRootResolver";
|
|
7
7
|
|
|
8
8
|
const tempRoot = tempDirs("akan-watch-roots-");
|
|
@@ -49,7 +49,7 @@ describe("AgentAssets", () => {
|
|
|
49
49
|
test("names no rule or skill file that a new workspace's .gitignore would keep out of git", async () => {
|
|
50
50
|
const assets = [...(await AgentAssets.rules()), ...(await AgentAssets.skills())];
|
|
51
51
|
const root = await fsPromise.mkdtemp(path.join(os.tmpdir(), "akan-agent-ignore-"));
|
|
52
|
-
const template = path.join(import.meta.dir, "
|
|
52
|
+
const template = path.join(import.meta.dir, "../../cli/templates/workspaceRoot/.gitignore.template");
|
|
53
53
|
await fsPromise.copyFile(template, path.join(root, ".gitignore"));
|
|
54
54
|
Bun.spawnSync(["git", "init", "-q"], { cwd: root });
|
|
55
55
|
const proc = Bun.spawn(["git", "check-ignore", "--no-index", "--stdin"], {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fsPromise from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { akanCodePaths } from "
|
|
3
|
+
import { akanCodePaths } from "../codeAgent/agent/akanCodePaths";
|
|
4
4
|
import { type ConventionRule, ConventionSet } from "./conventionSet";
|
|
5
5
|
import { Prompter } from "./prompter";
|
|
6
6
|
|
|
@@ -45,7 +45,7 @@ export class AgentAssets {
|
|
|
45
45
|
"modelUtil",
|
|
46
46
|
"framework",
|
|
47
47
|
],
|
|
48
|
-
"akan-err": [],
|
|
48
|
+
"akan-err": ["errorCodes"],
|
|
49
49
|
"akan-deps": [],
|
|
50
50
|
"akan-debug": [],
|
|
51
51
|
"akan-page": ["pageRule", "akanApi"],
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import type { RecipeInfo } from "../context/recipeScanner";
|
|
4
|
+
import { tempDirs, writeText } from "../test/testHelpers";
|
|
3
5
|
import {
|
|
4
6
|
AGENT_BLOCK_END,
|
|
5
7
|
AGENT_BLOCK_START,
|
|
@@ -11,8 +13,6 @@ import {
|
|
|
11
13
|
renderScopeClaudeMd,
|
|
12
14
|
upsertAgentBlock,
|
|
13
15
|
} from "./agentsIndex";
|
|
14
|
-
import type { RecipeInfo } from "./recipeScanner";
|
|
15
|
-
import { tempDirs, writeText } from "./testHelpers";
|
|
16
16
|
|
|
17
17
|
const button: RecipeInfo = {
|
|
18
18
|
name: "buttonRecipe",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { RecipeInfo, RecipeSource } from "
|
|
1
|
+
import type { RecipeInfo, RecipeSource } from "../context/recipeScanner";
|
|
2
2
|
|
|
3
3
|
// Lazy: recipeScanner loads `typescript` (~65MB) and this module sits in the CLI entry graph (entryModuleGraph test).
|
|
4
|
-
let recipeScannerLoad: Promise<typeof import("
|
|
5
|
-
const loadRecipeScanner = () => (recipeScannerLoad ??= import("
|
|
4
|
+
let recipeScannerLoad: Promise<typeof import("../context/recipeScanner")> | null = null;
|
|
5
|
+
const loadRecipeScanner = () => (recipeScannerLoad ??= import("../context/recipeScanner"));
|
|
6
6
|
|
|
7
7
|
//* Split by ownership (root: framework recipes; each app/lib: what it may import), so always-loaded context does not
|
|
8
8
|
//* grow with the app count and no unimportable neighbour recipe is listed.
|
|
@@ -23,13 +23,16 @@ export const extractBlockVersion = (content: string): string | null =>
|
|
|
23
23
|
/** The running `@akanjs/devkit` version; null when its package.json is unreadable, which must not fail a doctor run. */
|
|
24
24
|
export const readDevkitVersion = async (): Promise<string | null> => {
|
|
25
25
|
const { readFile } = await import("node:fs/promises");
|
|
26
|
-
const { getDirname } = await import("
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
const { getDirname } = await import("../util/fileSys");
|
|
27
|
+
const dirname = getDirname(import.meta.url);
|
|
28
|
+
for (const candidate of [`${dirname}/package.json`, `${dirname}/../package.json`]) {
|
|
29
|
+
try {
|
|
30
|
+
return (JSON.parse(await readFile(candidate, "utf-8")) as { version?: string }).version ?? null;
|
|
31
|
+
} catch {
|
|
32
|
+
//? The bundled CLI sits beside its own package.json; devkit's source sits one folder below its own.
|
|
33
|
+
}
|
|
32
34
|
}
|
|
35
|
+
return null;
|
|
33
36
|
};
|
|
34
37
|
|
|
35
38
|
export interface AgentsIndexScope {
|
|
@@ -45,7 +48,7 @@ export const upsertAgentBlock = (existing: string, block: string): string => {
|
|
|
45
48
|
if (startIndex >= 0 && endIndex > startIndex) {
|
|
46
49
|
return `${existing.slice(0, startIndex)}${managed}${existing.slice(endIndex + AGENT_BLOCK_END.length)}`;
|
|
47
50
|
}
|
|
48
|
-
return `${existing.
|
|
51
|
+
return `${existing.trimEnd()}\n\n${managed}\n`;
|
|
49
52
|
};
|
|
50
53
|
|
|
51
54
|
/** The content between the akan:agent markers, or null when the file carries no managed block. */
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import fsPromise from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { MaintainabilityContract } from "../quality/maintainabilityContract";
|
|
5
|
+
import { MaintainabilityLimits } from "../quality/maintainabilityLimits";
|
|
4
6
|
import { ConventionSet } from "./conventionSet";
|
|
5
|
-
import { MaintainabilityContract } from "./maintainabilityContract";
|
|
6
7
|
import { Prompter } from "./prompter";
|
|
7
8
|
|
|
8
9
|
describe("ConventionSet", () => {
|
|
@@ -49,17 +50,19 @@ describe("ConventionSet", () => {
|
|
|
49
50
|
}
|
|
50
51
|
});
|
|
51
52
|
|
|
52
|
-
test("names only checks that exist, and names every lint plugin and maintainability gate
|
|
53
|
+
test("names only checks that exist, and names every lint plugin and maintainability gate a workspace runs", async () => {
|
|
53
54
|
const set = await Prompter.getConventionSet();
|
|
54
55
|
const named = new Set(
|
|
55
56
|
[set.core, ...set.rules.map((rule) => rule.body)].flatMap((text) =>
|
|
56
57
|
[...text.matchAll(/`([^`\s]+)`/g)].map((match) => match[1] ?? ""),
|
|
57
58
|
),
|
|
58
59
|
);
|
|
59
|
-
const plugins = (await fsPromise.readdir(path.join(import.meta.dir, "lint")))
|
|
60
|
+
const plugins = (await fsPromise.readdir(path.join(import.meta.dir, "../lint")))
|
|
60
61
|
.filter((file) => file.endsWith(".grit"))
|
|
61
62
|
.map((file) => file.slice(0, -".grit".length));
|
|
62
|
-
const gates: readonly string[] = MaintainabilityContract.ruleIds
|
|
63
|
+
const gates: readonly string[] = MaintainabilityContract.ruleIds.filter(
|
|
64
|
+
(id) => !MaintainabilityLimits.repoOnlyRules.has(id),
|
|
65
|
+
);
|
|
63
66
|
const gateAreas = new Set(gates.map((id) => id.split(".").slice(0, 2).join(".")));
|
|
64
67
|
const isPluginName = (name: string) => /^non?-[a-z]+(-[a-z]+)+$/.test(name);
|
|
65
68
|
const isGateName = (name: string) =>
|
|
@@ -29,7 +29,7 @@ export class ConventionSet {
|
|
|
29
29
|
const match: RegExpExecArray | null = /^---\n([\s\S]*?)\n---\n/.exec(text);
|
|
30
30
|
if (!match) throw new Error(`Convention rule ${name} has no frontmatter`);
|
|
31
31
|
const front = match[1] ?? "";
|
|
32
|
-
const described: RegExpExecArray | null = /^description
|
|
32
|
+
const described: RegExpExecArray | null = /^description:(.*)$/m.exec(front);
|
|
33
33
|
const description = described?.[1]?.trim() ?? "";
|
|
34
34
|
const paths = [...front.matchAll(/^\s+-\s+"([^"]+)"$/gm)].map((entry) => entry[1] ?? "");
|
|
35
35
|
if (!description || paths.length === 0) throw new Error(`Convention rule ${name} needs a description and paths`);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import fsPromise from "node:fs/promises";
|
|
2
2
|
import { input, select } from "@inquirer/prompts";
|
|
3
|
-
|
|
3
|
+
import { getDirname } from "../util/fileSys";
|
|
4
4
|
import { ConventionSet } from "./conventionSet";
|
|
5
|
-
import { getDirname } from "./fileSys";
|
|
6
5
|
|
|
7
6
|
interface FileUpdateRequestProps {
|
|
8
7
|
context: string;
|
|
@@ -11,7 +10,7 @@ interface FileUpdateRequestProps {
|
|
|
11
10
|
export class Prompter {
|
|
12
11
|
static async #getGuidelineRoot() {
|
|
13
12
|
const dirname = getDirname(import.meta.url);
|
|
14
|
-
const candidates = [`${dirname}/guidelines`, `${dirname}
|
|
13
|
+
const candidates = [`${dirname}/guidelines`, `${dirname}/../../cli/guidelines`];
|
|
15
14
|
for (const candidate of candidates) {
|
|
16
15
|
try {
|
|
17
16
|
await fsPromise.access(candidate);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { ApplicationBuildReporter } from "@akanjs/devkit/applicationBuildReporter";
|
|
2
|
+
import { ApplicationBuildReporter } from "@akanjs/devkit/app/applicationBuildReporter";
|
|
3
3
|
import { resolveSsrPageEntriesForApp } from "@akanjs/devkit/artifact/implicitRootLayout";
|
|
4
4
|
import { computeRouteSeedIndex, saveRouteSeedIndex } from "@akanjs/devkit/artifact/routeSeedIndex";
|
|
5
5
|
import type { App } from "@akanjs/devkit/commandDecorators";
|
|
@@ -47,7 +47,7 @@ class BuildBatch {
|
|
|
47
47
|
return this.#result;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
// A bare `process.send` is safe only because
|
|
50
|
+
// A bare `process.send` is safe only because `main` exits once the runner has read the result sent after it;
|
|
51
51
|
// an explicit `process.exit` after an emit would silently drop payloads (route through BuilderChannel then).
|
|
52
52
|
#emit(message: BuilderMessage): void {
|
|
53
53
|
process.send?.(message);
|
|
@@ -84,9 +84,10 @@ class BuildBatch {
|
|
|
84
84
|
async #buildBase(): Promise<void> {
|
|
85
85
|
const started = Date.now();
|
|
86
86
|
try {
|
|
87
|
-
const { artifact, optimizedFonts } = await new SsrBaseArtifactBuilder(this.#app).build();
|
|
87
|
+
const { artifact, optimizedFonts, phaseMs } = await new SsrBaseArtifactBuilder(this.#app).build();
|
|
88
88
|
this.#result.artifact = artifact;
|
|
89
89
|
this.#result.optimizedFonts = optimizedFonts;
|
|
90
|
+
this.#result.basePhaseMs = phaseMs;
|
|
90
91
|
this.#logger.verbose(`base-artifact ok buildId=${artifact.pagesBundleBuildId} (${Date.now() - started}ms)`);
|
|
91
92
|
} catch (err) {
|
|
92
93
|
this.#fail("base", "base-artifact", err);
|
|
@@ -294,6 +295,16 @@ class BuildBatch {
|
|
|
294
295
|
});
|
|
295
296
|
}
|
|
296
297
|
|
|
298
|
+
// Bounded, so a runner that never releases this process cannot keep the bundler arenas alive.
|
|
299
|
+
static #report(result: BuildBatchResult): Promise<void> {
|
|
300
|
+
if (!process.send) return Promise.resolve();
|
|
301
|
+
return new Promise((resolve) => {
|
|
302
|
+
process.once("disconnect", () => resolve());
|
|
303
|
+
process.send?.({ type: "build-batch-result", data: result });
|
|
304
|
+
setTimeout(() => process.disconnect?.(), 5_000).unref();
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
|
|
297
308
|
static async main(): Promise<void> {
|
|
298
309
|
const raw = process.argv[2];
|
|
299
310
|
if (!raw) throw new Error("[build-batch] missing request argument");
|
|
@@ -312,12 +323,12 @@ class BuildBatch {
|
|
|
312
323
|
// Seeded, not rediscovered: route discovery would be the largest cost of spawning this process.
|
|
313
324
|
if (request.pageKeys) app.setPageKeys(request.pageKeys);
|
|
314
325
|
//? Exits with the builder that spawned it (a kill, a crash, a restart for a metadata save): left running, it would
|
|
315
|
-
//? write a registry its replacement is rebuilding. Removed before
|
|
326
|
+
//? write a registry its replacement is rebuilding. Removed before reporting, as the runner's release is a disconnect.
|
|
316
327
|
const orphaned = () => process.exit(1);
|
|
317
328
|
process.on("disconnect", orphaned);
|
|
318
329
|
const result = await new BuildBatch(request, app).run();
|
|
319
|
-
process.send?.({ type: "build-batch-result", data: result });
|
|
320
330
|
process.off("disconnect", orphaned);
|
|
331
|
+
await BuildBatch.#report(result);
|
|
321
332
|
}
|
|
322
333
|
}
|
|
323
334
|
|
|
@@ -22,6 +22,8 @@ export interface BuildBatchRequest {
|
|
|
22
22
|
trace?: HmrTrace;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
export type BatchWork = Pick<BuildBatchRequest, "generation" | "needs" | "changedFiles" | "trace">;
|
|
26
|
+
|
|
25
27
|
export type PagesBatchCssAssets = CssPayload["cssAssets"];
|
|
26
28
|
|
|
27
29
|
// Browser payloads stream as each need finishes; only state the next batch needs travels back here.
|
|
@@ -30,6 +32,7 @@ export interface BuildBatchResult {
|
|
|
30
32
|
cssAssets?: PagesBatchCssAssets;
|
|
31
33
|
optimizedFonts?: OptimizedFonts;
|
|
32
34
|
artifact?: BaseBuildArtifact; // `base` batches only
|
|
35
|
+
basePhaseMs?: Record<string, number>;
|
|
33
36
|
errors: Partial<Record<BuildBatchNeed, string>>;
|
|
34
37
|
crashed?: boolean; // died before reporting its result
|
|
35
38
|
/** Of a crashed batch, the needs it died before reporting: the others streamed their build-status first. */
|