@t1mmen/srtd 0.3.0 → 0.4.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 (186) hide show
  1. package/README.md +85 -118
  2. package/dist/package.json +97 -0
  3. package/dist/src/__tests__/apply.test.js +69 -0
  4. package/dist/src/__tests__/apply.test.js.map +1 -0
  5. package/dist/src/__tests__/build.test.js +67 -0
  6. package/dist/src/__tests__/build.test.js.map +1 -0
  7. package/dist/{__tests__ → src/__tests__}/vitest.setup.js +41 -25
  8. package/dist/src/__tests__/vitest.setup.js.map +1 -0
  9. package/dist/{__tests__ → src/__tests__}/watch.test.js +9 -3
  10. package/dist/src/__tests__/watch.test.js.map +1 -0
  11. package/dist/src/cli.js.map +1 -0
  12. package/dist/src/commands/_app.js +29 -0
  13. package/dist/src/commands/_app.js.map +1 -0
  14. package/dist/{commands → src/commands}/apply.d.ts +2 -1
  15. package/dist/src/commands/apply.js +30 -0
  16. package/dist/src/commands/apply.js.map +1 -0
  17. package/dist/{commands → src/commands}/build.d.ts +5 -1
  18. package/dist/src/commands/build.js +41 -0
  19. package/dist/src/commands/build.js.map +1 -0
  20. package/dist/src/commands/clear.d.ts +2 -0
  21. package/dist/src/commands/clear.js +45 -0
  22. package/dist/src/commands/clear.js.map +1 -0
  23. package/dist/{commands → src/commands}/index.js +11 -5
  24. package/dist/src/commands/index.js.map +1 -0
  25. package/dist/src/commands/init.js.map +1 -0
  26. package/dist/{commands → src/commands}/register.js +6 -5
  27. package/dist/src/commands/register.js.map +1 -0
  28. package/dist/{commands → src/commands}/watch.js +61 -33
  29. package/dist/src/commands/watch.js.map +1 -0
  30. package/dist/{components → src/components}/Branding.js +7 -7
  31. package/dist/src/components/Branding.js.map +1 -0
  32. package/dist/src/components/Debug.d.ts +2 -0
  33. package/dist/src/components/Debug.js +160 -0
  34. package/dist/src/components/Debug.js.map +1 -0
  35. package/dist/src/components/ProcessingResults.d.ts +9 -0
  36. package/dist/src/components/ProcessingResults.js +32 -0
  37. package/dist/src/components/ProcessingResults.js.map +1 -0
  38. package/dist/{components → src/components}/Quittable.js +1 -1
  39. package/dist/src/components/Quittable.js.map +1 -0
  40. package/dist/src/components/TimeSince.js.map +1 -0
  41. package/dist/src/components/customTheme.d.ts +10 -0
  42. package/dist/src/components/customTheme.js +66 -0
  43. package/dist/src/components/customTheme.js.map +1 -0
  44. package/dist/src/constants.js.map +1 -0
  45. package/dist/src/hooks/useDatabaseConnection.js +57 -0
  46. package/dist/src/hooks/useDatabaseConnection.js.map +1 -0
  47. package/dist/{hooks → src/hooks}/useTemplateManager.d.ts +6 -8
  48. package/dist/src/hooks/useTemplateManager.js +124 -0
  49. package/dist/src/hooks/useTemplateManager.js.map +1 -0
  50. package/dist/src/hooks/useTemplateProcessor.d.ts +11 -0
  51. package/dist/src/hooks/useTemplateProcessor.js +71 -0
  52. package/dist/src/hooks/useTemplateProcessor.js.map +1 -0
  53. package/dist/src/hooks/useTemplateState.js.map +1 -0
  54. package/dist/{lib → src/lib}/templateManager.d.ts +13 -2
  55. package/dist/{lib → src/lib}/templateManager.js +172 -50
  56. package/dist/src/lib/templateManager.js.map +1 -0
  57. package/dist/src/lib/templateManager.test.js +729 -0
  58. package/dist/src/lib/templateManager.test.js.map +1 -0
  59. package/dist/{types.d.ts → src/types.d.ts} +3 -0
  60. package/dist/src/types.js.map +1 -0
  61. package/dist/src/utils/applyMigration.js.map +1 -0
  62. package/dist/src/utils/applyMigrations.test.js.map +1 -0
  63. package/dist/src/utils/calculateMD5.js.map +1 -0
  64. package/dist/{utils → src/utils}/config.d.ts +2 -0
  65. package/dist/src/utils/config.js +65 -0
  66. package/dist/src/utils/config.js.map +1 -0
  67. package/dist/src/utils/config.test.js.map +1 -0
  68. package/dist/src/utils/createEmptyBuildLog.js.map +1 -0
  69. package/dist/{utils → src/utils}/databaseConnection.d.ts +5 -0
  70. package/dist/{utils → src/utils}/databaseConnection.js +40 -13
  71. package/dist/src/utils/databaseConnection.js.map +1 -0
  72. package/dist/src/utils/databaseConnection.test.d.ts +1 -0
  73. package/dist/src/utils/databaseConnection.test.js.map +1 -0
  74. package/dist/src/utils/ensureDirectories.js.map +1 -0
  75. package/dist/src/utils/fileExists.js.map +1 -0
  76. package/dist/src/utils/getNextTimestamp.js.map +1 -0
  77. package/dist/src/utils/isWipTemplate.js.map +1 -0
  78. package/dist/src/utils/loadBuildLog.js.map +1 -0
  79. package/dist/src/utils/loadBuildLog.test.d.ts +1 -0
  80. package/dist/src/utils/loadBuildLog.test.js.map +1 -0
  81. package/dist/src/utils/logger.js.map +1 -0
  82. package/dist/src/utils/registerTemplate.js.map +1 -0
  83. package/dist/src/utils/safeCreate.js.map +1 -0
  84. package/dist/src/utils/saveBuildLog.js.map +1 -0
  85. package/dist/src/utils/store.d.ts +5 -0
  86. package/dist/src/utils/store.js +10 -0
  87. package/dist/src/utils/store.js.map +1 -0
  88. package/package.json +4 -3
  89. package/dist/__tests__/vitest.setup.js.map +0 -1
  90. package/dist/__tests__/watch.test.js.map +0 -1
  91. package/dist/cli.js.map +0 -1
  92. package/dist/commands/_app.js +0 -27
  93. package/dist/commands/_app.js.map +0 -1
  94. package/dist/commands/apply.js +0 -32
  95. package/dist/commands/apply.js.map +0 -1
  96. package/dist/commands/build.js +0 -25
  97. package/dist/commands/build.js.map +0 -1
  98. package/dist/commands/index.js.map +0 -1
  99. package/dist/commands/init.js.map +0 -1
  100. package/dist/commands/register.js.map +0 -1
  101. package/dist/commands/watch.js.map +0 -1
  102. package/dist/components/Branding.js.map +0 -1
  103. package/dist/components/Quittable.js.map +0 -1
  104. package/dist/components/TimeSince.js.map +0 -1
  105. package/dist/constants.js.map +0 -1
  106. package/dist/hooks/useDatabaseConnection.js +0 -68
  107. package/dist/hooks/useDatabaseConnection.js.map +0 -1
  108. package/dist/hooks/useTemplateManager.js +0 -141
  109. package/dist/hooks/useTemplateManager.js.map +0 -1
  110. package/dist/hooks/useTemplateState.js.map +0 -1
  111. package/dist/lib/templateManager.js.map +0 -1
  112. package/dist/lib/templateManager.test.js +0 -289
  113. package/dist/lib/templateManager.test.js.map +0 -1
  114. package/dist/types.js.map +0 -1
  115. package/dist/utils/applyMigration.js.map +0 -1
  116. package/dist/utils/applyMigrations.test.js.map +0 -1
  117. package/dist/utils/calculateMD5.js.map +0 -1
  118. package/dist/utils/config.js +0 -79
  119. package/dist/utils/config.js.map +0 -1
  120. package/dist/utils/config.test.js.map +0 -1
  121. package/dist/utils/createEmptyBuildLog.js.map +0 -1
  122. package/dist/utils/databaseConnection.js.map +0 -1
  123. package/dist/utils/databaseConnection.test.js.map +0 -1
  124. package/dist/utils/ensureDirectories.js.map +0 -1
  125. package/dist/utils/fileExists.js.map +0 -1
  126. package/dist/utils/getNextTimestamp.js.map +0 -1
  127. package/dist/utils/isWipTemplate.js.map +0 -1
  128. package/dist/utils/loadBuildLog.js.map +0 -1
  129. package/dist/utils/loadBuildLog.test.js.map +0 -1
  130. package/dist/utils/logger.js.map +0 -1
  131. package/dist/utils/registerTemplate.js.map +0 -1
  132. package/dist/utils/safeCreate.js.map +0 -1
  133. package/dist/utils/saveBuildLog.js.map +0 -1
  134. /package/dist/{__tests__/watch.test.d.ts → src/__tests__/apply.test.d.ts} +0 -0
  135. /package/dist/{lib/templateManager.test.d.ts → src/__tests__/build.test.d.ts} +0 -0
  136. /package/dist/{__tests__ → src/__tests__}/vitest.setup.d.ts +0 -0
  137. /package/dist/{utils/applyMigrations.test.d.ts → src/__tests__/watch.test.d.ts} +0 -0
  138. /package/dist/{cli.d.ts → src/cli.d.ts} +0 -0
  139. /package/dist/{cli.js → src/cli.js} +0 -0
  140. /package/dist/{commands → src/commands}/_app.d.ts +0 -0
  141. /package/dist/{commands → src/commands}/index.d.ts +0 -0
  142. /package/dist/{commands → src/commands}/init.d.ts +0 -0
  143. /package/dist/{commands → src/commands}/init.js +0 -0
  144. /package/dist/{commands → src/commands}/register.d.ts +0 -0
  145. /package/dist/{commands → src/commands}/watch.d.ts +0 -0
  146. /package/dist/{components → src/components}/Branding.d.ts +0 -0
  147. /package/dist/{components → src/components}/Quittable.d.ts +0 -0
  148. /package/dist/{components → src/components}/TimeSince.d.ts +0 -0
  149. /package/dist/{components → src/components}/TimeSince.js +0 -0
  150. /package/dist/{constants.d.ts → src/constants.d.ts} +0 -0
  151. /package/dist/{constants.js → src/constants.js} +0 -0
  152. /package/dist/{hooks → src/hooks}/useDatabaseConnection.d.ts +0 -0
  153. /package/dist/{hooks → src/hooks}/useTemplateState.d.ts +0 -0
  154. /package/dist/{hooks → src/hooks}/useTemplateState.js +0 -0
  155. /package/dist/{utils/config.test.d.ts → src/lib/templateManager.test.d.ts} +0 -0
  156. /package/dist/{types.js → src/types.js} +0 -0
  157. /package/dist/{utils → src/utils}/applyMigration.d.ts +0 -0
  158. /package/dist/{utils → src/utils}/applyMigration.js +0 -0
  159. /package/dist/{utils/databaseConnection.test.d.ts → src/utils/applyMigrations.test.d.ts} +0 -0
  160. /package/dist/{utils → src/utils}/applyMigrations.test.js +0 -0
  161. /package/dist/{utils → src/utils}/calculateMD5.d.ts +0 -0
  162. /package/dist/{utils → src/utils}/calculateMD5.js +0 -0
  163. /package/dist/{utils/loadBuildLog.test.d.ts → src/utils/config.test.d.ts} +0 -0
  164. /package/dist/{utils → src/utils}/config.test.js +0 -0
  165. /package/dist/{utils → src/utils}/createEmptyBuildLog.d.ts +0 -0
  166. /package/dist/{utils → src/utils}/createEmptyBuildLog.js +0 -0
  167. /package/dist/{utils → src/utils}/databaseConnection.test.js +0 -0
  168. /package/dist/{utils → src/utils}/ensureDirectories.d.ts +0 -0
  169. /package/dist/{utils → src/utils}/ensureDirectories.js +0 -0
  170. /package/dist/{utils → src/utils}/fileExists.d.ts +0 -0
  171. /package/dist/{utils → src/utils}/fileExists.js +0 -0
  172. /package/dist/{utils → src/utils}/getNextTimestamp.d.ts +0 -0
  173. /package/dist/{utils → src/utils}/getNextTimestamp.js +0 -0
  174. /package/dist/{utils → src/utils}/isWipTemplate.d.ts +0 -0
  175. /package/dist/{utils → src/utils}/isWipTemplate.js +0 -0
  176. /package/dist/{utils → src/utils}/loadBuildLog.d.ts +0 -0
  177. /package/dist/{utils → src/utils}/loadBuildLog.js +0 -0
  178. /package/dist/{utils → src/utils}/loadBuildLog.test.js +0 -0
  179. /package/dist/{utils → src/utils}/logger.d.ts +0 -0
  180. /package/dist/{utils → src/utils}/logger.js +0 -0
  181. /package/dist/{utils → src/utils}/registerTemplate.d.ts +0 -0
  182. /package/dist/{utils → src/utils}/registerTemplate.js +0 -0
  183. /package/dist/{utils → src/utils}/safeCreate.d.ts +0 -0
  184. /package/dist/{utils → src/utils}/safeCreate.js +0 -0
  185. /package/dist/{utils → src/utils}/saveBuildLog.d.ts +0 -0
  186. /package/dist/{utils → src/utils}/saveBuildLog.js +0 -0
@@ -0,0 +1,29 @@
1
+ // src/commands/_app.tsx
2
+ import { Alert, ThemeProvider } from '@inkjs/ui';
3
+ import Debug from 'components/Debug.js';
4
+ import { Box, Static, Text } from 'ink';
5
+ import React from 'react';
6
+ import { COLOR_ERROR, customTheme } from '../components/customTheme.js';
7
+ import { useDatabaseConnection } from '../hooks/useDatabaseConnection.js';
8
+ export default function App({ Component, commandProps }) {
9
+ const { error } = useDatabaseConnection();
10
+ return (React.createElement(ThemeProvider, { theme: customTheme },
11
+ React.createElement(Box, { flexDirection: "column", padding: 1 },
12
+ !!error && (React.createElement(Static, { items: [error] }, error => (React.createElement(Box, { key: error },
13
+ React.createElement(Alert, { variant: "error" },
14
+ React.createElement(Text, { bold: true, color: COLOR_ERROR },
15
+ "Error:",
16
+ ' '),
17
+ error))))),
18
+ React.createElement(Component, { ...commandProps }),
19
+ React.createElement(Debug, null))));
20
+ }
21
+ // Fullscreen behavior
22
+ const enterAltScreenCommand = '\x1b[?1049h';
23
+ const leaveAltScreenCommand = '\x1b[?1049l';
24
+ process.stdout.write(enterAltScreenCommand);
25
+ const cleanup = () => {
26
+ process.stdout.write(leaveAltScreenCommand);
27
+ };
28
+ process.on('exit', cleanup);
29
+ //# sourceMappingURL=_app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_app.js","sourceRoot":"","sources":["../../../src/commands/_app.tsx"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAExC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,MAAM,CAAC,OAAO,UAAU,GAAG,CAAC,EAAE,SAAS,EAAE,YAAY,EAAY;IAC/D,MAAM,EAAE,KAAK,EAAE,GAAG,qBAAqB,EAAE,CAAC;IAE1C,OAAO,CACL,oBAAC,aAAa,IAAC,KAAK,EAAE,WAAW;QAC/B,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,OAAO,EAAE,CAAC;YACnC,CAAC,CAAC,KAAK,IAAI,CACV,oBAAC,MAAM,IAAC,KAAK,EAAE,CAAC,KAAK,CAAC,IACnB,KAAK,CAAC,EAAE,CAAC,CACR,oBAAC,GAAG,IAAC,GAAG,EAAE,KAAK;gBACb,oBAAC,KAAK,IAAC,OAAO,EAAC,OAAO;oBACpB,oBAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAE,WAAW;;wBACpB,GAAG,CACL;oBACN,KAAK,CACA,CACJ,CACP,CACM,CACV;YACD,oBAAC,SAAS,OAAK,YAAY,GAAI;YAC/B,oBAAC,KAAK,OAAG,CACL,CACQ,CACjB,CAAC;AACJ,CAAC;AAED,sBAAsB;AACtB,MAAM,qBAAqB,GAAG,aAAa,CAAC;AAC5C,MAAM,qBAAqB,GAAG,aAAa,CAAC;AAC5C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAE5C,MAAM,OAAO,GAAG,GAAG,EAAE;IACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import zod from 'zod';
2
3
  export declare const options: zod.ZodObject<{
3
4
  force: zod.ZodBoolean;
@@ -9,5 +10,5 @@ export declare const options: zod.ZodObject<{
9
10
  type Props = {
10
11
  options: zod.infer<typeof options>;
11
12
  };
12
- export default function Apply({ options }: Props): null;
13
+ export default function Apply({ options }: Props): React.JSX.Element;
13
14
  export {};
@@ -0,0 +1,30 @@
1
+ // src/commands/apply.tsx
2
+ import { Spinner } from '@inkjs/ui';
3
+ import { Box, Text, useApp, useInput } from 'ink';
4
+ import { option } from 'pastel';
5
+ import React from 'react';
6
+ import zod from 'zod';
7
+ import Branding from '../components/Branding.js';
8
+ import { ProcessingResults } from '../components/ProcessingResults.js';
9
+ import { useTemplateProcessor } from '../hooks/useTemplateProcessor.js';
10
+ export const options = zod.object({
11
+ force: zod.boolean().describe(option({
12
+ description: 'Force apply of all templates, irrespective of changes',
13
+ alias: 'f',
14
+ })),
15
+ });
16
+ export default function Apply({ options }) {
17
+ const { exit } = useApp();
18
+ const { result, isProcessing } = useTemplateProcessor({ force: options.force, apply: true });
19
+ useInput((_input, _) => {
20
+ if (!isProcessing) {
21
+ exit();
22
+ }
23
+ });
24
+ return (React.createElement(Box, { flexDirection: "column", gap: 1 },
25
+ React.createElement(Branding, { subtitle: "\u25B6\uFE0F Apply migrations" }),
26
+ isProcessing ? (React.createElement(Spinner, { label: "Applying templates..." })) : (React.createElement(React.Fragment, null,
27
+ React.createElement(ProcessingResults, { result: result, showApply: true }),
28
+ React.createElement(Text, { dimColor: true }, "Press any key to exit")))));
29
+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CAAC;QAChC,oBAAC,QAAQ,IAAC,QAAQ,EAAC,gCAAsB,GAAG;QAC3C,YAAY,CAAC,CAAC,CAAC,CACd,oBAAC,OAAO,IAAC,KAAK,EAAC,uBAAuB,GAAG,CAC1C,CAAC,CAAC,CAAC,CACF;YACE,oBAAC,iBAAiB,IAAC,MAAM,EAAE,MAAM,EAAE,SAAS,SAAG;YAC/C,oBAAC,IAAI,IAAC,QAAQ,kCAA6B,CAC1C,CACJ,CACG,CACP,CAAC;AACJ,CAAC"}
@@ -1,13 +1,17 @@
1
+ import React from 'react';
1
2
  import zod from 'zod';
2
3
  export declare const options: zod.ZodObject<{
3
4
  force: zod.ZodBoolean;
5
+ apply: zod.ZodOptional<zod.ZodBoolean>;
4
6
  }, "strip", zod.ZodTypeAny, {
5
7
  force: boolean;
8
+ apply?: boolean | undefined;
6
9
  }, {
7
10
  force: boolean;
11
+ apply?: boolean | undefined;
8
12
  }>;
9
13
  type Props = {
10
14
  options: zod.infer<typeof options>;
11
15
  };
12
- export default function Build({ options }: Props): null;
16
+ export default function Build({ options }: Props): React.JSX.Element;
13
17
  export {};
@@ -0,0 +1,41 @@
1
+ // commands/build.tsx
2
+ import { Spinner } from '@inkjs/ui';
3
+ import { Box, Text, useApp, useInput } from 'ink';
4
+ import { option } from 'pastel';
5
+ import React from 'react';
6
+ import zod from 'zod';
7
+ import Branding from '../components/Branding.js';
8
+ import { ProcessingResults } from '../components/ProcessingResults.js';
9
+ import { useTemplateProcessor } from '../hooks/useTemplateProcessor.js';
10
+ export const options = zod.object({
11
+ force: zod.boolean().describe(option({
12
+ description: 'Force building of all templates, irrespective of changes',
13
+ alias: 'f',
14
+ })),
15
+ apply: zod
16
+ .boolean()
17
+ .optional()
18
+ .describe(option({
19
+ description: 'Apply the built templates',
20
+ alias: 'a',
21
+ })),
22
+ });
23
+ export default function Build({ options }) {
24
+ const { exit } = useApp();
25
+ const { result, isProcessing } = useTemplateProcessor({
26
+ force: options.force,
27
+ generateFiles: true,
28
+ apply: options.apply,
29
+ });
30
+ useInput((_input, _) => {
31
+ if (!isProcessing) {
32
+ exit();
33
+ }
34
+ });
35
+ return (React.createElement(Box, { flexDirection: "column", gap: 1 },
36
+ React.createElement(Branding, { subtitle: "\uD83C\uDFD7\uFE0F Build migrations" }),
37
+ isProcessing ? (React.createElement(Spinner, { label: "Building templates..." })) : (React.createElement(React.Fragment, null,
38
+ React.createElement(ProcessingResults, { result: result, showBuild: true, showApply: !!option.apply }),
39
+ React.createElement(Text, { dimColor: true }, "Press any key to exit")))));
40
+ }
41
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/commands/build.tsx"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC;IAChC,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,QAAQ,CAC3B,MAAM,CAAC;QACL,WAAW,EAAE,0DAA0D;QACvE,KAAK,EAAE,GAAG;KACX,CAAC,CACH;IACD,KAAK,EAAE,GAAG;SACP,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CACP,MAAM,CAAC;QACL,WAAW,EAAE,2BAA2B;QACxC,KAAK,EAAE,GAAG;KACX,CAAC,CACH;CACJ,CAAC,CAAC;AAMH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,OAAO,EAAS;IAC9C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IAC1B,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,oBAAoB,CAAC;QACpD,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,aAAa,EAAE,IAAI;QACnB,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC,CAAC;IAEH,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrB,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,IAAI,EAAE,CAAC;QACT,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,GAAG,EAAE,CAAC;QAChC,oBAAC,QAAQ,IAAC,QAAQ,EAAC,sCAAuB,GAAG;QAC5C,YAAY,CAAC,CAAC,CAAC,CACd,oBAAC,OAAO,IAAC,KAAK,EAAC,uBAAuB,GAAG,CAC1C,CAAC,CAAC,CAAC,CACF;YACE,oBAAC,iBAAiB,IAAC,MAAM,EAAE,MAAM,EAAE,SAAS,QAAC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,GAAI;YAC1E,oBAAC,IAAI,IAAC,QAAQ,kCAA6B,CAC1C,CACJ,CACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function Clear(): React.JSX.Element;
@@ -0,0 +1,45 @@
1
+ import { Select, Spinner } from '@inkjs/ui';
2
+ import Branding from 'components/Branding.js';
3
+ import Quittable from 'components/Quittable.js';
4
+ // commands/build.tsx
5
+ import { Box, useApp } from 'ink';
6
+ import React from 'react';
7
+ import { clearBuildLogs, resetConfig } from '../utils/config.js';
8
+ const clearOptions = [
9
+ { label: 'Clear local build logs', value: 'local' },
10
+ { label: 'Clear shared build logs', value: 'shared' },
11
+ { label: 'Reset config and logs to initial defaults', value: 'full_reset' },
12
+ ];
13
+ export default function Clear() {
14
+ const { exit } = useApp();
15
+ const [isResetting, setIsResetting] = React.useState(false);
16
+ const handleSelect = async (value) => {
17
+ try {
18
+ setIsResetting(true);
19
+ switch (value) {
20
+ case 'local':
21
+ await clearBuildLogs(process.cwd(), 'local');
22
+ break;
23
+ case 'shared':
24
+ await clearBuildLogs(process.cwd(), 'shared');
25
+ break;
26
+ case 'full_reset':
27
+ await resetConfig(process.cwd());
28
+ await clearBuildLogs(process.cwd(), 'both');
29
+ break;
30
+ default:
31
+ throw new Error('Invalid option');
32
+ }
33
+ exit();
34
+ }
35
+ catch (err) {
36
+ exit(err instanceof Error ? err : new Error('Unknown error occurred'));
37
+ }
38
+ };
39
+ return (React.createElement(React.Fragment, null,
40
+ React.createElement(Branding, { subtitle: "\uD83E\uDDF9 Maintenance" }),
41
+ React.createElement(Select, { options: clearOptions, onChange: handleSelect }),
42
+ isResetting ? (React.createElement(Box, { marginY: 1 },
43
+ React.createElement(Spinner, { label: "Resetting..." }))) : (React.createElement(Quittable, null))));
44
+ }
45
+ //# sourceMappingURL=clear.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clear.js","sourceRoot":"","sources":["../../../src/commands/clear.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,qBAAqB;AACrB,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjE,MAAM,YAAY,GAAG;IACnB,EAAE,KAAK,EAAE,wBAAwB,EAAE,KAAK,EAAE,OAAO,EAAE;IACnD,EAAE,KAAK,EAAE,yBAA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Y,GAAI;QACxD,WAAW,CAAC,CAAC,CAAC,CACb,oBAAC,GAAG,IAAC,OAAO,EAAE,CAAC;YACb,oBAAC,OAAO,IAAC,KAAK,EAAC,cAAc,GAAG,CAC5B,CACP,CAAC,CAAC,CAAC,CACF,oBAAC,SAAS,OAAG,CACd,CACA,CACJ,CAAC;AACJ,CAAC"}
@@ -4,9 +4,11 @@ import { Box, Text } from 'ink';
4
4
  import React from 'react';
5
5
  import Branding from '../components/Branding.js';
6
6
  import Quittable from '../components/Quittable.js';
7
+ import { COLOR_ERROR } from '../components/customTheme.js';
7
8
  import { useDatabaseConnection } from '../hooks/useDatabaseConnection.js';
8
9
  import Apply from './apply.js';
9
10
  import Build from './build.js';
11
+ import Clear from './clear.js';
10
12
  import Register from './register.js';
11
13
  import Watch from './watch.js';
12
14
  export default function UI() {
@@ -27,19 +29,23 @@ export default function UI() {
27
29
  if (selectedCommand === 'watch') {
28
30
  return React.createElement(Watch, null);
29
31
  }
32
+ if (selectedCommand === 'clear') {
33
+ return React.createElement(Clear, null);
34
+ }
30
35
  const menuItems = [
31
- { label: '🏗️ build - Build Supabase migrations from templates', value: 'build' },
32
- { label: '▶️ apply - Apply migration templates directly to database', value: 'apply' },
33
- { label: '✍️ register - Register templates as already built', value: 'register' },
34
36
  {
35
- label: '👀 watch - Watch templates for changes and apply directly to database',
37
+ label: '👀 watch - Watch for changes, apply directly to db',
36
38
  value: 'watch',
37
39
  },
40
+ { label: '▶️ apply - Apply templates directly to db', value: 'apply' },
41
+ { label: '🏗️ build - Build templates as Supabase migrations', value: 'build' },
42
+ { label: '✍️ register - Register templates as already built', value: 'register' },
43
+ { label: '🧹 maintenance - Clear build logs and reset config', value: 'clear' },
38
44
  ];
39
45
  return (React.createElement(Box, { flexDirection: "column" },
40
46
  React.createElement(Branding, null),
41
47
  error ? (React.createElement(Box, { gap: 1 },
42
- React.createElement(Text, { color: "red", bold: true }, "Error"),
48
+ React.createElement(Text, { color: COLOR_ERROR, bold: true }, "Error"),
43
49
  React.createElement(Text, null, "Check your database connection and try again."))) : (React.createElement(Select, { options: menuItems, isDisabled: !isConnected, onChange: handleOnChange })),
44
50
  isChecking ? (React.createElement(Box, { marginTop: 1 },
45
51
  React.createElement(Spinner, { label: "Checking database connection..." }))) : (React.createElement(Quittable, null))));
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/index.tsx"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AACjD,OAAO,SAAS,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,EAAE;IACxB,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,qBAAqB,EAAE,CAAC;IACnE,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAElF,MAAM,cAAc,GAAG,KAAK,EAAE,KAAa,EAAE,EAAE;QAC7C,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC,CAAC;IAEF,IAAI,eAAe,KAAK,UAAU,EAAE,CAAC;QACnC,OAAO,oBAAC,QAAQ,IAAC,IAAI,EAAE,SAAS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@@ -5,6 +5,7 @@ import React from 'react';
5
5
  import zod from 'zod';
6
6
  import Branding from '../components/Branding.js';
7
7
  import Quittable from '../components/Quittable.js';
8
+ import { COLOR_ERROR, COLOR_SUCCESS } from '../components/customTheme.js';
8
9
  import { useTemplateState } from '../hooks/useTemplateState.js';
9
10
  import { registerTemplate } from '../utils/registerTemplate.js';
10
11
  // Support both array of filenames as arguments and interactive selection
@@ -49,7 +50,7 @@ export default function Register({ args: templateArgs }) {
49
50
  }
50
51
  }, [handleTemplateRegistration, templateArgs]);
51
52
  if (error) {
52
- return React.createElement(Text, { color: "red" },
53
+ return React.createElement(Text, { color: COLOR_ERROR },
53
54
  "Error: ",
54
55
  error);
55
56
  }
@@ -73,13 +74,13 @@ export default function Register({ args: templateArgs }) {
73
74
  React.createElement(Text, { dimColor: true }, "Use arrow/space to select, then press Enter to register.")),
74
75
  React.createElement(Box, { marginTop: 1, marginBottom: 1 },
75
76
  React.createElement(MultiSelect, { options: options, onChange: vals => setSelectedValues(vals), onSubmit: vals => void handleTemplateRegistration(vals) })),
76
- !!errorMessage && React.createElement(Text, { color: "red" }, errorMessage),
77
- !!successMessage && React.createElement(Text, { color: "#3ecf8e" }, successMessage),
77
+ !!errorMessage && React.createElement(Text, { color: COLOR_ERROR }, errorMessage),
78
+ !!successMessage && React.createElement(Text, { color: COLOR_SUCCESS }, successMessage),
78
79
  React.createElement(Quittable, null)));
79
80
  }
80
81
  return (React.createElement(Box, { flexDirection: "column", marginTop: 1 },
81
- !!errorMessage && React.createElement(Text, { color: "red" }, errorMessage),
82
- !!successMessage && React.createElement(Text, { color: "#3ecf8e" }, successMessage),
82
+ !!errorMessage && React.createElement(Text, { color: COLOR_ERROR }, errorMessage),
83
+ !!successMessage && React.createElement(Text, { color: COLOR_SUCCESS }, successMessage),
83
84
  React.createElement(Quittable, null)));
84
85
  }
85
86
  //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/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K,EAAE,aAAa,IAAG,cAAc,CAAQ;QACxE,oBAAC,SAAS,OAAG,CACT,CACP,CAAC;AACJ,CAAC"}
@@ -6,9 +6,12 @@ import React, { useMemo } from 'react';
6
6
  import Branding from '../components/Branding.js';
7
7
  import Quittable from '../components/Quittable.js';
8
8
  import { TimeSince } from '../components/TimeSince.js';
9
+ import { COLOR_ACCENT, COLOR_ERROR, COLOR_SUCCESS, COLOR_WARNING, } from '../components/customTheme.js';
9
10
  import { useDatabaseConnection } from '../hooks/useDatabaseConnection.js';
10
11
  import { useTemplateManager } from '../hooks/useTemplateManager.js';
11
- const MAX_FILES = 30;
12
+ import { store } from '../utils/store.js';
13
+ const MAX_FILES = 10;
14
+ const MAX_CHANGES = 15;
12
15
  const PATH_DISPLAY_LENGTH = 15;
13
16
  function StatBadge({ label, value, color }) {
14
17
  return (React.createElement(Box, { marginRight: 1 },
@@ -34,6 +37,8 @@ function formatTemplateDisplay(templatePath, templateDir) {
34
37
  }
35
38
  const TemplateRow = React.memo(({ template, isLatest, templateDir, }) => {
36
39
  const displayName = formatTemplateDisplay(template.path, templateDir ?? '');
40
+ const needsBuild = !template.buildState.lastBuildDate ||
41
+ template.currentHash !== template.buildState.lastBuildHash;
37
42
  return (React.createElement(Box, { marginLeft: 2 },
38
43
  React.createElement(Box, { width: 2 },
39
44
  React.createElement(Text, null, template.buildState.lastAppliedError ? '❌' : isLatest ? '⚡️' : '✓')),
@@ -43,73 +48,96 @@ const TemplateRow = React.memo(({ template, isLatest, templateDir, }) => {
43
48
  React.createElement(Text, { dimColor: true },
44
49
  "applied ",
45
50
  React.createElement(TimeSince, { date: template.buildState.lastAppliedDate }),
46
- " ago",
47
- !template.buildState.lastBuildDate ||
48
- template.currentHash !== template.buildState.lastBuildHash ? (React.createElement(React.Fragment, null, " \u2022 needs build")) : (React.createElement(React.Fragment, null,
49
- ' ',
50
- "\u2022 built ",
51
- React.createElement(TimeSince, { date: template.buildState.lastBuildDate }),
52
- " ago"))))));
51
+ " ago"),
52
+ React.createElement(Text, null, " \u2022 "),
53
+ React.createElement(Text, { dimColor: true }, template.wip ? (React.createElement(React.Fragment, null, "wip")) : needsBuild ? (React.createElement(React.Fragment, null, "needs build")) : (React.createElement(React.Fragment, null,
54
+ "built ",
55
+ React.createElement(TimeSince, { date: template.buildState.lastBuildDate }),
56
+ " ago"))))));
53
57
  });
54
58
  TemplateRow.displayName = 'TemplateRow';
55
59
  const UpdateLog = React.memo(({ updates, templateDir, }) => {
56
- const sortedUpdates = useMemo(() => [...updates].reverse().slice(0, 5), [updates]);
60
+ const sortedUpdates = useMemo(() => {
61
+ return [...updates]
62
+ .sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime())
63
+ .slice(0, MAX_CHANGES);
64
+ }, [updates]);
65
+ const formatError = (error) => {
66
+ if (error instanceof Error)
67
+ return error.message;
68
+ if (typeof error === 'string')
69
+ return error;
70
+ if (typeof error === 'object' && error && 'error' in error) {
71
+ return String(error.error);
72
+ }
73
+ return String(error);
74
+ };
57
75
  return (React.createElement(Box, { flexDirection: "column", marginTop: 1 },
58
- React.createElement(Text, { bold: true }, "Recent Updates:"),
76
+ React.createElement(Text, { bold: true }, "Changelog:"),
77
+ !sortedUpdates.length && React.createElement(Text, { dimColor: true }, "Nothing changed yet"),
59
78
  sortedUpdates.map(update => (React.createElement(Box, { key: `${update.template.path}-${update.timestamp}`, marginLeft: 2 },
60
- React.createElement(Text, { color: update.type === 'error' ? 'red' : update.type === 'applied' ? 'green' : 'blue' },
79
+ React.createElement(Text, { color: update.type === 'error'
80
+ ? COLOR_ERROR
81
+ : update.type === 'applied'
82
+ ? COLOR_SUCCESS
83
+ : COLOR_ACCENT },
61
84
  update.type === 'error' ? '❌' : update.type === 'applied' ? '✨' : '📝',
62
85
  ' ',
63
86
  formatTemplateDisplay(update.template.path, templateDir ?? ''),
64
87
  ":",
65
88
  ' ',
66
89
  update.type === 'error'
67
- ? update.error
90
+ ? formatError(update.error)
68
91
  : update.type === 'applied'
69
92
  ? 'applied successfully'
70
- : 'changed and reapplied'))))));
93
+ : 'changed'))))));
71
94
  });
72
95
  UpdateLog.displayName = 'UpdateLog';
73
96
  export default function Watch() {
74
97
  const { isConnected } = useDatabaseConnection();
75
98
  const { templates, updates, stats, isLoading, errors, latestPath, templateDir } = useTemplateManager();
76
- const [showUpdates, setShowUpdates] = React.useState(true);
99
+ const [showUpdates, setShowUpdates] = React.useState(store.get('showWatchLogs'));
77
100
  const activeTemplates = useMemo(() => templates.slice(-MAX_FILES), [templates]);
78
101
  const hasErrors = errors.size > 0;
79
102
  useInput(input => {
80
103
  if (input === 'u') {
81
- setShowUpdates(s => !s);
104
+ const show = !showUpdates;
105
+ setShowUpdates(show);
106
+ store.set('showWatchLogs', show);
82
107
  }
83
108
  });
84
109
  if (!isConnected) {
85
110
  return (React.createElement(Box, { flexDirection: "column" },
86
- React.createElement(Text, { color: "red" }, "Unable to connect to database. Is Supabase running?"),
111
+ React.createElement(Text, { color: COLOR_ERROR }, "Unable to connect to database. Is Supabase running?"),
87
112
  React.createElement(Quittable, null)));
88
113
  }
89
114
  return (React.createElement(Box, { flexDirection: "column" },
90
115
  React.createElement(Branding, { subtitle: "\uD83D\uDC40 Watch Mode" }),
91
- React.createElement(Box, { marginY: 1 },
92
- React.createElement(StatBadge, { label: "Total", value: stats.total, color: "#3ecf8e" }),
93
- stats.needsBuild > 0 && (React.createElement(StatBadge, { label: "Needs Build", value: stats.needsBuild, color: "yellow" })),
94
- stats.recentlyChanged > 0 && (React.createElement(StatBadge, { label: "Recent Changes", value: stats.recentlyChanged, color: "blue" })),
95
- hasErrors && React.createElement(StatBadge, { label: "Errors", value: stats.errors, color: "red" })),
116
+ React.createElement(Box, { marginBottom: 1 },
117
+ React.createElement(StatBadge, { label: "Total", value: stats.total, color: COLOR_SUCCESS }),
118
+ stats.needsBuild > 0 && (React.createElement(StatBadge, { label: "Needs Build", value: stats.needsBuild, color: COLOR_WARNING })),
119
+ stats.recentlyChanged > 0 && (React.createElement(StatBadge, { label: "Recent Changes", value: stats.recentlyChanged, color: COLOR_ACCENT })),
120
+ hasErrors && React.createElement(StatBadge, { label: "Errors", value: stats.errors, color: COLOR_ERROR })),
96
121
  isLoading ? (React.createElement(Text, null, "\uD83D\uDD0D Finding templates...")) : (React.createElement(Box, { flexDirection: "column" },
122
+ React.createElement(Text, { bold: true }, "Recently modified templates:"),
123
+ activeTemplates.length === 0 && React.createElement(Text, { dimColor: true }, "No templates found"),
97
124
  activeTemplates.map(template => (React.createElement(TemplateRow, { key: template.path, template: template, isLatest: template.path === latestPath, templateDir: templateDir }))),
98
- showUpdates && updates.length > 0 && (React.createElement(UpdateLog, { updates: updates, templateDir: templateDir })),
99
- !showUpdates && hasErrors && (React.createElement(Box, { flexDirection: "column", marginTop: 1 },
100
- React.createElement(Text, { bold: true, color: "red" }, "Errors:"),
125
+ showUpdates && React.createElement(UpdateLog, { updates: updates, templateDir: templateDir }),
126
+ hasErrors && (React.createElement(Box, { flexDirection: "column", marginTop: 1 },
127
+ React.createElement(Text, { bold: true, color: COLOR_ERROR }, "Errors:"),
101
128
  Array.from(errors.entries()).map(([path, error]) => (React.createElement(Box, { key: path, marginLeft: 2, marginTop: 1 },
102
- React.createElement(Text, { color: "red", wrap: "wrap" },
129
+ React.createElement(Text, { color: COLOR_ERROR, wrap: "wrap" },
103
130
  formatTemplateDisplay(path, templateDir ?? ''),
104
131
  ": ",
105
- error)))))))),
132
+ String(error))))))))),
106
133
  React.createElement(Box, { marginY: 1, flexDirection: "row", gap: 1 },
107
- React.createElement(Box, { marginY: 1 },
108
- React.createElement(Text, { dimColor: true }, "press "),
109
- React.createElement(Text, { underline: showUpdates }, "u"),
110
- React.createElement(Text, { dimColor: true }, " to toggle updates")),
111
- React.createElement(Box, { marginY: 1 },
112
- React.createElement(Text, { dimColor: true }, "\u2022")),
113
- React.createElement(Quittable, null))));
134
+ React.createElement(Quittable, null),
135
+ React.createElement(React.Fragment, null,
136
+ React.createElement(Box, { marginY: 1 },
137
+ React.createElement(Text, { dimColor: true }, "\u2022")),
138
+ React.createElement(Box, { marginY: 1 },
139
+ React.createElement(Text, { dimColor: true }, "Press "),
140
+ React.createElement(Text, { underline: showUpdates }, "u"),
141
+ React.createElement(Text, { dimColor: true }, " to toggle updates"))))));
114
142
  }
115
143
  //# sourceMappingURL=watch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch.js","sourceRoot":"","sources":["../../../src/commands/watch.tsx"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AACjD,OAAO,SAAS,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EACL,YAAY,EACZ,WAAW,EACX,aAAa,EACb,aAAa,GACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAE/B,SAAS,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAmD;IACzF,OAAO,CACL,oBAAC,GAAG,IAAC,WAAW,EAAE,CAAC;QACjB,oBAAC,KAAK,IAAC,KAAK,EAAE,KAAK;YAChB,GAAG;YACH,KAAK;;YAAI,KAAK;YAAE,GAAG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WAAW,EAAE,WAAW,GAAI;YAExE,SAAS,IAAI,CACZ,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAC;gBACtC,oBAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAE,WAAW,cAEtB;gBACN,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CACnD,oBAAC,GAAG,IAAC,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC;oBACzC,oBAAC,IAAI,IAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAC,MAAM;wBAClC,qBAAqB,CAAC,IAAI,EAAE,WAAW,IAAI,EAAE,CAAC;;wBAAI,MAAM,CAAC,KAAK,CAAC,CAC3D,CACH,CACP,CAAC,CACE,CACP,CACG,CACP;QAED,oBAAC,GAAG,IAAC,OAAO,EAAE,CAAC,EAAE,aAAa,EAAC,KAAK,EAAC,GAAG,EAAE,CAAC;YACzC,oBAAC,SAAS,OAAG;YACb;gBACE,oBAAC,GAAG,IAAC,OAAO,EAAE,CAAC;oBACb,oBAAC,IAAI,IAAC,QAAQ,mBAAS,CACnB;gBACN,oBAAC,GAAG,IAAC,OAAO,EAAE,CAAC;oBACb,oBAAC,IAAI,IAAC,QAAQ,mBAAc;oBAC5B,oBAAC,IAAI,IAAC,SAAS,EAAE,WAAW,QAAU;oBACtC,oBAAC,IAAI,IAAC,QAAQ,+BAA0B,CACpC,CACL,CACC,CACF,CACP,CAAC;AACJ,CAAC"}
@@ -3,25 +3,25 @@ import { Box, Text } from 'ink';
3
3
  import React from 'react';
4
4
  import packageJson from '../../package.json' assert { type: 'json' };
5
5
  import { useDatabaseConnection } from '../hooks/useDatabaseConnection.js';
6
+ import { COLOR_ERROR, COLOR_SUPABASE, COLOR_WARNING } from './customTheme.js';
6
7
  export default function Branding({ subtitle }) {
7
8
  const { error, isConnected } = useDatabaseConnection();
8
- const badgeColor = error ? 'red' : isConnected ? '#3ecf8e' : 'yellow';
9
+ const badgeColor = error ? COLOR_ERROR : isConnected ? COLOR_SUPABASE : COLOR_WARNING;
9
10
  return (React.createElement(Box, { marginBottom: 1, marginTop: 1, gap: 1, flexDirection: "column" },
10
11
  React.createElement(Box, { gap: 1 },
11
12
  React.createElement(Badge, { color: badgeColor }, " srtd "),
12
13
  subtitle ? (React.createElement(Text, null, subtitle)) : (React.createElement(Text, null,
13
- "(",
14
- React.createElement(Text, { bold: true, color: "#3ecf8e" }, "S"),
14
+ React.createElement(Text, { bold: true, color: COLOR_SUPABASE }, "S"),
15
15
  "upabase",
16
16
  ' ',
17
- React.createElement(Text, { bold: true, color: "#3ecf8e" }, "R"),
17
+ React.createElement(Text, { bold: true, color: COLOR_SUPABASE }, "R"),
18
18
  "epeatable",
19
19
  ' ',
20
- React.createElement(Text, { bold: true, color: "#3ecf8e" }, "T"),
20
+ React.createElement(Text, { bold: true, color: COLOR_SUPABASE }, "T"),
21
21
  "emplate",
22
22
  ' ',
23
- React.createElement(Text, { bold: true, color: "#3ecf8e" }, "D"),
24
- "efinitions)")),
23
+ React.createElement(Text, { bold: true, color: COLOR_SUPABASE }, "D"),
24
+ "efinitions")),
25
25
  React.createElement(Text, { dimColor: true },
26
26
  "v",
27
27
  packageJson.version))));
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Branding.js","sourceRoot":"","sources":["../../../src/components/Branding.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,WAAW,MAAM,oBAAoB,CAAC,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;A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