@fragno-dev/github-app-fragment 0.0.1

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 (104) hide show
  1. package/LICENSE.md +16 -0
  2. package/README.md +163 -0
  3. package/bin/run.js +5 -0
  4. package/dist/browser/client/react.d.ts +37 -0
  5. package/dist/browser/client/react.d.ts.map +1 -0
  6. package/dist/browser/client/react.js +166 -0
  7. package/dist/browser/client/react.js.map +1 -0
  8. package/dist/browser/client/solid.d.ts +35 -0
  9. package/dist/browser/client/solid.d.ts.map +1 -0
  10. package/dist/browser/client/solid.js +136 -0
  11. package/dist/browser/client/solid.js.map +1 -0
  12. package/dist/browser/client/svelte.d.ts +30 -0
  13. package/dist/browser/client/svelte.d.ts.map +1 -0
  14. package/dist/browser/client/svelte.js +134 -0
  15. package/dist/browser/client/svelte.js.map +1 -0
  16. package/dist/browser/client/vanilla.d.ts +16 -0
  17. package/dist/browser/client/vanilla.d.ts.map +1 -0
  18. package/dist/browser/client/vanilla.js +11 -0
  19. package/dist/browser/client/vanilla.js.map +1 -0
  20. package/dist/browser/client/vue.d.ts +33 -0
  21. package/dist/browser/client/vue.d.ts.map +1 -0
  22. package/dist/browser/client/vue.js +133 -0
  23. package/dist/browser/client/vue.js.map +1 -0
  24. package/dist/browser/factory-BIj4C6PD.js +2210 -0
  25. package/dist/browser/factory-BIj4C6PD.js.map +1 -0
  26. package/dist/browser/index.d.ts +343 -0
  27. package/dist/browser/index.d.ts.map +1 -0
  28. package/dist/browser/index.js +3 -0
  29. package/dist/browser/types-BzeSSOQU.d.ts +660 -0
  30. package/dist/browser/types-BzeSSOQU.d.ts.map +1 -0
  31. package/dist/cli/commands/installations.js +92 -0
  32. package/dist/cli/commands/installations.js.map +1 -0
  33. package/dist/cli/commands/pulls.js +123 -0
  34. package/dist/cli/commands/pulls.js.map +1 -0
  35. package/dist/cli/commands/repositories.js +105 -0
  36. package/dist/cli/commands/repositories.js.map +1 -0
  37. package/dist/cli/commands/serve.js +187 -0
  38. package/dist/cli/commands/serve.js.map +1 -0
  39. package/dist/cli/commands/webhooks.js +122 -0
  40. package/dist/cli/commands/webhooks.js.map +1 -0
  41. package/dist/cli/github/api.js +94 -0
  42. package/dist/cli/github/api.js.map +1 -0
  43. package/dist/cli/github/definition.js +15 -0
  44. package/dist/cli/github/definition.js.map +1 -0
  45. package/dist/cli/github/factory.js +12 -0
  46. package/dist/cli/github/factory.js.map +1 -0
  47. package/dist/cli/github/repo-sync.js +33 -0
  48. package/dist/cli/github/repo-sync.js.map +1 -0
  49. package/dist/cli/github/utils.js +23 -0
  50. package/dist/cli/github/utils.js.map +1 -0
  51. package/dist/cli/github/webhook-processing.js +247 -0
  52. package/dist/cli/github/webhook-processing.js.map +1 -0
  53. package/dist/cli/index.d.ts +5 -0
  54. package/dist/cli/index.d.ts.map +1 -0
  55. package/dist/cli/index.js +263 -0
  56. package/dist/cli/index.js.map +1 -0
  57. package/dist/cli/routes.js +718 -0
  58. package/dist/cli/routes.js.map +1 -0
  59. package/dist/cli/schema.js +47 -0
  60. package/dist/cli/schema.js.map +1 -0
  61. package/dist/cli/utils/client.js +120 -0
  62. package/dist/cli/utils/client.js.map +1 -0
  63. package/dist/cli/utils/config.js +113 -0
  64. package/dist/cli/utils/config.js.map +1 -0
  65. package/dist/cli/utils/options.js +90 -0
  66. package/dist/cli/utils/options.js.map +1 -0
  67. package/dist/cli/utils/output.js +12 -0
  68. package/dist/cli/utils/output.js.map +1 -0
  69. package/dist/node/github/api.d.ts +52 -0
  70. package/dist/node/github/api.d.ts.map +1 -0
  71. package/dist/node/github/api.js +94 -0
  72. package/dist/node/github/api.js.map +1 -0
  73. package/dist/node/github/clients.d.ts +19 -0
  74. package/dist/node/github/clients.d.ts.map +1 -0
  75. package/dist/node/github/clients.js +12 -0
  76. package/dist/node/github/clients.js.map +1 -0
  77. package/dist/node/github/definition.d.ts +33 -0
  78. package/dist/node/github/definition.d.ts.map +1 -0
  79. package/dist/node/github/definition.js +15 -0
  80. package/dist/node/github/definition.js.map +1 -0
  81. package/dist/node/github/factory.d.ts +139 -0
  82. package/dist/node/github/factory.d.ts.map +1 -0
  83. package/dist/node/github/factory.js +18 -0
  84. package/dist/node/github/factory.js.map +1 -0
  85. package/dist/node/github/repo-sync.js +33 -0
  86. package/dist/node/github/repo-sync.js.map +1 -0
  87. package/dist/node/github/types.d.ts +24 -0
  88. package/dist/node/github/types.d.ts.map +1 -0
  89. package/dist/node/github/utils.js +23 -0
  90. package/dist/node/github/utils.js.map +1 -0
  91. package/dist/node/github/webhook-processing.d.ts +15 -0
  92. package/dist/node/github/webhook-processing.d.ts.map +1 -0
  93. package/dist/node/github/webhook-processing.js +247 -0
  94. package/dist/node/github/webhook-processing.js.map +1 -0
  95. package/dist/node/index.d.ts +7 -0
  96. package/dist/node/index.js +6 -0
  97. package/dist/node/routes.d.ts +127 -0
  98. package/dist/node/routes.d.ts.map +1 -0
  99. package/dist/node/routes.js +718 -0
  100. package/dist/node/routes.js.map +1 -0
  101. package/dist/node/schema.js +47 -0
  102. package/dist/node/schema.js.map +1 -0
  103. package/dist/tsconfig.tsbuildinfo +1 -0
  104. package/package.json +114 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-BzeSSOQU.d.ts","names":["SplitPath","T","Rest","First","ExtractParam","Name","ExtractParamsFromSegments","ExtractPathParams","ValueType","Record","ExtractPathParamsOrWiden","MaybeExtractPathParamsOrWiden","HasPathParams","ExtractPathParamNames","QueryParamsHint","TQueryParameters","Partial","RequestBodyType","MutableRequestState","Record","URLSearchParams","Headers","private","constructor","pathParams","searchParams","body","headers","config","setBody","hasBodyOverride","ExtractPathParams","MutableRequestState","HTTPMethod","StandardSchemaV1","RequestBodyType","FormData","Blob","Uint8Array","ReadableStream","RequestInputContext","TPath","TInputSchema","URLSearchParams","Headers","Request","Promise","Exclude","InferOutput","private","constructor","path","method","pathParams","searchParams","parsedBody","rawBody","headers","request","inputSchema","shouldValidateInput","config","fromRequest","state","fromSSRContext","body","query","formData","isFormData","bodyStream","isBodyStream","input","schema","valid","InfoStatusCode","SuccessStatusCode","DeprecatedStatusCode","RedirectStatusCode","ClientErrorStatusCode","ServerErrorStatusCode","StatusCode","ContentlessStatusCode","StandardSchemaV1","InferOr","T","U","NonNullable","InferOutput","InferOrUnknown","Error","Message","__errorMessage","ResponseStream","TArray","ReadableStream","WritableStream","Uint8Array","Promise","private","aborted","closed","responseReadable","constructor","writable","readable","writeRaw","input","write","U","sleep","ms","close","onAbort","listener","abort","ContentlessStatusCode","StatusCode","InferOrUnknown","ResponseStream","StandardSchemaV1","ResponseInit","T","HeadersInit","headers","status","statusText","OutputContext","TOutput","TErrorCode","message","code","Response","Promise","onError","Error","error","initOrStatus","empty","json","object","jsonStream","stream","cb","RequestOutputContext","TOutputSchema","private","constructor","outputSchema","HTTPMethod","StandardSchemaV1","FragnoPublicConfig","mountRoute","FetcherConfig","RequestInit","fetch","type","options","fetcher","FragnoPublicClientConfig","baseUrl","fetcherConfig","FragnoFragmentSharedConfig","TRoutes","method","path","inputSchema","outputSchema","errorCodes","queryParameters","pathParameters","name","routes","RequestInputContext","RequestOutputContext","FragnoApiError","FragnoApiValidationError","RouteCallerConfig","createRouteCaller","RouteHandlerInputOptions","FragnoPublicConfig","StandardSchemaV1","StandardSchemaV1$1","HTTPMethod","NonGetHTTPMethod","Exclude","PathError","T","TMessage","ValidPath","Rest","RequestThisContext","RouteContentType","FragnoRouteConfig","TMethod","TPath","TInputSchema","TOutputSchema","TErrorCode","TQueryParameters","TThisContext","Response","Promise","method","path","contentType","inputSchema","outputSchema","errorCodes","queryParameters","handler","this","inputCtx","outputCtx","addRoute","route","StatusCode","FragnoErrorOptions","Error","cause","FragnoClientError","TCode","private","constructor","message","code","options","FragnoClientFetchError","fromUnknownFetchError","error","FragnoClientFetchNetworkError","FragnoClientFetchAbortError","FragnoClientUnknownApiError","status","FragnoClientApiError","TErrorCode","Response","Promise","fromResponse","response","AllKeys","T","Primitive","ReadonlyIfObject","Value","Readonly","args","ReadableAtom","get","lc","listen","value","oldValue","listener","notify","off","subscribe","WritableAtom","set","newValue","PreinitializedWritableAtom","Atom","notifyId","atom","StoreExt","readonlyType","store","AllKeys","ReadableAtom","ReadonlyIfObject","WritableAtom","KeyofBase","Get","T","K","Extract","K1","HasIndexSignature","ValueWithUndefinedForIndexSignatures","Value","Key","WritableStore","MapStore","Store","AnyStore","get","value","StoreValue","SomeStore","BaseMapStore","setKey","key","MapStoreKeys","args","listen","oldValue","changedKey","listener","notify","set","newValue","subscribe","PreinitializedMapStore","map","StoreExt","PlatformCompat","MapStore","ReadableAtom","NoKey","SomeKey","KeyInput","FetcherStore","Array","Key","KeyParts","KeySelector","key","Fetcher","T","Promise","args","OnErrorRetry","error","retryCount","opts","EventTypes","onError","RefetchSettings","dedupeTime","revalidateOnFocus","revalidateOnReconnect","revalidateInterval","cacheLifetime","onErrorRetry","CommonSettings","fetcher","NanoqueryArgs","Map","cache","data","created","expires","FetcherValue","E","Error","loading","promise","LazyFetchValue","Symbol","_","invalidate","revalidate","mutate","fetch","FetcherStoreCreator","keys","settings","ManualMutator","Data","Result","getCacheUpdater","shouldRevalidate","newValue","MutateCb","MutatorStore","defaultOnErrorRetry","nanoqueryFactory","E_1","globalFetcher","isAppVisible","visibilityChangeSubscribe","reconnectChangeSubscribe","globalSettings","keyInput","fetcherSettings","mutator","throttleCalls","__unsafeOverruleSettings","invalidateKeys","keySelector","revalidateKeys","mutateCache","MaybeExtractPathParamsOrWiden","InferOr","FetcherConfig","FragnoFragmentSharedConfig","FragnoFragmentSharedConfig$1","FragnoPublicClientConfig","FragnoPublicConfig","FragnoRouteConfig","HTTPMethod","NonGetHTTPMethod","RequestThisContext","AnyRouteOrFactory","FlattenRouteFactories","FragmentDefinition","FragnoClientApiError","FragnoClientError","FragnoClientFetchAbortError","FragnoClientFetchError","FragnoClientFetchNetworkError","FragnoClientUnknownApiError","FragnoErrorOptions","ReadableAtom","Store","FetcherStore","MutatorStore","StandardSchemaV1","GET_HOOK_SYMBOL","MUTATOR_HOOK_SYMBOL","STORE_SYMBOL","ExtractGetRoutes","T","K","Method","Path","Input","Output","ErrorCode","QueryParams","ExtractRoutePath","TExpectedMethod","ExtractGetRoutePaths","ExtractNonGetRoutePaths","ExtractRouteByPath","TRoutes","TPath","TMethod","M","ExtractOutputSchemaForPath","IsValidGetRoutePath","ValidateGetRoutePath","HasGetRoutes","ObjectContainingStoreField","P","Omit","Partial","FragnoStoreObjectData","obj","FragnoStoreFactoryData","TArgs","factory","args","FragnoStoreData","FragnoClientHookData","TOutputSchema","TErrorCode","TQueryParameters","Record","InferOutput","Promise","route","query","path","store","_outputSchema","FragnoClientMutatorData","TInputSchema","mutateQuery","body","mutatorStore","_inputSchema","buildUrl","baseUrl","mountRoute","config","pathParams","queryParams","params","getCacheKey","method","isGetHook","hook","isMutatorHook","isStore","TStore","OnErrorRetryFn","error","key","retryCount","opts","CreateHookOptions","onErrorRetry","OnInvalidateFn","TInnerPath","invalidate","CacheLine","data","created","expires","ClientBuilder","TFragmentConfig","Readonly","fetch","RequestInit","NonNullable","private","constructor","publicConfig","fragmentConfig","cacheEntries","createStore","getFetcher","fetcher","defaultOptions","createHook","options","createMutator","onInvalidate","createClientBuilder","TConfig","TOptions","TDeps","TBaseServices","TServices","TServiceDependencies","TPrivateServices","TServiceThisContext","THandlerThisContext","TRequestStorage","TRoutesOrFactories","TInternalRoutes","definition","routesOrFactories","authorFetcherConfig"],"sources":["../../../fragno/dist/api/internal/path.d.ts","../../../fragno/dist/api/mutable-request-state.d.ts","../../../fragno/dist/api/request-input-context.d.ts","../../../fragno/dist/http/http-status.d.ts","../../../fragno/dist/util/types-util.d.ts","../../../fragno/dist/api/internal/response-stream.d.ts","../../../fragno/dist/api/request-output-context.d.ts","../../../fragno/dist/api/shared-types.d.ts","../../../fragno/dist/api/api.d.ts","../../../fragno/dist/client/client-error.d.ts","../../../../node_modules/.pnpm/nanostores@1.1.0/node_modules/nanostores/atom/index.d.ts","../../../../node_modules/.pnpm/nanostores@1.1.0/node_modules/nanostores/map/index.d.ts","../../../../node_modules/.pnpm/@nanostores+query@0.3.4_nanostores@1.1.0/node_modules/@nanostores/query/dist/factory.d.ts","../../../fragno/dist/client/client.d.ts","../../src/github/types.ts"],"x_google_ignoreList":[10,11,12],"mappings":";;;;;KACKA,SAAAA,qBAA8BC,CAAAA,0CAA2CE,KAAAA,cAAmBH,SAAAA,CAAUE,IAAAA,KAASC,KAAAA,KAAUH,SAAAA,CAAUE,IAAAA,KAASD,CAAAA,oBAAqBA,CAAAA;AAAAA,KACjKG,YAAAA,qBAAiCH,CAAAA,4BAA6BI,IAAAA,GAAOJ,CAAAA,8BAA+BI,IAAAA,GAAOJ,CAAAA;AAAAA,KAC3GK,yBAAAA,gCAAyDL,CAAAA,iDAAkDE,KAAAA,kBAAuBD,IAAAA,6BAAiCE,YAAAA,CAAaD,KAAAA,IAASG,yBAAAA,CAA0BJ,IAAAA,IAAQE,YAAAA,CAAaD,KAAAA;;;;;;;;;;;KAWxOI,iBAAAA,yCAA0DD,yBAAAA,CAA0BN,SAAAA,CAAUC,CAAAA,mBAAoBQ,MAAAA,kBAAwBA,MAAAA,CAAOH,yBAAAA,CAA0BN,SAAAA,CAAUC,CAAAA,IAAKO,SAAAA;;;;;KAK1LE,wBAAAA,wDAAgFT,CAAAA,GAAIQ,MAAAA,SAAeD,SAAAA,IAAaD,iBAAAA,CAAkBN,CAAAA,EAAGO,SAAAA;;;;;KAKrIG,6BAAAA,yCAAsEC,aAAAA,CAAcX,CAAAA,iBAAkBS,wBAAAA,CAAyBT,CAAAA,EAAGO,SAAAA;AAAAA,KAClIK,qBAAAA,qBAA0CP,yBAAAA,CAA0BN,SAAAA,CAAUC,CAAAA;AAAAA,KAC9EW,aAAAA,qBAAkCC,qBAAAA,CAAsBZ,CAAAA;;;;;AAzB0G;;;;;;;;;;;;;;;KA6ClKa,eAAAA,wDAAuEE,OAAAA,CAAQP,MAAAA,CAAOM,gBAAA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BAAA;EACA,OAAA,GAAU,sBAAA;AAAA;AAAA,KAGA,mCAAA,GAAsC,wBAAA"}
@@ -0,0 +1,92 @@
1
+ import { baseArgs, createClientFromContext } from "../utils/options.js";
2
+ import { printResult } from "../utils/output.js";
3
+ import { define } from "gunshi";
4
+
5
+ //#region src/cli/commands/installations.ts
6
+ const installationsCommand = define({
7
+ name: "installations",
8
+ description: "Installation commands"
9
+ });
10
+ const installationsListCommand = define({
11
+ name: "list",
12
+ description: "List installations",
13
+ args: {
14
+ ...baseArgs,
15
+ status: {
16
+ type: "string",
17
+ description: "Filter by status (active, suspended, deleted)"
18
+ }
19
+ },
20
+ run: async (ctx) => {
21
+ const client = createClientFromContext(ctx);
22
+ const status = ctx.values["status"];
23
+ printResult(await client.requestJson({
24
+ method: "GET",
25
+ path: "/installations",
26
+ query: status ? { status } : void 0
27
+ }));
28
+ }
29
+ });
30
+ const installationsReposCommand = define({
31
+ name: "repos",
32
+ description: "List repositories for an installation",
33
+ args: {
34
+ ...baseArgs,
35
+ "installation-id": {
36
+ type: "string",
37
+ short: "i",
38
+ description: "Installation ID"
39
+ },
40
+ "linked-only": {
41
+ type: "boolean",
42
+ description: "Only include linked repositories"
43
+ },
44
+ "link-key": {
45
+ type: "string",
46
+ description: "Filter by link key"
47
+ }
48
+ },
49
+ run: async (ctx) => {
50
+ const installationId = ctx.values["installation-id"];
51
+ if (!installationId) throw new Error("Missing --installation-id");
52
+ const client = createClientFromContext(ctx);
53
+ const linkedOnly = ctx.values["linked-only"];
54
+ const linkKey = ctx.values["link-key"];
55
+ const query = {};
56
+ if (linkedOnly) query["linkedOnly"] = "true";
57
+ if (linkKey) query["linkKey"] = linkKey;
58
+ printResult(await client.requestJson({
59
+ method: "GET",
60
+ path: `/installations/${encodeURIComponent(installationId)}/repos`,
61
+ query: Object.keys(query).length > 0 ? query : void 0
62
+ }));
63
+ }
64
+ });
65
+ const installationsSyncCommand = define({
66
+ name: "sync",
67
+ description: "Sync repositories for an installation from GitHub",
68
+ args: {
69
+ ...baseArgs,
70
+ "installation-id": {
71
+ type: "string",
72
+ short: "i",
73
+ description: "Installation ID"
74
+ }
75
+ },
76
+ run: async (ctx) => {
77
+ const installationId = ctx.values["installation-id"];
78
+ if (!installationId) throw new Error("Missing --installation-id");
79
+ printResult(await createClientFromContext(ctx).requestJson({
80
+ method: "POST",
81
+ path: `/installations/${encodeURIComponent(installationId)}/sync`
82
+ }));
83
+ }
84
+ });
85
+ const installationsSubCommands = /* @__PURE__ */ new Map();
86
+ installationsSubCommands.set("list", installationsListCommand);
87
+ installationsSubCommands.set("repos", installationsReposCommand);
88
+ installationsSubCommands.set("sync", installationsSyncCommand);
89
+
90
+ //#endregion
91
+ export { installationsCommand, installationsSubCommands };
92
+ //# sourceMappingURL=installations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installations.js","names":[],"sources":["../../../src/cli/commands/installations.ts"],"sourcesContent":["import { define } from \"gunshi\";\n\nimport { baseArgs, createClientFromContext } from \"../utils/options.js\";\nimport { printResult } from \"../utils/output.js\";\n\nexport const installationsCommand = define({\n name: \"installations\",\n description: \"Installation commands\",\n});\n\nexport const installationsListCommand = define({\n name: \"list\",\n description: \"List installations\",\n args: {\n ...baseArgs,\n status: {\n type: \"string\",\n description: \"Filter by status (active, suspended, deleted)\",\n },\n },\n run: async (ctx) => {\n const client = createClientFromContext(ctx);\n const status = ctx.values[\"status\"] as string | undefined;\n\n const response = await client.requestJson({\n method: \"GET\",\n path: \"/installations\",\n query: status ? { status } : undefined,\n });\n\n printResult(response);\n },\n});\n\nexport const installationsReposCommand = define({\n name: \"repos\",\n description: \"List repositories for an installation\",\n args: {\n ...baseArgs,\n \"installation-id\": {\n type: \"string\",\n short: \"i\",\n description: \"Installation ID\",\n },\n \"linked-only\": {\n type: \"boolean\",\n description: \"Only include linked repositories\",\n },\n \"link-key\": {\n type: \"string\",\n description: \"Filter by link key\",\n },\n },\n run: async (ctx) => {\n const installationId = ctx.values[\"installation-id\"] as string | undefined;\n if (!installationId) {\n throw new Error(\"Missing --installation-id\");\n }\n\n const client = createClientFromContext(ctx);\n const linkedOnly = ctx.values[\"linked-only\"] as boolean | undefined;\n const linkKey = ctx.values[\"link-key\"] as string | undefined;\n\n const query: Record<string, string> = {};\n if (linkedOnly) {\n query[\"linkedOnly\"] = \"true\";\n }\n if (linkKey) {\n query[\"linkKey\"] = linkKey;\n }\n\n const response = await client.requestJson({\n method: \"GET\",\n path: `/installations/${encodeURIComponent(installationId)}/repos`,\n query: Object.keys(query).length > 0 ? query : undefined,\n });\n\n printResult(response);\n },\n});\n\nexport const installationsSyncCommand = define({\n name: \"sync\",\n description: \"Sync repositories for an installation from GitHub\",\n args: {\n ...baseArgs,\n \"installation-id\": {\n type: \"string\",\n short: \"i\",\n description: \"Installation ID\",\n },\n },\n run: async (ctx) => {\n const installationId = ctx.values[\"installation-id\"] as string | undefined;\n if (!installationId) {\n throw new Error(\"Missing --installation-id\");\n }\n\n const client = createClientFromContext(ctx);\n const response = await client.requestJson({\n method: \"POST\",\n path: `/installations/${encodeURIComponent(installationId)}/sync`,\n });\n\n printResult(response);\n },\n});\n\nexport const installationsSubCommands: Map<string, ReturnType<typeof define>> = new Map();\ninstallationsSubCommands.set(\"list\", installationsListCommand);\ninstallationsSubCommands.set(\"repos\", installationsReposCommand);\ninstallationsSubCommands.set(\"sync\", installationsSyncCommand);\n"],"mappings":";;;;;AAKA,MAAa,uBAAuB,OAAO;CACzC,MAAM;CACN,aAAa;CACd,CAAC;AAEF,MAAa,2BAA2B,OAAO;CAC7C,MAAM;CACN,aAAa;CACb,MAAM;EACJ,GAAG;EACH,QAAQ;GACN,MAAM;GACN,aAAa;GACd;EACF;CACD,KAAK,OAAO,QAAQ;EAClB,MAAM,SAAS,wBAAwB,IAAI;EAC3C,MAAM,SAAS,IAAI,OAAO;AAQ1B,cANiB,MAAM,OAAO,YAAY;GACxC,QAAQ;GACR,MAAM;GACN,OAAO,SAAS,EAAE,QAAQ,GAAG;GAC9B,CA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createClientFromContext, parseJsonValue } from "../utils/options.js";
2
+ import { printResult } from "../utils/output.js";
3
+ import { define } from "gunshi";
4
+
5
+ //#region src/cli/commands/pulls.ts
6
+ const pullsCommand = define({
7
+ name: "pulls",
8
+ description: "Pull request commands"
9
+ });
10
+ const pullsListCommand = define({
11
+ name: "list",
12
+ description: "List pull requests",
13
+ args: {
14
+ ...baseArgs,
15
+ owner: {
16
+ type: "string",
17
+ description: "Repository owner"
18
+ },
19
+ repo: {
20
+ type: "string",
21
+ description: "Repository name"
22
+ },
23
+ state: {
24
+ type: "string",
25
+ description: "State filter (open, closed, all)"
26
+ },
27
+ "per-page": {
28
+ type: "number",
29
+ description: "Results per page (1-100)"
30
+ },
31
+ page: {
32
+ type: "number",
33
+ description: "Page number"
34
+ }
35
+ },
36
+ run: async (ctx) => {
37
+ const owner = ctx.values["owner"];
38
+ const repo = ctx.values["repo"];
39
+ if (!owner) throw new Error("Missing --owner");
40
+ if (!repo) throw new Error("Missing --repo");
41
+ const client = createClientFromContext(ctx);
42
+ const state = ctx.values["state"];
43
+ const perPage = ctx.values["per-page"];
44
+ const page = ctx.values["page"];
45
+ const query = {};
46
+ if (state) query["state"] = state;
47
+ if (perPage !== void 0) query["perPage"] = String(perPage);
48
+ if (page !== void 0) query["page"] = String(page);
49
+ printResult(await client.requestJson({
50
+ method: "GET",
51
+ path: `/repositories/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/pulls`,
52
+ query: Object.keys(query).length > 0 ? query : void 0
53
+ }));
54
+ }
55
+ });
56
+ const pullsReviewCommand = define({
57
+ name: "review",
58
+ description: "Create a pull request review",
59
+ args: {
60
+ ...baseArgs,
61
+ owner: {
62
+ type: "string",
63
+ description: "Repository owner"
64
+ },
65
+ repo: {
66
+ type: "string",
67
+ description: "Repository name"
68
+ },
69
+ number: {
70
+ type: "number",
71
+ description: "Pull request number"
72
+ },
73
+ event: {
74
+ type: "string",
75
+ description: "Review event (APPROVE, REQUEST_CHANGES, COMMENT)"
76
+ },
77
+ body: {
78
+ type: "string",
79
+ description: "Review body"
80
+ },
81
+ comments: {
82
+ type: "string",
83
+ description: "Review comments JSON array"
84
+ },
85
+ "commit-id": {
86
+ type: "string",
87
+ description: "Commit id"
88
+ }
89
+ },
90
+ run: async (ctx) => {
91
+ const owner = ctx.values["owner"];
92
+ const repo = ctx.values["repo"];
93
+ const number = ctx.values["number"];
94
+ if (!owner) throw new Error("Missing --owner");
95
+ if (!repo) throw new Error("Missing --repo");
96
+ if (!number) throw new Error("Missing --number");
97
+ const event = ctx.values["event"];
98
+ if (event && ![
99
+ "APPROVE",
100
+ "REQUEST_CHANGES",
101
+ "COMMENT"
102
+ ].includes(event)) throw new Error("Invalid --event. Use APPROVE, REQUEST_CHANGES, or COMMENT.");
103
+ const comments = parseJsonValue("comments", ctx.values["comments"]);
104
+ if (comments !== void 0 && !Array.isArray(comments)) throw new Error("--comments must be a JSON array");
105
+ printResult(await createClientFromContext(ctx).requestJson({
106
+ method: "POST",
107
+ path: `/repositories/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/pulls/${number}/reviews`,
108
+ body: {
109
+ event: event || void 0,
110
+ body: ctx.values["body"],
111
+ comments,
112
+ commitId: ctx.values["commit-id"]
113
+ }
114
+ }));
115
+ }
116
+ });
117
+ const pullsSubCommands = /* @__PURE__ */ new Map();
118
+ pullsSubCommands.set("list", pullsListCommand);
119
+ pullsSubCommands.set("review", pullsReviewCommand);
120
+
121
+ //#endregion
122
+ export { pullsCommand, pullsSubCommands };
123
+ //# sourceMappingURL=pulls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pulls.js","names":[],"sources":["../../../src/cli/commands/pulls.ts"],"sourcesContent":["import { define } from \"gunshi\";\n\nimport { baseArgs, createClientFromContext, parseJsonValue } from \"../utils/options.js\";\nimport { printResult } from \"../utils/output.js\";\n\nexport const pullsCommand = define({\n name: \"pulls\",\n description: \"Pull request commands\",\n});\n\nexport const pullsListCommand = define({\n name: \"list\",\n description: \"List pull requests\",\n args: {\n ...baseArgs,\n owner: {\n type: \"string\",\n description: \"Repository owner\",\n },\n repo: {\n type: \"string\",\n description: \"Repository name\",\n },\n state: {\n type: \"string\",\n description: \"State filter (open, closed, all)\",\n },\n \"per-page\": {\n type: \"number\",\n description: \"Results per page (1-100)\",\n },\n page: {\n type: \"number\",\n description: \"Page number\",\n },\n },\n run: async (ctx) => {\n const owner = ctx.values[\"owner\"] as string | undefined;\n const repo = ctx.values[\"repo\"] as string | undefined;\n\n if (!owner) {\n throw new Error(\"Missing --owner\");\n }\n if (!repo) {\n throw new Error(\"Missing --repo\");\n }\n\n const client = createClientFromContext(ctx);\n const state = ctx.values[\"state\"] as string | undefined;\n const perPage = ctx.values[\"per-page\"] as number | undefined;\n const page = ctx.values[\"page\"] as number | undefined;\n\n const query: Record<string, string> = {};\n if (state) {\n query[\"state\"] = state;\n }\n if (perPage !== undefined) {\n query[\"perPage\"] = String(perPage);\n }\n if (page !== undefined) {\n query[\"page\"] = String(page);\n }\n\n const response = await client.requestJson({\n method: \"GET\",\n path: `/repositories/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/pulls`,\n query: Object.keys(query).length > 0 ? query : undefined,\n });\n\n printResult(response);\n },\n});\n\nexport const pullsReviewCommand = define({\n name: \"review\",\n description: \"Create a pull request review\",\n args: {\n ...baseArgs,\n owner: {\n type: \"string\",\n description: \"Repository owner\",\n },\n repo: {\n type: \"string\",\n description: \"Repository name\",\n },\n number: {\n type: \"number\",\n description: \"Pull request number\",\n },\n event: {\n type: \"string\",\n description: \"Review event (APPROVE, REQUEST_CHANGES, COMMENT)\",\n },\n body: {\n type: \"string\",\n description: \"Review body\",\n },\n comments: {\n type: \"string\",\n description: \"Review comments JSON array\",\n },\n \"commit-id\": {\n type: \"string\",\n description: \"Commit id\",\n },\n },\n run: async (ctx) => {\n const owner = ctx.values[\"owner\"] as string | undefined;\n const repo = ctx.values[\"repo\"] as string | undefined;\n const number = ctx.values[\"number\"] as number | undefined;\n\n if (!owner) {\n throw new Error(\"Missing --owner\");\n }\n if (!repo) {\n throw new Error(\"Missing --repo\");\n }\n if (!number) {\n throw new Error(\"Missing --number\");\n }\n\n const event = ctx.values[\"event\"] as string | undefined;\n if (event && ![\"APPROVE\", \"REQUEST_CHANGES\", \"COMMENT\"].includes(event)) {\n throw new Error(\"Invalid --event. Use APPROVE, REQUEST_CHANGES, or COMMENT.\");\n }\n\n const comments = parseJsonValue(\"comments\", ctx.values[\"comments\"] as string | undefined);\n if (comments !== undefined && !Array.isArray(comments)) {\n throw new Error(\"--comments must be a JSON array\");\n }\n\n const client = createClientFromContext(ctx);\n\n const response = await client.requestJson({\n method: \"POST\",\n path: `/repositories/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/pulls/${number}/reviews`,\n body: {\n event: event || undefined,\n body: ctx.values[\"body\"] as string | undefined,\n comments: comments as unknown[] | undefined,\n commitId: ctx.values[\"commit-id\"] as string | undefined,\n },\n });\n\n printResult(response);\n },\n});\n\nexport const pullsSubCommands: Map<string, ReturnType<typeof define>> = new Map();\npullsSubCommands.set(\"list\", pullsListCommand);\npullsSubCommands.set(\"review\", pullsReviewCommand);\n"],"mappings":";;;;;AAKA,MAAa,eAAe,OAAO;CACjC,MAAM;CACN,aAAa;CACd,CAAC;AAEF,MAAa,mBAAmB,OAAO;CACrC,MAAM;CACN,aAAa;CACb,MAAM;EACJ,GAAG;EACH,OAAO;GACL,MAAM;GACN,aAAa;GACd;EACD,MAAM;GACJ,MAAM;GACN,aAAa;GACd;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACd;EACD,YAAY;GACV,MAAM;GACN,aAAa;GACd;EACD,MAAM;GACJ,MAAM;GACN,aAAa;GACd;EACF;CACD,KAAK,OAAO,QAAQ;EAClB,MAAM,QAAQ,IAAI,OAAO;EACzB,MAAM,OAAO,IAAI,OAAO;AAExB,MAAI,CAAC,MACH,OAAM,IAAI,MAAM,kBAAkB;AAEpC,MAAI,CAAC,KACH,OAAM,IAAI,MAAM,iBAA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AAM,WAAW,eAAe,YAAY,IAAI,OAAO,YAAkC;AACzF,MAAI,aAAa,UAAa,CAAC,MAAM,QAAQ,SAAS,CACpD,OAAM,IAAI,MAAM,kCAAkC;AAgBpD,cAXiB,MAFF,wBAAwB,IAAI,CAEb,YAAY;GACxC,QAAQ;GACR,MAAM,iBAAiB,mBAAmB,MAAM,CAAC,GAAG,mBAAmB,KAAK,CAAC,SAAS,OAAO;GAC7F,MAAM;IACJ,OAAO,SAAS;IAChB,MAAM,IAAI,OAAO;IACP;IACV,UAAU,IAAI,OAAO;IACtB;GACF,CAAC,CAEmB;;CAExB,CAAC;AAEF,MAAa,mCAA2D,IAAI,KAAK;AACjF,iBAAiB,IAAI,QAAQ,iBAAiB;AAC9C,iBAAiB,IAAI,UAAU,mBAAmB"}
@@ -0,0 +1,105 @@
1
+ import { baseArgs, createClientFromContext } from "../utils/options.js";
2
+ import { printResult } from "../utils/output.js";
3
+ import { define } from "gunshi";
4
+
5
+ //#region src/cli/commands/repositories.ts
6
+ const repositoriesCommand = define({
7
+ name: "repositories",
8
+ description: "Repository commands"
9
+ });
10
+ const repositoriesLinkedCommand = define({
11
+ name: "linked",
12
+ description: "List linked repositories",
13
+ args: {
14
+ ...baseArgs,
15
+ "link-key": {
16
+ type: "string",
17
+ description: "Filter by link key"
18
+ }
19
+ },
20
+ run: async (ctx) => {
21
+ const client = createClientFromContext(ctx);
22
+ const linkKey = ctx.values["link-key"];
23
+ printResult(await client.requestJson({
24
+ method: "GET",
25
+ path: "/repositories/linked",
26
+ query: linkKey ? { linkKey } : void 0
27
+ }));
28
+ }
29
+ });
30
+ const repositoriesLinkCommand = define({
31
+ name: "link",
32
+ description: "Link a repository",
33
+ args: {
34
+ ...baseArgs,
35
+ "installation-id": {
36
+ type: "string",
37
+ short: "i",
38
+ description: "Installation ID"
39
+ },
40
+ "repo-id": {
41
+ type: "string",
42
+ short: "r",
43
+ description: "Repository ID"
44
+ },
45
+ "link-key": {
46
+ type: "string",
47
+ description: "Optional link key"
48
+ }
49
+ },
50
+ run: async (ctx) => {
51
+ const installationId = ctx.values["installation-id"];
52
+ const repoId = ctx.values["repo-id"];
53
+ if (!installationId) throw new Error("Missing --installation-id");
54
+ if (!repoId) throw new Error("Missing --repo-id");
55
+ const client = createClientFromContext(ctx);
56
+ const linkKey = ctx.values["link-key"];
57
+ printResult(await client.requestJson({
58
+ method: "POST",
59
+ path: "/repositories/link",
60
+ body: {
61
+ installationId,
62
+ repoId,
63
+ linkKey: linkKey || void 0
64
+ }
65
+ }));
66
+ }
67
+ });
68
+ const repositoriesUnlinkCommand = define({
69
+ name: "unlink",
70
+ description: "Unlink a repository",
71
+ args: {
72
+ ...baseArgs,
73
+ "repo-id": {
74
+ type: "string",
75
+ short: "r",
76
+ description: "Repository ID"
77
+ },
78
+ "link-key": {
79
+ type: "string",
80
+ description: "Optional link key"
81
+ }
82
+ },
83
+ run: async (ctx) => {
84
+ const repoId = ctx.values["repo-id"];
85
+ if (!repoId) throw new Error("Missing --repo-id");
86
+ const client = createClientFromContext(ctx);
87
+ const linkKey = ctx.values["link-key"];
88
+ printResult(await client.requestJson({
89
+ method: "POST",
90
+ path: "/repositories/unlink",
91
+ body: {
92
+ repoId,
93
+ linkKey: linkKey || void 0
94
+ }
95
+ }));
96
+ }
97
+ });
98
+ const repositoriesSubCommands = /* @__PURE__ */ new Map();
99
+ repositoriesSubCommands.set("linked", repositoriesLinkedCommand);
100
+ repositoriesSubCommands.set("link", repositoriesLinkCommand);
101
+ repositoriesSubCommands.set("unlink", repositoriesUnlinkCommand);
102
+
103
+ //#endregion
104
+ export { repositoriesCommand, repositoriesSubCommands };
105
+ //# sourceMappingURL=repositories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repositories.js","names":[],"sources":["../../../src/cli/commands/repositories.ts"],"sourcesContent":["import { define } from \"gunshi\";\n\nimport { baseArgs, createClientFromContext } from \"../utils/options.js\";\nimport { printResult } from \"../utils/output.js\";\n\nexport const repositoriesCommand = define({\n name: \"repositories\",\n description: \"Repository commands\",\n});\n\nexport const repositoriesLinkedCommand = define({\n name: \"linked\",\n description: \"List linked repositories\",\n args: {\n ...baseArgs,\n \"link-key\": {\n type: \"string\",\n description: \"Filter by link key\",\n },\n },\n run: async (ctx) => {\n const client = createClientFromContext(ctx);\n const linkKey = ctx.values[\"link-key\"] as string | undefined;\n\n const response = await client.requestJson({\n method: \"GET\",\n path: \"/repositories/linked\",\n query: linkKey ? { linkKey } : undefined,\n });\n\n printResult(response);\n },\n});\n\nexport const repositoriesLinkCommand = define({\n name: \"link\",\n description: \"Link a repository\",\n args: {\n ...baseArgs,\n \"installation-id\": {\n type: \"string\",\n short: \"i\",\n description: \"Installation ID\",\n },\n \"repo-id\": {\n type: \"string\",\n short: \"r\",\n description: \"Repository ID\",\n },\n \"link-key\": {\n type: \"string\",\n description: \"Optional link key\",\n },\n },\n run: async (ctx) => {\n const installationId = ctx.values[\"installation-id\"] as string | undefined;\n const repoId = ctx.values[\"repo-id\"] as string | undefined;\n if (!installationId) {\n throw new Error(\"Missing --installation-id\");\n }\n if (!repoId) {\n throw new Error(\"Missing --repo-id\");\n }\n\n const client = createClientFromContext(ctx);\n const linkKey = ctx.values[\"link-key\"] as string | undefined;\n\n const response = await client.requestJson({\n method: \"POST\",\n path: \"/repositories/link\",\n body: {\n installationId,\n repoId,\n linkKey: linkKey || undefined,\n },\n });\n\n printResult(response);\n },\n});\n\nexport const repositoriesUnlinkCommand = define({\n name: \"unlink\",\n description: \"Unlink a repository\",\n args: {\n ...baseArgs,\n \"repo-id\": {\n type: \"string\",\n short: \"r\",\n description: \"Repository ID\",\n },\n \"link-key\": {\n type: \"string\",\n description: \"Optional link key\",\n },\n },\n run: async (ctx) => {\n const repoId = ctx.values[\"repo-id\"] as string | undefined;\n if (!repoId) {\n throw new Error(\"Missing --repo-id\");\n }\n\n const client = createClientFromContext(ctx);\n const linkKey = ctx.values[\"link-key\"] as string | undefined;\n\n const response = await client.requestJson({\n method: \"POST\",\n path: \"/repositories/unlink\",\n body: {\n repoId,\n linkKey: linkKey || undefined,\n },\n });\n\n printResult(response);\n },\n});\n\nexport const repositoriesSubCommands: Map<string, ReturnType<typeof define>> = new Map();\nrepositoriesSubCommands.set(\"linked\", repositoriesLinkedCommand);\nrepositoriesSubCommands.set(\"link\", repositoriesLinkCommand);\nrepositoriesSubCommands.set(\"unlink\", repositoriesUnlinkCommand);\n"],"mappings":";;;;;AAKA,MAAa,sBAAsB,OAAO;CACxC,MAAM;CACN,aAAa;CACd,CAAC;AAEF,MAAa,4BAA4B,OAAO;CAC9C,MAAM;CACN,aAAa;CACb,MAAM;EACJ,GAAG;EACH,YAAY;GACV,MAAM;GACN,aAAa;GACd;EACF;CACD,KAAK,OAAO,QAAQ;EAClB,MAAM,SAAS,wBAAwB,IAAI;EAC3C,MAAM,UAAU,IAAI,OAAO;AAQ3B,cANiB,MAAM,OAAO,YAAY;GACxC,QAAQ;GACR,MAAM;GACN,OAAO,UAAU,EAAE,SAAS,GAAG;GAChC,CAAC,CAEmB;;CAExB,CAAC;AAEF,MAAa,0BAA0B,OAAO;CAC5C,MAAM;CACN,aAAa;CACb,MAAM;EACJ,GAAG;EACH,mBAAmB;GACjB,MAAM;GACN,OAAO;GACP,aAAa;GACd;EACD,WAAW;GACT,MAAM;GACN,OAAO;GACP,aAAa;GACd;EACD,YAAY;GACV,MAAM;GACN,aAAa;GACd;EACF;CACD,KAAK,OAAO,QAAQ;EAClB,MAAM,iBAAiB,IAAI,OAAO;EAClC,MAAM,SAAS,IAAI,OAAO;AAC1B,MAAI,CAAC,eACH,OAAM,IAAI,MAAM,4BAA4B;AAE9C,MAAI,CAAC,OACH,OAAM,IAAI,MAAM,oBAAoB;EAGtC,MAAM,SAAS,wBAAwB,IAAI;EAC3C,MAAM,UAAU,IAAI,OAAO;AAY3B,cAViB,MAAM,OAAO,YAAY;GACxC,QAAQ;GACR,MAAM;GACN,MAAM;IACJ;IACA;IACA,SAAS,WAAW;IACrB;GACF,CAAC,CAEmB;;CAExB,CAAC;AAEF,MAAa,4BAA4B,OAAO;CAC9C,MAAM;CACN,aAAa;CACb,MAAM;EACJ,GAAG;EACH,WAAW;GACT,MAAM;GACN,OAAO;GACP,aAAa;GACd;EACD,YAAY;GACV,MAAM;GACN,aAAa;GACd;EACF;CACD,KAAK,OAAO,QAAQ;EAClB,MAAM,SAAS,IAAI,OAAO;AAC1B,MAAI,CAAC,OACH,OAAM,IAAI,MAAM,oBAAoB;EAGtC,MAAM,SAAS,wBAAwB,IAAI;EAC3C,MAAM,UAAU,IAAI,OAAO;AAW3B,cATiB,MAAM,OAAO,YAAY;GACxC,QAAQ;GACR,MAAM;GACN,MAAM;IACJ;IACA,SAAS,WAAW;IACrB;GACF,CAAC,CAEmB;;CAExB,CAAC;AAEF,MAAa,0CAAkE,IAAI,KAAK;AACxF,wBAAwB,IAAI,UAAU,0BAA0B;AAChE,wBAAwB,IAAI,QAAQ,wBAAwB;AAC5D,wBAAwB,IAAI,UAAU,0BAA0B"}
@@ -0,0 +1,187 @@
1
+ import { createGitHubAppFragment } from "../github/factory.js";
2
+ import { resolveGitHubAppConfig } from "../utils/config.js";
3
+ import { createRequire } from "node:module";
4
+ import { mkdirSync } from "node:fs";
5
+ import { dirname } from "node:path";
6
+ import { define } from "gunshi";
7
+ import { createServer } from "node:http";
8
+ import { SqlAdapter } from "@fragno-dev/db/adapters/sql";
9
+ import { createDurableHooksProcessor } from "@fragno-dev/db/dispatchers/node";
10
+ import { BetterSQLite3DriverConfig } from "@fragno-dev/db/drivers";
11
+ import { SqliteDialect } from "kysely";
12
+ import { migrate } from "@fragno-dev/db";
13
+ import { toNodeHandler } from "@fragno-dev/node";
14
+
15
+ //#region src/cli/commands/serve.ts
16
+ const resolveMountRoute = (ctx) => ctx.values["mount-route"] ?? process.env["FRAGNO_GITHUB_APP_MOUNT_ROUTE"] ?? void 0;
17
+ const resolveDbPath = (ctx) => ctx.values["db-path"] ?? process.env["FRAGNO_GITHUB_APP_DB_PATH"] ?? "./github-app-fragment.sqlite";
18
+ const resolvePollInterval = (ctx) => {
19
+ const raw = ctx.values["poll-interval"] ?? process.env["FRAGNO_GITHUB_APP_POLL_INTERVAL_MS"] ?? void 0;
20
+ if (raw === void 0) return 200;
21
+ const numeric = typeof raw === "number" ? raw : Number(raw);
22
+ if (!Number.isFinite(numeric) || numeric <= 0) throw new Error("poll-interval must be a positive number");
23
+ return numeric;
24
+ };
25
+ const loadBetterSqlite3 = () => {
26
+ const mod = createRequire(import.meta.url)("better-sqlite3");
27
+ return mod.default ?? mod;
28
+ };
29
+ const ensureDbDir = (dbPath) => {
30
+ if (dbPath === ":memory:") return;
31
+ mkdirSync(dirname(dbPath), { recursive: true });
32
+ };
33
+ const createSqliteAdapter = (dbPath) => {
34
+ ensureDbDir(dbPath);
35
+ const db = new (loadBetterSqlite3())(dbPath);
36
+ return {
37
+ adapter: new SqlAdapter({
38
+ dialect: new SqliteDialect({ database: db }),
39
+ driverConfig: new BetterSQLite3DriverConfig()
40
+ }),
41
+ close: async () => {
42
+ db.close();
43
+ }
44
+ };
45
+ };
46
+ const addressToString = (server, protocol = "http") => {
47
+ const addr = server.address();
48
+ if (!addr) throw new Error("Address invalid");
49
+ if (typeof addr === "string") return addr;
50
+ let host = addr.address;
51
+ if (host === "::" || host === "0.0.0.0") host = "localhost";
52
+ if (addr.family === "IPv6" && host !== "localhost") host = `[${host}]`;
53
+ return `${protocol}://${host}:${addr.port}`;
54
+ };
55
+ const serveCommand = define({
56
+ name: "serve",
57
+ description: "Start a local server for the GitHub app fragment",
58
+ args: {
59
+ host: {
60
+ type: "string",
61
+ short: "H",
62
+ description: "Host to bind to (default: 127.0.0.1)"
63
+ },
64
+ port: {
65
+ type: "number",
66
+ short: "p",
67
+ description: "Port to listen on (default: 6173)"
68
+ },
69
+ "mount-route": {
70
+ type: "string",
71
+ description: "Override mount route (env: FRAGNO_GITHUB_APP_MOUNT_ROUTE)"
72
+ },
73
+ "db-path": {
74
+ type: "string",
75
+ description: "SQLite database path (env: FRAGNO_GITHUB_APP_DB_PATH)"
76
+ },
77
+ "poll-interval": {
78
+ type: "number",
79
+ description: "Durable hooks poll interval in ms (default: 200)"
80
+ },
81
+ "app-id": {
82
+ type: "string",
83
+ description: "GitHub App ID (env: GITHUB_APP_ID)"
84
+ },
85
+ "app-slug": {
86
+ type: "string",
87
+ description: "GitHub App slug (env: GITHUB_APP_SLUG)"
88
+ },
89
+ "private-key": {
90
+ type: "string",
91
+ description: "GitHub App private key PEM (env: GITHUB_APP_PRIVATE_KEY)"
92
+ },
93
+ "private-key-file": {
94
+ type: "string",
95
+ description: "GitHub App private key PEM file (env: GITHUB_APP_PRIVATE_KEY_FILE)"
96
+ },
97
+ "webhook-secret": {
98
+ type: "string",
99
+ description: "Webhook secret (env: GITHUB_APP_WEBHOOK_SECRET)"
100
+ },
101
+ "webhook-debug": {
102
+ type: "boolean",
103
+ description: "Log webhook debug info (env: GITHUB_APP_WEBHOOK_DEBUG)"
104
+ },
105
+ "api-base-url": {
106
+ type: "string",
107
+ description: "GitHub API base URL (env: GITHUB_APP_API_BASE_URL)"
108
+ },
109
+ "api-version": {
110
+ type: "string",
111
+ description: "GitHub API version (env: GITHUB_APP_API_VERSION)"
112
+ },
113
+ "web-base-url": {
114
+ type: "string",
115
+ description: "GitHub web base URL (env: GITHUB_APP_WEB_BASE_URL)"
116
+ },
117
+ "default-link-key": {
118
+ type: "string",
119
+ description: "Default link key (env: GITHUB_APP_DEFAULT_LINK_KEY)"
120
+ },
121
+ "token-cache-ttl": {
122
+ type: "number",
123
+ description: "Token cache TTL in seconds (env: GITHUB_APP_TOKEN_CACHE_TTL_SECONDS)"
124
+ }
125
+ },
126
+ run: async (ctx) => {
127
+ const config = resolveGitHubAppConfig(ctx);
128
+ const host = ctx.values["host"] ?? "127.0.0.1";
129
+ const port = ctx.values["port"] ?? 6173;
130
+ const mountRoute = resolveMountRoute(ctx);
131
+ const pollIntervalMs = resolvePollInterval(ctx);
132
+ const { adapter, close } = createSqliteAdapter(resolveDbPath(ctx));
133
+ const fragment = createGitHubAppFragment(config, {
134
+ databaseAdapter: adapter ?? void 0,
135
+ outbox: { enabled: true },
136
+ mountRoute
137
+ });
138
+ console.log("Running database migrations...");
139
+ await migrate(fragment);
140
+ const server = createServer(toNodeHandler(fragment.handler.bind(fragment)));
141
+ await new Promise((resolve, reject) => {
142
+ server.once("error", reject);
143
+ server.listen(port, host, () => resolve());
144
+ });
145
+ const dispatcher = createDurableHooksProcessor([fragment], {
146
+ pollIntervalMs,
147
+ onError: (error) => {
148
+ console.error("Durable hooks processing error", error);
149
+ }
150
+ });
151
+ dispatcher.startPolling();
152
+ const baseUrl = addressToString(server);
153
+ const mount = fragment.mountRoute;
154
+ const fragmentBase = `${baseUrl}${mount}`;
155
+ console.log(`GitHub app fragment server running on ${baseUrl}`);
156
+ console.log(`Fragment mount: ${mount}`);
157
+ console.log(`Fragment base URL: ${fragmentBase}`);
158
+ console.log(`Webhook URL: ${fragmentBase}/webhooks`);
159
+ console.log(`Durable hooks polling: ${pollIntervalMs}ms`);
160
+ console.log("Set FRAGNO_GITHUB_APP_BASE_URL to call routes from the CLI.");
161
+ const cleanup = async () => {
162
+ dispatcher.stopPolling();
163
+ await new Promise((resolve) => {
164
+ server.close(() => resolve());
165
+ });
166
+ await close();
167
+ };
168
+ let stopping = false;
169
+ const stop = async () => {
170
+ if (stopping) return;
171
+ stopping = true;
172
+ try {
173
+ await cleanup();
174
+ } catch (error) {
175
+ console.error("Cleanup failed", error);
176
+ } finally {
177
+ process.exit(0);
178
+ }
179
+ };
180
+ process.on("SIGINT", stop);
181
+ process.on("SIGTERM", stop);
182
+ }
183
+ });
184
+
185
+ //#endregion
186
+ export { serveCommand };
187
+ //# sourceMappingURL=serve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serve.js","names":[],"sources":["../../../src/cli/commands/serve.ts"],"sourcesContent":["import { mkdirSync } from \"node:fs\";\nimport { createServer, type Server } from \"node:http\";\nimport { createRequire } from \"node:module\";\nimport { dirname } from \"node:path\";\n\nimport { SqlAdapter } from \"@fragno-dev/db/adapters/sql\";\nimport { createDurableHooksProcessor } from \"@fragno-dev/db/dispatchers/node\";\nimport { BetterSQLite3DriverConfig } from \"@fragno-dev/db/drivers\";\nimport { define } from \"gunshi\";\nimport { SqliteDialect } from \"kysely\";\n\nimport { migrate } from \"@fragno-dev/db\";\nimport { toNodeHandler } from \"@fragno-dev/node\";\n\nimport { createGitHubAppFragment } from \"../../github/factory.js\";\nimport { resolveGitHubAppConfig } from \"../utils/config.js\";\n\nconst resolveMountRoute = (ctx: { values: Record<string, unknown> }) =>\n (ctx.values[\"mount-route\"] as string | undefined) ??\n process.env[\"FRAGNO_GITHUB_APP_MOUNT_ROUTE\"] ??\n undefined;\n\nconst resolveDbPath = (ctx: { values: Record<string, unknown> }) =>\n (ctx.values[\"db-path\"] as string | undefined) ??\n process.env[\"FRAGNO_GITHUB_APP_DB_PATH\"] ??\n \"./github-app-fragment.sqlite\";\n\nconst resolvePollInterval = (ctx: { values: Record<string, unknown> }) => {\n const raw =\n (ctx.values[\"poll-interval\"] as number | string | undefined) ??\n process.env[\"FRAGNO_GITHUB_APP_POLL_INTERVAL_MS\"] ??\n undefined;\n if (raw === undefined) {\n return 200;\n }\n const numeric = typeof raw === \"number\" ? raw : Number(raw);\n if (!Number.isFinite(numeric) || numeric <= 0) {\n throw new Error(\"poll-interval must be a positive number\");\n }\n return numeric;\n};\n\nconst loadBetterSqlite3 = () => {\n const requireFn = createRequire(import.meta.url);\n const mod = requireFn(\"better-sqlite3\");\n return (mod.default ?? mod) as typeof import(\"better-sqlite3\");\n};\n\nconst ensureDbDir = (dbPath: string) => {\n if (dbPath === \":memory:\") {\n return;\n }\n mkdirSync(dirname(dbPath), { recursive: true });\n};\n\nconst createSqliteAdapter = (dbPath: string) => {\n ensureDbDir(dbPath);\n const BetterSqlite3 = loadBetterSqlite3();\n const db = new BetterSqlite3(dbPath);\n const dialect = new SqliteDialect({ database: db });\n\n return {\n adapter: new SqlAdapter({ dialect, driverConfig: new BetterSQLite3DriverConfig() }),\n close: async () => {\n db.close();\n },\n };\n};\n\nconst addressToString = (server: Server, protocol: \"http\" | \"https\" = \"http\") => {\n const addr = server.address();\n if (!addr) {\n throw new Error(\"Address invalid\");\n }\n\n if (typeof addr === \"string\") {\n return addr;\n }\n\n let host = addr.address;\n\n if (host === \"::\" || host === \"0.0.0.0\") {\n host = \"localhost\";\n }\n\n if (addr.family === \"IPv6\" && host !== \"localhost\") {\n host = `[${host}]`;\n }\n\n return `${protocol}://${host}:${addr.port}`;\n};\n\nexport const serveCommand = define({\n name: \"serve\",\n description: \"Start a local server for the GitHub app fragment\",\n args: {\n host: {\n type: \"string\",\n short: \"H\",\n description: \"Host to bind to (default: 127.0.0.1)\",\n },\n port: {\n type: \"number\",\n short: \"p\",\n description: \"Port to listen on (default: 6173)\",\n },\n \"mount-route\": {\n type: \"string\",\n description: \"Override mount route (env: FRAGNO_GITHUB_APP_MOUNT_ROUTE)\",\n },\n \"db-path\": {\n type: \"string\",\n description: \"SQLite database path (env: FRAGNO_GITHUB_APP_DB_PATH)\",\n },\n \"poll-interval\": {\n type: \"number\",\n description: \"Durable hooks poll interval in ms (default: 200)\",\n },\n \"app-id\": {\n type: \"string\",\n description: \"GitHub App ID (env: GITHUB_APP_ID)\",\n },\n \"app-slug\": {\n type: \"string\",\n description: \"GitHub App slug (env: GITHUB_APP_SLUG)\",\n },\n \"private-key\": {\n type: \"string\",\n description: \"GitHub App private key PEM (env: GITHUB_APP_PRIVATE_KEY)\",\n },\n \"private-key-file\": {\n type: \"string\",\n description: \"GitHub App private key PEM file (env: GITHUB_APP_PRIVATE_KEY_FILE)\",\n },\n \"webhook-secret\": {\n type: \"string\",\n description: \"Webhook secret (env: GITHUB_APP_WEBHOOK_SECRET)\",\n },\n \"webhook-debug\": {\n type: \"boolean\",\n description: \"Log webhook debug info (env: GITHUB_APP_WEBHOOK_DEBUG)\",\n },\n \"api-base-url\": {\n type: \"string\",\n description: \"GitHub API base URL (env: GITHUB_APP_API_BASE_URL)\",\n },\n \"api-version\": {\n type: \"string\",\n description: \"GitHub API version (env: GITHUB_APP_API_VERSION)\",\n },\n \"web-base-url\": {\n type: \"string\",\n description: \"GitHub web base URL (env: GITHUB_APP_WEB_BASE_URL)\",\n },\n \"default-link-key\": {\n type: \"string\",\n description: \"Default link key (env: GITHUB_APP_DEFAULT_LINK_KEY)\",\n },\n \"token-cache-ttl\": {\n type: \"number\",\n description: \"Token cache TTL in seconds (env: GITHUB_APP_TOKEN_CACHE_TTL_SECONDS)\",\n },\n },\n run: async (ctx) => {\n const config = resolveGitHubAppConfig(ctx);\n const host = (ctx.values[\"host\"] as string | undefined) ?? \"127.0.0.1\";\n const port = (ctx.values[\"port\"] as number | undefined) ?? 6173;\n const mountRoute = resolveMountRoute(ctx);\n const pollIntervalMs = resolvePollInterval(ctx);\n const dbPath = resolveDbPath(ctx);\n\n const { adapter, close } = createSqliteAdapter(dbPath);\n\n const fragment = createGitHubAppFragment(config, {\n databaseAdapter: adapter ?? undefined,\n outbox: { enabled: true },\n mountRoute,\n });\n\n console.log(\"Running database migrations...\");\n await migrate(fragment);\n\n const handler = toNodeHandler(fragment.handler.bind(fragment));\n const server = createServer(handler);\n\n await new Promise<void>((resolve, reject) => {\n server.once(\"error\", reject);\n server.listen(port, host, () => resolve());\n });\n\n const dispatcher = createDurableHooksProcessor([fragment], {\n pollIntervalMs,\n onError: (error) => {\n console.error(\"Durable hooks processing error\", error);\n },\n });\n dispatcher.startPolling();\n\n const baseUrl = addressToString(server);\n const mount = fragment.mountRoute;\n const fragmentBase = `${baseUrl}${mount}`;\n\n console.log(`GitHub app fragment server running on ${baseUrl}`);\n console.log(`Fragment mount: ${mount}`);\n console.log(`Fragment base URL: ${fragmentBase}`);\n console.log(`Webhook URL: ${fragmentBase}/webhooks`);\n console.log(`Durable hooks polling: ${pollIntervalMs}ms`);\n console.log(\"Set FRAGNO_GITHUB_APP_BASE_URL to call routes from the CLI.\");\n\n const cleanup = async () => {\n dispatcher.stopPolling();\n await new Promise<void>((resolve) => {\n server.close(() => resolve());\n });\n await close();\n };\n\n let stopping = false;\n const stop = async () => {\n if (stopping) {\n return;\n }\n stopping = true;\n try {\n await cleanup();\n } catch (error) {\n console.error(\"Cleanup failed\", error);\n } finally {\n process.exit(0);\n }\n };\n\n process.on(\"SIGINT\", stop);\n process.on(\"SIGTERM\", stop);\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAM,qBAAqB,QACxB,IAAI,OAAO,kBACZ,QAAQ,IAAI,oCACZ;AAEF,MAAM,iBAAiB,QACpB,IAAI,OAAO,cACZ,QAAQ,IAAI,gCACZ;AAEF,MAAM,uBAAuB,QAA6C;CACxE,MAAM,MACH,IAAI,OAAO,oBACZ,QAAQ,IAAI,yCACZ;AACF,KAAI,QAAQ,OACV,QAAO;CAET,MAAM,UAAU,OAAO,QAAQ,WAAW,MAAM,OAAO,IAAI;AAC3D,KAAI,CAAC,OAAO,SAAS,QAAQ,IAAI,WAAW,EAC1C,OAAM,IAAI,MAAM,0CAA0C;AAE5D,QAAO;;AAGT,MAAM,0BAA0B;CAE9B,MAAM,MADY,cAAc,OAAO,KAAK,IAAI,CAC1B,iBAAiB;AACvC,QAAQ,IAAI,WAAW;;AAGzB,MAAM,eAAe,WAAmB;AACtC,KAAI,WAAW,WACb;AAEF,WAAU,QAAQ,OAAO,EAAE,EAAE,WAAW,MAAM,CAAC;;AAGjD,MAAM,uBAAuB,WAAmB;AAC9C,aAAY,OAAO;CAEnB,MAAM,KAAK,KADW,mBAAmB,EACZ,OAAO;AAGpC,QAAO;EACL,SAAS,IAAI,WAAW;GAAE,SAHZ,IAAI,cAAc,EAAE,UAAU,IAAI,CAAC;GAGd,cAAc,IAAI,2BAA2B;GAAE,CAAC;EACnF,OAAO,YAAY;AACjB,MAAG,OAAO;;EAEb;;AAGH,MAAM,mBAAmB,QAAgB,WAA6B,WAAW;CAC/E,MAAM,OAAO,O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