@mrpatronz/nexusflow 0.2.19 → 1.3.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 (294) hide show
  1. package/README.md +37 -7
  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/add-repo.d.ts +9 -0
  7. package/dist/commands/add-repo.d.ts.map +1 -1
  8. package/dist/commands/add-repo.js +12 -1
  9. package/dist/commands/add-repo.js.map +1 -1
  10. package/dist/commands/add-repo.test.d.ts +2 -0
  11. package/dist/commands/add-repo.test.d.ts.map +1 -0
  12. package/dist/commands/add-repo.test.js +30 -0
  13. package/dist/commands/add-repo.test.js.map +1 -0
  14. package/dist/commands/commands.test.js +26 -6
  15. package/dist/commands/commands.test.js.map +1 -1
  16. package/dist/commands/commit.d.ts +7 -1
  17. package/dist/commands/commit.d.ts.map +1 -1
  18. package/dist/commands/commit.js +31 -8
  19. package/dist/commands/commit.js.map +1 -1
  20. package/dist/commands/commit.test.d.ts +2 -0
  21. package/dist/commands/commit.test.d.ts.map +1 -0
  22. package/dist/commands/commit.test.js +54 -0
  23. package/dist/commands/commit.test.js.map +1 -0
  24. package/dist/commands/diff.d.ts +9 -2
  25. package/dist/commands/diff.d.ts.map +1 -1
  26. package/dist/commands/diff.js +36 -12
  27. package/dist/commands/diff.js.map +1 -1
  28. package/dist/commands/doctor.d.ts.map +1 -1
  29. package/dist/commands/doctor.js +16 -20
  30. package/dist/commands/doctor.js.map +1 -1
  31. package/dist/commands/handoff.d.ts.map +1 -1
  32. package/dist/commands/handoff.js +11 -15
  33. package/dist/commands/handoff.js.map +1 -1
  34. package/dist/commands/refresh.d.ts +4 -2
  35. package/dist/commands/refresh.d.ts.map +1 -1
  36. package/dist/commands/refresh.js +20 -36
  37. package/dist/commands/refresh.js.map +1 -1
  38. package/dist/commands/schedule.d.ts +35 -0
  39. package/dist/commands/schedule.d.ts.map +1 -0
  40. package/dist/commands/schedule.js +151 -0
  41. package/dist/commands/schedule.js.map +1 -0
  42. package/dist/commands/sync.d.ts.map +1 -1
  43. package/dist/commands/sync.js +28 -7
  44. package/dist/commands/sync.js.map +1 -1
  45. package/dist/commands/tui.js +1 -1
  46. package/dist/commands/tui.js.map +1 -1
  47. package/dist/commands/ui.d.ts +1 -0
  48. package/dist/commands/ui.d.ts.map +1 -1
  49. package/dist/commands/ui.js +5 -2
  50. package/dist/commands/ui.js.map +1 -1
  51. package/dist/core/adapters/local-storage.d.ts +7 -0
  52. package/dist/core/adapters/local-storage.d.ts.map +1 -1
  53. package/dist/core/adapters/local-storage.js +13 -4
  54. package/dist/core/adapters/local-storage.js.map +1 -1
  55. package/dist/core/adapters/storage.test.js +18 -0
  56. package/dist/core/adapters/storage.test.js.map +1 -1
  57. package/dist/core/analysis-cache.d.ts +58 -0
  58. package/dist/core/analysis-cache.d.ts.map +1 -0
  59. package/dist/core/analysis-cache.js +116 -0
  60. package/dist/core/analysis-cache.js.map +1 -0
  61. package/dist/core/analysis-cache.test.d.ts +2 -0
  62. package/dist/core/analysis-cache.test.d.ts.map +1 -0
  63. package/dist/core/analysis-cache.test.js +108 -0
  64. package/dist/core/analysis-cache.test.js.map +1 -0
  65. package/dist/core/refresh.d.ts +41 -0
  66. package/dist/core/refresh.d.ts.map +1 -0
  67. package/dist/core/refresh.js +56 -0
  68. package/dist/core/refresh.js.map +1 -0
  69. package/dist/core/scheduler.d.ts +117 -0
  70. package/dist/core/scheduler.d.ts.map +1 -0
  71. package/dist/core/scheduler.js +361 -0
  72. package/dist/core/scheduler.js.map +1 -0
  73. package/dist/core/scheduler.test.d.ts +2 -0
  74. package/dist/core/scheduler.test.d.ts.map +1 -0
  75. package/dist/core/scheduler.test.js +163 -0
  76. package/dist/core/scheduler.test.js.map +1 -0
  77. package/dist/core/sync.d.ts +6 -0
  78. package/dist/core/sync.d.ts.map +1 -1
  79. package/dist/core/sync.js +17 -12
  80. package/dist/core/sync.js.map +1 -1
  81. package/dist/core/workspace.d.ts +6 -0
  82. package/dist/core/workspace.d.ts.map +1 -1
  83. package/dist/core/workspace.js +32 -15
  84. package/dist/core/workspace.js.map +1 -1
  85. package/dist/core/workspace.test.d.ts +2 -0
  86. package/dist/core/workspace.test.d.ts.map +1 -0
  87. package/dist/core/workspace.test.js +42 -0
  88. package/dist/core/workspace.test.js.map +1 -0
  89. package/dist/generators/index.d.ts +7 -1
  90. package/dist/generators/index.d.ts.map +1 -1
  91. package/dist/generators/index.js +14 -1
  92. package/dist/generators/index.js.map +1 -1
  93. package/dist/generators/map-generator.d.ts.map +1 -1
  94. package/dist/generators/map-generator.js +4 -3
  95. package/dist/generators/map-generator.js.map +1 -1
  96. package/dist/generators/map-generator.test.js +4 -2
  97. package/dist/generators/map-generator.test.js.map +1 -1
  98. package/dist/gui/assets/index-ElroPpSP.js +26 -0
  99. package/dist/gui/index.html +1 -1
  100. package/dist/index.js +108 -4
  101. package/dist/index.js.map +1 -1
  102. package/dist/orchestration/index.d.ts +1 -1
  103. package/dist/orchestration/index.d.ts.map +1 -1
  104. package/dist/orchestration/index.js +1 -1
  105. package/dist/orchestration/index.js.map +1 -1
  106. package/dist/orchestration/runner.d.ts +16 -1
  107. package/dist/orchestration/runner.d.ts.map +1 -1
  108. package/dist/orchestration/runner.js +41 -5
  109. package/dist/orchestration/runner.js.map +1 -1
  110. package/dist/orchestration/runner.test.d.ts +2 -0
  111. package/dist/orchestration/runner.test.d.ts.map +1 -0
  112. package/dist/orchestration/runner.test.js +71 -0
  113. package/dist/orchestration/runner.test.js.map +1 -0
  114. package/dist/server.d.ts +17 -1
  115. package/dist/server.d.ts.map +1 -1
  116. package/dist/server.js +275 -114
  117. package/dist/server.js.map +1 -1
  118. package/dist/server.test.js +158 -1
  119. package/dist/server.test.js.map +1 -1
  120. package/dist/utils/multi-git.d.ts +21 -0
  121. package/dist/utils/multi-git.d.ts.map +1 -1
  122. package/dist/utils/multi-git.js +40 -4
  123. package/dist/utils/multi-git.js.map +1 -1
  124. package/dist/utils/prompts.d.ts.map +1 -1
  125. package/dist/utils/prompts.js +8 -2
  126. package/dist/utils/prompts.js.map +1 -1
  127. package/package.json +13 -1
  128. package/.agents/skills/ccc/SKILL.md +0 -71
  129. package/.agents/skills/ccc/references/management.md +0 -110
  130. package/.agents/skills/ccc/references/settings.md +0 -126
  131. package/.github/dependabot.yml +0 -52
  132. package/.github/workflows/ci.yml +0 -44
  133. package/.github/workflows/dependabot-merge.yml +0 -53
  134. package/.github/workflows/release-desktop.yml +0 -67
  135. package/.github/workflows/release-npm.yml +0 -65
  136. package/.github/workflows/release-vscode.yml +0 -61
  137. package/.vscode/launch.json +0 -17
  138. package/.vscode/tasks.json +0 -17
  139. package/GETTING_STARTED.md +0 -114
  140. package/desktop/build-installer.js +0 -228
  141. package/desktop/build.js +0 -118
  142. package/desktop/installer/nexusflow.iss +0 -35
  143. package/desktop/neutralino.config.json +0 -39
  144. package/desktop/package-lock.json +0 -1060
  145. package/desktop/package.json +0 -14
  146. package/dist/gui/assets/index-D8iJPvnk.js +0 -26
  147. package/extension/media/icon.svg +0 -1
  148. package/extension/package-lock.json +0 -6044
  149. package/extension/package.json +0 -117
  150. package/extension/src/extension.ts +0 -653
  151. package/extension/tsconfig.json +0 -21
  152. package/gui/README.md +0 -73
  153. package/gui/e2e/dashboard.spec.ts +0 -61
  154. package/gui/e2e/wizard.spec.ts +0 -346
  155. package/gui/eslint.config.js +0 -26
  156. package/gui/index.html +0 -17
  157. package/gui/package-lock.json +0 -3137
  158. package/gui/package.json +0 -37
  159. package/gui/playwright.config.ts +0 -41
  160. package/gui/public/app_logo.png +0 -0
  161. package/gui/public/favicon.svg +0 -1
  162. package/gui/public/icons.svg +0 -24
  163. package/gui/src/App.css +0 -1
  164. package/gui/src/App.tsx +0 -3573
  165. package/gui/src/app/AppSidebar.tsx +0 -69
  166. package/gui/src/assets/hero.png +0 -0
  167. package/gui/src/assets/react.svg +0 -1
  168. package/gui/src/assets/vite.svg +0 -1
  169. package/gui/src/components/AddRepoPicker.tsx +0 -81
  170. package/gui/src/components/ui/Button.tsx +0 -40
  171. package/gui/src/components/ui/Card.tsx +0 -6
  172. package/gui/src/components/ui/EmptyState.tsx +0 -22
  173. package/gui/src/components/ui/Input.tsx +0 -21
  174. package/gui/src/components/ui/Menu.tsx +0 -71
  175. package/gui/src/components/ui/Modal.tsx +0 -39
  176. package/gui/src/components/ui/PageHeader.tsx +0 -21
  177. package/gui/src/components/ui/RepoStatusStrip.tsx +0 -33
  178. package/gui/src/components/ui/Skeleton.tsx +0 -5
  179. package/gui/src/components/ui/StatusPill.tsx +0 -36
  180. package/gui/src/components/ui/Tabs.tsx +0 -40
  181. package/gui/src/components/ui/cn.ts +0 -4
  182. package/gui/src/components/ui/index.ts +0 -16
  183. package/gui/src/features/changes/ChangesViewer.tsx +0 -388
  184. package/gui/src/features/knowledge/KnowledgeBase.tsx +0 -84
  185. package/gui/src/features/onboarding/OnboardingWizard.tsx +0 -230
  186. package/gui/src/features/plan/ImplementationPlan.tsx +0 -32
  187. package/gui/src/features/services/ServiceConsole.tsx +0 -215
  188. package/gui/src/features/sessions/SessionHistory.tsx +0 -195
  189. package/gui/src/index.css +0 -167
  190. package/gui/src/lib/status.ts +0 -24
  191. package/gui/src/main.tsx +0 -94
  192. package/gui/src/pages/DashboardPage.tsx +0 -129
  193. package/gui/src/pages/WorkspacesPage.tsx +0 -352
  194. package/gui/src/types.ts +0 -81
  195. package/gui/tsconfig.app.json +0 -25
  196. package/gui/tsconfig.json +0 -7
  197. package/gui/tsconfig.node.json +0 -24
  198. package/gui/vite.config.ts +0 -12
  199. package/resources/workflows/plan-implement-review.md +0 -8
  200. package/resources/workflows/research-verify.md +0 -6
  201. package/resources/workflows/solo-developer.md +0 -3
  202. package/scripts/simulate-workspaces.ts +0 -55
  203. package/skills-lock.json +0 -11
  204. package/src/analyzers/detect-apis.ts +0 -290
  205. package/src/analyzers/detect-deps.ts +0 -315
  206. package/src/analyzers/detect-existing.ts +0 -74
  207. package/src/analyzers/detect-ports.ts +0 -110
  208. package/src/analyzers/index.ts +0 -97
  209. package/src/analyzers/messaging-analyzer.ts +0 -254
  210. package/src/analyzers/readme-summarizer.ts +0 -102
  211. package/src/analyzers/run-analyzer.ts +0 -269
  212. package/src/analyzers/tech-stack.ts +0 -283
  213. package/src/commands/adapter.ts +0 -348
  214. package/src/commands/add-repo.ts +0 -156
  215. package/src/commands/commands.test.ts +0 -156
  216. package/src/commands/commit.ts +0 -131
  217. package/src/commands/config.ts +0 -52
  218. package/src/commands/create.ts +0 -204
  219. package/src/commands/desktop.ts +0 -128
  220. package/src/commands/diff.ts +0 -125
  221. package/src/commands/doctor.ts +0 -370
  222. package/src/commands/handoff.ts +0 -266
  223. package/src/commands/init.ts +0 -134
  224. package/src/commands/list.ts +0 -46
  225. package/src/commands/logs.ts +0 -63
  226. package/src/commands/mcp.ts +0 -94
  227. package/src/commands/open.ts +0 -129
  228. package/src/commands/refresh.ts +0 -137
  229. package/src/commands/remove.ts +0 -98
  230. package/src/commands/start.ts +0 -117
  231. package/src/commands/status.ts +0 -54
  232. package/src/commands/stop.ts +0 -55
  233. package/src/commands/sync.ts +0 -125
  234. package/src/commands/tui.ts +0 -484
  235. package/src/commands/ui.ts +0 -111
  236. package/src/core/adapters/local-storage.ts +0 -66
  237. package/src/core/adapters/obsidian-storage.ts +0 -151
  238. package/src/core/adapters/registry.ts +0 -44
  239. package/src/core/adapters/storage.test.ts +0 -174
  240. package/src/core/adapters/vault-storage.ts +0 -86
  241. package/src/core/config.test.ts +0 -96
  242. package/src/core/config.ts +0 -140
  243. package/src/core/graph.ts +0 -344
  244. package/src/core/plugins/index.ts +0 -17
  245. package/src/core/plugins/loader.ts +0 -36
  246. package/src/core/ports/storage.ts +0 -71
  247. package/src/core/scanner.test.ts +0 -61
  248. package/src/core/scanner.ts +0 -91
  249. package/src/core/storage.ts +0 -37
  250. package/src/core/sync.ts +0 -121
  251. package/src/core/workspace-state.test.ts +0 -108
  252. package/src/core/workspace-state.ts +0 -130
  253. package/src/core/workspace.ts +0 -487
  254. package/src/core/worktree.ts +0 -120
  255. package/src/generators/antigravity.ts +0 -32
  256. package/src/generators/base.ts +0 -243
  257. package/src/generators/claude.ts +0 -34
  258. package/src/generators/codex.ts +0 -48
  259. package/src/generators/copilot.ts +0 -56
  260. package/src/generators/cursor.ts +0 -44
  261. package/src/generators/diff-context.ts +0 -75
  262. package/src/generators/index.ts +0 -322
  263. package/src/generators/map-generator.test.ts +0 -159
  264. package/src/generators/map-generator.ts +0 -539
  265. package/src/generators/plan-generator.ts +0 -483
  266. package/src/generators/skills-generator.ts +0 -259
  267. package/src/index.ts +0 -539
  268. package/src/mcp/server.ts +0 -338
  269. package/src/orchestration/detect.ts +0 -313
  270. package/src/orchestration/index.ts +0 -7
  271. package/src/orchestration/runner.ts +0 -283
  272. package/src/server.test.ts +0 -618
  273. package/src/server.ts +0 -1402
  274. package/src/types.ts +0 -451
  275. package/src/utils/detect-ai.test.ts +0 -44
  276. package/src/utils/detect-ai.ts +0 -84
  277. package/src/utils/detect-editors.test.ts +0 -48
  278. package/src/utils/detect-editors.ts +0 -57
  279. package/src/utils/git.test.ts +0 -74
  280. package/src/utils/git.ts +0 -117
  281. package/src/utils/local-ai.test.ts +0 -130
  282. package/src/utils/local-ai.ts +0 -116
  283. package/src/utils/multi-git.test.ts +0 -158
  284. package/src/utils/multi-git.ts +0 -405
  285. package/src/utils/prompts.ts +0 -209
  286. package/src/utils/session-finder.ts +0 -483
  287. package/src/utils/system-scanner.test.ts +0 -89
  288. package/src/utils/system-scanner.ts +0 -96
  289. package/src/utils/update-check.ts +0 -286
  290. package/src/utils/workflow-advisor.ts +0 -118
  291. package/src/utils/workflows.test.ts +0 -114
  292. package/src/utils/workflows.ts +0 -178
  293. package/tsconfig.json +0 -19
  294. 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
- });