@sylphx/flow 1.7.0 → 1.8.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 (131) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/assets/agents/coder.md +72 -119
  3. package/assets/agents/orchestrator.md +26 -90
  4. package/assets/agents/reviewer.md +76 -47
  5. package/assets/agents/writer.md +82 -63
  6. package/assets/output-styles/silent.md +141 -8
  7. package/assets/rules/code-standards.md +9 -33
  8. package/assets/rules/core.md +67 -59
  9. package/package.json +2 -12
  10. package/src/commands/flow/execute.ts +470 -0
  11. package/src/commands/flow/index.ts +11 -0
  12. package/src/commands/flow/prompt.ts +35 -0
  13. package/src/commands/flow/setup.ts +312 -0
  14. package/src/commands/flow/targets.ts +18 -0
  15. package/src/commands/flow/types.ts +47 -0
  16. package/src/commands/flow-command.ts +18 -967
  17. package/src/commands/flow-orchestrator.ts +14 -5
  18. package/src/commands/hook-command.ts +1 -1
  19. package/src/commands/init-core.ts +12 -3
  20. package/src/commands/run-command.ts +1 -1
  21. package/src/config/rules.ts +1 -1
  22. package/src/core/error-handling.ts +1 -1
  23. package/src/core/loop-controller.ts +1 -1
  24. package/src/core/state-detector.ts +1 -1
  25. package/src/core/target-manager.ts +1 -1
  26. package/src/index.ts +1 -1
  27. package/src/shared/files/index.ts +1 -1
  28. package/src/shared/processing/index.ts +1 -1
  29. package/src/targets/claude-code.ts +3 -3
  30. package/src/targets/opencode.ts +3 -3
  31. package/src/utils/agent-enhancer.ts +2 -2
  32. package/src/utils/{mcp-config.ts → config/mcp-config.ts} +4 -4
  33. package/src/utils/{paths.ts → config/paths.ts} +1 -1
  34. package/src/utils/{settings.ts → config/settings.ts} +1 -1
  35. package/src/utils/{target-config.ts → config/target-config.ts} +5 -5
  36. package/src/utils/{target-utils.ts → config/target-utils.ts} +3 -3
  37. package/src/utils/display/banner.ts +25 -0
  38. package/src/utils/display/status.ts +55 -0
  39. package/src/utils/{file-operations.ts → files/file-operations.ts} +2 -2
  40. package/src/utils/files/jsonc.ts +36 -0
  41. package/src/utils/{sync-utils.ts → files/sync-utils.ts} +3 -3
  42. package/src/utils/index.ts +42 -61
  43. package/src/utils/version.ts +47 -0
  44. package/src/components/benchmark-monitor.tsx +0 -331
  45. package/src/components/reindex-progress.tsx +0 -261
  46. package/src/composables/functional/index.ts +0 -14
  47. package/src/composables/functional/useEnvironment.ts +0 -171
  48. package/src/composables/functional/useFileSystem.ts +0 -139
  49. package/src/composables/index.ts +0 -4
  50. package/src/composables/useEnv.ts +0 -13
  51. package/src/composables/useRuntimeConfig.ts +0 -27
  52. package/src/core/ai-sdk.ts +0 -603
  53. package/src/core/app-factory.ts +0 -381
  54. package/src/core/builtin-agents.ts +0 -9
  55. package/src/core/command-system.ts +0 -550
  56. package/src/core/config-system.ts +0 -550
  57. package/src/core/connection-pool.ts +0 -390
  58. package/src/core/di-container.ts +0 -155
  59. package/src/core/headless-display.ts +0 -96
  60. package/src/core/interfaces/index.ts +0 -22
  61. package/src/core/interfaces/repository.interface.ts +0 -91
  62. package/src/core/interfaces/service.interface.ts +0 -133
  63. package/src/core/interfaces.ts +0 -96
  64. package/src/core/result.ts +0 -351
  65. package/src/core/service-config.ts +0 -252
  66. package/src/core/session-service.ts +0 -121
  67. package/src/core/storage-factory.ts +0 -115
  68. package/src/core/stream-handler.ts +0 -288
  69. package/src/core/type-utils.ts +0 -427
  70. package/src/core/unified-storage.ts +0 -456
  71. package/src/core/validation/limit.ts +0 -46
  72. package/src/core/validation/query.ts +0 -20
  73. package/src/db/auto-migrate.ts +0 -322
  74. package/src/db/base-database-client.ts +0 -144
  75. package/src/db/cache-db.ts +0 -218
  76. package/src/db/cache-schema.ts +0 -75
  77. package/src/db/database.ts +0 -70
  78. package/src/db/index.ts +0 -252
  79. package/src/db/memory-db.ts +0 -153
  80. package/src/db/memory-schema.ts +0 -29
  81. package/src/db/schema.ts +0 -289
  82. package/src/db/session-repository.ts +0 -733
  83. package/src/domains/index.ts +0 -6
  84. package/src/domains/utilities/index.ts +0 -6
  85. package/src/domains/utilities/time/index.ts +0 -5
  86. package/src/domains/utilities/time/tools.ts +0 -291
  87. package/src/services/agent-service.ts +0 -273
  88. package/src/services/evaluation-service.ts +0 -271
  89. package/src/services/functional/evaluation-logic.ts +0 -296
  90. package/src/services/functional/file-processor.ts +0 -273
  91. package/src/services/functional/index.ts +0 -12
  92. package/src/services/memory.service.ts +0 -476
  93. package/src/types/api/batch.ts +0 -108
  94. package/src/types/api/errors.ts +0 -118
  95. package/src/types/api/index.ts +0 -55
  96. package/src/types/api/requests.ts +0 -76
  97. package/src/types/api/responses.ts +0 -180
  98. package/src/types/api/websockets.ts +0 -85
  99. package/src/types/benchmark.ts +0 -49
  100. package/src/types/database.types.ts +0 -510
  101. package/src/types/memory-types.ts +0 -63
  102. package/src/utils/advanced-tokenizer.ts +0 -191
  103. package/src/utils/ai-model-fetcher.ts +0 -19
  104. package/src/utils/async-file-operations.ts +0 -516
  105. package/src/utils/audio-player.ts +0 -345
  106. package/src/utils/codebase-helpers.ts +0 -211
  107. package/src/utils/console-ui.ts +0 -79
  108. package/src/utils/database-errors.ts +0 -140
  109. package/src/utils/debug-logger.ts +0 -49
  110. package/src/utils/file-scanner.ts +0 -259
  111. package/src/utils/help.ts +0 -20
  112. package/src/utils/immutable-cache.ts +0 -106
  113. package/src/utils/jsonc.ts +0 -158
  114. package/src/utils/memory-tui.ts +0 -414
  115. package/src/utils/models-dev.ts +0 -91
  116. package/src/utils/parallel-operations.ts +0 -487
  117. package/src/utils/process-manager.ts +0 -155
  118. package/src/utils/prompts.ts +0 -120
  119. package/src/utils/search-tool-builder.ts +0 -214
  120. package/src/utils/session-manager.ts +0 -168
  121. package/src/utils/session-title.ts +0 -87
  122. package/src/utils/simplified-errors.ts +0 -410
  123. package/src/utils/template-engine.ts +0 -94
  124. package/src/utils/test-audio.ts +0 -71
  125. package/src/utils/todo-context.ts +0 -46
  126. package/src/utils/token-counter.ts +0 -288
  127. /package/src/utils/{cli-output.ts → display/cli-output.ts} +0 -0
  128. /package/src/utils/{logger.ts → display/logger.ts} +0 -0
  129. /package/src/utils/{notifications.ts → display/notifications.ts} +0 -0
  130. /package/src/utils/{secret-utils.ts → security/secret-utils.ts} +0 -0
  131. /package/src/utils/{security.ts → security/security.ts} +0 -0
@@ -1,273 +0,0 @@
1
- /**
2
- * Functional file processing service
3
- * Pure file transformations separated from I/O
4
- *
5
- * DESIGN RATIONALE:
6
- * - Pure transformation functions
7
- * - Composable processing pipeline
8
- * - Side effects (I/O) explicit and isolated
9
- * - Testable without file system
10
- */
11
-
12
- import type { FileSystemError } from '../../core/functional/error-types.js';
13
- import { fileSystemError } from '../../core/functional/error-types.js';
14
- import type { Result } from '../../core/functional/result.js';
15
- import { all, failure, success } from '../../core/functional/result.js';
16
-
17
- /**
18
- * Domain types
19
- */
20
-
21
- export interface FileContent {
22
- path: string;
23
- content: string;
24
- metadata?: Record<string, unknown>;
25
- }
26
-
27
- export interface ProcessedFile {
28
- originalPath: string;
29
- processedContent: string;
30
- metadata: Record<string, unknown>;
31
- }
32
-
33
- export type FileTransform = (content: string) => string;
34
- export type FileValidator = (content: string) => Result<string, FileSystemError>;
35
-
36
- /**
37
- * Pure transformation functions
38
- */
39
-
40
- /**
41
- * Trim whitespace from content
42
- */
43
- export const trimContent: FileTransform = (content: string): string => {
44
- return content.trim();
45
- };
46
-
47
- /**
48
- * Normalize line endings to \n
49
- */
50
- export const normalizeLineEndings: FileTransform = (content: string): string => {
51
- return content.replace(/\r\n/g, '\n');
52
- };
53
-
54
- /**
55
- * Remove trailing whitespace from each line
56
- */
57
- export const removeTrailingWhitespace: FileTransform = (content: string): string => {
58
- return content
59
- .split('\n')
60
- .map((line) => line.trimEnd())
61
- .join('\n');
62
- };
63
-
64
- /**
65
- * Ensure file ends with newline
66
- */
67
- export const ensureTrailingNewline: FileTransform = (content: string): string => {
68
- if (!content.endsWith('\n')) {
69
- return `${content}\n`;
70
- }
71
- return content;
72
- };
73
-
74
- /**
75
- * Remove consecutive blank lines (keep max 1)
76
- */
77
- export const collapseBlankLines: FileTransform = (content: string): string => {
78
- return content.replace(/\n\n\n+/g, '\n\n');
79
- };
80
-
81
- /**
82
- * Apply multiple transforms in sequence
83
- */
84
- export const composeTransforms = (...transforms: FileTransform[]): FileTransform => {
85
- return (content: string) => transforms.reduce((acc, transform) => transform(acc), content);
86
- };
87
-
88
- /**
89
- * Standard cleanup pipeline
90
- */
91
- export const standardCleanup: FileTransform = composeTransforms(
92
- normalizeLineEndings,
93
- removeTrailingWhitespace,
94
- collapseBlankLines,
95
- ensureTrailingNewline
96
- );
97
-
98
- /**
99
- * Validation functions
100
- */
101
-
102
- /**
103
- * Validate content is not empty
104
- */
105
- export const validateNotEmpty: FileValidator = (
106
- content: string
107
- ): Result<string, FileSystemError> => {
108
- if (content.trim().length === 0) {
109
- return failure(fileSystemError('File content is empty', '', 'read'));
110
- }
111
- return success(content);
112
- };
113
-
114
- /**
115
- * Validate content size
116
- */
117
- export const validateSize =
118
- (maxBytes: number): FileValidator =>
119
- (content: string): Result<string, FileSystemError> => {
120
- const bytes = Buffer.byteLength(content, 'utf-8');
121
- if (bytes > maxBytes) {
122
- return failure(
123
- fileSystemError(`File content exceeds maximum size: ${bytes} > ${maxBytes}`, '', 'read', {
124
- context: { bytes, maxBytes },
125
- })
126
- );
127
- }
128
- return success(content);
129
- };
130
-
131
- /**
132
- * Validate content matches pattern
133
- */
134
- export const validatePattern =
135
- (pattern: RegExp, message: string): FileValidator =>
136
- (content: string): Result<string, FileSystemError> => {
137
- if (!pattern.test(content)) {
138
- return failure(fileSystemError(message, '', 'read'));
139
- }
140
- return success(content);
141
- };
142
-
143
- /**
144
- * Compose validators
145
- */
146
- export const composeValidators =
147
- (...validators: FileValidator[]): FileValidator =>
148
- (content: string): Result<string, FileSystemError> => {
149
- for (const validator of validators) {
150
- const result = validator(content);
151
- if (result._tag === 'Failure') {
152
- return result;
153
- }
154
- }
155
- return success(content);
156
- };
157
-
158
- /**
159
- * File processing operations
160
- */
161
-
162
- /**
163
- * Process a single file (pure transformation)
164
- */
165
- export const processFileContent = (
166
- file: FileContent,
167
- transform: FileTransform,
168
- validator?: FileValidator
169
- ): Result<ProcessedFile, FileSystemError> => {
170
- // Validate if validator provided
171
- if (validator) {
172
- const validationResult = validator(file.content);
173
- if (validationResult._tag === 'Failure') {
174
- return validationResult;
175
- }
176
- }
177
-
178
- // Apply transformation
179
- const processedContent = transform(file.content);
180
-
181
- return success({
182
- originalPath: file.path,
183
- processedContent,
184
- metadata: {
185
- ...file.metadata,
186
- processed: true,
187
- originalLength: file.content.length,
188
- processedLength: processedContent.length,
189
- },
190
- });
191
- };
192
-
193
- /**
194
- * Process multiple files
195
- */
196
- export const processFiles = (
197
- files: FileContent[],
198
- transform: FileTransform,
199
- validator?: FileValidator
200
- ): Result<ProcessedFile[], FileSystemError> => {
201
- const results = files.map((file) => processFileContent(file, transform, validator));
202
-
203
- return all(results);
204
- };
205
-
206
- /**
207
- * Filter files by extension (pure)
208
- */
209
- export const filterByExtension =
210
- (extensions: string[]) =>
211
- (files: FileContent[]): FileContent[] => {
212
- return files.filter((file) => {
213
- const ext = file.path.split('.').pop()?.toLowerCase();
214
- return ext && extensions.includes(ext);
215
- });
216
- };
217
-
218
- /**
219
- * Filter files by pattern (pure)
220
- */
221
- export const filterByPattern =
222
- (pattern: RegExp) =>
223
- (files: FileContent[]): FileContent[] => {
224
- return files.filter((file) => pattern.test(file.path));
225
- };
226
-
227
- /**
228
- * Sort files by path (pure)
229
- */
230
- export const sortByPath = (files: FileContent[]): FileContent[] => {
231
- return [...files].sort((a, b) => a.path.localeCompare(b.path));
232
- };
233
-
234
- /**
235
- * Group files by directory (pure)
236
- */
237
- export const groupByDirectory = (files: FileContent[]): Record<string, FileContent[]> => {
238
- return files.reduce(
239
- (acc, file) => {
240
- const dir = file.path.split('/').slice(0, -1).join('/') || '.';
241
- if (!acc[dir]) {
242
- acc[dir] = [];
243
- }
244
- acc[dir].push(file);
245
- return acc;
246
- },
247
- {} as Record<string, FileContent[]>
248
- );
249
- };
250
-
251
- /**
252
- * Extract metadata from content (pure)
253
- */
254
- export const extractMetadata =
255
- (extractor: (content: string) => Record<string, unknown>) =>
256
- (file: FileContent): FileContent => {
257
- return {
258
- ...file,
259
- metadata: {
260
- ...file.metadata,
261
- ...extractor(file.content),
262
- },
263
- };
264
- };
265
-
266
- /**
267
- * Building block for file processing pipelines
268
- */
269
- export const createFileProcessor = (transform: FileTransform, validator?: FileValidator) => {
270
- return (files: FileContent[]): Result<ProcessedFile[], FileSystemError> => {
271
- return processFiles(files, transform, validator);
272
- };
273
- };
@@ -1,12 +0,0 @@
1
- /**
2
- * Functional services
3
- * Business logic as composable pure functions
4
- *
5
- * DESIGN RATIONALE:
6
- * - Services as collections of pure functions
7
- * - Side effects isolated to service boundaries
8
- * - Composable through functional patterns
9
- * - Testable without mocking
10
- */
11
-
12
- export * from './file-processor.js';