@portel/photon 1.4.1 โ†’ 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (395) hide show
  1. package/README.md +326 -1177
  2. package/dist/auto-ui/beam.d.ts +14 -0
  3. package/dist/auto-ui/beam.d.ts.map +1 -0
  4. package/dist/auto-ui/beam.js +3057 -0
  5. package/dist/auto-ui/beam.js.map +1 -0
  6. package/dist/auto-ui/bridge/index.d.ts +37 -0
  7. package/dist/auto-ui/bridge/index.d.ts.map +1 -0
  8. package/dist/auto-ui/bridge/index.js +555 -0
  9. package/dist/auto-ui/bridge/index.js.map +1 -0
  10. package/dist/auto-ui/bridge/openai-shim.d.ts +20 -0
  11. package/dist/auto-ui/bridge/openai-shim.d.ts.map +1 -0
  12. package/dist/auto-ui/bridge/openai-shim.js +231 -0
  13. package/dist/auto-ui/bridge/openai-shim.js.map +1 -0
  14. package/dist/auto-ui/bridge/photon-app.d.ts +162 -0
  15. package/dist/auto-ui/bridge/photon-app.d.ts.map +1 -0
  16. package/dist/auto-ui/bridge/photon-app.js +460 -0
  17. package/dist/auto-ui/bridge/photon-app.js.map +1 -0
  18. package/dist/auto-ui/bridge/types.d.ts +128 -0
  19. package/dist/auto-ui/bridge/types.d.ts.map +1 -0
  20. package/dist/auto-ui/bridge/types.js +7 -0
  21. package/dist/auto-ui/bridge/types.js.map +1 -0
  22. package/dist/auto-ui/components/card.d.ts +13 -0
  23. package/dist/auto-ui/components/card.d.ts.map +1 -0
  24. package/dist/auto-ui/components/card.js +64 -0
  25. package/dist/auto-ui/components/card.js.map +1 -0
  26. package/dist/auto-ui/components/form.d.ts +15 -0
  27. package/dist/auto-ui/components/form.d.ts.map +1 -0
  28. package/dist/auto-ui/components/form.js +72 -0
  29. package/dist/auto-ui/components/form.js.map +1 -0
  30. package/dist/auto-ui/components/list.d.ts +13 -0
  31. package/dist/auto-ui/components/list.d.ts.map +1 -0
  32. package/dist/auto-ui/components/list.js +58 -0
  33. package/dist/auto-ui/components/list.js.map +1 -0
  34. package/dist/auto-ui/components/progress.d.ts +18 -0
  35. package/dist/auto-ui/components/progress.d.ts.map +1 -0
  36. package/dist/auto-ui/components/progress.js +125 -0
  37. package/dist/auto-ui/components/progress.js.map +1 -0
  38. package/dist/auto-ui/components/table.d.ts +13 -0
  39. package/dist/auto-ui/components/table.d.ts.map +1 -0
  40. package/dist/auto-ui/components/table.js +82 -0
  41. package/dist/auto-ui/components/table.js.map +1 -0
  42. package/dist/auto-ui/components/tree.d.ts +13 -0
  43. package/dist/auto-ui/components/tree.d.ts.map +1 -0
  44. package/dist/auto-ui/components/tree.js +61 -0
  45. package/dist/auto-ui/components/tree.js.map +1 -0
  46. package/dist/auto-ui/daemon-tools.d.ts +45 -0
  47. package/dist/auto-ui/daemon-tools.d.ts.map +1 -0
  48. package/dist/auto-ui/daemon-tools.js +580 -0
  49. package/dist/auto-ui/daemon-tools.js.map +1 -0
  50. package/dist/auto-ui/design-system/index.d.ts +21 -0
  51. package/dist/auto-ui/design-system/index.d.ts.map +1 -0
  52. package/dist/auto-ui/design-system/index.js +27 -0
  53. package/dist/auto-ui/design-system/index.js.map +1 -0
  54. package/dist/auto-ui/design-system/tokens.d.ts +9 -0
  55. package/dist/auto-ui/design-system/tokens.d.ts.map +1 -0
  56. package/dist/auto-ui/design-system/tokens.js +27 -0
  57. package/dist/auto-ui/design-system/tokens.js.map +1 -0
  58. package/dist/auto-ui/design-system/transaction-ui.d.ts +70 -0
  59. package/dist/auto-ui/design-system/transaction-ui.d.ts.map +1 -0
  60. package/dist/auto-ui/design-system/transaction-ui.js +982 -0
  61. package/dist/auto-ui/design-system/transaction-ui.js.map +1 -0
  62. package/dist/auto-ui/frontend/index.html +84 -0
  63. package/dist/auto-ui/index.d.ts +23 -0
  64. package/dist/auto-ui/index.d.ts.map +1 -0
  65. package/dist/auto-ui/index.js +28 -0
  66. package/dist/auto-ui/index.js.map +1 -0
  67. package/dist/auto-ui/openapi-generator.d.ts +71 -0
  68. package/dist/auto-ui/openapi-generator.d.ts.map +1 -0
  69. package/dist/auto-ui/openapi-generator.js +223 -0
  70. package/dist/auto-ui/openapi-generator.js.map +1 -0
  71. package/dist/auto-ui/photon-bridge.d.ts +159 -0
  72. package/dist/auto-ui/photon-bridge.d.ts.map +1 -0
  73. package/dist/auto-ui/photon-bridge.js +262 -0
  74. package/dist/auto-ui/photon-bridge.js.map +1 -0
  75. package/dist/auto-ui/photon-host.d.ts +113 -0
  76. package/dist/auto-ui/photon-host.d.ts.map +1 -0
  77. package/dist/auto-ui/photon-host.js +284 -0
  78. package/dist/auto-ui/photon-host.js.map +1 -0
  79. package/dist/auto-ui/platform-compat.d.ts +71 -0
  80. package/dist/auto-ui/platform-compat.d.ts.map +1 -0
  81. package/dist/auto-ui/platform-compat.js +628 -0
  82. package/dist/auto-ui/platform-compat.js.map +1 -0
  83. package/dist/auto-ui/playground-html.d.ts +15 -0
  84. package/dist/auto-ui/playground-html.d.ts.map +1 -0
  85. package/dist/auto-ui/playground-html.js +1113 -0
  86. package/dist/auto-ui/playground-html.js.map +1 -0
  87. package/dist/auto-ui/playground-server.d.ts +7 -0
  88. package/dist/auto-ui/playground-server.d.ts.map +1 -0
  89. package/dist/auto-ui/playground-server.js +840 -0
  90. package/dist/auto-ui/playground-server.js.map +1 -0
  91. package/dist/auto-ui/registry.d.ts +13 -0
  92. package/dist/auto-ui/registry.d.ts.map +1 -0
  93. package/dist/auto-ui/registry.js +62 -0
  94. package/dist/auto-ui/registry.js.map +1 -0
  95. package/dist/auto-ui/renderer.d.ts +14 -0
  96. package/dist/auto-ui/renderer.d.ts.map +1 -0
  97. package/dist/auto-ui/renderer.js +88 -0
  98. package/dist/auto-ui/renderer.js.map +1 -0
  99. package/dist/auto-ui/rendering/components.d.ts +29 -0
  100. package/dist/auto-ui/rendering/components.d.ts.map +1 -0
  101. package/dist/auto-ui/rendering/components.js +773 -0
  102. package/dist/auto-ui/rendering/components.js.map +1 -0
  103. package/dist/auto-ui/rendering/field-analyzer.d.ts +48 -0
  104. package/dist/auto-ui/rendering/field-analyzer.d.ts.map +1 -0
  105. package/dist/auto-ui/rendering/field-analyzer.js +270 -0
  106. package/dist/auto-ui/rendering/field-analyzer.js.map +1 -0
  107. package/dist/auto-ui/rendering/field-renderers.d.ts +64 -0
  108. package/dist/auto-ui/rendering/field-renderers.d.ts.map +1 -0
  109. package/dist/auto-ui/rendering/field-renderers.js +317 -0
  110. package/dist/auto-ui/rendering/field-renderers.js.map +1 -0
  111. package/dist/auto-ui/rendering/index.d.ts +28 -0
  112. package/dist/auto-ui/rendering/index.d.ts.map +1 -0
  113. package/dist/auto-ui/rendering/index.js +60 -0
  114. package/dist/auto-ui/rendering/index.js.map +1 -0
  115. package/dist/auto-ui/rendering/layout-selector.d.ts +48 -0
  116. package/dist/auto-ui/rendering/layout-selector.d.ts.map +1 -0
  117. package/dist/auto-ui/rendering/layout-selector.js +352 -0
  118. package/dist/auto-ui/rendering/layout-selector.js.map +1 -0
  119. package/dist/auto-ui/rendering/template-engine.d.ts +41 -0
  120. package/dist/auto-ui/rendering/template-engine.d.ts.map +1 -0
  121. package/dist/auto-ui/rendering/template-engine.js +238 -0
  122. package/dist/auto-ui/rendering/template-engine.js.map +1 -0
  123. package/dist/auto-ui/streamable-http-transport.d.ts +103 -0
  124. package/dist/auto-ui/streamable-http-transport.d.ts.map +1 -0
  125. package/dist/auto-ui/streamable-http-transport.js +1875 -0
  126. package/dist/auto-ui/streamable-http-transport.js.map +1 -0
  127. package/dist/auto-ui/types.d.ts +384 -0
  128. package/dist/auto-ui/types.d.ts.map +1 -0
  129. package/dist/auto-ui/types.js +92 -0
  130. package/dist/auto-ui/types.js.map +1 -0
  131. package/dist/beam.bundle.js +63137 -0
  132. package/dist/beam.bundle.js.map +7 -0
  133. package/dist/claude-code-plugin.d.ts.map +1 -1
  134. package/dist/claude-code-plugin.js +30 -30
  135. package/dist/claude-code-plugin.js.map +1 -1
  136. package/dist/cli/commands/info.d.ts +11 -0
  137. package/dist/cli/commands/info.d.ts.map +1 -0
  138. package/dist/cli/commands/info.js +313 -0
  139. package/dist/cli/commands/info.js.map +1 -0
  140. package/dist/cli/commands/marketplace.d.ts +11 -0
  141. package/dist/cli/commands/marketplace.d.ts.map +1 -0
  142. package/dist/cli/commands/marketplace.js +198 -0
  143. package/dist/cli/commands/marketplace.js.map +1 -0
  144. package/dist/cli/commands/package-app.d.ts +9 -0
  145. package/dist/cli/commands/package-app.d.ts.map +1 -0
  146. package/dist/cli/commands/package-app.js +191 -0
  147. package/dist/cli/commands/package-app.js.map +1 -0
  148. package/dist/cli/commands/package.d.ts +11 -0
  149. package/dist/cli/commands/package.d.ts.map +1 -0
  150. package/dist/cli/commands/package.js +573 -0
  151. package/dist/cli/commands/package.js.map +1 -0
  152. package/dist/cli-alias.d.ts.map +1 -1
  153. package/dist/cli-alias.js +30 -28
  154. package/dist/cli-alias.js.map +1 -1
  155. package/dist/cli-formatter.d.ts +8 -24
  156. package/dist/cli-formatter.d.ts.map +1 -1
  157. package/dist/cli-formatter.js +8 -325
  158. package/dist/cli-formatter.js.map +1 -1
  159. package/dist/cli.d.ts +15 -1
  160. package/dist/cli.d.ts.map +1 -1
  161. package/dist/cli.js +1166 -1131
  162. package/dist/cli.js.map +1 -1
  163. package/dist/daemon/client.d.ts +84 -3
  164. package/dist/daemon/client.d.ts.map +1 -1
  165. package/dist/daemon/client.js +561 -11
  166. package/dist/daemon/client.js.map +1 -1
  167. package/dist/daemon/manager.d.ts +51 -12
  168. package/dist/daemon/manager.d.ts.map +1 -1
  169. package/dist/daemon/manager.js +122 -61
  170. package/dist/daemon/manager.js.map +1 -1
  171. package/dist/daemon/protocol.d.ts +62 -6
  172. package/dist/daemon/protocol.d.ts.map +1 -1
  173. package/dist/daemon/protocol.js +76 -1
  174. package/dist/daemon/protocol.js.map +1 -1
  175. package/dist/daemon/server.d.ts +6 -6
  176. package/dist/daemon/server.js +743 -133
  177. package/dist/daemon/server.js.map +1 -1
  178. package/dist/daemon/session-manager.d.ts +8 -1
  179. package/dist/daemon/session-manager.d.ts.map +1 -1
  180. package/dist/daemon/session-manager.js +32 -9
  181. package/dist/daemon/session-manager.js.map +1 -1
  182. package/dist/deploy/cloudflare.d.ts +12 -0
  183. package/dist/deploy/cloudflare.d.ts.map +1 -0
  184. package/dist/deploy/cloudflare.js +216 -0
  185. package/dist/deploy/cloudflare.js.map +1 -0
  186. package/dist/index.d.ts +1 -0
  187. package/dist/index.d.ts.map +1 -1
  188. package/dist/index.js +3 -0
  189. package/dist/index.js.map +1 -1
  190. package/dist/loader.d.ts +191 -21
  191. package/dist/loader.d.ts.map +1 -1
  192. package/dist/loader.js +1186 -319
  193. package/dist/loader.js.map +1 -1
  194. package/dist/markdown-utils.d.ts +8 -0
  195. package/dist/markdown-utils.d.ts.map +1 -0
  196. package/dist/markdown-utils.js +63 -0
  197. package/dist/markdown-utils.js.map +1 -0
  198. package/dist/marketplace-manager.d.ts +10 -0
  199. package/dist/marketplace-manager.d.ts.map +1 -1
  200. package/dist/marketplace-manager.js +112 -28
  201. package/dist/marketplace-manager.js.map +1 -1
  202. package/dist/mcp-client.d.ts +9 -0
  203. package/dist/mcp-client.d.ts.map +1 -0
  204. package/dist/mcp-client.js +11 -0
  205. package/dist/mcp-client.js.map +1 -0
  206. package/dist/mcp-elicitation.d.ts +32 -0
  207. package/dist/mcp-elicitation.d.ts.map +1 -0
  208. package/dist/mcp-elicitation.js +26 -0
  209. package/dist/mcp-elicitation.js.map +1 -0
  210. package/dist/path-resolver.d.ts +9 -12
  211. package/dist/path-resolver.d.ts.map +1 -1
  212. package/dist/path-resolver.js +13 -43
  213. package/dist/path-resolver.js.map +1 -1
  214. package/dist/photon-cli-runner.d.ts.map +1 -1
  215. package/dist/photon-cli-runner.js +204 -77
  216. package/dist/photon-cli-runner.js.map +1 -1
  217. package/dist/photon-doc-extractor.d.ts +89 -0
  218. package/dist/photon-doc-extractor.d.ts.map +1 -1
  219. package/dist/photon-doc-extractor.js +560 -32
  220. package/dist/photon-doc-extractor.js.map +1 -1
  221. package/dist/photons/maker.photon.d.ts +182 -0
  222. package/dist/photons/maker.photon.d.ts.map +1 -0
  223. package/dist/photons/maker.photon.js +504 -0
  224. package/dist/photons/maker.photon.js.map +1 -0
  225. package/dist/photons/maker.photon.ts +626 -0
  226. package/dist/photons/marketplace.photon.d.ts +110 -0
  227. package/dist/photons/marketplace.photon.d.ts.map +1 -0
  228. package/dist/photons/marketplace.photon.js +260 -0
  229. package/dist/photons/marketplace.photon.js.map +1 -0
  230. package/dist/photons/marketplace.photon.ts +378 -0
  231. package/dist/photons/tunnel.photon.d.ts +80 -0
  232. package/dist/photons/tunnel.photon.d.ts.map +1 -0
  233. package/dist/photons/tunnel.photon.js +269 -0
  234. package/dist/photons/tunnel.photon.js.map +1 -0
  235. package/dist/photons/tunnel.photon.ts +345 -0
  236. package/dist/security-scanner.d.ts.map +1 -1
  237. package/dist/security-scanner.js +18 -15
  238. package/dist/security-scanner.js.map +1 -1
  239. package/dist/serv/auth/jwt.d.ts +89 -0
  240. package/dist/serv/auth/jwt.d.ts.map +1 -0
  241. package/dist/serv/auth/jwt.js +239 -0
  242. package/dist/serv/auth/jwt.js.map +1 -0
  243. package/dist/serv/auth/oauth.d.ts +117 -0
  244. package/dist/serv/auth/oauth.d.ts.map +1 -0
  245. package/dist/serv/auth/oauth.js +395 -0
  246. package/dist/serv/auth/oauth.js.map +1 -0
  247. package/dist/serv/auth/well-known.d.ts +60 -0
  248. package/dist/serv/auth/well-known.d.ts.map +1 -0
  249. package/dist/serv/auth/well-known.js +154 -0
  250. package/dist/serv/auth/well-known.js.map +1 -0
  251. package/dist/serv/db/d1-client.d.ts +65 -0
  252. package/dist/serv/db/d1-client.d.ts.map +1 -0
  253. package/dist/serv/db/d1-client.js +137 -0
  254. package/dist/serv/db/d1-client.js.map +1 -0
  255. package/dist/serv/db/d1-stores.d.ts +62 -0
  256. package/dist/serv/db/d1-stores.d.ts.map +1 -0
  257. package/dist/serv/db/d1-stores.js +307 -0
  258. package/dist/serv/db/d1-stores.js.map +1 -0
  259. package/dist/serv/index.d.ts +114 -0
  260. package/dist/serv/index.d.ts.map +1 -0
  261. package/dist/serv/index.js +172 -0
  262. package/dist/serv/index.js.map +1 -0
  263. package/dist/serv/local.d.ts +118 -0
  264. package/dist/serv/local.d.ts.map +1 -0
  265. package/dist/serv/local.js +392 -0
  266. package/dist/serv/local.js.map +1 -0
  267. package/dist/serv/middleware/auth.d.ts +66 -0
  268. package/dist/serv/middleware/auth.d.ts.map +1 -0
  269. package/dist/serv/middleware/auth.js +178 -0
  270. package/dist/serv/middleware/auth.js.map +1 -0
  271. package/dist/serv/middleware/tenant.d.ts +94 -0
  272. package/dist/serv/middleware/tenant.d.ts.map +1 -0
  273. package/dist/serv/middleware/tenant.js +152 -0
  274. package/dist/serv/middleware/tenant.js.map +1 -0
  275. package/dist/serv/runtime/executor.d.ts +76 -0
  276. package/dist/serv/runtime/executor.d.ts.map +1 -0
  277. package/dist/serv/runtime/executor.js +105 -0
  278. package/dist/serv/runtime/executor.js.map +1 -0
  279. package/dist/serv/runtime/index.d.ts +8 -0
  280. package/dist/serv/runtime/index.d.ts.map +1 -0
  281. package/dist/serv/runtime/index.js +10 -0
  282. package/dist/serv/runtime/index.js.map +1 -0
  283. package/dist/serv/runtime/oauth-context.d.ts +121 -0
  284. package/dist/serv/runtime/oauth-context.d.ts.map +1 -0
  285. package/dist/serv/runtime/oauth-context.js +153 -0
  286. package/dist/serv/runtime/oauth-context.js.map +1 -0
  287. package/dist/serv/session/kv-store.d.ts +54 -0
  288. package/dist/serv/session/kv-store.d.ts.map +1 -0
  289. package/dist/serv/session/kv-store.js +149 -0
  290. package/dist/serv/session/kv-store.js.map +1 -0
  291. package/dist/serv/session/store.d.ts +113 -0
  292. package/dist/serv/session/store.d.ts.map +1 -0
  293. package/dist/serv/session/store.js +284 -0
  294. package/dist/serv/session/store.js.map +1 -0
  295. package/dist/serv/types/index.d.ts +147 -0
  296. package/dist/serv/types/index.d.ts.map +1 -0
  297. package/dist/serv/types/index.js +8 -0
  298. package/dist/serv/types/index.js.map +1 -0
  299. package/dist/serv/vault/token-vault.d.ts +102 -0
  300. package/dist/serv/vault/token-vault.d.ts.map +1 -0
  301. package/dist/serv/vault/token-vault.js +177 -0
  302. package/dist/serv/vault/token-vault.js.map +1 -0
  303. package/dist/server.d.ts +184 -0
  304. package/dist/server.d.ts.map +1 -1
  305. package/dist/server.js +1995 -86
  306. package/dist/server.js.map +1 -1
  307. package/dist/shared/cli-sections.d.ts +6 -0
  308. package/dist/shared/cli-sections.d.ts.map +1 -0
  309. package/dist/shared/cli-sections.js +16 -0
  310. package/dist/shared/cli-sections.js.map +1 -0
  311. package/dist/shared/cli-utils.d.ts +81 -0
  312. package/dist/shared/cli-utils.d.ts.map +1 -0
  313. package/dist/shared/cli-utils.js +174 -0
  314. package/dist/shared/cli-utils.js.map +1 -0
  315. package/dist/shared/config-docs.d.ts +6 -0
  316. package/dist/shared/config-docs.d.ts.map +1 -0
  317. package/dist/shared/config-docs.js +6 -0
  318. package/dist/shared/config-docs.js.map +1 -0
  319. package/dist/shared/error-handler.d.ts +128 -0
  320. package/dist/shared/error-handler.d.ts.map +1 -0
  321. package/dist/shared/error-handler.js +342 -0
  322. package/dist/shared/error-handler.js.map +1 -0
  323. package/dist/shared/logger.d.ts +42 -0
  324. package/dist/shared/logger.d.ts.map +1 -0
  325. package/dist/shared/logger.js +123 -0
  326. package/dist/shared/logger.js.map +1 -0
  327. package/dist/shared/performance.d.ts +65 -0
  328. package/dist/shared/performance.d.ts.map +1 -0
  329. package/dist/shared/performance.js +136 -0
  330. package/dist/shared/performance.js.map +1 -0
  331. package/dist/shared/task-runner.d.ts +2 -0
  332. package/dist/shared/task-runner.d.ts.map +1 -0
  333. package/dist/shared/task-runner.js +16 -0
  334. package/dist/shared/task-runner.js.map +1 -0
  335. package/dist/shared/validation.d.ts +6 -0
  336. package/dist/shared/validation.d.ts.map +1 -0
  337. package/dist/shared/validation.js +6 -0
  338. package/dist/shared/validation.js.map +1 -0
  339. package/dist/shared-utils.d.ts +63 -0
  340. package/dist/shared-utils.d.ts.map +1 -0
  341. package/dist/shared-utils.js +123 -0
  342. package/dist/shared-utils.js.map +1 -0
  343. package/dist/template-manager.d.ts +23 -2
  344. package/dist/template-manager.d.ts.map +1 -1
  345. package/dist/template-manager.js +176 -87
  346. package/dist/template-manager.js.map +1 -1
  347. package/dist/test-client.d.ts.map +1 -1
  348. package/dist/test-client.js +10 -8
  349. package/dist/test-client.js.map +1 -1
  350. package/dist/test-runner.d.ts +52 -0
  351. package/dist/test-runner.d.ts.map +1 -0
  352. package/dist/test-runner.js +785 -0
  353. package/dist/test-runner.js.map +1 -0
  354. package/dist/testing.d.ts +103 -0
  355. package/dist/testing.d.ts.map +1 -0
  356. package/dist/testing.js +163 -0
  357. package/dist/testing.js.map +1 -0
  358. package/dist/version-checker.d.ts.map +1 -1
  359. package/dist/version-checker.js +2 -2
  360. package/dist/version-checker.js.map +1 -1
  361. package/dist/version.d.ts +10 -0
  362. package/dist/version.d.ts.map +1 -0
  363. package/dist/version.js +21 -0
  364. package/dist/version.js.map +1 -0
  365. package/dist/watcher.d.ts +6 -3
  366. package/dist/watcher.d.ts.map +1 -1
  367. package/dist/watcher.js +49 -10
  368. package/dist/watcher.js.map +1 -1
  369. package/package.json +57 -7
  370. package/templates/cloudflare/worker.ts.template +381 -0
  371. package/templates/cloudflare/wrangler.toml.template +9 -0
  372. package/dist/base.d.ts +0 -58
  373. package/dist/base.d.ts.map +0 -1
  374. package/dist/base.js +0 -92
  375. package/dist/base.js.map +0 -1
  376. package/dist/dependency-manager.d.ts +0 -49
  377. package/dist/dependency-manager.d.ts.map +0 -1
  378. package/dist/dependency-manager.js +0 -165
  379. package/dist/dependency-manager.js.map +0 -1
  380. package/dist/registry-manager.d.ts +0 -76
  381. package/dist/registry-manager.d.ts.map +0 -1
  382. package/dist/registry-manager.js +0 -220
  383. package/dist/registry-manager.js.map +0 -1
  384. package/dist/schema-extractor.d.ts +0 -110
  385. package/dist/schema-extractor.d.ts.map +0 -1
  386. package/dist/schema-extractor.js +0 -727
  387. package/dist/schema-extractor.js.map +0 -1
  388. package/dist/test-marketplace-sources.d.ts +0 -5
  389. package/dist/test-marketplace-sources.d.ts.map +0 -1
  390. package/dist/test-marketplace-sources.js +0 -53
  391. package/dist/test-marketplace-sources.js.map +0 -1
  392. package/dist/types.d.ts +0 -109
  393. package/dist/types.d.ts.map +0 -1
  394. package/dist/types.js +0 -12
  395. package/dist/types.js.map +0 -1
package/README.md CHANGED
@@ -1,1370 +1,519 @@
1
1
 
2
- ![Photon Logo](https://raw.githubusercontent.com/portel-dev/photon/refs/heads/main/assets/photon-logo.png)
2
+ <div align="center">
3
3
 
4
- [![npm version](https://badgen.net/npm/v/@portel/photon)](https://www.npmjs.com/package/@portel/photon)
5
- [![npm downloads](https://badgen.net/npm/dm/@portel/photon)](https://www.npmjs.com/package/@portel/photon)
6
- [![MCP](https://img.shields.io/badge/MCP-Compatible-blue)](https://modelcontextprotocol.io)
4
+ <img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/photon-logo.png" alt="Photon" width="500">
7
5
 
8
- # Photon
6
+ **Simplify the creation of CLI tools, MCP servers, and web applications.**
9
7
 
10
- **Universal runtime that turns single-file TypeScript into MCP server, CLI, and more.**
8
+ A framework, runtime, and ecosystem. Batteries included.
11
9
 
12
- Photon TS files are Single file. Zero boilerplate. Pure business logic.
10
+ [![npm version](https://img.shields.io/npm/v/@portel/photon?color=cb3837&label=npm)](https://www.npmjs.com/package/@portel/photon)
11
+ [![npm downloads](https://img.shields.io/npm/dm/@portel/photon?color=cb3837)](https://www.npmjs.com/package/@portel/photon)
12
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/portel-dev/photon/blob/main/LICENSE)
13
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-3178c6.svg)](https://www.typescriptlang.org)
14
+ [![Node](https://img.shields.io/badge/node-%3E%3D18-43853d.svg)](https://nodejs.org)
15
+ [![MCP](https://img.shields.io/badge/MCP-compatible-7c3aed.svg)](https://modelcontextprotocol.io)
13
16
 
14
- ---
15
-
16
- ## TL;DR
17
-
18
- **The Problem with MCPs Today:**
19
-
20
- - Popular MCPs don't exactly match your specific requirements
21
- - **Security risk**: Malicious MCPs can steal your data through prompt injectionโ€”not just credentials
22
- - Scattered across 4-6 files, making security audits impractical
23
- - Too complex to fork and customize safely
24
-
25
- **Photon's Solution:** Single-file TypeScript format. Pure business logic, zero boilerplate. Fork-first design where every `.photon.ts` is trivial to audit and customize.
26
-
27
- Think of it like **NPM and Node, but for MCP**.
28
-
29
- ### Write Once, Use Everywhere
30
-
31
- The same `.photon.ts` file automatically becomes:
32
- - ๐Ÿค– **MCP Server** - Tools for Claude Desktop, Cursor, and AI assistants
33
- - ๐Ÿ’ป **CLI Tool** - Beautiful command-line interface for humans
34
- - ๐Ÿ”Œ **Platform Integrations** - NCP, Lumina, and future runtimes
35
-
36
- ```bash
37
- # Same file, multiple interfaces:
38
- photon mcp analytics # Run as MCP server for AI
39
- photon cli analytics revenue # Use as CLI tool for humans
40
- ```
41
-
42
- **Zero extra code. Pure business logic. Infinite deployment targets.**
43
-
44
- ### The Photon Ecosystem Flywheel
45
-
46
- ![Photon Ecosystem](https://raw.githubusercontent.com/portel-dev/photon/refs/heads/main/assets/photon-ecosystem.png)
17
+ [Quick Start](#quick-start) ยท [How It Works](#how-it-works) ยท [Beam UI](#beam) ยท [Marketplace](#marketplace) ยท [Docs](#documentation)
47
18
 
48
- The ecosystem creates a virtuous cycle: AI generates photons โ†’ Runtime executes them โ†’ Community shares โ†’ AI gets smarter.
19
+ </div>
49
20
 
50
21
  ---
51
22
 
52
- ## The Problem
53
-
54
- Traditional MCP servers scatter your logic across 4-6 files:
55
-
56
- ```
57
- traditional-mcp/
58
- โ”œโ”€โ”€ server.ts (50 lines of boilerplate)
59
- โ”œโ”€โ”€ transport.ts (40 lines of setup)
60
- โ”œโ”€โ”€ schemas.ts (40 lines of type definitions)
61
- โ”œโ”€โ”€ types.ts (30 lines more types)
62
- โ”œโ”€โ”€ package.json (dependencies)
63
- โ””โ”€โ”€ business.ts (20 lines of YOUR CODE)
64
- ```
65
-
66
- **This creates real problems:**
67
-
68
- - โŒ **For AI agents**: Scattered context across files makes understanding difficult
69
- - โŒ **For humans**: Jump between files to understand one feature
70
- - โŒ **For teams**: 200+ lines before you write business logic
71
- - โŒ **For maintenance**: Changes require updating multiple files and configs
72
-
73
- ---
74
-
75
- ## The Solution
76
-
77
- Photon puts everything in **one file**:
78
-
79
- ```typescript
80
- /**
81
- * Analytics - Query company analytics database
82
- * @dependencies pg@^8.11.0
83
- */
84
- import { Client } from 'pg';
85
-
86
- export default class Analytics {
87
- private db: Client;
88
-
89
- constructor(
90
- private host: string,
91
- private database: string,
92
- private password: string
93
- ) {}
94
-
95
- async onInitialize() {
96
- this.db = new Client({
97
- host: this.host,
98
- database: this.database,
99
- password: this.password
100
- });
101
- await this.db.connect();
102
- }
103
-
104
- /**
105
- * Get revenue by date range
106
- * @param startDate Start date (YYYY-MM-DD)
107
- * @param endDate End date (YYYY-MM-DD)
108
- */
109
- async revenue(params: { startDate: string; endDate: string }) {
110
- const result = await this.db.query(
111
- 'SELECT date, SUM(amount) FROM orders WHERE date BETWEEN $1 AND $2 GROUP BY date',
112
- [params.startDate, params.endDate]
113
- );
114
- return result.rows;
115
- }
116
- }
117
- ```
23
+ ## What Is This Thing?
118
24
 
119
- **40 lines. One file. Production-ready.**
25
+ So, here is the situation. You write a single TypeScript file. Just one. And somehow, through some dark magic I donโ€™t fully understand either, you get three things at once:
120
26
 
121
- ### Use It Everywhere
27
+ 1. **An MCP server** (so Claude or Cursor can use your tools).
28
+ 2. **A CLI tool** (so you can run it from the terminal like a normal human).
29
+ 3. **A web application** (a visual dashboard called "Beam" that makes forms for you).
122
30
 
123
- That single file now works as both an **MCP server** and a **CLI tool**:
31
+ It looks like this:
124
32
 
125
- ```bash
126
- # As an MCP server (for AI assistants)
127
- photon mcp analytics
128
- # โ†’ Claude Desktop can now call revenue() as a tool
129
-
130
- # As a CLI (for humans)
131
- photon cli analytics revenue --startDate 2024-01-01 --endDate 2024-12-31
132
- # โ†’ Beautiful formatted output:
133
- # โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
134
- # โ”‚ Date โ”‚ Revenue โ”‚
135
- # โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
136
- # โ”‚ 2024-01-01 โ”‚ $12,450 โ”‚
137
- # โ”‚ 2024-01-02 โ”‚ $15,320 โ”‚
138
- # โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
139
33
  ```
140
-
141
- **Same code. Same logic. Two interfaces. Zero duplication.**
142
-
143
- ---
144
-
145
- ## Why One File Changes Everything
146
-
147
- ### ๐Ÿค– AI-Native Design
148
-
149
- AI agents can now understand your entire MCP in one context:
150
-
151
- ```bash
152
- # AI can read, understand, and suggest improvements
153
- "Read my analytics.photon.ts and explain how it works"
154
- "Review this photon for security issues"
155
- "Add error handling to this photon"
34
+ analytics.photon.ts โ†’ MCP Server | CLI Tool | Web UI
156
35
  ```
157
36
 
158
- Traditional MCPs require AI to piece together scattered files โ€” Photons give complete context.
159
-
160
- ### ๐Ÿ‘ค Human-Friendly
37
+ You just write the logic. Photon deals with the protocols, schemas, and the boring stuff that usually makes you question your life choices.
161
38
 
162
- - **Understand**: Read one file, understand the whole system
163
- - **Review**: Code reviews are one file, one story
164
- - **Debug**: All logic in one place, no jumping around
165
- - **Learn**: New team members read one file
39
+ ### The Basics
166
40
 
167
- ### ๐Ÿ”ง Fork-First Philosophy
41
+ If you are just skimming, here is what you need to know:
168
42
 
169
- Every photon is designed to be customized:
170
-
171
- ```bash
172
- # Copy, modify, done โ€” no build configs to update
173
- cp ~/.photon/jira.photon.ts ~/.photon/my-jira.photon.ts
174
- # Edit my-jira.photon.ts however you want
175
- photon mcp my-jira # Works immediately
176
- ```
43
+ | Concept | What it is | Learn more |
44
+ |---------|-----------|------------|
45
+ | **MCP** | A way for AI to use your tools. Itโ€™s a standard. | [modelcontextprotocol.io](https://modelcontextprotocol.io/introduction) |
46
+ | **Photon file** | A `.photon.ts` file. You define tools as methods in a class. | [Guide](./GUIDE.md) |
47
+ | **Beam** | A web dashboard. It shows your tools as forms. | [Beam UI](#beam) |
48
+ | **Marketplace** | A way to get other peopleโ€™s photons. | [Marketplace](#marketplace) |
49
+ | **Daemon** | A background thing that handles messages and jobs. | [Daemon Pub/Sub](./DAEMON-PUBSUB.md) |
50
+ | **Tags** | JSDoc comments that tell Photon what to do. | [Tag Reference](./DOCBLOCK-TAGS.md) |
51
+ | **Custom UI** | When the auto-generated forms aren't enough. | [Custom UI Guide](./CUSTOM-UI.md) |
177
52
 
178
- **Use cases:**
53
+ ### Who Is This For?
179
54
 
180
- - Add company-specific authentication
181
- - Customize business logic
182
- - Merge multiple photons
183
- - Experiment without breaking originals
55
+ * **Developers** who want to give AI access to their database but are too lazy to write a full server.
56
+ * **Teams** who want to share tools without emailing zip files.
57
+ * **Anyone** who wants a CLI and a web UI without writing the boilerplate.
184
58
 
185
- ### ๐Ÿ”’ Security Through Transparency
186
-
187
- Prompt injection attacks are the new supply-chain threat. A malicious MCP can manipulate AI responses to exfiltrate your entire conversation historyโ€”not just credentials.
188
-
189
- **One file = one audit:**
190
-
191
- - Read 40 lines, understand everything
192
- - No hidden code scattered across imports
193
- - Fork and verify in minutes, not hours
194
- - Trust through transparency, not reputation
195
-
196
- When you can't trust a photon, you can **safely fork and audit it**. Traditional MCPs with scattered logic? Nearly impossible to verify.
197
-
198
- ### ๐Ÿ“ฆ Zero-Friction Dependencies
199
-
200
- Dependencies are auto-installed via JSDoc (like `npx` or `uv`):
201
-
202
- ```typescript
203
- /**
204
- * @dependencies axios@^1.6.0, lodash@^4.17.21
205
- */
206
- ```
207
-
208
- No manual `npm install`. No `package.json`. Photon handles it.
59
+ You don't need to know what "MCP" actually stands for. If you can write a TypeScript class, you are qualified.
209
60
 
210
61
  ---
211
62
 
212
63
  ## Quick Start
213
64
 
214
- ### Install
65
+ If you are the type who likes to just run commands and see what happens:
215
66
 
216
67
  ```bash
217
68
  npm install -g @portel/photon
69
+ photon maker new my-tool # Makes a new photon
70
+ photon # Opens the Beam UI
218
71
  ```
219
72
 
220
- ### Use Ready-Made Photons
221
-
222
- The [**official Photon marketplace**](https://github.com/portel-dev/photons) comes pre-configured with 16+ production-ready photons:
73
+ Or if you don't want to install anything (I get it):
223
74
 
224
75
  ```bash
225
- # Browse all photons
226
- photon info
227
-
228
- # Install any photon (filesystem, git, postgres, mongodb, slack, etc.)
229
- photon add filesystem
230
-
231
- # or else copy your own .photon.ts file to
232
- # .photon folder in your user folder
233
-
234
- # Call info command with mcp option
235
- photon info filesystem --mcp
236
- # Get client config json
237
- {
238
- "filesystem": {
239
- "command": "photon",
240
- "args": [
241
- "mcp",
242
- "filesystem"
243
- ],
244
- "env": {
245
- "FILESYSTEM_WORKDIR": "/Users/arul/Documents",
246
- "FILESYSTEM_MAX_FILE_SIZE": "10485760",
247
- "FILESYSTEM_ALLOW_HIDDEN": "false"
248
- }
249
- }
250
- }
251
- # Add to your client
76
+ npx @portel/photon maker new my-tool
77
+ npx @portel/photon
252
78
  ```
253
79
 
254
- ### Build Photons with AI
255
-
256
- Use the [**photon-skill**](https://github.com/portel-dev/photon-skill) for Claude Desktop or Claude Code to generate `.photon.ts` files:
257
- - Single TypeScript files with metadata
258
- - AI understands complete context in one file
259
- - Zero boilerplate, just business logic
260
-
261
- ### Add Your Own Marketplace
262
-
263
- ```bash
264
- # Add custom marketplace from GitHub
265
- photon marketplace add your-org/your-photons
266
-
267
- # Install from your marketplace
268
- photon add your-custom-tool
269
- ```
80
+ > **Note:** You need [Node.js 18+](https://nodejs.org). Also, TypeScript helps, but Photon handles the compiling, so you don't have to fight with `tsconfig.json`.
270
81
 
271
82
  ---
272
83
 
273
- ## The Value Proposition
84
+ ## How It Works
274
85
 
275
- | Metric | Traditional MCP | Photon |
276
- |--------|-----------------|--------|
277
- | **Setup Time** | 40 minutes | 5 minutes |
278
- | **Lines of Code** | 200+ | ~40 |
279
- | **Files Needed** | 4-6 files | 1 file |
280
- | **Boilerplate** | Manual | Auto-handled |
281
- | **Schema Generation** | Manual | Automatic from TypeScript |
282
- | **Dependencies** | Manual npm install | Auto-installed from @dependencies |
283
- | **Hot Reload** | Configure yourself | Built-in with --dev |
284
- | **AI Context** | Scattered | Single file |
285
- | **CLI Interface** | Write separate code | Automatic from same code |
286
- | **Deployment Targets** | MCP only | MCP, CLI, NCP, Lumina, APIs... |
86
+ A photon is just a TypeScript class. The **public methods become tools**. Photon reads your code, looks at the types, reads your comments, and then generates everything else.
287
87
 
288
- [See detailed comparison โ†’](COMPARISON.md)
88
+ Iโ€™ll show you.
289
89
 
290
- ---
90
+ ### Step 1: The Bare Minimum
291
91
 
292
- ## CLI Interface
92
+ Here is a class with one method. This is a valid photon.
293
93
 
294
- Every photon automatically provides a beautiful CLI interface with zero additional code. The same business logic that powers your MCP tools becomes instantly available from the terminal.
295
-
296
- ### Quick Example
297
-
298
- ```bash
299
- # List all methods
300
- photon cli lg-remote
301
-
302
- # Call methods with natural syntax
303
- photon cli lg-remote volume 50
304
- photon cli lg-remote volume +5
305
- photon cli lg-remote channel 7
306
- photon cli lg-remote app netflix
307
-
308
- # Get method help
309
- photon cli lg-remote volume --help
310
- ```
311
-
312
- ### Beautiful Output Formats
313
-
314
- Photon automatically formats output based on data structure:
315
-
316
- **Tables** - Key-value pairs and flat objects:
317
- ```bash
318
- $ photon cli lg-remote volume
319
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”
320
- โ”‚ volume โ”‚ 45 โ”‚
321
- โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”ค
322
- โ”‚ muted โ”‚ no โ”‚
323
- โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”ค
324
- โ”‚ maxVol โ”‚ 100โ”‚
325
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”˜
94
+ ```typescript
95
+ export default class Weather {
96
+ async forecast(params: { city: string }) {
97
+ return `Weather for ${params.city}: Sunny, 72ยฐF`;
98
+ }
99
+ }
326
100
  ```
327
101
 
328
- **Lists** - Arrays of items:
329
- ```bash
330
- $ photon cli lg-remote apps
331
- โ€ข Netflix (netflix)
332
- โ€ข YouTube (youtube.leanback.v4)
333
- โ€ข HDMI1 (com.webos.app.hdmi1)
334
- โ€ข Disney+ (disney)
335
- ```
102
+ **What happens:** Beam sees this and makes a form with a text box labeled "city". You click a button, and it runs.
336
103
 
337
- **Trees** - Hierarchical data (shown as formatted JSON)
338
- **Primitives** - Simple values displayed directly
104
+ **What you get:**
105
+ * `photon mcp weather` (The server for Claude)
106
+ * `photon cli weather forecast --city Paris` (The command line tool)
107
+ * `photon` (The web UI)
339
108
 
340
- ### Format System
109
+ <div align="center">
110
+ <img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/readme-step-1.png" alt="Step 1 โ€” Bare method in Beam" width="600">
111
+ </div>
341
112
 
342
- Photon uses a smart format system with 5 standard types:
113
+ ### Step 2: Adding Descriptions
343
114
 
344
- 1. **`primitive`** - String, number, boolean
345
- 2. **`table`** - Flat object or array of flat objects
346
- 3. **`tree`** - Nested/hierarchical data
347
- 4. **`list`** - Array of simple items
348
- 5. **`none`** - No return value (void operations)
115
+ If you add JSDoc comments, they show up as descriptions.
349
116
 
350
- **Hint the format** (optional):
351
117
  ```typescript
352
118
  /**
353
- * Get current volume
354
- * @format table
119
+ * Weather - Check weather forecasts worldwide
120
+ *
121
+ * Provides current conditions.
355
122
  */
356
- async volume() {
357
- return this._request('ssap://audio/getVolume');
123
+ export default class Weather {
124
+ /**
125
+ * Get the weather forecast
126
+ * @param city City name (e.g., "London")
127
+ */
128
+ async forecast(params: { city: string }) {
129
+ return `Weather for ${params.city}: Sunny, 72ยฐF`;
130
+ }
358
131
  }
359
132
  ```
360
133
 
361
- **Auto-detection**: If no `@format` tag is provided, Photon automatically detects the best format based on the return value structure.
362
-
363
- ### CLI Command Reference
364
-
365
- #### `photon cli <photon-name> [method] [args...]`
366
-
367
- **List all methods:**
368
- ```bash
369
- photon cli lg-remote
370
- ```
371
-
372
- **Call a method:**
373
- ```bash
374
- # No parameters
375
- photon cli lg-remote status
376
-
377
- # Single parameter
378
- photon cli lg-remote volume 50
379
-
380
- # Multiple parameters
381
- photon cli lg-remote search query "breaking bad" limit 10
382
-
383
- # Relative adjustments
384
- photon cli lg-remote volume +5
385
- photon cli lg-remote channel +1
386
- ```
387
-
388
- **Get method help:**
389
- ```bash
390
- photon cli lg-remote volume --help
391
- ```
134
+ **What happens:** Now the UI has helpful text. Also, the AI client reads this to understand what the tool does.
392
135
 
393
- **Raw JSON output:**
394
- ```bash
395
- photon cli lg-remote volume --json
396
- ```
136
+ <div align="center">
137
+ <img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/readme-step-2.png" alt="Step 2 โ€” JSDoc descriptions in Beam" width="600">
138
+ </div>
397
139
 
398
- ### One Codebase, Multiple Interfaces
140
+ ### Step 3: Configuration (The clever bit)
399
141
 
400
- The beauty of Photon's design: **improvements to business logic automatically work across all interfaces**.
142
+ If you need an API key, put it in the constructor.
401
143
 
402
- Write your logic once:
403
144
  ```typescript
404
- async volume(params?: { level?: number | string } | number | string) {
405
- // Handle relative adjustments
406
- if (typeof level === 'string' && level.startsWith('+')) {
407
- const delta = parseInt(level);
408
- const current = await this._getCurrentVolume();
409
- const newVolume = current + delta;
410
- await this._setVolume(newVolume);
145
+ export default class Weather {
146
+ constructor(
147
+ private apiKey: string,
148
+ private units: string = 'metric'
149
+ ) {}
150
+
151
+ async forecast(params: { city: string }) {
152
+ const res = await fetch(
153
+ `https://api.openweathermap.org/data/2.5/weather?q=${params.city}&appid=${this.apiKey}&units=${this.units}`
154
+ );
155
+ return await res.json();
411
156
  }
412
- // ... rest of logic
413
- return this._getCurrentVolume(); // Always return current state
414
157
  }
415
158
  ```
416
159
 
417
- **Works everywhere:**
418
- - โœ… **MCP**: Claude Desktop, Cursor, etc.
419
- - โœ… **CLI**: `photon cli lg-remote volume +5`
420
- - โœ… **Future interfaces**: HTTP, WebSocket, etc.
160
+ **What happens:** Beam creates a settings panel. `apiKey` becomes a password field. It also maps to environment variables like `WEATHER_API_KEY`. It just works.
421
161
 
422
- ### Context-Aware Error Messages
162
+ <div align="center">
163
+ <img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/readme-step-3.png" alt="Step 3 โ€” Configuration panel in Beam" width="600">
164
+ </div>
423
165
 
424
- Photons can provide helpful, context-aware errors:
166
+ ### Step 4: Validation (Stop bad inputs)
425
167
 
426
- ```bash
427
- $ photon cli lg-remote channels
428
- โŒ Error: TV channels not available. Currently on HDMI1.
429
- Switch to a TV tuner input to access channels.
430
- ```
168
+ You can add tags to valid inputs.
431
169
 
432
- The same error quality appears in MCP toolsโ€”because it's the same code.
433
-
434
- ### Exit Codes
435
-
436
- The CLI properly returns exit codes for automation:
437
- - **0**: Success
438
- - **1**: Error (tool execution failed, invalid parameters, etc.)
439
-
440
- Perfect for shell scripts and CI/CD:
441
- ```bash
442
- if photon cli lg-remote volume 50; then
443
- echo "Volume set successfully"
444
- else
445
- echo "Failed to set volume"
446
- exit 1
447
- fi
448
- ```
449
-
450
- ---
451
-
452
- ## How Photon Works
453
-
454
- ### Convention = Automation
455
-
456
- **File Name โ†’ MCP Name**
457
170
  ```typescript
458
- // analytics.photon.ts โ†’ "analytics" MCP
459
- ```
171
+ /**
172
+ * Weather - Check weather forecasts worldwide
173
+ * @dependencies node-fetch@^3.0.0
174
+ */
175
+ export default class Weather {
176
+ constructor(
177
+ private apiKey: string,
178
+ private units: string = 'metric'
179
+ ) {}
460
180
 
461
- **Class Methods โ†’ Tools**
462
- ```typescript
463
- async revenue() {} // โ†’ "revenue" tool
464
- async topCustomers() {} // โ†’ "topCustomers" tool
181
+ /**
182
+ * Get the weather forecast for a city
183
+ * @param city City name {@example London} {@pattern ^[a-zA-Z\s]+$}
184
+ * @param days Number of days {@min 1} {@max 7}
185
+ * @format table
186
+ */
187
+ async forecast(params: { city: string; days?: number }) {
188
+ // fetch and return forecast data...
189
+ }
190
+ }
465
191
  ```
466
192
 
467
- **TypeScript Types โ†’ JSON Schemas**
468
- ```typescript
469
- async create(params: { title: string; priority: number }) {}
470
- // Photon auto-generates JSON schema from TypeScript types
471
- ```
193
+ **What happens:**
194
+ * The `city` input validates the regex.
195
+ * The `days` input becomes a number spinner (1-7).
196
+ * The result is formatted as a table.
197
+ * `@dependencies` makes Photon install `node-fetch` automatically. You don't even run `npm install`.
472
198
 
473
- **JSDoc โ†’ Tool Descriptions**
474
- ```typescript
475
- /**
476
- * Get revenue by date range
477
- * @param startDate Start date (YYYY-MM-DD)
478
- */
479
- // Photon extracts descriptions automatically
480
- ```
199
+ #### System CLI Dependencies
481
200
 
482
- **Constructor Parameters โ†’ Environment Variables**
483
- ```typescript
484
- constructor(private host: string, private database: string) {}
485
- // Maps to: ANALYTICS_HOST, ANALYTICS_DATABASE
486
- ```
201
+ If your photon wraps a command-line tool (e.g. `ffmpeg`, `git`, `docker`), declare it with `@cli`. Photon checks for the tool at load time and refuses to load if it's missing.
487
202
 
488
- **JSDoc @dependencies โ†’ Auto-Install**
489
203
  ```typescript
490
204
  /**
491
- * @dependencies pg@^8.11.0, lodash@^4.17.21
205
+ * Video processor
206
+ * @cli ffmpeg - https://ffmpeg.org/download.html
207
+ * @cli imagemagick - https://imagemagick.org/script/download.php
492
208
  */
493
- // Photon auto-installs on first run (like npx or uv)
209
+ export default class VideoProcessor {
210
+ async convert({ input, format }: { input: string; format: string }) {
211
+ // ffmpeg is guaranteed to exist if this method runs
212
+ }
213
+ }
494
214
  ```
495
215
 
496
- ---
497
-
498
- ## Available Photons
499
-
500
- Production-ready photons from **[portel-dev/photons](https://github.com/portel-dev/photons)**:
501
-
502
- | Category | Photons | Total Tools |
503
- |----------|---------|-------------|
504
- | **Databases** | PostgreSQL (7), MongoDB (13), Redis (18), SQLite (9) | 47 |
505
- | **Infrastructure** | AWS S3 (11), Docker (10), Filesystem (13) | 34 |
506
- | **Development** | Git (11), GitHub Issues (7) | 18 |
507
- | **Communication** | Email (8), Slack (7) | 15 |
508
- | **Productivity** | Google Calendar (9), Jira (10) | 19 |
509
- | **Utilities** | Fetch (2), Time (3), Memory (10) | 15 |
216
+ If `ffmpeg` is not installed, the photon won't load and the user sees:
510
217
 
511
- **Total: 16 photons, 148 focused tools**
512
-
513
- Browse and install:
514
- ```bash
515
- photon info # See all available photons
516
- photon add postgres # Install any photon
517
- photon search git # Search by keyword
518
218
  ```
519
-
520
- ---
521
-
522
- ## Create Your Own Photon
523
-
524
- ### 1. Initialize
525
-
526
- ```bash
527
- photon init analytics
219
+ VideoProcessor requires the following CLI tools to be installed:
220
+ - ffmpeg: Install from https://ffmpeg.org/download.html
528
221
  ```
529
222
 
530
- Creates `analytics.photon.ts` in `~/.photon/` (accessible from anywhere).
223
+ > See the full [Tag Reference](./DOCBLOCK-TAGS.md) for all available tags. There are 30+ covering validation, UI hints, scheduling, webhooks, and more.
531
224
 
532
- **Custom directory:**
533
- ```bash
534
- photon --working-dir ./my-photons init analytics
535
- ```
225
+ <div align="center">
226
+ <img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/readme-step-4.png" alt="Step 4 โ€” Validation and formatting in Beam" width="600">
227
+ </div>
536
228
 
537
- ### 2. Write Business Logic
229
+ ### Step 5: Custom UI (When you want to be fancy)
230
+
231
+ If the auto-generated form is too boring, you can write your own HTML.
538
232
 
539
233
  ```typescript
540
234
  /**
541
- * Analytics - Query company analytics database
542
- * @dependencies pg@^8.11.0
235
+ * Weather - Check weather forecasts worldwide
236
+ * @dependencies node-fetch@^3.0.0
237
+ * @ui dashboard ./ui/weather.html
543
238
  */
544
- import { Client } from 'pg';
545
-
546
- export default class Analytics {
547
- private db: Client;
548
-
549
- constructor(
550
- private host: string,
551
- private database: string,
552
- private password: string
553
- ) {}
554
-
555
- async onInitialize() {
556
- this.db = new Client({
557
- host: this.host,
558
- database: this.database,
559
- password: this.password
560
- });
561
- await this.db.connect();
562
- }
239
+ export default class Weather {
240
+ constructor(private apiKey: string, private units: string = 'metric') {}
563
241
 
564
242
  /**
565
- * Get revenue by date range
566
- * @param startDate Start date (YYYY-MM-DD)
567
- * @param endDate End date (YYYY-MM-DD)
243
+ * Get the weather forecast for a city
244
+ * @ui dashboard
245
+ * @format table
568
246
  */
569
- async revenue(params: { startDate: string; endDate: string }) {
570
- const result = await this.db.query(
571
- 'SELECT date, SUM(amount) FROM orders WHERE date BETWEEN $1 AND $2 GROUP BY date',
572
- [params.startDate, params.endDate]
573
- );
574
- return result.rows;
575
- }
576
-
577
- async onShutdown() {
578
- await this.db.end();
247
+ async forecast(params: { city: string; days?: number }) {
248
+ // returns structured weather data
579
249
  }
580
250
  }
581
251
  ```
582
252
 
583
- ### 3. Run
584
-
585
- ```bash
586
- # Development mode (hot reload)
587
- photon mcp analytics --dev
588
-
589
- # Production mode
590
- photon mcp analytics
253
+ ```html
254
+ <!-- ui/weather.html -->
255
+ <div id="weather-app">
256
+ <div id="forecast"></div>
257
+ </div>
258
+ <script>
259
+ window.photon.onResult(data => {
260
+ document.getElementById('forecast').innerHTML = renderWeather(data);
261
+ });
262
+ </script>
591
263
  ```
592
264
 
593
- **That's it!** Photon handles:
594
- - โœ… TypeScript compilation (via esbuild)
595
- - โœ… Schema generation from types
596
- - โœ… MCP protocol implementation
597
- - โœ… Environment variable mapping
598
- - โœ… Dependency installation (@dependencies)
599
- - โœ… Hot reload in dev mode
265
+ **What changes in Beam:** Instead of the auto-generated table, results render inside your custom HTML (a weather dashboard with icons, charts, or any visualization you build). The `window.photon` API bridges your UI to the tool system.
600
266
 
601
- **You focus on:** Your business logic
602
- **Photon handles:** Everything else
267
+ > Custom UIs follow the [MCP Apps Extension (SEP-1865)](https://github.com/nicolo-ribaudo/modelcontextprotocol/blob/nicolo/sep-1865/docs/specification/draft/extensions/apps.mdx) standard and work across compatible hosts. See the [Custom UI Guide](./CUSTOM-UI.md).
603
268
 
604
- ---
269
+ <div align="center">
270
+ <img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/readme-step-5.png" alt="Step 5 โ€” Custom UI result in Beam" width="600">
271
+ </div>
605
272
 
606
- ## Commands Reference
273
+ ### In Summary
607
274
 
608
- ### Global Options
609
-
610
- ```bash
611
- --working-dir <dir> # Use custom directory instead of ~/.photon
612
- -V, --version # Show version number
613
- -h, --help # Show help
614
- ```
615
-
616
- ### Development Commands
617
-
618
- #### `photon init <name>`
619
- Create a new `.photon.ts` file from template.
620
-
621
- ```bash
622
- # Create in default directory (~/.photon)
623
- photon init calculator
624
-
625
- # Create in custom directory
626
- photon --working-dir ./my-photons init calculator
627
- ```
275
+ | Step | You write | Photon generates |
276
+ |------|---------|-----------------|
277
+ | **1. Methods** | A function | Tools, CLI commands, Forms |
278
+ | **2. JSDoc** | Comments | Descriptions for AI and Humans |
279
+ | **3. Constructor** | Arguments | Config UI, Env vars |
280
+ | **4. Tags** | `@tags` | Validation, Installers, Formatting |
281
+ | **5. Custom UI** | HTML | A custom app |
628
282
 
629
- #### `photon validate <name>`
630
- Validate syntax and extract schemas without running.
631
-
632
- ```bash
633
- photon validate calculator
634
- ```
635
-
636
- Useful for:
637
- - Checking syntax errors
638
- - Testing schema generation
639
- - CI/CD validation
640
-
641
- ### Running Photons
642
-
643
- #### `photon mcp <name>`
644
- Run a photon as an MCP server.
645
-
646
- ```bash
647
- # Production mode
648
- photon mcp calculator
649
-
650
- # Development mode (hot reload on file changes)
651
- photon mcp calculator --dev
652
-
653
- # Validate configuration without running
654
- photon mcp calculator --validate
655
-
656
- # Show MCP configuration template
657
- photon mcp calculator --config
658
- ```
659
-
660
- **Options:**
661
- - `--dev` - Enable hot reload for development
662
- - `--validate` - Validate configuration without running server
663
- - `--config` - Show configuration template and exit
664
-
665
- #### `photon cli <photon-name> [method] [args...]`
666
- Run photon methods directly from the command line.
667
-
668
- ```bash
669
- # List all available methods
670
- photon cli calculator
671
-
672
- # Call a method with arguments
673
- photon cli calculator add 5 10
674
-
675
- # Get method-specific help
676
- photon cli calculator add --help
677
-
678
- # Output raw JSON instead of formatted output
679
- photon cli calculator add 5 10 --json
680
- ```
681
-
682
- **Arguments:**
683
- - Arguments are automatically coerced to expected types (string, number, boolean)
684
- - Strings starting with `+` or `-` are preserved for relative adjustments
685
- - Arrays and objects can be passed as JSON strings
686
-
687
- **Options:**
688
- - `--help` - Show help for the photon or specific method
689
- - `--json` - Output raw JSON instead of formatted output
690
-
691
- **Exit Codes:**
692
- - `0` - Success
693
- - `1` - Error (invalid arguments, execution failure, etc.)
694
-
695
- **Examples:**
696
-
697
- ```bash
698
- # Smart home control
699
- photon cli lg-remote volume 50
700
- photon cli lg-remote volume +5 # Relative adjustment
701
- photon cli lg-remote channel 7
702
- photon cli lg-remote app netflix
703
-
704
- # Database queries
705
- photon cli postgres query "SELECT * FROM users LIMIT 10"
706
-
707
- # File operations
708
- photon cli filesystem read-file path "/home/user/document.txt"
709
-
710
- # Git operations
711
- photon cli git commit message "feat: add new feature"
712
- ```
713
-
714
- ### Inspect & Configure
715
-
716
- #### `photon info [name]`
717
- List all photons or show details for a specific one.
718
-
719
- ```bash
720
- # List all installed photons
721
- photon info
722
-
723
- # Show details for one photon
724
- photon info calculator
725
-
726
- # Get MCP client configuration
727
- photon info calculator --mcp
728
- ```
729
-
730
- **Options:**
731
- - `--mcp` - Output MCP server configuration for your client
732
-
733
- ### Marketplace Commands
734
-
735
- #### `photon add <name>`
736
- Install a photon from a marketplace.
737
-
738
- ```bash
739
- # Install from any enabled marketplace
740
- photon add filesystem
741
-
742
- # Install from specific marketplace
743
- photon add filesystem --marketplace portel-dev/photons
744
- ```
745
-
746
- **Options:**
747
- - `--marketplace <name>` - Specify which marketplace to use
748
-
749
- #### `photon search <query>`
750
- Search for photons across all enabled marketplaces.
751
-
752
- ```bash
753
- photon search database
754
- photon search git
755
- ```
756
-
757
- #### `photon info <name>`
758
- Show detailed information about a photon from marketplaces.
759
-
760
- ```bash
761
- photon info postgres
762
- ```
763
-
764
- Shows:
765
- - Description
766
- - Available tools
767
- - Configuration requirements
768
- - Marketplace source
769
-
770
- #### `photon upgrade [name]`
771
- Upgrade photons from marketplaces.
772
-
773
- ```bash
774
- # Upgrade all photons
775
- photon upgrade
776
-
777
- # Upgrade specific photon
778
- photon upgrade filesystem
779
-
780
- # Check for updates without upgrading
781
- photon upgrade --check
782
- ```
783
-
784
- **Options:**
785
- - `--check` - Only check for updates, don't install
786
-
787
- #### `photon conflicts`
788
- Show photons available in multiple marketplaces.
789
-
790
- ```bash
791
- photon conflicts
792
- ```
793
-
794
- Useful when same photon name exists in different marketplaces.
795
-
796
- ### Marketplace Management
797
-
798
- #### `photon marketplace list`
799
- List all configured marketplaces.
800
-
801
- ```bash
802
- photon marketplace list
803
- ```
804
-
805
- #### `photon marketplace add <repo>`
806
- Add a new marketplace.
807
-
808
- ```bash
809
- # GitHub shorthand
810
- photon marketplace add username/repo
811
-
812
- # Full HTTPS URL
813
- photon marketplace add https://github.com/username/repo
814
-
815
- # SSH URL
816
- photon marketplace add git@github.com:username/repo.git
817
-
818
- # Direct URL
819
- photon marketplace add https://example.com/marketplace
820
-
821
- # Local path
822
- photon marketplace add ./my-local-marketplace
823
- ```
824
-
825
- #### `photon marketplace remove <name>`
826
- Remove a marketplace.
827
-
828
- ```bash
829
- photon marketplace remove my-marketplace
830
- ```
831
-
832
- #### `photon marketplace enable <name>`
833
- Enable a previously disabled marketplace.
834
-
835
- ```bash
836
- photon marketplace enable my-marketplace
837
- ```
838
-
839
- #### `photon marketplace disable <name>`
840
- Disable a marketplace without removing it.
841
-
842
- ```bash
843
- photon marketplace disable my-marketplace
844
- ```
845
-
846
- #### `photon marketplace update [name]`
847
- Update marketplace metadata from remote.
848
-
849
- ```bash
850
- # Update all marketplaces
851
- photon marketplace update
852
-
853
- # Update specific marketplace
854
- photon marketplace update portel-dev/photons
855
- ```
856
-
857
- ### Advanced Commands
858
-
859
- #### `photon sync marketplace [path]`
860
- Generate marketplace manifest and documentation.
861
-
862
- ```bash
863
- # Sync current directory
864
- photon sync marketplace
865
-
866
- # Sync specific directory
867
- photon sync marketplace ./my-marketplace
868
-
869
- # Generate Claude Code plugin files too
870
- photon sync marketplace --claude-code
871
- ```
872
-
873
- **Options:**
874
- - `--claude-code` - Also generate Claude Code plugin files (`.claude-plugin/`)
875
- - `--name <name>` - Override marketplace name
876
- - `--description <desc>` - Set marketplace description
877
- - `--owner <owner>` - Set owner name
878
-
879
- Used when creating your own marketplace. See [Marketplace System](#marketplace-system) and [Claude Code Plugins](#claude-code-plugins).
880
-
881
- #### `photon audit [name]`
882
- Security audit of photon dependencies.
883
-
884
- ```bash
885
- # Audit all photons
886
- photon audit
887
-
888
- # Audit specific photon
889
- photon audit postgres
890
- ```
891
-
892
- Checks for:
893
- - Vulnerable dependencies
894
- - Outdated packages
895
- - Security advisories
283
+ <div align="center">
284
+ <img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/photon-ecosystem.png" alt="Photon Ecosystem" width="600">
285
+ </div>
896
286
 
897
287
  ---
898
288
 
899
- ## Marketplace System
900
-
901
- ### For Users: Install from Marketplace
902
-
903
- ```bash
904
- # Install from official marketplace (portel-dev/photons)
905
- photon add github-issues
906
- photon add sqlite
907
- photon add memory
908
-
909
- # Search for photons
910
- photon search slack
911
- ```
912
-
913
- ### For Teams: Create Your Marketplace
914
-
915
- **Build an internal marketplace for your organization:**
916
-
917
- ```bash
918
- # 1. Organize your photons
919
- mkdir company-photons && cd company-photons
920
- cp ~/.photon/*.photon.ts .
921
-
922
- # 2. Generate marketplace manifest (and optionally Claude Code plugin)
923
- photon sync marketplace --claude-code
924
-
925
- # 3. Push to GitHub/Git
926
- git init
927
- git add .
928
- git commit -m "Initial marketplace"
929
- git push origin main
930
-
931
- # 4. Team members install (via CLI or Claude Code)
932
- photon marketplace add company/photons
933
- photon add internal-crm
934
- photon add analytics-db
935
- ```
936
-
937
- **Benefits:**
289
+ ## Beam
938
290
 
939
- - ๐Ÿ”’ **Secure**: Your code, your infrastructure, your control
940
- - ๐Ÿ“ฆ **Easy**: Single-file photons are trivial to maintain
941
- - ๐ŸŽฏ **Focused**: Build exact tools for your workflows
942
- - ๐Ÿ“Š **Traceable**: Git-based versioning and attribution
943
- - ๐Ÿ”Œ **Dual Distribution**: With `--claude-code`, also works as Claude Code plugin
291
+ Beam is the dashboard. Itโ€™s where you go to poke your tools and see if they work before you let an AI loose on them.
944
292
 
945
- > **Tip:** Use `--claude-code` flag to enable installation via both Photon CLI and Claude Code plugin manager. See [Claude Code Plugins](#claude-code-plugins) for details.
293
+ Run `photon`. Thatโ€™s it.
946
294
 
947
- ### Manage Marketplaces
948
-
949
- ```bash
950
- # List all marketplaces
951
- photon marketplace list
952
-
953
- # Add marketplace (multiple formats supported)
954
- photon marketplace add username/repo # GitHub shorthand
955
- photon marketplace add https://github.com/u/repo # HTTPS
956
- photon marketplace add git@github.com:u/repo.git # SSH
957
- photon marketplace add https://example.com/mkt # Direct URL
958
- photon marketplace add ./local-photons # Local path
959
-
960
- # Remove marketplace
961
- photon marketplace remove <name>
962
-
963
- # Search across all marketplaces
964
- photon search <keyword>
965
- ```
295
+ <div align="center">
296
+ <img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/beam-dashboard.png" alt="Beam Dashboard" width="700">
297
+ </div>
966
298
 
967
299
  ---
968
300
 
969
- ## Claude Code Plugins
970
-
971
- Photon marketplaces can be automatically published as **Claude Code plugins**, enabling users to install individual photons directly from Claude Code's plugin manager.
972
-
973
- ### Why Dual Distribution?
301
+ ## Connecting to AI
974
302
 
975
- One marketplace, two distribution channels:
976
-
977
- **Via Photon CLI:**
978
- ```bash
979
- photon add filesystem
980
- photon add git
981
- ```
303
+ If you want to use this with Claude or Cursor, you need the config.
982
304
 
983
- **Via Claude Code Plugin:**
984
305
  ```bash
985
- /plugin marketplace add your-org/your-marketplace
986
- /plugin install filesystem@your-marketplace
987
- /plugin install git@your-marketplace
306
+ photon info weather --mcp
988
307
  ```
989
308
 
990
- **Benefits:**
991
- - ๐ŸŽฏ **Granular Installation**: Claude Code users can install only the photons they need
992
- - ๐Ÿ”„ **Auto-Sync**: Plugin stays in sync with your marketplace
993
- - โšก **Zero Config**: Photon CLI auto-installs on first use
994
- - ๐Ÿ›ก๏ธ **Secure**: Credentials never shared with AI (interactive setup available)
995
- - ๐Ÿ“ฆ **Same Source**: One marketplace serves both CLI and plugin users
996
-
997
- ### Generate Plugin Files
998
-
999
- When creating your marketplace, add the `--claude-code` flag:
1000
-
1001
- ```bash
1002
- # In your marketplace directory
1003
- photon sync marketplace --claude-code
1004
- ```
1005
-
1006
- This generates:
1007
- - `.claude-plugin/marketplace.json` - Plugin manifest with individual photon entries
1008
- - `.claude-plugin/hooks.json` - SessionStart hook to auto-install Photon CLI
1009
- - `.claude-plugin/scripts/check-photon.sh` - Auto-installer script
1010
- - `.claude-plugin/scripts/setup-photon.sh` - Interactive credential setup tool
1011
-
1012
- ### What Gets Generated
1013
-
1014
- **Individual Plugins:** Each photon becomes a separate installable plugin in Claude Code:
309
+ It spits out some JSON:
1015
310
 
1016
311
  ```json
1017
312
  {
1018
- "name": "your-marketplace",
1019
- "plugins": [
1020
- {
1021
- "name": "filesystem",
1022
- "description": "Filesystem - File and directory operations",
1023
- "mcpServers": {
1024
- "filesystem": {
1025
- "command": "photon",
1026
- "args": ["mcp", "filesystem"]
1027
- }
1028
- }
313
+ "mcpServers": {
314
+ "weather": {
315
+ "command": "photon",
316
+ "args": ["mcp", "weather"]
1029
317
  }
1030
- // ... one entry per photon
1031
- ]
1032
- }
1033
- ```
1034
-
1035
- **Auto-Install Hook:** When users install your plugin, Claude Code automatically:
1036
- 1. Checks if `photon` CLI is installed
1037
- 2. Installs it globally via npm if missing
1038
- 3. Makes all photon tools available immediately
1039
-
1040
- ### Example: Official Photons Marketplace
1041
-
1042
- The [official photons marketplace](https://github.com/portel-dev/photons) uses this approach:
1043
-
1044
- ```bash
1045
- # In the photons repo
1046
- photon sync marketplace --claude-code
1047
- git commit -m "chore: update marketplace"
1048
- git push
1049
- ```
1050
-
1051
- Users can then install via Claude Code:
1052
- ```bash
1053
- /plugin marketplace add portel-dev/photons
1054
- /plugin install knowledge-graph@photons-marketplace
1055
- /plugin install git@photons-marketplace
1056
- ```
1057
-
1058
- ### Automated Git Hooks
1059
-
1060
- Add this to your `.git/hooks/pre-commit` to auto-sync:
1061
-
1062
- ```bash
1063
- #!/bin/bash
1064
- photon sync marketplace --claude-code
1065
- git add .marketplace/ .claude-plugin/ README.md *.md
1066
- ```
1067
-
1068
- Now your marketplace AND plugin files stay in sync automatically.
1069
-
1070
- ### Distribution Strategy
1071
-
1072
- **Recommended approach:**
1073
-
1074
- 1. **Commit both** `.marketplace/` and `.claude-plugin/` to your repo
1075
- 2. **Single command** keeps them in sync
1076
- 3. **Users choose** their preferred installation method
1077
- 4. **Same photons**, whether via CLI or Claude Code
1078
-
1079
- **Result:** Maximum reach with minimal maintenance.
1080
-
1081
- ---
1082
-
1083
- ## Advanced Features
1084
-
1085
- ### Lifecycle Hooks
1086
-
1087
- ```typescript
1088
- export default class MyPhoton {
1089
- async onInitialize() {
1090
- // Called when photon loads
1091
- console.error('Photon initialized');
1092
- }
1093
-
1094
- async onShutdown() {
1095
- // Called on shutdown
1096
- console.error('Photon shutting down');
1097
- }
1098
-
1099
- async myTool(params: { input: string }) {
1100
- return `Processed: ${params.input}`;
1101
318
  }
1102
319
  }
1103
320
  ```
1104
321
 
1105
- ### Templates (MCP Prompts)
1106
-
1107
- ```typescript
1108
- import { Template, asTemplate } from '@portel/photon';
1109
-
1110
- export default class MyPhoton {
1111
- /**
1112
- * Generate a code review prompt
1113
- * @Template
1114
- * @param language Programming language
1115
- * @param code Code to review
1116
- */
1117
- async codeReview(params: { language: string; code: string }): Promise<Template> {
1118
- const prompt = `Review this ${params.language} code:\n\`\`\`\n${params.code}\n\`\`\``;
1119
- return asTemplate(prompt);
1120
- }
1121
- }
1122
- ```
322
+ Copy that. Paste it into your AI clientโ€™s config file. Done.
1123
323
 
1124
- ### Static Resources (MCP Resources)
324
+ Works with [Claude Desktop](https://claude.ai/download), [Claude Code](https://docs.anthropic.com/en/docs/claude-code), [Cursor](https://cursor.com), and any [MCP-compatible client](https://modelcontextprotocol.io).
1125
325
 
1126
- ```typescript
1127
- import { Static, asStatic } from '@portel/photon';
326
+ ---
1128
327
 
1129
- export default class MyPhoton {
1130
- /**
1131
- * Get API documentation
1132
- * @Static api://docs
1133
- * @mimeType text/markdown
1134
- */
1135
- async apiDocs(params: {}): Promise<Static> {
1136
- const docs = `# API Documentation\n\n...`;
1137
- return asStatic(docs);
1138
- }
1139
- }
1140
- ```
328
+ ## Why did we build this?
1141
329
 
1142
- ### Private Methods
330
+ Writing an MCP server usually involves 4 to 6 files and about 150 lines of code before you even start writing the thing you actually wanted to write.
1143
331
 
1144
- Methods starting with `_` are private (not exposed as tools):
332
+ With Photon, itโ€™s one file.
1145
333
 
1146
- ```typescript
1147
- export default class MyPhoton {
1148
- // Public tool
1149
- async publicTool(params: {}) {
1150
- return this._helperMethod();
1151
- }
334
+ | | Traditional MCP | Photon |
335
+ |---|---|---|
336
+ | **Files** | 4-6 (server, transport, schemas, types, config) | 1 |
337
+ | **Boilerplate** | 150+ lines | 0 |
338
+ | **Dependencies** | Manual `npm install` | Automatic |
339
+ | **Schema** | Hand-written JSON Schema | Generated from TS types |
340
+ | **Config** | Manual env var parsing | Automatic from Constructor |
1152
341
 
1153
- // Private helper (NOT exposed)
1154
- async _helperMethod() {
1155
- return "Internal logic only";
1156
- }
1157
- }
1158
- ```
342
+ It is unnecessarily difficult to do it the old way. So we stopped doing it.
1159
343
 
1160
344
  ---
1161
345
 
1162
- ## Examples
346
+ ## Marketplace
1163
347
 
1164
- The repository includes example photons in `examples/`:
348
+ We also have a marketplace. 31 photons and counting.
1165
349
 
1166
- ### Content (Templates & Static Resources)
1167
- ```bash
1168
- npx photon --working-dir examples mcp content --dev
1169
- ```
1170
- Demonstrates Templates (MCP Prompts) and Static resources.
350
+ <div align="center">
351
+ <img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/beam-marketplace.png" alt="Marketplace" width="700">
352
+ </div>
1171
353
 
1172
- ### Calculator
1173
354
  ```bash
1174
- npx photon --working-dir examples mcp math --dev
355
+ photon search postgres
356
+ photon add postgres
1175
357
  ```
1176
- Basic arithmetic operations.
1177
358
 
1178
- ### String Utilities
1179
- ```bash
1180
- npx photon --working-dir examples mcp text --dev
1181
- ```
1182
- Text manipulation tools.
359
+ ### Available Photons
1183
360
 
1184
- ### Workflow
1185
- ```bash
1186
- npx photon --working-dir examples mcp workflow --dev
1187
- ```
1188
- Task management system.
361
+ **Productivity**
1189
362
 
1190
- ---
363
+ | Photon | What it does | Tools |
364
+ |--------|-------------|-------|
365
+ | ๐Ÿ“Œ **kanban** | Multi-tenant task boards for humans and AI | 33 |
366
+ | ๐Ÿ“ฌ **git-box** | Mailbox-style Git interface, manage repos like an inbox | 58 |
367
+ | ๐Ÿ“ฌ **form-inbox** | Webhook-powered form submission collector | 12 |
368
+ | ๐Ÿ“… **google-calendar** | Calendar integration via OAuth | 9 |
369
+ | ๐ŸŽซ **jira** | Project management and issue tracking | 10 |
370
+ | ๐Ÿ’ฌ **slack** | Send messages and manage Slack workspaces | 7 |
371
+ | ๐Ÿ“ง **email** | Send and receive via SMTP/IMAP | 8 |
1191
372
 
1192
- ## Architecture
373
+ **Infrastructure**
1193
374
 
1194
- ```
1195
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
1196
- โ”‚ .photon.ts file โ”‚ โ† Your single TypeScript file
1197
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
1198
- โ”‚
1199
- โ†“
1200
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
1201
- โ”‚ Auto-Install โ”‚ โ† Reads @dependencies, installs packages
1202
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
1203
- โ”‚
1204
- โ†“
1205
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
1206
- โ”‚ Loader โ”‚ โ† Compiles TypeScript with esbuild
1207
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ Loads class dynamically
1208
- โ”‚
1209
- โ†“
1210
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
1211
- โ”‚ Schema Extractor โ”‚ โ† Parses JSDoc + TypeScript types
1212
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ Generates JSON schemas
1213
- โ”‚
1214
- โ†“
1215
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
1216
- โ”‚ MCP Server โ”‚ โ† Implements MCP protocol
1217
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ Using @modelcontextprotocol/sdk
1218
- โ”‚
1219
- โ†“
1220
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€-โ”€โ”
1221
- โ”‚ stdio/JSON-RPCโ”‚ โ† Communicates with MCP clients
1222
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€-โ”€โ”˜ (Claude Desktop, Cursor, Zed, etc.)
1223
- ```
1224
-
1225
- ---
375
+ | Photon | What it does | Tools |
376
+ |--------|-------------|-------|
377
+ | ๐Ÿ“ **filesystem** | Safe, cross-platform file operations | 13 |
378
+ | ๐Ÿ”€ **git** | Local git repository operations | 11 |
379
+ | ๐Ÿ™ **github-issues** | Manage GitHub issues and comments | 7 |
380
+ | ๐Ÿณ **docker** | Container and image management | 10 |
381
+ | โ˜๏ธ **aws-s3** | S3 object storage operations | 11 |
382
+ | ๐ŸŒ **web** | DuckDuckGo search + Readability extraction | 2 |
1226
383
 
1227
- ## Philosophy
384
+ **Databases**
1228
385
 
1229
- > **"Singular focus. Precise target."**
386
+ | Photon | What it does | Tools |
387
+ |--------|-------------|-------|
388
+ | ๐Ÿ˜ **postgres** | PostgreSQL queries and schema ops | 7 |
389
+ | ๐Ÿ—„๏ธ **sqlite** | SQLite database operations | 9 |
390
+ | ๐Ÿƒ **mongodb** | MongoDB document CRUD and aggregation | 13 |
391
+ | โšก **redis** | Key-value store, lists, sets, pub/sub | 18 |
1230
392
 
1231
- A **photon** is the smallest unit of light, delivering **singular focus** to a **precise target**.
393
+ **Utilities and Demos**
1232
394
 
1233
- Each Photon module embodies this principle:
395
+ | Photon | What it does | Tools |
396
+ |--------|-------------|-------|
397
+ | ๐Ÿ• **time** | Timezone conversion and queries | 3 |
398
+ | ๐Ÿงฎ **math** | Expression evaluator (trig, stats, etc.) | 1 |
399
+ | ๐Ÿ“Š **code-diagram** | Generate Mermaid diagrams from code | 3 |
400
+ | ๐Ÿ”ด **connect-four** | Play against AI with distributed locks | 8 |
401
+ | ๐Ÿณ **kitchen-sink** | Every runtime feature in one file | 25 |
402
+ | ๐Ÿ“‹ **dashboard** | MCP Apps UI demo | 6 |
403
+ | ๐Ÿ“บ **team-dashboard** | TV/monitor-optimized team display | 20 |
404
+ | ๐ŸŽญ **mcp-orchestrator** | Combine multiple MCPs into workflows | 10 |
1234
405
 
1235
- - **Singular focus** - One responsibility, executed flawlessly
1236
- - **Precise target** - Clear purpose, clean API
1237
- - **Universal design** - Pure TypeScript, ready for future possibilities
406
+ You can also make a private marketplace for your team, so internal tools stay off the public internet.
1238
407
 
1239
408
  ---
1240
409
 
1241
- ## FAQ
1242
-
1243
- ### Do I need to extend a base class?
1244
-
1245
- No! Just export any class with async methods. Photon handles the rest.
1246
-
1247
- ### How are parameters validated?
1248
-
1249
- Photon extracts JSON schemas from your TypeScript types. MCP clients validate parameters before calling your tools.
1250
-
1251
- ### Can I use external packages?
1252
-
1253
- Yes! Dependencies are **auto-installed** from JSDoc `@dependencies` tags (like `npx` or `uv`).
1254
-
1255
- ### How does hot reload work?
1256
-
1257
- In `--dev` mode, Photon watches your `.photon.ts` file and recompiles on save.
1258
-
1259
- ### Where are compiled files cached?
1260
-
1261
- `~/.cache/photon-mcp/compiled/`
410
+ ## Commands
1262
411
 
1263
- ### Where are my photons stored?
412
+ A few commands you might use:
1264
413
 
1265
- **Default:** `~/.photon/`
1266
- **Custom:** Use `--working-dir` flag
414
+ ```bash
415
+ # Run
416
+ photon # Open Beam UI
417
+ photon mcp <name> # Run as MCP server
418
+ photon mcp <name> --dev # MCP server with hot reload
419
+ photon cli <name> [method] # Run as CLI tool
1267
420
 
1268
- ### Can I fork and customize photons?
421
+ # Create
422
+ photon maker new <name> # Scaffold a new photon
1269
423
 
1270
- Absolutely! That's the design. Copy any `.photon.ts` file, edit it, run it. No build config changes needed.
424
+ # Manage
425
+ photon info # List all photons
426
+ photon info <name> --mcp # Get MCP client config (paste into Claude/Cursor)
427
+ photon validate <name> # Check for errors
1271
428
 
1272
- ### How do I update photons?
429
+ # Marketplace
430
+ photon add <name> # Install photon
431
+ photon search <query> # Search marketplace
432
+ photon upgrade # Upgrade all
1273
433
 
1274
- ```bash
1275
- photon upgrade # Update all
1276
- photon upgrade <name> # Update specific photon
434
+ # Ops
435
+ photon doctor # Diagnose environment
436
+ photon audit # Security audit
437
+ photon test # Run tests
1277
438
  ```
1278
439
 
1279
440
  ---
1280
441
 
1281
- ## Roadmap
1282
-
1283
- ### โœ… MCP Servers & CLI Interface (Available Now)
1284
-
1285
- **MCP Servers:**
1286
- Build and run photons as MCP servers for AI assistants. Works with Claude Desktop, Cursor, Zed, Continue, Cline, and any MCP-compatible client.
1287
-
1288
- **CLI Interface:**
1289
- Run photon methods directly from the command line with beautiful formatted output. Every photon automatically becomes a CLI tool with zero additional code.
1290
-
1291
- **Write once, deploy everywhere:** The same business logic powers both your MCP tools and CLI commands.
1292
-
1293
- ### ๐Ÿ”Œ Ecosystem Integrations
1294
-
1295
- Photon files are first-class citizens across multiple platforms:
1296
-
1297
- #### NCP - Intelligent MCP Orchestration
1298
-
1299
- [NCP](https://github.com/portel-dev/ncp) runs as an MCP client hosting many MCPs intelligently, while acting as an MCP server for any client. Photon files integrate seamlessly as context providers.
1300
-
1301
- ```bash
1302
- # Photons work natively with NCP
1303
- ncp add analytics.photon.ts
1304
- ```
1305
-
1306
- NCP enables sophisticated MCP orchestration patterns, and `.photon.ts` files are designed to work seamlessly in this environment.
442
+ ## Tag Reference (Quick Overview)
1307
443
 
1308
- #### Lumina - Anything API Server *(Coming Soon)*
444
+ Tags are JSDoc annotations that control how Photon processes your code. Here are the most commonly used ones:
1309
445
 
1310
- Turn any photon into a production API endpoint with zero configuration.
446
+ | Tag | Where | What it does |
447
+ |-----|-------|-------------|
448
+ | `@dependencies` | Class | Auto-install npm packages on first run |
449
+ | `@cli` | Class | Declare system CLI tool dependencies, checked at load time |
450
+ | `@format` | Method | Control result rendering (table, list, markdown, code, etc.) |
451
+ | `@param ... {@choice a,b,c}` | Param | Dropdown selection in Beam |
452
+ | `@param ... {@format email}` | Param | Input validation and field type |
453
+ | `@param ... {@min N} {@max N}` | Param | Numeric range constraints |
454
+ | `@ui` | Class/Method | Link a custom HTML template |
455
+ | `@webhook` | Method | Expose as HTTP endpoint |
456
+ | `@scheduled` | Method | Run on a cron schedule |
457
+ | `@locked` | Method | Distributed lock across processes |
458
+ | `@autorun` | Method | Auto-execute when selected in Beam |
459
+ | `@mcp` | Class | Inject another MCP server as a dependency |
460
+ | `@icon` | Class/Method | Set emoji icon |
1311
461
 
1312
- ```bash
1313
- # Same photon, now an HTTP API
1314
- lumina serve analytics.photon.ts
1315
- # โ†’ POST /revenue with JSON params
1316
- # โ†’ GET /status
1317
- # โ†’ Full REST API from your photon methods
1318
- ```
462
+ > This is a subset. See the full [Tag Reference](./DOCBLOCK-TAGS.md) for all 30+ tags with examples.
1319
463
 
1320
- Lumina will make photons available as HTTP/WebSocket endpoints, enabling web apps, mobile clients, and traditional API consumers to use the same business logic.
464
+ ---
1321
465
 
1322
- #### Future Platforms
466
+ ## Documentation
1323
467
 
1324
- The `.photon.ts` format is designed to be consumed by any runtime:
1325
- - WebSocket servers
1326
- - Serverless functions (AWS Lambda, Cloudflare Workers)
1327
- - Native desktop applications
1328
- - Browser extensions
1329
- - GraphQL servers
468
+ **Start here:**
1330
469
 
1331
- **One file. Many platforms. Pure business logic.**
470
+ | Guide | |
471
+ |-------|-|
472
+ | [Getting Started](./GUIDE.md) | Create your first photon, step by step |
473
+ | [Tag Reference](./DOCBLOCK-TAGS.md) | Complete JSDoc tag reference with examples |
474
+ | [Naming Conventions](./NAMING-CONVENTIONS.md) | How to name methods so they read naturally as CLI commands |
475
+ | [Troubleshooting](./TROUBLESHOOTING.md) | Common issues and solutions |
1332
476
 
1333
- ---
477
+ **Build more:**
1334
478
 
1335
- Photon's framework-agnostic design enables future deployment targets. More on the way.
479
+ | Topic | |
480
+ |-------|-|
481
+ | [Custom UI](./CUSTOM-UI.md) | Build rich interactive interfaces with `window.photon` |
482
+ | [OAuth](./AUTH.md) | Built-in OAuth 2.1 with Google, GitHub, Microsoft |
483
+ | [Daemon Pub/Sub](./DAEMON-PUBSUB.md) | Real-time cross-process messaging |
484
+ | [Webhooks](./WEBHOOKS.md) | HTTP endpoints for external services |
485
+ | [Locks](./LOCKS.md) | Distributed locks for exclusive access |
486
+ | [Advanced Patterns](./ADVANCED.md) | Lifecycle hooks, dependency injection, interactive workflows |
487
+ | [Deployment](./DEPLOYMENT.md) | Docker, Cloudflare Workers, AWS Lambda, Systemd |
1336
488
 
1337
- ---
489
+ **Operate:**
1338
490
 
1339
- ## Documentation
491
+ | Topic | |
492
+ |-------|-|
493
+ | [Security](./SECURITY.md) | Best practices and audit checklist |
494
+ | [Marketplace Publishing](./MARKETPLACE-PUBLISHING.md) | Create and share team marketplaces |
495
+ | [Best Practices](./PHOTON_BEST_PRACTICES.md) | Patterns for production photons |
496
+ | [Comparison](./COMPARISON.md) | Benchmarks vs official MCP implementations |
1340
497
 
1341
- - **[GUIDE.md](GUIDE.md)** - Complete tutorial for creating photons
1342
- - **[ADVANCED.md](ADVANCED.md)** - Lifecycle hooks, performance, production deployment
1343
- - **[COMPARISON.md](COMPARISON.md)** - Detailed comparison vs traditional MCP
1344
- - **[TROUBLESHOOTING.md](TROUBLESHOOTING.md)** - Common issues and solutions
1345
- - **[CHANGELOG.md](CHANGELOG.md)** - Version history
498
+ **Reference:** [Architecture](./ARCHITECTURE.md) ยท [Changelog](./CHANGELOG.md) ยท [Contributing](./CONTRIBUTING.md)
1346
499
 
1347
500
  ---
1348
501
 
1349
502
  ## Contributing
1350
503
 
1351
- Contributions welcome! Please open issues and PRs at [github.com/portel-dev/photon-mcp](https://github.com/portel-dev/photon-mcp).
1352
-
1353
- ---
504
+ If you find a bug, or if my code offends you, feel free to open an issue or a PR. See [CONTRIBUTING.md](./CONTRIBUTING.md).
1354
505
 
1355
- ## Related Projects
506
+ ## License
1356
507
 
1357
- - **[photons](https://github.com/portel-dev/photons)** - Official marketplace with 16+ production-ready photons
1358
- - **@modelcontextprotocol/sdk** - Official MCP TypeScript SDK
508
+ [MIT](./LICENSE). Do what you want with it.
1359
509
 
1360
510
  ---
1361
511
 
1362
- ## License
512
+ <div align="center">
1363
513
 
1364
- MIT ยฉ Portel
514
+ *Singular focus. Precise target.*
1365
515
 
1366
- ---
516
+ Made by [Portel](https://github.com/portel-dev)
1367
517
 
1368
- **Built with singular focus. Deployed with precise targeting.**
518
+ </div>
1369
519
 
1370
- Made with โš›๏ธ by [Portel](https://github.com/portel-dev)