@knpkv/codecommit 0.1.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 (233) hide show
  1. package/README.md +216 -0
  2. package/dist/package.json +50 -0
  3. package/dist/src/bin.d.ts +3 -0
  4. package/dist/src/bin.d.ts.map +1 -0
  5. package/dist/src/bin.js +204 -0
  6. package/dist/src/bin.js.map +1 -0
  7. package/dist/src/main.d.ts +2 -0
  8. package/dist/src/main.d.ts.map +1 -0
  9. package/dist/src/main.js +25 -0
  10. package/dist/src/main.js.map +1 -0
  11. package/dist/src/tui/App.d.ts +6 -0
  12. package/dist/src/tui/App.d.ts.map +1 -0
  13. package/dist/src/tui/App.js +40 -0
  14. package/dist/src/tui/App.js.map +1 -0
  15. package/dist/src/tui/Constants.d.ts +11 -0
  16. package/dist/src/tui/Constants.d.ts.map +1 -0
  17. package/dist/src/tui/Constants.js +40 -0
  18. package/dist/src/tui/Constants.js.map +1 -0
  19. package/dist/src/tui/ListBuilder.d.ts +32 -0
  20. package/dist/src/tui/ListBuilder.d.ts.map +1 -0
  21. package/dist/src/tui/ListBuilder.js +145 -0
  22. package/dist/src/tui/ListBuilder.js.map +1 -0
  23. package/dist/src/tui/atoms/actions.d.ts +39 -0
  24. package/dist/src/tui/atoms/actions.d.ts.map +1 -0
  25. package/dist/src/tui/atoms/actions.js +149 -0
  26. package/dist/src/tui/atoms/actions.js.map +1 -0
  27. package/dist/src/tui/atoms/app.d.ts +42 -0
  28. package/dist/src/tui/atoms/app.d.ts.map +1 -0
  29. package/dist/src/tui/atoms/app.js +69 -0
  30. package/dist/src/tui/atoms/app.js.map +1 -0
  31. package/dist/src/tui/atoms/index.d.ts +6 -0
  32. package/dist/src/tui/atoms/index.d.ts.map +1 -0
  33. package/dist/src/tui/atoms/index.js +7 -0
  34. package/dist/src/tui/atoms/index.js.map +1 -0
  35. package/dist/src/tui/atoms/runtime.d.ts +9 -0
  36. package/dist/src/tui/atoms/runtime.d.ts.map +1 -0
  37. package/dist/src/tui/atoms/runtime.js +22 -0
  38. package/dist/src/tui/atoms/runtime.js.map +1 -0
  39. package/dist/src/tui/atoms/ui.d.ts +103 -0
  40. package/dist/src/tui/atoms/ui.d.ts.map +1 -0
  41. package/dist/src/tui/atoms/ui.js +97 -0
  42. package/dist/src/tui/atoms/ui.js.map +1 -0
  43. package/dist/src/tui/components/Badge.d.ts +13 -0
  44. package/dist/src/tui/components/Badge.d.ts.map +1 -0
  45. package/dist/src/tui/components/Badge.js +48 -0
  46. package/dist/src/tui/components/Badge.js.map +1 -0
  47. package/dist/src/tui/components/DetailsView.d.ts +6 -0
  48. package/dist/src/tui/components/DetailsView.d.ts.map +1 -0
  49. package/dist/src/tui/components/DetailsView.js +81 -0
  50. package/dist/src/tui/components/DetailsView.js.map +1 -0
  51. package/dist/src/tui/components/ErrorBoundary.d.ts +20 -0
  52. package/dist/src/tui/components/ErrorBoundary.d.ts.map +1 -0
  53. package/dist/src/tui/components/ErrorBoundary.js +33 -0
  54. package/dist/src/tui/components/ErrorBoundary.js.map +1 -0
  55. package/dist/src/tui/components/Footer.d.ts +6 -0
  56. package/dist/src/tui/components/Footer.d.ts.map +1 -0
  57. package/dist/src/tui/components/Footer.js +29 -0
  58. package/dist/src/tui/components/Footer.js.map +1 -0
  59. package/dist/src/tui/components/Header.d.ts +6 -0
  60. package/dist/src/tui/components/Header.d.ts.map +1 -0
  61. package/dist/src/tui/components/Header.js +58 -0
  62. package/dist/src/tui/components/Header.js.map +1 -0
  63. package/dist/src/tui/components/ListItemRow.d.ts +13 -0
  64. package/dist/src/tui/components/ListItemRow.d.ts.map +1 -0
  65. package/dist/src/tui/components/ListItemRow.js +52 -0
  66. package/dist/src/tui/components/ListItemRow.js.map +1 -0
  67. package/dist/src/tui/components/MainList.d.ts +11 -0
  68. package/dist/src/tui/components/MainList.d.ts.map +1 -0
  69. package/dist/src/tui/components/MainList.js +124 -0
  70. package/dist/src/tui/components/MainList.js.map +1 -0
  71. package/dist/src/tui/components/NotificationsTable.d.ts +12 -0
  72. package/dist/src/tui/components/NotificationsTable.d.ts.map +1 -0
  73. package/dist/src/tui/components/NotificationsTable.js +72 -0
  74. package/dist/src/tui/components/NotificationsTable.js.map +1 -0
  75. package/dist/src/tui/components/QuickFilters.d.ts +6 -0
  76. package/dist/src/tui/components/QuickFilters.d.ts.map +1 -0
  77. package/dist/src/tui/components/QuickFilters.js +74 -0
  78. package/dist/src/tui/components/QuickFilters.js.map +1 -0
  79. package/dist/src/tui/components/SettingsTable.d.ts +12 -0
  80. package/dist/src/tui/components/SettingsTable.d.ts.map +1 -0
  81. package/dist/src/tui/components/SettingsTable.js +62 -0
  82. package/dist/src/tui/components/SettingsTable.js.map +1 -0
  83. package/dist/src/tui/components/Spinner.d.ts +11 -0
  84. package/dist/src/tui/components/Spinner.d.ts.map +1 -0
  85. package/dist/src/tui/components/Spinner.js +24 -0
  86. package/dist/src/tui/components/Spinner.js.map +1 -0
  87. package/dist/src/tui/components/StatusRow.d.ts +11 -0
  88. package/dist/src/tui/components/StatusRow.d.ts.map +1 -0
  89. package/dist/src/tui/components/StatusRow.js +11 -0
  90. package/dist/src/tui/components/StatusRow.js.map +1 -0
  91. package/dist/src/tui/components/Table.d.ts +20 -0
  92. package/dist/src/tui/components/Table.d.ts.map +1 -0
  93. package/dist/src/tui/components/Table.js +38 -0
  94. package/dist/src/tui/components/Table.js.map +1 -0
  95. package/dist/src/tui/components/index.d.ts +14 -0
  96. package/dist/src/tui/components/index.d.ts.map +1 -0
  97. package/dist/src/tui/components/index.js +14 -0
  98. package/dist/src/tui/components/index.js.map +1 -0
  99. package/dist/src/tui/components/mainlist-utils.d.ts +22 -0
  100. package/dist/src/tui/components/mainlist-utils.d.ts.map +1 -0
  101. package/dist/src/tui/components/mainlist-utils.js +71 -0
  102. package/dist/src/tui/components/mainlist-utils.js.map +1 -0
  103. package/dist/src/tui/components/table-utils.d.ts +25 -0
  104. package/dist/src/tui/components/table-utils.d.ts.map +1 -0
  105. package/dist/src/tui/components/table-utils.js +25 -0
  106. package/dist/src/tui/components/table-utils.js.map +1 -0
  107. package/dist/src/tui/context/dialog.d.ts +32 -0
  108. package/dist/src/tui/context/dialog.d.ts.map +1 -0
  109. package/dist/src/tui/context/dialog.js +41 -0
  110. package/dist/src/tui/context/dialog.js.map +1 -0
  111. package/dist/src/tui/context/theme.d.ts +25 -0
  112. package/dist/src/tui/context/theme.d.ts.map +1 -0
  113. package/dist/src/tui/context/theme.js +31 -0
  114. package/dist/src/tui/context/theme.js.map +1 -0
  115. package/dist/src/tui/hooks/index.d.ts +2 -0
  116. package/dist/src/tui/hooks/index.d.ts.map +1 -0
  117. package/dist/src/tui/hooks/index.js +2 -0
  118. package/dist/src/tui/hooks/index.js.map +1 -0
  119. package/dist/src/tui/hooks/useKeyboardNav.d.ts +16 -0
  120. package/dist/src/tui/hooks/useKeyboardNav.d.ts.map +1 -0
  121. package/dist/src/tui/hooks/useKeyboardNav.js +429 -0
  122. package/dist/src/tui/hooks/useKeyboardNav.js.map +1 -0
  123. package/dist/src/tui/hooks/useListNavigation.d.ts +3 -0
  124. package/dist/src/tui/hooks/useListNavigation.d.ts.map +1 -0
  125. package/dist/src/tui/hooks/useListNavigation.js +123 -0
  126. package/dist/src/tui/hooks/useListNavigation.js.map +1 -0
  127. package/dist/src/tui/mocks.d.ts +6 -0
  128. package/dist/src/tui/mocks.d.ts.map +1 -0
  129. package/dist/src/tui/mocks.js +36 -0
  130. package/dist/src/tui/mocks.js.map +1 -0
  131. package/dist/src/tui/theme/Resolver.d.ts +6 -0
  132. package/dist/src/tui/theme/Resolver.d.ts.map +1 -0
  133. package/dist/src/tui/theme/Resolver.js +73 -0
  134. package/dist/src/tui/theme/Resolver.js.map +1 -0
  135. package/dist/src/tui/theme/ThemeRegistry.d.ts +3 -0
  136. package/dist/src/tui/theme/ThemeRegistry.d.ts.map +1 -0
  137. package/dist/src/tui/theme/ThemeRegistry.js +70 -0
  138. package/dist/src/tui/theme/ThemeRegistry.js.map +1 -0
  139. package/dist/src/tui/theme/data/aura.json +69 -0
  140. package/dist/src/tui/theme/data/ayu.json +80 -0
  141. package/dist/src/tui/theme/data/carbonfox.json +248 -0
  142. package/dist/src/tui/theme/data/catppuccin-frappe.json +233 -0
  143. package/dist/src/tui/theme/data/catppuccin-macchiato.json +233 -0
  144. package/dist/src/tui/theme/data/catppuccin.json +112 -0
  145. package/dist/src/tui/theme/data/cobalt2.json +228 -0
  146. package/dist/src/tui/theme/data/cursor.json +249 -0
  147. package/dist/src/tui/theme/data/dracula.json +219 -0
  148. package/dist/src/tui/theme/data/everforest.json +241 -0
  149. package/dist/src/tui/theme/data/flexoki.json +237 -0
  150. package/dist/src/tui/theme/data/github.json +233 -0
  151. package/dist/src/tui/theme/data/gruvbox.json +242 -0
  152. package/dist/src/tui/theme/data/kanagawa.json +77 -0
  153. package/dist/src/tui/theme/data/lucent-orng.json +237 -0
  154. package/dist/src/tui/theme/data/material.json +235 -0
  155. package/dist/src/tui/theme/data/matrix.json +77 -0
  156. package/dist/src/tui/theme/data/mercury.json +245 -0
  157. package/dist/src/tui/theme/data/monokai.json +221 -0
  158. package/dist/src/tui/theme/data/nightowl.json +221 -0
  159. package/dist/src/tui/theme/data/nord.json +223 -0
  160. package/dist/src/tui/theme/data/one-dark.json +84 -0
  161. package/dist/src/tui/theme/data/opencode.json +245 -0
  162. package/dist/src/tui/theme/data/orng.json +249 -0
  163. package/dist/src/tui/theme/data/osaka-jade.json +93 -0
  164. package/dist/src/tui/theme/data/palenight.json +222 -0
  165. package/dist/src/tui/theme/data/rosepine.json +234 -0
  166. package/dist/src/tui/theme/data/solarized.json +223 -0
  167. package/dist/src/tui/theme/data/synthwave84.json +226 -0
  168. package/dist/src/tui/theme/data/tokyonight.json +243 -0
  169. package/dist/src/tui/theme/data/vercel.json +245 -0
  170. package/dist/src/tui/theme/data/vesper.json +218 -0
  171. package/dist/src/tui/theme/data/zenburn.json +223 -0
  172. package/dist/src/tui/theme/default.d.ts +40 -0
  173. package/dist/src/tui/theme/default.d.ts.map +1 -0
  174. package/dist/src/tui/theme/default.js +35 -0
  175. package/dist/src/tui/theme/default.js.map +1 -0
  176. package/dist/src/tui/theme/resolver-utils.d.ts +28 -0
  177. package/dist/src/tui/theme/resolver-utils.d.ts.map +1 -0
  178. package/dist/src/tui/theme/resolver-utils.js +19 -0
  179. package/dist/src/tui/theme/resolver-utils.js.map +1 -0
  180. package/dist/src/tui/theme/themes.d.ts +3 -0
  181. package/dist/src/tui/theme/themes.d.ts.map +1 -0
  182. package/dist/src/tui/theme/themes.js +13 -0
  183. package/dist/src/tui/theme/themes.js.map +1 -0
  184. package/dist/src/tui/ui/Dialog.d.ts +19 -0
  185. package/dist/src/tui/ui/Dialog.d.ts.map +1 -0
  186. package/dist/src/tui/ui/Dialog.js +39 -0
  187. package/dist/src/tui/ui/Dialog.js.map +1 -0
  188. package/dist/src/tui/ui/DialogCommand.d.ts +2 -0
  189. package/dist/src/tui/ui/DialogCommand.d.ts.map +1 -0
  190. package/dist/src/tui/ui/DialogCommand.js +182 -0
  191. package/dist/src/tui/ui/DialogCommand.js.map +1 -0
  192. package/dist/src/tui/ui/DialogCreatePR.d.ts +2 -0
  193. package/dist/src/tui/ui/DialogCreatePR.d.ts.map +1 -0
  194. package/dist/src/tui/ui/DialogCreatePR.js +397 -0
  195. package/dist/src/tui/ui/DialogCreatePR.js.map +1 -0
  196. package/dist/src/tui/ui/DialogHelp.d.ts +6 -0
  197. package/dist/src/tui/ui/DialogHelp.d.ts.map +1 -0
  198. package/dist/src/tui/ui/DialogHelp.js +93 -0
  199. package/dist/src/tui/ui/DialogHelp.js.map +1 -0
  200. package/dist/src/tui/ui/DialogTheme.d.ts +2 -0
  201. package/dist/src/tui/ui/DialogTheme.d.ts.map +1 -0
  202. package/dist/src/tui/ui/DialogTheme.js +124 -0
  203. package/dist/src/tui/ui/DialogTheme.js.map +1 -0
  204. package/dist/src/tui/ui/index.d.ts +6 -0
  205. package/dist/src/tui/ui/index.d.ts.map +1 -0
  206. package/dist/src/tui/ui/index.js +6 -0
  207. package/dist/src/tui/ui/index.js.map +1 -0
  208. package/dist/src/tui/utils/prTemplates.d.ts +19 -0
  209. package/dist/src/tui/utils/prTemplates.d.ts.map +1 -0
  210. package/dist/src/tui/utils/prTemplates.js +46 -0
  211. package/dist/src/tui/utils/prTemplates.js.map +1 -0
  212. package/dist/test/ConfigService.test.d.ts +2 -0
  213. package/dist/test/ConfigService.test.d.ts.map +1 -0
  214. package/dist/test/ConfigService.test.js +40 -0
  215. package/dist/test/ConfigService.test.js.map +1 -0
  216. package/dist/test/ListBuilder.test.d.ts +2 -0
  217. package/dist/test/ListBuilder.test.d.ts.map +1 -0
  218. package/dist/test/ListBuilder.test.js +246 -0
  219. package/dist/test/ListBuilder.test.js.map +1 -0
  220. package/dist/test/MainList.test.d.ts +2 -0
  221. package/dist/test/MainList.test.d.ts.map +1 -0
  222. package/dist/test/MainList.test.js +228 -0
  223. package/dist/test/MainList.test.js.map +1 -0
  224. package/dist/test/Resolver.test.d.ts +2 -0
  225. package/dist/test/Resolver.test.d.ts.map +1 -0
  226. package/dist/test/Resolver.test.js +81 -0
  227. package/dist/test/Resolver.test.js.map +1 -0
  228. package/dist/test/Table.test.d.ts +2 -0
  229. package/dist/test/Table.test.d.ts.map +1 -0
  230. package/dist/test/Table.test.js +100 -0
  231. package/dist/test/Table.test.js.map +1 -0
  232. package/dist/tsconfig.tsbuildinfo +1 -0
  233. package/package.json +50 -0
@@ -0,0 +1,40 @@
1
+ export const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
2
+ export const VIEW_TITLES = {
3
+ prs: "CodeCommit PRs",
4
+ settings: "Manage Accounts",
5
+ notifications: "Notifications",
6
+ details: "PR Details"
7
+ };
8
+ export const HINTS = {
9
+ prs: "Enter: Details | o: Open | f: Filter | 1-4: Quick Filter | r: Refresh | s: Settings | n: Notifications | q: Quit",
10
+ settings: "Space: Toggle | Enter: Save & Return | r: Refresh | s: PRs | t: Theme | n: Notifications | q: Quit",
11
+ notifications: "Enter: Action | r: Refresh | s: Settings | t: Theme | c: Clear | n: PRs | q: Quit",
12
+ details: "Esc: Back | Enter: Open/Copy"
13
+ };
14
+ export const COMMON_HELP = " r - Refresh everything\n" +
15
+ " t - Toggle theme\n" +
16
+ " h - Toggle help\n" +
17
+ " q - Quit\n" +
18
+ " Esc - Close help / Clear filter";
19
+ export const HELP_CONTENT = {
20
+ prs: " f - Filter PRs\n" +
21
+ " 1-4 - Quick filters (All/Mine/Account/Author)\n" +
22
+ " ←→ - Cycle filter values\n" +
23
+ " Enter - PR Details\n" +
24
+ " o - Open PR in browser\n" +
25
+ " s - Manage Accounts\n" +
26
+ " n - Notifications",
27
+ settings: " Enter - Toggle account sync\n" +
28
+ " s - Back to PRs\n" +
29
+ " n - Notifications",
30
+ notifications: " Enter - Run action\n" +
31
+ " c - Clear all\n" +
32
+ " s - Manage Accounts\n" +
33
+ " n - Back to PRs"
34
+ };
35
+ export const SETTINGS_LEGEND = "\n\n" +
36
+ " Status Icons:\n" +
37
+ " ● - Active & Synced\n" +
38
+ " ○ - Disabled\n" +
39
+ " ⚠ - Error fetching";
40
+ //# sourceMappingURL=Constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../src/tui/Constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAEhF,MAAM,CAAC,MAAM,WAAW,GAA2B;IACjD,GAAG,EAAE,gBAAgB;IACrB,QAAQ,EAAE,iBAAiB;IAC3B,aAAa,EAAE,eAAe;IAC9B,OAAO,EAAE,YAAY;CACtB,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAA2B;IAC3C,GAAG,EACD,kHAAkH;IACpH,QAAQ,EAAE,oGAAoG;IAC9G,aAAa,EAAE,mFAAmF;IAClG,OAAO,EAAE,8BAA8B;CACxC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,kCAAkC;IAC3D,4BAA4B;IAC5B,2BAA2B;IAC3B,oBAAoB;IACpB,uCAAuC,CAAA;AAEzC,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,GAAG,EAAE,0BAA0B;QAC7B,uDAAuD;QACvD,mCAAmC;QACnC,0BAA0B;QAC1B,kCAAkC;QAClC,+BAA+B;QAC/B,2BAA2B;IAC7B,QAAQ,EAAE,mCAAmC;QAC3C,2BAA2B;QAC3B,2BAA2B;IAC7B,aAAa,EAAE,0BAA0B;QACvC,yBAAyB;QACzB,+BAA+B;QAC/B,yBAAyB;CAC5B,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM;IACnC,mBAAmB;IACnB,yBAAyB;IACzB,kBAAkB;IAClB,sBAAsB,CAAA"}
@@ -0,0 +1,32 @@
1
+ import type { Domain } from "@knpkv/codecommit-core";
2
+ import type { QuickFilterType } from "./atoms/ui.js";
3
+ export type TuiView = "prs" | "settings" | "notifications" | "details";
4
+ /**
5
+ * Extract scope from title. Supports:
6
+ * - Conventional commit: feat(scope): message -> scope
7
+ * - Jira-style ticket: RPS-123: message -> RPS-123
8
+ */
9
+ export declare const extractScope: (title: string) => string | null;
10
+ export type ListItem = {
11
+ type: "header";
12
+ label: string;
13
+ count: number;
14
+ } | {
15
+ type: "pr";
16
+ pr: Domain.PullRequest;
17
+ } | {
18
+ type: "empty";
19
+ } | {
20
+ type: "account";
21
+ account: Domain.AppState["accounts"][number];
22
+ } | {
23
+ type: "notification";
24
+ notification: Domain.NotificationItem;
25
+ };
26
+ export interface QuickFilter {
27
+ readonly type: QuickFilterType;
28
+ readonly value: string;
29
+ readonly currentUser: string;
30
+ }
31
+ export declare const buildListItems: (state: Domain.AppState, view: TuiView, filterText: string, notifications?: ReadonlyArray<Domain.NotificationItem>, quickFilter?: QuickFilter) => Array<ListItem>;
32
+ //# sourceMappingURL=ListBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListBuilder.d.ts","sourceRoot":"","sources":["../../../src/tui/ListBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAEpD,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,UAAU,GAAG,eAAe,GAAG,SAAS,CAAA;AAEtE;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,MAAM,GAAG,IAUrD,CAAA;AAwBD,MAAM,MAAM,QAAQ,GAChB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC,WAAW,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAA;CAAE,GACjE;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC,gBAAgB,CAAA;CAAE,CAAA;AAEnE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B;AAkBD,eAAO,MAAM,cAAc,GACzB,OAAO,MAAM,CAAC,QAAQ,EACtB,MAAM,OAAO,EACb,YAAY,MAAM,EAClB,gBAAe,aAAa,CAAC,MAAM,CAAC,gBAAgB,CAAM,EAC1D,cAAc,WAAW,KACxB,KAAK,CAAC,QAAQ,CAqGhB,CAAA"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Extract scope from title. Supports:
3
+ * - Conventional commit: feat(scope): message -> scope
4
+ * - Jira-style ticket: RPS-123: message -> RPS-123
5
+ */
6
+ export const extractScope = (title) => {
7
+ // Conventional commit: feat(scope): message
8
+ const conventional = title.match(/^\w+\(([^)]+)\):/);
9
+ if (conventional?.[1])
10
+ return conventional[1];
11
+ // Jira-style: ABC-123: message
12
+ const jira = title.match(/^([A-Z]+-\d+):/);
13
+ if (jira?.[1])
14
+ return jira[1];
15
+ return null;
16
+ };
17
+ /**
18
+ * Check if date matches filter value (using relative days)
19
+ */
20
+ const matchesDateFilter = (date, filterValue) => {
21
+ const now = Date.now();
22
+ const dateMs = date.getTime();
23
+ const dayMs = 24 * 60 * 60 * 1000;
24
+ switch (filterValue) {
25
+ case "today":
26
+ return now - dateMs < dayMs;
27
+ case "week":
28
+ return now - dateMs < 7 * dayMs;
29
+ case "month":
30
+ return now - dateMs < 30 * dayMs;
31
+ case "older":
32
+ return now - dateMs >= 30 * dayMs;
33
+ default:
34
+ return true;
35
+ }
36
+ };
37
+ const applyTextFilter = (prs, filterText) => {
38
+ if (!filterText)
39
+ return [...prs];
40
+ const search = filterText.toLowerCase();
41
+ return prs.filter((pr) => pr.repositoryName.toLowerCase().includes(search) ||
42
+ pr.title.toLowerCase().includes(search) ||
43
+ pr.author.toLowerCase().includes(search) ||
44
+ pr.sourceBranch.toLowerCase().includes(search) ||
45
+ pr.destinationBranch.toLowerCase().includes(search) ||
46
+ pr.id.toLowerCase().includes(search) ||
47
+ (pr.description?.toLowerCase().includes(search) ?? false) ||
48
+ pr.account.id.toLowerCase().includes(search) ||
49
+ pr.account.region.toLowerCase().includes(search));
50
+ };
51
+ export const buildListItems = (state, view, filterText, notifications = [], quickFilter) => {
52
+ if (view === "prs" || view === "details") {
53
+ const enabledAccounts = state.accounts.filter((a) => a.enabled);
54
+ const prsByAccount = enabledAccounts.map((acc) => {
55
+ const prs = state.pullRequests.filter((pr) => pr.account.id === acc.profile);
56
+ const mostRecent = prs.length > 0
57
+ ? Math.max(...prs.map((p) => p.creationDate.getTime()))
58
+ : 0;
59
+ return { acc, prs, mostRecent };
60
+ });
61
+ const filteredGroups = prsByAccount.map((group) => {
62
+ let filteredPRs = group.prs;
63
+ // Apply quick filter first
64
+ if (quickFilter && quickFilter.type !== "all") {
65
+ filteredPRs = filteredPRs.filter((pr) => {
66
+ switch (quickFilter.type) {
67
+ case "mine":
68
+ // Filter by current user AND selected scope
69
+ if (pr.author !== quickFilter.currentUser)
70
+ return false;
71
+ return extractScope(pr.title) === quickFilter.value;
72
+ case "account":
73
+ return pr.account.id === quickFilter.value;
74
+ case "author":
75
+ return pr.author === quickFilter.value;
76
+ case "scope":
77
+ return extractScope(pr.title) === quickFilter.value;
78
+ case "date":
79
+ return matchesDateFilter(pr.creationDate, quickFilter.value);
80
+ case "repo":
81
+ return pr.repositoryName === quickFilter.value;
82
+ case "status":
83
+ switch (quickFilter.value) {
84
+ case "approved":
85
+ return pr.isApproved;
86
+ case "pending":
87
+ return !pr.isApproved;
88
+ case "mergeable":
89
+ return pr.isMergeable;
90
+ case "conflicts":
91
+ return !pr.isMergeable;
92
+ default:
93
+ return true;
94
+ }
95
+ default:
96
+ return true;
97
+ }
98
+ });
99
+ }
100
+ // Apply text filter
101
+ filteredPRs = applyTextFilter(filteredPRs, filterText);
102
+ return { ...group, prs: filteredPRs };
103
+ });
104
+ const sortedGroups = [...filteredGroups].sort((a, b) => {
105
+ if (a.prs.length > 0 && b.prs.length === 0)
106
+ return -1;
107
+ if (a.prs.length === 0 && b.prs.length > 0)
108
+ return 1;
109
+ if (a.prs.length > 0 && b.prs.length > 0)
110
+ return b.mostRecent - a.mostRecent;
111
+ return a.acc.profile.localeCompare(b.acc.profile);
112
+ });
113
+ const items = [];
114
+ for (const group of sortedGroups) {
115
+ items.push({
116
+ type: "header",
117
+ label: group.acc.profile,
118
+ count: group.prs.length
119
+ });
120
+ if (group.prs.length === 0) {
121
+ items.push({ type: "empty" });
122
+ }
123
+ for (const pr of group.prs) {
124
+ items.push({ type: "pr", pr });
125
+ }
126
+ }
127
+ return items;
128
+ }
129
+ if (view === "settings") {
130
+ return state.accounts.map((acc) => {
131
+ return {
132
+ type: "account",
133
+ account: acc
134
+ };
135
+ });
136
+ }
137
+ if (view === "notifications") {
138
+ return notifications.map((n) => ({
139
+ type: "notification",
140
+ notification: n
141
+ }));
142
+ }
143
+ return [];
144
+ };
145
+ //# sourceMappingURL=ListBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListBuilder.js","sourceRoot":"","sources":["../../../src/tui/ListBuilder.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAiB,EAAE;IAC3D,4CAA4C;IAC5C,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAA;IACpD,IAAI,YAAY,EAAE,CAAC,CAAC,CAAC;QAAE,OAAO,YAAY,CAAC,CAAC,CAAC,CAAA;IAE7C,+BAA+B;IAC/B,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAA;IAC1C,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,CAAC,CAAA;IAE7B,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,iBAAiB,GAAG,CAAC,IAAU,EAAE,WAAmB,EAAW,EAAE;IACrE,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IACtB,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,CAAA;IAC7B,MAAM,KAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IAEjC,Q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C,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAA;YAChC,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YAChC,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,GAAG;aACb,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,IAAI,KAAK,eAAe,EAAE,CAAC;QAC7B,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC/B,IAAI,EAAE,cAAc;YACpB,YAAY,EAAE,CAAC;SAChB,CAAC,CAAC,CAAA;IACL,CAAC;IAED,OAAO,EAAE,CAAA;AACX,CAAC,CAAA"}
@@ -0,0 +1,39 @@
1
+ import { type Domain } from "@knpkv/codecommit-core";
2
+ export interface CreatePRInput {
3
+ readonly repositoryName: string;
4
+ readonly title: string;
5
+ readonly description?: string;
6
+ readonly sourceBranch: string;
7
+ readonly destinationBranch: string;
8
+ readonly account: Domain.Account;
9
+ }
10
+ export interface ListBranchesInput {
11
+ readonly repositoryName: string;
12
+ readonly account: Domain.Account;
13
+ }
14
+ /**
15
+ * Log in to AWS SSO
16
+ * @category atoms
17
+ */
18
+ export declare const loginToAwsAtom: import("@effect-atom/atom/Atom").AtomResultFn<string & import("effect/Brand").Brand<"AwsProfileName">, void, never>;
19
+ /**
20
+ * Copies PR link and runs assume -c for the profile
21
+ * @category atoms
22
+ */
23
+ export declare const openPrAtom: import("@effect-atom/atom/Atom").AtomResultFn<Domain.PullRequest, void, never>;
24
+ /**
25
+ * Opens a URL in the default browser
26
+ * @category atoms
27
+ */
28
+ export declare const openBrowserAtom: import("@effect-atom/atom/Atom").AtomResultFn<string, void, never>;
29
+ /**
30
+ * Create a new pull request
31
+ * @category atoms
32
+ */
33
+ export declare const createPrAtom: import("@effect-atom/atom/Atom").AtomResultFn<CreatePRInput, string, never>;
34
+ /**
35
+ * List branches for a repository
36
+ * @category atoms
37
+ */
38
+ export declare const listBranchesAtom: import("@effect-atom/atom/Atom").AtomResultFn<ListBranchesInput, string[], never>;
39
+ //# sourceMappingURL=actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../../src/tui/atoms/actions.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,MAAM,EAA0B,MAAM,wBAAwB,CAAA;AAQvF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAA;CACjC;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAA;CACjC;AAyCD;;;GAGG;AACH,eAAO,MAAM,cAAc,qHA4C1B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,gFAuCtB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,oEAwB3B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,6EAyCxB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,mFAkB5B,CAAA"}
@@ -0,0 +1,149 @@
1
+ import { Command } from "@effect/platform";
2
+ import { AwsClient, PRService } from "@knpkv/codecommit-core";
3
+ import { Effect, Stream } from "effect";
4
+ import { runtimeAtom } from "./runtime.js";
5
+ const isDarwin = process.platform === "darwin";
6
+ const notifyError = (title, error) => Effect.gen(function* () {
7
+ const service = yield* PRService.PRService;
8
+ yield* service.addNotification({
9
+ type: "error",
10
+ title,
11
+ message: error.message
12
+ });
13
+ });
14
+ const copyToClipboard = (text) => Effect.gen(function* () {
15
+ const cmd = isDarwin
16
+ ? Command.make("pbcopy")
17
+ : Command.make("xclip", "-selection", "clipboard");
18
+ yield* Command.exitCode(Command.stdin(cmd, Stream.make(text).pipe(Stream.encodeText)));
19
+ }).pipe(Effect.catchAll((error) => Effect.gen(function* () {
20
+ const service = yield* PRService.PRService;
21
+ yield* service.addNotification({
22
+ type: "error",
23
+ title: "Clipboard",
24
+ message: error instanceof Error ? error.message : String(error)
25
+ });
26
+ })), Effect.withSpan("copyToClipboard"));
27
+ // ---------------------------------------------------------------------------
28
+ // Atoms
29
+ // ---------------------------------------------------------------------------
30
+ /**
31
+ * Log in to AWS SSO
32
+ * @category atoms
33
+ */
34
+ export const loginToAwsAtom = runtimeAtom.fn(Effect.fnUntraced(function* (profile) {
35
+ const service = yield* PRService.PRService;
36
+ if (!profile || profile.trim() === "") {
37
+ yield* service.addNotification({
38
+ type: "error",
39
+ title: "SSO Login",
40
+ message: "No profile specified"
41
+ });
42
+ return;
43
+ }
44
+ yield* service.addNotification({
45
+ type: "info",
46
+ title: "SSO Login",
47
+ message: `Opening browser for ${profile}...`
48
+ });
49
+ const cmd = Command.make("aws", "sso", "login", "--profile", profile).pipe(Command.stdout("inherit"), Command.stderr("inherit"));
50
+ yield* Effect.forkDaemon(Command.exitCode(cmd).pipe(Effect.tap(() => service.addNotification({
51
+ type: "success",
52
+ title: "SSO Login",
53
+ message: `Login complete for ${profile}`
54
+ })), Effect.catchAll((e) => service.addNotification({
55
+ type: "error",
56
+ title: "SSO Login Failed",
57
+ message: e instanceof Error ? e.message : String(e)
58
+ })), Effect.withSpan("loginToAws", { attributes: { profile } })));
59
+ }));
60
+ /**
61
+ * Copies PR link and runs assume -c for the profile
62
+ * @category atoms
63
+ */
64
+ export const openPrAtom = runtimeAtom.fn(Effect.fnUntraced(function* (pr) {
65
+ const service = yield* PRService.PRService;
66
+ const profile = pr.account.id;
67
+ yield* copyToClipboard(pr.link);
68
+ yield* service.addNotification({
69
+ type: "info",
70
+ title: "Assume",
71
+ message: `URL copied. Running assume -c ${profile}...`
72
+ });
73
+ const cmd = Command.make("assume", "-c", profile).pipe(Command.stdout("inherit"), Command.stderr("inherit"), Command.env({ GRANTED_ALIAS_CONFIGURED: "true" }));
74
+ yield* Effect.forkDaemon(Command.exitCode(cmd).pipe(Effect.tap(() => service.addNotification({
75
+ type: "success",
76
+ title: "Assume",
77
+ message: `Assumed ${profile}`
78
+ })), Effect.catchAll((e) => service.addNotification({
79
+ type: "error",
80
+ title: "Assume Failed",
81
+ message: e instanceof Error ? e.message : String(e)
82
+ })), Effect.withSpan("openPr", { attributes: { profile, prId: pr.id } })));
83
+ }));
84
+ /**
85
+ * Opens a URL in the default browser
86
+ * @category atoms
87
+ */
88
+ export const openBrowserAtom = runtimeAtom.fn(Effect.fnUntraced(function* (link) {
89
+ const openCmd = isDarwin ? "open" : "xdg-open";
90
+ const cmd = Command.make(openCmd, link).pipe(Command.stdout("pipe"), Command.stderr("pipe"));
91
+ yield* Command.exitCode(cmd).pipe(Effect.catchAll((error) => Effect.gen(function* () {
92
+ const service = yield* PRService.PRService;
93
+ yield* service.addNotification({
94
+ type: "error",
95
+ title: "Open Browser",
96
+ message: error instanceof Error ? error.message : String(error)
97
+ });
98
+ })), Effect.fork, Effect.asVoid, Effect.withSpan("openBrowser"));
99
+ }));
100
+ /**
101
+ * Create a new pull request
102
+ * @category atoms
103
+ */
104
+ export const createPrAtom = runtimeAtom.fn(Effect.fnUntraced(function* (input) {
105
+ const service = yield* PRService.PRService;
106
+ const awsClient = yield* AwsClient.AwsClient;
107
+ yield* service.addNotification({
108
+ type: "info",
109
+ title: "Creating PR",
110
+ message: `${input.title} in ${input.repositoryName}...`
111
+ });
112
+ const prId = yield* awsClient.createPullRequest({
113
+ account: { profile: input.account.id, region: input.account.region },
114
+ repositoryName: input.repositoryName,
115
+ title: input.title,
116
+ ...(input.description && { description: input.description }),
117
+ sourceReference: input.sourceBranch,
118
+ destinationReference: input.destinationBranch
119
+ }).pipe(Effect.tapError((e) => notifyError("Create PR Failed", e)),
120
+ // Error recovery: AwsClient already retries throttle errors with exponential
121
+ // backoff (see throttleRetry). These catchTags handle exhausted retries
122
+ // and non-retryable errors — notifyError shows the user what happened,
123
+ // then we return a fallback so the UI doesn't crash.
124
+ Effect.catchTag("AwsApiError", () => Effect.succeed("")), Effect.catchTag("AwsCredentialError", () => Effect.succeed("")), Effect.catchTag("AwsThrottleError", () => Effect.succeed("")), Effect.withSpan("createPr", { attributes: { repo: input.repositoryName } }));
125
+ if (prId) {
126
+ yield* service.addNotification({
127
+ type: "success",
128
+ title: "PR Created",
129
+ message: `${input.title} (#${prId})`
130
+ });
131
+ yield* service.refresh;
132
+ }
133
+ return prId;
134
+ }));
135
+ /**
136
+ * List branches for a repository
137
+ * @category atoms
138
+ */
139
+ export const listBranchesAtom = runtimeAtom.fn(Effect.fnUntraced(function* (input) {
140
+ const awsClient = yield* AwsClient.AwsClient;
141
+ const branches = yield* awsClient.listBranches({
142
+ account: { profile: input.account.id, region: input.account.region },
143
+ repositoryName: input.repositoryName
144
+ }).pipe(Effect.tapError((e) => notifyError("List Branches Failed", e)),
145
+ // Exhausted-retry fallbacks — throttle retry happens inside AwsClient
146
+ Effect.catchTag("AwsApiError", () => Effect.succeed([])), Effect.catchTag("AwsCredentialError", () => Effect.succeed([])), Effect.catchTag("AwsThrottleError", () => Effect.succeed([])), Effect.withSpan("listBranches", { attributes: { repo: input.repositoryName } }));
147
+ return branches.sort();
148
+ }));
149
+ //# sourceMappingURL=actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../../src/tui/atoms/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,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,EAAE,CAC5C,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAC,KAAwB;IAClD,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,SAAS,CAAA;IAE5C,MAAM,QAAQ,GAAkB,KAAK,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC;QAC5D,OAAO,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE;QACpE,cAAc,EAAE,KAAK,CAAC,cAAc;KACrC,CAAC,CAAC,IAAI,CACL,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC;IAC9D,sEAAsE;IACtE,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAgB,EAAE,CAAC,CAAC,EACvE,MAAM,CAAC,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAgB,EAAE,CAAC,CAAC,EAC9E,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAgB,EAAE,CAAC,CAAC,EAC5E,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,cAAc,EAAE,EAAE,CAAC,CAChF,CAAA;IAED,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAA;AACxB,CAAC,CAAC,CACH,CAAA"}
@@ -0,0 +1,42 @@
1
+ import { type Domain } from "@knpkv/codecommit-core";
2
+ import { Effect } from "effect";
3
+ /**
4
+ * Subscribes to PRService.state changes
5
+ * @category atoms
6
+ */
7
+ export declare const appStateAtom: import("@effect-atom/atom/Atom").Atom<import("@effect-atom/atom/Result").Result<Domain.AppState, never>>;
8
+ /**
9
+ * Triggers a refresh of pull requests
10
+ * @category atoms
11
+ */
12
+ export declare const refreshAtom: import("@effect-atom/atom/Atom").AtomResultFn<void, void, never>;
13
+ /**
14
+ * Cleanup function to abort pending requests on exit
15
+ */
16
+ export declare const cleanup: Effect.Effect<void, never, never>;
17
+ /**
18
+ * Toggles account enabled state in settings
19
+ * @category atoms
20
+ */
21
+ export declare const toggleAccountAtom: import("@effect-atom/atom/Atom").AtomResultFn<string & import("effect/Brand").Brand<"AwsProfileName">, void, never>;
22
+ /**
23
+ * Sets all accounts to enabled or disabled
24
+ * @category atoms
25
+ */
26
+ export declare const setAllAccountsAtom: import("@effect-atom/atom/Atom").AtomResultFn<{
27
+ enabled: boolean;
28
+ profiles?: Array<Domain.AwsProfileName>;
29
+ }, void, never>;
30
+ /**
31
+ * Clears accumulated notifications
32
+ * @category atoms
33
+ */
34
+ export declare const clearNotificationsAtom: import("@effect-atom/atom/Atom").AtomResultFn<void, void, never>;
35
+ /**
36
+ * Subscribes to NotificationsService.state changes
37
+ * @category atoms
38
+ */
39
+ export declare const notificationsAtom: import("@effect-atom/atom/Atom").Atom<import("@effect-atom/atom/Result").Result<Domain.NotificationsState, never>>;
40
+ export type AppState = Domain.AppState;
41
+ export type NotificationsState = Domain.NotificationsState;
42
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../../src/tui/atoms/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAmC,MAAM,wBAAwB,CAAA;AACrF,OAAO,EAAE,MAAM,EAAS,MAAM,QAAQ,CAAA;AAMtC;;;GAGG;AACH,eAAO,MAAM,YAAY,0GAKxB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,kEAWvB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,OAAO,mCAKlB,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,qHAK7B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB;aACkB,OAAO;eAAa,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC;eAIhG,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,kEAKlC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,oHAK7B,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAA;AACtC,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAA"}
@@ -0,0 +1,69 @@
1
+ import { NotificationsService, PRService } from "@knpkv/codecommit-core";
2
+ import { Effect, Fiber } from "effect";
3
+ import { runtimeAtom } from "./runtime.js";
4
+ // Track active refresh fiber for cleanup
5
+ let activeRefreshFiber = null;
6
+ /**
7
+ * Subscribes to PRService.state changes
8
+ * @category atoms
9
+ */
10
+ export const appStateAtom = runtimeAtom.subscribable(Effect.gen(function* () {
11
+ const prService = yield* PRService.PRService;
12
+ return prService.state;
13
+ }));
14
+ /**
15
+ * Triggers a refresh of pull requests
16
+ * @category atoms
17
+ */
18
+ export const refreshAtom = runtimeAtom.fn(Effect.fnUntraced(function* () {
19
+ // Interrupt previous refresh if still running
20
+ if (activeRefreshFiber) {
21
+ yield* Fiber.interrupt(activeRefreshFiber);
22
+ activeRefreshFiber = null;
23
+ }
24
+ const prService = yield* PRService.PRService;
25
+ // Use forkDaemon so it survives parent scope, but track for cleanup
26
+ activeRefreshFiber = yield* Effect.forkDaemon(prService.refresh);
27
+ }));
28
+ /**
29
+ * Cleanup function to abort pending requests on exit
30
+ */
31
+ export const cleanup = Effect.gen(function* () {
32
+ if (activeRefreshFiber) {
33
+ yield* Fiber.interrupt(activeRefreshFiber);
34
+ activeRefreshFiber = null;
35
+ }
36
+ });
37
+ /**
38
+ * Toggles account enabled state in settings
39
+ * @category atoms
40
+ */
41
+ export const toggleAccountAtom = runtimeAtom.fn(Effect.fnUntraced(function* (profile) {
42
+ const prService = yield* PRService.PRService;
43
+ yield* Effect.forkDaemon(prService.toggleAccount(profile));
44
+ }));
45
+ /**
46
+ * Sets all accounts to enabled or disabled
47
+ * @category atoms
48
+ */
49
+ export const setAllAccountsAtom = runtimeAtom.fn(Effect.fnUntraced(function* (params) {
50
+ const prService = yield* PRService.PRService;
51
+ yield* Effect.forkDaemon(prService.setAllAccounts(params.enabled, params.profiles));
52
+ }));
53
+ /**
54
+ * Clears accumulated notifications
55
+ * @category atoms
56
+ */
57
+ export const clearNotificationsAtom = runtimeAtom.fn(Effect.fnUntraced(function* () {
58
+ const prService = yield* PRService.PRService;
59
+ yield* prService.clearNotifications;
60
+ }));
61
+ /**
62
+ * Subscribes to NotificationsService.state changes
63
+ * @category atoms
64
+ */
65
+ export const notificationsAtom = runtimeAtom.subscribable(Effect.gen(function* () {
66
+ const notificationsService = yield* NotificationsService.NotificationsService;
67
+ return notificationsService.state;
68
+ }));
69
+ //# sourceMappingURL=app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../src/tui/atoms/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,oBAAoB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACrF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,yCAAyC;AACzC,IAAI,kBAAkB,GAA6C,IAAI,CAAA;AAEvE;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC,YAAY,CAClD,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,SAAS,CAAA;IAC5C,OAAO,SAAS,CAAC,KAAK,CAAA;AACxB,CAAC,CAAC,CACH,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC,EAAE,CACvC,MAAM,CAAC,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C,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAA;AACrF,CAAC,CAAC,CACH,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAAC,EAAE,CAClD,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC;IACzB,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,SAAS,CAAA;IAC5C,KAAK,CAAC,CAAC,SAAS,CAAC,kBAAkB,CAAA;AACrC,CAAC,CAAC,CACH,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC,YAAY,CACvD,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,oBAAoB,GAAG,KAAK,CAAC,CAAC,oBAAoB,CAAC,oBAAoB,CAAA;IAC7E,OAAO,oBAAoB,CAAC,KAAK,CAAA;AACnC,CAAC,CAAC,CACH,CAAA"}
@@ -0,0 +1,6 @@
1
+ export { runtimeAtom } from "./runtime.js";
2
+ export { appStateAtom, refreshAtom, toggleAccountAtom } from "./app.js";
3
+ export type { AppState } from "./app.js";
4
+ export { currentPRAtom, currentUserAtom, filterTextAtom, isFilteringAtom, quickFilterTypeAtom, quickFilterValueAtom, quickFilterValuesAtom, selectedIndexAtom, selectedPrIdAtom, showHelpAtom, viewAtom } from "./ui.js";
5
+ export type { QuickFilterType, TuiView } from "./ui.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tui/atoms/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAG1C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AACvE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGxC,OAAO,EACL,aAAa,EACb,eAAe,EACf,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACT,MAAM,SAAS,CAAA;AAChB,YAAY,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA"}
@@ -0,0 +1,7 @@
1
+ // Runtime
2
+ export { runtimeAtom } from "./runtime.js";
3
+ // App state
4
+ export { appStateAtom, refreshAtom, toggleAccountAtom } from "./app.js";
5
+ // UI state
6
+ export { currentPRAtom, currentUserAtom, filterTextAtom, isFilteringAtom, quickFilterTypeAtom, quickFilterValueAtom, quickFilterValuesAtom, selectedIndexAtom, selectedPrIdAtom, showHelpAtom, viewAtom } from "./ui.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tui/atoms/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,YAAY;AACZ,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAGvE,WAAW;AACX,OAAO,EACL,aAAa,EACb,eAAe,EACf,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACT,MAAM,SAAS,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { Atom } from "@effect-atom/atom-react";
2
+ import { BunContext } from "@effect/platform-bun";
3
+ import { AwsClient, NotificationsService, PRService } from "@knpkv/codecommit-core";
4
+ /**
5
+ * Runtime atom providing Effect services to other atoms
6
+ * @category atoms
7
+ */
8
+ export declare const runtimeAtom: Atom.AtomRuntime<AwsClient.AwsClient | NotificationsService.NotificationsService | PRService.PRService | BunContext.BunContext, never>;
9
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/tui/atoms/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAkC,oBAAoB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AA2BnH;;;GAGG;AACH,eAAO,MAAM,WAAW,wIAAyB,CAAA"}
@@ -0,0 +1,22 @@
1
+ import { Atom } from "@effect-atom/atom-react";
2
+ import { FetchHttpClient } from "@effect/platform";
3
+ import { BunContext } from "@effect/platform-bun";
4
+ import { AwsClient, AwsClientConfig, ConfigService, NotificationsService, PRService } from "@knpkv/codecommit-core";
5
+ import { Layer } from "effect";
6
+ // ConfigServiceLive needs FileSystem from BunContext
7
+ const ConfigLayer = ConfigService.ConfigServiceLive.pipe(Layer.provide(BunContext.layer));
8
+ // PRService layer with its dependencies
9
+ const PRLayer = PRService.PRServiceLive.pipe(Layer.provide(AwsClient.AwsClientLive), Layer.provide(ConfigLayer), Layer.provide(NotificationsService.NotificationsServiceLive));
10
+ // Merge PRLayer with NotificationsServiceLive so both PRService and notificationsAtom
11
+ // can access notifications. Effect automatically memoizes layers.
12
+ const MainLayer = Layer.merge(PRLayer, NotificationsService.NotificationsServiceLive);
13
+ // Also expose AwsClient directly for atoms that need it (listBranchesAtom, etc.)
14
+ const MainWithAwsLayer = Layer.merge(MainLayer, AwsClient.AwsClientLive);
15
+ // Wire leaf dependencies, then merge BunContext for CommandExecutor/Terminal/Path
16
+ const AppLayer = MainWithAwsLayer.pipe(Layer.provideMerge(BunContext.layer), Layer.provide(FetchHttpClient.layer), Layer.provide(AwsClientConfig.Default));
17
+ /**
18
+ * Runtime atom providing Effect services to other atoms
19
+ * @category atoms
20
+ */
21
+ export const runtimeAtom = Atom.runtime(AppLayer);
22
+ //# sourceMappingURL=runtime.js.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