doclific 0.3.4 → 0.3.5

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.
@@ -45,33 +45,38 @@ export const getFileContents = async (filePath) => {
45
45
  * @returns {string[]} - Array of relative paths
46
46
  */
47
47
  export async function getFlatFileList(dir = process.cwd(), fileList = [], baseDir = dir, ignoreInstance) {
48
- // Load .gitignore on first call
49
- if (!ignoreInstance) {
50
- const gitignorePath = path.join(baseDir, '.gitignore');
51
- let gitignoreContent = '';
52
- if (existsSync(gitignorePath)) {
53
- gitignoreContent = await fs.readFile(gitignorePath, 'utf8');
54
- }
55
- ignoreInstance = ignore().add(gitignoreContent);
56
- }
57
- const items = await fs.readdir(dir, { withFileTypes: true });
58
- for (const item of items) {
59
- const fullPath = path.join(dir, item.name);
60
- const relativePath = path.relative(baseDir, fullPath);
61
- const stats = await fs.stat(fullPath);
62
- // Check if path should be ignored
63
- if (ignoreInstance.ignores(relativePath) || relativePath.startsWith('.git')) {
64
- continue;
65
- }
66
- if (stats.isDirectory()) {
67
- // Include directory path itself
68
- fileList.push(relativePath + '/');
69
- // Recurse into the subdirectory
70
- await getFlatFileList(fullPath, fileList, baseDir, ignoreInstance);
48
+ try {
49
+ // Load .gitignore on first call
50
+ if (!ignoreInstance) {
51
+ const gitignorePath = path.join(baseDir, '.gitignore');
52
+ let gitignoreContent = '';
53
+ if (existsSync(gitignorePath)) {
54
+ gitignoreContent = await fs.readFile(gitignorePath, 'utf8');
55
+ }
56
+ ignoreInstance = ignore().add(gitignoreContent);
71
57
  }
72
- else {
73
- fileList.push(relativePath);
58
+ const items = await fs.readdir(dir, { withFileTypes: true });
59
+ for (const item of items) {
60
+ const fullPath = path.join(dir, item.name);
61
+ const relativePath = path.relative(baseDir, fullPath);
62
+ // Check if path should be ignored
63
+ if (ignoreInstance.ignores(relativePath) || relativePath.startsWith('.git')) {
64
+ continue;
65
+ }
66
+ const stats = await fs.stat(fullPath);
67
+ if (stats.isDirectory()) {
68
+ // Include directory path itself
69
+ fileList.push(relativePath + '/');
70
+ // Recurse into the subdirectory
71
+ await getFlatFileList(fullPath, fileList, baseDir, ignoreInstance);
72
+ }
73
+ else {
74
+ fileList.push(relativePath);
75
+ }
74
76
  }
77
+ return fileList;
78
+ }
79
+ catch (error) {
80
+ throw new Error(`Failed to get flat file list for ${dir}: ${error}`);
75
81
  }
76
- return fileList;
77
82
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doclific",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "doclific": "./dist/bin/doclific.js"
@@ -22,6 +22,14 @@
22
22
  "dist",
23
23
  "package.json"
24
24
  ],
25
+ "keywords": [
26
+ "documentation",
27
+ "ai",
28
+ "documentation-tool",
29
+ "documentation-generator",
30
+ "documentation-assistant",
31
+ "documentation-assistant-ai"
32
+ ],
25
33
  "dependencies": {
26
34
  "@ai-sdk/anthropic": "^2.0.56",
27
35
  "@ai-sdk/google": "^2.0.49",