project-librarian 0.2.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/LICENSE +21 -0
- package/README.ja.md +227 -0
- package/README.ko.md +229 -0
- package/README.md +280 -0
- package/README.zh.md +227 -0
- package/SKILL.md +335 -0
- package/agents/openai.yaml +3 -0
- package/dist/args.js +235 -0
- package/dist/code-index-db.js +34 -0
- package/dist/code-index-file-policy.js +120 -0
- package/dist/code-index-sql.js +9 -0
- package/dist/code-index.js +1856 -0
- package/dist/hooks.js +321 -0
- package/dist/init-project-wiki.js +246 -0
- package/dist/install-skill.js +142 -0
- package/dist/migration.js +356 -0
- package/dist/modes.js +823 -0
- package/dist/templates.js +552 -0
- package/dist/types.js +2 -0
- package/dist/wiki-files.js +289 -0
- package/dist/workspace.js +212 -0
- package/package.json +71 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.maxIndexedBytes = exports.ignoredDirectories = void 0;
|
|
37
|
+
exports.fileLanguage = fileLanguage;
|
|
38
|
+
exports.isJavaScriptLike = isJavaScriptLike;
|
|
39
|
+
exports.shouldIndexFile = shouldIndexFile;
|
|
40
|
+
exports.isIgnoredCodePath = isIgnoredCodePath;
|
|
41
|
+
const path = __importStar(require("node:path"));
|
|
42
|
+
const workspace_1 = require("./workspace");
|
|
43
|
+
exports.ignoredDirectories = new Set([
|
|
44
|
+
".git",
|
|
45
|
+
".codex",
|
|
46
|
+
".claude",
|
|
47
|
+
".project-wiki",
|
|
48
|
+
"node_modules",
|
|
49
|
+
".next",
|
|
50
|
+
"dist",
|
|
51
|
+
"build",
|
|
52
|
+
"coverage",
|
|
53
|
+
"vendor",
|
|
54
|
+
"tmp",
|
|
55
|
+
"temp",
|
|
56
|
+
]);
|
|
57
|
+
const languageByExtension = {
|
|
58
|
+
".c": "c",
|
|
59
|
+
".cc": "cpp",
|
|
60
|
+
".cjs": "javascript",
|
|
61
|
+
".cpp": "cpp",
|
|
62
|
+
".cs": "csharp",
|
|
63
|
+
".css": "css",
|
|
64
|
+
".cts": "typescript",
|
|
65
|
+
".go": "go",
|
|
66
|
+
".java": "java",
|
|
67
|
+
".js": "javascript",
|
|
68
|
+
".jsx": "javascript",
|
|
69
|
+
".kt": "kotlin",
|
|
70
|
+
".mjs": "javascript",
|
|
71
|
+
".mts": "typescript",
|
|
72
|
+
".php": "php",
|
|
73
|
+
".py": "python",
|
|
74
|
+
".rb": "ruby",
|
|
75
|
+
".rs": "rust",
|
|
76
|
+
".swift": "swift",
|
|
77
|
+
".ts": "typescript",
|
|
78
|
+
".tsx": "typescript",
|
|
79
|
+
".vue": "vue",
|
|
80
|
+
};
|
|
81
|
+
const configExtensions = new Set([".json", ".yaml", ".yml", ".toml"]);
|
|
82
|
+
exports.maxIndexedBytes = 1024 * 1024;
|
|
83
|
+
function fileLanguage(relativePath) {
|
|
84
|
+
if (path.basename(relativePath) === ".env.example")
|
|
85
|
+
return "config";
|
|
86
|
+
const extension = path.extname(relativePath).toLowerCase();
|
|
87
|
+
return languageByExtension[extension] ?? (configExtensions.has(extension) ? "config" : "");
|
|
88
|
+
}
|
|
89
|
+
function isBlockedEnvFile(relativePath) {
|
|
90
|
+
const base = path.basename(relativePath);
|
|
91
|
+
return base.startsWith(".env") && base !== ".env.example";
|
|
92
|
+
}
|
|
93
|
+
function isBlockedSensitiveConfigFile(relativePath) {
|
|
94
|
+
if (fileLanguage(relativePath) !== "config")
|
|
95
|
+
return false;
|
|
96
|
+
const base = path.basename(relativePath).toLowerCase();
|
|
97
|
+
if (base === ".env.example")
|
|
98
|
+
return false;
|
|
99
|
+
return /(^|[._-])(secret|secrets|credential|credentials|token|tokens|private|key|keys)([._-]|$)/i.test(base);
|
|
100
|
+
}
|
|
101
|
+
function isJavaScriptLike(relativePath) {
|
|
102
|
+
return [".cjs", ".cts", ".js", ".jsx", ".mjs", ".mts", ".ts", ".tsx"].includes(path.extname(relativePath).toLowerCase());
|
|
103
|
+
}
|
|
104
|
+
function shouldIndexFile(relativePath) {
|
|
105
|
+
if (isBlockedEnvFile(relativePath))
|
|
106
|
+
return false;
|
|
107
|
+
if (isBlockedSensitiveConfigFile(relativePath))
|
|
108
|
+
return false;
|
|
109
|
+
const language = fileLanguage(relativePath);
|
|
110
|
+
if (language)
|
|
111
|
+
return true;
|
|
112
|
+
const base = path.basename(relativePath);
|
|
113
|
+
return ["Dockerfile", "Makefile", "package.json", "tsconfig.json"].includes(base);
|
|
114
|
+
}
|
|
115
|
+
function isIgnoredCodePath(relativePath) {
|
|
116
|
+
return (0, workspace_1.normalizePath)(relativePath)
|
|
117
|
+
.split("/")
|
|
118
|
+
.filter(Boolean)
|
|
119
|
+
.some((part) => exports.ignoredDirectories.has(part));
|
|
120
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isReadOnlySql = isReadOnlySql;
|
|
4
|
+
function isReadOnlySql(sql) {
|
|
5
|
+
const trimmed = sql.trim().toLowerCase();
|
|
6
|
+
if (!/^(select|with)\b/.test(trimmed) || /;\s*\S/.test(trimmed))
|
|
7
|
+
return false;
|
|
8
|
+
return !/\b(attach|alter|create|delete|detach|drop|insert|pragma|reindex|replace|update|vacuum)\b/.test(trimmed);
|
|
9
|
+
}
|