unity-agentic-tools 0.4.3 → 0.5.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 +74 -20
- package/dist/cli.js +6899 -13936
- package/dist/doc-indexer-cli.js +5 -42
- package/dist/index.js +479 -354
- package/native/unity-file-tools.darwin-arm64.node +0 -0
- package/native/unity-file-tools.darwin-x64.node +0 -0
- package/native/unity-file-tools.linux-x64-gnu.node +0 -0
- package/native/unity-file-tools.win32-x64-msvc.node +0 -0
- package/package.json +3 -2
package/dist/doc-indexer-cli.js
CHANGED
|
@@ -3089,20 +3089,6 @@ function read_unity_version(projectRoot) {
|
|
|
3089
3089
|
// src/cli.ts
|
|
3090
3090
|
var program2 = new Command;
|
|
3091
3091
|
program2.name("unity-doc-indexer").description("Fast Unity documentation indexer with local embeddings").version("1.0.0").option("--project-root <path>", "Unity project root (auto-detected if omitted)").option("--storage-path <path>", "Index storage file path (auto-resolved if omitted)");
|
|
3092
|
-
function extract_doc_title(filePath) {
|
|
3093
|
-
if (!filePath)
|
|
3094
|
-
return "Unknown";
|
|
3095
|
-
const filename = filePath.split("/").pop()?.replace(/\.[^.]+$/, "") ?? "Unknown";
|
|
3096
|
-
return filename.replace(/^class-/, "").replace(/-/g, ".");
|
|
3097
|
-
}
|
|
3098
|
-
function extract_relative_source(filePath) {
|
|
3099
|
-
if (!filePath)
|
|
3100
|
-
return;
|
|
3101
|
-
const match = filePath.match(/((?:ScriptReference|Manual|Documentation)\/[^/]*\.html?)$/i);
|
|
3102
|
-
if (match)
|
|
3103
|
-
return match[1];
|
|
3104
|
-
return filePath.split("/").pop();
|
|
3105
|
-
}
|
|
3106
3092
|
function get_storage_path(opts) {
|
|
3107
3093
|
if (opts.storagePath)
|
|
3108
3094
|
return opts.storagePath;
|
|
@@ -3127,7 +3113,7 @@ async function auto_index(storage, projectRoot) {
|
|
|
3127
3113
|
}
|
|
3128
3114
|
return reindexed;
|
|
3129
3115
|
}
|
|
3130
|
-
program2.command("search <query>").description("Search documentation (auto-discovers and indexes on first use)").
|
|
3116
|
+
program2.command("search <query>").description("Search documentation (auto-discovers and indexes on first use)").action(async (query) => {
|
|
3131
3117
|
const globalOpts = program2.opts();
|
|
3132
3118
|
const storagePath = get_storage_path(globalOpts);
|
|
3133
3119
|
const projectRoot = globalOpts.projectRoot || find_project_root() || null;
|
|
@@ -3135,11 +3121,7 @@ program2.command("search <query>").description("Search documentation (auto-disco
|
|
|
3135
3121
|
await storage.init();
|
|
3136
3122
|
await auto_index(storage, projectRoot);
|
|
3137
3123
|
if (storage.chunk_count() === 0) {
|
|
3138
|
-
|
|
3139
|
-
results: [],
|
|
3140
|
-
message: "No documentation indexed. Install Unity docs via Unity Hub > Installs > Modules > Documentation, or run: unity-agentic-tools setup --index-docs"
|
|
3141
|
-
};
|
|
3142
|
-
console.log(JSON.stringify(output, null, 2));
|
|
3124
|
+
console.log(JSON.stringify({ results: [] }, null, 2));
|
|
3143
3125
|
return;
|
|
3144
3126
|
}
|
|
3145
3127
|
const searcher = new DocSearch(storage);
|
|
@@ -3149,28 +3131,9 @@ program2.command("search <query>").description("Search documentation (auto-disco
|
|
|
3149
3131
|
semantic_weight: 0.6,
|
|
3150
3132
|
keyword_weight: 0.4
|
|
3151
3133
|
});
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
}
|
|
3156
|
-
const count = results.results.length;
|
|
3157
|
-
console.log(`# Unity Docs: "${query}" (${count} result${count !== 1 ? "s" : ""})
|
|
3158
|
-
`);
|
|
3159
|
-
for (const result of results.results) {
|
|
3160
|
-
const meta = result.metadata;
|
|
3161
|
-
const title = meta?.section || meta?.unity_class || extract_doc_title(meta?.file_path);
|
|
3162
|
-
const source = extract_relative_source(meta?.file_path);
|
|
3163
|
-
console.log(`## ${title}
|
|
3164
|
-
`);
|
|
3165
|
-
console.log(result.content);
|
|
3166
|
-
if (source) {
|
|
3167
|
-
console.log(`
|
|
3168
|
-
*Source: ${source}*`);
|
|
3169
|
-
}
|
|
3170
|
-
console.log(`
|
|
3171
|
-
---
|
|
3172
|
-
`);
|
|
3173
|
-
}
|
|
3134
|
+
console.log(JSON.stringify({
|
|
3135
|
+
results: results.results.map(({ metadata: _metadata, ...entry }) => entry)
|
|
3136
|
+
}, null, 2));
|
|
3174
3137
|
});
|
|
3175
3138
|
program2.command("index [path]").description("Index documentation (auto-discovers sources if no path given)").action(async (path) => {
|
|
3176
3139
|
const globalOpts = program2.opts();
|