@afterxleep/doc-bot 1.16.0 → 1.18.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/package.json +7 -4
- package/src/__tests__/temp-docs-1756129972061/test.md +5 -0
- package/src/__tests__/temp-docs-1756129972071/test.md +5 -0
- package/src/__tests__/temp-docs-1756129972075/test.md +5 -0
- package/src/__tests__/temp-docs-1756129972077/test.md +5 -0
- package/src/__tests__/temp-docs-1756129972079/test.md +5 -0
- package/src/__tests__/temp-docs-1756130189361/test.md +5 -0
- package/src/__tests__/temp-docs-1756130189372/test.md +5 -0
- package/src/__tests__/temp-docs-1756130189375/test.md +5 -0
- package/src/__tests__/temp-docs-1756130189378/test.md +5 -0
- package/src/__tests__/temp-docs-1756130189379/test.md +5 -0
- package/src/__tests__/temp-docs-1756130271128/test.md +5 -0
- package/src/__tests__/temp-docs-1756130271139/test.md +5 -0
- package/src/__tests__/temp-docs-1756130271142/test.md +5 -0
- package/src/__tests__/temp-docs-1756130271145/test.md +5 -0
- package/src/__tests__/temp-docs-1756130271146/test.md +5 -0
- package/src/__tests__/temp-docs-1756130687030/test.md +5 -0
- package/src/__tests__/temp-docs-1756130687044/test.md +5 -0
- package/src/__tests__/temp-docs-1756130687048/test.md +5 -0
- package/src/__tests__/temp-docs-1756130687051/test.md +5 -0
- package/src/__tests__/temp-docs-1756130687053/test.md +5 -0
- package/src/__tests__/temp-docs-1756131694925/test.md +5 -0
- package/src/__tests__/temp-docs-1756131694937/test.md +5 -0
- package/src/__tests__/temp-docs-1756131694941/test.md +5 -0
- package/src/__tests__/temp-docs-1756131694944/test.md +5 -0
- package/src/__tests__/temp-docs-1756131694946/test.md +5 -0
- package/src/__tests__/temp-docs-1756133998710/test.md +5 -0
- package/src/__tests__/temp-docs-1756133998721/test.md +5 -0
- package/src/__tests__/temp-docs-1756133998724/test.md +5 -0
- package/src/__tests__/temp-docs-1756133998727/test.md +5 -0
- package/src/__tests__/temp-docs-1756133998729/test.md +5 -0
- package/src/__tests__/temp-docs-1756134345935/test.md +5 -0
- package/src/__tests__/temp-docs-1756134345948/test.md +5 -0
- package/src/__tests__/temp-docs-1756134345952/test.md +5 -0
- package/src/__tests__/temp-docs-1756134345954/test.md +5 -0
- package/src/__tests__/temp-docs-1756134345957/test.md +5 -0
- package/src/__tests__/temp-docsets-1756129972079/2e443167/Mock.docset/Contents/Info.plist +10 -0
- package/src/__tests__/temp-docsets-1756129972079/2e443167/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756129972079/Mock.docset/Contents/Info.plist +10 -0
- package/src/__tests__/temp-docsets-1756129972079/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756129972079/docsets.json +10 -0
- package/src/__tests__/temp-docsets-1756130189379/Mock.docset/Contents/Info.plist +10 -0
- package/src/__tests__/temp-docsets-1756130189379/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756130189379/a4934c14/Mock.docset/Contents/Info.plist +10 -0
- package/src/__tests__/temp-docsets-1756130189379/a4934c14/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756130189379/docsets.json +10 -0
- package/src/__tests__/temp-docsets-1756130271146/3f8acbb2/Mock.docset/Contents/Info.plist +10 -0
- package/src/__tests__/temp-docsets-1756130271146/3f8acbb2/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756130271146/Mock.docset/Contents/Info.plist +10 -0
- package/src/__tests__/temp-docsets-1756130271146/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756130271146/docsets.json +10 -0
- package/src/__tests__/temp-docsets-1756130687053/6810e6bd/Mock.docset/Contents/Info.plist +10 -0
- package/src/__tests__/temp-docsets-1756130687053/6810e6bd/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756130687053/Mock.docset/Contents/Info.plist +10 -0
- package/src/__tests__/temp-docsets-1756130687053/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756130687053/docsets.json +10 -0
- package/src/__tests__/temp-docsets-1756131694946/Mock.docset/Contents/Info.plist +10 -0
- package/src/__tests__/temp-docsets-1756131694946/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756131694946/dd703046/Mock.docset/Contents/Info.plist +10 -0
- package/src/__tests__/temp-docsets-1756131694946/dd703046/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756131694946/docsets.json +10 -0
- package/src/__tests__/temp-docsets-1756133998729/9e061136/Mock.docset/Contents/Info.plist +10 -0
- package/src/__tests__/temp-docsets-1756133998729/9e061136/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756133998729/Mock.docset/Contents/Info.plist +10 -0
- package/src/__tests__/temp-docsets-1756133998729/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756133998729/docsets.json +10 -0
- package/src/__tests__/temp-docsets-1756134345957/03e730af/Mock.docset/Contents/Info.plist +10 -0
- package/src/__tests__/temp-docsets-1756134345957/03e730af/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756134345957/Mock.docset/Contents/Info.plist +10 -0
- package/src/__tests__/temp-docsets-1756134345957/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756134345957/docsets.json +10 -0
- package/src/index.js +18 -11
- package/src/services/DocumentationService.js +26 -1
- package/prompts/file-docs.txt +0 -52
- package/prompts/global-rules.txt +0 -83
- package/prompts/mandatory-rules.txt +0 -117
- package/prompts/search-results.txt +0 -48
- package/prompts/system-prompt.txt +0 -210
- package/src/__tests__/docset-integration.test.js +0 -146
- package/src/services/__tests__/DocumentationService.test.js +0 -318
- package/src/services/__tests__/UnifiedSearchService.test.js +0 -302
- package/src/services/docset/__tests__/EnhancedDocsetDatabase.test.js +0 -324
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@afterxleep/doc-bot",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "Generic MCP server for intelligent documentation access in any project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -12,9 +12,12 @@
|
|
|
12
12
|
"start:watch": "node bin/doc-bot.js --verbose --watch",
|
|
13
13
|
"start:examples": "node bin/doc-bot.js --docs ./samples --verbose",
|
|
14
14
|
"dev": "node bin/doc-bot.js --verbose --watch",
|
|
15
|
-
"test": "jest",
|
|
16
|
-
"test:watch": "jest --watch",
|
|
17
|
-
"test:coverage": "jest --coverage",
|
|
15
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
16
|
+
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch",
|
|
17
|
+
"test:coverage": "NODE_OPTIONS=--experimental-vm-modules jest --coverage",
|
|
18
|
+
"test:e2e": "node test/fixtures/create-test-docs.js && NODE_OPTIONS=--experimental-vm-modules jest test/e2e.test.js",
|
|
19
|
+
"test:unit": "NODE_OPTIONS=--experimental-vm-modules jest src/services/__tests__",
|
|
20
|
+
"test:setup": "node test/fixtures/create-test-docs.js",
|
|
18
21
|
"lint": "eslint src/ bin/ --ext .js",
|
|
19
22
|
"lint:fix": "eslint src/ bin/ --ext .js --fix"
|
|
20
23
|
},
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleName</key>
|
|
6
|
+
<string>Mock Documentation</string>
|
|
7
|
+
<key>CFBundleIdentifier</key>
|
|
8
|
+
<string>mock.documentation</string>
|
|
9
|
+
</dict>
|
|
10
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleName</key>
|
|
6
|
+
<string>Mock Documentation</string>
|
|
7
|
+
<key>CFBundleIdentifier</key>
|
|
8
|
+
<string>mock.documentation</string>
|
|
9
|
+
</dict>
|
|
10
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "2e443167",
|
|
4
|
+
"name": "Mock Documentation",
|
|
5
|
+
"source": "/Users/afterxleep/Developer/doc-bot/src/__tests__/temp-docsets-1756129972079/Mock.docset",
|
|
6
|
+
"path": "/Users/afterxleep/Developer/doc-bot/src/__tests__/temp-docsets-1756129972079/2e443167/Mock.docset",
|
|
7
|
+
"downloadedAt": "2025-08-25T13:52:52.088Z",
|
|
8
|
+
"size": 8513
|
|
9
|
+
}
|
|
10
|
+
]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleName</key>
|
|
6
|
+
<string>Mock Documentation</string>
|
|
7
|
+
<key>CFBundleIdentifier</key>
|
|
8
|
+
<string>mock.documentation</string>
|
|
9
|
+
</dict>
|
|
10
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleName</key>
|
|
6
|
+
<string>Mock Documentation</string>
|
|
7
|
+
<key>CFBundleIdentifier</key>
|
|
8
|
+
<string>mock.documentation</string>
|
|
9
|
+
</dict>
|
|
10
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "a4934c14",
|
|
4
|
+
"name": "Mock Documentation",
|
|
5
|
+
"source": "/Users/afterxleep/Developer/doc-bot/src/__tests__/temp-docsets-1756130189379/Mock.docset",
|
|
6
|
+
"path": "/Users/afterxleep/Developer/doc-bot/src/__tests__/temp-docsets-1756130189379/a4934c14/Mock.docset",
|
|
7
|
+
"downloadedAt": "2025-08-25T13:56:29.388Z",
|
|
8
|
+
"size": 8513
|
|
9
|
+
}
|
|
10
|
+
]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleName</key>
|
|
6
|
+
<string>Mock Documentation</string>
|
|
7
|
+
<key>CFBundleIdentifier</key>
|
|
8
|
+
<string>mock.documentation</string>
|
|
9
|
+
</dict>
|
|
10
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleName</key>
|
|
6
|
+
<string>Mock Documentation</string>
|
|
7
|
+
<key>CFBundleIdentifier</key>
|
|
8
|
+
<string>mock.documentation</string>
|
|
9
|
+
</dict>
|
|
10
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "3f8acbb2",
|
|
4
|
+
"name": "Mock Documentation",
|
|
5
|
+
"source": "/Users/afterxleep/Developer/doc-bot/src/__tests__/temp-docsets-1756130271146/Mock.docset",
|
|
6
|
+
"path": "/Users/afterxleep/Developer/doc-bot/src/__tests__/temp-docsets-1756130271146/3f8acbb2/Mock.docset",
|
|
7
|
+
"downloadedAt": "2025-08-25T13:57:51.155Z",
|
|
8
|
+
"size": 8513
|
|
9
|
+
}
|
|
10
|
+
]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleName</key>
|
|
6
|
+
<string>Mock Documentation</string>
|
|
7
|
+
<key>CFBundleIdentifier</key>
|
|
8
|
+
<string>mock.documentation</string>
|
|
9
|
+
</dict>
|
|
10
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleName</key>
|
|
6
|
+
<string>Mock Documentation</string>
|
|
7
|
+
<key>CFBundleIdentifier</key>
|
|
8
|
+
<string>mock.documentation</string>
|
|
9
|
+
</dict>
|
|
10
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "6810e6bd",
|
|
4
|
+
"name": "Mock Documentation",
|
|
5
|
+
"source": "/Users/afterxleep/Developer/doc-bot/src/__tests__/temp-docsets-1756130687053/Mock.docset",
|
|
6
|
+
"path": "/Users/afterxleep/Developer/doc-bot/src/__tests__/temp-docsets-1756130687053/6810e6bd/Mock.docset",
|
|
7
|
+
"downloadedAt": "2025-08-25T14:04:47.063Z",
|
|
8
|
+
"size": 8513
|
|
9
|
+
}
|
|
10
|
+
]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleName</key>
|
|
6
|
+
<string>Mock Documentation</string>
|
|
7
|
+
<key>CFBundleIdentifier</key>
|
|
8
|
+
<string>mock.documentation</string>
|
|
9
|
+
</dict>
|
|
10
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleName</key>
|
|
6
|
+
<string>Mock Documentation</string>
|
|
7
|
+
<key>CFBundleIdentifier</key>
|
|
8
|
+
<string>mock.documentation</string>
|
|
9
|
+
</dict>
|
|
10
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "dd703046",
|
|
4
|
+
"name": "Mock Documentation",
|
|
5
|
+
"source": "/Users/afterxleep/Developer/doc-bot/src/__tests__/temp-docsets-1756131694946/Mock.docset",
|
|
6
|
+
"path": "/Users/afterxleep/Developer/doc-bot/src/__tests__/temp-docsets-1756131694946/dd703046/Mock.docset",
|
|
7
|
+
"downloadedAt": "2025-08-25T14:21:34.958Z",
|
|
8
|
+
"size": 8513
|
|
9
|
+
}
|
|
10
|
+
]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleName</key>
|
|
6
|
+
<string>Mock Documentation</string>
|
|
7
|
+
<key>CFBundleIdentifier</key>
|
|
8
|
+
<string>mock.documentation</string>
|
|
9
|
+
</dict>
|
|
10
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleName</key>
|
|
6
|
+
<string>Mock Documentation</string>
|
|
7
|
+
<key>CFBundleIdentifier</key>
|
|
8
|
+
<string>mock.documentation</string>
|
|
9
|
+
</dict>
|
|
10
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "9e061136",
|
|
4
|
+
"name": "Mock Documentation",
|
|
5
|
+
"source": "/Users/afterxleep/Developer/doc-bot/src/__tests__/temp-docsets-1756133998729/Mock.docset",
|
|
6
|
+
"path": "/Users/afterxleep/Developer/doc-bot/src/__tests__/temp-docsets-1756133998729/9e061136/Mock.docset",
|
|
7
|
+
"downloadedAt": "2025-08-25T14:59:58.738Z",
|
|
8
|
+
"size": 8513
|
|
9
|
+
}
|
|
10
|
+
]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleName</key>
|
|
6
|
+
<string>Mock Documentation</string>
|
|
7
|
+
<key>CFBundleIdentifier</key>
|
|
8
|
+
<string>mock.documentation</string>
|
|
9
|
+
</dict>
|
|
10
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleName</key>
|
|
6
|
+
<string>Mock Documentation</string>
|
|
7
|
+
<key>CFBundleIdentifier</key>
|
|
8
|
+
<string>mock.documentation</string>
|
|
9
|
+
</dict>
|
|
10
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "03e730af",
|
|
4
|
+
"name": "Mock Documentation",
|
|
5
|
+
"source": "/Users/afterxleep/Developer/doc-bot/src/__tests__/temp-docsets-1756134345957/Mock.docset",
|
|
6
|
+
"path": "/Users/afterxleep/Developer/doc-bot/src/__tests__/temp-docsets-1756134345957/03e730af/Mock.docset",
|
|
7
|
+
"downloadedAt": "2025-08-25T15:05:45.967Z",
|
|
8
|
+
"size": 8513
|
|
9
|
+
}
|
|
10
|
+
]
|
package/src/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { UnifiedSearchService } from './services/UnifiedSearchService.js';
|
|
|
9
9
|
import chokidar from 'chokidar';
|
|
10
10
|
import path from 'path';
|
|
11
11
|
import { promises as fs } from 'fs';
|
|
12
|
+
import fsExtra from 'fs-extra';
|
|
12
13
|
import { fileURLToPath } from 'url';
|
|
13
14
|
import os from 'os';
|
|
14
15
|
|
|
@@ -61,12 +62,21 @@ class DocsServer {
|
|
|
61
62
|
|
|
62
63
|
async loadPromptTemplate(templateName) {
|
|
63
64
|
if (!this.promptTemplates[templateName]) {
|
|
64
|
-
|
|
65
|
+
// Try markdown first, fall back to txt for backward compatibility
|
|
66
|
+
const mdPath = path.join(__dirname, '../prompts', `${templateName}.md`);
|
|
67
|
+
const txtPath = path.join(__dirname, '../prompts', `${templateName}.txt`);
|
|
68
|
+
|
|
65
69
|
try {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
// Try loading markdown version first
|
|
71
|
+
this.promptTemplates[templateName] = await fs.readFile(mdPath, 'utf8');
|
|
72
|
+
} catch (mdError) {
|
|
73
|
+
try {
|
|
74
|
+
// Fall back to txt version
|
|
75
|
+
this.promptTemplates[templateName] = await fs.readFile(txtPath, 'utf8');
|
|
76
|
+
} catch (txtError) {
|
|
77
|
+
console.error(`Failed to load prompt template ${templateName}:`, mdError.message);
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
70
80
|
}
|
|
71
81
|
}
|
|
72
82
|
return this.promptTemplates[templateName];
|
|
@@ -1224,12 +1234,9 @@ Try:
|
|
|
1224
1234
|
}
|
|
1225
1235
|
|
|
1226
1236
|
async createOrUpdateRule({ fileName, title, description, keywords, alwaysApply, content }) {
|
|
1227
|
-
const fs = require('fs-extra');
|
|
1228
|
-
const path = require('path');
|
|
1229
|
-
|
|
1230
1237
|
try {
|
|
1231
1238
|
// Ensure the docs directory exists
|
|
1232
|
-
await
|
|
1239
|
+
await fsExtra.ensureDir(this.options.docsPath);
|
|
1233
1240
|
|
|
1234
1241
|
// Create the full file path
|
|
1235
1242
|
const filePath = path.join(this.options.docsPath, fileName);
|
|
@@ -1250,11 +1257,11 @@ Try:
|
|
|
1250
1257
|
const fullContent = frontmatter + content;
|
|
1251
1258
|
|
|
1252
1259
|
// Check if file exists to determine if this is create or update
|
|
1253
|
-
const fileExists = await
|
|
1260
|
+
const fileExists = await fsExtra.pathExists(filePath);
|
|
1254
1261
|
const action = fileExists ? 'updated' : 'created';
|
|
1255
1262
|
|
|
1256
1263
|
// Write the file
|
|
1257
|
-
await
|
|
1264
|
+
await fsExtra.writeFile(filePath, fullContent, 'utf8');
|
|
1258
1265
|
|
|
1259
1266
|
// Reload the documentation service to pick up the new/updated file
|
|
1260
1267
|
await this.docService.reload();
|