@powerhousedao/codegen 6.0.0-dev.135 → 6.0.0-dev.137
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/dist/{file-builders-DyZN9JYf.mjs → file-builders-DRzXbZTI.mjs} +183 -183
- package/dist/file-builders-DRzXbZTI.mjs.map +1 -0
- package/dist/{index-CPl7k91J.d.mts → index-CHAnPBj2.d.mts} +26 -26
- package/dist/index-CHAnPBj2.d.mts.map +1 -0
- package/dist/index.d.mts +5 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/index.mjs.map +1 -1
- package/dist/src/file-builders/index.d.mts +2 -2
- package/dist/src/file-builders/index.mjs +3 -3
- package/dist/src/templates/index.d.mts +48 -48
- package/dist/src/templates/index.d.mts.map +1 -1
- package/dist/src/templates/index.mjs +2 -2
- package/dist/src/utils/index.d.mts +1 -1
- package/dist/src/utils/index.mjs +1 -1
- package/dist/src/utils/index.mjs.map +1 -1
- package/dist/{templates-CKdxigVj.mjs → templates-DBvz_qPL.mjs} +522 -522
- package/dist/templates-DBvz_qPL.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/file-builders-DyZN9JYf.mjs.map +0 -1
- package/dist/index-CPl7k91J.d.mts.map +0 -1
- package/dist/templates-CKdxigVj.mjs.map +0 -1
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["path","claudeTemplate","fs","path","fs"],"sources":["../src/codegen/utils.ts","../src/codegen/generate.ts","../src/codegen/kysely.ts","../src/create-lib/utils.ts","../src/create-lib/checkout-project.ts","../src/templates/boilerplate/document-models/upgrade-manifests.ts","../src/create-lib/create-project.ts","../src/ts-morph-generator/core/FileGenerator.ts","../src/ts-morph-generator/core/ReducerGenerator.ts","../src/ts-morph-generator/utilities/DeclarationManager.ts","../src/ts-morph-generator/utilities/DirectoryManager.ts","../src/ts-morph-generator/utilities/ImportManager.ts","../src/ts-morph-generator/core/TSMorphCodeGenerator.ts"],"sourcesContent":["import { pascalCase } from \"change-case\";\nimport type {\n DocumentModelDocument,\n DocumentModelGlobalState,\n} from \"@powerhousedao/shared/document-model\";\nimport { documentModelReducer } from \"@powerhousedao/shared/document-model\";\nimport { baseLoadFromFile } from \"document-model/node\";\nimport fs from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\nimport { format } from \"prettier\";\nimport type { DocumentTypesMap } from \"./types.js\";\n\nexport async function loadDocumentModel(\n path: string,\n): Promise<DocumentModelGlobalState> {\n let documentModel: DocumentModelGlobalState;\n try {\n if (!path) {\n throw new Error(\"Document model file not specified\");\n } else if (path.endsWith(\".zip\") || path.endsWith(\".phd\")) {\n const file = await baseLoadFromFile(path, documentModelReducer);\n documentModel = file.state.global;\n } else if (path.endsWith(\".json\")) {\n const data = await readFile(path, \"utf-8\");\n const parsedData = JSON.parse(data) as DocumentModelDocument;\n if (\"state\" in parsedData) {\n documentModel = parsedData.state.global;\n } else {\n documentModel = parsedData;\n }\n } else {\n throw new Error(\"File type not supported. Must be zip, phd, or json.\");\n }\n return documentModel;\n } catch (error) {\n throw (error as { code?: string }).code === \"MODULE_NOT_FOUND\"\n ? new Error(`Document model not found.`)\n : error;\n }\n}\n\nexport async function formatWithPrettierBeforeWrite(\n outputFile: string,\n content: string,\n) {\n const modifiedContent = await format(content, {\n parser: \"typescript\",\n });\n return modifiedContent;\n}\n\n/** returns map of document model id to document model name in pascal case and import path */\nexport function getDocumentTypesMap(\n dir: string,\n pathOrigin = \"../../\",\n): DocumentTypesMap {\n const documentTypesMap: DocumentTypesMap = {\n \"powerhouse/document-model\": {\n name: \"DocumentModel\",\n importPath: `document-model`,\n },\n };\n\n // add document types from provided dir\n if (fs.existsSync(dir)) {\n fs.readdirSync(dir, { withFileTypes: true })\n .filter((dirent) => dirent.isDirectory())\n .map((dirent) => dirent.name)\n .forEach((name) => {\n const specPath = resolve(dir, name, `${name}.json`);\n if (!fs.existsSync(specPath)) {\n return;\n }\n\n const specRaw = fs.readFileSync(specPath, \"utf-8\");\n try {\n const spec = JSON.parse(specRaw) as DocumentModelGlobalState;\n if (spec.id) {\n documentTypesMap[spec.id] = {\n name: pascalCase(name),\n importPath: join(pathOrigin, dir, name, \"index.js\"),\n };\n }\n } catch {\n console.error(`Failed to parse ${specPath}`);\n }\n });\n }\n\n return documentTypesMap;\n}\n","import {\n makeSubgraphsIndexFile,\n tsMorphGenerateDocumentEditor,\n tsMorphGenerateDocumentModel,\n tsMorphGenerateDriveEditor,\n tsMorphGenerateSubgraph,\n} from \"@powerhousedao/codegen/file-builders\";\nimport type {\n PartialPowerhouseManifest,\n PowerhouseManifest,\n} from \"@powerhousedao/shared\";\nimport { fileExists, type PowerhouseConfig } from \"@powerhousedao/shared/clis\";\nimport type { DocumentModelGlobalState } from \"@powerhousedao/shared/document-model\";\nimport type { ProcessorApps } from \"@powerhousedao/shared/processors\";\nimport { kebabCase } from \"change-case\";\nimport { getTsconfig } from \"get-tsconfig\";\nimport fs from \"node:fs\";\nimport { readdir, writeFile } from \"node:fs/promises\";\nimport path, { join } from \"node:path\";\nimport { readPackage, type NormalizedPackageJson } from \"read-pkg\";\nimport semver from \"semver\";\nimport {\n exportsTemplate,\n tsconfigPathsTemplate,\n tsConfigTemplate,\n} from \"templates\";\nimport { writePackage } from \"write-package\";\nimport { tsMorphGenerateProcessor } from \"../file-builders/processors/processor.js\";\nimport { generateSchemas } from \"./graphql.js\";\nimport type { CodegenOptions } from \"./types.js\";\nimport { loadDocumentModel } from \"./utils.js\";\n\nexport async function generateAll(args: {\n dir: string;\n useVersioning: boolean;\n migrateLegacy?: boolean;\n watch?: boolean;\n skipFormat?: boolean;\n verbose?: boolean;\n force?: boolean;\n}) {\n const {\n dir,\n useVersioning,\n migrateLegacy = false,\n watch = false,\n skipFormat = false,\n verbose = true,\n force = true,\n } = args;\n const files = await readdir(dir, { withFileTypes: true });\n const documentModelStates: DocumentModelGlobalState[] = [];\n\n for (const directory of files.filter((f) => f.isDirectory())) {\n const documentModelPath = path.join(\n dir,\n directory.name,\n `${directory.name}.json`,\n );\n const pathExists = await fileExists(documentModelPath);\n if (!pathExists) {\n continue;\n }\n\n try {\n const documentModelState = await loadDocumentModel(documentModelPath);\n documentModelStates.push(documentModelState);\n\n await generateDocumentModel({\n dir,\n documentModelState,\n watch,\n skipFormat,\n verbose,\n force,\n useVersioning,\n migrateLegacy,\n });\n } catch (error) {\n if (verbose) {\n console.error(directory.name, error);\n }\n }\n }\n}\n\nexport async function generate(\n config: PowerhouseConfig,\n useVersioning: boolean,\n migrateLegacy = false,\n) {\n const { skipFormat, watch } = config;\n await generateSchemas(config.documentModelsDir, { skipFormat, watch });\n await generateAll({\n dir: config.documentModelsDir,\n useVersioning,\n migrateLegacy,\n skipFormat,\n watch,\n });\n}\n\nexport async function generateFromFile(args: {\n path: string;\n config: PowerhouseConfig;\n useVersioning: boolean;\n migrateLegacy?: boolean;\n options?: CodegenOptions;\n}) {\n const { path, config, useVersioning, migrateLegacy, options } = args;\n // load document model spec from file\n const documentModelState = await loadDocumentModel(path);\n\n // delegate to shared generation function\n await generateFromDocumentModel({\n documentModelState,\n config,\n useVersioning,\n migrateLegacy,\n options,\n });\n}\n\n/**\n * Generates code from a DocumentModelGlobalState object directly.\n *\n * @remarks\n * This function performs the same code generation as generateFromFile but takes\n * a DocumentModelGlobalState object directly instead of loading from a file. This allows for\n * programmatic code generation without file I/O.\n *\n * @param documentModelDocument - The DocumentModelGlobalState object containing the document model\n * @param config - The PowerhouseConfig configuration object\n * @param options - Optional configuration for generation behavior (verbose logging, etc.)\n * @returns A promise that resolves when code generation is complete\n */\nexport async function generateFromDocument(args: {\n documentModelState: DocumentModelGlobalState;\n config: PowerhouseConfig;\n useVersioning: boolean;\n migrateLegacy?: boolean;\n options?: CodegenOptions;\n}) {\n // delegate to shared generation function\n await generateFromDocumentModel(args);\n}\n\ntype GenerateDocumentModelArgs = {\n dir: string;\n documentModelState: DocumentModelGlobalState;\n useVersioning: boolean;\n migrateLegacy?: boolean;\n watch?: boolean;\n skipFormat?: boolean;\n verbose?: boolean;\n force?: boolean;\n};\nexport async function generateDocumentModel(args: GenerateDocumentModelArgs) {\n const { dir, documentModelState, useVersioning, migrateLegacy } = args;\n const packageJson = await readPackage();\n const zodSemverString = findZodDependencyInPackageJson(packageJson);\n ensureZodVersionIsSufficient(zodSemverString);\n\n const projectDir = path.dirname(dir);\n await tsMorphGenerateDocumentModel({\n projectDir,\n documentModelState,\n useVersioning,\n migrateLegacy,\n });\n // await ensurePackageExportsWildcards();\n // await ensureTsconfigPaths();\n}\n\n/**\n * Ensures that the project's package.json exports field contains the\n * wildcard subpath patterns required for deep imports like\n * \"document-models/my-doc\" to resolve correctly.\n */\nasync function ensurePackageExportsWildcards() {\n const requiredExports = JSON.parse(`{ ${exportsTemplate} }`) as Record<\n string,\n string\n >;\n\n const packageJson = await readPackage();\n\n const existingExports =\n !packageJson.exports ||\n typeof packageJson.exports === \"string\" ||\n Array.isArray(packageJson.exports)\n ? {}\n : packageJson.exports;\n\n packageJson.exports = {\n ...existingExports,\n ...requiredExports,\n };\n\n await writePackage(process.cwd(), packageJson);\n}\n\n/**\n * Ensures that the project's tsconfig.json has paths mappings for\n * the convenience export paths like \"document-models/\" etc.\n */\nasync function ensureTsconfigPaths() {\n const requiredTsConfigPaths = JSON.parse(\n `{ ${tsconfigPathsTemplate} }`,\n ) as Record<string, string[]>;\n const tsConfigFilePath = join(process.cwd(), \"tsconfig.json\");\n let tsConfig = getTsconfig();\n\n if (!tsConfig) {\n await writeFile(tsConfigFilePath, tsConfigTemplate);\n tsConfig = getTsconfig();\n }\n\n if (!tsConfig) {\n throw new Error(\n `Failed to get or create tsconfig.json at \"${tsConfigFilePath}\".`,\n );\n }\n\n const existingCompilerOptions = tsConfig.config.compilerOptions ?? {};\n const existingPaths = existingCompilerOptions.paths ?? {};\n\n tsConfig.config.compilerOptions = {\n ...existingCompilerOptions,\n paths: {\n ...existingPaths,\n ...requiredTsConfigPaths,\n },\n };\n\n await writeFile(tsConfigFilePath, JSON.stringify(tsConfig.config, null, 2));\n}\n\nfunction findZodDependencyInPackageJson(\n packageJson: NormalizedPackageJson,\n): string | undefined {\n const dependencies = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n const zodDependency = dependencies[\"zod\"];\n return zodDependency;\n}\n\nfunction ensureZodVersionIsSufficient(zodSemverString: string | undefined) {\n if (!zodSemverString) return;\n const cleaned = semver.clean(zodSemverString);\n if (!cleaned) return;\n const isSufficient = semver.gte(cleaned, \"4.0.0\");\n if (!isSufficient) {\n throw new Error(\n `Your version of zod \"${zodSemverString}\" is out of date. Please install zod version 4.x to continue.`,\n );\n }\n}\n\ntype GenerateEditorArgs = {\n editorName: string;\n documentTypes: string[];\n skipFormat?: boolean;\n editorId?: string;\n editorDirName?: string;\n};\nexport async function generateEditor(args: GenerateEditorArgs) {\n const {\n editorName,\n documentTypes,\n editorId: editorIdArg,\n editorDirName,\n } = args;\n\n const projectDir = path.dirname(\"editors\");\n\n if (documentTypes.length > 1) {\n throw new Error(\"Multiple document types are not supported yet\");\n }\n\n const documentModelId = documentTypes[0];\n const editorId = editorIdArg || kebabCase(editorName);\n const editorDir = editorDirName || kebabCase(editorName);\n\n await tsMorphGenerateDocumentEditor({\n projectDir,\n editorDir,\n documentModelId,\n editorName,\n editorId,\n });\n // await ensurePackageExportsWildcards();\n // await ensureTsconfigPaths();\n}\n\nexport async function generateDriveEditor(options: {\n driveEditorName: string;\n skipFormat?: boolean;\n driveEditorId?: string;\n allowedDocumentTypes?: string[];\n isDragAndDropEnabled?: boolean;\n driveEditorDirName?: string;\n}) {\n const {\n driveEditorName,\n driveEditorId,\n allowedDocumentTypes,\n isDragAndDropEnabled,\n driveEditorDirName,\n } = options;\n const dir = \"editors\";\n\n const projectDir = path.dirname(dir);\n\n await tsMorphGenerateDriveEditor({\n projectDir,\n editorDir: driveEditorDirName || kebabCase(driveEditorName),\n editorName: driveEditorName,\n editorId: driveEditorId ?? kebabCase(driveEditorName),\n allowedDocumentModelIds: allowedDocumentTypes ?? [],\n isDragAndDropEnabled: isDragAndDropEnabled ?? true,\n });\n}\n\nexport async function generateSubgraphFromDocumentModel(\n name: string,\n documentModel: DocumentModelGlobalState,\n config: PowerhouseConfig,\n) {\n await tsMorphGenerateSubgraph({\n subgraphsDir: config.subgraphsDir,\n subgraphName: name,\n documentModel,\n });\n await makeSubgraphsIndexFile({\n projectDir: path.dirname(config.subgraphsDir),\n });\n}\n\nexport async function generateSubgraph(\n name: string,\n file: string | null,\n config: PowerhouseConfig,\n) {\n const documentModelState =\n file !== null ? await loadDocumentModel(file) : null;\n\n await tsMorphGenerateSubgraph({\n subgraphsDir: config.subgraphsDir,\n subgraphName: name,\n documentModel: documentModelState,\n });\n await makeSubgraphsIndexFile({\n projectDir: path.dirname(config.subgraphsDir),\n });\n}\n\nexport async function generateProcessor(args: {\n processorName: string;\n processorType: \"analytics\" | \"relationalDb\";\n processorApps: ProcessorApps;\n documentTypes: string[];\n skipFormat?: boolean;\n rootDir?: string;\n}) {\n const { rootDir = process.cwd() } = args;\n return await tsMorphGenerateProcessor({\n rootDir,\n ...args,\n });\n}\n\nexport async function generateImportScript(\n _name: string,\n _config: PowerhouseConfig,\n) {\n throw new Error(\n \"Import script generation has been removed. The document-drive server APIs it depended on have been deprecated.\",\n );\n}\n\nconst defaultManifest: PowerhouseManifest = {\n name: \"\",\n description: \"\",\n category: \"\",\n publisher: {\n name: \"\",\n url: \"\",\n },\n documentModels: [],\n editors: [],\n apps: [],\n subgraphs: [],\n importScripts: [],\n};\n\nexport function generateManifest(\n manifestData: PartialPowerhouseManifest,\n projectRoot?: string,\n) {\n const rootDir = projectRoot || process.cwd();\n const manifestPath = join(rootDir, \"powerhouse.manifest.json\");\n\n // Create default manifest structure\n\n // Read existing manifest if it exists\n let existingManifest: PowerhouseManifest = defaultManifest;\n if (fs.existsSync(manifestPath)) {\n try {\n const existingData = fs.readFileSync(manifestPath, \"utf-8\");\n existingManifest = JSON.parse(existingData) as PowerhouseManifest;\n } catch (error) {\n console.warn(`Failed to parse existing manifest: ${String(error)}`);\n existingManifest = defaultManifest;\n }\n }\n\n // Helper function to merge arrays by ID\n const mergeArrayById = <T extends { id: string }>(\n existingArray: T[],\n newArray?: T[],\n ): T[] => {\n if (!newArray) return existingArray;\n\n const result = [...existingArray];\n\n newArray.forEach((newItem) => {\n const existingIndex = result.findIndex((item) => item.id === newItem.id);\n if (existingIndex !== -1) {\n // Replace existing item\n result[existingIndex] = newItem;\n } else {\n // Add new item\n result.push(newItem);\n }\n });\n\n return result;\n };\n\n // Merge partial data with existing manifest\n const updatedManifest: PowerhouseManifest = {\n ...existingManifest,\n ...manifestData,\n publisher: {\n ...existingManifest.publisher,\n ...(manifestData.publisher || {}),\n },\n documentModels: mergeArrayById(\n existingManifest.documentModels,\n manifestData.documentModels,\n ),\n editors: mergeArrayById(existingManifest.editors, manifestData.editors),\n apps: mergeArrayById(existingManifest.apps, manifestData.apps),\n subgraphs: mergeArrayById(\n existingManifest.subgraphs,\n manifestData.subgraphs,\n ),\n importScripts: mergeArrayById(\n existingManifest.importScripts,\n manifestData.importScripts,\n ),\n };\n\n // Write updated manifest to file\n fs.writeFileSync(manifestPath, JSON.stringify(updatedManifest, null, 4));\n\n return manifestPath;\n}\n\n/**\n * Generates code from a DocumentModelGlobalState.\n *\n * @remarks\n * This is the core generation function that both generateFromFile and generateFromDocument\n * use internally. It handles the actual code generation from a DocumentModelGlobalState object.\n *\n * @param documentModel - The DocumentModelGlobalState containing the document model specification\n * @param config - The PowerhouseConfig configuration object\n * @param options - Optional configuration for generation behavior\n * @returns A promise that resolves when code generation is complete\n */\nasync function generateFromDocumentModel(args: {\n documentModelState: DocumentModelGlobalState;\n config: PowerhouseConfig;\n useVersioning: boolean;\n migrateLegacy?: boolean;\n options?: CodegenOptions;\n}) {\n const {\n documentModelState,\n config,\n useVersioning,\n migrateLegacy,\n options = {},\n } = args;\n const {\n verbose = config.logLevel === \"verbose\" ||\n config.logLevel === \"debug\" ||\n config.logLevel === \"info\",\n force = false,\n } = options;\n const name = kebabCase(documentModelState.name);\n const documentModelDir = join(config.documentModelsDir, name);\n // create document model folder and spec as json\n fs.mkdirSync(documentModelDir, { recursive: true });\n fs.writeFileSync(\n join(documentModelDir, `${name}.json`),\n JSON.stringify(documentModelState, null, 2),\n );\n\n await generateDocumentModel({\n dir: config.documentModelsDir,\n documentModelState,\n watch: config.watch,\n skipFormat: config.skipFormat,\n verbose,\n force,\n useVersioning,\n migrateLegacy,\n });\n}\n","import { spawn } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { join, resolve } from \"node:path\";\n\nfunction getKyselyPgLiteBin(): string {\n const require = createRequire(import.meta.url);\n\n const paths = require.resolve.paths(\"kysely-pglite\");\n if (paths) {\n for (const basePath of paths) {\n const pkgRoot = join(basePath, \"kysely-pglite\");\n const binPath = join(pkgRoot, \"bin/run.js\");\n\n if (existsSync(binPath)) {\n return binPath;\n }\n }\n }\n\n throw new Error(\"Could not find kysely-pglite/bin/run.js\");\n}\n\nexport interface IOptions {\n migrationFile: string;\n schemaFile?: string;\n}\n\nfunction runCommand(\n command: string,\n args: string[],\n cwd?: string,\n): Promise<void> {\n return new Promise((resolve, reject) => {\n const child = spawn(command, args, {\n cwd,\n stdio: \"inherit\",\n shell: true,\n });\n\n child.on(\"close\", (code) => {\n if (code === 0) {\n resolve();\n } else {\n reject(new Error(`Command failed with exit code ${code}`));\n }\n });\n\n child.on(\"error\", (error) => {\n reject(error);\n });\n });\n}\n\nexport async function generateDBSchema({\n migrationFile,\n schemaFile,\n}: IOptions) {\n const outFile = schemaFile ?? resolve(migrationFile, \"../schema.ts\");\n\n try {\n const kyselyBinPath = getKyselyPgLiteBin();\n // Use kysely-pglite CLI to handle TypeScript compilation and module resolution\n await runCommand(\n \"node\",\n [kyselyBinPath, migrationFile, \"--outFile\", outFile],\n process.cwd(),\n );\n\n console.log(`Schema types generated at ${outFile}`);\n } catch (error) {\n console.error(\"Error running migration:\", error);\n }\n}\n","import { execSync } from \"child_process\";\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\nconst packageManagers = [\"npm\", \"yarn\", \"pnpm\", \"bun\"] as const;\nconst defaultPackageManager = \"npm\";\n\nexport type PackageManager = (typeof packageManagers)[number];\n\nexport function getPackageManager(userAgent?: string): PackageManager {\n if (!userAgent) {\n return defaultPackageManager;\n }\n\n const pkgSpec = userAgent.split(\" \")[0];\n const pkgSpecArr = pkgSpec.split(\"/\");\n const name = pkgSpecArr[0];\n\n if (packageManagers.includes(name as PackageManager)) {\n return name as PackageManager;\n } else {\n return defaultPackageManager;\n }\n}\n\nexport const envPackageManager = getPackageManager(\n process.env.npm_config_user_agent,\n);\n\nexport function runCmd(command: string) {\n try {\n execSync(command, { stdio: \"inherit\" });\n } catch (error) {\n console.log(\"\\x1b[31m\", error, \"\\x1b[0m\");\n throw error;\n }\n}\n\nexport async function writeFileEnsuringDir(\n filePath: string,\n contents: string | Buffer,\n) {\n await mkdir(dirname(filePath), { recursive: true });\n await writeFile(filePath, contents, { encoding: \"utf-8\" });\n}\n","import path from \"node:path\";\nimport { runCmd } from \"./utils.js\";\n\n/**\n * Clones a git repository and returns the path to the cloned project.\n * @param repositoryUrl - The URL of the git repository to clone\n * @returns The absolute path to the cloned project directory\n */\nexport function cloneRepository(repositoryUrl: string): string {\n try {\n console.log(\n \"\\x1b[33m\",\n `Cloning repository from ${repositoryUrl}...`,\n \"\\x1b[0m\",\n );\n runCmd(`git clone ${repositoryUrl}`);\n\n // Extract project name from repository URL\n // e.g., https://github.com/org/repo.git -> repo\n const repoName = repositoryUrl\n .split(\"/\")\n .pop()\n ?.replace(/\\.git$/, \"\");\n\n if (!repoName) {\n throw new Error(\"Could not determine project name from repository URL\");\n }\n\n const projectPath = path.join(process.cwd(), repoName);\n return projectPath;\n } catch (error) {\n console.log(error);\n throw error;\n }\n}\n\n/**\n * Installs dependencies in a project directory using the specified package manager.\n * @param projectPath - The absolute path to the project directory\n * @param packageManager - The package manager to use (npm, pnpm, yarn, bun)\n */\nexport function installDependencies(\n projectPath: string,\n packageManager: string,\n): void {\n try {\n process.chdir(projectPath);\n\n console.log(\n \"\\x1b[34m\",\n `Installing dependencies with ${packageManager}...`,\n \"\\x1b[0m\",\n );\n runCmd(`${packageManager} install --loglevel error`);\n\n console.log(\"\\x1b[32m\", \"Dependencies installed successfully!\", \"\\x1b[0m\");\n console.log();\n } catch (error) {\n console.log(error);\n throw error;\n }\n}\n","import { ts } from \"@tmpl/core\";\n\nexport const upgradeManifestsTemplate = ts`\nimport type { UpgradeManifest } from \"document-model\";\n\nexport const upgradeManifests: UpgradeManifest<readonly number[]>[] = [];\n`.raw;\n","import chalk from \"chalk\";\nimport { buildBoilerplatePackageJson } from \"file-builders\";\nimport fs from \"node:fs\";\nimport path from \"path\";\nimport {\n agentsTemplate,\n buildPowerhouseConfigTemplate,\n claudeSettingsLocalTemplate,\n claudeTemplate,\n connectEntrypointTemplate,\n cursorMcpTemplate,\n dockerfileTemplate,\n documentModelsIndexTemplate,\n documentModelsTemplate,\n editorsIndexTemplate,\n editorsTemplate,\n eslintConfigTemplate,\n factoryBuildersTemplate,\n geminiSettingsTemplate,\n gitIgnoreTemplate,\n indexHtmlTemplate,\n indexTsTemplate,\n licenseTemplate,\n mainTsxTemplate,\n mcpTemplate,\n nginxConfTemplate,\n npmrcTemplate,\n powerhouseManifestTemplate,\n processorsFactoryTemplate,\n processorsIndexTemplate,\n readmeTemplate,\n styleTemplate,\n subgraphsIndexTemplate,\n switchboardEntrypointTemplate,\n syncAndPublishWorkflowTemplate,\n tsConfigTemplate,\n vitestConfigTemplate,\n} from \"templates\";\nimport { runPrettier } from \"utils\";\nimport { upgradeManifestsTemplate } from \"../templates/boilerplate/document-models/upgrade-manifests.js\";\nimport { runCmd, writeFileEnsuringDir } from \"./utils.js\";\ntype CreateProjectArgs = {\n name: string;\n packageManager: string;\n tag?: string;\n version?: string;\n remoteDrive?: string;\n skipGitInit?: boolean;\n skipInstall?: boolean;\n};\nexport async function createProject({\n name,\n packageManager,\n tag,\n version,\n remoteDrive,\n skipGitInit,\n skipInstall,\n}: CreateProjectArgs) {\n const appPath = path.join(process.cwd(), name);\n\n try {\n fs.mkdirSync(appPath);\n } catch (err) {\n if ((err as { code: string }).code === \"EEXIST\") {\n console.error(\n `⛔ The folder \"${name}\" already exists in the current directory, please give it another name.`,\n );\n } else {\n console.error(err);\n }\n process.exit(1);\n }\n\n try {\n // Create a new directory for the project\n console.log(chalk.blue(`▶️ Creating directory for project \"${name}\"...\\n`));\n const appPath = path.join(process.cwd(), name);\n process.chdir(appPath);\n console.log(chalk.green(`✅ Project directory created\\n`));\n\n await writeFileEnsuringDir(\".gitignore\", gitIgnoreTemplate);\n if (!skipGitInit) {\n // Create a .gitignore file, then initialize the git repository\n console.log(chalk.blue(`▶️ Initializing git repository...\\n`));\n runCmd(`git init`);\n console.log(chalk.green(`\\n✅ Git repository initialized\\n`));\n }\n\n // Write the boilerplate files for the project\n console.log(chalk.blue(`▶️ Creating project boilerplate files...\\n`));\n await writeProjectRootFiles({ name, tag, version, remoteDrive });\n await writeModuleFiles();\n await writeAiConfigFiles();\n await writeCIFiles();\n console.log(chalk.green(`✅ Project boilerplate files created\\n`));\n\n if (!skipInstall) {\n // Install the project dependencies with the specified package manager\n console.log(\n chalk.blue(\n `▶️ Installing project dependencies with ${packageManager}...\\n`,\n ),\n );\n runCmd(`${packageManager} install`);\n console.log(chalk.green(`\\n✅ Project dependencies installed\\n`));\n }\n\n // Use the installed version of `prettier` to format the generated code\n console.log(chalk.blue(`▶️ Formatting boilerplate project files...\\n`));\n await runPrettier();\n console.log(chalk.green(`✅ Boilerplate files formatted\\n`));\n\n // Project creation complete\n console.log(chalk.bold(`🎉 Successfully created project \"${name}\" 🎉\\n`));\n } catch (error) {\n console.error(error);\n process.exit(1);\n }\n}\n\nasync function writeProjectRootFiles(args: {\n name: string;\n tag?: string;\n version?: string;\n remoteDrive?: string;\n}) {\n const { name, tag, version, remoteDrive } = args;\n await writeFileEnsuringDir(\"LICENSE\", licenseTemplate);\n await writeFileEnsuringDir(\"README.md\", readmeTemplate);\n await writeFileEnsuringDir(\".npmrc\", npmrcTemplate);\n const packageJson = await buildBoilerplatePackageJson({\n name,\n tag,\n version,\n });\n const powerhouseManifest = powerhouseManifestTemplate(name);\n await writeFileEnsuringDir(\"powerhouse.manifest.json\", powerhouseManifest);\n const powerhouseConfig = await buildPowerhouseConfigTemplate({\n tag,\n version,\n remoteDrive,\n });\n await writeFileEnsuringDir(\"powerhouse.config.json\", powerhouseConfig);\n await writeFileEnsuringDir(\"package.json\", packageJson);\n await writeFileEnsuringDir(\"tsconfig.json\", tsConfigTemplate);\n await writeFileEnsuringDir(\"index.html\", indexHtmlTemplate);\n await writeFileEnsuringDir(\"main.tsx\", mainTsxTemplate);\n await writeFileEnsuringDir(\"eslint.config.js\", eslintConfigTemplate);\n await writeFileEnsuringDir(\"index.ts\", indexTsTemplate);\n await writeFileEnsuringDir(\"style.css\", styleTemplate);\n await writeFileEnsuringDir(\"vitest.config.ts\", vitestConfigTemplate);\n}\n\nasync function writeModuleFiles() {\n await writeFileEnsuringDir(\n \"document-models/document-models.ts\",\n documentModelsTemplate,\n );\n await writeFileEnsuringDir(\n \"document-models/index.ts\",\n documentModelsIndexTemplate,\n );\n await writeFileEnsuringDir(\n \"document-models/upgrade-manifests.ts\",\n upgradeManifestsTemplate,\n );\n await writeFileEnsuringDir(\"editors/editors.ts\", editorsTemplate);\n await writeFileEnsuringDir(\"editors/index.ts\", editorsIndexTemplate);\n await writeFileEnsuringDir(\n \"processors/factory.ts\",\n processorsFactoryTemplate,\n );\n await writeFileEnsuringDir(\"processors/index.ts\", processorsIndexTemplate);\n await writeFileEnsuringDir(\"processors/connect.ts\", factoryBuildersTemplate);\n await writeFileEnsuringDir(\n \"processors/switchboard.ts\",\n factoryBuildersTemplate,\n );\n await writeFileEnsuringDir(\"subgraphs/index.ts\", subgraphsIndexTemplate);\n await writeFileEnsuringDir(\"processors/index.ts\", processorsIndexTemplate);\n}\n\nasync function writeAiConfigFiles() {\n await writeFileEnsuringDir(\"CLAUDE.md\", claudeTemplate);\n await writeFileEnsuringDir(\"AGENTS.md\", agentsTemplate);\n await writeFileEnsuringDir(\".mcp.json\", mcpTemplate);\n await writeFileEnsuringDir(\".gemini/settings.json\", geminiSettingsTemplate);\n await writeFileEnsuringDir(\".cursor/mcp.json\", cursorMcpTemplate);\n await writeFileEnsuringDir(\n \".claude/settings.local.json\",\n claudeSettingsLocalTemplate,\n );\n}\n\nasync function writeCIFiles() {\n await writeFileEnsuringDir(\n \".github/workflows/sync-and-publish.yml\",\n syncAndPublishWorkflowTemplate,\n );\n await writeFileEnsuringDir(\"Dockerfile\", dockerfileTemplate);\n await writeFileEnsuringDir(\"docker/nginx.conf\", nginxConfTemplate);\n await writeFileEnsuringDir(\n \"docker/connect-entrypoint.sh\",\n connectEntrypointTemplate,\n );\n await writeFileEnsuringDir(\n \"docker/switchboard-entrypoint.sh\",\n switchboardEntrypointTemplate,\n );\n}\n","import type { DeclarationManager } from \"../utilities/DeclarationManager.js\";\nimport type { DirectoryManager } from \"../utilities/DirectoryManager.js\";\nimport type { ImportManager } from \"../utilities/ImportManager.js\";\nimport type { GenerationContext } from \"./GenerationContext.js\";\n\nexport abstract class FileGenerator {\n constructor(\n protected importManager: ImportManager,\n protected directoryManager: DirectoryManager,\n protected declarationManager: DeclarationManager,\n ) {}\n\n abstract generate(context: GenerationContext): Promise<void>;\n}\n","import { camelCase, kebabCase, pascalCase } from \"change-case\";\nimport type { OperationErrorSpecification } from \"@powerhousedao/shared/document-model\";\nimport type {\n MethodDeclaration,\n ObjectLiteralExpression,\n SourceFile,\n} from \"ts-morph\";\nimport { SyntaxKind, VariableDeclarationKind } from \"ts-morph\";\nimport { FileGenerator } from \"./FileGenerator.js\";\nimport type {\n CodegenOperation,\n GenerationContext,\n} from \"./GenerationContext.js\";\n\nexport class ReducerGenerator extends FileGenerator {\n async generate(context: GenerationContext): Promise<void> {\n // Skip if no actions to generate\n if (context.operations.length === 0) return;\n\n const filePath = this.getOutputPath(context);\n const sourceFile = await this.directoryManager.createSourceFile(\n context.project,\n filePath,\n );\n\n const packageName = context.packageName;\n // Reducer-specific import logic\n const typeImportName = `${pascalCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;\n const typeImportPath = `${packageName}/document-models/${kebabCase(context.docModel.name)}`;\n\n // Import management (shared utility)\n this.importManager.replaceImportByName(\n sourceFile,\n typeImportName,\n typeImportPath,\n true,\n );\n\n // AST logic (specific to reducers)\n this.createReducerObject(sourceFile, typeImportName, context);\n\n // Detect and import error classes used in the actual reducer code (after generation)\n this.addErrorImports(sourceFile, context);\n\n await sourceFile.save();\n }\n\n private static getDefaultReducerCode(methodName: string): string[] {\n return [\n `// TODO: Implement \"${methodName}\" reducer`,\n `throw new Error('Reducer \"${methodName}\" not yet implemented');`,\n ];\n }\n\n private addErrorImports(\n sourceFile: SourceFile,\n context: GenerationContext,\n ): void {\n // Collect all errors from all operations\n const allErrors: OperationErrorSpecification[] = [];\n\n context.operations.forEach((operation) => {\n if (Array.isArray(operation.errors)) {\n operation.errors\n .filter((error) => error.name)\n .forEach((error) => {\n // Deduplicate errors by name\n if (!allErrors.find((e) => e.name === error.name)) {\n allErrors.push(error);\n }\n });\n }\n });\n\n if (allErrors.length === 0) return;\n\n // Analyze the actual source file content to find which errors are used\n const sourceFileContent = sourceFile.getFullText();\n const usedErrors = new Set<string>();\n\n allErrors.forEach((error) => {\n // Check if error class name is mentioned anywhere in the source file\n // Look for patterns like \"new ErrorName\" or \"throw ErrorName\" or \"ErrorName(\"\n const errorPattern = new RegExp(`\\\\b${error.name}\\\\b`, \"g\");\n if (errorPattern.test(sourceFileContent)) {\n usedErrors.add(error.name!);\n }\n });\n\n // Add imports for used errors (only if they're not already imported)\n if (usedErrors.size > 0) {\n const errorImportPath = `../../gen/${kebabCase(context.module.name)}/error.js`;\n const errorClassNames = Array.from(usedErrors);\n\n // Check if imports already exist to avoid duplicates\n const existingImports = sourceFile.getImportDeclarations();\n const existingErrorImport = existingImports.find(\n (importDecl) =>\n importDecl.getModuleSpecifierValue() === errorImportPath,\n );\n\n if (existingErrorImport) {\n // Get already imported error names\n const existingNamedImports = existingErrorImport\n .getNamedImports()\n .map((namedImport) => namedImport.getName());\n\n // Only import errors that aren't already imported\n const newErrorsToImport = errorClassNames.filter(\n (errorName) => !existingNamedImports.includes(errorName),\n );\n\n if (newErrorsToImport.length > 0) {\n // Add new named imports to existing import declaration\n existingErrorImport.addNamedImports(newErrorsToImport);\n }\n } else {\n // Create new import declaration\n this.importManager.addNamedImports(\n sourceFile,\n errorClassNames,\n errorImportPath,\n );\n }\n }\n }\n\n private getOutputPath(context: GenerationContext): string {\n return this.directoryManager.getReducerPath(\n context.rootDir,\n context.docModel.name,\n context.module.name,\n );\n }\n\n private createReducerObject(\n sourceFile: SourceFile,\n typeName: string,\n context: GenerationContext,\n ): void {\n const { operations, forceUpdate } = context;\n const operationHandlersObjectName = `${camelCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;\n const legacyReducerVar = sourceFile.getVariableDeclaration(\"reducer\");\n if (legacyReducerVar) {\n this.declarationManager.renameVariable(\n sourceFile,\n \"reducer\",\n operationHandlersObjectName,\n );\n }\n let reducerVar = sourceFile.getVariableDeclaration(\n operationHandlersObjectName,\n );\n if (!reducerVar) {\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: operationHandlersObjectName,\n type: typeName,\n initializer: \"{}\",\n },\n ],\n });\n reducerVar = sourceFile.getVariableDeclarationOrThrow(\n operationHandlersObjectName,\n );\n } else {\n // Ensure correct type\n const typeNode = reducerVar.getTypeNode();\n if (!typeNode || typeNode.getText() !== typeName) {\n reducerVar.setType(typeName);\n }\n }\n\n const initializer = reducerVar.getInitializerIfKindOrThrow(\n SyntaxKind.ObjectLiteralExpression,\n );\n\n for (const operation of operations) {\n this.addReducerMethod(initializer, operation, forceUpdate);\n }\n }\n\n private addReducerMethod(\n objectLiteral: ObjectLiteralExpression,\n operation: CodegenOperation,\n forceUpdate = false,\n ): void {\n const actionName = camelCase(operation.name ?? \"\");\n if (!actionName) return;\n\n const methodName = `${actionName}Operation`;\n\n const reducerCode = operation.reducer?.trim();\n\n const existingReducer = objectLiteral\n .getProperty(methodName)\n ?.asKind(SyntaxKind.MethodDeclaration);\n\n // if reducer already exists but forceUpdate is true, update it\n if (existingReducer) {\n if (forceUpdate && reducerCode) {\n existingReducer.setBodyText(\"\");\n this.setReducerMethodCode(existingReducer, reducerCode);\n }\n return;\n }\n\n // if reducer doesn't exist, create it and set the code with the default code if no code is provided\n const method = objectLiteral.addMethod({\n name: methodName,\n parameters: [{ name: \"state\" }, { name: \"action\" }],\n });\n this.setReducerMethodCode(method, reducerCode);\n }\n\n private setReducerMethodCode(reducer: MethodDeclaration, code?: string) {\n reducer.addStatements(\n code ? [code] : ReducerGenerator.getDefaultReducerCode(reducer.getName()),\n );\n }\n}\n","import type { SourceFile } from \"ts-morph\";\n\nexport class DeclarationManager {\n renameVariable(\n sourceFile: SourceFile,\n oldName: string,\n newName: string,\n ): void {\n const variable = sourceFile.getVariableDeclaration(oldName);\n\n if (variable) {\n variable.getNameNode().replaceWithText(newName);\n sourceFile.saveSync();\n }\n }\n}\n","import type { PHProjectDirectories } from \"@powerhousedao/codegen\";\nimport { kebabCase, pascalCase } from \"change-case\";\nimport fs from \"fs/promises\";\nimport path from \"path\";\nimport type { Project, SourceFile } from \"ts-morph\";\n\nexport class DirectoryManager {\n private directories: Required<PHProjectDirectories> = {\n documentModelDir: \"document-model\",\n editorsDir: \"editors\",\n processorsDir: \"processors\",\n subgraphsDir: \"subgraphs\",\n };\n\n constructor(directories: PHProjectDirectories = {}) {\n this.directories = {\n ...this.directories,\n ...directories,\n };\n }\n async ensureExists(dirPath: string): Promise<void> {\n try {\n await fs.mkdir(dirPath, { recursive: true });\n } catch (err) {\n console.error(`Failed to create directory: ${dirPath}`, err);\n throw err;\n }\n }\n\n // Path builders for different file types\n getReducerPath(\n rootDir: string,\n docModelName: string,\n moduleName: string,\n ): string {\n return path.join(\n rootDir,\n this.directories.documentModelDir,\n kebabCase(docModelName),\n \"src\",\n \"reducers\",\n `${kebabCase(moduleName)}.ts`,\n );\n }\n\n getActionsPath(\n rootDir: string,\n docModelName: string,\n moduleName: string,\n ): string {\n return path.join(\n rootDir,\n this.directories.documentModelDir,\n kebabCase(docModelName),\n \"src\",\n \"actions\",\n `${kebabCase(moduleName)}.ts`,\n );\n }\n\n getComponentPath(\n rootDir: string,\n docModelName: string,\n componentName: string,\n ): string {\n return path.join(\n rootDir,\n this.directories.documentModelDir,\n kebabCase(docModelName),\n \"src\",\n \"components\",\n `${pascalCase(componentName)}.tsx`,\n );\n }\n\n getTypesPath(rootDir: string, docModelName: string): string {\n return path.join(\n rootDir,\n this.directories.documentModelDir,\n kebabCase(docModelName),\n \"src\",\n \"types.ts\",\n );\n }\n\n async createSourceFile(\n project: Project,\n filePath: string,\n ): Promise<SourceFile> {\n await this.ensureExists(path.dirname(filePath));\n return (\n project.addSourceFileAtPathIfExists(filePath) ??\n project.createSourceFile(filePath, \"\", { overwrite: false })\n );\n }\n}\n","import type { ImportDeclaration, SourceFile } from \"ts-morph\";\n\nexport interface ImportSpec {\n moduleSpecifier: string;\n namedImports?: string[];\n defaultImport?: string;\n isTypeOnly?: boolean;\n}\n\nexport class ImportManager {\n addImport(sourceFile: SourceFile, spec: ImportSpec): void {\n // Check if import already exists\n const existing = sourceFile.getImportDeclaration(\n (imp) => imp.getFullText() === spec.moduleSpecifier,\n );\n if (existing) {\n this.mergeImports(existing, spec);\n } else {\n sourceFile.addImportDeclaration(spec);\n }\n }\n\n addTypeImport(sourceFile: SourceFile, typeName: string, path: string): void {\n this.addImport(sourceFile, {\n moduleSpecifier: path,\n namedImports: [typeName],\n isTypeOnly: true,\n });\n }\n\n addNamedImports(\n sourceFile: SourceFile,\n imports: string[],\n path: string,\n ): void {\n this.addImport(sourceFile, {\n moduleSpecifier: path,\n namedImports: imports,\n });\n }\n\n private mergeImports(\n existingImport: ImportDeclaration,\n newSpec: ImportSpec,\n ): void {\n // Logic to merge named imports if they don't already exist\n if (newSpec.namedImports) {\n const existingNames = existingImport\n .getNamedImports()\n .map((ni) => ni.getName());\n const newNames = newSpec.namedImports.filter(\n (name) => !existingNames.includes(name),\n );\n\n if (newNames.length > 0) {\n existingImport.addNamedImports(newNames);\n }\n }\n }\n\n replaceImportByName(\n sourceFile: SourceFile,\n name: string,\n path: string,\n isTypeOnly = false,\n ): void {\n const existing = sourceFile\n .getImportDeclarations()\n .filter((imp) =>\n imp.getNamedImports().find((ni) => ni.getName() === name),\n );\n existing.forEach((imp) => imp.remove());\n sourceFile.addImportDeclaration({\n moduleSpecifier: path,\n namedImports: [name],\n isTypeOnly,\n });\n sourceFile.saveSync();\n }\n}\n","import type {\n DocumentModelGlobalState,\n ModuleSpecification,\n} from \"@powerhousedao/shared/document-model\";\nimport fs from \"fs/promises\";\nimport { Project } from \"ts-morph\";\nimport { DeclarationManager } from \"../utilities/DeclarationManager.js\";\nimport { DirectoryManager } from \"../utilities/DirectoryManager.js\";\nimport { ImportManager } from \"../utilities/ImportManager.js\";\nimport type { FileGenerator } from \"./FileGenerator.js\";\nimport type {\n CodeGeneratorOptions,\n CodegenOperation,\n GenerationContext,\n PHProjectDirectories,\n} from \"./GenerationContext.js\";\nimport { ReducerGenerator } from \"./ReducerGenerator.js\";\n\nexport class TSMorphCodeGenerator {\n private project = new Project();\n private generators = new Map<string, FileGenerator>();\n private directories: PHProjectDirectories = {\n documentModelDir: \"document-model\",\n editorsDir: \"editors\",\n processorsDir: \"processors\",\n subgraphsDir: \"subgraphs\",\n };\n private forceUpdate = false;\n\n constructor(\n private rootDir: string,\n private docModels: DocumentModelGlobalState[],\n private packageName: string,\n options: CodeGeneratorOptions = { directories: {}, forceUpdate: false },\n ) {\n this.directories = {\n ...this.directories,\n ...options.directories,\n };\n this.packageName = packageName;\n this.forceUpdate = options.forceUpdate ?? false;\n\n this.setupGenerators();\n }\n\n private setupGenerators(): void {\n const importManager = new ImportManager();\n const directoryManager = new DirectoryManager(this.directories);\n const declarationManager = new DeclarationManager();\n // Register all generators\n this.generators.set(\n \"reducers\",\n new ReducerGenerator(importManager, directoryManager, declarationManager),\n );\n }\n\n // Generate specific file types\n async generateReducers(): Promise<void> {\n await this.generateFileType(\"reducers\");\n }\n\n // Generate everything\n async generateAll(): Promise<void> {\n for (const [type] of this.generators) {\n await this.generateFileType(type);\n }\n }\n\n private async generateFileType(type: string): Promise<void> {\n const generator = this.generators.get(type);\n if (!generator) {\n throw new Error(`No generator registered for type: ${type}`);\n }\n\n await this.setupProject();\n\n for (const docModel of this.docModels) {\n const latestSpec =\n docModel.specifications[docModel.specifications.length - 1];\n\n for (const module of latestSpec.modules) {\n const context = this.createGenerationContext(\n docModel,\n module,\n this.forceUpdate,\n );\n\n await generator.generate(context);\n }\n }\n }\n\n private async setupProject(): Promise<void> {\n // Only load files from configured directories\n const sourcePaths: string[] = [];\n\n if (this.directories.documentModelDir) {\n const dirPath = `${this.rootDir}/${this.directories.documentModelDir}`;\n await this.ensureDirectoryExists(dirPath);\n sourcePaths.push(`${dirPath}/**/*.ts`);\n }\n if (this.directories.editorsDir) {\n const dirPath = `${this.rootDir}/${this.directories.editorsDir}`;\n await this.ensureDirectoryExists(dirPath);\n sourcePaths.push(`${dirPath}/**/*.ts`);\n }\n if (this.directories.processorsDir) {\n const dirPath = `${this.rootDir}/${this.directories.processorsDir}`;\n await this.ensureDirectoryExists(dirPath);\n sourcePaths.push(`${dirPath}/**/*.ts`);\n }\n if (this.directories.subgraphsDir) {\n const dirPath = `${this.rootDir}/${this.directories.subgraphsDir}`;\n await this.ensureDirectoryExists(dirPath);\n sourcePaths.push(`${dirPath}/**/*.ts`);\n }\n\n // Exclude node_modules from all paths\n sourcePaths.push(`!${this.rootDir}/**/node_modules/**`);\n\n if (sourcePaths.length > 0) {\n this.project.addSourceFilesAtPaths(sourcePaths);\n }\n }\n\n private createGenerationContext(\n docModel: DocumentModelGlobalState,\n module: ModuleSpecification,\n forceUpdate = false,\n ): GenerationContext {\n const operations: CodegenOperation[] = module.operations.map((op) => ({\n ...op,\n hasInput: op.schema !== null,\n hasAttachment: op.schema?.includes(\": Attachment\"),\n scope: op.scope || \"global\",\n state: op.scope === \"global\" ? \"\" : op.scope,\n }));\n\n return {\n rootDir: this.rootDir,\n packageName: this.packageName,\n docModel,\n module,\n project: this.project,\n operations,\n forceUpdate,\n };\n }\n\n private async ensureDirectoryExists(dirPath: string): Promise<void> {\n try {\n await fs.mkdir(dirPath, { recursive: true });\n } catch (err) {\n console.error(`Failed to create directory: ${dirPath}`, err);\n throw err;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAaA,eAAsB,kBACpB,MACmC;CACnC,IAAI;AACJ,KAAI;AACF,MAAI,CAAC,KACH,OAAM,IAAI,MAAM,oCAAoC;WAC3C,KAAK,SAAS,OAAO,IAAI,KAAK,SAAS,OAAO,CAEvD,kBADa,MAAM,iBAAiB,MAAM,qBAAqB,EAC1C,MAAM;WAClB,KAAK,SAAS,QAAQ,EAAE;GACjC,MAAM,OAAO,MAAM,SAAS,MAAM,QAAQ;GAC1C,MAAM,aAAa,KAAK,MAAM,KAAK;AACnC,OAAI,WAAW,WACb,iBAAgB,WAAW,MAAM;OAEjC,iBAAgB;QAGlB,OAAM,IAAI,MAAM,sDAAsD;AAExE,SAAO;UACA,OAAO;AACd,QAAO,MAA4B,SAAS,qCACxC,IAAI,MAAM,4BAA4B,GACtC;;;AAIR,eAAsB,8BACpB,YACA,SACA;AAIA,QAHwB,MAAM,OAAO,SAAS,EAC5C,QAAQ,cACT,CAAC;;;AAKJ,SAAgB,oBACd,KACA,aAAa,UACK;CAClB,MAAM,mBAAqC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xC,EAAE;AAEH,SAAO;GACL,SAAS,KAAK;GACd,aAAa,KAAK;GAClB;GACA;GACA,SAAS,KAAK;GACd;GACA;GACD;;CAGH,MAAc,sBAAsB,SAAgC;AAClE,MAAI;AACF,SAAMC,KAAG,MAAM,SAAS,EAAE,WAAW,MAAM,CAAC;WACrC,KAAK;AACZ,WAAQ,MAAM,+BAA+B,WAAW,IAAI;AAC5D,SAAM"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["path","claudeTemplate","fs","path","fs"],"sources":["../src/codegen/utils.ts","../src/codegen/generate.ts","../src/codegen/kysely.ts","../src/create-lib/utils.ts","../src/create-lib/checkout-project.ts","../src/templates/boilerplate/document-models/upgrade-manifests.ts","../src/create-lib/create-project.ts","../src/ts-morph-generator/core/FileGenerator.ts","../src/ts-morph-generator/core/ReducerGenerator.ts","../src/ts-morph-generator/utilities/DeclarationManager.ts","../src/ts-morph-generator/utilities/DirectoryManager.ts","../src/ts-morph-generator/utilities/ImportManager.ts","../src/ts-morph-generator/core/TSMorphCodeGenerator.ts"],"sourcesContent":["import { pascalCase } from \"change-case\";\nimport type {\n DocumentModelDocument,\n DocumentModelGlobalState,\n} from \"@powerhousedao/shared/document-model\";\nimport { documentModelReducer } from \"@powerhousedao/shared/document-model\";\nimport { baseLoadFromFile } from \"document-model/node\";\nimport fs from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\nimport { format } from \"prettier\";\nimport type { DocumentTypesMap } from \"./types.js\";\n\nexport async function loadDocumentModel(\n path: string,\n): Promise<DocumentModelGlobalState> {\n let documentModel: DocumentModelGlobalState;\n try {\n if (!path) {\n throw new Error(\"Document model file not specified\");\n } else if (path.endsWith(\".zip\") || path.endsWith(\".phd\")) {\n const file = await baseLoadFromFile(path, documentModelReducer);\n documentModel = file.state.global;\n } else if (path.endsWith(\".json\")) {\n const data = await readFile(path, \"utf-8\");\n const parsedData = JSON.parse(data) as DocumentModelDocument;\n if (\"state\" in parsedData) {\n documentModel = parsedData.state.global;\n } else {\n documentModel = parsedData;\n }\n } else {\n throw new Error(\"File type not supported. Must be zip, phd, or json.\");\n }\n return documentModel;\n } catch (error) {\n throw (error as { code?: string }).code === \"MODULE_NOT_FOUND\"\n ? new Error(`Document model not found.`)\n : error;\n }\n}\n\nexport async function formatWithPrettierBeforeWrite(\n outputFile: string,\n content: string,\n) {\n const modifiedContent = await format(content, {\n parser: \"typescript\",\n });\n return modifiedContent;\n}\n\n/** returns map of document model id to document model name in pascal case and import path */\nexport function getDocumentTypesMap(\n dir: string,\n pathOrigin = \"../../\",\n): DocumentTypesMap {\n const documentTypesMap: DocumentTypesMap = {\n \"powerhouse/document-model\": {\n name: \"DocumentModel\",\n importPath: `document-model`,\n },\n };\n\n // add document types from provided dir\n if (fs.existsSync(dir)) {\n fs.readdirSync(dir, { withFileTypes: true })\n .filter((dirent) => dirent.isDirectory())\n .map((dirent) => dirent.name)\n .forEach((name) => {\n const specPath = resolve(dir, name, `${name}.json`);\n if (!fs.existsSync(specPath)) {\n return;\n }\n\n const specRaw = fs.readFileSync(specPath, \"utf-8\");\n try {\n const spec = JSON.parse(specRaw) as DocumentModelGlobalState;\n if (spec.id) {\n documentTypesMap[spec.id] = {\n name: pascalCase(name),\n importPath: join(pathOrigin, dir, name, \"index.js\"),\n };\n }\n } catch {\n console.error(`Failed to parse ${specPath}`);\n }\n });\n }\n\n return documentTypesMap;\n}\n","import {\n makeSubgraphsIndexFile,\n tsMorphGenerateApp,\n tsMorphGenerateDocumentEditor,\n tsMorphGenerateDocumentModel,\n tsMorphGenerateSubgraph,\n} from \"@powerhousedao/codegen/file-builders\";\nimport type {\n PartialPowerhouseManifest,\n PowerhouseManifest,\n} from \"@powerhousedao/shared\";\nimport { fileExists, type PowerhouseConfig } from \"@powerhousedao/shared/clis\";\nimport type { DocumentModelGlobalState } from \"@powerhousedao/shared/document-model\";\nimport type { ProcessorApps } from \"@powerhousedao/shared/processors\";\nimport { kebabCase } from \"change-case\";\nimport { getTsconfig } from \"get-tsconfig\";\nimport fs from \"node:fs\";\nimport { readdir, writeFile } from \"node:fs/promises\";\nimport path, { join } from \"node:path\";\nimport { readPackage, type NormalizedPackageJson } from \"read-pkg\";\nimport semver from \"semver\";\nimport {\n exportsTemplate,\n tsconfigPathsTemplate,\n tsConfigTemplate,\n} from \"templates\";\nimport { writePackage } from \"write-package\";\nimport { tsMorphGenerateProcessor } from \"../file-builders/processors/processor.js\";\nimport { generateSchemas } from \"./graphql.js\";\nimport type { CodegenOptions } from \"./types.js\";\nimport { loadDocumentModel } from \"./utils.js\";\n\nexport async function generateAll(args: {\n dir: string;\n useVersioning: boolean;\n migrateLegacy?: boolean;\n watch?: boolean;\n skipFormat?: boolean;\n verbose?: boolean;\n force?: boolean;\n}) {\n const {\n dir,\n useVersioning,\n migrateLegacy = false,\n watch = false,\n skipFormat = false,\n verbose = true,\n force = true,\n } = args;\n const files = await readdir(dir, { withFileTypes: true });\n const documentModelStates: DocumentModelGlobalState[] = [];\n\n for (const directory of files.filter((f) => f.isDirectory())) {\n const documentModelPath = path.join(\n dir,\n directory.name,\n `${directory.name}.json`,\n );\n const pathExists = await fileExists(documentModelPath);\n if (!pathExists) {\n continue;\n }\n\n try {\n const documentModelState = await loadDocumentModel(documentModelPath);\n documentModelStates.push(documentModelState);\n\n await generateDocumentModel({\n dir,\n documentModelState,\n watch,\n skipFormat,\n verbose,\n force,\n useVersioning,\n migrateLegacy,\n });\n } catch (error) {\n if (verbose) {\n console.error(directory.name, error);\n }\n }\n }\n}\n\nexport async function generate(\n config: PowerhouseConfig,\n useVersioning: boolean,\n migrateLegacy = false,\n) {\n const { skipFormat, watch } = config;\n await generateSchemas(config.documentModelsDir, { skipFormat, watch });\n await generateAll({\n dir: config.documentModelsDir,\n useVersioning,\n migrateLegacy,\n skipFormat,\n watch,\n });\n}\n\nexport async function generateFromFile(args: {\n path: string;\n config: PowerhouseConfig;\n useVersioning: boolean;\n migrateLegacy?: boolean;\n options?: CodegenOptions;\n}) {\n const { path, config, useVersioning, migrateLegacy, options } = args;\n // load document model spec from file\n const documentModelState = await loadDocumentModel(path);\n\n // delegate to shared generation function\n await generateFromDocumentModel({\n documentModelState,\n config,\n useVersioning,\n migrateLegacy,\n options,\n });\n}\n\n/**\n * Generates code from a DocumentModelGlobalState object directly.\n *\n * @remarks\n * This function performs the same code generation as generateFromFile but takes\n * a DocumentModelGlobalState object directly instead of loading from a file. This allows for\n * programmatic code generation without file I/O.\n *\n * @param documentModelDocument - The DocumentModelGlobalState object containing the document model\n * @param config - The PowerhouseConfig configuration object\n * @param options - Optional configuration for generation behavior (verbose logging, etc.)\n * @returns A promise that resolves when code generation is complete\n */\nexport async function generateFromDocument(args: {\n documentModelState: DocumentModelGlobalState;\n config: PowerhouseConfig;\n useVersioning: boolean;\n migrateLegacy?: boolean;\n options?: CodegenOptions;\n}) {\n // delegate to shared generation function\n await generateFromDocumentModel(args);\n}\n\ntype GenerateDocumentModelArgs = {\n dir: string;\n documentModelState: DocumentModelGlobalState;\n useVersioning: boolean;\n migrateLegacy?: boolean;\n watch?: boolean;\n skipFormat?: boolean;\n verbose?: boolean;\n force?: boolean;\n};\nexport async function generateDocumentModel(args: GenerateDocumentModelArgs) {\n const { dir, documentModelState, useVersioning, migrateLegacy } = args;\n const packageJson = await readPackage();\n const zodSemverString = findZodDependencyInPackageJson(packageJson);\n ensureZodVersionIsSufficient(zodSemverString);\n\n const projectDir = path.dirname(dir);\n await tsMorphGenerateDocumentModel({\n projectDir,\n documentModelState,\n useVersioning,\n migrateLegacy,\n });\n // await ensurePackageExportsWildcards();\n // await ensureTsconfigPaths();\n}\n\n/**\n * Ensures that the project's package.json exports field contains the\n * wildcard subpath patterns required for deep imports like\n * \"document-models/my-doc\" to resolve correctly.\n */\nasync function ensurePackageExportsWildcards() {\n const requiredExports = JSON.parse(`{ ${exportsTemplate} }`) as Record<\n string,\n string\n >;\n\n const packageJson = await readPackage();\n\n const existingExports =\n !packageJson.exports ||\n typeof packageJson.exports === \"string\" ||\n Array.isArray(packageJson.exports)\n ? {}\n : packageJson.exports;\n\n packageJson.exports = {\n ...existingExports,\n ...requiredExports,\n };\n\n await writePackage(process.cwd(), packageJson);\n}\n\n/**\n * Ensures that the project's tsconfig.json has paths mappings for\n * the convenience export paths like \"document-models/\" etc.\n */\nasync function ensureTsconfigPaths() {\n const requiredTsConfigPaths = JSON.parse(\n `{ ${tsconfigPathsTemplate} }`,\n ) as Record<string, string[]>;\n const tsConfigFilePath = join(process.cwd(), \"tsconfig.json\");\n let tsConfig = getTsconfig();\n\n if (!tsConfig) {\n await writeFile(tsConfigFilePath, tsConfigTemplate);\n tsConfig = getTsconfig();\n }\n\n if (!tsConfig) {\n throw new Error(\n `Failed to get or create tsconfig.json at \"${tsConfigFilePath}\".`,\n );\n }\n\n const existingCompilerOptions = tsConfig.config.compilerOptions ?? {};\n const existingPaths = existingCompilerOptions.paths ?? {};\n\n tsConfig.config.compilerOptions = {\n ...existingCompilerOptions,\n paths: {\n ...existingPaths,\n ...requiredTsConfigPaths,\n },\n };\n\n await writeFile(tsConfigFilePath, JSON.stringify(tsConfig.config, null, 2));\n}\n\nfunction findZodDependencyInPackageJson(\n packageJson: NormalizedPackageJson,\n): string | undefined {\n const dependencies = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n const zodDependency = dependencies[\"zod\"];\n return zodDependency;\n}\n\nfunction ensureZodVersionIsSufficient(zodSemverString: string | undefined) {\n if (!zodSemverString) return;\n const cleaned = semver.clean(zodSemverString);\n if (!cleaned) return;\n const isSufficient = semver.gte(cleaned, \"4.0.0\");\n if (!isSufficient) {\n throw new Error(\n `Your version of zod \"${zodSemverString}\" is out of date. Please install zod version 4.x to continue.`,\n );\n }\n}\n\ntype GenerateEditorArgs = {\n editorName: string;\n documentTypes: string[];\n skipFormat?: boolean;\n editorId?: string;\n editorDirName?: string;\n};\nexport async function generateEditor(args: GenerateEditorArgs) {\n const {\n editorName,\n documentTypes,\n editorId: editorIdArg,\n editorDirName,\n } = args;\n\n const projectDir = path.dirname(\"editors\");\n\n if (documentTypes.length > 1) {\n throw new Error(\"Multiple document types are not supported yet\");\n }\n\n const documentModelId = documentTypes[0];\n const editorId = editorIdArg || kebabCase(editorName);\n const editorDir = editorDirName || kebabCase(editorName);\n\n await tsMorphGenerateDocumentEditor({\n projectDir,\n editorDir,\n documentModelId,\n editorName,\n editorId,\n });\n // await ensurePackageExportsWildcards();\n // await ensureTsconfigPaths();\n}\n\nexport async function generateApp(options: {\n appName: string;\n skipFormat?: boolean;\n appId?: string;\n allowedDocumentTypes?: string[];\n isDragAndDropEnabled?: boolean;\n appDirName?: string;\n}) {\n const {\n appName,\n appId,\n allowedDocumentTypes,\n isDragAndDropEnabled,\n appDirName,\n } = options;\n const dir = \"editors\";\n\n const projectDir = path.dirname(dir);\n\n await tsMorphGenerateApp({\n projectDir,\n editorDir: appDirName || kebabCase(appName),\n editorName: appName,\n editorId: appId ?? kebabCase(appName),\n allowedDocumentModelIds: allowedDocumentTypes ?? [],\n isDragAndDropEnabled: isDragAndDropEnabled ?? true,\n });\n}\n\nexport async function generateSubgraphFromDocumentModel(\n name: string,\n documentModel: DocumentModelGlobalState,\n config: PowerhouseConfig,\n) {\n await tsMorphGenerateSubgraph({\n subgraphsDir: config.subgraphsDir,\n subgraphName: name,\n documentModel,\n });\n await makeSubgraphsIndexFile({\n projectDir: path.dirname(config.subgraphsDir),\n });\n}\n\nexport async function generateSubgraph(\n name: string,\n file: string | null,\n config: PowerhouseConfig,\n) {\n const documentModelState =\n file !== null ? await loadDocumentModel(file) : null;\n\n await tsMorphGenerateSubgraph({\n subgraphsDir: config.subgraphsDir,\n subgraphName: name,\n documentModel: documentModelState,\n });\n await makeSubgraphsIndexFile({\n projectDir: path.dirname(config.subgraphsDir),\n });\n}\n\nexport async function generateProcessor(args: {\n processorName: string;\n processorType: \"analytics\" | \"relationalDb\";\n processorApps: ProcessorApps;\n documentTypes: string[];\n skipFormat?: boolean;\n rootDir?: string;\n}) {\n const { rootDir = process.cwd() } = args;\n return await tsMorphGenerateProcessor({\n rootDir,\n ...args,\n });\n}\n\nexport async function generateImportScript(\n _name: string,\n _config: PowerhouseConfig,\n) {\n throw new Error(\n \"Import script generation has been removed. The document-drive server APIs it depended on have been deprecated.\",\n );\n}\n\nconst defaultManifest: PowerhouseManifest = {\n name: \"\",\n description: \"\",\n category: \"\",\n publisher: {\n name: \"\",\n url: \"\",\n },\n documentModels: [],\n editors: [],\n apps: [],\n subgraphs: [],\n importScripts: [],\n};\n\nexport function generateManifest(\n manifestData: PartialPowerhouseManifest,\n projectRoot?: string,\n) {\n const rootDir = projectRoot || process.cwd();\n const manifestPath = join(rootDir, \"powerhouse.manifest.json\");\n\n // Create default manifest structure\n\n // Read existing manifest if it exists\n let existingManifest: PowerhouseManifest = defaultManifest;\n if (fs.existsSync(manifestPath)) {\n try {\n const existingData = fs.readFileSync(manifestPath, \"utf-8\");\n existingManifest = JSON.parse(existingData) as PowerhouseManifest;\n } catch (error) {\n console.warn(`Failed to parse existing manifest: ${String(error)}`);\n existingManifest = defaultManifest;\n }\n }\n\n // Helper function to merge arrays by ID\n const mergeArrayById = <T extends { id: string }>(\n existingArray: T[],\n newArray?: T[],\n ): T[] => {\n if (!newArray) return existingArray;\n\n const result = [...existingArray];\n\n newArray.forEach((newItem) => {\n const existingIndex = result.findIndex((item) => item.id === newItem.id);\n if (existingIndex !== -1) {\n // Replace existing item\n result[existingIndex] = newItem;\n } else {\n // Add new item\n result.push(newItem);\n }\n });\n\n return result;\n };\n\n // Merge partial data with existing manifest\n const updatedManifest: PowerhouseManifest = {\n ...existingManifest,\n ...manifestData,\n publisher: {\n ...existingManifest.publisher,\n ...(manifestData.publisher || {}),\n },\n documentModels: mergeArrayById(\n existingManifest.documentModels,\n manifestData.documentModels,\n ),\n editors: mergeArrayById(existingManifest.editors, manifestData.editors),\n apps: mergeArrayById(existingManifest.apps, manifestData.apps),\n subgraphs: mergeArrayById(\n existingManifest.subgraphs,\n manifestData.subgraphs,\n ),\n importScripts: mergeArrayById(\n existingManifest.importScripts,\n manifestData.importScripts,\n ),\n };\n\n // Write updated manifest to file\n fs.writeFileSync(manifestPath, JSON.stringify(updatedManifest, null, 4));\n\n return manifestPath;\n}\n\n/**\n * Generates code from a DocumentModelGlobalState.\n *\n * @remarks\n * This is the core generation function that both generateFromFile and generateFromDocument\n * use internally. It handles the actual code generation from a DocumentModelGlobalState object.\n *\n * @param documentModel - The DocumentModelGlobalState containing the document model specification\n * @param config - The PowerhouseConfig configuration object\n * @param options - Optional configuration for generation behavior\n * @returns A promise that resolves when code generation is complete\n */\nasync function generateFromDocumentModel(args: {\n documentModelState: DocumentModelGlobalState;\n config: PowerhouseConfig;\n useVersioning: boolean;\n migrateLegacy?: boolean;\n options?: CodegenOptions;\n}) {\n const {\n documentModelState,\n config,\n useVersioning,\n migrateLegacy,\n options = {},\n } = args;\n const {\n verbose = config.logLevel === \"verbose\" ||\n config.logLevel === \"debug\" ||\n config.logLevel === \"info\",\n force = false,\n } = options;\n const name = kebabCase(documentModelState.name);\n const documentModelDir = join(config.documentModelsDir, name);\n // create document model folder and spec as json\n fs.mkdirSync(documentModelDir, { recursive: true });\n fs.writeFileSync(\n join(documentModelDir, `${name}.json`),\n JSON.stringify(documentModelState, null, 2),\n );\n\n await generateDocumentModel({\n dir: config.documentModelsDir,\n documentModelState,\n watch: config.watch,\n skipFormat: config.skipFormat,\n verbose,\n force,\n useVersioning,\n migrateLegacy,\n });\n}\n","import { spawn } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { join, resolve } from \"node:path\";\n\nfunction getKyselyPgLiteBin(): string {\n const require = createRequire(import.meta.url);\n\n const paths = require.resolve.paths(\"kysely-pglite\");\n if (paths) {\n for (const basePath of paths) {\n const pkgRoot = join(basePath, \"kysely-pglite\");\n const binPath = join(pkgRoot, \"bin/run.js\");\n\n if (existsSync(binPath)) {\n return binPath;\n }\n }\n }\n\n throw new Error(\"Could not find kysely-pglite/bin/run.js\");\n}\n\nexport interface IOptions {\n migrationFile: string;\n schemaFile?: string;\n}\n\nfunction runCommand(\n command: string,\n args: string[],\n cwd?: string,\n): Promise<void> {\n return new Promise((resolve, reject) => {\n const child = spawn(command, args, {\n cwd,\n stdio: \"inherit\",\n shell: true,\n });\n\n child.on(\"close\", (code) => {\n if (code === 0) {\n resolve();\n } else {\n reject(new Error(`Command failed with exit code ${code}`));\n }\n });\n\n child.on(\"error\", (error) => {\n reject(error);\n });\n });\n}\n\nexport async function generateDBSchema({\n migrationFile,\n schemaFile,\n}: IOptions) {\n const outFile = schemaFile ?? resolve(migrationFile, \"../schema.ts\");\n\n try {\n const kyselyBinPath = getKyselyPgLiteBin();\n // Use kysely-pglite CLI to handle TypeScript compilation and module resolution\n await runCommand(\n \"node\",\n [kyselyBinPath, migrationFile, \"--outFile\", outFile],\n process.cwd(),\n );\n\n console.log(`Schema types generated at ${outFile}`);\n } catch (error) {\n console.error(\"Error running migration:\", error);\n }\n}\n","import { execSync } from \"child_process\";\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\nconst packageManagers = [\"npm\", \"yarn\", \"pnpm\", \"bun\"] as const;\nconst defaultPackageManager = \"npm\";\n\nexport type PackageManager = (typeof packageManagers)[number];\n\nexport function getPackageManager(userAgent?: string): PackageManager {\n if (!userAgent) {\n return defaultPackageManager;\n }\n\n const pkgSpec = userAgent.split(\" \")[0];\n const pkgSpecArr = pkgSpec.split(\"/\");\n const name = pkgSpecArr[0];\n\n if (packageManagers.includes(name as PackageManager)) {\n return name as PackageManager;\n } else {\n return defaultPackageManager;\n }\n}\n\nexport const envPackageManager = getPackageManager(\n process.env.npm_config_user_agent,\n);\n\nexport function runCmd(command: string) {\n try {\n execSync(command, { stdio: \"inherit\" });\n } catch (error) {\n console.log(\"\\x1b[31m\", error, \"\\x1b[0m\");\n throw error;\n }\n}\n\nexport async function writeFileEnsuringDir(\n filePath: string,\n contents: string | Buffer,\n) {\n await mkdir(dirname(filePath), { recursive: true });\n await writeFile(filePath, contents, { encoding: \"utf-8\" });\n}\n","import path from \"node:path\";\nimport { runCmd } from \"./utils.js\";\n\n/**\n * Clones a git repository and returns the path to the cloned project.\n * @param repositoryUrl - The URL of the git repository to clone\n * @returns The absolute path to the cloned project directory\n */\nexport function cloneRepository(repositoryUrl: string): string {\n try {\n console.log(\n \"\\x1b[33m\",\n `Cloning repository from ${repositoryUrl}...`,\n \"\\x1b[0m\",\n );\n runCmd(`git clone ${repositoryUrl}`);\n\n // Extract project name from repository URL\n // e.g., https://github.com/org/repo.git -> repo\n const repoName = repositoryUrl\n .split(\"/\")\n .pop()\n ?.replace(/\\.git$/, \"\");\n\n if (!repoName) {\n throw new Error(\"Could not determine project name from repository URL\");\n }\n\n const projectPath = path.join(process.cwd(), repoName);\n return projectPath;\n } catch (error) {\n console.log(error);\n throw error;\n }\n}\n\n/**\n * Installs dependencies in a project directory using the specified package manager.\n * @param projectPath - The absolute path to the project directory\n * @param packageManager - The package manager to use (npm, pnpm, yarn, bun)\n */\nexport function installDependencies(\n projectPath: string,\n packageManager: string,\n): void {\n try {\n process.chdir(projectPath);\n\n console.log(\n \"\\x1b[34m\",\n `Installing dependencies with ${packageManager}...`,\n \"\\x1b[0m\",\n );\n runCmd(`${packageManager} install --loglevel error`);\n\n console.log(\"\\x1b[32m\", \"Dependencies installed successfully!\", \"\\x1b[0m\");\n console.log();\n } catch (error) {\n console.log(error);\n throw error;\n }\n}\n","import { ts } from \"@tmpl/core\";\n\nexport const upgradeManifestsTemplate = ts`\nimport type { UpgradeManifest } from \"document-model\";\n\nexport const upgradeManifests: UpgradeManifest<readonly number[]>[] = [];\n`.raw;\n","import chalk from \"chalk\";\nimport { buildBoilerplatePackageJson } from \"file-builders\";\nimport fs from \"node:fs\";\nimport path from \"path\";\nimport {\n agentsTemplate,\n buildPowerhouseConfigTemplate,\n claudeSettingsLocalTemplate,\n claudeTemplate,\n connectEntrypointTemplate,\n cursorMcpTemplate,\n dockerfileTemplate,\n documentModelsIndexTemplate,\n documentModelsTemplate,\n editorsIndexTemplate,\n editorsTemplate,\n eslintConfigTemplate,\n factoryBuildersTemplate,\n geminiSettingsTemplate,\n gitIgnoreTemplate,\n indexHtmlTemplate,\n indexTsTemplate,\n licenseTemplate,\n mainTsxTemplate,\n mcpTemplate,\n nginxConfTemplate,\n npmrcTemplate,\n powerhouseManifestTemplate,\n processorsFactoryTemplate,\n processorsIndexTemplate,\n readmeTemplate,\n styleTemplate,\n subgraphsIndexTemplate,\n switchboardEntrypointTemplate,\n syncAndPublishWorkflowTemplate,\n tsConfigTemplate,\n vitestConfigTemplate,\n} from \"templates\";\nimport { runPrettier } from \"utils\";\nimport { upgradeManifestsTemplate } from \"../templates/boilerplate/document-models/upgrade-manifests.js\";\nimport { runCmd, writeFileEnsuringDir } from \"./utils.js\";\ntype CreateProjectArgs = {\n name: string;\n packageManager: string;\n tag?: string;\n version?: string;\n remoteDrive?: string;\n skipGitInit?: boolean;\n skipInstall?: boolean;\n};\nexport async function createProject({\n name,\n packageManager,\n tag,\n version,\n remoteDrive,\n skipGitInit,\n skipInstall,\n}: CreateProjectArgs) {\n const appPath = path.join(process.cwd(), name);\n\n try {\n fs.mkdirSync(appPath);\n } catch (err) {\n if ((err as { code: string }).code === \"EEXIST\") {\n console.error(\n `⛔ The folder \"${name}\" already exists in the current directory, please give it another name.`,\n );\n } else {\n console.error(err);\n }\n process.exit(1);\n }\n\n try {\n // Create a new directory for the project\n console.log(chalk.blue(`▶️ Creating directory for project \"${name}\"...\\n`));\n const appPath = path.join(process.cwd(), name);\n process.chdir(appPath);\n console.log(chalk.green(`✅ Project directory created\\n`));\n\n await writeFileEnsuringDir(\".gitignore\", gitIgnoreTemplate);\n if (!skipGitInit) {\n // Create a .gitignore file, then initialize the git repository\n console.log(chalk.blue(`▶️ Initializing git repository...\\n`));\n runCmd(`git init`);\n console.log(chalk.green(`\\n✅ Git repository initialized\\n`));\n }\n\n // Write the boilerplate files for the project\n console.log(chalk.blue(`▶️ Creating project boilerplate files...\\n`));\n await writeProjectRootFiles({ name, tag, version, remoteDrive });\n await writeModuleFiles();\n await writeAiConfigFiles();\n await writeCIFiles();\n console.log(chalk.green(`✅ Project boilerplate files created\\n`));\n\n if (!skipInstall) {\n // Install the project dependencies with the specified package manager\n console.log(\n chalk.blue(\n `▶️ Installing project dependencies with ${packageManager}...\\n`,\n ),\n );\n runCmd(`${packageManager} install`);\n console.log(chalk.green(`\\n✅ Project dependencies installed\\n`));\n }\n\n // Use the installed version of `prettier` to format the generated code\n console.log(chalk.blue(`▶️ Formatting boilerplate project files...\\n`));\n await runPrettier();\n console.log(chalk.green(`✅ Boilerplate files formatted\\n`));\n\n // Project creation complete\n console.log(chalk.bold(`🎉 Successfully created project \"${name}\" 🎉\\n`));\n } catch (error) {\n console.error(error);\n process.exit(1);\n }\n}\n\nasync function writeProjectRootFiles(args: {\n name: string;\n tag?: string;\n version?: string;\n remoteDrive?: string;\n}) {\n const { name, tag, version, remoteDrive } = args;\n await writeFileEnsuringDir(\"LICENSE\", licenseTemplate);\n await writeFileEnsuringDir(\"README.md\", readmeTemplate);\n await writeFileEnsuringDir(\".npmrc\", npmrcTemplate);\n const packageJson = await buildBoilerplatePackageJson({\n name,\n tag,\n version,\n });\n const powerhouseManifest = powerhouseManifestTemplate(name);\n await writeFileEnsuringDir(\"powerhouse.manifest.json\", powerhouseManifest);\n const powerhouseConfig = await buildPowerhouseConfigTemplate({\n tag,\n version,\n remoteDrive,\n });\n await writeFileEnsuringDir(\"powerhouse.config.json\", powerhouseConfig);\n await writeFileEnsuringDir(\"package.json\", packageJson);\n await writeFileEnsuringDir(\"tsconfig.json\", tsConfigTemplate);\n await writeFileEnsuringDir(\"index.html\", indexHtmlTemplate);\n await writeFileEnsuringDir(\"main.tsx\", mainTsxTemplate);\n await writeFileEnsuringDir(\"eslint.config.js\", eslintConfigTemplate);\n await writeFileEnsuringDir(\"index.ts\", indexTsTemplate);\n await writeFileEnsuringDir(\"style.css\", styleTemplate);\n await writeFileEnsuringDir(\"vitest.config.ts\", vitestConfigTemplate);\n}\n\nasync function writeModuleFiles() {\n await writeFileEnsuringDir(\n \"document-models/document-models.ts\",\n documentModelsTemplate,\n );\n await writeFileEnsuringDir(\n \"document-models/index.ts\",\n documentModelsIndexTemplate,\n );\n await writeFileEnsuringDir(\n \"document-models/upgrade-manifests.ts\",\n upgradeManifestsTemplate,\n );\n await writeFileEnsuringDir(\"editors/editors.ts\", editorsTemplate);\n await writeFileEnsuringDir(\"editors/index.ts\", editorsIndexTemplate);\n await writeFileEnsuringDir(\n \"processors/factory.ts\",\n processorsFactoryTemplate,\n );\n await writeFileEnsuringDir(\"processors/index.ts\", processorsIndexTemplate);\n await writeFileEnsuringDir(\"processors/connect.ts\", factoryBuildersTemplate);\n await writeFileEnsuringDir(\n \"processors/switchboard.ts\",\n factoryBuildersTemplate,\n );\n await writeFileEnsuringDir(\"subgraphs/index.ts\", subgraphsIndexTemplate);\n await writeFileEnsuringDir(\"processors/index.ts\", processorsIndexTemplate);\n}\n\nasync function writeAiConfigFiles() {\n await writeFileEnsuringDir(\"CLAUDE.md\", claudeTemplate);\n await writeFileEnsuringDir(\"AGENTS.md\", agentsTemplate);\n await writeFileEnsuringDir(\".mcp.json\", mcpTemplate);\n await writeFileEnsuringDir(\".gemini/settings.json\", geminiSettingsTemplate);\n await writeFileEnsuringDir(\".cursor/mcp.json\", cursorMcpTemplate);\n await writeFileEnsuringDir(\n \".claude/settings.local.json\",\n claudeSettingsLocalTemplate,\n );\n}\n\nasync function writeCIFiles() {\n await writeFileEnsuringDir(\n \".github/workflows/sync-and-publish.yml\",\n syncAndPublishWorkflowTemplate,\n );\n await writeFileEnsuringDir(\"Dockerfile\", dockerfileTemplate);\n await writeFileEnsuringDir(\"docker/nginx.conf\", nginxConfTemplate);\n await writeFileEnsuringDir(\n \"docker/connect-entrypoint.sh\",\n connectEntrypointTemplate,\n );\n await writeFileEnsuringDir(\n \"docker/switchboard-entrypoint.sh\",\n switchboardEntrypointTemplate,\n );\n}\n","import type { DeclarationManager } from \"../utilities/DeclarationManager.js\";\nimport type { DirectoryManager } from \"../utilities/DirectoryManager.js\";\nimport type { ImportManager } from \"../utilities/ImportManager.js\";\nimport type { GenerationContext } from \"./GenerationContext.js\";\n\nexport abstract class FileGenerator {\n constructor(\n protected importManager: ImportManager,\n protected directoryManager: DirectoryManager,\n protected declarationManager: DeclarationManager,\n ) {}\n\n abstract generate(context: GenerationContext): Promise<void>;\n}\n","import { camelCase, kebabCase, pascalCase } from \"change-case\";\nimport type { OperationErrorSpecification } from \"@powerhousedao/shared/document-model\";\nimport type {\n MethodDeclaration,\n ObjectLiteralExpression,\n SourceFile,\n} from \"ts-morph\";\nimport { SyntaxKind, VariableDeclarationKind } from \"ts-morph\";\nimport { FileGenerator } from \"./FileGenerator.js\";\nimport type {\n CodegenOperation,\n GenerationContext,\n} from \"./GenerationContext.js\";\n\nexport class ReducerGenerator extends FileGenerator {\n async generate(context: GenerationContext): Promise<void> {\n // Skip if no actions to generate\n if (context.operations.length === 0) return;\n\n const filePath = this.getOutputPath(context);\n const sourceFile = await this.directoryManager.createSourceFile(\n context.project,\n filePath,\n );\n\n const packageName = context.packageName;\n // Reducer-specific import logic\n const typeImportName = `${pascalCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;\n const typeImportPath = `${packageName}/document-models/${kebabCase(context.docModel.name)}`;\n\n // Import management (shared utility)\n this.importManager.replaceImportByName(\n sourceFile,\n typeImportName,\n typeImportPath,\n true,\n );\n\n // AST logic (specific to reducers)\n this.createReducerObject(sourceFile, typeImportName, context);\n\n // Detect and import error classes used in the actual reducer code (after generation)\n this.addErrorImports(sourceFile, context);\n\n await sourceFile.save();\n }\n\n private static getDefaultReducerCode(methodName: string): string[] {\n return [\n `// TODO: Implement \"${methodName}\" reducer`,\n `throw new Error('Reducer \"${methodName}\" not yet implemented');`,\n ];\n }\n\n private addErrorImports(\n sourceFile: SourceFile,\n context: GenerationContext,\n ): void {\n // Collect all errors from all operations\n const allErrors: OperationErrorSpecification[] = [];\n\n context.operations.forEach((operation) => {\n if (Array.isArray(operation.errors)) {\n operation.errors\n .filter((error) => error.name)\n .forEach((error) => {\n // Deduplicate errors by name\n if (!allErrors.find((e) => e.name === error.name)) {\n allErrors.push(error);\n }\n });\n }\n });\n\n if (allErrors.length === 0) return;\n\n // Analyze the actual source file content to find which errors are used\n const sourceFileContent = sourceFile.getFullText();\n const usedErrors = new Set<string>();\n\n allErrors.forEach((error) => {\n // Check if error class name is mentioned anywhere in the source file\n // Look for patterns like \"new ErrorName\" or \"throw ErrorName\" or \"ErrorName(\"\n const errorPattern = new RegExp(`\\\\b${error.name}\\\\b`, \"g\");\n if (errorPattern.test(sourceFileContent)) {\n usedErrors.add(error.name!);\n }\n });\n\n // Add imports for used errors (only if they're not already imported)\n if (usedErrors.size > 0) {\n const errorImportPath = `../../gen/${kebabCase(context.module.name)}/error.js`;\n const errorClassNames = Array.from(usedErrors);\n\n // Check if imports already exist to avoid duplicates\n const existingImports = sourceFile.getImportDeclarations();\n const existingErrorImport = existingImports.find(\n (importDecl) =>\n importDecl.getModuleSpecifierValue() === errorImportPath,\n );\n\n if (existingErrorImport) {\n // Get already imported error names\n const existingNamedImports = existingErrorImport\n .getNamedImports()\n .map((namedImport) => namedImport.getName());\n\n // Only import errors that aren't already imported\n const newErrorsToImport = errorClassNames.filter(\n (errorName) => !existingNamedImports.includes(errorName),\n );\n\n if (newErrorsToImport.length > 0) {\n // Add new named imports to existing import declaration\n existingErrorImport.addNamedImports(newErrorsToImport);\n }\n } else {\n // Create new import declaration\n this.importManager.addNamedImports(\n sourceFile,\n errorClassNames,\n errorImportPath,\n );\n }\n }\n }\n\n private getOutputPath(context: GenerationContext): string {\n return this.directoryManager.getReducerPath(\n context.rootDir,\n context.docModel.name,\n context.module.name,\n );\n }\n\n private createReducerObject(\n sourceFile: SourceFile,\n typeName: string,\n context: GenerationContext,\n ): void {\n const { operations, forceUpdate } = context;\n const operationHandlersObjectName = `${camelCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;\n const legacyReducerVar = sourceFile.getVariableDeclaration(\"reducer\");\n if (legacyReducerVar) {\n this.declarationManager.renameVariable(\n sourceFile,\n \"reducer\",\n operationHandlersObjectName,\n );\n }\n let reducerVar = sourceFile.getVariableDeclaration(\n operationHandlersObjectName,\n );\n if (!reducerVar) {\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: operationHandlersObjectName,\n type: typeName,\n initializer: \"{}\",\n },\n ],\n });\n reducerVar = sourceFile.getVariableDeclarationOrThrow(\n operationHandlersObjectName,\n );\n } else {\n // Ensure correct type\n const typeNode = reducerVar.getTypeNode();\n if (!typeNode || typeNode.getText() !== typeName) {\n reducerVar.setType(typeName);\n }\n }\n\n const initializer = reducerVar.getInitializerIfKindOrThrow(\n SyntaxKind.ObjectLiteralExpression,\n );\n\n for (const operation of operations) {\n this.addReducerMethod(initializer, operation, forceUpdate);\n }\n }\n\n private addReducerMethod(\n objectLiteral: ObjectLiteralExpression,\n operation: CodegenOperation,\n forceUpdate = false,\n ): void {\n const actionName = camelCase(operation.name ?? \"\");\n if (!actionName) return;\n\n const methodName = `${actionName}Operation`;\n\n const reducerCode = operation.reducer?.trim();\n\n const existingReducer = objectLiteral\n .getProperty(methodName)\n ?.asKind(SyntaxKind.MethodDeclaration);\n\n // if reducer already exists but forceUpdate is true, update it\n if (existingReducer) {\n if (forceUpdate && reducerCode) {\n existingReducer.setBodyText(\"\");\n this.setReducerMethodCode(existingReducer, reducerCode);\n }\n return;\n }\n\n // if reducer doesn't exist, create it and set the code with the default code if no code is provided\n const method = objectLiteral.addMethod({\n name: methodName,\n parameters: [{ name: \"state\" }, { name: \"action\" }],\n });\n this.setReducerMethodCode(method, reducerCode);\n }\n\n private setReducerMethodCode(reducer: MethodDeclaration, code?: string) {\n reducer.addStatements(\n code ? [code] : ReducerGenerator.getDefaultReducerCode(reducer.getName()),\n );\n }\n}\n","import type { SourceFile } from \"ts-morph\";\n\nexport class DeclarationManager {\n renameVariable(\n sourceFile: SourceFile,\n oldName: string,\n newName: string,\n ): void {\n const variable = sourceFile.getVariableDeclaration(oldName);\n\n if (variable) {\n variable.getNameNode().replaceWithText(newName);\n sourceFile.saveSync();\n }\n }\n}\n","import type { PHProjectDirectories } from \"@powerhousedao/codegen\";\nimport { kebabCase, pascalCase } from \"change-case\";\nimport fs from \"fs/promises\";\nimport path from \"path\";\nimport type { Project, SourceFile } from \"ts-morph\";\n\nexport class DirectoryManager {\n private directories: Required<PHProjectDirectories> = {\n documentModelDir: \"document-model\",\n editorsDir: \"editors\",\n processorsDir: \"processors\",\n subgraphsDir: \"subgraphs\",\n };\n\n constructor(directories: PHProjectDirectories = {}) {\n this.directories = {\n ...this.directories,\n ...directories,\n };\n }\n async ensureExists(dirPath: string): Promise<void> {\n try {\n await fs.mkdir(dirPath, { recursive: true });\n } catch (err) {\n console.error(`Failed to create directory: ${dirPath}`, err);\n throw err;\n }\n }\n\n // Path builders for different file types\n getReducerPath(\n rootDir: string,\n docModelName: string,\n moduleName: string,\n ): string {\n return path.join(\n rootDir,\n this.directories.documentModelDir,\n kebabCase(docModelName),\n \"src\",\n \"reducers\",\n `${kebabCase(moduleName)}.ts`,\n );\n }\n\n getActionsPath(\n rootDir: string,\n docModelName: string,\n moduleName: string,\n ): string {\n return path.join(\n rootDir,\n this.directories.documentModelDir,\n kebabCase(docModelName),\n \"src\",\n \"actions\",\n `${kebabCase(moduleName)}.ts`,\n );\n }\n\n getComponentPath(\n rootDir: string,\n docModelName: string,\n componentName: string,\n ): string {\n return path.join(\n rootDir,\n this.directories.documentModelDir,\n kebabCase(docModelName),\n \"src\",\n \"components\",\n `${pascalCase(componentName)}.tsx`,\n );\n }\n\n getTypesPath(rootDir: string, docModelName: string): string {\n return path.join(\n rootDir,\n this.directories.documentModelDir,\n kebabCase(docModelName),\n \"src\",\n \"types.ts\",\n );\n }\n\n async createSourceFile(\n project: Project,\n filePath: string,\n ): Promise<SourceFile> {\n await this.ensureExists(path.dirname(filePath));\n return (\n project.addSourceFileAtPathIfExists(filePath) ??\n project.createSourceFile(filePath, \"\", { overwrite: false })\n );\n }\n}\n","import type { ImportDeclaration, SourceFile } from \"ts-morph\";\n\nexport interface ImportSpec {\n moduleSpecifier: string;\n namedImports?: string[];\n defaultImport?: string;\n isTypeOnly?: boolean;\n}\n\nexport class ImportManager {\n addImport(sourceFile: SourceFile, spec: ImportSpec): void {\n // Check if import already exists\n const existing = sourceFile.getImportDeclaration(\n (imp) => imp.getFullText() === spec.moduleSpecifier,\n );\n if (existing) {\n this.mergeImports(existing, spec);\n } else {\n sourceFile.addImportDeclaration(spec);\n }\n }\n\n addTypeImport(sourceFile: SourceFile, typeName: string, path: string): void {\n this.addImport(sourceFile, {\n moduleSpecifier: path,\n namedImports: [typeName],\n isTypeOnly: true,\n });\n }\n\n addNamedImports(\n sourceFile: SourceFile,\n imports: string[],\n path: string,\n ): void {\n this.addImport(sourceFile, {\n moduleSpecifier: path,\n namedImports: imports,\n });\n }\n\n private mergeImports(\n existingImport: ImportDeclaration,\n newSpec: ImportSpec,\n ): void {\n // Logic to merge named imports if they don't already exist\n if (newSpec.namedImports) {\n const existingNames = existingImport\n .getNamedImports()\n .map((ni) => ni.getName());\n const newNames = newSpec.namedImports.filter(\n (name) => !existingNames.includes(name),\n );\n\n if (newNames.length > 0) {\n existingImport.addNamedImports(newNames);\n }\n }\n }\n\n replaceImportByName(\n sourceFile: SourceFile,\n name: string,\n path: string,\n isTypeOnly = false,\n ): void {\n const existing = sourceFile\n .getImportDeclarations()\n .filter((imp) =>\n imp.getNamedImports().find((ni) => ni.getName() === name),\n );\n existing.forEach((imp) => imp.remove());\n sourceFile.addImportDeclaration({\n moduleSpecifier: path,\n namedImports: [name],\n isTypeOnly,\n });\n sourceFile.saveSync();\n }\n}\n","import type {\n DocumentModelGlobalState,\n ModuleSpecification,\n} from \"@powerhousedao/shared/document-model\";\nimport fs from \"fs/promises\";\nimport { Project } from \"ts-morph\";\nimport { DeclarationManager } from \"../utilities/DeclarationManager.js\";\nimport { DirectoryManager } from \"../utilities/DirectoryManager.js\";\nimport { ImportManager } from \"../utilities/ImportManager.js\";\nimport type { FileGenerator } from \"./FileGenerator.js\";\nimport type {\n CodeGeneratorOptions,\n CodegenOperation,\n GenerationContext,\n PHProjectDirectories,\n} from \"./GenerationContext.js\";\nimport { ReducerGenerator } from \"./ReducerGenerator.js\";\n\nexport class TSMorphCodeGenerator {\n private project = new Project();\n private generators = new Map<string, FileGenerator>();\n private directories: PHProjectDirectories = {\n documentModelDir: \"document-model\",\n editorsDir: \"editors\",\n processorsDir: \"processors\",\n subgraphsDir: \"subgraphs\",\n };\n private forceUpdate = false;\n\n constructor(\n private rootDir: string,\n private docModels: DocumentModelGlobalState[],\n private packageName: string,\n options: CodeGeneratorOptions = { directories: {}, forceUpdate: false },\n ) {\n this.directories = {\n ...this.directories,\n ...options.directories,\n };\n this.packageName = packageName;\n this.forceUpdate = options.forceUpdate ?? false;\n\n this.setupGenerators();\n }\n\n private setupGenerators(): void {\n const importManager = new ImportManager();\n const directoryManager = new DirectoryManager(this.directories);\n const declarationManager = new DeclarationManager();\n // Register all generators\n this.generators.set(\n \"reducers\",\n new ReducerGenerator(importManager, directoryManager, declarationManager),\n );\n }\n\n // Generate specific file types\n async generateReducers(): Promise<void> {\n await this.generateFileType(\"reducers\");\n }\n\n // Generate everything\n async generateAll(): Promise<void> {\n for (const [type] of this.generators) {\n await this.generateFileType(type);\n }\n }\n\n private async generateFileType(type: string): Promise<void> {\n const generator = this.generators.get(type);\n if (!generator) {\n throw new Error(`No generator registered for type: ${type}`);\n }\n\n await this.setupProject();\n\n for (const docModel of this.docModels) {\n const latestSpec =\n docModel.specifications[docModel.specifications.length - 1];\n\n for (const module of latestSpec.modules) {\n const context = this.createGenerationContext(\n docModel,\n module,\n this.forceUpdate,\n );\n\n await generator.generate(context);\n }\n }\n }\n\n private async setupProject(): Promise<void> {\n // Only load files from configured directories\n const sourcePaths: string[] = [];\n\n if (this.directories.documentModelDir) {\n const dirPath = `${this.rootDir}/${this.directories.documentModelDir}`;\n await this.ensureDirectoryExists(dirPath);\n sourcePaths.push(`${dirPath}/**/*.ts`);\n }\n if (this.directories.editorsDir) {\n const dirPath = `${this.rootDir}/${this.directories.editorsDir}`;\n await this.ensureDirectoryExists(dirPath);\n sourcePaths.push(`${dirPath}/**/*.ts`);\n }\n if (this.directories.processorsDir) {\n const dirPath = `${this.rootDir}/${this.directories.processorsDir}`;\n await this.ensureDirectoryExists(dirPath);\n sourcePaths.push(`${dirPath}/**/*.ts`);\n }\n if (this.directories.subgraphsDir) {\n const dirPath = `${this.rootDir}/${this.directories.subgraphsDir}`;\n await this.ensureDirectoryExists(dirPath);\n sourcePaths.push(`${dirPath}/**/*.ts`);\n }\n\n // Exclude node_modules from all paths\n sourcePaths.push(`!${this.rootDir}/**/node_modules/**`);\n\n if (sourcePaths.length > 0) {\n this.project.addSourceFilesAtPaths(sourcePaths);\n }\n }\n\n private createGenerationContext(\n docModel: DocumentModelGlobalState,\n module: ModuleSpecification,\n forceUpdate = false,\n ): GenerationContext {\n const operations: CodegenOperation[] = module.operations.map((op) => ({\n ...op,\n hasInput: op.schema !== null,\n hasAttachment: op.schema?.includes(\": Attachment\"),\n scope: op.scope || \"global\",\n state: op.scope === \"global\" ? \"\" : op.scope,\n }));\n\n return {\n rootDir: this.rootDir,\n packageName: this.packageName,\n docModel,\n module,\n project: this.project,\n operations,\n forceUpdate,\n };\n }\n\n private async ensureDirectoryExists(dirPath: string): Promise<void> {\n try {\n await fs.mkdir(dirPath, { recursive: true });\n } catch (err) {\n console.error(`Failed to create directory: ${dirPath}`, err);\n throw err;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAaA,eAAsB,kBACpB,MACmC;CACnC,IAAI;AACJ,KAAI;AACF,MAAI,CAAC,KACH,OAAM,IAAI,M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sBAAsB,QAAQ;AACzC,eAAY,KAAK,GAAG,QAAQ,UAAU;;AAExC,MAAI,KAAK,YAAY,cAAc;GACjC,MAAM,UAAU,GAAG,KAAK,QAAQ,GAAG,KAAK,YAAY;AACpD,SAAM,KAAK,sBAAsB,QAAQ;AACzC,eAAY,KAAK,GAAG,QAAQ,UAAU;;AAIxC,cAAY,KAAK,IAAI,KAAK,QAAQ,qBAAqB;AAEvD,MAAI,YAAY,SAAS,EACvB,MAAK,QAAQ,sBAAsB,YAAY;;CAInD,wBACE,UACA,QACA,cAAc,OACK;EACnB,MAAM,aAAiC,OAAO,WAAW,KAAK,QAAQ;GACpE,GAAG;GACH,UAAU,GAAG,WAAW;GACxB,eAAe,GAAG,QAAQ,SAAS,eAAe;GAClD,OAAO,GAAG,SAAS;GACnB,OAAO,GAAG,UAAU,WAAW,KAAK,GAAG;GACxC,EAAE;AAEH,SAAO;GACL,SAAS,KAAK;GACd,aAAa,KAAK;GAClB;GACA;GACA,SAAS,KAAK;GACd;GACA;GACD;;CAGH,MAAc,sBAAsB,SAAgC;AAClE,MAAI;AACF,SAAMC,KAAG,MAAM,SAAS,EAAE,WAAW,MAAM,CAAC;WACrC,KAAK;AACZ,WAAQ,MAAM,+BAA+B,WAAW,IAAI;AAC5D,SAAM"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as CommonMakeEditorComponentArgs, c as DocumentModelOperationsModuleVariableNames, d as DocumentModelVariableNames, f as EditorVariableNames, i as CommonGenerateEditorArgs, l as DocumentModelTemplateInputs, m as HelpTopic, n as CommandEntry, o as DocumentModelDocumentTypeMetadata, p as GenerateDocumentModelArgs, r as CommandHelpInfo, s as DocumentModelFileMakerArgs, t as ActionFromOperation, u as DocumentModelTemplateInputsWithModule } from "../../types-e2ztuDtG.mjs";
|
|
2
|
-
import { _ as
|
|
3
|
-
export { ActionFromOperation, CommandEntry, CommandHelpInfo, CommonGenerateEditorArgs, CommonMakeEditorComponentArgs, DocumentModelDocumentTypeMetadata, DocumentModelFileMakerArgs, DocumentModelOperationsModuleVariableNames, DocumentModelTemplateInputs, DocumentModelTemplateInputsWithModule, DocumentModelVariableNames, EditorVariableNames, GenerateDocumentModelArgs, HelpTopic, buildBoilerplatePackageJson, getCommandHelpInfo, getCommandsHelpInfo, makeCliDocsFromHelp, makeDocumentModelModulesFile, makeEditorModuleFile, makeEditorsModulesFile, makeLegacyIndexFile, makeModulesFile, makeSubgraphsIndexFile, makeUpgradeManifestsExport, makeUpgradeManifestsFile, tsMorphGenerateDocumentEditor, tsMorphGenerateDocumentModel,
|
|
2
|
+
import { _ as buildBoilerplatePackageJson, a as makeEditorsModulesFile, c as makeUpgradeManifestsFile, d as tsMorphGenerateDocumentModel, f as tsMorphGenerateDocumentEditor, g as writeCliDocsMarkdownFile, h as makeCliDocsFromHelp, i as makeDocumentModelModulesFile, l as makeLegacyIndexFile, m as getCommandsHelpInfo, n as tsMorphGenerateSubgraph, o as makeModulesFile, p as getCommandHelpInfo, r as tsMorphGenerateProcessor, s as makeUpgradeManifestsExport, t as makeSubgraphsIndexFile, u as makeEditorModuleFile, v as tsMorphGenerateApp } from "../../index-CHAnPBj2.mjs";
|
|
3
|
+
export { ActionFromOperation, CommandEntry, CommandHelpInfo, CommonGenerateEditorArgs, CommonMakeEditorComponentArgs, DocumentModelDocumentTypeMetadata, DocumentModelFileMakerArgs, DocumentModelOperationsModuleVariableNames, DocumentModelTemplateInputs, DocumentModelTemplateInputsWithModule, DocumentModelVariableNames, EditorVariableNames, GenerateDocumentModelArgs, HelpTopic, buildBoilerplatePackageJson, getCommandHelpInfo, getCommandsHelpInfo, makeCliDocsFromHelp, makeDocumentModelModulesFile, makeEditorModuleFile, makeEditorsModulesFile, makeLegacyIndexFile, makeModulesFile, makeSubgraphsIndexFile, makeUpgradeManifestsExport, makeUpgradeManifestsFile, tsMorphGenerateApp, tsMorphGenerateDocumentEditor, tsMorphGenerateDocumentModel, tsMorphGenerateProcessor, tsMorphGenerateSubgraph, writeCliDocsMarkdownFile };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../../templates-
|
|
2
|
-
import { C as tsMorphGenerateProcessor, _ as
|
|
3
|
-
export { buildBoilerplatePackageJson, getCommandHelpInfo, getCommandsHelpInfo, makeCliDocsFromHelp, makeDocumentModelModulesFile, makeEditorModuleFile, makeEditorsModulesFile, makeLegacyIndexFile, makeModulesFile, makeSubgraphsIndexFile, makeUpgradeManifestsExport, makeUpgradeManifestsFile, tsMorphGenerateDocumentEditor, tsMorphGenerateDocumentModel,
|
|
1
|
+
import "../../templates-DBvz_qPL.mjs";
|
|
2
|
+
import { C as tsMorphGenerateProcessor, _ as makeEditorModuleFile, a as getCommandHelpInfo, c as writeCliDocsMarkdownFile, d as makeDocumentModelModulesFile, f as makeEditorsModulesFile, g as makeLegacyIndexFile, h as makeUpgradeManifestsFile, i as tsMorphGenerateDocumentEditor, l as buildBoilerplatePackageJson, m as makeUpgradeManifestsExport, n as tsMorphGenerateSubgraph, o as getCommandsHelpInfo, p as makeModulesFile, r as tsMorphGenerateDocumentModel, s as makeCliDocsFromHelp, t as makeSubgraphsIndexFile, u as tsMorphGenerateApp } from "../../file-builders-DRzXbZTI.mjs";
|
|
3
|
+
export { buildBoilerplatePackageJson, getCommandHelpInfo, getCommandsHelpInfo, makeCliDocsFromHelp, makeDocumentModelModulesFile, makeEditorModuleFile, makeEditorsModulesFile, makeLegacyIndexFile, makeModulesFile, makeSubgraphsIndexFile, makeUpgradeManifestsExport, makeUpgradeManifestsFile, tsMorphGenerateApp, tsMorphGenerateDocumentEditor, tsMorphGenerateDocumentModel, tsMorphGenerateProcessor, tsMorphGenerateSubgraph, writeCliDocsMarkdownFile };
|
|
@@ -2,6 +2,39 @@ import { d as DocumentModelVariableNames, l as DocumentModelTemplateInputs, t as
|
|
|
2
2
|
import * as _tmpl_core0 from "@tmpl/core";
|
|
3
3
|
import { ActionFromOperation, CommandHelpInfo, DocumentModelTemplateInputsWithModule, EditorVariableNames } from "@powerhousedao/codegen";
|
|
4
4
|
|
|
5
|
+
//#region src/templates/app/components/CreateDocument.d.ts
|
|
6
|
+
declare const createDocumentFileTemplate: string;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/templates/app/components/DriveContents.d.ts
|
|
9
|
+
declare const appDriveContentsFileTemplate: () => string;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/templates/app/components/DriveExplorer.d.ts
|
|
12
|
+
declare const driveExplorerFileTemplate: string;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/templates/app/components/EmptyState.d.ts
|
|
15
|
+
declare const emptyStateFileTemplate: string;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/templates/app/components/Files.d.ts
|
|
18
|
+
declare const appFilesFileTemplate: () => string;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/templates/app/components/Folders.d.ts
|
|
21
|
+
declare const appFoldersFileTemplate: () => string;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/templates/app/components/FolderTree.d.ts
|
|
24
|
+
declare const folderTreeFileTemplate: string;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/templates/app/components/NavigationBreadcrumbs.d.ts
|
|
27
|
+
declare const driveExplorerNavigationBreadcrumbsFileTemplate: () => string;
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/templates/app/config.d.ts
|
|
30
|
+
declare const appConfigFileTemplate: (v: {
|
|
31
|
+
allowedDocumentTypesString: string;
|
|
32
|
+
isDragAndDropEnabledString: string;
|
|
33
|
+
}) => string;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/templates/app/editor.d.ts
|
|
36
|
+
declare const appEditorFileTemplate: () => string;
|
|
37
|
+
//#endregion
|
|
5
38
|
//#region src/templates/boilerplate/AGENTS.md.d.ts
|
|
6
39
|
declare const agentsTemplate: string;
|
|
7
40
|
//#endregion
|
|
@@ -53,15 +86,15 @@ declare const indexHtmlTemplate: string;
|
|
|
53
86
|
//#region src/templates/boilerplate/index.html.legacy.d.ts
|
|
54
87
|
declare const legacyIndexHtmlTemplate: string;
|
|
55
88
|
//#endregion
|
|
56
|
-
//#region src/templates/boilerplate/main.tsx.d.ts
|
|
57
|
-
declare const mainTsxTemplate: string;
|
|
58
|
-
//#endregion
|
|
59
89
|
//#region src/templates/boilerplate/index.d.ts
|
|
60
90
|
declare const indexTsTemplate: string;
|
|
61
91
|
//#endregion
|
|
62
92
|
//#region src/templates/boilerplate/LICENSE.d.ts
|
|
63
93
|
declare const licenseTemplate = "\n GNU AFFERO GENERAL PUBLIC LICENSE\n Version 3, 19 November 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n Preamble\n\n The GNU Affero General Public License is a free, copyleft license for\nsoftware and other kinds of works, specifically designed to ensure\ncooperation with the community in the case of network server software.\n\n The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works. By contrast,\nour General Public Licenses are intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.\n\n When we speak of free software, we are referring to freedom, not\nprice. Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n Developers that use our General Public Licenses protect your rights\nwith two steps: (1) assert copyright on the software, and (2) offer\nyou this License which gives you legal permission to copy, distribute\nand/or modify the software.\n\n A secondary benefit of defending all users' freedom is that\nimprovements made in alternate versions of the program, if they\nreceive widespread use, become available for other developers to\nincorporate. Many developers of free software are heartened and\nencouraged by the resulting cooperation. However, in the case of\nsoftware used on network servers, this result may fail to come about.\nThe GNU General Public License permits making a modified version and\nletting the public access it on a server without ever releasing its\nsource code to the public.\n\n The GNU Affero General Public License is designed specifically to\nensure that, in such cases, the modified source code becomes available\nto the community. It requires the operator of a network server to\nprovide the source code of the modified version running there to the\nusers of that server. Therefore, public use of a modified version, on\na publicly accessible server, gives the public access to the source\ncode of the modified version.\n\n An older license, called the Affero General Public License and\npublished by Affero, was designed to accomplish similar goals. This is\na different license, not a version of the Affero GPL, but Affero has\nreleased a new version of the Affero GPL which permits relicensing under\nthis license.\n\n The precise terms and conditions for copying, distribution and\nmodification follow.\n\n TERMS AND CONDITIONS\n\n 0. Definitions.\n\n \"This License\" refers to version 3 of the GNU Affero General Public License.\n\n \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n \"The Program\" refers to any copyrightable work licensed under this\nLicense. Each licensee is addressed as \"you\". \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy. The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy. Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies. Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License. If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n 1. Source Code.\n\n The \"source code\" for a work means the preferred form of the work\nfor making modifications to it. \"Object code\" means any non-source\nform of a work.\n\n A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form. A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities. However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work. For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n The Corresponding Source for a work in source code form is that\nsame work.\n\n 2. Basic Permissions.\n\n All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met. This License explicitly affirms your unlimited\npermission to run the unmodified Program. The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work. This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force. You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright. Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n Conveying under any other circumstances is permitted solely under\nthe conditions stated below. Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n 3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n 4. Conveying Verbatim Copies.\n\n You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n 5. Conveying Modified Source Versions.\n\n You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n a) The work must carry prominent notices stating that you modified\n it, and giving a relevant date.\n\n b) The work must carry prominent notices stating that it is\n released under this License and any conditions added under section\n 7. This requirement modifies the requirement in section 4 to\n \"keep intact all notices\".\n\n c) You must license the entire work, as a whole, under this\n License to anyone who comes into possession of a copy. This\n License will therefore apply, along with any applicable section 7\n additional terms, to the whole of the work, and all its parts,\n regardless of how they are packaged. This License gives no\n permission to license the work in any other way, but it does not\n invalidate such permission if you have separately received it.\n\n d) If the work has interactive user interfaces, each must display\n Appropriate Legal Notices; however, if the Program has interactive\n interfaces that do not display Appropriate Legal Notices, your\n work need not make them do so.\n\n A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit. Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n 6. Conveying Non-Source Forms.\n\n You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n a) Convey the object code in, or embodied in, a physical product\n (including a physical distribution medium), accompanied by the\n Corresponding Source fixed on a durable physical medium\n customarily used for software interchange.\n\n b) Convey the object code in, or embodied in, a physical product\n (including a physical distribution medium), accompanied by a\n written offer, valid for at least three years and valid for as\n long as you offer spare parts or customer support for that product\n model, to give anyone who possesses the object code either (1) a\n copy of the Corresponding Source for all the software in the\n product that is covered by this License, on a durable physical\n medium customarily used for software interchange, for a price no\n more than your reasonable cost of physically performing this\n conveying of source, or (2) access to copy the\n Corresponding Source from a network server at no charge.\n\n c) Convey individual copies of the object code with a copy of the\n written offer to provide the Corresponding Source. This\n alternative is allowed only occasionally and noncommercially, and\n only if you received the object code with such an offer, in accord\n with subsection 6b.\n\n d) Convey the object code by offering access from a designated\n place (gratis or for a charge), and offer equivalent access to the\n Corresponding Source in the same way through the same place at no\n further charge. You need not require recipients to copy the\n Corresponding Source along with the object code. If the place to\n copy the object code is a network server, the Corresponding Source\n may be on a different server (operated by you or a third party)\n that supports equivalent copying facilities, provided you maintain\n clear directions next to the object code saying where to find the\n Corresponding Source. Regardless of what server hosts the\n Corresponding Source, you remain obligated to ensure that it is\n available for as long as needed to satisfy these requirements.\n\n e) Convey the object code using peer-to-peer transmission, provided\n you inform other peers where the object code and Corresponding\n Source of the work are being offered to the general public at no\n charge under subsection 6d.\n\n A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling. In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage. For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product. A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source. The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information. But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed. Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n 7. Additional Terms.\n\n \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law. If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit. (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.) You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n a) Disclaiming warranty or limiting liability differently from the\n terms of sections 15 and 16 of this License; or\n\n b) Requiring preservation of specified reasonable legal notices or\n author attributions in that material or in the Appropriate Legal\n Notices displayed by works containing it; or\n\n c) Prohibiting misrepresentation of the origin of that material, or\n requiring that modified versions of such material be marked in\n reasonable ways as different from the original version; or\n\n d) Limiting the use for publicity purposes of names of licensors or\n authors of the material; or\n\n e) Declining to grant rights under trademark law for use of some\n trade names, trademarks, or service marks; or\n\n f) Requiring indemnification of licensors and authors of that\n material by anyone who conveys the material (or modified versions of\n it) with contractual assumptions of liability to the recipient, for\n any liability that these contractual assumptions directly impose on\n those licensors and authors.\n\n All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10. If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term. If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n 8. Termination.\n\n You may not propagate or modify a covered work except as expressly\nprovided under this License. Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License. If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n 9. Acceptance Not Required for Having Copies.\n\n You are not required to accept this License in order to receive or\nrun a copy of the Program. Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance. However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work. These actions infringe copyright if you do\nnot accept this License. Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n 10. Automatic Licensing of Downstream Recipients.\n\n Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License. You are not responsible\nfor enforcing compliance by third parties with this License.\n\n An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations. If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License. For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n 11. Patents.\n\n A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based. The\nwork thus licensed is called the contributor's \"contributor version\".\n\n A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version. For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement). To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients. \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License. You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n 12. No Surrender of Others' Freedom.\n\n If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License. If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all. For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n 13. Remote Network Interaction; Use with the GNU General Public License.\n\n Notwithstanding any other provision of this License, if you modify the\nProgram, your modified version must prominently offer all users\ninteracting with it remotely through a computer network (if your version\nsupports such interaction) an opportunity to receive the Corresponding\nSource of your version by providing access to the Corresponding Source\nfrom a network server at no charge, through some standard or customary\nmeans of facilitating copying of software. This Corresponding Source\nshall include the Corresponding Source for any work covered by version 3\nof the GNU General Public License that is incorporated pursuant to the\nfollowing paragraph.\n\n Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU General Public License into a single\ncombined work, and to convey the resulting work. The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the work with which it is combined will remain governed by version\n3 of the GNU General Public License.\n\n 14. Revised Versions of this License.\n\n The Free Software Foundation may publish revised and/or new versions of\nthe GNU Affero General Public License from time to time. Such new versions\nwill be similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n Each version is given a distinguishing version number. If the\nProgram specifies that a certain numbered version of the GNU Affero General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation. If the Program does not specify a version number of the\nGNU Affero General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n If the Program specifies that a proxy can decide which future\nversions of the GNU Affero General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n Later license versions may give you additional or different\npermissions. However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n 15. Disclaimer of Warranty.\n\n THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n 16. Limitation of Liability.\n\n IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n 17. Interpretation of Sections 15 and 16.\n\n If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n END OF TERMS AND CONDITIONS\n\n How to Apply These Terms to Your New Programs\n\n If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n To do so, attach the following notices to the program. It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n <one line to give the program's name and a brief idea of what it does.>\n Copyright (C) <year> <name of author>\n\n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU Affero General Public License as published\n by the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Affero General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License\n along with this program. If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n If your software can interact with users remotely through a computer\nnetwork, you should also make sure that it provides a way for users to\nget its source. For example, if your program is a web application, its\ninterface could display a \"Source\" link that leads users to an archive\nof the code. There are many ways you could offer source, and different\nsolutions will be better for different programs; see section 13 for the\nspecific requirements.\n\n You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU AGPL, see\n<https://www.gnu.org/licenses/>.\n";
|
|
64
94
|
//#endregion
|
|
95
|
+
//#region src/templates/boilerplate/main.tsx.d.ts
|
|
96
|
+
declare const mainTsxTemplate: string;
|
|
97
|
+
//#endregion
|
|
65
98
|
//#region src/templates/boilerplate/mcp.json.d.ts
|
|
66
99
|
declare const mcpTemplate: string;
|
|
67
100
|
//#endregion
|
|
@@ -252,6 +285,9 @@ declare function documentModelModuleFileTemplate({
|
|
|
252
285
|
//#region src/templates/document-model/src/index.d.ts
|
|
253
286
|
declare const documentModelSrcIndexFileTemplate: string;
|
|
254
287
|
//#endregion
|
|
288
|
+
//#region src/templates/document-model/src/utils.d.ts
|
|
289
|
+
declare const documentModelSrcUtilsTemplate: string;
|
|
290
|
+
//#endregion
|
|
255
291
|
//#region src/templates/document-model/tests/document-model.test.d.ts
|
|
256
292
|
declare const documentModelTestFileTemplate: (v: DocumentModelTemplateInputs) => string;
|
|
257
293
|
//#endregion
|
|
@@ -261,9 +297,6 @@ declare function makeActionImportNames(v: DocumentModelTemplateInputsWithModule$
|
|
|
261
297
|
declare function makeActionsImports(v: DocumentModelTemplateInputsWithModule$1): string;
|
|
262
298
|
declare const documentModelOperationsModuleTestFileTemplate: (v: DocumentModelTemplateInputsWithModule$1) => string;
|
|
263
299
|
//#endregion
|
|
264
|
-
//#region src/templates/document-model/src/utils.d.ts
|
|
265
|
-
declare const documentModelSrcUtilsTemplate: string;
|
|
266
|
-
//#endregion
|
|
267
300
|
//#region src/templates/document-model/upgrades/upgrade-manifest.d.ts
|
|
268
301
|
declare const upgradeManifestTemplate: (v: {
|
|
269
302
|
documentModelId: string;
|
|
@@ -284,39 +317,6 @@ declare const documentModelUtilsTemplate: ({
|
|
|
284
317
|
pascalCaseDocumentType
|
|
285
318
|
}: DocumentModelVariableNames) => string;
|
|
286
319
|
//#endregion
|
|
287
|
-
//#region src/templates/drive-editor/components/CreateDocument.d.ts
|
|
288
|
-
declare const createDocumentFileTemplate: string;
|
|
289
|
-
//#endregion
|
|
290
|
-
//#region src/templates/drive-editor/components/DriveContents.d.ts
|
|
291
|
-
declare const driveEditorDriveContentsFileTemplate: () => string;
|
|
292
|
-
//#endregion
|
|
293
|
-
//#region src/templates/drive-editor/components/DriveExplorer.d.ts
|
|
294
|
-
declare const driveExplorerFileTemplate: string;
|
|
295
|
-
//#endregion
|
|
296
|
-
//#region src/templates/drive-editor/components/EmptyState.d.ts
|
|
297
|
-
declare const emptyStateFileTemplate: string;
|
|
298
|
-
//#endregion
|
|
299
|
-
//#region src/templates/drive-editor/components/Files.d.ts
|
|
300
|
-
declare const driveEditorFilesFileTemplate: () => string;
|
|
301
|
-
//#endregion
|
|
302
|
-
//#region src/templates/drive-editor/components/Folders.d.ts
|
|
303
|
-
declare const driveEditorFoldersFileTemplate: () => string;
|
|
304
|
-
//#endregion
|
|
305
|
-
//#region src/templates/drive-editor/components/FolderTree.d.ts
|
|
306
|
-
declare const folderTreeFileTemplate: string;
|
|
307
|
-
//#endregion
|
|
308
|
-
//#region src/templates/drive-editor/components/NavigationBreadcrumbs.d.ts
|
|
309
|
-
declare const driveExplorerNavigationBreadcrumbsFileTemplate: () => string;
|
|
310
|
-
//#endregion
|
|
311
|
-
//#region src/templates/drive-editor/config.d.ts
|
|
312
|
-
declare const driveEditorConfigFileTemplate: (v: {
|
|
313
|
-
allowedDocumentTypesString: string;
|
|
314
|
-
isDragAndDropEnabledString: string;
|
|
315
|
-
}) => string;
|
|
316
|
-
//#endregion
|
|
317
|
-
//#region src/templates/drive-editor/editor.d.ts
|
|
318
|
-
declare const driveEditorEditorFileTemplate: () => string;
|
|
319
|
-
//#endregion
|
|
320
320
|
//#region src/templates/processors/analytics/factory.d.ts
|
|
321
321
|
declare const analyticsFactoryTemplate: (v: {
|
|
322
322
|
pascalCaseName: string;
|
|
@@ -324,20 +324,20 @@ declare const analyticsFactoryTemplate: (v: {
|
|
|
324
324
|
documentTypes: string[];
|
|
325
325
|
}) => string;
|
|
326
326
|
//#endregion
|
|
327
|
+
//#region src/templates/processors/analytics/index.d.ts
|
|
328
|
+
declare const analyticsIndexTemplate: string;
|
|
329
|
+
//#endregion
|
|
327
330
|
//#region src/templates/processors/analytics/processor.d.ts
|
|
328
331
|
declare const analyticsProcessorTemplate: (v: {
|
|
329
332
|
pascalCaseName: string;
|
|
330
333
|
}) => string;
|
|
331
334
|
//#endregion
|
|
332
|
-
//#region src/templates/processors/
|
|
333
|
-
declare const
|
|
335
|
+
//#region src/templates/processors/factory-builders.d.ts
|
|
336
|
+
declare const factoryBuildersTemplate: string;
|
|
334
337
|
//#endregion
|
|
335
338
|
//#region src/templates/processors/factory.d.ts
|
|
336
339
|
declare const processorsFactoryTemplate: string;
|
|
337
340
|
//#endregion
|
|
338
|
-
//#region src/templates/processors/factory-builders.d.ts
|
|
339
|
-
declare const factoryBuildersTemplate: string;
|
|
340
|
-
//#endregion
|
|
341
341
|
//#region src/templates/processors/index.d.ts
|
|
342
342
|
declare const processorsIndexTemplate: string;
|
|
343
343
|
//#endregion
|
|
@@ -351,14 +351,14 @@ declare const relationalDbFactoryTemplate: (v: {
|
|
|
351
351
|
//#region src/templates/processors/relational-db/index.d.ts
|
|
352
352
|
declare const relationalDbIndexTemplate: string;
|
|
353
353
|
//#endregion
|
|
354
|
+
//#region src/templates/processors/relational-db/migrations.d.ts
|
|
355
|
+
declare const relationalDbMigrationsTemplate: () => string;
|
|
356
|
+
//#endregion
|
|
354
357
|
//#region src/templates/processors/relational-db/processor.d.ts
|
|
355
358
|
declare const relationalDbProcessorTemplate: (v: {
|
|
356
359
|
pascalCaseName: string;
|
|
357
360
|
}) => string;
|
|
358
361
|
//#endregion
|
|
359
|
-
//#region src/templates/processors/relational-db/migrations.d.ts
|
|
360
|
-
declare const relationalDbMigrationsTemplate: () => string;
|
|
361
|
-
//#endregion
|
|
362
362
|
//#region src/templates/processors/relational-db/schema.d.ts
|
|
363
363
|
declare const relationalDbSchemaTemplate: () => string;
|
|
364
364
|
//#endregion
|
|
@@ -412,5 +412,5 @@ type DocumentModelSubgraphResolversParams = {
|
|
|
412
412
|
};
|
|
413
413
|
declare const documentModelSubgraphResolversTemplate: (v: DocumentModelSubgraphResolversParams) => string;
|
|
414
414
|
//#endregion
|
|
415
|
-
export { DocumentModelSubgraphResolversParams, DocumentModelSubgraphSchemaParams, agentsTemplate, agentsTemplate as claudeTemplate, analyticsFactoryTemplate, analyticsIndexTemplate, analyticsProcessorTemplate, buildPowerhouseConfigTemplate, claudeSettingsLocalTemplate, connectEntrypointTemplate, createDocumentFileTemplate, cursorMcpTemplate, customSubgraphResolversTemplate, customSubgraphSchemaTemplate, dockerfileTemplate, docsFromCliHelpTemplate, documentEditorEditorFileTemplate, documentEditorModuleFileTemplate, documentModelDocumentSchemaFileTemplate, documentModelDocumentTypeTemplate, documentModelGenActionsFileTemplate, documentModelGenControllerFileTemplate, documentModelGenCreatorsFileTemplate, documentModelGenIndexFileTemplate, documentModelGenReducerFileTemplate, documentModelGenTypesTemplate, documentModelGenUtilsTemplate, documentModelHooksFileTemplate, documentModelIndexTemplate, documentModelModuleFileTemplate, documentModelOperationModuleActionsFileTemplate, documentModelOperationsModuleCreatorsFileTemplate, documentModelOperationsModuleErrorFileTemplate, documentModelOperationsModuleOperationsFileTemplate, documentModelOperationsModuleTestFileTemplate, documentModelPhFactoriesFileTemplate, documentModelRootActionsFileTemplate, documentModelSchemaIndexTemplate, documentModelSrcIndexFileTemplate, documentModelSrcUtilsTemplate, documentModelSubgraphResolversTemplate, documentModelSubgraphSchemaTemplate, documentModelTestFileTemplate, documentModelUtilsTemplate, documentModelsIndexTemplate, documentModelsTemplate,
|
|
415
|
+
export { DocumentModelSubgraphResolversParams, DocumentModelSubgraphSchemaParams, agentsTemplate, agentsTemplate as claudeTemplate, analyticsFactoryTemplate, analyticsIndexTemplate, analyticsProcessorTemplate, appConfigFileTemplate, appDriveContentsFileTemplate, appEditorFileTemplate, appFilesFileTemplate, appFoldersFileTemplate, buildPowerhouseConfigTemplate, claudeSettingsLocalTemplate, connectEntrypointTemplate, createDocumentFileTemplate, cursorMcpTemplate, customSubgraphResolversTemplate, customSubgraphSchemaTemplate, dockerfileTemplate, docsFromCliHelpTemplate, documentEditorEditorFileTemplate, documentEditorModuleFileTemplate, documentModelDocumentSchemaFileTemplate, documentModelDocumentTypeTemplate, documentModelGenActionsFileTemplate, documentModelGenControllerFileTemplate, documentModelGenCreatorsFileTemplate, documentModelGenIndexFileTemplate, documentModelGenReducerFileTemplate, documentModelGenTypesTemplate, documentModelGenUtilsTemplate, documentModelHooksFileTemplate, documentModelIndexTemplate, documentModelModuleFileTemplate, documentModelOperationModuleActionsFileTemplate, documentModelOperationsModuleCreatorsFileTemplate, documentModelOperationsModuleErrorFileTemplate, documentModelOperationsModuleOperationsFileTemplate, documentModelOperationsModuleTestFileTemplate, documentModelPhFactoriesFileTemplate, documentModelRootActionsFileTemplate, documentModelSchemaIndexTemplate, documentModelSrcIndexFileTemplate, documentModelSrcUtilsTemplate, documentModelSubgraphResolversTemplate, documentModelSubgraphSchemaTemplate, documentModelTestFileTemplate, documentModelUtilsTemplate, documentModelsIndexTemplate, documentModelsTemplate, driveExplorerFileTemplate, driveExplorerNavigationBreadcrumbsFileTemplate, editorsIndexTemplate, editorsTemplate, emptyStateFileTemplate, eslintConfigTemplate, exportsTemplate, factoryBuildersTemplate, folderTreeFileTemplate, geminiSettingsTemplate, getModuleExportType, gitIgnoreTemplate, indexHtmlTemplate, indexTsTemplate, legacyIndexHtmlTemplate, licenseTemplate, mainTsxTemplate, makeActionImportNames, makeActionsImports, makeTestCaseForAction, mcpTemplate, nginxConfTemplate, npmrcTemplate, packageJsonExportsTemplate, packageJsonScriptsTemplate, packageJsonTemplate, powerhouseManifestTemplate, processorsFactoryTemplate, processorsIndexTemplate, readmeTemplate, relationalDbFactoryTemplate, relationalDbIndexTemplate, relationalDbMigrationsTemplate, relationalDbProcessorTemplate, relationalDbSchemaTemplate, styleTemplate, subgraphIndexFileTemplate, subgraphLibFileTemplate, subgraphsIndexTemplate, switchboardEntrypointTemplate, syncAndPublishWorkflowTemplate, tsConfigTemplate, tsconfigPathsTemplate, upgradeManifestTemplate, upgradeTransitionTemplate, viteConfigTemplate, vitestConfigTemplate };
|
|
416
416
|
//# sourceMappingURL=index.d.mts.map
|