@powerhousedao/ph-cli 6.2.3-dev.10 → 6.2.3-dev.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/README.md +21 -0
  2. package/dist/{auth-AR3VxAIk.mjs → auth-BFUq7CvE.mjs} +3 -3
  3. package/dist/{auth-AR3VxAIk.mjs.map → auth-BFUq7CvE.mjs.map} +1 -1
  4. package/dist/auth-CNhbN5UM.mjs +4 -0
  5. package/dist/authoring-mode-DWbbsuWh.mjs +23 -0
  6. package/dist/authoring-mode-DWbbsuWh.mjs.map +1 -0
  7. package/dist/build-C1mmZvlb.mjs +3011 -0
  8. package/dist/build-C1mmZvlb.mjs.map +1 -0
  9. package/dist/build-Ws5hhqol.mjs +4 -0
  10. package/dist/check-Cco7-UC2.mjs +65 -0
  11. package/dist/check-Cco7-UC2.mjs.map +1 -0
  12. package/dist/check-CjFMilhk.mjs +4 -0
  13. package/dist/check-DvG9Xy4c.mjs +60 -0
  14. package/dist/check-DvG9Xy4c.mjs.map +1 -0
  15. package/dist/{cli-connect-override-D3hh4aH_.mjs → cli-connect-override-D3N3gbp_.mjs} +39 -27
  16. package/dist/cli-connect-override-D3N3gbp_.mjs.map +1 -0
  17. package/dist/cli.d.mts +2 -1
  18. package/dist/cli.mjs +54 -1178
  19. package/dist/cli.mjs.map +1 -1
  20. package/dist/compound-DO_mvh0O-Dp1YPhR0.mjs +2806 -0
  21. package/dist/compound-DO_mvh0O-Dp1YPhR0.mjs.map +1 -0
  22. package/dist/connect-build-COdexcA8.mjs +322 -0
  23. package/dist/connect-build-COdexcA8.mjs.map +1 -0
  24. package/dist/{connect-config-BWGiW3IB.mjs → connect-config-C6hKMsUG.mjs} +19 -12
  25. package/dist/connect-config-C6hKMsUG.mjs.map +1 -0
  26. package/dist/connect-preview-CdFvlANO.mjs +49 -0
  27. package/dist/connect-preview-CdFvlANO.mjs.map +1 -0
  28. package/dist/connect-studio-C7Bbh50O.mjs +81 -0
  29. package/dist/connect-studio-C7Bbh50O.mjs.map +1 -0
  30. package/dist/connect-studio-xQNYl142.mjs +4 -0
  31. package/dist/definitions-worker.d.mts +98 -0
  32. package/dist/definitions-worker.d.mts.map +1 -0
  33. package/dist/definitions-worker.mjs +28 -0
  34. package/dist/definitions-worker.mjs.map +1 -0
  35. package/dist/dist-B-_lMGlB.mjs +480 -0
  36. package/dist/dist-B-_lMGlB.mjs.map +1 -0
  37. package/dist/evidence-Dchpoogs.mjs +120 -0
  38. package/dist/evidence-Dchpoogs.mjs.map +1 -0
  39. package/dist/explain-lynfOtDg.mjs +230 -0
  40. package/dist/explain-lynfOtDg.mjs.map +1 -0
  41. package/dist/export-YkeGUZjR.mjs +42 -0
  42. package/dist/export-YkeGUZjR.mjs.map +1 -0
  43. package/dist/external-M25AgDIE.d.mts +4277 -0
  44. package/dist/external-M25AgDIE.d.mts.map +1 -0
  45. package/dist/feature-flags-xwqcHEWC.mjs +4 -0
  46. package/dist/files-D6_euBBn.mjs +457 -0
  47. package/dist/files-D6_euBBn.mjs.map +1 -0
  48. package/dist/generate-all-_7S0Iii2.mjs +36 -0
  49. package/dist/generate-all-_7S0Iii2.mjs.map +1 -0
  50. package/dist/generate-app-hm6CJ_4O.mjs +72 -0
  51. package/dist/generate-app-hm6CJ_4O.mjs.map +1 -0
  52. package/dist/generate-desktop-shell-CEcE_1gb.mjs +323 -0
  53. package/dist/generate-desktop-shell-CEcE_1gb.mjs.map +1 -0
  54. package/dist/generate-document-model-DCjzz3Sa.mjs +114 -0
  55. package/dist/generate-document-model-DCjzz3Sa.mjs.map +1 -0
  56. package/dist/generate-editor-DdoapkEK.mjs +64 -0
  57. package/dist/generate-editor-DdoapkEK.mjs.map +1 -0
  58. package/dist/generate-hosts-BFmPIW2X.mjs +18 -0
  59. package/dist/generate-hosts-BFmPIW2X.mjs.map +1 -0
  60. package/dist/generate-hosts-RWj7WPHZ.mjs +4 -0
  61. package/dist/generate-migration-file-yK8uA70U.mjs +20 -0
  62. package/dist/generate-migration-file-yK8uA70U.mjs.map +1 -0
  63. package/dist/generate-piece-5Nyr2UZj.mjs +73 -0
  64. package/dist/generate-piece-5Nyr2UZj.mjs.map +1 -0
  65. package/dist/generate-piece-action-DqR8BcoO.mjs +31 -0
  66. package/dist/generate-piece-action-DqR8BcoO.mjs.map +1 -0
  67. package/dist/generate-piece-trigger-CZaDD-cc.mjs +30 -0
  68. package/dist/generate-piece-trigger-CZaDD-cc.mjs.map +1 -0
  69. package/dist/generate-processor-BVjOsfjJ.mjs +58 -0
  70. package/dist/generate-processor-BVjOsfjJ.mjs.map +1 -0
  71. package/dist/generate-subgraph-CrHbYK91.mjs +64 -0
  72. package/dist/generate-subgraph-CrHbYK91.mjs.map +1 -0
  73. package/dist/get-version-BBiGShxz.mjs +11 -0
  74. package/dist/get-version-BBiGShxz.mjs.map +1 -0
  75. package/dist/index-BdxG1c0H.d.mts +188 -0
  76. package/dist/index-BdxG1c0H.d.mts.map +1 -0
  77. package/dist/{init-BZP6gvYd.mjs → init-BjwbWklG.mjs} +24 -15
  78. package/dist/init-BjwbWklG.mjs.map +1 -0
  79. package/dist/inspect-BpVHe9vz.mjs +46 -0
  80. package/dist/inspect-BpVHe9vz.mjs.map +1 -0
  81. package/dist/{inspect-DXjbQEV_.mjs → inspect-zWJnBDMJ.mjs} +11 -4
  82. package/dist/inspect-zWJnBDMJ.mjs.map +1 -0
  83. package/dist/install-added-dependencies-DnZFR3aE.mjs +18 -0
  84. package/dist/install-added-dependencies-DnZFR3aE.mjs.map +1 -0
  85. package/dist/keyframes-bFo9iDhT.mjs +201 -0
  86. package/dist/keyframes-bFo9iDhT.mjs.map +1 -0
  87. package/dist/mcp-BK-qb1ZS.mjs +262 -0
  88. package/dist/mcp-BK-qb1ZS.mjs.map +1 -0
  89. package/dist/migrate-B-MM9TlS.mjs +177 -0
  90. package/dist/migrate-B-MM9TlS.mjs.map +1 -0
  91. package/dist/module-dir-1avCXsBi.mjs +17 -0
  92. package/dist/module-dir-1avCXsBi.mjs.map +1 -0
  93. package/dist/npm-args-g1Tgel4s.mjs +78 -0
  94. package/dist/npm-args-g1Tgel4s.mjs.map +1 -0
  95. package/dist/offered-routes-imports-CQInWI6y.mjs +4 -0
  96. package/dist/offered-routes-imports-CalXK9dh.mjs +96 -0
  97. package/dist/offered-routes-imports-CalXK9dh.mjs.map +1 -0
  98. package/dist/ph-cli-commands-DwSp4Sbq.mjs +1770 -0
  99. package/dist/ph-cli-commands-DwSp4Sbq.mjs.map +1 -0
  100. package/dist/ph-cli-commands-HLM5KIpd.mjs +4 -0
  101. package/dist/{registry-auth-DxEWCJu2.mjs → registry-auth-Bm5AR-fB.mjs} +4 -4
  102. package/dist/{registry-auth-DxEWCJu2.mjs.map → registry-auth-Bm5AR-fB.mjs.map} +1 -1
  103. package/dist/render-BO-Nwn2H.mjs +71 -0
  104. package/dist/render-BO-Nwn2H.mjs.map +1 -0
  105. package/dist/render-DdieUjtg.mjs +4 -0
  106. package/dist/run-DEKE4MJY.mjs +111 -0
  107. package/dist/run-DEKE4MJY.mjs.map +1 -0
  108. package/dist/run-DP3fNgPv.mjs +4 -0
  109. package/dist/run-sugar-D9lIzhAx.mjs +39 -0
  110. package/dist/run-sugar-D9lIzhAx.mjs.map +1 -0
  111. package/dist/runners/connect.d.mts +17 -0
  112. package/dist/runners/connect.d.mts.map +1 -0
  113. package/dist/runners/connect.mjs +63 -0
  114. package/dist/runners/connect.mjs.map +1 -0
  115. package/dist/runners/switchboard.d.mts +11 -0
  116. package/dist/runners/switchboard.d.mts.map +1 -0
  117. package/dist/runners/switchboard.mjs +21 -0
  118. package/dist/runners/switchboard.mjs.map +1 -0
  119. package/dist/schemas-DzgKfQIx.mjs +6024 -0
  120. package/dist/schemas-DzgKfQIx.mjs.map +1 -0
  121. package/dist/scripts/emit-runner-schemas.ts +24 -0
  122. package/dist/scripts/generate-commands-docs.ts +17 -0
  123. package/dist/scripts/manage-environment +0 -0
  124. package/dist/scripts/setup.sh +0 -0
  125. package/dist/{switchboard-migrate-NQ7LHWSi.mjs → switchboard-migrate-Docb8Cjv.mjs} +6 -5
  126. package/dist/{switchboard-migrate-NQ7LHWSi.mjs.map → switchboard-migrate-Docb8Cjv.mjs.map} +1 -1
  127. package/dist/switchboard-proxy-CGfMtENM.mjs +37 -0
  128. package/dist/switchboard-proxy-CGfMtENM.mjs.map +1 -0
  129. package/dist/{switchboard-reset-BcQXlcVf.mjs → switchboard-reset-MtTB_GAI.mjs} +8 -6
  130. package/dist/switchboard-reset-MtTB_GAI.mjs.map +1 -0
  131. package/dist/sync-connect-routes-BtAsFPXN.mjs +4 -0
  132. package/dist/sync-connect-routes-t0Slg-P6.mjs +25 -0
  133. package/dist/sync-connect-routes-t0Slg-P6.mjs.map +1 -0
  134. package/dist/{utils-C4isxXSO.mjs → utils-9KyRM0mf.mjs} +6 -34
  135. package/dist/{utils-C4isxXSO.mjs.map → utils-9KyRM0mf.mjs.map} +1 -1
  136. package/dist/utils-TO9lB8Xs.mjs +4 -0
  137. package/dist/verify-l5f7BDmy.mjs +71 -0
  138. package/dist/verify-l5f7BDmy.mjs.map +1 -0
  139. package/dist/{vetra-DkF6EJMY.mjs → vetra-DSFzAl_1.mjs} +115 -148
  140. package/dist/vetra-DSFzAl_1.mjs.map +1 -0
  141. package/dist/vetra-launch-DQDZxGTV.mjs +343 -0
  142. package/dist/vetra-launch-DQDZxGTV.mjs.map +1 -0
  143. package/dist/warn-subgraph-type-conflicts-BOHBmThq.mjs +19 -0
  144. package/dist/warn-subgraph-type-conflicts-BOHBmThq.mjs.map +1 -0
  145. package/package.json +45 -18
  146. package/dist/auth-BNkN6kS9.mjs +0 -4
  147. package/dist/build-C-A5-ipO.mjs +0 -4
  148. package/dist/build-uQXq6_HU.mjs +0 -71
  149. package/dist/build-uQXq6_HU.mjs.map +0 -1
  150. package/dist/cli-connect-override-D3hh4aH_.mjs.map +0 -1
  151. package/dist/connect-build-WL4axo4z.mjs +0 -43
  152. package/dist/connect-build-WL4axo4z.mjs.map +0 -1
  153. package/dist/connect-config-BWGiW3IB.mjs.map +0 -1
  154. package/dist/connect-preview-D7ypzFDc.mjs +0 -28
  155. package/dist/connect-preview-D7ypzFDc.mjs.map +0 -1
  156. package/dist/connect-studio-BIQzyq5B.mjs +0 -5
  157. package/dist/connect-studio-D6rfWCNB.mjs +0 -31
  158. package/dist/connect-studio-D6rfWCNB.mjs.map +0 -1
  159. package/dist/generate-all-DrT4ZxHX.mjs +0 -30
  160. package/dist/generate-all-DrT4ZxHX.mjs.map +0 -1
  161. package/dist/generate-app-DNNqA-H3.mjs +0 -48
  162. package/dist/generate-app-DNNqA-H3.mjs.map +0 -1
  163. package/dist/generate-document-model-BJXyODfm.mjs +0 -34
  164. package/dist/generate-document-model-BJXyODfm.mjs.map +0 -1
  165. package/dist/generate-editor-BejvaVVT.mjs +0 -48
  166. package/dist/generate-editor-BejvaVVT.mjs.map +0 -1
  167. package/dist/generate-processor-_WOx-mMe.mjs +0 -40
  168. package/dist/generate-processor-_WOx-mMe.mjs.map +0 -1
  169. package/dist/generate-subgraph-BsHUstpl.mjs +0 -38
  170. package/dist/generate-subgraph-BsHUstpl.mjs.map +0 -1
  171. package/dist/init-BZP6gvYd.mjs.map +0 -1
  172. package/dist/inspect-DXjbQEV_.mjs.map +0 -1
  173. package/dist/migrate-jGKfE02L.mjs +0 -83
  174. package/dist/migrate-jGKfE02L.mjs.map +0 -1
  175. package/dist/switchboard-CJMoMzWx.mjs +0 -75
  176. package/dist/switchboard-CJMoMzWx.mjs.map +0 -1
  177. package/dist/switchboard-iRFugh8I.mjs +0 -4
  178. package/dist/switchboard-reset-BcQXlcVf.mjs.map +0 -1
  179. package/dist/utils-BzwczAW-.mjs +0 -4
  180. package/dist/vetra-DkF6EJMY.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files-D6_euBBn.mjs","sources":["../src/services/build-control.ts","../src/services/release/revision.ts","../src/services/release/approval.ts","../src/services/release/pack.ts","../src/services/release/files.ts"],"sourcesContent":["import { basename, join, posix, sep } from \"node:path\";\n\n/** Scratch space of `ph build`, per package. */\nexport const BUILD_DIRECTORY = join(\".ph\", \"build\");\nexport const LOCK_FILE = join(BUILD_DIRECTORY, \"lock\");\n\nexport const takeoverPrefix = (lockName: string) => `${lockName}.takeover-`;\nexport const pendingPrefix = (fileName: string) => `.${fileName}.`;\n\nexport function isBuildLockFile(path: string): boolean {\n const lockName = basename(LOCK_FILE);\n const name = posix.basename(path);\n return (\n posix.dirname(path) === BUILD_DIRECTORY.split(sep).join(\"/\") &&\n (name === lockName ||\n name.startsWith(takeoverPrefix(lockName)) ||\n name.startsWith(pendingPrefix(lockName)))\n );\n}\n","import { createHash } from \"node:crypto\";\n\nexport type Sha256 = `sha256:${string}`;\n\n/** One file, by its POSIX path relative to the package root, and the hex sha256 of its bytes. */\nexport type FileDigest = { readonly path: string; readonly sha256: string };\n\n/**\n * The package revision: one digest over its files, sorted by path, bound to\n * the given values (the ph-cli version), so the same files under another\n * ph-cli are another revision.\n */\nexport function packageRevision(\n files: readonly FileDigest[],\n bindings: Readonly<Record<string, string>>,\n): Sha256 {\n const hash = createHash(\"sha256\");\n for (const { path, sha256 } of [...files].sort(byPath)) {\n hash.update(`${path}\\0${sha256}\\n`);\n }\n for (const key of Object.keys(bindings).sort()) {\n hash.update(`binding:${key}\\0${bindings[key]}\\n`);\n }\n return `sha256:${hash.digest(\"hex\")}`;\n}\n\nexport function byPath(left: FileDigest, right: FileDigest): number {\n return left.path < right.path ? -1 : left.path > right.path ? 1 : 0;\n}\n\n/** Paths added, removed or with other bytes in `after`, sorted. */\nexport function changedPaths(\n before: readonly FileDigest[],\n after: readonly FileDigest[],\n): string[] {\n const was = new Map(before.map(({ path, sha256 }) => [path, sha256]));\n const now = new Map(after.map(({ path, sha256 }) => [path, sha256]));\n return [...new Set([...was.keys(), ...now.keys()])]\n .filter((path) => was.get(path) !== now.get(path))\n .sort();\n}\n","import { z } from \"zod\";\nimport { type FileDigest, packageRevision } from \"./revision.js\";\n\n/** Where `ph build --release` records its approval, relative to the package root. */\nexport const RELEASE_APPROVAL_PATH = \".ph/build/release-approval.json\";\n\n/** The binding key of the ph-cli version in the package revision. */\nexport const PH_CLI_BINDING = \"ph-cli\";\n\nconst fileDigest = z.object({\n path: z.string(),\n sha256: z.string().regex(/^[0-9a-f]{64}$/),\n});\n\nconst hostFinding = z.looseObject({\n kind: z.enum([\n \"scalar-unbound\",\n \"scalar-mismatch\",\n \"scalar-uncomparable\",\n \"definition-invalid\",\n \"definition-mismatch\",\n ]),\n documentType: z.string(),\n scalar: z.string().optional(),\n});\n\nconst approvalSchema = z.object({\n kind: z.literal(\"powerhouse.release-approval\"),\n formatVersion: z.literal(1),\n phCliVersion: z.string(),\n /** POSIX, relative to the package root: the output directory the build replaced. */\n outDir: z.string(),\n packageRevision: z.object({\n digest: z.templateLiteral([\"sha256:\", z.string()]),\n /** Compiler outputs left out besides the fixed exclusions, POSIX and package relative. */\n excluded: z.array(z.string()).readonly(),\n }),\n /** What `npm pack` publishes, sorted by path. */\n publishedFiles: z.array(fileDigest).readonly(),\n report: z.object({\n profile: z.literal(\"release\"),\n status: z.enum([\"ok\", \"invalid\", \"failed\", \"skipped\"]),\n definitions: z\n .array(z.looseObject({ kind: z.string(), key: z.string() }))\n .readonly(),\n }),\n scalars: z\n .array(\n z.object({\n scalar: z.string(),\n packageName: z.string(),\n version: z.string().nullable(),\n }),\n )\n .readonly(),\n hostValidation: z.discriminatedUnion(\"completed\", [\n z.object({\n completed: z.literal(true),\n findings: z.array(hostFinding).readonly(),\n }),\n z.object({\n completed: z.literal(false),\n reason: z.string(),\n findings: z.array(hostFinding).readonly(),\n }),\n ]),\n});\n\n/** `.ph/build/release-approval.json`: what a successful `ph build --release` checked and built. */\nexport type ReleaseApproval = z.infer<typeof approvalSchema>;\n\n/** One scalar the package's models use, and the package and version that provide it. */\nexport type ScalarBinding = ReleaseApproval[\"scalars\"][number];\n\nexport type ApprovalRead =\n | { readonly kind: \"missing\" }\n | { readonly kind: \"unreadable\"; readonly reason: string }\n | { readonly kind: \"found\"; readonly approval: ReleaseApproval };\n\n/** Parses an approval file's text. */\nexport function parseReleaseApproval(\n text: string,\n): Exclude<ApprovalRead, { kind: \"missing\" }> {\n let json: unknown;\n try {\n json = JSON.parse(text);\n } catch {\n return { kind: \"unreadable\", reason: \"it is not JSON\" };\n }\n const parsed = approvalSchema.safeParse(json);\n if (parsed.success) return { kind: \"found\", approval: parsed.data };\n const [issue] = parsed.error.issues;\n const at = issue.path.length > 0 ? ` at ${issue.path.join(\".\")}` : \"\";\n return {\n kind: \"unreadable\",\n reason: `it is not an approval this ph-cli reads (${issue.message}${at})`,\n };\n}\n\n/** The package as it is now, read with the approval's output directory and exclusions. */\nexport type CurrentRelease = {\n readonly phCliVersion: string;\n /** The files the package revision reads. */\n readonly files: readonly FileDigest[];\n readonly publishedFiles: readonly FileDigest[];\n};\n\ntype Reasons = readonly [string, ...string[]];\n\n/** Whether the package may be published as the approval describes it, and why not. */\nexport type ReleaseDecision =\n | { readonly decision: \"approved\"; readonly reasons: readonly [] }\n | {\n readonly decision: \"missing\" | \"unreadable\" | \"stale\" | \"refused\";\n readonly reasons: Reasons;\n };\n\n/** The decision when there is no approval to compare. */\nexport function decisionWithoutApproval(\n read: Exclude<ApprovalRead, { kind: \"found\" }>,\n): ReleaseDecision {\n return read.kind === \"missing\"\n ? {\n decision: \"missing\",\n reasons: [\n `there is no release approval (${RELEASE_APPROVAL_PATH}); ph build --release writes one`,\n ],\n }\n : {\n decision: \"unreadable\",\n reasons: [\n `the release approval (${RELEASE_APPROVAL_PATH}) cannot be read: ${read.reason}`,\n ],\n };\n}\n\nconst LISTED = 5;\n\n/** Up to five items, then how many more. */\nexport function listed(items: readonly string[]): string {\n const shown = items.slice(0, LISTED).join(\", \");\n return items.length > LISTED\n ? `${shown} and ${items.length - LISTED} more`\n : shown;\n}\n\nconst plural = (count: number, one: string, many: string) =>\n `${count} ${count === 1 ? one : many}`;\n\nfunction describeFinding(\n finding: ReleaseApproval[\"hostValidation\"][\"findings\"][number],\n): string {\n return finding.scalar === undefined\n ? `${finding.kind} in ${finding.documentType}`\n : `${finding.kind} ${finding.scalar} in ${finding.documentType}`;\n}\n\nfunction refusalReasons(approval: ReleaseApproval): string[] {\n const { report, hostValidation } = approval;\n const reasons: string[] = [];\n if (report.status === \"invalid\" || report.status === \"failed\") {\n reasons.push(`its release check reported ${report.status}`);\n }\n if (!hostValidation.completed) {\n reasons.push(`host validation did not complete: ${hostValidation.reason}`);\n }\n if (hostValidation.findings.length > 0) {\n reasons.push(\n `host validation found ${plural(hostValidation.findings.length, \"problem\", \"problems\")}: ${listed(hostValidation.findings.map(describeFinding))}`,\n );\n }\n return reasons;\n}\n\nfunction staleReasons(\n approval: ReleaseApproval,\n current: CurrentRelease,\n): string[] {\n const reasons: string[] = [];\n if (approval.phCliVersion !== current.phCliVersion) {\n reasons.push(\n `it was made by ph-cli ${approval.phCliVersion}, and this is ph-cli ${current.phCliVersion}`,\n );\n }\n // Under the approval's own binding, so a new ph-cli alone does not read as edited files.\n const revision = packageRevision(current.files, {\n [PH_CLI_BINDING]: approval.phCliVersion,\n });\n if (revision !== approval.packageRevision.digest) {\n reasons.push(\"the package's files changed since the approval was made\");\n }\n const approved = new Map(\n approval.publishedFiles.map(({ path, sha256 }) => [path, sha256]),\n );\n const now = new Map(\n current.publishedFiles.map(({ path, sha256 }) => [path, sha256]),\n );\n const added = [...now.keys()].filter((path) => !approved.has(path));\n const removed = [...approved.keys()].filter((path) => !now.has(path));\n const changed = [...now].filter(\n ([path, sha256]) => approved.has(path) && approved.get(path) !== sha256,\n );\n const files = (paths: readonly string[], what: string) =>\n `${plural(paths.length, \"published file\", \"published files\")} ${what} since the approval was made: ${listed(paths)}`;\n if (added.length > 0) reasons.push(files(added, \"added\"));\n if (removed.length > 0) reasons.push(files(removed, \"removed\"));\n if (changed.length > 0) {\n reasons.push(\n files(\n changed.map(([path]) => path),\n \"changed\",\n ),\n );\n }\n return reasons;\n}\n\nfunction decided(\n decision: \"stale\" | \"refused\",\n reasons: readonly string[],\n): ReleaseDecision | undefined {\n if (reasons.length === 0) return undefined;\n const [first, ...rest] = reasons;\n return { decision, reasons: [first, ...rest] };\n}\n\n/**\n * Whether the package as it is now is the one the approval checked. Refused\n * when the approval records a failed check; stale when ph-cli, the package's\n * files or the published files changed since.\n */\nexport function verifyReleaseApproval(\n approval: ReleaseApproval,\n current: CurrentRelease,\n): ReleaseDecision {\n return (\n decided(\"refused\", refusalReasons(approval)) ??\n decided(\"stale\", staleReasons(approval, current)) ?? {\n decision: \"approved\",\n reasons: [],\n }\n );\n}\n","import { spawnSync } from \"node:child_process\";\nimport { createHash } from \"node:crypto\";\nimport {\n mkdtempSync,\n readdirSync,\n readFileSync,\n realpathSync,\n rmSync,\n} from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { join, posix } from \"node:path\";\nimport { gunzipSync } from \"node:zlib\";\nimport { z } from \"zod\";\nimport { isBuildLockFile } from \"../build-control.js\";\nimport { RELEASE_APPROVAL_PATH } from \"./approval.js\";\nimport { byPath, type FileDigest } from \"./revision.js\";\n\nexport type PackedRelease = {\n readonly directory: string;\n readonly tarball: string;\n readonly manifest: PackedManifest;\n readonly files: ReadonlyMap<string, Buffer>;\n readonly dispose: () => void;\n};\n\nconst manifestSchema = z.looseObject({\n name: z.string(),\n version: z.string(),\n main: z.string().optional(),\n exports: z.unknown().optional(),\n dependencies: z.record(z.string(), z.string()).optional(),\n optionalDependencies: z.record(z.string(), z.string()).optional(),\n peerDependencies: z.record(z.string(), z.string()).optional(),\n});\n\nexport type PackedManifest = z.infer<typeof manifestSchema>;\n\nconst packListing = z.array(\n z.object({ name: z.string(), version: z.string(), filename: z.string() }),\n);\n\n/** npm refuses `--workspaces=false` while its configuration selects one. */\nconst SELECTS_WORKSPACE = /--no-workspaces and --workspace/;\n\nexport const selectsAnotherPackage = (packageRoot: string) =>\n `npm's configuration (a workspace setting in the environment or an .npmrc) selects a package other than the one in ${packageRoot}; the release approval covers that package only.`;\n\nconst BLOCK = 512;\n\nfunction field(header: Buffer, start: number, length: number): string {\n const bytes = header.subarray(start, start + length);\n const end = bytes.indexOf(0);\n return bytes.subarray(0, end === -1 ? length : end).toString(\"utf8\");\n}\n\nfunction paxPath(body: Buffer): string | undefined {\n for (let offset = 0; offset < body.length;) {\n const space = body.indexOf(0x20, offset);\n const length = Number(body.subarray(offset, space).toString(\"ascii\"));\n if (space === -1 || !(length > 0)) return undefined;\n const record = body\n .subarray(space + 1, offset + length - 1)\n .toString(\"utf8\");\n if (record.startsWith(\"path=\")) return record.slice(\"path=\".length);\n offset += length;\n }\n return undefined;\n}\n\nexport function readTarball(tarball: string): Map<string, Buffer> {\n const tar = gunzipSync(readFileSync(tarball));\n const files = new Map<string, Buffer>();\n let longPath: string | undefined;\n for (let offset = 0; offset + BLOCK <= tar.length;) {\n const header = tar.subarray(offset, offset + BLOCK);\n if (header.every((byte) => byte === 0)) break;\n const size = parseInt(field(header, 124, 12).trim() || \"0\", 8);\n const type = String.fromCharCode(header[156] || 48);\n const body = tar.subarray(offset + BLOCK, offset + BLOCK + size);\n offset += BLOCK + Math.ceil(size / BLOCK) * BLOCK;\n if (type === \"x\") {\n longPath = paxPath(body) ?? longPath;\n continue;\n }\n if (type === \"L\") {\n longPath = field(body, 0, body.length);\n continue;\n }\n if (type === \"g\") continue;\n const prefix = field(header, 345, 155);\n const name = field(header, 0, 100);\n const path = longPath ?? (prefix === \"\" ? name : `${prefix}/${name}`);\n longPath = undefined;\n if (type === \"5\") continue;\n const inside = posix.normalize(path.split(\"/\").slice(1).join(\"/\"));\n if (\n inside === \".\" ||\n inside.startsWith(\"../\") ||\n posix.isAbsolute(inside)\n ) {\n throw new Error(`the tarball has an entry outside the package: ${path}`);\n }\n const bytes =\n type === \"1\" || type === \"2\"\n ? Buffer.from(field(header, 157, 100))\n : Buffer.from(body);\n files.set(inside, bytes);\n }\n return files;\n}\n\nexport function packRelease(packageRoot: string): PackedRelease {\n const directory = realpathSync.native(\n mkdtempSync(join(tmpdir(), \"ph-release-\")),\n );\n const dispose = () => rmSync(directory, { recursive: true, force: true });\n try {\n const packed = spawnSync(\n \"npm\",\n [\n \"pack\",\n \"--json\",\n \"--ignore-scripts\",\n \"--workspaces=false\",\n \"--pack-destination\",\n // cmd.exe splits an unquoted path at its spaces.\n process.platform === \"win32\" ? `\"${directory}\"` : directory,\n ],\n {\n cwd: packageRoot,\n encoding: \"utf8\",\n maxBuffer: 256 * 1024 * 1024,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n shell: process.platform === \"win32\",\n },\n );\n if (packed.status !== 0) {\n if (SELECTS_WORKSPACE.test(`${packed.stdout}${packed.stderr}`)) {\n throw new Error(selectsAnotherPackage(packageRoot));\n }\n throw new Error(\n `npm pack could not pack the package: ${(packed.stderr || packed.error?.message || packed.stdout).trim()}`,\n );\n }\n const listings = packListing.parse(JSON.parse(packed.stdout));\n const root = z\n .object({ name: z.string(), version: z.string() })\n .parse(\n JSON.parse(readFileSync(join(packageRoot, \"package.json\"), \"utf8\")),\n );\n const [listing] = listings;\n const tarballs = readdirSync(directory);\n if (\n listings.length !== 1 ||\n listing.name !== root.name ||\n listing.version !== root.version ||\n tarballs.length !== 1\n ) {\n const packs = listings.map(({ name, version }) => `${name}@${version}`);\n throw new Error(\n `npm pack packs ${packs.join(\", \") || \"no package\"}, not ${root.name}@${root.version}: ${selectsAnotherPackage(packageRoot)}`,\n );\n }\n const tarball = join(directory, tarballs[0]);\n const files = readTarball(tarball);\n const manifestBytes = files.get(\"package.json\");\n if (manifestBytes === undefined) {\n throw new Error(\"npm pack wrote a tarball without a package.json\");\n }\n const manifest = manifestSchema.parse(\n JSON.parse(manifestBytes.toString(\"utf8\")),\n );\n return { directory, tarball, manifest, files, dispose };\n } catch (error) {\n dispose();\n throw error;\n }\n}\n\nexport function packedDigests(packed: PackedRelease): FileDigest[] {\n return [...packed.files]\n .filter(\n ([path]) => path !== RELEASE_APPROVAL_PATH && !isBuildLockFile(path),\n )\n .map(([path, bytes]) => ({\n path,\n sha256: createHash(\"sha256\").update(bytes).digest(\"hex\"),\n }))\n .sort(byPath);\n}\n","import { spawnSync } from \"node:child_process\";\nimport { createHash } from \"node:crypto\";\nimport {\n type Dirent,\n existsSync,\n lstatSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n readlinkSync,\n renameSync,\n rmSync,\n writeFileSync,\n} from \"node:fs\";\nimport { dirname, join, relative, resolve, sep } from \"node:path\";\nimport {\n type ApprovalRead,\n parseReleaseApproval,\n RELEASE_APPROVAL_PATH,\n type ReleaseApproval,\n} from \"./approval.js\";\nimport { packedDigests, packRelease } from \"./pack.js\";\nimport { byPath, type FileDigest } from \"./revision.js\";\n\nconst ALWAYS_EXCLUDED = new Set([\"node_modules\", \".git\", \".ph\"]);\n// A build's stage and retired tree, beside its output while it runs.\nconst BUILD_SCRATCH = /^\\..+\\.ph-(stage|old)-/;\n\nconst toPosix = (path: string) => path.split(sep).join(\"/\");\n\n/** `path` relative to the package root, in POSIX form. */\nexport function packagePath(packageRoot: string, path: string): string {\n return toPosix(relative(packageRoot, resolve(packageRoot, path)));\n}\n\nfunction sha256(bytes: string | Buffer): string {\n return createHash(\"sha256\").update(bytes).digest(\"hex\");\n}\n\n/** A file's digest; a symlink's is its target text, which is not followed. */\nfunction digestOf(packageRoot: string, path: string): FileDigest | undefined {\n const absolute = join(packageRoot, ...path.split(\"/\"));\n const stat = lstatSync(absolute, { throwIfNoEntry: false });\n if (stat?.isSymbolicLink()) {\n return { path, sha256: sha256(toPosix(readlinkSync(absolute))) };\n }\n return stat?.isFile()\n ? { path, sha256: sha256(readFileSync(absolute)) }\n : undefined;\n}\n\nfunction insideWorkTree(packageRoot: string): boolean {\n const probe = spawnSync(\"git\", [\"rev-parse\", \"--is-inside-work-tree\"], {\n cwd: packageRoot,\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n });\n return probe.status === 0 && probe.stdout.trim() === \"true\";\n}\n\n/** Tracked and untracked files git does not ignore, relative to the package root. */\nfunction gitFiles(packageRoot: string): string[] {\n const listed = spawnSync(\n \"git\",\n [\"ls-files\", \"-co\", \"--exclude-standard\", \"-z\"],\n {\n cwd: packageRoot,\n encoding: \"utf8\",\n maxBuffer: 256 * 1024 * 1024,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n },\n );\n if (listed.status !== 0) {\n throw new Error(\n `git ls-files could not list the package's files: ${listed.stderr || listed.error?.message}`,\n );\n }\n return [...new Set(listed.stdout.split(\"\\0\").filter(Boolean))];\n}\n\n/**\n * Every file under the package root, by POSIX path, without entering a\n * directory `included` rejects. Throws when a directory cannot be read.\n */\nfunction walkedFiles(\n packageRoot: string,\n included: (path: string) => boolean,\n): string[] {\n const files: string[] = [];\n const visit = (directory: string, prefix: string) => {\n let entries: Dirent[];\n try {\n entries = readdirSync(directory, { withFileTypes: true });\n } catch (error) {\n throw new Error(\n `the package directory ${prefix || \".\"} cannot be read: ${error instanceof Error ? error.message : String(error)}`,\n { cause: error },\n );\n }\n for (const entry of entries) {\n const path = prefix === \"\" ? entry.name : `${prefix}/${entry.name}`;\n if (!included(path)) continue;\n if (entry.isDirectory()) {\n visit(join(directory, entry.name), path);\n } else {\n files.push(path);\n }\n }\n };\n visit(packageRoot, \"\");\n return files;\n}\n\n/**\n * The files the package revision reads, with their digests: what git tracks\n * or would track inside a work tree, every file otherwise. Leaves out\n * node_modules, .git, .ph, a build's stage, and each excluded path (the\n * output directory, compiler outputs) with what is under it.\n */\nexport function revisionFiles(\n packageRoot: string,\n excluded: readonly string[],\n): FileDigest[] {\n const included = (path: string) =>\n !path\n .split(\"/\")\n .some(\n (segment) =>\n ALWAYS_EXCLUDED.has(segment) || BUILD_SCRATCH.test(segment),\n ) &&\n !excluded.some(\n (exclusion) => path === exclusion || path.startsWith(`${exclusion}/`),\n );\n const paths = insideWorkTree(packageRoot)\n ? gitFiles(packageRoot)\n : walkedFiles(packageRoot, included);\n return paths\n .filter(included)\n .flatMap((path) => digestOf(packageRoot, path) ?? [])\n .sort(byPath);\n}\n\n/**\n * What `npm pack` publishes from the package root, with digests read from the\n * packed tarball. Workspaces are off, so npm packs the root package or\n * refuses; a tarball of another package than the root's package.json names\n * throws as well.\n */\nexport function publishedFiles(packageRoot: string): FileDigest[] {\n const packed = packRelease(packageRoot);\n try {\n return packedDigests(packed);\n } finally {\n packed.dispose();\n }\n}\n\nconst approvalFile = (packageRoot: string) =>\n join(packageRoot, ...RELEASE_APPROVAL_PATH.split(\"/\"));\n\nexport function readReleaseApproval(packageRoot: string): ApprovalRead {\n const file = approvalFile(packageRoot);\n if (!existsSync(file)) return { kind: \"missing\" };\n let text: string;\n try {\n text = readFileSync(file, \"utf8\");\n } catch (error) {\n return {\n kind: \"unreadable\",\n reason: error instanceof Error ? error.message : String(error),\n };\n }\n return parseReleaseApproval(text);\n}\n\n/** Replaces the approval in one rename, so a reader never sees half of one. */\nexport function writeReleaseApproval(\n packageRoot: string,\n approval: ReleaseApproval,\n): void {\n const file = approvalFile(packageRoot);\n mkdirSync(dirname(file), { recursive: true });\n const temporary = `${file}.${process.pid}.tmp`;\n try {\n writeFileSync(temporary, `${JSON.stringify(approval, null, 2)}\\n`);\n renameSync(temporary, file);\n } finally {\n rmSync(temporary, { force: true });\n }\n}\n"],"names":["z.object","z.string","z.looseObject","z.enum","z.literal","z.templateLiteral","z.array","z\n .array","z\n .array","z.discriminatedUnion","z.looseObject","z.string","z.unknown","z.record","z.array","z.object","z\n .object"],"mappings":";;;;;;;;;;;AAGA,MAAa,kBAAkB,KAAK,OAAO,OAAO;AAClD,MAAa,YAAY,KAAK,iBAAiB,MAAM;AAErD,MAAa,kBAAkB,aAAqB,GAAG,SAAS;AAChE,MAAa,iBAAiB,aAAqB,IAAI,SAAS;AAEhE,SAAgB,gBAAgB,MAAuB;CACrD,MAAM,WAAW,SAAS,SAAS;CACnC,MAAM,OAAO,MAAM,SAAS,IAAI;CAChC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C,UAAU,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;CAC5C,MAAM,YAAY,GAAG,KAAK,GAAG,QAAQ,IAAI;CACzC,IAAI;EACF,cAAc,WAAW,GAAG,KAAK,UAAU,UAAU,MAAM,CAAC,EAAE,GAAG;EACjE,WAAW,WAAW,IAAI;CAC5B,UAAU;EACR,OAAO,WAAW,EAAE,OAAO,KAAK,CAAC;CACnC;AACF","debug_id":"fe8bf27c-1748-57ef-aec3-baf7d689bdaa"}
@@ -0,0 +1,36 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d4e58662-4f9c-5d0e-bf7e-6b0f5fb5f539")}catch(e){}}();
3
+ import { t as isUniformRunnersEnabled } from "./feature-flags-xwqcHEWC.mjs";
4
+ import { M as probeHostsFolder } from "./compound-DO_mvh0O-Dp1YPhR0.mjs";
5
+ import { t as warnSubgraphTypeConflicts } from "./warn-subgraph-type-conflicts-BOHBmThq.mjs";
6
+ import { n as selectProjectModelGeneration } from "./authoring-mode-DWbbsuWh.mjs";
7
+ import { t as startGenerateHosts } from "./generate-hosts-BFmPIW2X.mjs";
8
+ import { buildTsMorphProject } from "@powerhousedao/codegen/utils";
9
+ import { extractAllDocuments, saveSpec } from "@powerhousedao/vetra/codegen";
10
+ //#region src/services/generate-all.ts
11
+ async function startGenerateAll(args, projectDir) {
12
+ const project = buildTsMorphProject(projectDir);
13
+ if (args.extract) {
14
+ const all = extractAllDocuments(project);
15
+ for (const doc of [
16
+ ...all.documentModels,
17
+ ...all.editors,
18
+ ...all.processors,
19
+ ...all.subgraphs,
20
+ ...all.apps
21
+ ]) {
22
+ const path = await saveSpec(doc, projectDir);
23
+ console.log(`Wrote ${path}`);
24
+ }
25
+ return;
26
+ }
27
+ await selectProjectModelGeneration(projectDir).generateAll(project);
28
+ await project.save();
29
+ await warnSubgraphTypeConflicts(projectDir);
30
+ if (isUniformRunnersEnabled() && probeHostsFolder(projectDir).kind === "present" && !await startGenerateHosts(projectDir)) process.exitCode = 1;
31
+ }
32
+ //#endregion
33
+ export { startGenerateAll };
34
+
35
+ //# sourceMappingURL=generate-all-_7S0Iii2.mjs.map
36
+ //# debugId=d4e58662-4f9c-5d0e-bf7e-6b0f5fb5f539
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-all-_7S0Iii2.mjs","sources":["../src/services/generate-all.ts"],"sourcesContent":["import { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport { extractAllDocuments, saveSpec } from \"@powerhousedao/vetra/codegen\";\nimport { probeHostsFolder } from \"@powerhousedao/host-core\";\nimport { isUniformRunnersEnabled } from \"../utils/feature-flags.js\";\nimport { warnSubgraphTypeConflicts } from \"../utils/warn-subgraph-type-conflicts.js\";\nimport { selectProjectModelGeneration } from \"./definitions/authoring-mode.js\";\nimport { startGenerateHosts } from \"./generate-hosts.js\";\n\nexport async function startGenerateAll(\n args: { extract?: boolean },\n projectDir: string,\n) {\n const project = buildTsMorphProject(projectDir);\n if (args.extract) {\n const all = extractAllDocuments(project);\n for (const doc of [\n ...all.documentModels,\n ...all.editors,\n ...all.processors,\n ...all.subgraphs,\n ...all.apps,\n ]) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n await selectProjectModelGeneration(projectDir).generateAll(project);\n await project.save();\n await warnSubgraphTypeConflicts(projectDir);\n if (\n isUniformRunnersEnabled() &&\n probeHostsFolder(projectDir).kind === \"present\" &&\n !(await startGenerateHosts(projectDir))\n ) {\n process.exitCode = 1;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAQA,eAAsB,iBACpB,MACA,YACA;CACA,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,KAAK,SAAS;EAChB,MAAM,MAAM,oBAAoB,OAAO;EACvC,KAAK,MAAM,OAAO;GAChB,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;EACT,GAAG;GACD,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,MAAM,6BAA6B,UAAU,CAAC,CAAC,YAAY,OAAO;CAClE,MAAM,QAAQ,KAAK;CACnB,MAAM,0BAA0B,UAAU;CAC1C,IACE,wBAAwB,KACxB,iBAAiB,UAAU,CAAC,CAAC,SAAS,aACtC,CAAE,MAAM,mBAAmB,UAAU,GAErC,QAAQ,WAAW;AAEvB","debug_id":"d4e58662-4f9c-5d0e-bf7e-6b0f5fb5f539"}
@@ -0,0 +1,72 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="598034cf-aa42-5189-8607-4625d64996ff")}catch(e){}}();
3
+ import { t as resolveModuleDirName } from "./module-dir-1avCXsBi.mjs";
4
+ import { existsSync } from "node:fs";
5
+ import { join } from "node:path";
6
+ import { generateAllApps, generateApp } from "@powerhousedao/codegen";
7
+ import { buildTsMorphProject, getAppMetadata, getEditorMetadata } from "@powerhousedao/codegen/utils";
8
+ import { extractAppDocuments, generateAppFromDocument, getDocument, saveSpec } from "@powerhousedao/vetra/codegen";
9
+ //#region src/services/generate-app.ts
10
+ const MODULE_FILE_EXPECTATION = "an EditorModule with string literals for config.id, config.name and documentTypes";
11
+ async function startGenerateApp(args, projectDir) {
12
+ const { name, allowedDocumentTypes = [], disableDragAndDrop, document, dir, all, extract, debug } = args;
13
+ if (debug) console.log({ args });
14
+ const project = buildTsMorphProject(projectDir);
15
+ if (extract) {
16
+ const docs = extractAppDocuments(project);
17
+ if (docs.length === 0) console.log("No drive apps found in editors/.");
18
+ for (const doc of docs) {
19
+ const path = await saveSpec(doc, projectDir);
20
+ console.log(`Wrote ${path}`);
21
+ }
22
+ return;
23
+ }
24
+ if (all) {
25
+ const { apps, unreadableDirs } = await generateAllApps(project);
26
+ await project.save();
27
+ if (apps.length === 0 && unreadableDirs.length === 0) console.log("No drive apps found in editors/.");
28
+ for (const app of apps) console.log(`Regenerated app "${app.name}" in editors/${app.dirName}`);
29
+ for (const dirName of unreadableDirs) console.warn(`Skipped editors/${dirName}: expected its module.ts to export ${MODULE_FILE_EXPECTATION}. Kept the manifest's apps.`);
30
+ return;
31
+ } else if (document) {
32
+ const doc = await getDocument(document);
33
+ await generateAppFromDocument(doc, project);
34
+ } else if (name) await generateApp({
35
+ appName: name,
36
+ allowedDocumentTypes,
37
+ isDragAndDropEnabled: !disableDragAndDrop
38
+ }, project);
39
+ else if (dir) {
40
+ const appMetadata = getAppMetadata(project, resolveAppDirName(project, projectDir, dir));
41
+ if (!appMetadata) throw new Error(`Failed to get data for app in dir "${dir}"`);
42
+ const { name: appName, id: appId, dirName: appDirName, allowedDocumentTypes, isDragAndDropEnabled } = appMetadata;
43
+ await generateApp({
44
+ appName,
45
+ appId,
46
+ appDirName,
47
+ allowedDocumentTypes,
48
+ isDragAndDropEnabled
49
+ }, project);
50
+ await project.save();
51
+ console.log(`Regenerated app "${appName}" in editors/${appDirName}`);
52
+ return;
53
+ } else {
54
+ console.log("Please specify one of `name`, `document`, `dir`, `all`, or `extract`.");
55
+ return;
56
+ }
57
+ await project.save();
58
+ }
59
+ /** The app directory that `--dir` names, checked to hold a drive app's module.ts */
60
+ function resolveAppDirName(project, projectDir, dir) {
61
+ const dirName = resolveModuleDirName(projectDir, "editors", dir, "my-app");
62
+ if (!existsSync(join(projectDir, "editors", dirName, "module.ts"))) throw new Error(`editors/${dirName} has no module.ts.`);
63
+ const editorMetadata = getEditorMetadata(project, dirName);
64
+ if (!editorMetadata) throw new Error(`Could not read editors/${dirName}/module.ts: expected ${MODULE_FILE_EXPECTATION}.`);
65
+ if (!editorMetadata.documentTypes.includes("powerhouse/document-drive")) throw new Error(`editors/${dirName} is a document editor, not a drive app: its documentTypes don't include "powerhouse/document-drive". Use \`ph-cli generate editor --dir ${dirName}\` instead.`);
66
+ return dirName;
67
+ }
68
+ //#endregion
69
+ export { startGenerateApp };
70
+
71
+ //# sourceMappingURL=generate-app-hm6CJ_4O.mjs.map
72
+ //# debugId=598034cf-aa42-5189-8607-4625d64996ff
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-app-hm6CJ_4O.mjs","sources":["../src/services/generate-app.ts"],"sourcesContent":["import { generateAllApps, generateApp } from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getAppMetadata,\n getEditorMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractAppDocuments,\n generateAppFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { AppModuleDocument } from \"@powerhousedao/vetra/document-models/app-module\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { GenerateAppArgs } from \"../types.js\";\nimport { resolveModuleDirName } from \"../utils/module-dir.js\";\n\nconst MODULE_FILE_EXPECTATION =\n \"an EditorModule with string literals for config.id, config.name and documentTypes\";\n\nexport async function startGenerateApp(\n args: GenerateAppArgs,\n projectDir: string,\n) {\n const {\n name,\n allowedDocumentTypes = [],\n disableDragAndDrop,\n document,\n dir,\n all,\n extract,\n debug,\n } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractAppDocuments(project);\n if (docs.length === 0) {\n console.log(\"No drive apps found in editors/.\");\n }\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n if (all) {\n const { apps, unreadableDirs } = await generateAllApps(project);\n await project.save();\n if (apps.length === 0 && unreadableDirs.length === 0) {\n console.log(\"No drive apps found in editors/.\");\n }\n for (const app of apps) {\n console.log(`Regenerated app \"${app.name}\" in editors/${app.dirName}`);\n }\n for (const dirName of unreadableDirs) {\n console.warn(\n `Skipped editors/${dirName}: expected its module.ts to export ${MODULE_FILE_EXPECTATION}. Kept the manifest's apps.`,\n );\n }\n return;\n } else if (document) {\n const doc = (await getDocument(document)) as AppModuleDocument;\n await generateAppFromDocument(doc, project);\n } else if (name) {\n await generateApp(\n {\n appName: name,\n allowedDocumentTypes,\n isDragAndDropEnabled: !disableDragAndDrop,\n },\n project,\n );\n } else if (dir) {\n const appMetadata = getAppMetadata(\n project,\n resolveAppDirName(project, projectDir, dir),\n );\n if (!appMetadata) {\n throw new Error(`Failed to get data for app in dir \"${dir}\"`);\n }\n const {\n name: appName,\n id: appId,\n dirName: appDirName,\n allowedDocumentTypes,\n isDragAndDropEnabled,\n } = appMetadata;\n\n await generateApp(\n {\n appName,\n appId,\n appDirName,\n allowedDocumentTypes,\n isDragAndDropEnabled,\n },\n project,\n );\n await project.save();\n console.log(`Regenerated app \"${appName}\" in editors/${appDirName}`);\n return;\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n}\n\n/** The app directory that `--dir` names, checked to hold a drive app's module.ts */\nfunction resolveAppDirName(\n project: ReturnType<typeof buildTsMorphProject>,\n projectDir: string,\n dir: string,\n) {\n const dirName = resolveModuleDirName(projectDir, \"editors\", dir, \"my-app\");\n if (!existsSync(join(projectDir, \"editors\", dirName, \"module.ts\"))) {\n throw new Error(`editors/${dirName} has no module.ts.`);\n }\n const editorMetadata = getEditorMetadata(project, dirName);\n if (!editorMetadata) {\n throw new Error(\n `Could not read editors/${dirName}/module.ts: expected ${MODULE_FILE_EXPECTATION}.`,\n );\n }\n if (!editorMetadata.documentTypes.includes(\"powerhouse/document-drive\")) {\n throw new Error(\n `editors/${dirName} is a document editor, not a drive app: its documentTypes don't include \"powerhouse/document-drive\". Use \\`ph-cli generate editor --dir ${dirName}\\` instead.`,\n );\n }\n return dirName;\n}\n"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;EACA,MAAM,QAAQ,KAAK;EACnB,QAAQ,IAAI,oBAAoB,QAAQ,eAAe,YAAY;EACnE;CACF,OAAO;EACL,QAAQ,IACN,uEACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;AACrB;;AAGA,SAAS,kBACP,SACA,YACA,KACA;CACA,MAAM,UAAU,qBAAqB,YAAY,WAAW,KAAK,QAAQ;CACzE,IAAI,CAAC,WAAW,KAAK,YAAY,WAAW,SAAS,WAAW,CAAC,GAC/D,MAAM,IAAI,MAAM,WAAW,QAAQ,mBAAmB;CAExD,MAAM,iBAAiB,kBAAkB,SAAS,OAAO;CACzD,IAAI,CAAC,gBACH,MAAM,IAAI,MACR,0BAA0B,QAAQ,uBAAuB,wBAAwB,EACnF;CAEF,IAAI,CAAC,eAAe,cAAc,SAAS,2BAA2B,GACpE,MAAM,IAAI,MACR,WAAW,QAAQ,0IAA0I,QAAQ,YACvK;CAEF,OAAO;AACT","debug_id":"598034cf-aa42-5189-8607-4625d64996ff"}
@@ -0,0 +1,323 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a8b6ffb6-cb4f-5e08-b62d-af05b0350b70")}catch(e){}}();
3
+ import { g as union, i as boolean, m as string, p as strictObject, r as array, u as number } from "./schemas-DzgKfQIx.mjs";
4
+ import "node:module";
5
+ import fs from "node:fs";
6
+ import path from "node:path";
7
+ import "node:child_process";
8
+ import { mapBackgroundImages, validateBackground } from "@powerhousedao/shared/connect";
9
+ import { deflateSync } from "node:zlib";
10
+ import "node:url";
11
+ import { isPassthroughImageRef } from "@powerhousedao/shared/connect/image-ref";
12
+ //#region ../../packages/desktop/dist/bundle-backend-CvUS8-oc.mjs
13
+ /**
14
+ * `hosts/desktop/app.json` — the builder's desktop identity (phase 7, mode 1:
15
+ * the builder ships under THEIR identity without writing Rust). It is the ONE
16
+ * file a builder edits; `shell-project.ts` projects it into a generated
17
+ * `tauri-shell/` that depends on the published `ph-desktop-shell` crate. Every
18
+ * field validates strictly so a typo fails with the field named, not silently.
19
+ */
20
+ const identifierSchema = string().min(1).regex(/^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+$/, "identifier must be reverse-DNS (e.g. com.acme.app): dot-separated alphanumeric segments");
21
+ const windowSchema = strictObject({
22
+ title: string().min(1).optional(),
23
+ width: number().int().positive().optional(),
24
+ height: number().int().positive().optional(),
25
+ resizable: boolean().optional(),
26
+ /** Smallest size the window can be dragged to (logical pixels). */
27
+ minWidth: number().int().positive().optional(),
28
+ minHeight: number().int().positive().optional()
29
+ }).optional();
30
+ const cssColorSchema = string().regex(/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/, "use a hex color (#rgb, #rgba, #rrggbb or #rrggbbaa)");
31
+ /** The loading page's colors. */
32
+ const loadingColorsSchema = strictObject({
33
+ /** Page background (default #0f1115). */
34
+ background: cssColorSchema.nullable().optional(),
35
+ /** Status text color (default #e6e8eb). */
36
+ color: cssColorSchema.nullable().optional(),
37
+ /** The pulsing status dot (default #4ade80). */
38
+ accent: cssColorSchema.nullable().optional()
39
+ });
40
+ /** The loading page's look, so the window opens in the app's own colors
41
+ * instead of the default dark page. Every field is optional, and `null`
42
+ * means the default (the scaffold lists the fields that way). */
43
+ const loadingSchema = loadingColorsSchema.extend({
44
+ /** Status line under the art (default "Starting <productName>…"). */
45
+ message: string().min(1).nullable().optional(),
46
+ /** Colors for `prefers-color-scheme: dark`; without it the page keeps
47
+ * the light colors in both schemes. */
48
+ dark: loadingColorsSchema.nullable().optional(),
49
+ /** Deprecated: a decoration pinned to the bottom-right corner, relative
50
+ * to app.json, with `artDark` its dark-scheme counterpart. Superseded by
51
+ * the top-level `background`, which ignores these when set. */
52
+ art: string().min(1).nullable().optional(),
53
+ artDark: string().min(1).nullable().optional()
54
+ }).nullable().optional();
55
+ const imageRefSchema = string().min(1);
56
+ const schemedImageSchema = union([imageRefSchema, strictObject({
57
+ light: imageRefSchema,
58
+ dark: imageRefSchema.nullable().optional()
59
+ })]);
60
+ const lengthSchema = union([number(), string().min(1)]).nullable().optional();
61
+ const edgesSchema = strictObject({
62
+ top: lengthSchema,
63
+ right: lengthSchema,
64
+ bottom: lengthSchema,
65
+ left: lengthSchema
66
+ }).nullable().optional();
67
+ const backgroundLayerSchema = strictObject({
68
+ src: schemedImageSchema,
69
+ position: edgesSchema,
70
+ width: lengthSchema,
71
+ height: lengthSchema,
72
+ minWidth: lengthSchema,
73
+ minHeight: lengthSchema,
74
+ maxWidth: lengthSchema,
75
+ maxHeight: lengthSchema,
76
+ opacity: number().min(0).max(1).nullable().optional(),
77
+ fade: edgesSchema
78
+ });
79
+ const backgroundSchema = union([imageRefSchema, strictObject({
80
+ color: union([string().min(1), strictObject({
81
+ light: string().min(1),
82
+ dark: string().min(1).nullable().optional()
83
+ })]).nullable().optional(),
84
+ layers: array(backgroundLayerSchema)
85
+ })]).superRefine((background, ctx) => {
86
+ for (const problem of validateBackground(background, "background")) ctx.addIssue({
87
+ code: "custom",
88
+ message: problem
89
+ });
90
+ }).nullable().optional();
91
+ const fileAssociationSchema = strictObject({
92
+ /** Extensions WITHOUT the leading dot ("phd", not ".phd"). */
93
+ ext: array(string().min(1).regex(/^[^.]/, "drop the leading dot")).min(1),
94
+ name: string().min(1),
95
+ description: string().optional(),
96
+ mimeType: string().optional()
97
+ });
98
+ /** Where the generated Cargo.toml resolves `ph-desktop-shell` from. Default
99
+ * (omitted) = the published crates.io version. */
100
+ const shellSourceSchema = strictObject({
101
+ /** Local checkout for shell development (the lab points here). */
102
+ path: string().min(1).optional(),
103
+ /** Git source, pinned to a tag/rev, for pre-publication consumption. */
104
+ git: string().min(1).optional(),
105
+ tag: string().min(1).optional(),
106
+ rev: string().min(1).optional(),
107
+ /** crates.io version requirement (default DEFAULT_SHELL_CRATE_VERSION). */
108
+ version: string().min(1).optional()
109
+ }).refine((s) => !(s.path && s.git), { message: "shell.source: set path OR git, not both" }).optional();
110
+ const appJsonSchema = strictObject({
111
+ identifier: identifierSchema,
112
+ productName: string().min(1),
113
+ /** Ask who is using the app before anything runs: the stack then starts for
114
+ * that identity, with its own folder and as its admin. Off, the stack starts
115
+ * with the window, in one store. */
116
+ signIn: boolean().nullable().optional(),
117
+ /** Single source image (square PNG, 1024×1024 recommended); the icon set
118
+ * for every platform is generated from it via `tauri icon`. */
119
+ icon: string().min(1),
120
+ /** The loading page's background: images positioned and sized over a
121
+ * page colour (`{ color, layers }`), or one image pinned bottom-right.
122
+ * The status line stays centred above them. `ph generate desktop-shell`
123
+ * copies Connect's `connect.branding.homeBackground` here. null or
124
+ * omitted: the app icon (or `splash`) above the status line. */
125
+ background: backgroundSchema,
126
+ /** Deprecated in favour of `background`: a wide splash image shown above
127
+ * the status line instead of the square icon. Relative to this file. */
128
+ splash: string().min(1).nullable().optional(),
129
+ /** Deprecated with `splash`: its `prefers-color-scheme: dark` variant. */
130
+ splashDark: string().min(1).nullable().optional(),
131
+ loading: loadingSchema,
132
+ window: windowSchema,
133
+ fileAssociations: array(fileAssociationSchema).optional(),
134
+ shell: shellSourceSchema
135
+ });
136
+ const APP_JSON_FILE = "app.json";
137
+ path.join(".ph", "connect-build", "dist");
138
+ path.join("dist", "node", "pieces");
139
+ //#endregion
140
+ //#region ../../packages/desktop/dist/index.mjs
141
+ /**
142
+ * A background whose project-relative paths are rewritten to be relative to
143
+ * another directory (powerhouse.config.json's root -> hosts/desktop, where
144
+ * app.json resolves them from). URLs and data URIs are left as they are.
145
+ */
146
+ function rebaseBackground(background, fromDir, toDir) {
147
+ const rebase = (ref) => {
148
+ if (isPassthroughImageRef(ref)) return ref;
149
+ const rel = path.relative(toDir, path.resolve(fromDir, ref)).split(path.sep).join("/");
150
+ return rel.startsWith(".") ? rel : `./${rel}`;
151
+ };
152
+ return typeof background === "string" ? rebase(background) : mapBackgroundImages(background, rebase);
153
+ }
154
+ /** Minimal PNG encoder — a solid square so `tauri icon` always has a valid
155
+ * source. Pure Node (zlib); no binary asset ships in the package. The builder
156
+ * replaces it with their real 1024×1024 artwork. */
157
+ function solidPng(size, rgba) {
158
+ const [r, g, b, a] = rgba;
159
+ const row = Buffer.alloc(1 + size * 4);
160
+ for (let x = 0; x < size; x++) {
161
+ const o = 1 + x * 4;
162
+ row[o] = r;
163
+ row[o + 1] = g;
164
+ row[o + 2] = b;
165
+ row[o + 3] = a;
166
+ }
167
+ const raw = Buffer.concat(Array.from({ length: size }, () => row));
168
+ const idat = deflateSync(raw);
169
+ const chunk = (type, data) => {
170
+ const len = Buffer.alloc(4);
171
+ len.writeUInt32BE(data.length, 0);
172
+ const typeBuf = Buffer.from(type, "ascii");
173
+ const body = Buffer.concat([typeBuf, data]);
174
+ const crc = Buffer.alloc(4);
175
+ crc.writeUInt32BE(crc32(body) >>> 0, 0);
176
+ return Buffer.concat([
177
+ len,
178
+ body,
179
+ crc
180
+ ]);
181
+ };
182
+ const ihdr = Buffer.alloc(13);
183
+ ihdr.writeUInt32BE(size, 0);
184
+ ihdr.writeUInt32BE(size, 4);
185
+ ihdr[8] = 8;
186
+ ihdr[9] = 6;
187
+ ihdr[10] = 0;
188
+ ihdr[11] = 0;
189
+ ihdr[12] = 0;
190
+ return Buffer.concat([
191
+ Buffer.from([
192
+ 137,
193
+ 80,
194
+ 78,
195
+ 71,
196
+ 13,
197
+ 10,
198
+ 26,
199
+ 10
200
+ ]),
201
+ chunk("IHDR", ihdr),
202
+ chunk("IDAT", idat),
203
+ chunk("IEND", Buffer.alloc(0))
204
+ ]);
205
+ }
206
+ let crcTable;
207
+ function crc32(buf) {
208
+ if (!crcTable) {
209
+ crcTable = [];
210
+ for (let n = 0; n < 256; n++) {
211
+ let c = n;
212
+ for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
213
+ crcTable[n] = c;
214
+ }
215
+ }
216
+ let crc = 4294967295;
217
+ for (let i = 0; i < buf.length; i++) crc = crcTable[(crc ^ buf[i]) & 255] ^ crc >>> 8;
218
+ return crc ^ 4294967295;
219
+ }
220
+ const GITIGNORE = `# Generated tauri shell — only Cargo.lock and app-icon.png are tracked.
221
+ /tauri-shell/target
222
+ /tauri-shell/gen
223
+ /tauri-shell/icons
224
+ /tauri-shell/dist-stack
225
+ /tauri-shell/binaries
226
+ `;
227
+ function scaffoldDesktopShell(hostDir, options) {
228
+ const created = [];
229
+ const skipped = [];
230
+ fs.mkdirSync(hostDir, { recursive: true });
231
+ const iconFile = "icon.png";
232
+ const app = {
233
+ identifier: options.identifier,
234
+ productName: options.productName,
235
+ icon: `./${iconFile}`,
236
+ background: options.background ?? null,
237
+ loading: null,
238
+ window: {
239
+ title: options.productName,
240
+ width: 1440,
241
+ height: 900
242
+ },
243
+ fileAssociations: [{
244
+ ext: ["phd"],
245
+ name: "Powerhouse Document",
246
+ mimeType: "application/vnd.powerhouse.document+zip"
247
+ }]
248
+ };
249
+ appJsonSchema.parse(app);
250
+ const appJsonPath = path.join(hostDir, APP_JSON_FILE);
251
+ if (fs.existsSync(appJsonPath) && !options.force) skipped.push(appJsonPath);
252
+ else {
253
+ fs.writeFileSync(appJsonPath, `${JSON.stringify(app, null, 2)}\n`);
254
+ created.push(appJsonPath);
255
+ }
256
+ const iconPath = path.join(hostDir, iconFile);
257
+ if (fs.existsSync(iconPath)) skipped.push(iconPath);
258
+ else {
259
+ fs.writeFileSync(iconPath, solidPng(1024, [
260
+ 79,
261
+ 70,
262
+ 229,
263
+ 255
264
+ ]));
265
+ created.push(iconPath);
266
+ }
267
+ const gitignorePath = path.join(hostDir, ".gitignore");
268
+ if (fs.existsSync(gitignorePath)) skipped.push(gitignorePath);
269
+ else {
270
+ fs.writeFileSync(gitignorePath, GITIGNORE);
271
+ created.push(gitignorePath);
272
+ }
273
+ return {
274
+ hostDir,
275
+ created,
276
+ skipped
277
+ };
278
+ }
279
+ //#endregion
280
+ //#region src/services/generate-desktop-shell.ts
281
+ /** A reverse-DNS-safe segment from the project name (drop scope, slugify). */
282
+ function projectSlug(pkgName) {
283
+ return (pkgName ?? "app").replace(/^@[^/]+\//, "").toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "") || "app";
284
+ }
285
+ /** `connect.home.background` of the project's powerhouse.config.json, if
286
+ * any (absent or unreadable config: none). */
287
+ function readHomeBackground(cwd) {
288
+ try {
289
+ return JSON.parse(fs.readFileSync(path.join(cwd, "powerhouse.config.json"), "utf8")).connect?.home?.background ?? null;
290
+ } catch {
291
+ return null;
292
+ }
293
+ }
294
+ /** `ph generate desktop-shell`: write hosts/desktop/app.json + a placeholder
295
+ * icon + .gitignore. Defaults product name / identifier from the project. */
296
+ function startGenerateDesktopShell(args, cwd) {
297
+ let pkgName;
298
+ try {
299
+ pkgName = JSON.parse(fs.readFileSync(path.join(cwd, "package.json"), "utf8")).name;
300
+ } catch {}
301
+ const slug = projectSlug(pkgName);
302
+ const productName = args.name ?? pkgName?.replace(/^@[^/]+\//, "") ?? "App";
303
+ const identifier = args.identifier ?? `inc.powerhouse.desktop.${slug}`;
304
+ const hostDir = path.join(cwd, "hosts", "desktop");
305
+ const homeBackground = readHomeBackground(cwd);
306
+ const result = scaffoldDesktopShell(hostDir, {
307
+ identifier,
308
+ productName,
309
+ force: args.force,
310
+ background: homeBackground ? rebaseBackground(homeBackground, cwd, hostDir) : null
311
+ });
312
+ const rel = (p) => path.relative(cwd, p).replace(/\\/g, "/");
313
+ for (const f of result.created) console.log(` created ${rel(f)}`);
314
+ if (homeBackground && result.created.some((f) => f.endsWith("app.json"))) console.log(" copied connect.home.background -> hosts/desktop/app.json background");
315
+ for (const f of result.skipped) console.log(` skipped ${rel(f)} (exists — pass --force to overwrite)`);
316
+ if (!fs.existsSync(path.join(hostDir, "host.js"))) console.log("\nNote: hosts/desktop/host.js not found. Add a desktop host (see the desktop topology from `ph init`) so `ph run desktop` can supervise the stack; app.json then gives it a native window.");
317
+ console.log(`\nIdentity: ${productName} (${identifier}).\n• Replace hosts/desktop/icon.png with your 1024×1024 icon.\n• \`ph run desktop dev\` opens the native window (needs Rust + the Tauri CLI).\n• \`ph run desktop build\` produces installers for this OS.`);
318
+ }
319
+ //#endregion
320
+ export { startGenerateDesktopShell };
321
+
322
+ //# sourceMappingURL=generate-desktop-shell-CEcE_1gb.mjs.map
323
+ //# debugId=a8b6ffb6-cb4f-5e08-b62d-af05b0350b70