sdd-mcp-server 1.6.2 → 1.8.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.
- package/README.md +48 -33
- package/dist/adapters/cli/SDDToolAdapter.js +23 -22
- package/dist/adapters/cli/SDDToolAdapter.js.map +1 -1
- package/dist/application/services/staticSteering.js +22 -19
- package/dist/application/services/staticSteering.js.map +1 -1
- package/dist/index.js +92 -57
- package/dist/index.js.map +1 -1
- package/dist/utils/moduleLoader.d.ts +9 -12
- package/dist/utils/moduleLoader.js +55 -52
- package/dist/utils/moduleLoader.js.map +1 -1
- package/dist/utils/specGenerator.js +228 -160
- package/dist/utils/specGenerator.js.map +1 -1
- package/package.json +2 -2
- package/dist/__tests__/legacy/setup.d.ts +0 -44
- package/dist/__tests__/legacy/setup.js +0 -178
- package/dist/__tests__/legacy/setup.js.map +0 -1
- package/dist/__tests__/legacy/test-helpers/mock-factories.d.ts +0 -26
- package/dist/__tests__/legacy/test-helpers/mock-factories.js +0 -466
- package/dist/__tests__/legacy/test-helpers/mock-factories.js.map +0 -1
- package/dist/__tests__/setup.d.ts +0 -44
- package/dist/__tests__/setup.js +0 -178
- package/dist/__tests__/setup.js.map +0 -1
- package/dist/__tests__/test-helpers/mock-factories.d.ts +0 -26
- package/dist/__tests__/test-helpers/mock-factories.js +0 -466
- package/dist/__tests__/test-helpers/mock-factories.js.map +0 -1
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
* - Development mode (src/utils/)
|
|
9
9
|
* - Alternative paths (parent directory)
|
|
10
10
|
*
|
|
11
|
+
* The loader supports both TypeScript (.ts) and JavaScript (.js, .mjs, .cjs) extensions
|
|
12
|
+
* for cross-context compatibility.
|
|
13
|
+
*
|
|
11
14
|
* @module moduleLoader
|
|
12
15
|
*/
|
|
13
16
|
/**
|
|
@@ -51,26 +54,20 @@ export interface ProjectAnalysis {
|
|
|
51
54
|
packageManager: string;
|
|
52
55
|
}
|
|
53
56
|
/**
|
|
54
|
-
* Load the documentGenerator module using
|
|
57
|
+
* Load the documentGenerator module using cross-context path resolution
|
|
55
58
|
*
|
|
56
|
-
* Attempts to load the module from multiple paths
|
|
57
|
-
*
|
|
58
|
-
* 2. ../utils/documentGenerator.js - From subdirectory (e.g., dist/tools/)
|
|
59
|
-
* 3. ./documentGenerator.js - Root-level published package
|
|
60
|
-
* 4. ../documentGenerator.js - Alternative root-level
|
|
59
|
+
* Attempts to load the module from multiple paths with multiple extensions.
|
|
60
|
+
* Supports both TypeScript (.ts) and JavaScript (.js, .mjs, .cjs) files.
|
|
61
61
|
*
|
|
62
62
|
* @returns The documentGenerator module with all export functions
|
|
63
63
|
* @throws Error if all import paths fail, with details of all attempts
|
|
64
64
|
*/
|
|
65
65
|
export declare function loadDocumentGenerator(): Promise<DocumentGeneratorModule>;
|
|
66
66
|
/**
|
|
67
|
-
* Load the specGenerator module using
|
|
67
|
+
* Load the specGenerator module using cross-context path resolution
|
|
68
68
|
*
|
|
69
|
-
* Attempts to load the module from multiple paths
|
|
70
|
-
*
|
|
71
|
-
* 2. ../utils/specGenerator.js - From subdirectory
|
|
72
|
-
* 3. ./specGenerator.js - Root-level published package
|
|
73
|
-
* 4. ../specGenerator.js - Alternative root-level
|
|
69
|
+
* Attempts to load the module from multiple paths with multiple extensions.
|
|
70
|
+
* Supports both TypeScript (.ts) and JavaScript (.js, .mjs, .cjs) files.
|
|
74
71
|
*
|
|
75
72
|
* @returns The specGenerator module with all export functions
|
|
76
73
|
* @throws Error if all import paths fail, with details of all attempts
|
|
@@ -8,74 +8,77 @@
|
|
|
8
8
|
* - Development mode (src/utils/)
|
|
9
9
|
* - Alternative paths (parent directory)
|
|
10
10
|
*
|
|
11
|
+
* The loader supports both TypeScript (.ts) and JavaScript (.js, .mjs, .cjs) extensions
|
|
12
|
+
* for cross-context compatibility.
|
|
13
|
+
*
|
|
11
14
|
* @module moduleLoader
|
|
12
15
|
*/
|
|
13
16
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* Attempts to load the module from multiple paths in priority order:
|
|
17
|
-
* 1. ./utils/documentGenerator.js - Compiled TypeScript in dist/utils/
|
|
18
|
-
* 2. ../utils/documentGenerator.js - From subdirectory (e.g., dist/tools/)
|
|
19
|
-
* 3. ./documentGenerator.js - Root-level published package
|
|
20
|
-
* 4. ../documentGenerator.js - Alternative root-level
|
|
21
|
-
*
|
|
22
|
-
* @returns The documentGenerator module with all export functions
|
|
23
|
-
* @throws Error if all import paths fail, with details of all attempts
|
|
17
|
+
* File extensions to try when loading modules
|
|
18
|
+
* Order matters: .js first for production builds, .ts for development
|
|
24
19
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
const EXTENSIONS = [".js", ".ts", ".mjs", ".cjs"];
|
|
21
|
+
/**
|
|
22
|
+
* Compute base paths for module resolution
|
|
23
|
+
* Returns relative paths that work in both dev (tsx) and prod (node) contexts
|
|
24
|
+
*/
|
|
25
|
+
function computeBasePaths(target) {
|
|
26
|
+
return [
|
|
27
|
+
`./utils/${target}`, // Same directory utils/ subfolder
|
|
28
|
+
`./${target}`, // Same directory
|
|
29
|
+
`../${target}`, // Parent directory (for root-level modules)
|
|
30
|
+
`../utils/${target}`, // Parent utils/ (typical case from dist/X to dist/utils/)
|
|
31
|
+
`../../${target}`, // Two levels up (for root-level modules from dist/utils/)
|
|
32
|
+
`../../utils/${target}`, // Two levels up utils/
|
|
31
33
|
];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Generic module loader with cross-context support
|
|
37
|
+
* Tries multiple paths with multiple extensions
|
|
38
|
+
*/
|
|
39
|
+
async function loadModule(target) {
|
|
40
|
+
const basePaths = computeBasePaths(target);
|
|
32
41
|
const errors = [];
|
|
33
|
-
for (const
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
for (const basePath of basePaths) {
|
|
43
|
+
for (const ext of EXTENSIONS) {
|
|
44
|
+
const fullPath = `${basePath}${ext}`;
|
|
45
|
+
try {
|
|
46
|
+
console.error(`[SDD-DEBUG] ModuleLoader attempting: ${fullPath}`);
|
|
47
|
+
const module = await import(fullPath);
|
|
48
|
+
console.error(`[SDD-DEBUG] ✅ Loaded ${target} from: ${fullPath}`);
|
|
49
|
+
return module;
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
53
|
+
errors.push(`${fullPath}: ${errorMessage}`);
|
|
54
|
+
}
|
|
42
55
|
}
|
|
43
56
|
}
|
|
44
57
|
// All paths failed
|
|
45
|
-
throw new Error(`Failed to load
|
|
58
|
+
throw new Error(`Failed to load ${target}. Attempted paths:\n${errors.map((e) => ` - ${e}`).join("\n")}`);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Load the documentGenerator module using cross-context path resolution
|
|
62
|
+
*
|
|
63
|
+
* Attempts to load the module from multiple paths with multiple extensions.
|
|
64
|
+
* Supports both TypeScript (.ts) and JavaScript (.js, .mjs, .cjs) files.
|
|
65
|
+
*
|
|
66
|
+
* @returns The documentGenerator module with all export functions
|
|
67
|
+
* @throws Error if all import paths fail, with details of all attempts
|
|
68
|
+
*/
|
|
69
|
+
export async function loadDocumentGenerator() {
|
|
70
|
+
return loadModule("documentGenerator");
|
|
46
71
|
}
|
|
47
72
|
/**
|
|
48
|
-
* Load the specGenerator module using
|
|
73
|
+
* Load the specGenerator module using cross-context path resolution
|
|
49
74
|
*
|
|
50
|
-
* Attempts to load the module from multiple paths
|
|
51
|
-
*
|
|
52
|
-
* 2. ../utils/specGenerator.js - From subdirectory
|
|
53
|
-
* 3. ./specGenerator.js - Root-level published package
|
|
54
|
-
* 4. ../specGenerator.js - Alternative root-level
|
|
75
|
+
* Attempts to load the module from multiple paths with multiple extensions.
|
|
76
|
+
* Supports both TypeScript (.ts) and JavaScript (.js, .mjs, .cjs) files.
|
|
55
77
|
*
|
|
56
78
|
* @returns The specGenerator module with all export functions
|
|
57
79
|
* @throws Error if all import paths fail, with details of all attempts
|
|
58
80
|
*/
|
|
59
81
|
export async function loadSpecGenerator() {
|
|
60
|
-
|
|
61
|
-
'./utils/specGenerator.js', // Priority 1: Compiled TS in dist/utils/
|
|
62
|
-
'../utils/specGenerator.js', // Priority 2: From subdirectory
|
|
63
|
-
'./specGenerator.js', // Priority 3: Root-level package
|
|
64
|
-
'../specGenerator.js' // Priority 4: Alternative root
|
|
65
|
-
];
|
|
66
|
-
const errors = [];
|
|
67
|
-
for (const path of paths) {
|
|
68
|
-
try {
|
|
69
|
-
const module = await import(path);
|
|
70
|
-
console.error(`[SDD-DEBUG] ✅ Loaded specGenerator from: ${path}`);
|
|
71
|
-
return module;
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
75
|
-
errors.push(`${path}: ${errorMessage}`);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
// All paths failed
|
|
79
|
-
throw new Error(`Failed to load specGenerator. Attempted paths:\n${errors.map(e => ` - ${e}`).join('\n')}`);
|
|
82
|
+
return loadModule("specGenerator");
|
|
80
83
|
}
|
|
81
84
|
//# sourceMappingURL=moduleLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moduleLoader.js","sourceRoot":"","sources":["../../src/utils/moduleLoader.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"moduleLoader.js","sourceRoot":"","sources":["../../src/utils/moduleLoader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAsDH;;;GAGG;AACH,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAE3D;;;GAGG;AACH,SAAS,gBAAgB,CAAC,MAAc;IACtC,OAAO;Q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