@mrpatronz/nexusflow 0.2.19 → 1.3.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 (236) hide show
  1. package/README.md +27 -3
  2. package/dist/analyzers/index.d.ts +23 -0
  3. package/dist/analyzers/index.d.ts.map +1 -1
  4. package/dist/analyzers/index.js +62 -0
  5. package/dist/analyzers/index.js.map +1 -1
  6. package/dist/commands/commands.test.js +20 -6
  7. package/dist/commands/commands.test.js.map +1 -1
  8. package/dist/commands/commit.d.ts +2 -0
  9. package/dist/commands/commit.d.ts.map +1 -1
  10. package/dist/commands/commit.js +27 -5
  11. package/dist/commands/commit.js.map +1 -1
  12. package/dist/commands/diff.d.ts +9 -2
  13. package/dist/commands/diff.d.ts.map +1 -1
  14. package/dist/commands/diff.js +36 -12
  15. package/dist/commands/diff.js.map +1 -1
  16. package/dist/commands/doctor.js +2 -2
  17. package/dist/commands/doctor.js.map +1 -1
  18. package/dist/commands/handoff.js +2 -2
  19. package/dist/commands/handoff.js.map +1 -1
  20. package/dist/commands/refresh.d.ts +4 -2
  21. package/dist/commands/refresh.d.ts.map +1 -1
  22. package/dist/commands/refresh.js +20 -36
  23. package/dist/commands/refresh.js.map +1 -1
  24. package/dist/commands/schedule.d.ts +35 -0
  25. package/dist/commands/schedule.d.ts.map +1 -0
  26. package/dist/commands/schedule.js +151 -0
  27. package/dist/commands/schedule.js.map +1 -0
  28. package/dist/commands/sync.d.ts.map +1 -1
  29. package/dist/commands/sync.js +28 -7
  30. package/dist/commands/sync.js.map +1 -1
  31. package/dist/core/analysis-cache.d.ts +58 -0
  32. package/dist/core/analysis-cache.d.ts.map +1 -0
  33. package/dist/core/analysis-cache.js +116 -0
  34. package/dist/core/analysis-cache.js.map +1 -0
  35. package/dist/core/analysis-cache.test.d.ts +2 -0
  36. package/dist/core/analysis-cache.test.d.ts.map +1 -0
  37. package/dist/core/analysis-cache.test.js +108 -0
  38. package/dist/core/analysis-cache.test.js.map +1 -0
  39. package/dist/core/refresh.d.ts +41 -0
  40. package/dist/core/refresh.d.ts.map +1 -0
  41. package/dist/core/refresh.js +60 -0
  42. package/dist/core/refresh.js.map +1 -0
  43. package/dist/core/scheduler.d.ts +117 -0
  44. package/dist/core/scheduler.d.ts.map +1 -0
  45. package/dist/core/scheduler.js +247 -0
  46. package/dist/core/scheduler.js.map +1 -0
  47. package/dist/core/scheduler.test.d.ts +2 -0
  48. package/dist/core/scheduler.test.d.ts.map +1 -0
  49. package/dist/core/scheduler.test.js +111 -0
  50. package/dist/core/scheduler.test.js.map +1 -0
  51. package/dist/core/sync.d.ts +6 -0
  52. package/dist/core/sync.d.ts.map +1 -1
  53. package/dist/core/sync.js +15 -5
  54. package/dist/core/sync.js.map +1 -1
  55. package/dist/generators/index.d.ts +7 -1
  56. package/dist/generators/index.d.ts.map +1 -1
  57. package/dist/generators/index.js +14 -1
  58. package/dist/generators/index.js.map +1 -1
  59. package/dist/index.js +107 -4
  60. package/dist/index.js.map +1 -1
  61. package/dist/server.d.ts.map +1 -1
  62. package/dist/server.js +81 -0
  63. package/dist/server.js.map +1 -1
  64. package/dist/server.test.js +66 -0
  65. package/dist/server.test.js.map +1 -1
  66. package/dist/utils/multi-git.d.ts +21 -0
  67. package/dist/utils/multi-git.d.ts.map +1 -1
  68. package/dist/utils/multi-git.js +40 -4
  69. package/dist/utils/multi-git.js.map +1 -1
  70. package/package.json +13 -1
  71. package/.agents/skills/ccc/SKILL.md +0 -71
  72. package/.agents/skills/ccc/references/management.md +0 -110
  73. package/.agents/skills/ccc/references/settings.md +0 -126
  74. package/.github/dependabot.yml +0 -52
  75. package/.github/workflows/ci.yml +0 -44
  76. package/.github/workflows/dependabot-merge.yml +0 -53
  77. package/.github/workflows/release-desktop.yml +0 -67
  78. package/.github/workflows/release-npm.yml +0 -65
  79. package/.github/workflows/release-vscode.yml +0 -61
  80. package/.vscode/launch.json +0 -17
  81. package/.vscode/tasks.json +0 -17
  82. package/GETTING_STARTED.md +0 -114
  83. package/desktop/build-installer.js +0 -228
  84. package/desktop/build.js +0 -118
  85. package/desktop/installer/nexusflow.iss +0 -35
  86. package/desktop/neutralino.config.json +0 -39
  87. package/desktop/package-lock.json +0 -1060
  88. package/desktop/package.json +0 -14
  89. package/extension/media/icon.svg +0 -1
  90. package/extension/package-lock.json +0 -6044
  91. package/extension/package.json +0 -117
  92. package/extension/src/extension.ts +0 -653
  93. package/extension/tsconfig.json +0 -21
  94. package/gui/README.md +0 -73
  95. package/gui/e2e/dashboard.spec.ts +0 -61
  96. package/gui/e2e/wizard.spec.ts +0 -346
  97. package/gui/eslint.config.js +0 -26
  98. package/gui/index.html +0 -17
  99. package/gui/package-lock.json +0 -3137
  100. package/gui/package.json +0 -37
  101. package/gui/playwright.config.ts +0 -41
  102. package/gui/public/app_logo.png +0 -0
  103. package/gui/public/favicon.svg +0 -1
  104. package/gui/public/icons.svg +0 -24
  105. package/gui/src/App.css +0 -1
  106. package/gui/src/App.tsx +0 -3573
  107. package/gui/src/app/AppSidebar.tsx +0 -69
  108. package/gui/src/assets/hero.png +0 -0
  109. package/gui/src/assets/react.svg +0 -1
  110. package/gui/src/assets/vite.svg +0 -1
  111. package/gui/src/components/AddRepoPicker.tsx +0 -81
  112. package/gui/src/components/ui/Button.tsx +0 -40
  113. package/gui/src/components/ui/Card.tsx +0 -6
  114. package/gui/src/components/ui/EmptyState.tsx +0 -22
  115. package/gui/src/components/ui/Input.tsx +0 -21
  116. package/gui/src/components/ui/Menu.tsx +0 -71
  117. package/gui/src/components/ui/Modal.tsx +0 -39
  118. package/gui/src/components/ui/PageHeader.tsx +0 -21
  119. package/gui/src/components/ui/RepoStatusStrip.tsx +0 -33
  120. package/gui/src/components/ui/Skeleton.tsx +0 -5
  121. package/gui/src/components/ui/StatusPill.tsx +0 -36
  122. package/gui/src/components/ui/Tabs.tsx +0 -40
  123. package/gui/src/components/ui/cn.ts +0 -4
  124. package/gui/src/components/ui/index.ts +0 -16
  125. package/gui/src/features/changes/ChangesViewer.tsx +0 -388
  126. package/gui/src/features/knowledge/KnowledgeBase.tsx +0 -84
  127. package/gui/src/features/onboarding/OnboardingWizard.tsx +0 -230
  128. package/gui/src/features/plan/ImplementationPlan.tsx +0 -32
  129. package/gui/src/features/services/ServiceConsole.tsx +0 -215
  130. package/gui/src/features/sessions/SessionHistory.tsx +0 -195
  131. package/gui/src/index.css +0 -167
  132. package/gui/src/lib/status.ts +0 -24
  133. package/gui/src/main.tsx +0 -94
  134. package/gui/src/pages/DashboardPage.tsx +0 -129
  135. package/gui/src/pages/WorkspacesPage.tsx +0 -352
  136. package/gui/src/types.ts +0 -81
  137. package/gui/tsconfig.app.json +0 -25
  138. package/gui/tsconfig.json +0 -7
  139. package/gui/tsconfig.node.json +0 -24
  140. package/gui/vite.config.ts +0 -12
  141. package/resources/workflows/plan-implement-review.md +0 -8
  142. package/resources/workflows/research-verify.md +0 -6
  143. package/resources/workflows/solo-developer.md +0 -3
  144. package/scripts/simulate-workspaces.ts +0 -55
  145. package/skills-lock.json +0 -11
  146. package/src/analyzers/detect-apis.ts +0 -290
  147. package/src/analyzers/detect-deps.ts +0 -315
  148. package/src/analyzers/detect-existing.ts +0 -74
  149. package/src/analyzers/detect-ports.ts +0 -110
  150. package/src/analyzers/index.ts +0 -97
  151. package/src/analyzers/messaging-analyzer.ts +0 -254
  152. package/src/analyzers/readme-summarizer.ts +0 -102
  153. package/src/analyzers/run-analyzer.ts +0 -269
  154. package/src/analyzers/tech-stack.ts +0 -283
  155. package/src/commands/adapter.ts +0 -348
  156. package/src/commands/add-repo.ts +0 -156
  157. package/src/commands/commands.test.ts +0 -156
  158. package/src/commands/commit.ts +0 -131
  159. package/src/commands/config.ts +0 -52
  160. package/src/commands/create.ts +0 -204
  161. package/src/commands/desktop.ts +0 -128
  162. package/src/commands/diff.ts +0 -125
  163. package/src/commands/doctor.ts +0 -370
  164. package/src/commands/handoff.ts +0 -266
  165. package/src/commands/init.ts +0 -134
  166. package/src/commands/list.ts +0 -46
  167. package/src/commands/logs.ts +0 -63
  168. package/src/commands/mcp.ts +0 -94
  169. package/src/commands/open.ts +0 -129
  170. package/src/commands/refresh.ts +0 -137
  171. package/src/commands/remove.ts +0 -98
  172. package/src/commands/start.ts +0 -117
  173. package/src/commands/status.ts +0 -54
  174. package/src/commands/stop.ts +0 -55
  175. package/src/commands/sync.ts +0 -125
  176. package/src/commands/tui.ts +0 -484
  177. package/src/commands/ui.ts +0 -111
  178. package/src/core/adapters/local-storage.ts +0 -66
  179. package/src/core/adapters/obsidian-storage.ts +0 -151
  180. package/src/core/adapters/registry.ts +0 -44
  181. package/src/core/adapters/storage.test.ts +0 -174
  182. package/src/core/adapters/vault-storage.ts +0 -86
  183. package/src/core/config.test.ts +0 -96
  184. package/src/core/config.ts +0 -140
  185. package/src/core/graph.ts +0 -344
  186. package/src/core/plugins/index.ts +0 -17
  187. package/src/core/plugins/loader.ts +0 -36
  188. package/src/core/ports/storage.ts +0 -71
  189. package/src/core/scanner.test.ts +0 -61
  190. package/src/core/scanner.ts +0 -91
  191. package/src/core/storage.ts +0 -37
  192. package/src/core/sync.ts +0 -121
  193. package/src/core/workspace-state.test.ts +0 -108
  194. package/src/core/workspace-state.ts +0 -130
  195. package/src/core/workspace.ts +0 -487
  196. package/src/core/worktree.ts +0 -120
  197. package/src/generators/antigravity.ts +0 -32
  198. package/src/generators/base.ts +0 -243
  199. package/src/generators/claude.ts +0 -34
  200. package/src/generators/codex.ts +0 -48
  201. package/src/generators/copilot.ts +0 -56
  202. package/src/generators/cursor.ts +0 -44
  203. package/src/generators/diff-context.ts +0 -75
  204. package/src/generators/index.ts +0 -322
  205. package/src/generators/map-generator.test.ts +0 -159
  206. package/src/generators/map-generator.ts +0 -539
  207. package/src/generators/plan-generator.ts +0 -483
  208. package/src/generators/skills-generator.ts +0 -259
  209. package/src/index.ts +0 -539
  210. package/src/mcp/server.ts +0 -338
  211. package/src/orchestration/detect.ts +0 -313
  212. package/src/orchestration/index.ts +0 -7
  213. package/src/orchestration/runner.ts +0 -283
  214. package/src/server.test.ts +0 -618
  215. package/src/server.ts +0 -1402
  216. package/src/types.ts +0 -451
  217. package/src/utils/detect-ai.test.ts +0 -44
  218. package/src/utils/detect-ai.ts +0 -84
  219. package/src/utils/detect-editors.test.ts +0 -48
  220. package/src/utils/detect-editors.ts +0 -57
  221. package/src/utils/git.test.ts +0 -74
  222. package/src/utils/git.ts +0 -117
  223. package/src/utils/local-ai.test.ts +0 -130
  224. package/src/utils/local-ai.ts +0 -116
  225. package/src/utils/multi-git.test.ts +0 -158
  226. package/src/utils/multi-git.ts +0 -405
  227. package/src/utils/prompts.ts +0 -209
  228. package/src/utils/session-finder.ts +0 -483
  229. package/src/utils/system-scanner.test.ts +0 -89
  230. package/src/utils/system-scanner.ts +0 -96
  231. package/src/utils/update-check.ts +0 -286
  232. package/src/utils/workflow-advisor.ts +0 -118
  233. package/src/utils/workflows.test.ts +0 -114
  234. package/src/utils/workflows.ts +0 -178
  235. package/tsconfig.json +0 -19
  236. package/vitest.config.ts +0 -14
@@ -1,348 +0,0 @@
1
- /**
2
- * @module commands/adapter
3
- * CLI commands for managing storage adapters.
4
- *
5
- * Usage:
6
- * nexusflow adapter list # List all available adapters
7
- * nexusflow adapter use <name> # Switch active adapter (prompts for config)
8
- * nexusflow adapter info <name> # Show adapter details and current settings
9
- * nexusflow adapter init <name> # Scaffold a new adapter plugin project
10
- */
11
-
12
- import chalk from 'chalk';
13
- import { input, confirm } from '@inquirer/prompts';
14
- import * as fs from 'node:fs/promises';
15
- import * as path from 'node:path';
16
-
17
- import { listStorageProviders, getStorageProvider } from '../core/adapters/registry.js';
18
- import { loadConfig, saveConfig } from '../core/config.js';
19
- import type { StorageAdapterMeta, AdapterConfigField } from '../core/ports/storage.js';
20
-
21
- /**
22
- * Lists all registered storage adapters in a formatted table.
23
- */
24
- export async function adapterListCommand(): Promise<void> {
25
- const config = await loadConfig();
26
- const activeName = config.storageProvider || 'local';
27
- const adapters = listStorageProviders();
28
-
29
- console.log(chalk.bold.cyan('\n📦 Available Storage Adapters\n'));
30
-
31
- // Table header
32
- const nameW = 18;
33
- const dispW = 22;
34
- const actW = 8;
35
- console.log(
36
- chalk.dim(' ') +
37
- chalk.bold('Name'.padEnd(nameW)) +
38
- chalk.bold('Display Name'.padEnd(dispW)) +
39
- chalk.bold('Active'.padEnd(actW)) +
40
- chalk.bold('Description')
41
- );
42
- console.log(chalk.dim(' ' + '─'.repeat(nameW + dispW + actW + 40)));
43
-
44
- for (const adapter of adapters) {
45
- const isActive = adapter.name === activeName;
46
- const activeMarker = isActive ? chalk.green(' ✔') : ' ';
47
- const configCount = adapter.configFields.length;
48
- const configHint = configCount > 0 ? chalk.dim(` (${configCount} settings)`) : '';
49
-
50
- console.log(
51
- ' ' +
52
- chalk.white(adapter.name.padEnd(nameW)) +
53
- chalk.cyan(adapter.displayName.padEnd(dispW)) +
54
- activeMarker.padEnd(actW) +
55
- chalk.gray(adapter.description) +
56
- configHint
57
- );
58
- }
59
- console.log();
60
- }
61
-
62
- /**
63
- * Shows detailed information about a specific adapter.
64
- */
65
- export async function adapterInfoCommand(adapterName: string): Promise<void> {
66
- const config = await loadConfig();
67
- const activeName = config.storageProvider || 'local';
68
-
69
- let meta: StorageAdapterMeta;
70
- try {
71
- meta = getStorageProvider(adapterName).meta;
72
- } catch {
73
- console.error(chalk.red(`\n✖ Adapter "${adapterName}" is not registered.\n`));
74
- const adapters = listStorageProviders();
75
- console.log(chalk.dim(` Available: ${adapters.map(a => a.name).join(', ')}`));
76
- return;
77
- }
78
-
79
- console.log(chalk.bold.cyan(`\n📦 Adapter: ${meta.displayName}\n`));
80
- console.log(` ${chalk.bold('Name:')} ${meta.name}`);
81
- console.log(` ${chalk.bold('Active:')} ${meta.name === activeName ? chalk.green('Yes') : 'No'}`);
82
- console.log(` ${chalk.bold('Description:')} ${meta.description}`);
83
-
84
- if (meta.configFields.length > 0) {
85
- console.log(`\n ${chalk.bold('Configuration Fields:')}`);
86
- const currentSettings = config.adapterConfig?.[meta.name] ?? {};
87
-
88
- for (const field of meta.configFields) {
89
- const currentValue = currentSettings[field.key];
90
- const defaultStr = field.default !== undefined ? chalk.dim(` (default: ${String(field.default)})`) : '';
91
- const requiredStr = field.required ? chalk.yellow(' *required') : '';
92
- const valueStr = currentValue !== undefined ? chalk.green(String(currentValue)) : chalk.dim('not set');
93
-
94
- console.log(` ${chalk.white(field.label)} [${field.key}]${requiredStr}${defaultStr}`);
95
- console.log(` ${chalk.dim(field.description || '')}`);
96
- console.log(` Current: ${valueStr}`);
97
- }
98
- } else {
99
- console.log(chalk.dim('\n No configuration needed.'));
100
- }
101
- console.log();
102
- }
103
-
104
- /**
105
- * Switches the active adapter and prompts for any required configuration.
106
- */
107
- export async function adapterUseCommand(adapterName: string): Promise<void> {
108
- let provider;
109
- try {
110
- provider = getStorageProvider(adapterName);
111
- } catch {
112
- console.error(chalk.red(`\n✖ Adapter "${adapterName}" is not registered.\n`));
113
- const adapters = listStorageProviders();
114
- console.log(chalk.dim(` Available: ${adapters.map(a => a.name).join(', ')}`));
115
- return;
116
- }
117
-
118
- const config = await loadConfig();
119
- const meta = provider.meta;
120
- const existingSettings = config.adapterConfig?.[meta.name] ?? {};
121
- const newSettings: Record<string, unknown> = { ...existingSettings };
122
-
123
- // Prompt for each config field
124
- if (meta.configFields.length > 0) {
125
- console.log(chalk.bold.cyan(`\n⚙️ Configure ${meta.displayName}\n`));
126
-
127
- for (const field of meta.configFields) {
128
- const currentValue = existingSettings[field.key];
129
- const defaultValue = currentValue !== undefined ? String(currentValue) : (field.default !== undefined ? String(field.default) : undefined);
130
-
131
- if (field.type === 'boolean') {
132
- const result = await confirm({
133
- message: field.label + (field.description ? chalk.dim(` — ${field.description}`) : ''),
134
- default: defaultValue === 'true' || field.default === true,
135
- });
136
- newSettings[field.key] = result;
137
- } else {
138
- const result = await input({
139
- message: field.label + (field.description ? chalk.dim(` — ${field.description}`) : ''),
140
- default: defaultValue,
141
- validate: (val) => {
142
- if (field.required && !val.trim()) return `${field.label} is required`;
143
- return true;
144
- },
145
- });
146
-
147
- if (field.type === 'number') {
148
- newSettings[field.key] = Number(result);
149
- } else {
150
- newSettings[field.key] = result;
151
- }
152
- }
153
- }
154
- }
155
-
156
- // Save config
157
- if (!config.adapterConfig) {
158
- config.adapterConfig = {};
159
- }
160
- config.adapterConfig[meta.name] = newSettings;
161
- config.storageProvider = meta.name;
162
- await saveConfig(config);
163
-
164
- // Apply configuration
165
- if (provider.configure) {
166
- provider.configure(newSettings);
167
- }
168
-
169
- console.log(chalk.green(`\n✔ Activated '${meta.displayName}' adapter.\n`));
170
- }
171
-
172
- /**
173
- * Scaffolds a new adapter plugin project.
174
- */
175
- export async function adapterInitCommand(adapterName: string): Promise<void> {
176
- const targetDir = path.resolve(adapterName);
177
-
178
- try {
179
- await fs.access(targetDir);
180
- console.error(chalk.red(`\n✖ Directory "${adapterName}" already exists.\n`));
181
- return;
182
- } catch {}
183
-
184
- console.log(chalk.bold.cyan(`\n🔧 Scaffolding adapter: ${adapterName}\n`));
185
-
186
- await fs.mkdir(path.join(targetDir, 'src'), { recursive: true });
187
-
188
- // package.json
189
- const pkg = {
190
- name: `nexusflow-${adapterName}`,
191
- version: '1.0.0',
192
- type: 'module',
193
- main: 'dist/index.js',
194
- scripts: {
195
- build: 'tsc',
196
- dev: 'tsc --watch',
197
- },
198
- peerDependencies: {
199
- '@mrpatronz/nexusflow': '>=0.2.0',
200
- },
201
- devDependencies: {
202
- typescript: '^5.0.0',
203
- },
204
- };
205
- await fs.writeFile(path.join(targetDir, 'package.json'), JSON.stringify(pkg, null, 2), 'utf8');
206
-
207
- // tsconfig.json
208
- const tsconfig = {
209
- compilerOptions: {
210
- target: 'ES2022',
211
- module: 'Node16',
212
- moduleResolution: 'Node16',
213
- outDir: 'dist',
214
- rootDir: 'src',
215
- strict: true,
216
- esModuleInterop: true,
217
- declaration: true,
218
- },
219
- include: ['src/**/*'],
220
- };
221
- await fs.writeFile(path.join(targetDir, 'tsconfig.json'), JSON.stringify(tsconfig, null, 2), 'utf8');
222
-
223
- // src/index.ts — starter adapter
224
- const indexContent = `/**
225
- * NexusFlow Storage Adapter: ${adapterName}
226
- *
227
- * Implement the StoragePort interface to create a custom storage backend.
228
- * See: https://github.com/antan87/NexusFlow#adapters
229
- */
230
-
231
- import type { StoragePort, StorageAdapterMeta, NexusFlowPlugin } from '@mrpatronz/nexusflow';
232
- // If the above import fails, use relative path to nexusflow's type definitions.
233
-
234
- class ${toPascalCase(adapterName)}Adapter implements StoragePort {
235
- readonly meta: StorageAdapterMeta = {
236
- name: '${adapterName}',
237
- displayName: '${toTitleCase(adapterName)}',
238
- description: 'A custom NexusFlow storage adapter.',
239
- configFields: [
240
- // Add your configuration fields here, e.g.:
241
- // { key: 'endpoint', label: 'API Endpoint', type: 'string', required: true, description: 'URL of the storage API' },
242
- ],
243
- };
244
-
245
- configure(settings: Record<string, unknown>): void {
246
- // Read your adapter-specific settings here
247
- }
248
-
249
- // ── Workspace (feature) layer ────────────────────────────
250
-
251
- async writeWorkspaceFile(workspacePath: string, featureId: string, filename: string, content: string): Promise<void> {
252
- throw new Error('Not implemented yet');
253
- }
254
-
255
- async readWorkspaceFile(workspacePath: string, featureId: string, filename: string): Promise<string> {
256
- throw new Error('Not implemented yet');
257
- }
258
-
259
- async workspaceFileExists(workspacePath: string, featureId: string, filename: string): Promise<boolean> {
260
- return false;
261
- }
262
-
263
- resolveWorkspaceFileUrl(workspacePath: string, featureId: string, filename: string): string {
264
- return '';
265
- }
266
-
267
- // ── Base (repo) layer ────────────────────────────────────
268
-
269
- async writeBaseFile(workspacePath: string, repoName: string, filename: string, content: string): Promise<void> {
270
- throw new Error('Not implemented yet');
271
- }
272
-
273
- async readBaseFile(workspacePath: string, repoName: string, filename: string): Promise<string> {
274
- throw new Error('Not implemented yet');
275
- }
276
-
277
- async baseFileExists(workspacePath: string, repoName: string, filename: string): Promise<boolean> {
278
- return false;
279
- }
280
-
281
- resolveBaseFileUrl(workspacePath: string, repoName: string, filename: string): string {
282
- return '';
283
- }
284
- }
285
-
286
- const plugin: NexusFlowPlugin = {
287
- name: 'nexusflow-${adapterName}',
288
- version: '1.0.0',
289
- register(context) {
290
- context.registerStorageProvider('${adapterName}', new ${toPascalCase(adapterName)}Adapter());
291
- },
292
- };
293
-
294
- export default plugin;
295
- `;
296
- await fs.writeFile(path.join(targetDir, 'src', 'index.ts'), indexContent, 'utf8');
297
-
298
- // README.md
299
- const readme = `# nexusflow-${adapterName}
300
-
301
- A custom storage adapter for [NexusFlow](https://github.com/antan87/NexusFlow).
302
-
303
- ## Development
304
-
305
- \`\`\`bash
306
- npm install
307
- npm run build
308
- \`\`\`
309
-
310
- ## Usage
311
-
312
- Add to your NexusFlow config (\`~/.nexusflow/config.json\`):
313
-
314
- \`\`\`json
315
- {
316
- "plugins": ["./path/to/nexusflow-${adapterName}/dist/index.js"],
317
- "storageProvider": "${adapterName}"
318
- }
319
- \`\`\`
320
-
321
- Or activate via CLI:
322
-
323
- \`\`\`bash
324
- nexusflow adapter use ${adapterName}
325
- \`\`\`
326
- `;
327
- await fs.writeFile(path.join(targetDir, 'README.md'), readme, 'utf8');
328
-
329
- console.log(chalk.green(' ✔ Created package.json'));
330
- console.log(chalk.green(' ✔ Created tsconfig.json'));
331
- console.log(chalk.green(' ✔ Created src/index.ts (starter adapter)'));
332
- console.log(chalk.green(' ✔ Created README.md'));
333
- console.log(chalk.bold.green(`\n✅ Adapter scaffolded at ${targetDir}\n`));
334
- console.log(chalk.dim(' Next steps:'));
335
- console.log(chalk.dim(` cd ${adapterName}`));
336
- console.log(chalk.dim(' npm install'));
337
- console.log(chalk.dim(' # Implement the StoragePort methods in src/index.ts'));
338
- console.log(chalk.dim(' npm run build'));
339
- console.log();
340
- }
341
-
342
- function toPascalCase(str: string): string {
343
- return str.split(/[-_]/).map(s => s.charAt(0).toUpperCase() + s.slice(1)).join('');
344
- }
345
-
346
- function toTitleCase(str: string): string {
347
- return str.split(/[-_]/).map(s => s.charAt(0).toUpperCase() + s.slice(1)).join(' ');
348
- }
@@ -1,156 +0,0 @@
1
- /**
2
- * @module commands/add-repo
3
- * Adds a repository to an existing NexusFlow workspace.
4
- */
5
-
6
- import chalk from 'chalk';
7
- import ora from 'ora';
8
- import { select, search } from '@inquirer/prompts';
9
- import * as path from 'node:path';
10
-
11
- import { loadConfig } from '../core/config.js';
12
- import { scanForRepos } from '../core/scanner.js';
13
- import { listWorkspaces, loadFeatureConfig, addRepoToWorkspace } from '../core/workspace.js';
14
-
15
- /**
16
- * Executes the add-repo command.
17
- *
18
- * @param repoPathArg - Optional repository path to add.
19
- * @param workspaceArg - Optional workspace path or name.
20
- */
21
- export async function addRepoCommand(
22
- repoPathArg?: string,
23
- workspaceArg?: string,
24
- ): Promise<void> {
25
- console.log(chalk.bold.cyan('\n➕ NexusFlow — Adding Repository to Workspace\n'));
26
-
27
- const config = await loadConfig();
28
-
29
- // 1. Resolve workspace
30
- let workspacePath: string | null = null;
31
- let workspaceName = '';
32
-
33
- if (workspaceArg) {
34
- const resolvedPath = path.isAbsolute(workspaceArg)
35
- ? workspaceArg
36
- : path.resolve(config.workspacesDir, workspaceArg);
37
-
38
- try {
39
- const manifest = await loadFeatureConfig(resolvedPath);
40
- if (manifest) {
41
- workspacePath = resolvedPath;
42
- workspaceName = manifest.branchName;
43
- }
44
- } catch {}
45
-
46
- if (!workspacePath) {
47
- const directPath = path.join(config.workspacesDir, workspaceArg);
48
- const manifest = await loadFeatureConfig(directPath);
49
- if (manifest) {
50
- workspacePath = directPath;
51
- workspaceName = manifest.branchName;
52
- } else {
53
- console.error(chalk.red(`✖ Invalid workspace: No nexusflow.json found at ${workspaceArg}`));
54
- return;
55
- }
56
- }
57
- } else {
58
- const cwdFeature = await loadFeatureConfig(process.cwd());
59
- if (cwdFeature) {
60
- workspacePath = cwdFeature.workspacePath;
61
- workspaceName = cwdFeature.branchName;
62
- } else {
63
- const workspaces = await listWorkspaces(config.workspacesDir);
64
- if (workspaces.length === 0) {
65
- console.log(chalk.yellow('No workspaces found.\n'));
66
- return;
67
- }
68
-
69
- const selected = await search({
70
- message: 'Search and select a workspace to add a repository to:',
71
- source: async (input) => {
72
- const query = (input || '').toLowerCase();
73
- const filtered = workspaces.filter(
74
- (ws) =>
75
- ws.branchName.toLowerCase().includes(query) ||
76
- ws.workspacePath.toLowerCase().includes(query)
77
- );
78
- return filtered.map((ws) => ({
79
- name: `${ws.branchName} ${chalk.dim(`(${ws.repos.length} repos)`)}`,
80
- value: ws,
81
- }));
82
- },
83
- });
84
-
85
- workspacePath = selected.workspacePath;
86
- workspaceName = selected.branchName;
87
- }
88
- }
89
-
90
- if (!workspacePath) return;
91
-
92
- const feature = await loadFeatureConfig(workspacePath);
93
- if (!feature) {
94
- console.error(chalk.red('✖ Failed to load workspace configuration.'));
95
- return;
96
- }
97
-
98
- // 2. Resolve repository to add
99
- let repoPathToAdd = '';
100
-
101
- if (repoPathArg) {
102
- repoPathToAdd = path.resolve(repoPathArg);
103
- } else {
104
- const scanSpinner = ora('Scanning for projects...').start();
105
- let repos = [];
106
- try {
107
- repos = await scanForRepos(config.devDir, config.scanDepth);
108
- scanSpinner.succeed(`Found ${chalk.bold(repos.length)} projects in ${config.devDir}`);
109
- } catch (error) {
110
- scanSpinner.fail('Failed to scan for projects');
111
- console.error(error);
112
- return;
113
- }
114
-
115
- const availableRepos = repos.filter(
116
- (r) => !feature.repos.includes(r.path)
117
- );
118
-
119
- if (availableRepos.length === 0) {
120
- console.log(chalk.yellow('All scanned repositories are already in the workspace.\n'));
121
- return;
122
- }
123
-
124
- repoPathToAdd = await search({
125
- message: 'Search and select a repository to add:',
126
- source: async (input) => {
127
- const query = (input || '').toLowerCase();
128
- const filtered = availableRepos.filter(
129
- (r) =>
130
- r.name.toLowerCase().includes(query) ||
131
- r.path.toLowerCase().includes(query)
132
- );
133
- return filtered.map((r) => ({
134
- name: `${r.name} ${chalk.dim(`(${r.path})`)}`,
135
- value: r.path,
136
- }));
137
- },
138
- });
139
- }
140
-
141
- const repoName = path.basename(repoPathToAdd);
142
- const spinner = ora(`Adding ${repoName} to workspace ${workspaceName}...`).start();
143
-
144
- try {
145
- await addRepoToWorkspace(workspacePath, repoPathToAdd);
146
- spinner.succeed(`Successfully added ${chalk.bold(repoName)} to workspace ${chalk.bold(workspaceName)}`);
147
- console.log(chalk.dim(' - Checked out git worktree'));
148
- console.log(chalk.dim(' - Updated nexusflow.json and .gitignore'));
149
- console.log(chalk.dim(' - Re-analyzed workspace codebases'));
150
- console.log(chalk.dim(' - Regenerated LLM instruction context files'));
151
- console.log();
152
- } catch (error) {
153
- spinner.fail(`Failed to add repository: ${error instanceof Error ? error.message : String(error)}`);
154
- console.log();
155
- }
156
- }
@@ -1,156 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import * as fs from 'node:fs/promises';
3
- import * as path from 'node:path';
4
- import { handoffCommand } from './handoff.js';
5
- import { refreshCommand } from './refresh.js';
6
- import { doctorCommand } from './doctor.js';
7
- import * as workspace from '../core/workspace.js';
8
- import * as multiGit from '../utils/multi-git.js';
9
- import * as analyzers from '../analyzers/index.js';
10
- import * as generators from '../generators/index.js';
11
-
12
- vi.mock('node:fs/promises');
13
- vi.mock('execa');
14
- vi.mock('../core/workspace.js');
15
- vi.mock('../utils/multi-git.js');
16
- vi.mock('../analyzers/index.js');
17
- vi.mock('../generators/index.js');
18
-
19
- describe('NexusFlow CLI New Commands unit tests', () => {
20
- const mockWorkspacePath = path.resolve('/mock/workspace');
21
- const repo1Path = path.join(mockWorkspacePath, 'repo-1');
22
-
23
- beforeEach(() => {
24
- vi.clearAllMocks();
25
- });
26
-
27
- describe('handoffCommand', () => {
28
- it('should generate a handoff bundle with repository status, branch and suggested files', async () => {
29
- const mockFeature = {
30
- id: 'test-feature',
31
- branchName: 'test-feature-branch',
32
- description: 'Test Feature description',
33
- repos: [repo1Path],
34
- originalRepos: [path.resolve('/mock/repo-1')],
35
- assistants: ['claude' as const],
36
- workspacePath: mockWorkspacePath,
37
- createdAt: new Date().toISOString(),
38
- };
39
-
40
- vi.spyOn(workspace, 'loadFeatureConfig').mockResolvedValue(mockFeature);
41
- vi.spyOn(multiGit, 'getRepoStatus').mockResolvedValue({
42
- hasChanges: true,
43
- changedFiles: ['src/file1.ts'],
44
- summary: '1 file changed',
45
- });
46
-
47
- const mockAnalysis = new Map();
48
- mockAnalysis.set(repo1Path, {
49
- name: 'repo-1',
50
- path: repo1Path,
51
- techStack: { languages: ['typescript'], frameworks: [], buildTools: [], projectType: 'backend' },
52
- endpoints: [],
53
- dependencies: [],
54
- ports: [],
55
- readmeSummary: 'README summary',
56
- existingAIConfigs: [],
57
- });
58
- vi.spyOn(analyzers, 'analyzeAllRepos').mockResolvedValue(mockAnalysis);
59
-
60
- const writtenFiles: Record<string, string> = {};
61
- vi.spyOn(fs, 'writeFile').mockImplementation(async (filePath: any, content: any) => {
62
- writtenFiles[path.resolve(filePath as string)] = content as string;
63
- return Promise.resolve();
64
- });
65
-
66
- // Run handoff command
67
- await handoffCommand(mockWorkspacePath);
68
-
69
- const expectedHandoffPath = path.resolve(path.join(mockWorkspacePath, 'nexusflow-handoff.md'));
70
- expect(fs.writeFile).toHaveBeenCalled();
71
- expect(writtenFiles[expectedHandoffPath]).toBeDefined();
72
-
73
- const content = writtenFiles[expectedHandoffPath]!;
74
- expect(content).toContain('# NexusFlow Handoff Bundle — test-feature-branch');
75
- expect(content).toContain('repo-1');
76
- expect(content).toContain('1 file changed');
77
- expect(content).toContain('src/file1.ts');
78
- });
79
- });
80
-
81
- describe('refreshCommand', () => {
82
- it('should trigger context regeneration and optional repack', async () => {
83
- const mockFeature = {
84
- id: 'test-feature',
85
- branchName: 'test-feature-branch',
86
- description: 'Test Feature description',
87
- repos: [repo1Path],
88
- originalRepos: [path.resolve('/mock/repo-1')],
89
- assistants: ['claude' as const],
90
- workspacePath: mockWorkspacePath,
91
- createdAt: new Date().toISOString(),
92
- };
93
-
94
- vi.spyOn(workspace, 'loadFeatureConfig').mockResolvedValue(mockFeature);
95
- vi.spyOn(analyzers, 'analyzeAllRepos').mockResolvedValue(new Map());
96
- vi.spyOn(generators, 'generateContextFiles').mockResolvedValue(undefined);
97
-
98
- // Run refresh command with repo filter
99
- await refreshCommand({ repo: 'repo-1' }, mockWorkspacePath);
100
-
101
- expect(analyzers.analyzeAllRepos).toHaveBeenCalled();
102
- expect(generators.generateContextFiles).toHaveBeenCalledWith(
103
- expect.any(Object),
104
- expect.any(Array),
105
- mockWorkspacePath,
106
- 'repo-1',
107
- undefined
108
- );
109
- });
110
- });
111
-
112
- describe('doctorCommand', () => {
113
- it('should complete health check successfully', async () => {
114
- const mockFeature = {
115
- id: 'test-feature',
116
- branchName: 'test-feature-branch',
117
- description: 'Test Feature description',
118
- repos: [repo1Path],
119
- originalRepos: [path.resolve('/mock/repo-1')],
120
- assistants: ['claude' as const],
121
- workspacePath: mockWorkspacePath,
122
- createdAt: new Date().toISOString(),
123
- };
124
-
125
- vi.spyOn(workspace, 'loadFeatureConfig').mockResolvedValue(mockFeature);
126
- vi.spyOn(fs, 'stat').mockResolvedValue({ isDirectory: () => true } as any);
127
- vi.spyOn(multiGit, 'getRepoStatus').mockResolvedValue({
128
- hasChanges: false,
129
- changedFiles: [],
130
- summary: 'Clean',
131
- });
132
-
133
- const mockAnalysis = new Map();
134
- mockAnalysis.set(repo1Path, {
135
- name: 'repo-1',
136
- path: repo1Path,
137
- techStack: { languages: ['typescript'], frameworks: [], buildTools: [], projectType: 'backend' },
138
- endpoints: [],
139
- dependencies: [],
140
- ports: [],
141
- readmeSummary: 'README summary',
142
- existingAIConfigs: [],
143
- });
144
- vi.spyOn(analyzers, 'analyzeAllRepos').mockResolvedValue(mockAnalysis);
145
- vi.spyOn(fs, 'access').mockResolvedValue(undefined); // covers .code-workspace + artifact checks
146
- vi.spyOn(fs, 'readFile').mockResolvedValue(JSON.stringify({ "search.useIgnoreFiles": false }));
147
-
148
- // Run doctor command
149
- await doctorCommand(mockWorkspacePath);
150
-
151
- expect(workspace.loadFeatureConfig).toHaveBeenCalledWith(mockWorkspacePath);
152
- expect(fs.stat).toHaveBeenCalledWith(repo1Path);
153
- expect(analyzers.analyzeAllRepos).toHaveBeenCalled();
154
- });
155
- });
156
- });