ai-first-cli 1.2.2 → 1.2.3

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.
@@ -1,6 +1,7 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
3
  import { ensureDir, writeFile, readJsonFile } from "../utils/fileUtils.js";
4
+ import { DEFAULT_ADAPTER, type AnalysisAdapter } from "./adapters/baseAdapter.js";
4
5
 
5
6
  export interface Feature {
6
7
  name: string;
@@ -23,77 +24,31 @@ export interface SemanticContexts {
23
24
  flows: Flow[];
24
25
  }
25
26
 
26
- // ============================================================
27
- // CONFIGURATION - Feature Detection Rules
28
- // ============================================================
27
+ // Use DEFAULT_ADAPTER which has universal patterns for ALL languages/frameworks
28
+ const ADAPTER = DEFAULT_ADAPTER;
29
+
30
+ const CANDIDATE_ROOTS = ADAPTER.featureRoots;
31
+ const IGNORED_FOLDERS = new Set(ADAPTER.ignoredFolders);
32
+ const ENTRYPOINT_PATTERNS = ADAPTER.entrypointPatterns;
33
+ const FLOW_ENTRY_PATTERNS = ADAPTER.flowEntrypointPatterns;
34
+ const FLOW_EXCLUDE = new Set(ADAPTER.flowExcludePatterns);
35
+
36
+ const LAYER_PATTERNS: Record<string, string[]> = {};
37
+ for (const layer of ADAPTER.layerRules) {
38
+ LAYER_PATTERNS[layer.name] = layer.patterns;
39
+ }
29
40
 
30
- // 1. Candidate roots - scan inside these directories
31
- const CANDIDATE_ROOTS = [
32
- "src", "app", "packages", "services", "modules", "features",
33
- // MVC patterns - for projects without src/ prefix
34
- "controllers", "routes", "handlers", "views", "pages"
35
- ];
36
-
37
- // 2. Ignore folders - these are technical, not business features
38
- const IGNORED_FOLDERS = new Set([
39
- "utils",
40
- "helpers",
41
- "types",
42
- "interfaces",
43
- "constants",
44
- "config",
45
- "dto",
46
- "common",
47
- "shared"
48
- ]);
49
-
50
- // 3. Entrypoint patterns - files that indicate a business feature
51
- const ENTRYPOINT_PATTERNS = [
52
- "controller",
53
- "route",
54
- "handler",
55
- "command",
56
- "service"
57
- ];
58
-
59
- // 4. Flow-specific patterns
60
- const FLOW_ENTRY_PATTERNS = [
61
- "controller", "route", "handler", "command",
62
- // Frontend patterns
63
- "page", "screen", "view", "component"
64
- ];
65
-
66
- // 5. Flow exclusion patterns
67
- const FLOW_EXCLUDE = new Set([
68
- "repository", "repo", "utils", "helper", "model", "entity",
69
- "dto", "type", "interface", "constant", "config"
70
- ]);
71
-
72
- // 6. Layer detection
73
- const LAYER_PATTERNS: Record<string, string[]> = {
74
- api: ["controller", "handler", "route", "router", "api", "endpoint"],
75
- service: ["service", "services", "usecase", "interactor"],
76
- data: ["repository", "repo", "dal", "dao", "data", "persistence"],
77
- domain: ["model", "entity", "schema", "domain"],
78
- util: ["util", "helper", "lib", "common"]
79
- };
80
-
81
- const LAYER_PRIORITY: Record<string, number> = {
82
- api: 1, controller: 1, handler: 1, route: 1, router: 1,
83
- service: 2, usecase: 2, interactor: 2,
84
- data: 3, repository: 3, repo: 3, dal: 3, dao: 3, persistence: 3,
85
- model: 4, entity: 4, domain: 4,
86
- };
41
+ const LAYER_PRIORITY: Record<string, number> = {};
42
+ for (const layer of ADAPTER.layerRules) {
43
+ for (const pattern of layer.patterns) {
44
+ LAYER_PRIORITY[pattern] = layer.priority;
45
+ }
46
+ }
87
47
 
88
48
  const MAX_FLOW_DEPTH = 5;
89
49
  const MAX_FLOW_FILES = 30;
90
50
 
91
- // Supported source file extensions
92
- const SOURCE_EXTENSIONS = new Set([
93
- ".ts", ".tsx", ".js", ".jsx", ".py", ".java", ".kt", ".go", ".rs", ".rb", ".php", ".cs", ".vue", ".svelte",
94
- // Salesforce/Apex
95
- ".cls", ".trigger", ".apex", ".object"
96
- ]);
51
+ const SOURCE_EXTENSIONS = new Set(ADAPTER.supportedExtensions);
97
52
 
98
53
  // ============================================================
99
54
  // HELPER FUNCTIONS
@@ -304,6 +259,9 @@ export function generateFeatures(
304
259
  // Extract feature name from path - get the last segment
305
260
  const featureName = mod.path.split("/").pop() || moduleName;
306
261
 
262
+ // Skip ignored folders (utils, helpers, types, etc.)
263
+ if (isIgnoredFolder(featureName)) continue;
264
+
307
265
  features.push({
308
266
  name: featureName,
309
267
  path: mod.path,