@akanjs/devkit 3.2.0-rc.9 → 3.2.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 +132 -3
- package/akanApp/akanApp.host.ts +146 -1216
- package/akanApp/akanApp.host.wiring.test.ts +727 -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 +392 -0
- package/akanApp/devBuildStatusBoard.ts +128 -0
- package/akanApp/devBuilder.ts +196 -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/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 +448 -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} +76 -15
- 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/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/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 +1 -1
- 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/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 +14 -4
- package/incrementalBuilder/buildBatchProtocol.ts +2 -0
- package/incrementalBuilder/buildBatchRunner.test.ts +122 -2
- package/incrementalBuilder/buildBatchRunner.ts +17 -4
- package/incrementalBuilder/builderBoot.ts +106 -0
- package/incrementalBuilder/builderBuildStatus.ts +23 -0
- package/incrementalBuilder/builderChannel.test.ts +1 -1
- package/incrementalBuilder/builderChannel.ts +11 -0
- 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.proc.test.ts +101 -7
- package/incrementalBuilder/incrementalBuilder.proc.ts +81 -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/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/{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/{fileSys.test.ts → util/fileSys.test.ts} +0 -0
- /package/{fileSys.ts → util/fileSys.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
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { WorkflowDiagnostic } from "./types";
|
|
2
|
+
|
|
3
|
+
export const normalizeFieldType = (typeName: string) => {
|
|
4
|
+
const normalizedTypes: Record<string, string> = {
|
|
5
|
+
string: "String",
|
|
6
|
+
boolean: "Boolean",
|
|
7
|
+
date: "Date",
|
|
8
|
+
int: "Int",
|
|
9
|
+
integer: "Int",
|
|
10
|
+
float: "Float",
|
|
11
|
+
double: "Float",
|
|
12
|
+
decimal: "Float",
|
|
13
|
+
};
|
|
14
|
+
return normalizedTypes[typeName.toLowerCase()] ?? typeName;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type FieldDefaultValue = string | number | boolean | null;
|
|
18
|
+
|
|
19
|
+
const numericDefault = (typeName: "Int" | "Float", rawDefault: FieldDefaultValue): string | null => {
|
|
20
|
+
if (typeof rawDefault === "number") {
|
|
21
|
+
if (!Number.isFinite(rawDefault)) return null;
|
|
22
|
+
if (typeName === "Int" && !Number.isInteger(rawDefault)) return null;
|
|
23
|
+
return String(rawDefault);
|
|
24
|
+
}
|
|
25
|
+
if (typeof rawDefault !== "string") return null;
|
|
26
|
+
const trimmed = rawDefault.trim();
|
|
27
|
+
if (!trimmed || !Number.isFinite(Number(trimmed))) return null;
|
|
28
|
+
if (typeName === "Int" && !/^-?\d+$/.test(trimmed)) return null;
|
|
29
|
+
return trimmed;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const booleanDefault = (rawDefault: FieldDefaultValue): string | null => {
|
|
33
|
+
if (typeof rawDefault === "boolean") return String(rawDefault);
|
|
34
|
+
if (typeof rawDefault !== "string") return null;
|
|
35
|
+
const lowered = rawDefault.trim().toLowerCase();
|
|
36
|
+
return lowered === "true" || lowered === "false" ? lowered : null;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const dateDefault = (rawDefault: FieldDefaultValue): string | null => {
|
|
40
|
+
if (typeof rawDefault === "number" && Number.isFinite(rawDefault)) return `() => dayjs(${rawDefault})`;
|
|
41
|
+
if (typeof rawDefault !== "string") return null;
|
|
42
|
+
const trimmed = rawDefault.trim();
|
|
43
|
+
if (!trimmed) return null;
|
|
44
|
+
if (trimmed === "now") return "() => dayjs()";
|
|
45
|
+
if (!Number.isNaN(Date.parse(trimmed))) return `() => dayjs(${JSON.stringify(trimmed)})`;
|
|
46
|
+
return null;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const coerceFieldDefault = (
|
|
50
|
+
typeName: string,
|
|
51
|
+
defaultValue?: FieldDefaultValue,
|
|
52
|
+
options: { enumValues?: readonly string[] | null } = {},
|
|
53
|
+
): { expression: string | null; diagnostic?: WorkflowDiagnostic; normalized: boolean; normalizedType: string } => {
|
|
54
|
+
const normalizedType = typeName.toLowerCase() === "enum" ? "enum" : normalizeFieldType(typeName);
|
|
55
|
+
if (defaultValue === undefined || defaultValue === null || defaultValue === "") {
|
|
56
|
+
return { expression: null, normalized: false, normalizedType };
|
|
57
|
+
}
|
|
58
|
+
if (normalizedType === "Int" || normalizedType === "Float") {
|
|
59
|
+
const expression = numericDefault(normalizedType, defaultValue);
|
|
60
|
+
if (expression !== null) return { expression, normalized: typeof defaultValue === "string", normalizedType };
|
|
61
|
+
return {
|
|
62
|
+
expression: null,
|
|
63
|
+
normalized: false,
|
|
64
|
+
normalizedType,
|
|
65
|
+
diagnostic: {
|
|
66
|
+
severity: "error",
|
|
67
|
+
code: "primitive-default-value-invalid",
|
|
68
|
+
input: "default",
|
|
69
|
+
failureScope: "source-change",
|
|
70
|
+
message: `Default value for ${normalizedType} must be a numeric literal. Received: ${JSON.stringify(defaultValue)}.`,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (normalizedType === "Boolean") {
|
|
75
|
+
const expression = booleanDefault(defaultValue);
|
|
76
|
+
if (expression !== null) return { expression, normalized: typeof defaultValue === "string", normalizedType };
|
|
77
|
+
return {
|
|
78
|
+
expression: null,
|
|
79
|
+
normalized: false,
|
|
80
|
+
normalizedType,
|
|
81
|
+
diagnostic: {
|
|
82
|
+
severity: "error",
|
|
83
|
+
code: "primitive-default-value-invalid",
|
|
84
|
+
input: "default",
|
|
85
|
+
failureScope: "source-change",
|
|
86
|
+
message: `Default value for Boolean must be true or false. Received: ${JSON.stringify(defaultValue)}.`,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (normalizedType === "Date") {
|
|
91
|
+
const expression = dateDefault(defaultValue);
|
|
92
|
+
if (expression !== null) return { expression, normalized: true, normalizedType };
|
|
93
|
+
return {
|
|
94
|
+
expression: null,
|
|
95
|
+
normalized: false,
|
|
96
|
+
normalizedType,
|
|
97
|
+
diagnostic: {
|
|
98
|
+
severity: "error",
|
|
99
|
+
code: "primitive-default-value-invalid",
|
|
100
|
+
input: "default",
|
|
101
|
+
failureScope: "source-change",
|
|
102
|
+
message: `Default value for Date must be "now", a timestamp, or a parseable date string. Received: ${JSON.stringify(
|
|
103
|
+
defaultValue,
|
|
104
|
+
)}.`,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
if (normalizedType === "enum") {
|
|
109
|
+
if (typeof defaultValue === "string" && options.enumValues?.includes(defaultValue)) {
|
|
110
|
+
return { expression: JSON.stringify(defaultValue), normalized: false, normalizedType };
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
expression: null,
|
|
114
|
+
normalized: false,
|
|
115
|
+
normalizedType,
|
|
116
|
+
diagnostic: {
|
|
117
|
+
severity: "error",
|
|
118
|
+
code: "primitive-default-value-invalid",
|
|
119
|
+
input: "default",
|
|
120
|
+
failureScope: "source-change",
|
|
121
|
+
message: `Default value for enum must be one of: ${(options.enumValues ?? []).join(", ")}. Received: ${JSON.stringify(
|
|
122
|
+
defaultValue,
|
|
123
|
+
)}.`,
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
expression: JSON.stringify(String(defaultValue)),
|
|
129
|
+
normalized: typeof defaultValue !== "string",
|
|
130
|
+
normalizedType,
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export const fieldExpression = (
|
|
135
|
+
typeName: string,
|
|
136
|
+
defaultValue?: FieldDefaultValue,
|
|
137
|
+
options: { enumValues?: readonly string[] | null; builderName?: string } = {},
|
|
138
|
+
) => {
|
|
139
|
+
const typeExpression = normalizeFieldType(typeName);
|
|
140
|
+
const defaultExpression = coerceFieldDefault(
|
|
141
|
+
options.enumValues ? "enum" : typeExpression,
|
|
142
|
+
defaultValue,
|
|
143
|
+
options,
|
|
144
|
+
).expression;
|
|
145
|
+
const defaultOption = defaultExpression ? `, { default: ${defaultExpression} }` : "";
|
|
146
|
+
return `${options.builderName ?? "field"}(${typeExpression}${defaultOption})`;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const parseValues = (value: string | null) =>
|
|
150
|
+
value
|
|
151
|
+
?.split(",")
|
|
152
|
+
.map((item) => item.trim())
|
|
153
|
+
.filter(Boolean) ?? [];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { lowerlize } from "akanjs/common";
|
|
2
|
+
|
|
3
|
+
export const titleize = (value: string) =>
|
|
4
|
+
value
|
|
5
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1 $2")
|
|
6
|
+
.replace(/[-_]+/g, " ")
|
|
7
|
+
.replace(/\b\w/g, (char) => char.toUpperCase());
|
|
8
|
+
|
|
9
|
+
const koLabels: Record<string, string> = {
|
|
10
|
+
amount: "금액",
|
|
11
|
+
budget: "예산",
|
|
12
|
+
category: "카테고리",
|
|
13
|
+
content: "내용",
|
|
14
|
+
count: "개수",
|
|
15
|
+
createdAt: "생성일",
|
|
16
|
+
date: "날짜",
|
|
17
|
+
description: "설명",
|
|
18
|
+
due: "마감일",
|
|
19
|
+
dueAt: "마감일",
|
|
20
|
+
email: "이메일",
|
|
21
|
+
enabled: "활성화",
|
|
22
|
+
endAt: "종료일",
|
|
23
|
+
id: "ID",
|
|
24
|
+
name: "이름",
|
|
25
|
+
owner: "담당자",
|
|
26
|
+
priority: "우선순위",
|
|
27
|
+
project: "프로젝트",
|
|
28
|
+
rating: "평점",
|
|
29
|
+
startAt: "시작일",
|
|
30
|
+
status: "상태",
|
|
31
|
+
title: "제목",
|
|
32
|
+
updatedAt: "수정일",
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const splitFieldWords = (fieldName: string) =>
|
|
36
|
+
fieldName
|
|
37
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1 $2")
|
|
38
|
+
.replace(/[-_]+/g, " ")
|
|
39
|
+
.split(/\s+/)
|
|
40
|
+
.map((word) => word.trim())
|
|
41
|
+
.filter(Boolean);
|
|
42
|
+
|
|
43
|
+
const koLabelForField = (fieldName: string) => {
|
|
44
|
+
if (koLabels[fieldName]) return koLabels[fieldName];
|
|
45
|
+
const words = splitFieldWords(fieldName);
|
|
46
|
+
const translated = words.map((word) => koLabels[word] ?? koLabels[lowerlize(word)] ?? null);
|
|
47
|
+
return translated.every(Boolean) ? translated.join(" ") : null;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const bilingualLabelForField = (fieldName: string) => {
|
|
51
|
+
const en = titleize(fieldName);
|
|
52
|
+
return { en, ko: koLabelForField(fieldName) ?? en };
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const bilingualDescriptionForField = (fieldName: string) => {
|
|
56
|
+
const label = bilingualLabelForField(fieldName);
|
|
57
|
+
return {
|
|
58
|
+
en: `Enter ${label.en.toLowerCase()}.`,
|
|
59
|
+
ko: `${label.ko} 값을 입력합니다.`,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { propertyName } from "./sourceAst";
|
|
3
|
+
import { lineEndAt, lineIndentAt, lineStartAt, spliceText } from "./sourceText";
|
|
4
|
+
|
|
5
|
+
export const fieldOrderingPriority = [
|
|
6
|
+
"id",
|
|
7
|
+
"name",
|
|
8
|
+
"title",
|
|
9
|
+
"status",
|
|
10
|
+
"category",
|
|
11
|
+
"description",
|
|
12
|
+
"content",
|
|
13
|
+
"startAt",
|
|
14
|
+
"dueAt",
|
|
15
|
+
"endAt",
|
|
16
|
+
"createdAt",
|
|
17
|
+
"updatedAt",
|
|
18
|
+
] as const;
|
|
19
|
+
|
|
20
|
+
type FieldOrderingName = string;
|
|
21
|
+
|
|
22
|
+
interface LocatedField {
|
|
23
|
+
name: FieldOrderingName;
|
|
24
|
+
start: number;
|
|
25
|
+
fullStart: number;
|
|
26
|
+
end: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ObjectInsertionLocator {
|
|
30
|
+
objectStart: number;
|
|
31
|
+
objectEnd: number;
|
|
32
|
+
fields: LocatedField[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const locatedObject = (
|
|
36
|
+
source: ts.SourceFile,
|
|
37
|
+
objectLiteral: ts.ObjectLiteralExpression,
|
|
38
|
+
): ObjectInsertionLocator => ({
|
|
39
|
+
objectStart: objectLiteral.getStart(source),
|
|
40
|
+
objectEnd: objectLiteral.getEnd(),
|
|
41
|
+
fields: objectLiteral.properties
|
|
42
|
+
.map((property): LocatedField | null => {
|
|
43
|
+
const name = propertyName(property);
|
|
44
|
+
if (!name) return null;
|
|
45
|
+
return {
|
|
46
|
+
name,
|
|
47
|
+
start: property.getStart(source),
|
|
48
|
+
fullStart: property.getFullStart(),
|
|
49
|
+
end: property.getEnd(),
|
|
50
|
+
};
|
|
51
|
+
})
|
|
52
|
+
.filter((field): field is LocatedField => field !== null),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const priorityOf = (fieldName: string) => {
|
|
56
|
+
const priority = (fieldOrderingPriority as readonly string[]).indexOf(fieldName);
|
|
57
|
+
return priority < 0 ? null : priority;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const insertionIndexForFieldOrder = (fieldNames: readonly string[], newFieldName: string) => {
|
|
61
|
+
const newPriority = priorityOf(newFieldName);
|
|
62
|
+
if (newPriority !== null) {
|
|
63
|
+
const greaterPriorityIndex = fieldNames.findIndex((name) => {
|
|
64
|
+
const existingPriority = priorityOf(name);
|
|
65
|
+
return existingPriority !== null && existingPriority > newPriority;
|
|
66
|
+
});
|
|
67
|
+
if (greaterPriorityIndex >= 0) return greaterPriorityIndex;
|
|
68
|
+
|
|
69
|
+
const lastPriorityIndex = fieldNames.reduce((lastIndex, name, index) => {
|
|
70
|
+
const existingPriority = priorityOf(name);
|
|
71
|
+
return existingPriority !== null ? index : lastIndex;
|
|
72
|
+
}, -1);
|
|
73
|
+
return lastPriorityIndex + 1;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const lastNonPriorityIndex = fieldNames.reduce(
|
|
77
|
+
(lastIndex, name, index) => (priorityOf(name) === null ? index : lastIndex),
|
|
78
|
+
-1,
|
|
79
|
+
);
|
|
80
|
+
return lastNonPriorityIndex >= 0 ? lastNonPriorityIndex + 1 : fieldNames.length;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const insertOrderedFieldLine = (
|
|
84
|
+
content: string,
|
|
85
|
+
locator: ObjectInsertionLocator,
|
|
86
|
+
fieldName: string,
|
|
87
|
+
line: string,
|
|
88
|
+
options: { fieldIndent: string; closingIndent: string },
|
|
89
|
+
) => {
|
|
90
|
+
if (locator.fields.some((field) => field.name === fieldName)) return content;
|
|
91
|
+
const insertIndex = insertionIndexForFieldOrder(
|
|
92
|
+
locator.fields.map((field) => field.name),
|
|
93
|
+
fieldName,
|
|
94
|
+
);
|
|
95
|
+
const formattedLine = line.trim();
|
|
96
|
+
if (locator.fields.length === 0) {
|
|
97
|
+
return spliceText(
|
|
98
|
+
content,
|
|
99
|
+
locator.objectStart,
|
|
100
|
+
locator.objectEnd,
|
|
101
|
+
`{\n${options.fieldIndent}${formattedLine}\n${options.closingIndent}}`,
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const beforeField = locator.fields[insertIndex];
|
|
106
|
+
if (beforeField) {
|
|
107
|
+
const leadingComments = ts.getLeadingCommentRanges(content, beforeField.fullStart) ?? [];
|
|
108
|
+
const insertAt = lineStartAt(content, leadingComments[0]?.pos ?? beforeField.start);
|
|
109
|
+
const indent = lineIndentAt(content, beforeField.start) || options.fieldIndent;
|
|
110
|
+
return spliceText(content, insertAt, insertAt, `${indent}${formattedLine}\n`);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const afterField = locator.fields[locator.fields.length - 1];
|
|
114
|
+
const insertAt = lineEndAt(content, afterField.end);
|
|
115
|
+
const indent = lineIndentAt(content, afterField.start) || options.fieldIndent;
|
|
116
|
+
return spliceText(content, insertAt, insertAt, `${indent}${formattedLine}\n`);
|
|
117
|
+
};
|
package/workflow/fieldType.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
import type { Sys } from "../commandDecorators";
|
|
3
|
-
import {
|
|
3
|
+
import { getSysRoot, moduleComponentName, moduleSourcePaths } from "./modulePaths";
|
|
4
4
|
import { sourceFileFor } from "./sourceAst";
|
|
5
|
+
import { ensureBaseImport, ensureNamedImport } from "./sourceImports";
|
|
5
6
|
import type { WorkflowDiagnostic } from "./types";
|
|
6
7
|
|
|
7
8
|
const builtInFieldTypes = new Set(["String", "Boolean", "Date", "Map"]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { createTempApp, tempRoots, writeJson, writeText } from "../testHelpers";
|
|
3
|
+
import { createTempApp, tempRoots, writeJson, writeText } from "../test/testHelpers";
|
|
4
4
|
import { GuardCatalog } from "./guardCatalog";
|
|
5
5
|
|
|
6
6
|
const track = tempRoots();
|
package/workflow/keyRename.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { AkanIndex, type AkanRenameEdit } from "@akanjs/language";
|
|
|
4
4
|
import ts from "typescript";
|
|
5
5
|
import type { Workspace } from "../commandDecorators";
|
|
6
6
|
import { resolveWorkflowSys } from "./executor";
|
|
7
|
-
import { getSysRoot, moduleSourcePaths } from "./
|
|
7
|
+
import { getSysRoot, moduleSourcePaths } from "./modulePaths";
|
|
8
8
|
import type { RenameKeyInput, ScaffoldFile, WorkflowDiagnostic } from "./types";
|
|
9
9
|
|
|
10
10
|
const indexedPath = /^(apps|libs)\/(?!(?:.*\/)?(?:node_modules|dist|\.akan)\/).*\.tsx?$/;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import type { AkanModuleContext } from "../akanContext";
|
|
4
3
|
import type { Workspace } from "../commandDecorators";
|
|
5
|
-
import {
|
|
4
|
+
import type { AkanModuleContext } from "../context/akanContext";
|
|
5
|
+
import { tempDirs, writeText } from "../test/testHelpers";
|
|
6
6
|
import { buildAkanModuleContextIndex } from "./moduleIndex";
|
|
7
7
|
|
|
8
8
|
const tempRoot = tempDirs("akan-module-index-");
|
package/workflow/moduleIndex.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { access } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import ts from "typescript";
|
|
4
|
-
import type { AkanModuleContext } from "../akanContext";
|
|
5
4
|
import type { Workspace } from "../commandDecorators";
|
|
6
|
-
import {
|
|
5
|
+
import type { AkanModuleContext } from "../context/akanContext";
|
|
6
|
+
import { moduleComponentName, moduleSourcePaths } from "./modulePaths";
|
|
7
7
|
import {
|
|
8
8
|
callExpressionName,
|
|
9
9
|
expressionName,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Sys } from "../commandDecorators";
|
|
2
|
+
|
|
3
|
+
export const getSysRoot = (sys: Sys) => `${sys.type}s/${sys.name}`;
|
|
4
|
+
|
|
5
|
+
export const moduleComponentName = (moduleName: string) =>
|
|
6
|
+
moduleName
|
|
7
|
+
.replace(/[-_]+/g, " ")
|
|
8
|
+
.replace(/(?<=^|\s)[a-zA-Z0-9]/g, (char) => char.toUpperCase())
|
|
9
|
+
.replace(/\s+/g, "");
|
|
10
|
+
|
|
11
|
+
export const moduleSourcePaths = (moduleName: string) => {
|
|
12
|
+
const componentName = moduleComponentName(moduleName);
|
|
13
|
+
return {
|
|
14
|
+
abstract: `lib/${moduleName}/${moduleName}.abstract.md`,
|
|
15
|
+
constant: `lib/${moduleName}/${moduleName}.constant.ts`,
|
|
16
|
+
dictionary: `lib/${moduleName}/${moduleName}.dictionary.ts`,
|
|
17
|
+
document: `lib/${moduleName}/${moduleName}.document.ts`,
|
|
18
|
+
service: `lib/${moduleName}/${moduleName}.service.ts`,
|
|
19
|
+
signal: `lib/${moduleName}/${moduleName}.signal.ts`,
|
|
20
|
+
store: `lib/${moduleName}/${moduleName}.store.ts`,
|
|
21
|
+
template: `lib/${moduleName}/${componentName}.Template.tsx`,
|
|
22
|
+
unit: `lib/${moduleName}/${componentName}.Unit.tsx`,
|
|
23
|
+
util: `lib/${moduleName}/${componentName}.Util.tsx`,
|
|
24
|
+
view: `lib/${moduleName}/${componentName}.View.tsx`,
|
|
25
|
+
zone: `lib/${moduleName}/${componentName}.Zone.tsx`,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
import { lowerlize, modelNames } from "akanjs/common";
|
|
2
2
|
import type { Sys } from "../commandDecorators";
|
|
3
|
+
import { hasDictionaryEndpointEntry, insertDictionaryEndpointEntry } from "./dictionarySource";
|
|
3
4
|
import { GuardCatalog } from "./guardCatalog";
|
|
5
|
+
import { moduleComponentName, moduleSourcePaths } from "./modulePaths";
|
|
4
6
|
import { type MutationActingUser, type MutationCall, MutationSource } from "./mutationSource";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
hasClassMethod,
|
|
11
|
-
hasDictionaryEndpointEntry,
|
|
12
|
-
hasSignalFactoryEntry,
|
|
13
|
-
hasSourceParseErrors,
|
|
14
|
-
insertClassMethod,
|
|
15
|
-
insertDictionaryEndpointEntry,
|
|
16
|
-
insertSignalFactoryEntry,
|
|
17
|
-
moduleComponentName,
|
|
18
|
-
moduleSourcePaths,
|
|
19
|
-
} from "./source";
|
|
7
|
+
import { classMethodParameters, hasClassMethod, insertClassMethod } from "./serviceSource";
|
|
8
|
+
import { hasSignalFactoryEntry, insertSignalFactoryEntry } from "./signalSource";
|
|
9
|
+
import { hasSourceParseErrors } from "./sourceAst";
|
|
10
|
+
import { ensureImportDeclaration, ensureNamedImport } from "./sourceImports";
|
|
11
|
+
import { appendTopLevelTestCases } from "./testSource";
|
|
20
12
|
import type { ScaffoldFile, WorkflowDiagnostic, WorkflowRecommendation } from "./types";
|
|
21
13
|
|
|
22
14
|
export interface MutationScaffoldInput {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { lowerlize } from "akanjs/common";
|
|
2
|
-
import { bilingualLabelForField,
|
|
2
|
+
import { bilingualLabelForField, titleize } from "./fieldLabel";
|
|
3
|
+
import { moduleComponentName } from "./modulePaths";
|
|
3
4
|
|
|
4
5
|
export interface MutationCall {
|
|
5
6
|
ref: string;
|
package/workflow/plan.ts
CHANGED
|
@@ -2,12 +2,13 @@ import { capitalize } from "akanjs/common";
|
|
|
2
2
|
import type { Sys, Workspace } from "../commandDecorators";
|
|
3
3
|
import { withoutApplyHints, workflowPlanApproval } from "./artifacts";
|
|
4
4
|
import { resolveWorkflowSys } from "./executor";
|
|
5
|
+
import { coerceFieldDefault, normalizeFieldType } from "./fieldExpression";
|
|
5
6
|
import { fieldTypeSource } from "./fieldType";
|
|
6
7
|
import { InteractionScaffold } from "./interactionScaffold";
|
|
7
8
|
import { KeyRename } from "./keyRename";
|
|
9
|
+
import { getSysRoot, moduleSourcePaths } from "./modulePaths";
|
|
8
10
|
import { MutationScaffold } from "./mutationScaffold";
|
|
9
11
|
import { identifierPattern, sysNamePattern } from "./plainName";
|
|
10
|
-
import { coerceFieldDefault, getSysRoot, moduleSourcePaths, normalizeFieldType } from "./source";
|
|
11
12
|
import type {
|
|
12
13
|
WorkflowDiagnostic,
|
|
13
14
|
WorkflowInputSpec,
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Sys } from "../commandDecorators";
|
|
2
|
+
import { generatedFilePathsForTarget } from "./artifacts";
|
|
3
|
+
import { getSysRoot } from "./modulePaths";
|
|
4
|
+
import type {
|
|
5
|
+
PrimitiveChangedFile,
|
|
6
|
+
PrimitiveFileMap,
|
|
7
|
+
PrimitiveGeneratedFile,
|
|
8
|
+
PrimitiveNextAction,
|
|
9
|
+
PrimitiveValidationCommand,
|
|
10
|
+
PrimitiveWriteReport,
|
|
11
|
+
} from "./types";
|
|
12
|
+
|
|
13
|
+
export const sourceFile = (sys: Sys, path: string, action: PrimitiveChangedFile["action"], reason: string) => ({
|
|
14
|
+
path: `${getSysRoot(sys)}/${path}`,
|
|
15
|
+
action,
|
|
16
|
+
reason,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const generatedFilesForSync = (sys: Sys, reason = "Generated files may change after sync.") =>
|
|
20
|
+
generatedFilePathsForTarget(getSysRoot(sys), reason);
|
|
21
|
+
|
|
22
|
+
export const validationCommandsForTarget = (target: string) =>
|
|
23
|
+
[
|
|
24
|
+
{ command: `akan verify ${target}`, reason: "Sync, lint, typecheck and build the target in one run." },
|
|
25
|
+
] satisfies PrimitiveValidationCommand[];
|
|
26
|
+
|
|
27
|
+
export const nextActionsForTarget = (target: string) =>
|
|
28
|
+
[
|
|
29
|
+
{ command: `akan verify ${target}`, reason: "Refresh generated files and validate the target in one run." },
|
|
30
|
+
] satisfies PrimitiveNextAction[];
|
|
31
|
+
|
|
32
|
+
export const createPrimitiveWriteReport = ({
|
|
33
|
+
command,
|
|
34
|
+
status,
|
|
35
|
+
changedFiles = [],
|
|
36
|
+
generatedFiles = [],
|
|
37
|
+
validationCommands = [],
|
|
38
|
+
diagnostics = [],
|
|
39
|
+
nextActions = [],
|
|
40
|
+
}: Omit<PrimitiveWriteReport, "schemaVersion" | "status"> & {
|
|
41
|
+
status?: PrimitiveWriteReport["status"];
|
|
42
|
+
}): PrimitiveWriteReport => ({
|
|
43
|
+
schemaVersion: 1,
|
|
44
|
+
command,
|
|
45
|
+
status: status ?? (diagnostics.some((diagnostic) => diagnostic.severity === "error") ? "failed" : "passed"),
|
|
46
|
+
changedFiles,
|
|
47
|
+
generatedFiles,
|
|
48
|
+
validationCommands,
|
|
49
|
+
diagnostics,
|
|
50
|
+
nextActions,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const createPassedPrimitiveReport = ({
|
|
54
|
+
command,
|
|
55
|
+
changedFiles,
|
|
56
|
+
generatedFiles,
|
|
57
|
+
target,
|
|
58
|
+
nextActions,
|
|
59
|
+
}: {
|
|
60
|
+
command: string;
|
|
61
|
+
changedFiles: PrimitiveChangedFile[];
|
|
62
|
+
generatedFiles?: PrimitiveGeneratedFile[];
|
|
63
|
+
target: string;
|
|
64
|
+
nextActions?: PrimitiveNextAction[];
|
|
65
|
+
}) =>
|
|
66
|
+
createPrimitiveWriteReport({
|
|
67
|
+
command,
|
|
68
|
+
changedFiles,
|
|
69
|
+
generatedFiles: generatedFiles ?? [],
|
|
70
|
+
validationCommands: validationCommandsForTarget(target),
|
|
71
|
+
diagnostics: [],
|
|
72
|
+
nextActions: nextActions ?? nextActionsForTarget(target),
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export const scalarChangedFiles = (sys: Sys, scalarName: string, files: PrimitiveFileMap) =>
|
|
76
|
+
Object.values(files).map((file) =>
|
|
77
|
+
sourceFile(sys, `lib/__scalar/${scalarName}/${file.filename}`, "create", "Scalar source file was created."),
|
|
78
|
+
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import type { PackageJson } from "../types";
|
|
3
|
+
import type { PackageJson } from "../workspace/types";
|
|
4
4
|
import { findToolingRolloutViolations } from "./rolloutGate";
|
|
5
5
|
|
|
6
6
|
const manifest = (overrides: Partial<PackageJson>): PackageJson => ({
|
package/workflow/rolloutGate.ts
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { findClassDeclaration, nodeName, sourceFileFor } from "./sourceAst";
|
|
3
|
+
import { spliceText } from "./sourceText";
|
|
4
|
+
|
|
5
|
+
export const hasClassMethod = (content: string, className: string, methodName: string) => {
|
|
6
|
+
const node = findClassDeclaration(sourceFileFor("service.ts", content), className);
|
|
7
|
+
return Boolean(
|
|
8
|
+
node?.members.some((member) => ts.isMethodDeclaration(member) && nodeName(member.name) === methodName),
|
|
9
|
+
);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const classMethodParameters = (content: string, className: string, methodName: string) => {
|
|
13
|
+
const source = sourceFileFor("service.ts", content);
|
|
14
|
+
const method = findClassDeclaration(source, className)?.members.find(
|
|
15
|
+
(member): member is ts.MethodDeclaration => ts.isMethodDeclaration(member) && nodeName(member.name) === methodName,
|
|
16
|
+
);
|
|
17
|
+
return (
|
|
18
|
+
method?.parameters.map((parameter) => ({
|
|
19
|
+
name: nodeName(parameter.name),
|
|
20
|
+
optional: !!parameter.questionToken || !!parameter.initializer || !!parameter.dotDotDotToken,
|
|
21
|
+
})) ?? null
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const insertClassMethod = (content: string, className: string, methodBlock: string): string | null => {
|
|
26
|
+
const source = sourceFileFor("service.ts", content);
|
|
27
|
+
const node = findClassDeclaration(source, className);
|
|
28
|
+
if (!node) return null;
|
|
29
|
+
const closeBrace = node.getEnd() - 1;
|
|
30
|
+
if (content[closeBrace] !== "}") return null;
|
|
31
|
+
const lead = content.slice(0, closeBrace).endsWith("\n") ? "" : "\n";
|
|
32
|
+
return spliceText(content, closeBrace, closeBrace, `${lead}${methodBlock}\n`);
|
|
33
|
+
};
|