@akanjs/devkit 3.2.0-rc.9 → 3.3.0-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.
Files changed (341) hide show
  1. package/CHANGELOG.md +57 -516
  2. package/DEV_RUNTIME_KNOBS.md +4 -3
  3. package/README.ko.md +3 -2
  4. package/README.md +4 -2
  5. package/akanApp/BackendImportGraph.test.ts +1 -1
  6. package/akanApp/akanApp.host.test.ts +132 -3
  7. package/akanApp/akanApp.host.ts +146 -1216
  8. package/akanApp/akanApp.host.wiring.test.ts +727 -0
  9. package/akanApp/builderGap.ts +68 -0
  10. package/akanApp/builderRequestRelay.test.ts +93 -0
  11. package/akanApp/builderRequestRelay.ts +100 -0
  12. package/akanApp/builderRssRecycler.ts +182 -0
  13. package/akanApp/devBackend.ts +392 -0
  14. package/akanApp/devBuildStatusBoard.ts +128 -0
  15. package/akanApp/devBuilder.ts +196 -0
  16. package/akanApp/devIdleSuspend.test.ts +221 -0
  17. package/akanApp/devIdleSuspend.ts +192 -0
  18. package/akanApp/devIdleSuspend.watcher.test.ts +120 -0
  19. package/akanApp/devRecycler.test.ts +66 -0
  20. package/akanApp/devRecycler.ts +305 -0
  21. package/akanApp/processRss.ts +61 -0
  22. package/akanConfig/akanConfig.test.ts +45 -17
  23. package/akanConfig/akanConfig.ts +10 -10
  24. package/akanConfig/akanWorkspaceConfig.ts +1 -1
  25. package/akanConfig/productionLockfile.ts +1 -1
  26. package/apiReport/apiReport.test.ts +34 -3
  27. package/apiReport/apiReportDiff.ts +35 -1
  28. package/apiReport/apiReportPolicy.ts +3 -2
  29. package/{applicationBuildReporter.ts → app/applicationBuildReporter.ts} +2 -49
  30. package/{applicationBuildRunner.test.ts → app/applicationBuildRunner.test.ts} +71 -8
  31. package/{applicationBuildRunner.ts → app/applicationBuildRunner.ts} +60 -21
  32. package/{applicationTestPreload.ts → app/applicationTestPreload.ts} +1 -1
  33. package/{routeJsBudget.test.ts → app/routeJsBudget.test.ts} +17 -1
  34. package/{routeJsBudget.ts → app/routeJsBudget.ts} +9 -3
  35. package/{routeSourceValidator.test.ts → app/routeSourceValidator.test.ts} +17 -0
  36. package/{routeSourceValidator.ts → app/routeSourceValidator.ts} +5 -1
  37. package/artifact/implicitRootLayout.test.ts +71 -3
  38. package/artifact/implicitRootLayout.ts +9 -3
  39. package/artifact/implicitRootLayoutRender.test.tsx +297 -0
  40. package/biome.base.json +2 -1
  41. package/cloud/cloudApi.test.ts +1 -1
  42. package/cloud/configLock.test.ts +1 -1
  43. package/cloud/globalConfig.test.ts +1 -1
  44. package/cloud/globalConfig.ts +1 -1
  45. package/cloud/updatePackUpload.test.ts +1 -1
  46. package/codeAgent/agent/AkanCodeEnv.ts +1 -1
  47. package/codeAgent/agent/AkanCodeServices.ts +23 -0
  48. package/codeAgent/agent/akanCodePaths.ts +1 -1
  49. package/codeAgent/agent/akanCodeServices.test.ts +54 -0
  50. package/codeAgent/agent/akanSystemPrompt.ts +1 -1
  51. package/codeAgent/agent/codeAgent.test.ts +1 -1
  52. package/codeAgent/skills/akan-debug/SKILL.md +8 -5
  53. package/codeAgent/skills/akan-err/SKILL.md +7 -0
  54. package/codeAgent/skills/akan-mcp/SKILL.md +19 -1
  55. package/codeAgent/skills/akan-scaffold/SKILL.md +1 -1
  56. package/codeAgent/skills/akan-validate/SKILL.md +3 -3
  57. package/codeAgent/tools/AkanCli.ts +1 -1
  58. package/codeAgent/tools/AkanToolPack.ts +2 -2
  59. package/codeAgent/tools/akanCodePlugins.test.ts +1 -1
  60. package/commandDecorators/command.ts +35 -6
  61. package/commandDecorators/commandBuilder.ts +1 -1
  62. package/commandDecorators/commandDecorators.test.ts +107 -6
  63. package/commandDecorators/targetMeta.ts +2 -0
  64. package/commandDecorators/workspaceVersionCheck.test.ts +70 -1
  65. package/commandDecorators/workspaceVersionCheck.ts +64 -14
  66. package/context/akanContext.ts +576 -0
  67. package/context/akanContextInspection.ts +296 -0
  68. package/{akanMcpContract.test.ts → context/akanMcpContract.test.ts} +1 -1
  69. package/{akanMcpContract.ts → context/akanMcpContract.ts} +16 -256
  70. package/context/doctor/agentGuideCheck.ts +81 -0
  71. package/context/doctor/configLeftoverCheck.ts +35 -0
  72. package/context/doctor/doctorFindings.ts +70 -0
  73. package/context/doctor/generatedFreshness.ts +56 -0
  74. package/context/doctor/moduleShapeCheck.ts +88 -0
  75. package/context/doctor/recipeDuplicateCheck.ts +42 -0
  76. package/context/doctor/recipeIndexCheck.ts +87 -0
  77. package/context/doctor/rootShapeCheck.ts +55 -0
  78. package/context/doctor/workflowScope.ts +97 -0
  79. package/{recipeScanner.test.ts → context/recipeScanner.test.ts} +1 -1
  80. package/context/safeRead.ts +9 -0
  81. package/csrE2e/csrE2eHarness.fixture.ts +1 -1
  82. package/devkitUtils.test.ts +39 -5
  83. package/{apiReference.test.ts → docs/apiReference.test.ts} +4 -4
  84. package/{apiReference.ts → docs/apiReference.ts} +2 -2
  85. package/docs/errorCodeReference.test.ts +282 -0
  86. package/docs/errorCodeReference.ts +71 -0
  87. package/docs/errorCodeScan.ts +551 -0
  88. package/{frameworkGraph.test.ts → docs/frameworkGraph.test.ts} +1 -1
  89. package/executors/appExecutor.ts +448 -0
  90. package/executors/commandExecutionError.ts +53 -0
  91. package/executors/executor.ts +527 -0
  92. package/{executors.linkFallback.test.ts → executors/executors.linkFallback.test.ts} +1 -1
  93. package/{executors.test.ts → executors/executors.test.ts} +76 -15
  94. package/executors/index.ts +8 -0
  95. package/executors/libExecutor.ts +23 -0
  96. package/executors/moduleExecutor.ts +18 -0
  97. package/executors/pkgExecutor.ts +129 -0
  98. package/executors/sysExecutor.ts +301 -0
  99. package/executors/workspaceExecutor.ts +277 -0
  100. package/frontendBuild/allRoutesBuilder.test.ts +1 -1
  101. package/frontendBuild/autoImportSync.test.ts +1 -1
  102. package/frontendBuild/autoImportSync.ts +1 -1
  103. package/frontendBuild/buildRouteClient.test.ts +1 -1
  104. package/frontendBuild/clientEntriesBundler.test.ts +1 -1
  105. package/frontendBuild/csrArtifactBuilder.test.ts +1 -1
  106. package/frontendBuild/csrDevArtifactWriter.ts +1 -1
  107. package/frontendBuild/cssCompiler.test.ts +3 -2
  108. package/frontendBuild/devGeneratedIndexSync.test.ts +1 -1
  109. package/frontendBuild/devGeneratedIndexSync.ts +7 -38
  110. package/frontendBuild/dictionaryAssetBuilder.test.ts +1 -1
  111. package/frontendBuild/fontOptimizer.test.ts +1 -1
  112. package/frontendBuild/fontPruner.test.ts +1 -1
  113. package/frontendBuild/frontendBuild.test.ts +3 -3
  114. package/frontendBuild/hmrWatcher.stop.test.ts +63 -0
  115. package/frontendBuild/hmrWatcher.test.ts +1 -1
  116. package/frontendBuild/hmrWatcher.ts +22 -1
  117. package/frontendBuild/mcpAppViewBuilder.test.ts +1 -1
  118. package/frontendBuild/mcpAppViewBuilder.ts +1 -1
  119. package/frontendBuild/nativeCore.test.ts +1 -1
  120. package/frontendBuild/optionalPeers.test.ts +36 -8
  121. package/frontendBuild/pagesBundleBuilder.test.ts +2 -3
  122. package/frontendBuild/pagesBundleBuilder.ts +1 -1
  123. package/frontendBuild/precompressArtifacts.test.ts +1 -1
  124. package/frontendBuild/precompressArtifacts.ts +19 -6
  125. package/frontendBuild/serverGraphFile.ts +1 -1
  126. package/frontendBuild/sourceMtimeIndex.test.ts +1 -1
  127. package/frontendBuild/ssrDevBundler.test.ts +1 -1
  128. package/frontendBuild/vendorImportScanner.test.ts +1 -1
  129. package/frontendBuild/vendorNarrowing.test.ts +1 -1
  130. package/frontendBuild/watchRootResolver.test.ts +1 -1
  131. package/{agentAssets.test.ts → guideline/agentAssets.test.ts} +1 -1
  132. package/{agentAssets.ts → guideline/agentAssets.ts} +2 -2
  133. package/{agentsIndex.test.ts → guideline/agentsIndex.test.ts} +2 -2
  134. package/{agentsIndex.ts → guideline/agentsIndex.ts} +13 -10
  135. package/{conventionSet.test.ts → guideline/conventionSet.test.ts} +7 -4
  136. package/{conventionSet.ts → guideline/conventionSet.ts} +1 -1
  137. package/{prompter.ts → guideline/prompter.ts} +2 -3
  138. package/incrementalBuilder/buildBatch.proc.ts +14 -4
  139. package/incrementalBuilder/buildBatchProtocol.ts +2 -0
  140. package/incrementalBuilder/buildBatchRunner.test.ts +122 -2
  141. package/incrementalBuilder/buildBatchRunner.ts +17 -4
  142. package/incrementalBuilder/builderBoot.ts +106 -0
  143. package/incrementalBuilder/builderBuildStatus.ts +23 -0
  144. package/incrementalBuilder/builderChannel.test.ts +1 -1
  145. package/incrementalBuilder/builderChannel.ts +11 -0
  146. package/incrementalBuilder/builderGraphPayloads.ts +3 -3
  147. package/incrementalBuilder/builderLanes.ts +157 -0
  148. package/incrementalBuilder/builderWatch.ts +213 -0
  149. package/incrementalBuilder/csrRegistry.ts +234 -0
  150. package/incrementalBuilder/incrementalBuilder.proc.test.ts +101 -7
  151. package/incrementalBuilder/incrementalBuilder.proc.ts +81 -823
  152. package/incrementalBuilder/ssrRegistry.ts +282 -0
  153. package/index.ts +22 -22
  154. package/integration/devStability.integration.test.ts +62 -56
  155. package/integration/devStabilityHarness.test.ts +1 -1
  156. package/lint/__fixtures__/no-import-common-err/bad.tsx +13 -0
  157. package/lint/__fixtures__/no-import-common-err/good.tsx +12 -0
  158. package/{biomeBase.test.ts → lint/biomeBase.test.ts} +1 -1
  159. package/lint/gritRules.test.ts +1 -1
  160. package/{linter.test.ts → lint/linter.test.ts} +1 -1
  161. package/lint/no-import-common-err.grit +31 -0
  162. package/lint/no-init-fetch-in-client.grit +1 -1
  163. package/mobile/desktopBin.test.ts +1 -1
  164. package/mobile/desktopRelease.test.ts +1 -1
  165. package/mobile/desktopServerStage.test.ts +2 -2
  166. package/mobile/desktopServerStage.ts +1 -1
  167. package/mobile/nativeApi.test.ts +1 -1
  168. package/mobile/nativeApp.test.ts +1 -1
  169. package/mobile/nativeConfig.test.ts +1 -1
  170. package/mobile/nativePluginFolders.test.ts +1 -1
  171. package/mobile/nativePublicEnv.test.ts +1 -1
  172. package/mobile/nativeWebDir.test.ts +1 -1
  173. package/mobile/serverBundleSecrets.test.ts +1 -1
  174. package/mobile/tarWriter.test.ts +1 -1
  175. package/mobile/updatePackFolder.test.ts +1 -1
  176. package/package.json +173 -9
  177. package/packageExports.test.ts +20 -2
  178. package/piDependencyPins.test.ts +1 -1
  179. package/pipeline/PipelineDefinition.ts +1 -1
  180. package/platformTest/IdleWatchedProcess.test.ts +1 -1
  181. package/platformTest/LinuxDockerTarget.ts +1 -1
  182. package/platformTest/PlatformTestRun.test.ts +1 -1
  183. package/platformTest/TestSnapshot.test.ts +1 -1
  184. package/platformTest/WindowsSshTarget.ts +1 -1
  185. package/preview/previewView.test.ts +23 -1
  186. package/{abstractDoc.test.ts → quality/abstractDoc.test.ts} +2 -2
  187. package/{abstractDoc.ts → quality/abstractDoc.ts} +1 -1
  188. package/quality/bareErrorScanner.ts +126 -0
  189. package/{maintainabilityBaseline.test.ts → quality/maintainabilityBaseline.test.ts} +73 -0
  190. package/{maintainabilityBaseline.ts → quality/maintainabilityBaseline.ts} +97 -9
  191. package/{maintainabilityContract.test.ts → quality/maintainabilityContract.test.ts} +383 -2
  192. package/{maintainabilityContract.ts → quality/maintainabilityContract.ts} +151 -29
  193. package/{maintainabilityExceptionScanner.test.ts → quality/maintainabilityExceptionScanner.test.ts} +15 -1
  194. package/{maintainabilityExceptionScanner.ts → quality/maintainabilityExceptionScanner.ts} +5 -1
  195. package/{maintainabilityLimits.ts → quality/maintainabilityLimits.ts} +12 -0
  196. package/{maintainabilityReport.ts → quality/maintainabilityReport.ts} +20 -3
  197. package/{qualityScanner.test.ts → quality/qualityScanner.test.ts} +41 -1
  198. package/{qualityScanner.ts → quality/qualityScanner.ts} +25 -91
  199. package/{storeAccessScanner.ts → quality/storeAccessScanner.ts} +15 -2
  200. package/quality/workspaceSourceFiles.ts +82 -0
  201. package/{subspace.test.ts → subspace/subspace.test.ts} +25 -4
  202. package/{subspace.ts → subspace/subspace.ts} +5 -5
  203. package/{subspaceClone.ts → subspace/subspaceClone.ts} +8 -8
  204. package/{subspaceConfig.ts → subspace/subspaceConfig.ts} +5 -1
  205. package/{testHelpers.ts → test/testHelpers.ts} +37 -1
  206. package/transforms/barrelAnalyzer.ts +31 -10
  207. package/transforms/browserDirnamePlugin.test.ts +1 -1
  208. package/transforms/externalizeFrameworkPlugin.test.ts +1 -1
  209. package/transforms/mcpAppPageTrimmer.test.ts +1 -1
  210. package/transforms/pureLazyMarker.test.ts +1 -1
  211. package/transforms/serverEnvPlugin.test.ts +1 -1
  212. package/transforms/serverEnvProfile.test.ts +1 -1
  213. package/transforms/sideEffectImportOrder.test.ts +1 -1
  214. package/transforms/transforms.test.ts +52 -2
  215. package/transforms/tsconfigPackageResolver.test.ts +1 -1
  216. package/{createTunnel.test.ts → tunnel/createTunnel.test.ts} +1 -1
  217. package/{createTunnel.ts → tunnel/createTunnel.ts} +2 -2
  218. package/{sshHostKeys.ts → tunnel/sshHostKeys.ts} +2 -2
  219. package/typecheck/projectTypecheck.test.ts +23 -1
  220. package/typecheck/projectTypecheck.ts +10 -2
  221. package/{typeChecker.test.ts → typecheck/typeChecker.test.ts} +1 -1
  222. package/{typeChecker.ts → typecheck/typeChecker.ts} +5 -4
  223. package/typecheck/typecheck.proc.ts +6 -2
  224. package/typecheck/typecheckFailure.ts +1 -1
  225. package/util/errorReport.ts +66 -0
  226. package/{jsonFormatter.test.ts → util/jsonFormatter.test.ts} +1 -1
  227. package/workflow/constantSource.ts +187 -0
  228. package/workflow/dictionarySource.ts +184 -0
  229. package/workflow/executor.ts +6 -9
  230. package/workflow/fieldExpression.ts +153 -0
  231. package/workflow/fieldLabel.ts +61 -0
  232. package/workflow/fieldOrder.ts +117 -0
  233. package/workflow/fieldType.ts +2 -1
  234. package/workflow/guardCatalog.test.ts +1 -1
  235. package/workflow/keyRename.ts +1 -1
  236. package/workflow/moduleIndex.test.ts +2 -2
  237. package/workflow/moduleIndex.ts +2 -2
  238. package/workflow/modulePaths.ts +27 -0
  239. package/workflow/mutationScaffold.ts +7 -15
  240. package/workflow/mutationSource.ts +2 -1
  241. package/workflow/plan.ts +2 -1
  242. package/workflow/primitiveReport.ts +78 -0
  243. package/workflow/rolloutGate.test.ts +1 -1
  244. package/workflow/rolloutGate.ts +1 -1
  245. package/workflow/serviceSource.ts +33 -0
  246. package/workflow/signalSource.ts +96 -0
  247. package/workflow/source.ts +50 -1100
  248. package/workflow/sourceAst.ts +30 -0
  249. package/workflow/sourceImports.ts +105 -0
  250. package/workflow/sourceText.ts +13 -0
  251. package/workflow/templateSource.ts +30 -0
  252. package/workflow/testSource.ts +31 -0
  253. package/workflow/types.ts +1 -1
  254. package/workflow/uiPolicy.ts +1 -1
  255. package/{appSelectionMemory.ts → workspace/appSelectionMemory.ts} +1 -1
  256. package/{codegenLock.test.ts → workspace/codegenLock.test.ts} +1 -1
  257. package/{dependencyScanner.test.ts → workspace/dependencyScanner.test.ts} +1 -1
  258. package/{dependencyScanner.ts → workspace/dependencyScanner.ts} +2 -2
  259. package/{envSeed.test.ts → workspace/envSeed.test.ts} +2 -2
  260. package/{envSeed.ts → workspace/envSeed.ts} +1 -1
  261. package/{libSource.test.ts → workspace/libSource.test.ts} +2 -2
  262. package/{libSource.ts → workspace/libSource.ts} +1 -1
  263. package/{scanInfo.ts → workspace/scanInfo.ts} +21 -10
  264. package/{slicePlanner.test.ts → workspace/slicePlanner.test.ts} +2 -2
  265. package/{slicePlanner.ts → workspace/slicePlanner.ts} +1 -1
  266. package/{workspaceGraph.test.ts → workspace/workspaceGraph.test.ts} +1 -1
  267. package/{workspaceGraph.ts → workspace/workspaceGraph.ts} +1 -1
  268. package/{workspaceLayout.test.ts → workspace/workspaceLayout.test.ts} +1 -1
  269. package/{workspaceLayout.ts → workspace/workspaceLayout.ts} +3 -1
  270. package/akanContext.ts +0 -1083
  271. package/executors.ts +0 -1749
  272. /package/{applicationBuildReporter.test.ts → app/applicationBuildReporter.test.ts} +0 -0
  273. /package/{akanMcpToolError.ts → context/akanMcpToolError.ts} +0 -0
  274. /package/{moduleFieldNames.test.ts → context/moduleFieldNames.test.ts} +0 -0
  275. /package/{moduleFieldNames.ts → context/moduleFieldNames.ts} +0 -0
  276. /package/{recipeScanner.ts → context/recipeScanner.ts} +0 -0
  277. /package/{declarationReader.ts → docs/declarationReader.ts} +0 -0
  278. /package/{frameworkGraph.ts → docs/frameworkGraph.ts} +0 -0
  279. /package/{biomeBase.ts → lint/biomeBase.ts} +0 -0
  280. /package/{linter.ts → lint/linter.ts} +0 -0
  281. /package/{commentDensityScanner.test.ts → quality/commentDensityScanner.test.ts} +0 -0
  282. /package/{commentDensityScanner.ts → quality/commentDensityScanner.ts} +0 -0
  283. /package/{componentSizeScanner.test.ts → quality/componentSizeScanner.test.ts} +0 -0
  284. /package/{componentSizeScanner.ts → quality/componentSizeScanner.ts} +0 -0
  285. /package/{componentWriteChainScanner.test.ts → quality/componentWriteChainScanner.test.ts} +0 -0
  286. /package/{componentWriteChainScanner.ts → quality/componentWriteChainScanner.ts} +0 -0
  287. /package/{deprecatedCommentScanner.test.ts → quality/deprecatedCommentScanner.test.ts} +0 -0
  288. /package/{deprecatedCommentScanner.ts → quality/deprecatedCommentScanner.ts} +0 -0
  289. /package/{endpointReach.test.ts → quality/endpointReach.test.ts} +0 -0
  290. /package/{endpointReach.ts → quality/endpointReach.ts} +0 -0
  291. /package/{formSetterScanner.test.ts → quality/formSetterScanner.test.ts} +0 -0
  292. /package/{formSetterScanner.ts → quality/formSetterScanner.ts} +0 -0
  293. /package/{kindBranchScanner.test.ts → quality/kindBranchScanner.test.ts} +0 -0
  294. /package/{kindBranchScanner.ts → quality/kindBranchScanner.ts} +0 -0
  295. /package/{maintainabilityReport.test.ts → quality/maintainabilityReport.test.ts} +0 -0
  296. /package/{renderMutationScanner.test.ts → quality/renderMutationScanner.test.ts} +0 -0
  297. /package/{renderMutationScanner.ts → quality/renderMutationScanner.ts} +0 -0
  298. /package/{serviceLoopCallScanner.test.ts → quality/serviceLoopCallScanner.test.ts} +0 -0
  299. /package/{serviceLoopCallScanner.ts → quality/serviceLoopCallScanner.ts} +0 -0
  300. /package/{signalMutationIndex.test.ts → quality/signalMutationIndex.test.ts} +0 -0
  301. /package/{signalMutationIndex.ts → quality/signalMutationIndex.ts} +0 -0
  302. /package/{sourceComments.test.ts → quality/sourceComments.test.ts} +0 -0
  303. /package/{sourceComments.ts → quality/sourceComments.ts} +0 -0
  304. /package/{ssrScanner.test.ts → quality/ssrScanner.test.ts} +0 -0
  305. /package/{ssrScanner.ts → quality/ssrScanner.ts} +0 -0
  306. /package/{storeAccessScanner.test.ts → quality/storeAccessScanner.test.ts} +0 -0
  307. /package/{storeSource.ts → quality/storeSource.ts} +0 -0
  308. /package/{storeWriteScanner.test.ts → quality/storeWriteScanner.test.ts} +0 -0
  309. /package/{storeWriteScanner.ts → quality/storeWriteScanner.ts} +0 -0
  310. /package/{structureScanner.test.ts → quality/structureScanner.test.ts} +0 -0
  311. /package/{structureScanner.ts → quality/structureScanner.ts} +0 -0
  312. /package/{testOnlyExportScanner.test.ts → quality/testOnlyExportScanner.test.ts} +0 -0
  313. /package/{testOnlyExportScanner.ts → quality/testOnlyExportScanner.ts} +0 -0
  314. /package/{writePath.test.ts → quality/writePath.test.ts} +0 -0
  315. /package/{writePath.ts → quality/writePath.ts} +0 -0
  316. /package/{writePlacementScanner.test.ts → quality/writePlacementScanner.test.ts} +0 -0
  317. /package/{writePlacementScanner.ts → quality/writePlacementScanner.ts} +0 -0
  318. /package/{writingActionIndex.test.ts → quality/writingActionIndex.test.ts} +0 -0
  319. /package/{writingActionIndex.ts → quality/writingActionIndex.ts} +0 -0
  320. /package/{subspaceReport.ts → subspace/subspaceReport.ts} +0 -0
  321. /package/{sshTunnel.ts → tunnel/sshTunnel.ts} +0 -0
  322. /package/{fileEditor.ts → util/fileEditor.ts} +0 -0
  323. /package/{fileSys.test.ts → util/fileSys.test.ts} +0 -0
  324. /package/{fileSys.ts → util/fileSys.ts} +0 -0
  325. /package/{jsonFormatter.ts → util/jsonFormatter.ts} +0 -0
  326. /package/{selectModel.ts → util/selectModel.ts} +0 -0
  327. /package/{semver.test.ts → util/semver.test.ts} +0 -0
  328. /package/{semver.ts → util/semver.ts} +0 -0
  329. /package/{shellOnlyEnv.test.ts → util/shellOnlyEnv.test.ts} +0 -0
  330. /package/{shellOnlyEnv.ts → util/shellOnlyEnv.ts} +0 -0
  331. /package/{spinner.test.ts → util/spinner.test.ts} +0 -0
  332. /package/{spinner.ts → util/spinner.ts} +0 -0
  333. /package/{stripAnsi.ts → util/stripAnsi.ts} +0 -0
  334. /package/{codegenLock.ts → workspace/codegenLock.ts} +0 -0
  335. /package/{getRelatedCnsts.ts → workspace/getRelatedCnsts.ts} +0 -0
  336. /package/{gitRevision.test.ts → workspace/gitRevision.test.ts} +0 -0
  337. /package/{gitRevision.ts → workspace/gitRevision.ts} +0 -0
  338. /package/{manifestDependencies.ts → workspace/manifestDependencies.ts} +0 -0
  339. /package/{packageExportsMap.ts → workspace/packageExportsMap.ts} +0 -0
  340. /package/{repoIdentity.ts → workspace/repoIdentity.ts} +0 -0
  341. /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
+ };
@@ -1,7 +1,8 @@
1
1
  import ts from "typescript";
2
2
  import type { Sys } from "../commandDecorators";
3
- import { ensureBaseImport, ensureNamedImport, getSysRoot, moduleComponentName, moduleSourcePaths } from "./source";
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();
@@ -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 "./source";
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 { tempDirs, writeText } from "../testHelpers";
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-");
@@ -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 { moduleComponentName, moduleSourcePaths } from "./source";
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
- appendTopLevelTestCases,
7
- classMethodParameters,
8
- ensureImportDeclaration,
9
- ensureNamedImport,
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, moduleComponentName, titleize } from "./source";
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 => ({
@@ -1,4 +1,4 @@
1
- import type { PackageJson } from "../types";
1
+ import type { PackageJson } from "../workspace/types";
2
2
 
3
3
  export type ToolingRolloutDependencySection =
4
4
  | "dependencies"
@@ -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
+ };