@memberjunction/cli 6.3.0-edge.1 → 6.3.0-edge.3

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 (270) hide show
  1. package/README.md +1052 -359
  2. package/dist/baseline/connection.d.ts.map +1 -1
  3. package/dist/baseline/connection.js +12 -1
  4. package/dist/baseline/connection.js.map +1 -1
  5. package/dist/commands/agent/init.d.ts +3 -0
  6. package/dist/commands/agent/init.d.ts.map +1 -1
  7. package/dist/commands/agent/init.js +102 -46
  8. package/dist/commands/agent/init.js.map +1 -1
  9. package/dist/commands/agent/usage.d.ts +7 -0
  10. package/dist/commands/agent/usage.d.ts.map +1 -0
  11. package/dist/commands/agent/usage.js +10 -0
  12. package/dist/commands/agent/usage.js.map +1 -0
  13. package/dist/commands/ai/actions/list.d.ts.map +1 -1
  14. package/dist/commands/ai/actions/list.js +18 -14
  15. package/dist/commands/ai/actions/list.js.map +1 -1
  16. package/dist/commands/ai/actions/run.d.ts.map +1 -1
  17. package/dist/commands/ai/actions/run.js +15 -8
  18. package/dist/commands/ai/actions/run.js.map +1 -1
  19. package/dist/commands/ai/agents/list.d.ts.map +1 -1
  20. package/dist/commands/ai/agents/list.js +18 -14
  21. package/dist/commands/ai/agents/list.js.map +1 -1
  22. package/dist/commands/ai/agents/run.d.ts.map +1 -1
  23. package/dist/commands/ai/agents/run.js +19 -8
  24. package/dist/commands/ai/agents/run.js.map +1 -1
  25. package/dist/commands/ai/audit/agent-run.d.ts.map +1 -1
  26. package/dist/commands/ai/audit/agent-run.js +62 -56
  27. package/dist/commands/ai/audit/agent-run.js.map +1 -1
  28. package/dist/commands/ai/prompts/list.d.ts.map +1 -1
  29. package/dist/commands/ai/prompts/list.js +6 -3
  30. package/dist/commands/ai/prompts/list.js.map +1 -1
  31. package/dist/commands/ai/prompts/run.d.ts.map +1 -1
  32. package/dist/commands/ai/prompts/run.js +17 -10
  33. package/dist/commands/ai/prompts/run.js.map +1 -1
  34. package/dist/commands/app/install.d.ts +4 -0
  35. package/dist/commands/app/install.d.ts.map +1 -1
  36. package/dist/commands/app/install.js +36 -1
  37. package/dist/commands/app/install.js.map +1 -1
  38. package/dist/commands/app/upgrade.d.ts +1 -0
  39. package/dist/commands/app/upgrade.d.ts.map +1 -1
  40. package/dist/commands/app/upgrade.js +9 -0
  41. package/dist/commands/app/upgrade.js.map +1 -1
  42. package/dist/commands/codegen/manifest.d.ts +40 -0
  43. package/dist/commands/codegen/manifest.d.ts.map +1 -1
  44. package/dist/commands/codegen/manifest.js +124 -3
  45. package/dist/commands/codegen/manifest.js.map +1 -1
  46. package/dist/commands/diag/usage.d.ts +7 -0
  47. package/dist/commands/diag/usage.d.ts.map +1 -0
  48. package/dist/commands/diag/usage.js +10 -0
  49. package/dist/commands/diag/usage.js.map +1 -0
  50. package/dist/commands/doctor/index.d.ts +6 -0
  51. package/dist/commands/doctor/index.d.ts.map +1 -1
  52. package/dist/commands/doctor/index.js +42 -0
  53. package/dist/commands/doctor/index.js.map +1 -1
  54. package/dist/commands/explorer/postbuild.d.ts +14 -0
  55. package/dist/commands/explorer/postbuild.d.ts.map +1 -0
  56. package/dist/commands/explorer/postbuild.js +49 -0
  57. package/dist/commands/explorer/postbuild.js.map +1 -0
  58. package/dist/commands/explorer/usage.d.ts +7 -0
  59. package/dist/commands/explorer/usage.d.ts.map +1 -0
  60. package/dist/commands/explorer/usage.js +10 -0
  61. package/dist/commands/explorer/usage.js.map +1 -0
  62. package/dist/commands/harness/account/add.d.ts +22 -0
  63. package/dist/commands/harness/account/add.d.ts.map +1 -0
  64. package/dist/commands/harness/account/add.js +100 -0
  65. package/dist/commands/harness/account/add.js.map +1 -0
  66. package/dist/commands/harness/account/clear-cooldown.d.ts +13 -0
  67. package/dist/commands/harness/account/clear-cooldown.d.ts.map +1 -0
  68. package/dist/commands/harness/account/clear-cooldown.js +32 -0
  69. package/dist/commands/harness/account/clear-cooldown.js.map +1 -0
  70. package/dist/commands/harness/account/disable.d.ts +13 -0
  71. package/dist/commands/harness/account/disable.d.ts.map +1 -0
  72. package/dist/commands/harness/account/disable.js +34 -0
  73. package/dist/commands/harness/account/disable.js.map +1 -0
  74. package/dist/commands/harness/account/enable.d.ts +13 -0
  75. package/dist/commands/harness/account/enable.d.ts.map +1 -0
  76. package/dist/commands/harness/account/enable.js +34 -0
  77. package/dist/commands/harness/account/enable.js.map +1 -0
  78. package/dist/commands/harness/account/index.d.ts +7 -0
  79. package/dist/commands/harness/account/index.d.ts.map +1 -0
  80. package/dist/commands/harness/account/index.js +23 -0
  81. package/dist/commands/harness/account/index.js.map +1 -0
  82. package/dist/commands/harness/account/list.d.ts +15 -0
  83. package/dist/commands/harness/account/list.d.ts.map +1 -0
  84. package/dist/commands/harness/account/list.js +58 -0
  85. package/dist/commands/harness/account/list.js.map +1 -0
  86. package/dist/commands/harness/account/login.d.ts +16 -0
  87. package/dist/commands/harness/account/login.d.ts.map +1 -0
  88. package/dist/commands/harness/account/login.js +50 -0
  89. package/dist/commands/harness/account/login.js.map +1 -0
  90. package/dist/commands/harness/account/remove.d.ts +14 -0
  91. package/dist/commands/harness/account/remove.d.ts.map +1 -0
  92. package/dist/commands/harness/account/remove.js +43 -0
  93. package/dist/commands/harness/account/remove.js.map +1 -0
  94. package/dist/commands/harness/account/set-strategy.d.ts +13 -0
  95. package/dist/commands/harness/account/set-strategy.d.ts.map +1 -0
  96. package/dist/commands/harness/account/set-strategy.js +38 -0
  97. package/dist/commands/harness/account/set-strategy.js.map +1 -0
  98. package/dist/commands/harness/index.d.ts +7 -0
  99. package/dist/commands/harness/index.d.ts.map +1 -0
  100. package/dist/commands/harness/index.js +22 -0
  101. package/dist/commands/harness/index.js.map +1 -0
  102. package/dist/commands/harness/usage.d.ts +7 -0
  103. package/dist/commands/harness/usage.d.ts.map +1 -0
  104. package/dist/commands/harness/usage.js +10 -0
  105. package/dist/commands/harness/usage.js.map +1 -0
  106. package/dist/commands/migrate/convert.d.ts +25 -1
  107. package/dist/commands/migrate/convert.d.ts.map +1 -1
  108. package/dist/commands/migrate/convert.js +156 -38
  109. package/dist/commands/migrate/convert.js.map +1 -1
  110. package/dist/commands/migrate/index.d.ts +8 -0
  111. package/dist/commands/migrate/index.d.ts.map +1 -1
  112. package/dist/commands/migrate/index.js +40 -1
  113. package/dist/commands/migrate/index.js.map +1 -1
  114. package/dist/commands/migrate/rebake.d.ts +13 -0
  115. package/dist/commands/migrate/rebake.d.ts.map +1 -1
  116. package/dist/commands/migrate/rebake.js +45 -6
  117. package/dist/commands/migrate/rebake.js.map +1 -1
  118. package/dist/commands/queue/export-topology.d.ts +2 -0
  119. package/dist/commands/queue/export-topology.d.ts.map +1 -1
  120. package/dist/commands/queue/export-topology.js +3 -1
  121. package/dist/commands/queue/export-topology.js.map +1 -1
  122. package/dist/commands/queue/import-bindings.d.ts +2 -0
  123. package/dist/commands/queue/import-bindings.d.ts.map +1 -1
  124. package/dist/commands/queue/import-bindings.js +3 -1
  125. package/dist/commands/queue/import-bindings.js.map +1 -1
  126. package/dist/commands/queue/index.js +1 -1
  127. package/dist/commands/queue/index.js.map +1 -1
  128. package/dist/commands/queue/sweep.d.ts +4 -6
  129. package/dist/commands/queue/sweep.d.ts.map +1 -1
  130. package/dist/commands/queue/sweep.js +15 -23
  131. package/dist/commands/queue/sweep.js.map +1 -1
  132. package/dist/commands/queue/validate-bindings.d.ts +2 -0
  133. package/dist/commands/queue/validate-bindings.d.ts.map +1 -1
  134. package/dist/commands/queue/validate-bindings.js +3 -1
  135. package/dist/commands/queue/validate-bindings.js.map +1 -1
  136. package/dist/commands/queue/work.d.ts +2 -19
  137. package/dist/commands/queue/work.d.ts.map +1 -1
  138. package/dist/commands/queue/work.js +9 -29
  139. package/dist/commands/queue/work.js.map +1 -1
  140. package/dist/commands/rubric/usage.d.ts +7 -0
  141. package/dist/commands/rubric/usage.d.ts.map +1 -0
  142. package/dist/commands/rubric/usage.js +10 -0
  143. package/dist/commands/rubric/usage.js.map +1 -0
  144. package/dist/commands/test/regression/index.d.ts.map +1 -1
  145. package/dist/commands/test/regression/index.js +2 -0
  146. package/dist/commands/test/regression/index.js.map +1 -1
  147. package/dist/commands/test/regression/new.d.ts +21 -0
  148. package/dist/commands/test/regression/new.d.ts.map +1 -0
  149. package/dist/commands/test/regression/new.js +82 -0
  150. package/dist/commands/test/regression/new.js.map +1 -0
  151. package/dist/commands/test/regression/up.d.ts +1 -0
  152. package/dist/commands/test/regression/up.d.ts.map +1 -1
  153. package/dist/commands/test/regression/up.js +17 -0
  154. package/dist/commands/test/regression/up.js.map +1 -1
  155. package/dist/commands/test/scripts.d.ts +6 -4
  156. package/dist/commands/test/scripts.d.ts.map +1 -1
  157. package/dist/commands/test/scripts.js +14 -0
  158. package/dist/commands/test/scripts.js.map +1 -1
  159. package/dist/commands/test/suite.d.ts +1 -0
  160. package/dist/commands/test/suite.d.ts.map +1 -1
  161. package/dist/commands/test/suite.js +6 -0
  162. package/dist/commands/test/suite.js.map +1 -1
  163. package/dist/commands/usage.js +2 -1
  164. package/dist/commands/usage.js.map +1 -1
  165. package/dist/commands/user/usage.d.ts +7 -0
  166. package/dist/commands/user/usage.d.ts.map +1 -0
  167. package/dist/commands/user/usage.js +10 -0
  168. package/dist/commands/user/usage.js.map +1 -0
  169. package/dist/config.d.ts +117 -0
  170. package/dist/config.d.ts.map +1 -1
  171. package/dist/config.js +44 -0
  172. package/dist/config.js.map +1 -1
  173. package/dist/init-templates/citizen-builder/.agents/skills/package-agent/SKILL.md +12 -2
  174. package/dist/init-templates/citizen-builder/.agents/skills/test-agent/SKILL.md +1 -1
  175. package/dist/init-templates/citizen-builder/.claude/skills/package-agent/SKILL.md +12 -2
  176. package/dist/init-templates/citizen-builder/.claude/skills/test-agent/SKILL.md +1 -1
  177. package/dist/init-templates/citizen-builder/.env.example +14 -2
  178. package/dist/init-templates/citizen-builder/AGENTS.md +5 -2
  179. package/dist/init-templates/citizen-builder/CAPABILITIES.md +9 -0
  180. package/dist/init-templates/citizen-builder/README.md +29 -15
  181. package/dist/init-templates/citizen-builder/docker-compose.yml +13 -0
  182. package/dist/init-templates/citizen-builder/docs/PROMOTION_GUIDE.md +5 -2
  183. package/dist/init-templates/citizen-builder/scripts/docker-entrypoint.sh +290 -33
  184. package/dist/init-templates/citizen-builder/scripts/generate-capabilities.sh +148 -41
  185. package/dist/lib/db-preflight.d.ts.map +1 -1
  186. package/dist/lib/db-preflight.js +22 -0
  187. package/dist/lib/db-preflight.js.map +1 -1
  188. package/dist/lib/derived-usage.d.ts +8 -0
  189. package/dist/lib/derived-usage.d.ts.map +1 -1
  190. package/dist/lib/derived-usage.js +30 -20
  191. package/dist/lib/derived-usage.js.map +1 -1
  192. package/dist/lib/domain-profiles.d.ts.map +1 -1
  193. package/dist/lib/domain-profiles.js +24 -0
  194. package/dist/lib/domain-profiles.js.map +1 -1
  195. package/dist/lib/domain-usage-command.js +2 -1
  196. package/dist/lib/domain-usage-command.js.map +1 -1
  197. package/dist/lib/explorer-postbuild/public-page-html.d.ts +48 -0
  198. package/dist/lib/explorer-postbuild/public-page-html.d.ts.map +1 -0
  199. package/dist/lib/explorer-postbuild/public-page-html.js +284 -0
  200. package/dist/lib/explorer-postbuild/public-page-html.js.map +1 -0
  201. package/dist/lib/explorer-postbuild/service-worker-check.d.ts +13 -0
  202. package/dist/lib/explorer-postbuild/service-worker-check.d.ts.map +1 -0
  203. package/dist/lib/explorer-postbuild/service-worker-check.js +41 -0
  204. package/dist/lib/explorer-postbuild/service-worker-check.js.map +1 -0
  205. package/dist/lib/harness-account.d.ts +34 -0
  206. package/dist/lib/harness-account.d.ts.map +1 -0
  207. package/dist/lib/harness-account.js +105 -0
  208. package/dist/lib/harness-account.js.map +1 -0
  209. package/dist/lib/pg-preflight/checks.d.ts +28 -0
  210. package/dist/lib/pg-preflight/checks.d.ts.map +1 -0
  211. package/dist/lib/pg-preflight/checks.js +94 -0
  212. package/dist/lib/pg-preflight/checks.js.map +1 -0
  213. package/dist/lib/pg-preflight/extension-check.d.ts +28 -0
  214. package/dist/lib/pg-preflight/extension-check.d.ts.map +1 -0
  215. package/dist/lib/pg-preflight/extension-check.js +86 -0
  216. package/dist/lib/pg-preflight/extension-check.js.map +1 -0
  217. package/dist/lib/pg-preflight/extension-scan.d.ts +24 -0
  218. package/dist/lib/pg-preflight/extension-scan.d.ts.map +1 -0
  219. package/dist/lib/pg-preflight/extension-scan.js +58 -0
  220. package/dist/lib/pg-preflight/extension-scan.js.map +1 -0
  221. package/dist/lib/pg-preflight/pending-migrations.d.ts +28 -0
  222. package/dist/lib/pg-preflight/pending-migrations.d.ts.map +1 -0
  223. package/dist/lib/pg-preflight/pending-migrations.js +48 -0
  224. package/dist/lib/pg-preflight/pending-migrations.js.map +1 -0
  225. package/dist/lib/pg-preflight/preflight.d.ts +18 -0
  226. package/dist/lib/pg-preflight/preflight.d.ts.map +1 -0
  227. package/dist/lib/pg-preflight/preflight.js +43 -0
  228. package/dist/lib/pg-preflight/preflight.js.map +1 -0
  229. package/dist/lib/pg-preflight/remediation.d.ts +27 -0
  230. package/dist/lib/pg-preflight/remediation.d.ts.map +1 -0
  231. package/dist/lib/pg-preflight/remediation.js +82 -0
  232. package/dist/lib/pg-preflight/remediation.js.map +1 -0
  233. package/dist/lib/pg-preflight/render.d.ts +15 -0
  234. package/dist/lib/pg-preflight/render.d.ts.map +1 -0
  235. package/dist/lib/pg-preflight/render.js +48 -0
  236. package/dist/lib/pg-preflight/render.js.map +1 -0
  237. package/dist/lib/pg-preflight/run-for-config.d.ts +23 -0
  238. package/dist/lib/pg-preflight/run-for-config.d.ts.map +1 -0
  239. package/dist/lib/pg-preflight/run-for-config.js +45 -0
  240. package/dist/lib/pg-preflight/run-for-config.js.map +1 -0
  241. package/dist/lib/pg-preflight/types.d.ts +67 -0
  242. package/dist/lib/pg-preflight/types.d.ts.map +1 -0
  243. package/dist/lib/pg-preflight/types.js +8 -0
  244. package/dist/lib/pg-preflight/types.js.map +1 -0
  245. package/dist/lib/regression/test-scaffold.d.ts +52 -0
  246. package/dist/lib/regression/test-scaffold.d.ts.map +1 -0
  247. package/dist/lib/regression/test-scaffold.js +237 -0
  248. package/dist/lib/regression/test-scaffold.js.map +1 -0
  249. package/dist/lib/work-queue/queue-format.d.ts +4 -0
  250. package/dist/lib/work-queue/queue-format.d.ts.map +1 -1
  251. package/dist/lib/work-queue/queue-format.js +15 -0
  252. package/dist/lib/work-queue/queue-format.js.map +1 -1
  253. package/dist/lib/work-queue/queue-worker.d.ts +16 -1
  254. package/dist/lib/work-queue/queue-worker.d.ts.map +1 -1
  255. package/dist/lib/work-queue/queue-worker.js +18 -0
  256. package/dist/lib/work-queue/queue-worker.js.map +1 -1
  257. package/dist/light-commands.d.ts.map +1 -1
  258. package/dist/light-commands.js +34 -0
  259. package/dist/light-commands.js.map +1 -1
  260. package/dist/tsconfig.tsbuildinfo +1 -1
  261. package/dist/utils/dependencies-from-head.d.ts +4 -0
  262. package/dist/utils/dependencies-from-head.d.ts.map +1 -0
  263. package/dist/utils/dependencies-from-head.js +5 -0
  264. package/dist/utils/dependencies-from-head.js.map +1 -0
  265. package/dist/utils/open-app-context.d.ts +1 -0
  266. package/dist/utils/open-app-context.d.ts.map +1 -1
  267. package/dist/utils/open-app-context.js +6 -1
  268. package/dist/utils/open-app-context.js.map +1 -1
  269. package/oclif.manifest.json +2026 -1091
  270. package/package.json +34 -31
@@ -28,6 +28,10 @@ function isUntrustedCertError(message) {
28
28
  m.includes('unable to get local issuer certificate'));
29
29
  }
30
30
  /** True when the error indicates a credentials / login problem. */
31
+ /** PostgreSQL refusing a plain-TCP connection because its pg_hba.conf allows only `hostssl`. */
32
+ function isUnencryptedRejectedError(message) {
33
+ return message.toLowerCase().includes('no encryption');
34
+ }
31
35
  function isAuthError(message) {
32
36
  const m = message.toLowerCase();
33
37
  return m.includes('login failed') || m.includes('password authentication failed');
@@ -39,6 +43,24 @@ function isUnreachableError(message) {
39
43
  }
40
44
  /** Turn a connection error message into a classified, actionable result. */
41
45
  function classifyFailure(message, config) {
46
+ if (isUntrustedCertError(message) && config.dbPlatform === 'postgresql') {
47
+ return {
48
+ Ok: false,
49
+ Reason: 'tls-untrusted-cert',
50
+ Message: message,
51
+ Suggestion: 'The PostgreSQL server presents a certificate that is not signed by a CA Node trusts. Point ' +
52
+ 'PG_SSL_CA_FILE at the CA bundle that signed it (for RDS, Azure or HorizonDB, their published ' +
53
+ 'root bundle). Only for a development server, PG_SSL_MODE=require skips the check.',
54
+ };
55
+ }
56
+ if (isUnencryptedRejectedError(message)) {
57
+ return {
58
+ Ok: false,
59
+ Reason: 'other',
60
+ Message: message,
61
+ Suggestion: 'The PostgreSQL server only accepts TLS connections. Set PG_SSL_MODE=verify-full (and PG_SSL_CA_FILE if its CA is not public).',
62
+ };
63
+ }
42
64
  if (isUntrustedCertError(message)) {
43
65
  // Only suggest trusting the cert when we aren't already trusting it — otherwise
44
66
  // the problem is a different cert issue and that advice would mislead.
@@ -1 +1 @@
1
- {"version":3,"file":"db-preflight.js","sourceRoot":"","sources":["../../src/lib/db-preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,cAAc,EAA2B,MAAM,wBAAwB,CAAC;AA8BjF,uEAAuE;AACvE,SAAS,UAAU,CAAC,QAA0C;IAC5D,OAAO,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC;AAC1D,CAAC;AAED,gFAAgF;AAChF,SAAS,oBAAoB,CAAC,OAAe;IAC3C,MAAM,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAChC,OAAO,CACL,CAAC,CAAC,QAAQ,CAAC,yBAAyB,CAAC;QACrC,CAAC,CAAC,QAAQ,CAAC,yBAAyB,CAAC;QACrC,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;QACzC,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC;QACvC,CAAC,CAAC,QAAQ,CAAC,wCAAwC,CAAC;QACpD,CAAC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QAC5C,IAAI,GAAG,MAAM,CAAC;QACd,MAAM,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC/B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IACtB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,eAAe,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;IACnF,CAAC;YAAS,CAAC;QACT,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,wDAAwD;AACxD,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,MAA0B;IACvE,OAAO,wBAAwB,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC;AAED,+FAA+F;AAC/F,KAAK,UAAU,YAAY,CAAC,IAA4C;IACtE,IAAI,CAAC,IAAI;QAAE,OAAO;IAClB,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;IAAC,OAAO,QAAQ,EAAE,CAAC;QAClB,8EAA8E;QAC9E,yEAAyE;QACzE,KAAK,QAAQ,CAAC;IAChB,CAAC;AACH,CAAC"}
@@ -18,6 +18,7 @@
18
18
  * keeps the first entry per command key, and plugin-declared `static Usage` is read
19
19
  * first, so a migrated command always keeps its richer, curated metadata.
20
20
  */
21
+ import type { Command } from '@oclif/core';
21
22
  import { type PluginUsage } from '@memberjunction/cli-core';
22
23
  /**
23
24
  * The slice of oclif's `Command.Loadable` this module reads.
@@ -57,6 +58,13 @@ export declare function domainOf(commandId: string): string;
57
58
  export declare function DeriveUsage(command: OclifCommandShape): PluginUsage;
58
59
  /** @deprecated Use {@link DeriveUsage}. */
59
60
  export declare function deriveUsage(command: OclifCommandShape): PluginUsage;
61
+ /** Minimal subset of oclif's `Command.Loadable` needed to derive usage without unsafe casts. */
62
+ export type OclifLoadableLike = Pick<Command.Loadable, 'id' | 'description' | 'summary' | 'hidden' | 'examples'> & Partial<Pick<Command.Loadable, 'flags'>>;
63
+ /**
64
+ * Adapts oclif's native `Command.Loadable` entries (lowercase properties) into
65
+ * {@link OclifCommandShape} without unsafe type casts.
66
+ */
67
+ export declare function FromOclifCommands(commands: readonly OclifLoadableLike[]): OclifCommandShape[];
60
68
  /**
61
69
  * Registers derived usage for every visible oclif command.
62
70
  *
@@ -1 +1 @@
1
- {"version":3,"file":"derived-usage.d.ts","sourceRoot":"","sources":["../../src/lib/derived-usage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAqB,KAAK,WAAW,EAAwB,MAAM,0BAA0B,CAAC;AAGrG;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC,CAAC;IACnD,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/E;AAED,+DAA+D;AAC/D,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAcD,oFAAoF;AACpF,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wCAAwC;AACxC,wBAAgB,QAAQ,CAAC,SAA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IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAcD,oFAAoF;AACpF,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wCAAwC;AACxC,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAElD;AAsCD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG,WAAW,CAenE;AAED,2CAA2C;AAC3C,wBAAgB,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG,WAAW,CAEnE;AAED,gGAAgG;AAChG,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,OAAO,CAAC,QAAQ,EAChB,IAAI,GAAG,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,CACzD,GACC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAE3C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,GAAG,iBAAiB,EAAE,CAwB7F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,GAAG,MAAM,EAAE,CAUrF;AAED,oDAAoD;AACpD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,GAAG,MAAM,EAAE,CAErF"}
@@ -1,23 +1,3 @@
1
- /**
2
- * Derives `mj usage` entries for the commands that are still plain oclif
3
- * `Command`s, straight from oclif's own manifest.
4
- *
5
- * Why derive rather than hand-write: `mj usage` tier 1 tells an agent
6
- * *"Run `mj <domain> usage` before invoking. Do NOT guess flags."* — so a domain
7
- * absent from that map reads as "this domain does not exist". Before this, only the
8
- * handful of `BaseCLIPlugin` domains were registered, and the map confidently
9
- * advertised a fraction of the CLI. A map that lies by omission is worse than no map,
10
- * because an agent has no way to tell the difference.
11
- *
12
- * Hand-writing 80-odd `PluginUsage` literals would have fixed it once and rotted
13
- * immediately. oclif already holds every command's description, flags, and examples
14
- * and cannot fall out of sync with itself, so the only thing left to hand-maintain
15
- * is what oclif genuinely doesn't know: the runtime budget (see `domain-profiles.ts`).
16
- *
17
- * Registration is additive and never overwrites: `CLIPluginRegistry.RegisterUsage`
18
- * keeps the first entry per command key, and plugin-declared `static Usage` is read
19
- * first, so a migrated command always keeps its richer, curated metadata.
20
- */
21
1
  import { CLIPluginRegistry } from '@memberjunction/cli-core';
22
2
  import { GetDomainProfile } from './domain-profiles.js';
23
3
  /**
@@ -102,6 +82,36 @@ export function DeriveUsage(command) {
102
82
  export function deriveUsage(command) {
103
83
  return DeriveUsage(command);
104
84
  }
85
+ /**
86
+ * Adapts oclif's native `Command.Loadable` entries (lowercase properties) into
87
+ * {@link OclifCommandShape} without unsafe type casts.
88
+ */
89
+ export function FromOclifCommands(commands) {
90
+ return commands.map((cmd) => {
91
+ const flags = {};
92
+ if (cmd.flags) {
93
+ for (const [name, def] of Object.entries(cmd.flags)) {
94
+ if (!def)
95
+ continue;
96
+ flags[name] = {
97
+ type: def.type,
98
+ Description: def.description,
99
+ Char: def.char,
100
+ options: 'options' in def && Array.isArray(def.options) ? def.options : undefined,
101
+ Required: def.required,
102
+ };
103
+ }
104
+ }
105
+ return {
106
+ Id: cmd.id,
107
+ Description: cmd.description,
108
+ summary: cmd.summary,
109
+ Hidden: cmd.hidden,
110
+ Flags: Object.keys(flags).length > 0 ? flags : undefined,
111
+ Examples: cmd.examples,
112
+ };
113
+ });
114
+ }
105
115
  /**
106
116
  * Registers derived usage for every visible oclif command.
107
117
  *
@@ -1 +1 @@
1
- {"version":3,"file":"derived-usage.js","sourceRoot":"","sources":["../../src/lib/derived-usage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,iBAAiB,EAA0C,MAAM,0BAA0B,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,sB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gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAE9D;AAED,gDAAgD;AAChD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAE9D"}
1
+ {"version":3,"file":"domain-profiles.d.ts","sourceRoot":"","sources":["../../src/lib/domain-profiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,aAAa;IAC5B,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,OAAO,EAAE,WAAW,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,aAGpC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAiInE,CAAC;AAEF,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAE9D;AAED,gDAAgD;AAChD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAE9D"}
@@ -18,6 +18,10 @@ export const DEFAULT_DOMAIN_PROFILE = {
18
18
  * `RegisterUsage` is first-wins and reads plugin metadata first.
19
19
  */
20
20
  export const DOMAIN_PROFILES = {
21
+ agent: {
22
+ Summary: 'Initialize a Citizen Agent Builder environment with Docker setup.',
23
+ Runtime: { class: 'slow', typicalSeconds: 120, note: 'scaffolds files and optionally boots Docker containers' },
24
+ },
21
25
  codegen: {
22
26
  Summary: 'Regenerate entities, SQL, and Angular forms from the database schema.',
23
27
  Runtime: { class: 'slow', typicalSeconds: 120, note: 'scales with entity count; a full run ≫ a single-entity change' },
@@ -70,10 +74,22 @@ export const DOMAIN_PROFILES = {
70
74
  Summary: 'Generate and export AI-authored database documentation.',
71
75
  Runtime: { class: 'slow', typicalSeconds: 300, note: 'LLM-driven; scales with table and column count' },
72
76
  },
77
+ diag: {
78
+ Summary: 'Inspect, scrub, analyze, export, and generate keys for .mjdiag diagnostic bundles.',
79
+ Runtime: { class: 'fast', note: 'local archive verification, timeline/slow-query inspection, and trace export' },
80
+ },
73
81
  doctor: {
74
82
  Summary: 'Diagnose the local MJ environment and report what is misconfigured.',
75
83
  Runtime: { class: 'moderate', typicalSeconds: 15 },
76
84
  },
85
+ explorer: {
86
+ Summary: 'Post-build tasks for MJ Explorer (service worker verification and public page HTML generation).',
87
+ Runtime: { class: 'fast' },
88
+ },
89
+ harness: {
90
+ Summary: 'Manage multi-account CLI subscription pools, balancing strategies, and cooldown controls for external agent harnesses.',
91
+ Runtime: { class: 'fast', note: 'local pool operations are instant; interactive login awaits user sign-in' },
92
+ },
77
93
  install: {
78
94
  Summary: 'Install MemberJunction, or seed the Claude Code pack into a repo.',
79
95
  Runtime: { class: 'slow', typicalSeconds: 300, note: 'downloads a release, installs packages, runs migrations' },
@@ -94,6 +110,10 @@ export const DOMAIN_PROFILES = {
94
110
  Summary: 'Generate, validate, and export stored queries.',
95
111
  Runtime: { class: 'slow', typicalSeconds: 120, note: 'LLM-driven generation; validation alone is fast' },
96
112
  },
113
+ rubric: {
114
+ Summary: 'List, show, diff, validate, and evaluate versioned scoring rubrics.',
115
+ Runtime: { class: 'moderate', typicalSeconds: 20, note: 'validate is instant; evaluate invokes the configured evaluator' },
116
+ },
97
117
  'sql-audit': {
98
118
  Summary: 'Audit SQL objects for drift against the metadata.',
99
119
  Runtime: { class: 'moderate', typicalSeconds: 45, note: 'scales with object count' },
@@ -122,6 +142,10 @@ export const DOMAIN_PROFILES = {
122
142
  Summary: 'This progressive-disclosure surface: domains, then per-domain detail.',
123
143
  Runtime: { class: 'fast' },
124
144
  },
145
+ user: {
146
+ Summary: 'Clone an existing or template MJ user with roles, views, or settings.',
147
+ Runtime: { class: 'fast', note: 'single database clone operation' },
148
+ },
125
149
  };
126
150
  /** The profile for a domain, falling back to {@link DEFAULT_DOMAIN_PROFILE}. */
127
151
  export function GetDomainProfile(domain) {
@@ -1 +1 @@
1
- {"version":3,"file":"domain-profiles.js","sourceRoot":"","sources":["../../src/lib/domain-profiles.ts"],"names":[],"mappings":"AAwBA;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAkB;IACnD,OAAO,EAAE,qDAAqD;IAC9D,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,6CAA6C,EAAE;CACpF,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAA4C;IACtE,OAAO,EAAE;QACP,OAAO,EAAE,uEAAuE;QAChF,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,IAAI,EAAE,+DAA+D,EAAE;KACvH;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,mFAAmF;QAC5F,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,iEAAiE,EAAE;KACxG;IACD,GAAG,EAAE;QACH,OAAO,EAAE,+EAA+E;QACxF,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,gDAAgD,EAAE;KACvF;IACD,EAAE,EAAE;QACF,OAAO,EAAE,oEAAoE;QAC7E,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,wEAAwE,EAAE;KAC/G;IACD,KAAK,EAAE;QACL,OAAO,EAAE,2HAA2H;QACpI,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,EAAE,EAAE,IAAI,EAAE,+EAA+E,EAAE;KAC1I;IACD,GAAG,EAAE;QACH,OAAO,EAAE,iDAAiD;QAC1D,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,IAAI,EAAE,8CAA8C,EAAE;KACtG;IACD,SAAS,EAAE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AC7C,OAAO,eAAe,CAAC,MAAM,CAAC,IAAI,sBAAsB,CAAC;AAC3D,CAAC;AAED,gDAAgD;AAChD,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC"}
@@ -2,6 +2,7 @@ import { Command, Flags } from '@oclif/core';
2
2
  import { CLIPluginRegistry, ResolveOutputFormat } from '@memberjunction/cli-core';
3
3
  import { LoadAllCliPlugins } from './cli-plugins.js';
4
4
  import { EmitUsage, RenderDomainDetail } from './usage-render.js';
5
+ import { FromOclifCommands } from './derived-usage.js';
5
6
  /**
6
7
  * Shared base for tier-2 usage commands (`mj <domain> usage`). Concrete
7
8
  * subclasses under `commands/<domain>/usage.ts` set {@link Domain}. Returns every
@@ -18,7 +19,7 @@ export class DomainUsageCommand extends Command {
18
19
  }; }
19
20
  async run() {
20
21
  const { flags } = await this.parse(this.constructor);
21
- await LoadAllCliPlugins(process.cwd(), this.config.commands);
22
+ await LoadAllCliPlugins(process.cwd(), FromOclifCommands(this.config.commands));
22
23
  const detail = CLIPluginRegistry.BuildDomainDetail(this.Domain);
23
24
  const result = CLIPluginRegistry.AsResult(`${this.Domain}:usage`, { domain: detail.domain, commands: detail.commands });
24
25
  const { format } = ResolveOutputFormat({ formatFlag: flags.format });
@@ -1 +1 @@
1
- {"version":3,"file":"domain-usage-command.js","sourceRoot":"","sources":["../../src/lib/domain-usage-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGlE;;;;;GAKG;AACH,MAAM,OAAgB,kBAAmB,SAAQ,OAAO;aAC/C,UAAK,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B,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,OAAgB,kBAAmB,SAAQ,OAAO;aAC/C,UAAK,GAAG;QACb,8EAA8E;QAC9E,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;YACnB,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC;YAC/B,WAAW,EAAE,8EAA8E;SAC5F,CAAC;KACH,CAAC;IAKF,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAwC,CAAC,CAAC;QAClF,MAAM,iBAAiB,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAChF,MAAM,MAAM,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,MAAM,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxH,MAAM,EAAE,MAAM,EAAE,GAAG,mBAAmB,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QACrE,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5E,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { type OpenAppPublicPage, type OpenAppPublicPageEntry } from '../../commands/codegen/manifest.js';
2
+ /** A JSON value, as read from a config file. */
3
+ export type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;
4
+ /** A JSON object, as read from a config file. */
5
+ export interface JsonObject {
6
+ [key: string]: JsonValue;
7
+ }
8
+ /** One route in an Azure Static Web Apps config file. Other route settings are kept as they are. */
9
+ export interface StaticWebAppRoute {
10
+ route: string;
11
+ rewrite?: string;
12
+ [key: string]: JsonValue | undefined;
13
+ }
14
+ /**
15
+ * Builds a page's HTML from Explorer's built `index.html`:
16
+ * - the page title, and the description and Open Graph tags that link previews read
17
+ * - a robots tag that lets search engines index the page
18
+ * - no map library tags, and a plain link for the main stylesheet
19
+ * - a Content Security Policy that allows only the site's own scripts
20
+ */
21
+ export declare function BuildPublicPageHtml(indexHtml: string, page: OpenAppPublicPage): string;
22
+ /**
23
+ * Builds the HTML for a public page address that has no page file: an unknown slug, or `/p/` alone.
24
+ * It has the same policy as a page file, so the error page that shows there runs under it. Search
25
+ * engines do not index it.
26
+ */
27
+ export declare function BuildPublicFallbackHtml(indexHtml: string): string;
28
+ /**
29
+ * Writes `public-pages/<slug>.html` into the site folder (Explorer's build) for each enabled page,
30
+ * and `public-pages/_fallback.html` for the other public page addresses.
31
+ *
32
+ * @returns the number of page files written
33
+ */
34
+ export declare function WritePublicPageHtmlFiles(siteDir: string, entries: OpenAppPublicPageEntry[]): number;
35
+ /**
36
+ * Returns `routes` with two rewrites for each enabled page (`/p/<slug>` and `/p/<slug>/*`) to the
37
+ * page's HTML file, then one for every other public page address to the fallback file, before the
38
+ * other routes. Page routes from an earlier run are replaced.
39
+ */
40
+ export declare function ApplyPublicPageRoutes(routes: StaticWebAppRoute[], entries: OpenAppPublicPageEntry[]): StaticWebAppRoute[];
41
+ /**
42
+ * Adds the page routes to `staticwebapp.config.json` (Azure Static Web Apps) in the site folder.
43
+ * A site folder without that file is not changed.
44
+ *
45
+ * @returns true when the file was written
46
+ */
47
+ export declare function WriteStaticWebAppRoutes(siteDir: string, entries: OpenAppPublicPageEntry[]): boolean;
48
+ //# sourceMappingURL=public-page-html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-page-html.d.ts","sourceRoot":"","sources":["../../../src/lib/explorer-postbuild/public-page-html.ts"],"names":[],"mappings":"AASA,OAAO,EAAkC,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAczI,gDAAgD;AAChD,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,UAAU,CAAC;AAEpF,iDAAiD;AACjD,MAAM,WAAW,UAAU;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,oGAAoG;AACpG,MAAM,WAAW,iBAAiB;IAE9B,KAAK,EAAE,MAAM,CAAC;IAEd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;CACxC;AA0ND;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAGtF;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,GAAG,MAAM,CAYnG;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,EAAE,EAAE,OAAO,EAAE,sBAAsB,EAAE,GAAG,iBAAiB,EAAE,CAWzH;AAOD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAenG"}
@@ -0,0 +1,284 @@
1
+ /**
2
+ * @fileoverview The HTML file of each public page, and the Azure Static Web Apps routes that
3
+ * serve those files. `mj explorer postbuild` runs this on MJ Explorer's build output.
4
+ */
5
+ import { createHash } from 'node:crypto';
6
+ import { mkdirSync, writeFileSync } from 'node:fs';
7
+ import { join } from 'node:path';
8
+ import { defaultTreeAdapter, html as htmlNames, parse, serialize } from 'parse5';
9
+ import { PUBLIC_PAGE_SLUG_PATTERN } from '@memberjunction/open-app-engine';
10
+ import { IsPublicPage, ReadFileIfExists } from '../../commands/codegen/manifest.js';
11
+ /** Folder in the site folder that holds one HTML file per page. */
12
+ const PUBLIC_PAGE_HTML_FOLDER = 'public-pages';
13
+ /** File in the pages folder that answers a public page address with no page file of its own. An underscore cannot be in a slug. */
14
+ const PUBLIC_PAGE_FALLBACK_FILE = '_fallback.html';
15
+ /** Address prefix of public pages. The public host uses the same prefix. */
16
+ const PUBLIC_PAGE_PATH_PREFIX = '/p/';
17
+ /** The Azure Static Web Apps config file in the site folder. */
18
+ const STATIC_WEB_APP_CONFIG_FILE = 'staticwebapp.config.json';
19
+ /**
20
+ * The enabled pages. Error pages are left out: they have no address of their own, so no file and
21
+ * no route. Throws on a slug that does not follow the slug rule, because the slug is a file name
22
+ * and an address.
23
+ */
24
+ function enabledPages(entries) {
25
+ const pages = entries.filter(IsPublicPage).filter((entry) => entry.Enabled !== false);
26
+ const invalid = pages.find((page) => !PUBLIC_PAGE_SLUG_PATTERN.test(page.Slug));
27
+ if (invalid) {
28
+ throw new Error(`Public page slug '${invalid.Slug}' of app '${invalid.AppName}' must be lowercase letters and digits joined by single hyphens.`);
29
+ }
30
+ return pages;
31
+ }
32
+ function isElement(node) {
33
+ return defaultTreeAdapter.isElementNode(node);
34
+ }
35
+ /** All nodes below `parent`, in document order. */
36
+ function nodesIn(parent) {
37
+ return parent.childNodes.flatMap((child) => ('childNodes' in child ? [child, ...nodesIn(child)] : [child]));
38
+ }
39
+ /** The elements below `parent` with one of the tag names, in document order. */
40
+ function elementsIn(parent, ...tagNames) {
41
+ return nodesIn(parent).filter(isElement).filter((element) => tagNames.includes(element.tagName));
42
+ }
43
+ function attribute(element, name) {
44
+ return element.attrs.find((attr) => attr.name === name)?.value;
45
+ }
46
+ function textOf(element) {
47
+ return element.childNodes.map((child) => (defaultTreeAdapter.isTextNode(child) ? child.value : '')).join('');
48
+ }
49
+ function isBlankText(node) {
50
+ return !!node && defaultTreeAdapter.isTextNode(node) && node.value.trim() === '';
51
+ }
52
+ /** Removes a node, and the blank text before it, so no empty line stays. */
53
+ function removeNode(node) {
54
+ const siblings = node.parentNode?.childNodes ?? [];
55
+ const before = siblings[siblings.indexOf(node) - 1];
56
+ if (before && isBlankText(before)) {
57
+ defaultTreeAdapter.detachNode(before);
58
+ }
59
+ defaultTreeAdapter.detachNode(node);
60
+ }
61
+ function createElement(tagName, attrs) {
62
+ return defaultTreeAdapter.createElement(tagName, htmlNames.NS.HTML, Object.entries(attrs).map(([name, value]) => ({ name, value })));
63
+ }
64
+ /** Puts `elements` after `reference`, or first in `parent` when there is no reference. Each goes on its own line. */
65
+ function insertElements(parent, reference, elements) {
66
+ const index = reference ? parent.childNodes.indexOf(reference) + 1 : 0;
67
+ const next = parent.childNodes[index];
68
+ for (const element of elements) {
69
+ const indent = { nodeName: '#text', value: '\n ', parentNode: null };
70
+ for (const node of [indent, element]) {
71
+ if (next) {
72
+ defaultTreeAdapter.insertBefore(parent, node, next);
73
+ }
74
+ else {
75
+ defaultTreeAdapter.appendChild(parent, node);
76
+ }
77
+ }
78
+ }
79
+ }
80
+ /** True for an address of the map library (Leaflet and its cluster plugin) on unpkg.com. */
81
+ function isMapLibraryUrl(address) {
82
+ if (!URL.canParse(address)) {
83
+ return false;
84
+ }
85
+ const url = new URL(address);
86
+ return url.hostname === 'unpkg.com' && url.pathname.startsWith('/leaflet');
87
+ }
88
+ /** True for an inline script that names a map library address. */
89
+ function loadsMapLibrary(script) {
90
+ const addresses = textOf(script).match(/https?:\/\/[^\s'"`]+/g) ?? [];
91
+ return addresses.some(isMapLibraryUrl);
92
+ }
93
+ /**
94
+ * Removes the map library's tags. They load scripts from another site, and a public page does
95
+ * not use them.
96
+ */
97
+ function removeMapLibraryTags(document) {
98
+ for (const element of elementsIn(document, 'link', 'script')) {
99
+ const address = attribute(element, element.tagName === 'link' ? 'href' : 'src');
100
+ const isMapTag = address !== undefined ? isMapLibraryUrl(address) : element.tagName === 'script' && loadsMapLibrary(element);
101
+ if (isMapTag) {
102
+ removeNode(element);
103
+ }
104
+ }
105
+ }
106
+ function isStylesheetLink(node) {
107
+ return isElement(node) && node.tagName === 'link' && attribute(node, 'rel') === 'stylesheet';
108
+ }
109
+ /**
110
+ * Turns a stylesheet link that Angular's build defers with an inline `onload` handler into a
111
+ * plain link, and removes its `<noscript>` copy. The page's policy blocks inline handlers.
112
+ */
113
+ function useStylesheetLinks(document) {
114
+ for (const link of elementsIn(document, 'link')) {
115
+ if (isStylesheetLink(link) && attribute(link, 'media') === 'print' && attribute(link, 'onload') === "this.media='all'") {
116
+ link.attrs = link.attrs.filter((attr) => attr.name !== 'media' && attr.name !== 'onload');
117
+ }
118
+ }
119
+ for (const noscript of elementsIn(document, 'noscript')) {
120
+ const content = noscript.childNodes.filter((child) => !isBlankText(child));
121
+ if (content.length > 0 && content.every(isStylesheetLink)) {
122
+ defaultTreeAdapter.detachNode(noscript);
123
+ }
124
+ }
125
+ }
126
+ /** True for a script that the browser runs from its own text: no `src`, and not a data block. */
127
+ function isInlineScript(script) {
128
+ const type = attribute(script, 'type')?.trim().toLowerCase();
129
+ const runs = !type || type === 'module' || type.endsWith('javascript');
130
+ return runs && attribute(script, 'src') === undefined;
131
+ }
132
+ /**
133
+ * The page's Content Security Policy tag. Scripts run only from the site itself, plus the inline
134
+ * scripts that the page file holds, each named by the SHA-256 hash of its text. A script from
135
+ * another site, or one that an attacker injects, does not run, so it cannot read Explorer's
136
+ * sign-in tokens.
137
+ */
138
+ function policyTag(document) {
139
+ const hashes = elementsIn(document, 'script')
140
+ .filter(isInlineScript)
141
+ .map((script) => `'sha256-${createHash('sha256').update(textOf(script), 'utf-8').digest('base64')}'`);
142
+ const scriptSources = ["'self'", ...hashes].join(' ');
143
+ return createElement('meta', {
144
+ 'http-equiv': 'Content-Security-Policy',
145
+ content: `script-src ${scriptSources}; object-src 'none'; base-uri 'self'`,
146
+ });
147
+ }
148
+ /** The head tags that search results and link previews read. */
149
+ function previewTags(head) {
150
+ const tags = [];
151
+ if (head.Description) {
152
+ tags.push(createElement('meta', { name: 'description', content: head.Description }));
153
+ }
154
+ tags.push(createElement('meta', { property: 'og:type', content: 'website' }));
155
+ if (head.Title) {
156
+ tags.push(createElement('meta', { property: 'og:title', content: head.Title }));
157
+ }
158
+ if (head.Description) {
159
+ tags.push(createElement('meta', { property: 'og:description', content: head.Description }));
160
+ }
161
+ tags.push(createElement('meta', { name: 'twitter:card', content: 'summary' }));
162
+ return tags;
163
+ }
164
+ /** Sets the title, and puts the given tags and the robots tag after it. */
165
+ function setHeadTags(headElement, head, tags) {
166
+ for (const meta of elementsIn(headElement, 'meta')) {
167
+ if (attribute(meta, 'name')?.toLowerCase() === 'robots') {
168
+ removeNode(meta);
169
+ }
170
+ }
171
+ let title = elementsIn(headElement, 'title')[0];
172
+ if (head.Title) {
173
+ if (!title) {
174
+ title = createElement('title', {});
175
+ insertElements(headElement, headElement.childNodes.at(-1), [title]);
176
+ }
177
+ title.childNodes = [];
178
+ defaultTreeAdapter.insertText(title, head.Title);
179
+ }
180
+ const parent = title?.parentNode ?? headElement;
181
+ const reference = title ?? parent.childNodes.at(-1);
182
+ insertElements(parent, reference, [...tags, createElement('meta', { name: 'robots', content: head.Robots })]);
183
+ }
184
+ /**
185
+ * Builds a page file from Explorer's built `index.html`. The file is parsed and written as a
186
+ * browser reads it, so the policy names each inline script by the text that the browser runs.
187
+ */
188
+ function buildHtml(indexHtml, head, tags) {
189
+ const document = parse(indexHtml, { scriptingEnabled: false });
190
+ for (const node of nodesIn(document)) {
191
+ if (defaultTreeAdapter.isCommentNode(node)) {
192
+ removeNode(node);
193
+ }
194
+ }
195
+ removeMapLibraryTags(document);
196
+ useStylesheetLinks(document);
197
+ const headElement = elementsIn(document, 'head')[0];
198
+ setHeadTags(headElement, head, tags);
199
+ const charset = elementsIn(headElement, 'meta').find((meta) => attribute(meta, 'charset') !== undefined);
200
+ insertElements(charset?.parentNode ?? headElement, charset, [policyTag(document)]);
201
+ return serialize(document, { scriptingEnabled: false });
202
+ }
203
+ /**
204
+ * Builds a page's HTML from Explorer's built `index.html`:
205
+ * - the page title, and the description and Open Graph tags that link previews read
206
+ * - a robots tag that lets search engines index the page
207
+ * - no map library tags, and a plain link for the main stylesheet
208
+ * - a Content Security Policy that allows only the site's own scripts
209
+ */
210
+ export function BuildPublicPageHtml(indexHtml, page) {
211
+ const head = { Title: page.Title, Description: page.Description, Robots: 'index, follow' };
212
+ return buildHtml(indexHtml, head, previewTags(head));
213
+ }
214
+ /**
215
+ * Builds the HTML for a public page address that has no page file: an unknown slug, or `/p/` alone.
216
+ * It has the same policy as a page file, so the error page that shows there runs under it. Search
217
+ * engines do not index it.
218
+ */
219
+ export function BuildPublicFallbackHtml(indexHtml) {
220
+ return buildHtml(indexHtml, { Robots: 'noindex' }, []);
221
+ }
222
+ /**
223
+ * Writes `public-pages/<slug>.html` into the site folder (Explorer's build) for each enabled page,
224
+ * and `public-pages/_fallback.html` for the other public page addresses.
225
+ *
226
+ * @returns the number of page files written
227
+ */
228
+ export function WritePublicPageHtmlFiles(siteDir, entries) {
229
+ const indexHtml = ReadFileIfExists(join(siteDir, 'index.html'));
230
+ if (indexHtml === null) {
231
+ throw new Error(`No index.html in ${siteDir}. Build MJ Explorer first.`);
232
+ }
233
+ const pages = enabledPages(entries);
234
+ mkdirSync(join(siteDir, PUBLIC_PAGE_HTML_FOLDER), { recursive: true });
235
+ writeFileSync(join(siteDir, PUBLIC_PAGE_HTML_FOLDER, PUBLIC_PAGE_FALLBACK_FILE), BuildPublicFallbackHtml(indexHtml), 'utf-8');
236
+ for (const page of pages) {
237
+ writeFileSync(join(siteDir, PUBLIC_PAGE_HTML_FOLDER, `${page.Slug}.html`), BuildPublicPageHtml(indexHtml, page), 'utf-8');
238
+ }
239
+ return pages.length;
240
+ }
241
+ /**
242
+ * Returns `routes` with two rewrites for each enabled page (`/p/<slug>` and `/p/<slug>/*`) to the
243
+ * page's HTML file, then one for every other public page address to the fallback file, before the
244
+ * other routes. Page routes from an earlier run are replaced.
245
+ */
246
+ export function ApplyPublicPageRoutes(routes, entries) {
247
+ const pagesUrlPath = `/${PUBLIC_PAGE_HTML_FOLDER}`;
248
+ const isPageRoute = (route) => !!route.rewrite?.startsWith(`${pagesUrlPath}/`);
249
+ const pageRoutes = enabledPages(entries)
250
+ .flatMap((entry) => {
251
+ const rewrite = `${pagesUrlPath}/${entry.Slug}.html`;
252
+ const path = `${PUBLIC_PAGE_PATH_PREFIX}${entry.Slug}`;
253
+ return [{ route: path, rewrite }, { route: `${path}/*`, rewrite }];
254
+ });
255
+ const fallbackRoute = { route: `${PUBLIC_PAGE_PATH_PREFIX}*`, rewrite: `${pagesUrlPath}/${PUBLIC_PAGE_FALLBACK_FILE}` };
256
+ return [...pageRoutes, fallbackRoute, ...routes.filter((route) => !isPageRoute(route))];
257
+ }
258
+ /** True when a JSON value is a route object. */
259
+ function isRoute(value) {
260
+ return typeof value === 'object' && value !== null && !Array.isArray(value) && typeof value['route'] === 'string';
261
+ }
262
+ /**
263
+ * Adds the page routes to `staticwebapp.config.json` (Azure Static Web Apps) in the site folder.
264
+ * A site folder without that file is not changed.
265
+ *
266
+ * @returns true when the file was written
267
+ */
268
+ export function WriteStaticWebAppRoutes(siteDir, entries) {
269
+ const configPath = join(siteDir, STATIC_WEB_APP_CONFIG_FILE);
270
+ const configText = ReadFileIfExists(configPath);
271
+ if (configText === null) {
272
+ return false;
273
+ }
274
+ const config = JSON.parse(configText);
275
+ const current = config['routes'];
276
+ const routes = Array.isArray(current) ? current.filter(isRoute) : [];
277
+ const updated = ApplyPublicPageRoutes(routes, entries);
278
+ if (JSON.stringify(updated) === JSON.stringify(current ?? [])) {
279
+ return false;
280
+ }
281
+ writeFileSync(configPath, `${JSON.stringify({ ...config, routes: updated }, null, 2)}\n`, 'utf-8');
282
+ return true;
283
+ }
284
+ //# sourceMappingURL=public-page-html.js.map