@fnd-platform/cli 1.0.0-alpha.24 → 1.0.0-alpha.25

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 (230) hide show
  1. package/lib/bin/fnd.js +101 -4
  2. package/lib/bin/fnd.js.map +1 -1
  3. package/lib/commands/add.js +72 -75
  4. package/lib/commands/add.js.map +1 -1
  5. package/lib/commands/build.js +29 -34
  6. package/lib/commands/build.js.map +1 -1
  7. package/lib/commands/deploy.d.ts +13 -5
  8. package/lib/commands/deploy.d.ts.map +1 -1
  9. package/lib/commands/deploy.js +94 -75
  10. package/lib/commands/deploy.js.map +1 -1
  11. package/lib/commands/destroy.js +33 -38
  12. package/lib/commands/destroy.js.map +1 -1
  13. package/lib/commands/index.d.ts +1 -0
  14. package/lib/commands/index.d.ts.map +1 -1
  15. package/lib/commands/index.js +7 -15
  16. package/lib/commands/index.js.map +1 -1
  17. package/lib/commands/new.js +46 -50
  18. package/lib/commands/new.js.map +1 -1
  19. package/lib/commands/synth.d.ts +8 -1
  20. package/lib/commands/synth.d.ts.map +1 -1
  21. package/lib/commands/synth.js +82 -22
  22. package/lib/commands/synth.js.map +1 -1
  23. package/lib/commands/test.d.ts +73 -0
  24. package/lib/commands/test.d.ts.map +1 -0
  25. package/lib/commands/test.js +193 -0
  26. package/lib/commands/test.js.map +1 -0
  27. package/lib/index.d.ts +11 -2
  28. package/lib/index.d.ts.map +1 -1
  29. package/lib/index.js +29 -18
  30. package/lib/index.js.map +1 -1
  31. package/lib/lib/deploy-utils.d.ts.map +1 -1
  32. package/lib/lib/deploy-utils.js +73 -72
  33. package/lib/lib/deploy-utils.js.map +1 -1
  34. package/lib/lib/infra-generator.js +55 -63
  35. package/lib/lib/infra-generator.js.map +1 -1
  36. package/lib/lib/logger.js +23 -29
  37. package/lib/lib/logger.js.map +1 -1
  38. package/lib/lib/nx-stats.js +12 -18
  39. package/lib/lib/nx-stats.js.map +1 -1
  40. package/lib/lib/project.js +7 -11
  41. package/lib/lib/project.js.map +1 -1
  42. package/lib/lib/templates.js +2 -6
  43. package/lib/lib/templates.js.map +1 -1
  44. package/lib/lib/timer.js +2 -7
  45. package/lib/lib/timer.js.map +1 -1
  46. package/lib/lib/validation.d.ts +135 -0
  47. package/lib/lib/validation.d.ts.map +1 -0
  48. package/lib/lib/validation.js +233 -0
  49. package/lib/lib/validation.js.map +1 -0
  50. package/lib/tui/App.d.ts +11 -0
  51. package/lib/tui/App.d.ts.map +1 -0
  52. package/lib/tui/App.js +98 -0
  53. package/lib/tui/App.js.map +1 -0
  54. package/lib/tui/components/branding/AsciiBanner.d.ts +21 -0
  55. package/lib/tui/components/branding/AsciiBanner.d.ts.map +1 -0
  56. package/lib/tui/components/branding/AsciiBanner.js +15 -0
  57. package/lib/tui/components/branding/AsciiBanner.js.map +1 -0
  58. package/lib/tui/components/branding/index.d.ts +5 -0
  59. package/lib/tui/components/branding/index.d.ts.map +1 -0
  60. package/lib/tui/components/branding/index.js +5 -0
  61. package/lib/tui/components/branding/index.js.map +1 -0
  62. package/lib/tui/components/feedback/Notification.d.ts +51 -0
  63. package/lib/tui/components/feedback/Notification.d.ts.map +1 -0
  64. package/lib/tui/components/feedback/Notification.js +89 -0
  65. package/lib/tui/components/feedback/Notification.js.map +1 -0
  66. package/lib/tui/components/feedback/ProgressBar.d.ts +46 -0
  67. package/lib/tui/components/feedback/ProgressBar.d.ts.map +1 -0
  68. package/lib/tui/components/feedback/ProgressBar.js +30 -0
  69. package/lib/tui/components/feedback/ProgressBar.js.map +1 -0
  70. package/lib/tui/components/feedback/ProgressSteps.d.ts +35 -0
  71. package/lib/tui/components/feedback/ProgressSteps.d.ts.map +1 -0
  72. package/lib/tui/components/feedback/ProgressSteps.js +37 -0
  73. package/lib/tui/components/feedback/ProgressSteps.js.map +1 -0
  74. package/lib/tui/components/feedback/Spinner.d.ts +18 -0
  75. package/lib/tui/components/feedback/Spinner.d.ts.map +1 -0
  76. package/lib/tui/components/feedback/Spinner.js +28 -0
  77. package/lib/tui/components/feedback/Spinner.js.map +1 -0
  78. package/lib/tui/components/feedback/index.d.ts +8 -0
  79. package/lib/tui/components/feedback/index.d.ts.map +1 -0
  80. package/lib/tui/components/feedback/index.js +8 -0
  81. package/lib/tui/components/feedback/index.js.map +1 -0
  82. package/lib/tui/components/index.d.ts +8 -0
  83. package/lib/tui/components/index.d.ts.map +1 -0
  84. package/lib/tui/components/index.js +8 -0
  85. package/lib/tui/components/index.js.map +1 -0
  86. package/lib/tui/components/input/Checkbox.d.ts +26 -0
  87. package/lib/tui/components/input/Checkbox.d.ts.map +1 -0
  88. package/lib/tui/components/input/Checkbox.js +20 -0
  89. package/lib/tui/components/input/Checkbox.js.map +1 -0
  90. package/lib/tui/components/input/SelectInput.d.ts +41 -0
  91. package/lib/tui/components/input/SelectInput.d.ts.map +1 -0
  92. package/lib/tui/components/input/SelectInput.js +53 -0
  93. package/lib/tui/components/input/SelectInput.js.map +1 -0
  94. package/lib/tui/components/input/TextInput.d.ts +30 -0
  95. package/lib/tui/components/input/TextInput.d.ts.map +1 -0
  96. package/lib/tui/components/input/TextInput.js +48 -0
  97. package/lib/tui/components/input/TextInput.js.map +1 -0
  98. package/lib/tui/components/input/index.d.ts +7 -0
  99. package/lib/tui/components/input/index.d.ts.map +1 -0
  100. package/lib/tui/components/input/index.js +7 -0
  101. package/lib/tui/components/input/index.js.map +1 -0
  102. package/lib/tui/components/layout/Breadcrumbs.d.ts +11 -0
  103. package/lib/tui/components/layout/Breadcrumbs.d.ts.map +1 -0
  104. package/lib/tui/components/layout/Breadcrumbs.js +34 -0
  105. package/lib/tui/components/layout/Breadcrumbs.js.map +1 -0
  106. package/lib/tui/components/layout/Footer.d.ts +11 -0
  107. package/lib/tui/components/layout/Footer.d.ts.map +1 -0
  108. package/lib/tui/components/layout/Footer.js +20 -0
  109. package/lib/tui/components/layout/Footer.js.map +1 -0
  110. package/lib/tui/components/layout/Header.d.ts +21 -0
  111. package/lib/tui/components/layout/Header.d.ts.map +1 -0
  112. package/lib/tui/components/layout/Header.js +21 -0
  113. package/lib/tui/components/layout/Header.js.map +1 -0
  114. package/lib/tui/components/layout/Screen.d.ts +27 -0
  115. package/lib/tui/components/layout/Screen.d.ts.map +1 -0
  116. package/lib/tui/components/layout/Screen.js +11 -0
  117. package/lib/tui/components/layout/Screen.js.map +1 -0
  118. package/lib/tui/components/layout/index.d.ts +8 -0
  119. package/lib/tui/components/layout/index.d.ts.map +1 -0
  120. package/lib/tui/components/layout/index.js +8 -0
  121. package/lib/tui/components/layout/index.js.map +1 -0
  122. package/lib/tui/hooks/index.d.ts +20 -0
  123. package/lib/tui/hooks/index.d.ts.map +1 -0
  124. package/lib/tui/hooks/index.js +18 -0
  125. package/lib/tui/hooks/index.js.map +1 -0
  126. package/lib/tui/hooks/useAddPackage.d.ts +120 -0
  127. package/lib/tui/hooks/useAddPackage.d.ts.map +1 -0
  128. package/lib/tui/hooks/useAddPackage.js +347 -0
  129. package/lib/tui/hooks/useAddPackage.js.map +1 -0
  130. package/lib/tui/hooks/useCreateProject.d.ts +66 -0
  131. package/lib/tui/hooks/useCreateProject.d.ts.map +1 -0
  132. package/lib/tui/hooks/useCreateProject.js +156 -0
  133. package/lib/tui/hooks/useCreateProject.js.map +1 -0
  134. package/lib/tui/hooks/useDeploy.d.ts +93 -0
  135. package/lib/tui/hooks/useDeploy.d.ts.map +1 -0
  136. package/lib/tui/hooks/useDeploy.js +252 -0
  137. package/lib/tui/hooks/useDeploy.js.map +1 -0
  138. package/lib/tui/hooks/useKeyboard.d.ts +66 -0
  139. package/lib/tui/hooks/useKeyboard.d.ts.map +1 -0
  140. package/lib/tui/hooks/useKeyboard.js +101 -0
  141. package/lib/tui/hooks/useKeyboard.js.map +1 -0
  142. package/lib/tui/hooks/useNavigation.d.ts +33 -0
  143. package/lib/tui/hooks/useNavigation.d.ts.map +1 -0
  144. package/lib/tui/hooks/useNavigation.js +27 -0
  145. package/lib/tui/hooks/useNavigation.js.map +1 -0
  146. package/lib/tui/hooks/useProject.d.ts +36 -0
  147. package/lib/tui/hooks/useProject.d.ts.map +1 -0
  148. package/lib/tui/hooks/useProject.js +47 -0
  149. package/lib/tui/hooks/useProject.js.map +1 -0
  150. package/lib/tui/index.d.ts +15 -0
  151. package/lib/tui/index.d.ts.map +1 -0
  152. package/lib/tui/index.js +16 -0
  153. package/lib/tui/index.js.map +1 -0
  154. package/lib/tui/lib/add-package-tui.d.ts +127 -0
  155. package/lib/tui/lib/add-package-tui.d.ts.map +1 -0
  156. package/lib/tui/lib/add-package-tui.js +467 -0
  157. package/lib/tui/lib/add-package-tui.js.map +1 -0
  158. package/lib/tui/lib/create-project-tui.d.ts +84 -0
  159. package/lib/tui/lib/create-project-tui.d.ts.map +1 -0
  160. package/lib/tui/lib/create-project-tui.js +141 -0
  161. package/lib/tui/lib/create-project-tui.js.map +1 -0
  162. package/lib/tui/lib/deploy-tui.d.ts +131 -0
  163. package/lib/tui/lib/deploy-tui.d.ts.map +1 -0
  164. package/lib/tui/lib/deploy-tui.js +347 -0
  165. package/lib/tui/lib/deploy-tui.js.map +1 -0
  166. package/lib/tui/screens/AddPackageScreen.d.ts +12 -0
  167. package/lib/tui/screens/AddPackageScreen.d.ts.map +1 -0
  168. package/lib/tui/screens/AddPackageScreen.js +436 -0
  169. package/lib/tui/screens/AddPackageScreen.js.map +1 -0
  170. package/lib/tui/screens/CreateProjectScreen.d.ts +12 -0
  171. package/lib/tui/screens/CreateProjectScreen.d.ts.map +1 -0
  172. package/lib/tui/screens/CreateProjectScreen.js +252 -0
  173. package/lib/tui/screens/CreateProjectScreen.js.map +1 -0
  174. package/lib/tui/screens/DeployScreen.d.ts +11 -0
  175. package/lib/tui/screens/DeployScreen.d.ts.map +1 -0
  176. package/lib/tui/screens/DeployScreen.js +224 -0
  177. package/lib/tui/screens/DeployScreen.js.map +1 -0
  178. package/lib/tui/screens/ProjectDashboard.d.ts +11 -0
  179. package/lib/tui/screens/ProjectDashboard.d.ts.map +1 -0
  180. package/lib/tui/screens/ProjectDashboard.js +42 -0
  181. package/lib/tui/screens/ProjectDashboard.js.map +1 -0
  182. package/lib/tui/screens/WelcomeScreen.d.ts +11 -0
  183. package/lib/tui/screens/WelcomeScreen.d.ts.map +1 -0
  184. package/lib/tui/screens/WelcomeScreen.js +26 -0
  185. package/lib/tui/screens/WelcomeScreen.js.map +1 -0
  186. package/lib/tui/screens/index.d.ts +9 -0
  187. package/lib/tui/screens/index.d.ts.map +1 -0
  188. package/lib/tui/screens/index.js +9 -0
  189. package/lib/tui/screens/index.js.map +1 -0
  190. package/lib/tui/services/ConfigService.d.ts +133 -0
  191. package/lib/tui/services/ConfigService.d.ts.map +1 -0
  192. package/lib/tui/services/ConfigService.js +221 -0
  193. package/lib/tui/services/ConfigService.js.map +1 -0
  194. package/lib/tui/services/ProjectService.d.ts +55 -0
  195. package/lib/tui/services/ProjectService.d.ts.map +1 -0
  196. package/lib/tui/services/ProjectService.js +179 -0
  197. package/lib/tui/services/ProjectService.js.map +1 -0
  198. package/lib/tui/services/index.d.ts +6 -0
  199. package/lib/tui/services/index.d.ts.map +1 -0
  200. package/lib/tui/services/index.js +6 -0
  201. package/lib/tui/services/index.js.map +1 -0
  202. package/lib/tui/state/AppContext.d.ts +58 -0
  203. package/lib/tui/state/AppContext.d.ts.map +1 -0
  204. package/lib/tui/state/AppContext.js +75 -0
  205. package/lib/tui/state/AppContext.js.map +1 -0
  206. package/lib/tui/state/index.d.ts +7 -0
  207. package/lib/tui/state/index.d.ts.map +1 -0
  208. package/lib/tui/state/index.js +7 -0
  209. package/lib/tui/state/index.js.map +1 -0
  210. package/lib/tui/state/reducer.d.ts +13 -0
  211. package/lib/tui/state/reducer.d.ts.map +1 -0
  212. package/lib/tui/state/reducer.js +136 -0
  213. package/lib/tui/state/reducer.js.map +1 -0
  214. package/lib/tui/state/types.d.ts +132 -0
  215. package/lib/tui/state/types.d.ts.map +1 -0
  216. package/lib/tui/state/types.js +38 -0
  217. package/lib/tui/state/types.js.map +1 -0
  218. package/lib/tui/utils/ascii.d.ts +42 -0
  219. package/lib/tui/utils/ascii.d.ts.map +1 -0
  220. package/lib/tui/utils/ascii.js +63 -0
  221. package/lib/tui/utils/ascii.js.map +1 -0
  222. package/lib/tui/utils/colors.d.ts +65 -0
  223. package/lib/tui/utils/colors.d.ts.map +1 -0
  224. package/lib/tui/utils/colors.js +65 -0
  225. package/lib/tui/utils/colors.js.map +1 -0
  226. package/lib/tui/utils/index.d.ts +6 -0
  227. package/lib/tui/utils/index.d.ts.map +1 -0
  228. package/lib/tui/utils/index.js +6 -0
  229. package/lib/tui/utils/index.js.map +1 -0
  230. package/package.json +12 -3
@@ -0,0 +1,179 @@
1
+ /**
2
+ * Project detection service for the FND TUI.
3
+ *
4
+ * Detects project context and gathers project information.
5
+ */
6
+ import { existsSync, readdirSync, readFileSync } from 'fs';
7
+ import { join, basename } from 'path';
8
+ import { findProjectRoot } from '../../lib/project.js';
9
+ import { getProjectName } from '../../lib/deploy-utils.js';
10
+ import { ConfigService } from './ConfigService.js';
11
+ /**
12
+ * Service for detecting and managing project state.
13
+ */
14
+ export class ProjectService {
15
+ /**
16
+ * Detects the project context for the given directory.
17
+ *
18
+ * @param cwd - Current working directory
19
+ * @returns Project state information
20
+ */
21
+ static detectProject(cwd = process.cwd()) {
22
+ const state = {
23
+ context: 'unknown',
24
+ rootPath: null,
25
+ name: null,
26
+ packages: [],
27
+ currentStage: null,
28
+ isLoading: false,
29
+ error: null,
30
+ };
31
+ try {
32
+ // Check if we're in an existing fnd-platform project
33
+ const projectRoot = findProjectRoot(cwd);
34
+ if (projectRoot) {
35
+ // Found a project with .projenrc.ts
36
+ const configService = new ConfigService(projectRoot);
37
+ if (configService.hasConfig()) {
38
+ // Existing FND project with .fnd folder
39
+ state.context = 'existing';
40
+ state.rootPath = projectRoot;
41
+ state.name = getProjectName(projectRoot);
42
+ state.packages = ProjectService.detectPackages(projectRoot);
43
+ // Load current stage from environment
44
+ const env = configService.loadEnvironment();
45
+ state.currentStage = env.currentStage;
46
+ }
47
+ else {
48
+ // Legacy project (has .projenrc.ts but no .fnd folder)
49
+ state.context = 'legacy';
50
+ state.rootPath = projectRoot;
51
+ state.name = getProjectName(projectRoot);
52
+ state.packages = ProjectService.detectPackages(projectRoot);
53
+ }
54
+ }
55
+ else {
56
+ // Check if this is an empty or non-project directory
57
+ const entries = readdirSync(cwd);
58
+ const isEmpty = entries.length === 0 || entries.every((e) => e.startsWith('.'));
59
+ if (isEmpty) {
60
+ // Empty directory - good for new project
61
+ state.context = 'new';
62
+ }
63
+ else {
64
+ // Directory has files but no fnd project
65
+ state.context = 'unknown';
66
+ }
67
+ }
68
+ }
69
+ catch (error) {
70
+ state.error = error.message;
71
+ }
72
+ return state;
73
+ }
74
+ /**
75
+ * Detects packages in a project.
76
+ *
77
+ * @param projectRoot - Path to project root
78
+ * @returns Array of package information
79
+ */
80
+ static detectPackages(projectRoot) {
81
+ const packages = [];
82
+ const packagesDir = join(projectRoot, 'packages');
83
+ if (!existsSync(packagesDir)) {
84
+ return packages;
85
+ }
86
+ const entries = readdirSync(packagesDir, { withFileTypes: true });
87
+ for (const entry of entries) {
88
+ if (!entry.isDirectory())
89
+ continue;
90
+ const packagePath = join(packagesDir, entry.name);
91
+ const packageJsonPath = join(packagePath, 'package.json');
92
+ if (existsSync(packageJsonPath)) {
93
+ packages.push({
94
+ name: entry.name,
95
+ path: `packages/${entry.name}`,
96
+ type: ProjectService.detectPackageType(entry.name, packagePath),
97
+ });
98
+ }
99
+ }
100
+ return packages;
101
+ }
102
+ /**
103
+ * Detects the type of a package based on its name and contents.
104
+ *
105
+ * @param name - Package directory name
106
+ * @param packagePath - Full path to package
107
+ * @returns Package type
108
+ */
109
+ static detectPackageType(name, packagePath) {
110
+ // Common naming conventions
111
+ if (name === 'api' || name.includes('-api'))
112
+ return 'api';
113
+ if (name === 'frontend' || name === 'web' || name === 'app')
114
+ return 'frontend';
115
+ if (name === 'cms' || name === 'admin')
116
+ return 'cms';
117
+ if (name === 'infra' || name === 'infrastructure' || name === 'cdk')
118
+ return 'infra';
119
+ if (name === 'shared' || name === 'types' || name === 'common')
120
+ return 'shared';
121
+ // Check package.json for clues
122
+ try {
123
+ const packageJson = JSON.parse(readFileSync(join(packagePath, 'package.json'), 'utf-8'));
124
+ const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
125
+ if (deps['aws-cdk-lib'] || deps['@aws-cdk/core'])
126
+ return 'infra';
127
+ if (deps['@remix-run/node'] || deps['@remix-run/react'])
128
+ return 'frontend';
129
+ if (deps['express'] || deps['@aws-lambda'])
130
+ return 'api';
131
+ }
132
+ catch {
133
+ // Ignore parsing errors
134
+ }
135
+ return 'unknown';
136
+ }
137
+ /**
138
+ * Gets the display name for a package type.
139
+ *
140
+ * @param type - Package type
141
+ * @returns Human-readable type name
142
+ */
143
+ static getPackageTypeLabel(type) {
144
+ const labels = {
145
+ api: 'API',
146
+ frontend: 'Frontend',
147
+ cms: 'CMS',
148
+ infra: 'Infrastructure',
149
+ shared: 'Shared',
150
+ unknown: 'Package',
151
+ };
152
+ return labels[type];
153
+ }
154
+ /**
155
+ * Gets the directory name from a path.
156
+ *
157
+ * @param cwd - Current working directory
158
+ * @returns Directory name
159
+ */
160
+ static getDirectoryName(cwd = process.cwd()) {
161
+ return basename(cwd);
162
+ }
163
+ /**
164
+ * Checks if a directory is empty or nearly empty.
165
+ *
166
+ * @param dir - Directory to check
167
+ * @returns True if directory is empty or only has hidden files
168
+ */
169
+ static isEmptyDirectory(dir) {
170
+ try {
171
+ const entries = readdirSync(dir);
172
+ return entries.length === 0 || entries.every((e) => e.startsWith('.'));
173
+ }
174
+ catch {
175
+ return false;
176
+ }
177
+ }
178
+ }
179
+ //# sourceMappingURL=ProjectService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProjectService.js","sourceRoot":"","sources":["../../../src/tui/services/ProjectService.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW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KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * TUI services exports.
3
+ */
4
+ export * from './ConfigService.js';
5
+ export * from './ProjectService.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tui/services/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * TUI services exports.
3
+ */
4
+ export * from './ConfigService.js';
5
+ export * from './ProjectService.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tui/services/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Application context for the FND TUI.
3
+ *
4
+ * Provides global state management using React Context and useReducer.
5
+ */
6
+ import React, { type ReactNode } from 'react';
7
+ import { AppState, AppAction, Screen, Preferences } from './types.js';
8
+ /**
9
+ * Context value type.
10
+ */
11
+ interface AppContextValue {
12
+ /** Current application state */
13
+ state: AppState;
14
+ /** Dispatch function for state updates */
15
+ dispatch: React.Dispatch<AppAction>;
16
+ /** Navigate to a screen */
17
+ navigate: (screen: Screen, params?: Record<string, unknown>) => void;
18
+ /** Go back to previous screen */
19
+ goBack: () => void;
20
+ /** Toggle help overlay */
21
+ toggleHelp: () => void;
22
+ /** Toggle settings panel */
23
+ toggleSettings: () => void;
24
+ /** Show a notification */
25
+ showNotification: (message: string, type?: 'info' | 'success' | 'warning' | 'error') => void;
26
+ /** Clear notification */
27
+ clearNotification: () => void;
28
+ /** Update preferences */
29
+ updatePreferences: (prefs: Partial<Preferences>) => void;
30
+ }
31
+ /**
32
+ * Props for the AppProvider component.
33
+ */
34
+ interface AppProviderProps {
35
+ /** Child components */
36
+ children: ReactNode;
37
+ /** Optional initial state override (for testing) */
38
+ initialStateOverride?: Partial<AppState>;
39
+ }
40
+ /**
41
+ * Provides application state to the component tree.
42
+ */
43
+ export declare function AppProvider({ children, initialStateOverride }: AppProviderProps): React.ReactElement;
44
+ /**
45
+ * Hook to access application state and actions.
46
+ *
47
+ * @returns Application context value
48
+ * @throws Error if used outside of AppProvider
49
+ */
50
+ export declare function useAppState(): AppContextValue;
51
+ /**
52
+ * Hook to access just the dispatch function.
53
+ *
54
+ * @returns Dispatch function
55
+ */
56
+ export declare function useAppDispatch(): React.Dispatch<AppAction>;
57
+ export {};
58
+ //# sourceMappingURL=AppContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppContext.d.ts","sourceRoot":"","sources":["../../../src/tui/state/AppContext.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,EAAsD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClG,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAgB,WAAW,EAAE,MAAM,YAAY,CAAC;AAGpF;;GAEG;AACH,UAAU,eAAe;IACvB,gCAAgC;IAChC,KAAK,EAAE,QAAQ,CAAC;IAChB,0CAA0C;IAC1C,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACpC,2BAA2B;IAC3B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACrE,iCAAiC;IACjC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,0BAA0B;IAC1B,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,4BAA4B;IAC5B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,0BAA0B;IAC1B,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,KAAK,IAAI,CAAC;IAC7F,yBAAyB;IACzB,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,yBAAyB;IACzB,iBAAiB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CAC1D;AAID;;GAEG;AACH,UAAU,gBAAgB;IACxB,uBAAuB;IACvB,QAAQ,EAAE,SAAS,CAAC;IACpB,oDAAoD;IACpD,oBAAoB,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,oBAAoB,EAAE,EAAE,gBAAgB,GAAG,KAAK,CAAC,YAAY,CAmDpG;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,eAAe,CAM7C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAG1D"}
@@ -0,0 +1,75 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Application context for the FND TUI.
4
+ *
5
+ * Provides global state management using React Context and useReducer.
6
+ */
7
+ import { createContext, useContext, useReducer, useCallback } from 'react';
8
+ import { initialState } from './types.js';
9
+ import { appReducer } from './reducer.js';
10
+ const AppContext = createContext(null);
11
+ /**
12
+ * Provides application state to the component tree.
13
+ */
14
+ export function AppProvider({ children, initialStateOverride }) {
15
+ const mergedInitialState = initialStateOverride
16
+ ? { ...initialState, ...initialStateOverride }
17
+ : initialState;
18
+ const [state, dispatch] = useReducer(appReducer, mergedInitialState);
19
+ const navigate = useCallback((screen, params) => {
20
+ dispatch({ type: 'NAVIGATE', screen, params });
21
+ }, []);
22
+ const goBack = useCallback(() => {
23
+ dispatch({ type: 'GO_BACK' });
24
+ }, []);
25
+ const toggleHelp = useCallback(() => {
26
+ dispatch({ type: 'TOGGLE_HELP' });
27
+ }, []);
28
+ const toggleSettings = useCallback(() => {
29
+ dispatch({ type: 'TOGGLE_SETTINGS' });
30
+ }, []);
31
+ const showNotification = useCallback((message, type = 'info') => {
32
+ dispatch({ type: 'SET_NOTIFICATION', message, notificationType: type });
33
+ }, []);
34
+ const clearNotification = useCallback(() => {
35
+ dispatch({ type: 'SET_NOTIFICATION', message: null });
36
+ }, []);
37
+ const updatePreferences = useCallback((prefs) => {
38
+ dispatch({ type: 'UPDATE_PREFERENCES', preferences: prefs });
39
+ }, []);
40
+ const value = {
41
+ state,
42
+ dispatch,
43
+ navigate,
44
+ goBack,
45
+ toggleHelp,
46
+ toggleSettings,
47
+ showNotification,
48
+ clearNotification,
49
+ updatePreferences,
50
+ };
51
+ return _jsx(AppContext.Provider, { value: value, children: children });
52
+ }
53
+ /**
54
+ * Hook to access application state and actions.
55
+ *
56
+ * @returns Application context value
57
+ * @throws Error if used outside of AppProvider
58
+ */
59
+ export function useAppState() {
60
+ const context = useContext(AppContext);
61
+ if (!context) {
62
+ throw new Error('useAppState must be used within an AppProvider');
63
+ }
64
+ return context;
65
+ }
66
+ /**
67
+ * Hook to access just the dispatch function.
68
+ *
69
+ * @returns Dispatch function
70
+ */
71
+ export function useAppDispatch() {
72
+ const { dispatch } = useAppState();
73
+ return dispatch;
74
+ }
75
+ //# sourceMappingURL=AppContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppContext.js","sourceRoot":"","sources":["../../../src/tui/state/AppContext.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAkB,MAAM,OAAO,CAAC;AAClG,OAAO,EAA+B,YAAY,EAAe,MAAM,YAAY,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA0B1C,MAAM,UAAU,GAAG,aAAa,CAAyB,IAAI,CAAC,CAAC;AAY/D;;GAEG;AACH,MAAM,UAAU,WAAW,C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AE,IAAI,EAAE,CAAC,CAAC;IACxD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,iBAAiB,GAAG,WAAW,CAAC,CAAC,KAA2B,EAAE,EAAE;QACpE,QAAQ,CAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;IAC/D,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,KAAK,GAAoB;QAC7B,KAAK;QACL,QAAQ;QACR,QAAQ;QACR,MAAM;QACN,UAAU;QACV,cAAc;QACd,gBAAgB;QAChB,iBAAiB;QACjB,iBAAiB;KAClB,CAAC;IAEF,OAAO,KAAC,UAAU,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAuB,CAAC;AAC7E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW;IACzB,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,EAAE,QAAQ,EAAE,GAAG,WAAW,EAAE,CAAC;IACnC,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * TUI state management exports.
3
+ */
4
+ export * from './types.js';
5
+ export * from './reducer.js';
6
+ export * from './AppContext.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tui/state/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * TUI state management exports.
3
+ */
4
+ export * from './types.js';
5
+ export * from './reducer.js';
6
+ export * from './AppContext.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tui/state/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * State reducer for the FND TUI.
3
+ */
4
+ import { AppState, AppAction } from './types.js';
5
+ /**
6
+ * Reduces application state based on actions.
7
+ *
8
+ * @param state - Current state
9
+ * @param action - Action to process
10
+ * @returns New state
11
+ */
12
+ export declare function appReducer(state: AppState, action: AppAction): AppState;
13
+ //# sourceMappingURL=reducer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../../src/tui/state/reducer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAgB,MAAM,YAAY,CAAC;AAE/D;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,GAAG,QAAQ,CAyIvE"}
@@ -0,0 +1,136 @@
1
+ /**
2
+ * State reducer for the FND TUI.
3
+ */
4
+ import { initialState } from './types.js';
5
+ /**
6
+ * Reduces application state based on actions.
7
+ *
8
+ * @param state - Current state
9
+ * @param action - Action to process
10
+ * @returns New state
11
+ */
12
+ export function appReducer(state, action) {
13
+ switch (action.type) {
14
+ case 'NAVIGATE': {
15
+ // Don't add duplicate entries to history
16
+ const history = state.navigation.currentScreen !== action.screen
17
+ ? [...state.navigation.history, state.navigation.currentScreen]
18
+ : state.navigation.history;
19
+ return {
20
+ ...state,
21
+ navigation: {
22
+ currentScreen: action.screen,
23
+ history,
24
+ params: action.params,
25
+ },
26
+ // Close overlays when navigating
27
+ ui: {
28
+ ...state.ui,
29
+ showHelp: false,
30
+ showSettings: false,
31
+ },
32
+ };
33
+ }
34
+ case 'GO_BACK': {
35
+ if (state.navigation.history.length === 0) {
36
+ return state;
37
+ }
38
+ const history = [...state.navigation.history];
39
+ const previousScreen = history.pop();
40
+ return {
41
+ ...state,
42
+ navigation: {
43
+ currentScreen: previousScreen,
44
+ history,
45
+ params: undefined,
46
+ },
47
+ // Close overlays when navigating
48
+ ui: {
49
+ ...state.ui,
50
+ showHelp: false,
51
+ showSettings: false,
52
+ },
53
+ };
54
+ }
55
+ case 'SET_PROJECT': {
56
+ return {
57
+ ...state,
58
+ project: {
59
+ ...state.project,
60
+ ...action.payload,
61
+ },
62
+ };
63
+ }
64
+ case 'SET_PROJECT_LOADING': {
65
+ return {
66
+ ...state,
67
+ project: {
68
+ ...state.project,
69
+ isLoading: action.loading,
70
+ },
71
+ };
72
+ }
73
+ case 'TOGGLE_HELP': {
74
+ return {
75
+ ...state,
76
+ ui: {
77
+ ...state.ui,
78
+ showHelp: !state.ui.showHelp,
79
+ // Close settings when opening help
80
+ showSettings: state.ui.showHelp ? state.ui.showSettings : false,
81
+ },
82
+ };
83
+ }
84
+ case 'TOGGLE_SETTINGS': {
85
+ return {
86
+ ...state,
87
+ ui: {
88
+ ...state.ui,
89
+ showSettings: !state.ui.showSettings,
90
+ // Close help when opening settings
91
+ showHelp: state.ui.showSettings ? state.ui.showHelp : false,
92
+ },
93
+ };
94
+ }
95
+ case 'SET_NOTIFICATION': {
96
+ return {
97
+ ...state,
98
+ ui: {
99
+ ...state.ui,
100
+ notification: action.message,
101
+ notificationType: action.notificationType ?? 'info',
102
+ },
103
+ };
104
+ }
105
+ case 'UPDATE_DIMENSIONS': {
106
+ return {
107
+ ...state,
108
+ ui: {
109
+ ...state.ui,
110
+ dimensions: {
111
+ width: action.width,
112
+ height: action.height,
113
+ },
114
+ },
115
+ };
116
+ }
117
+ case 'UPDATE_PREFERENCES': {
118
+ return {
119
+ ...state,
120
+ preferences: {
121
+ ...state.preferences,
122
+ ...action.preferences,
123
+ },
124
+ };
125
+ }
126
+ case 'RESET_STATE': {
127
+ return initialState;
128
+ }
129
+ default: {
130
+ // Ensure exhaustive handling
131
+ const _exhaustiveCheck = action;
132
+ return state;
133
+ }
134
+ }
135
+ }
136
+ //# sourceMappingURL=reducer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reducer.js","sourceRoot":"","sources":["../../../src/tui/state/reducer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAuB,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAAe,EAAE,MAAiB;IAC3D,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,UAAU,CAAC,CAAC,CAAC;YAChB,yCAAyC;YACzC,MAAM,OAAO,GACX,KAAK,CAAC,UAAU,CAAC,aAAa,KAAK,MAAM,CAAC,MAAM;gBAC9C,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC;gBAC/D,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;YAE/B,OAAO;gBACL,GAAG,KAAK;gBACR,UAAU,EAAE;oBACV,aAAa,EAAE,MAAM,CAAC,MAAM;oBAC5B,OAAO;oBACP,MAAM,EAAE,MAAM,CAAC,MAAM;iBACtB;gBACD,iCAAiC;gBACjC,EAAE,EAAE;oBACF,GAAG,KAAK,CAAC,EAAE;oBACX,QAAQ,EAAE,KAAK;oBACf,YAAY,EAAE,KAAK;iBACpB;aACF,CAAC;QACJ,CAAC;QAED,KAAK,SAAS,CAAC,CAAC,CAAC;YACf,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC1C,OAAO,KAAK,CAAC;YACf,CAAC;YAED,MAAM,OAAO,GAAG,CAAC,GAAG,KAAK,CAAC,UAAU,C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QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK;iBAC5D;aACF,CAAC;QACJ,CAAC;QAED,KAAK,kBAAkB,CAAC,CAAC,CAAC;YACxB,OAAO;gBACL,GAAG,KAAK;gBACR,EAAE,EAAE;oBACF,GAAG,KAAK,CAAC,EAAE;oBACX,YAAY,EAAE,MAAM,CAAC,OAAO;oBAC5B,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,IAAI,MAAM;iBACpD;aACF,CAAC;QACJ,CAAC;QAED,KAAK,mBAAmB,CAAC,CAAC,CAAC;YACzB,OAAO;gBACL,GAAG,KAAK;gBACR,EAAE,EAAE;oBACF,GAAG,KAAK,CAAC,EAAE;oBACX,UAAU,EAAE;wBACV,KAAK,EAAE,MAAM,CAAC,KAAK;wBACnB,MAAM,EAAE,MAAM,CAAC,MAAM;qBACtB;iBACF;aACF,CAAC;QACJ,CAAC;QAED,KAAK,oBAAoB,CAAC,CAAC,CAAC;YAC1B,OAAO;gBACL,GAAG,KAAK;gBACR,WAAW,EAAE;oBACX,GAAG,KAAK,CAAC,WAAW;oBACpB,GAAG,MAAM,CAAC,WAAW;iBACtB;aACF,CAAC;QACJ,CAAC;QAED,KAAK,aAAa,CAAC,CAAC,CAAC;YACnB,OAAO,YAAY,CAAC;QACtB,CAAC;QAED,OAAO,CAAC,CAAC,CAAC;YACR,6BAA6B;YAC7B,MAAM,gBAAgB,GAAU,MAAM,CAAC;YACvC,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * State types for the FND TUI.
3
+ */
4
+ /**
5
+ * Available screens in the TUI.
6
+ */
7
+ export type Screen = 'welcome' | 'project-dashboard' | 'create-project' | 'add-package' | 'deploy' | 'settings' | 'help';
8
+ /**
9
+ * Navigation state.
10
+ */
11
+ export interface NavigationState {
12
+ /** Current active screen */
13
+ currentScreen: Screen;
14
+ /** Navigation history for back button */
15
+ history: Screen[];
16
+ /** Optional parameters for the current screen */
17
+ params?: Record<string, unknown>;
18
+ }
19
+ /**
20
+ * Project context types.
21
+ */
22
+ export type ProjectContext = 'new' | 'existing' | 'legacy' | 'unknown';
23
+ /**
24
+ * Package information.
25
+ */
26
+ export interface PackageInfo {
27
+ /** Package name */
28
+ name: string;
29
+ /** Package path relative to project root */
30
+ path: string;
31
+ /** Package type */
32
+ type: 'api' | 'frontend' | 'cms' | 'infra' | 'shared' | 'unknown';
33
+ }
34
+ /**
35
+ * Project state.
36
+ */
37
+ export interface ProjectState {
38
+ /** Project context type */
39
+ context: ProjectContext;
40
+ /** Project root path (if in a project) */
41
+ rootPath: string | null;
42
+ /** Project name (if in a project) */
43
+ name: string | null;
44
+ /** List of packages in the project */
45
+ packages: PackageInfo[];
46
+ /** Current deployment stage (if set) */
47
+ currentStage: string | null;
48
+ /** Whether the project is loading */
49
+ isLoading: boolean;
50
+ /** Error message if project detection failed */
51
+ error: string | null;
52
+ }
53
+ /**
54
+ * UI state.
55
+ */
56
+ export interface UIState {
57
+ /** Whether help overlay is shown */
58
+ showHelp: boolean;
59
+ /** Whether settings panel is shown */
60
+ showSettings: boolean;
61
+ /** Current notification message */
62
+ notification: string | null;
63
+ /** Notification type */
64
+ notificationType: 'info' | 'success' | 'warning' | 'error' | null;
65
+ /** Terminal dimensions */
66
+ dimensions: {
67
+ width: number;
68
+ height: number;
69
+ };
70
+ }
71
+ /**
72
+ * User preferences.
73
+ */
74
+ export interface Preferences {
75
+ /** Default deployment stage */
76
+ defaultStage: string;
77
+ /** Whether to show ASCII banner */
78
+ showBanner: boolean;
79
+ /** Color theme */
80
+ theme: 'auto' | 'dark' | 'light';
81
+ }
82
+ /**
83
+ * Complete application state.
84
+ */
85
+ export interface AppState {
86
+ /** Navigation state */
87
+ navigation: NavigationState;
88
+ /** Project state */
89
+ project: ProjectState;
90
+ /** UI state */
91
+ ui: UIState;
92
+ /** User preferences */
93
+ preferences: Preferences;
94
+ }
95
+ /**
96
+ * Initial application state.
97
+ */
98
+ export declare const initialState: AppState;
99
+ /**
100
+ * Action types for state management.
101
+ */
102
+ export type AppAction = {
103
+ type: 'NAVIGATE';
104
+ screen: Screen;
105
+ params?: Record<string, unknown>;
106
+ } | {
107
+ type: 'GO_BACK';
108
+ } | {
109
+ type: 'SET_PROJECT';
110
+ payload: Partial<ProjectState>;
111
+ } | {
112
+ type: 'SET_PROJECT_LOADING';
113
+ loading: boolean;
114
+ } | {
115
+ type: 'TOGGLE_HELP';
116
+ } | {
117
+ type: 'TOGGLE_SETTINGS';
118
+ } | {
119
+ type: 'SET_NOTIFICATION';
120
+ message: string | null;
121
+ notificationType?: 'info' | 'success' | 'warning' | 'error';
122
+ } | {
123
+ type: 'UPDATE_DIMENSIONS';
124
+ width: number;
125
+ height: number;
126
+ } | {
127
+ type: 'UPDATE_PREFERENCES';
128
+ preferences: Partial<Preferences>;
129
+ } | {
130
+ type: 'RESET_STATE';
131
+ };
132
+ //# sourceMappingURL=types.d.ts.map