@webneat/codewiki 0.0.5 → 0.0.7
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 +173 -24
- package/dist/bin.cjs +270 -246
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +270 -246
- package/dist/bin.js.map +1 -1
- package/dist/cli.cjs +270 -246
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +270 -246
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +18 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/bin.cjs
CHANGED
|
@@ -567,7 +567,7 @@ var symbols2 = {
|
|
|
567
567
|
where: {}
|
|
568
568
|
};
|
|
569
569
|
var external_dependencies2 = {
|
|
570
|
-
select: ["id", "package", "subpath", "name", "state", "error"],
|
|
570
|
+
select: ["id", "package", "subpath", "name", "is_builtin", "state", "error"],
|
|
571
571
|
order_by: ["id", "asc"],
|
|
572
572
|
limit: 20,
|
|
573
573
|
offset: 0,
|
|
@@ -1193,12 +1193,6 @@ async function create_context(sqlite, db6, config) {
|
|
|
1193
1193
|
);
|
|
1194
1194
|
return ctx;
|
|
1195
1195
|
}
|
|
1196
|
-
async function context_from_config(config) {
|
|
1197
|
-
const sqlite = new import_better_sqlite3.default(config.db_path);
|
|
1198
|
-
sqlite.pragma("foreign_keys = ON");
|
|
1199
|
-
const db6 = (0, import_better_sqlite32.drizzle)(sqlite, { schema: schema_exports });
|
|
1200
|
-
return create_context(sqlite, db6, config);
|
|
1201
|
-
}
|
|
1202
1196
|
async function context_from_db(db_path) {
|
|
1203
1197
|
const sqlite = new import_better_sqlite3.default(db_path);
|
|
1204
1198
|
sqlite.pragma("foreign_keys = ON");
|
|
@@ -1255,6 +1249,7 @@ async function get_github_repo(node_modules_paths, package_name) {
|
|
|
1255
1249
|
// src/cli/env.ts
|
|
1256
1250
|
var env = {
|
|
1257
1251
|
read_file,
|
|
1252
|
+
cwd: () => process.cwd(),
|
|
1258
1253
|
file_exists: (path6) => (0, import_node_fs2.existsSync)(path6),
|
|
1259
1254
|
argv: () => process.argv,
|
|
1260
1255
|
log: (...args) => console.log(...args),
|
|
@@ -1269,120 +1264,7 @@ var import_commander30 = require("commander");
|
|
|
1269
1264
|
var import_commander = require("commander");
|
|
1270
1265
|
|
|
1271
1266
|
// src/cli/commands/_common.ts
|
|
1272
|
-
var import_zod2 = require("zod");
|
|
1273
|
-
|
|
1274
|
-
// src/cli/schema.ts
|
|
1275
1267
|
var import_zod = require("zod");
|
|
1276
|
-
var Config = import_zod.z.object({
|
|
1277
|
-
db_path: import_zod.z.string().describe("Path to SQLite database"),
|
|
1278
|
-
project_path: import_zod.z.string().describe("Path to TypeScript project"),
|
|
1279
|
-
description: import_zod.z.string().optional(),
|
|
1280
|
-
package_json_path: import_zod.z.string().optional(),
|
|
1281
|
-
node_modules_paths: import_zod.z.array(import_zod.z.string()).optional()
|
|
1282
|
-
});
|
|
1283
|
-
var StringFilter = import_zod.z.union([
|
|
1284
|
-
import_zod.z.string(),
|
|
1285
|
-
import_zod.z.object({ contains: import_zod.z.string() }),
|
|
1286
|
-
import_zod.z.object({ starts_with: import_zod.z.string() }),
|
|
1287
|
-
import_zod.z.object({ ends_with: import_zod.z.string() })
|
|
1288
|
-
]);
|
|
1289
|
-
var OrderDirection = import_zod.z.enum(["asc", "desc"]);
|
|
1290
|
-
var FileField = import_zod.z.enum(["id", "directory_id", "path", "description", "state", "error"]);
|
|
1291
|
-
var FileState = import_zod.z.enum(["to_scan", "to_describe", "ready"]);
|
|
1292
|
-
var FileSearchOptions = import_zod.z.object({
|
|
1293
|
-
select: import_zod.z.array(FileField).optional(),
|
|
1294
|
-
limit: import_zod.z.number().int().positive().optional(),
|
|
1295
|
-
offset: import_zod.z.number().int().nonnegative().optional(),
|
|
1296
|
-
where: import_zod.z.object({
|
|
1297
|
-
id: import_zod.z.number().optional(),
|
|
1298
|
-
directory_id: import_zod.z.number().optional(),
|
|
1299
|
-
path: StringFilter.optional(),
|
|
1300
|
-
description: StringFilter.optional(),
|
|
1301
|
-
state: import_zod.z.union([FileState, import_zod.z.object({ contains: import_zod.z.string() })]).optional(),
|
|
1302
|
-
error: StringFilter.optional()
|
|
1303
|
-
}).optional(),
|
|
1304
|
-
order_by: import_zod.z.tuple([FileField, OrderDirection]).optional()
|
|
1305
|
-
});
|
|
1306
|
-
var FileRelationOptions = import_zod.z.object({
|
|
1307
|
-
select: import_zod.z.array(FileField).optional(),
|
|
1308
|
-
limit: import_zod.z.number().int().positive().optional(),
|
|
1309
|
-
offset: import_zod.z.number().int().nonnegative().optional(),
|
|
1310
|
-
deep: import_zod.z.boolean().optional()
|
|
1311
|
-
});
|
|
1312
|
-
var SymbolField = import_zod.z.enum(["id", "file_id", "type", "name", "text", "meta", "description", "is_exported", "state", "error"]);
|
|
1313
|
-
var SymbolType = import_zod.z.enum(["function", "class", "class_method", "class_property", "variable", "type"]);
|
|
1314
|
-
var SymbolState = import_zod.z.enum(["to_link", "to_describe", "ready"]);
|
|
1315
|
-
var SymbolSearchOptions = import_zod.z.object({
|
|
1316
|
-
select: import_zod.z.array(SymbolField).optional(),
|
|
1317
|
-
limit: import_zod.z.number().int().positive().optional(),
|
|
1318
|
-
offset: import_zod.z.number().int().nonnegative().optional(),
|
|
1319
|
-
where: import_zod.z.object({
|
|
1320
|
-
id: import_zod.z.number().optional(),
|
|
1321
|
-
file_id: import_zod.z.number().optional(),
|
|
1322
|
-
type: import_zod.z.union([SymbolType, import_zod.z.object({ contains: import_zod.z.string() })]).optional(),
|
|
1323
|
-
name: StringFilter.optional(),
|
|
1324
|
-
text: StringFilter.optional(),
|
|
1325
|
-
meta: StringFilter.optional(),
|
|
1326
|
-
description: StringFilter.optional(),
|
|
1327
|
-
is_exported: import_zod.z.boolean().optional(),
|
|
1328
|
-
state: import_zod.z.union([SymbolState, import_zod.z.object({ contains: import_zod.z.string() })]).optional(),
|
|
1329
|
-
error: StringFilter.optional()
|
|
1330
|
-
}).optional(),
|
|
1331
|
-
order_by: import_zod.z.tuple([SymbolField, OrderDirection]).optional()
|
|
1332
|
-
});
|
|
1333
|
-
var SymbolRelationOptions = import_zod.z.object({
|
|
1334
|
-
select: import_zod.z.array(SymbolField).optional(),
|
|
1335
|
-
limit: import_zod.z.number().int().positive().optional(),
|
|
1336
|
-
offset: import_zod.z.number().int().nonnegative().optional(),
|
|
1337
|
-
deep: import_zod.z.boolean().optional()
|
|
1338
|
-
});
|
|
1339
|
-
var DirectoryField = import_zod.z.enum(["id", "parent_id", "path", "description", "state", "error"]);
|
|
1340
|
-
var DirectoryState = import_zod.z.enum(["to_describe", "ready"]);
|
|
1341
|
-
var DirectorySearchOptions = import_zod.z.object({
|
|
1342
|
-
select: import_zod.z.array(DirectoryField).optional(),
|
|
1343
|
-
limit: import_zod.z.number().int().positive().optional(),
|
|
1344
|
-
offset: import_zod.z.number().int().nonnegative().optional(),
|
|
1345
|
-
where: import_zod.z.object({
|
|
1346
|
-
id: import_zod.z.number().optional(),
|
|
1347
|
-
parent_id: import_zod.z.number().optional(),
|
|
1348
|
-
path: StringFilter.optional(),
|
|
1349
|
-
description: StringFilter.optional(),
|
|
1350
|
-
state: import_zod.z.union([DirectoryState, import_zod.z.object({ contains: import_zod.z.string() })]).optional(),
|
|
1351
|
-
error: StringFilter.optional()
|
|
1352
|
-
}).optional(),
|
|
1353
|
-
order_by: import_zod.z.tuple([DirectoryField, OrderDirection]).optional()
|
|
1354
|
-
});
|
|
1355
|
-
var DirectoryRelationOptions = import_zod.z.object({
|
|
1356
|
-
select: import_zod.z.array(DirectoryField).optional(),
|
|
1357
|
-
limit: import_zod.z.number().int().positive().optional(),
|
|
1358
|
-
offset: import_zod.z.number().int().nonnegative().optional(),
|
|
1359
|
-
deep: import_zod.z.boolean().optional()
|
|
1360
|
-
});
|
|
1361
|
-
var DependencyField = import_zod.z.enum(["id", "package", "subpath", "name", "version", "github_repo", "is_builtin", "description", "state", "error"]);
|
|
1362
|
-
var DependencyState = import_zod.z.enum(["to_describe", "ready"]);
|
|
1363
|
-
var DependencySearchOptions = import_zod.z.object({
|
|
1364
|
-
select: import_zod.z.array(DependencyField).optional(),
|
|
1365
|
-
limit: import_zod.z.number().int().positive().optional(),
|
|
1366
|
-
offset: import_zod.z.number().int().nonnegative().optional(),
|
|
1367
|
-
where: import_zod.z.object({
|
|
1368
|
-
id: import_zod.z.number().optional(),
|
|
1369
|
-
package: StringFilter.optional(),
|
|
1370
|
-
subpath: StringFilter.optional(),
|
|
1371
|
-
name: StringFilter.optional(),
|
|
1372
|
-
version: StringFilter.optional(),
|
|
1373
|
-
github_repo: StringFilter.optional(),
|
|
1374
|
-
is_builtin: import_zod.z.boolean().optional(),
|
|
1375
|
-
description: StringFilter.optional(),
|
|
1376
|
-
state: import_zod.z.union([DependencyState, import_zod.z.object({ contains: import_zod.z.string() })]).optional(),
|
|
1377
|
-
error: StringFilter.optional()
|
|
1378
|
-
}).optional(),
|
|
1379
|
-
order_by: import_zod.z.tuple([DependencyField, OrderDirection]).optional()
|
|
1380
|
-
});
|
|
1381
|
-
var DependencySelectOptions = import_zod.z.object({
|
|
1382
|
-
select: import_zod.z.array(DependencyField).optional(),
|
|
1383
|
-
limit: import_zod.z.number().int().positive().optional(),
|
|
1384
|
-
offset: import_zod.z.number().int().nonnegative().optional()
|
|
1385
|
-
});
|
|
1386
1268
|
|
|
1387
1269
|
// src/update/track_changes.ts
|
|
1388
1270
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
@@ -2480,6 +2362,21 @@ async function update6(ctx) {
|
|
|
2480
2362
|
await link_symbols(ctx);
|
|
2481
2363
|
}
|
|
2482
2364
|
|
|
2365
|
+
// src/update_config.ts
|
|
2366
|
+
function update_config(ctx, config, updates) {
|
|
2367
|
+
if (Object.keys(updates).length === 0) return;
|
|
2368
|
+
const new_config = { ...config, ...updates };
|
|
2369
|
+
err.or_throw(
|
|
2370
|
+
configs_exports.upsert(ctx, {
|
|
2371
|
+
project_path: new_config.project_path,
|
|
2372
|
+
description: new_config.description ?? null,
|
|
2373
|
+
package_json_path: new_config.package_json_path ?? null,
|
|
2374
|
+
node_modules_paths: new_config.node_modules_paths ? JSON.stringify(new_config.node_modules_paths) : null
|
|
2375
|
+
})
|
|
2376
|
+
);
|
|
2377
|
+
Object.assign(config, updates);
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2483
2380
|
// src/counts.ts
|
|
2484
2381
|
var import_drizzle_orm13 = require("drizzle-orm");
|
|
2485
2382
|
function counts(ctx) {
|
|
@@ -2795,19 +2692,6 @@ function directories_to_describe(ctx, limit) {
|
|
|
2795
2692
|
}
|
|
2796
2693
|
|
|
2797
2694
|
// src/index.ts
|
|
2798
|
-
async function create(config) {
|
|
2799
|
-
const ctx = await context_from_config(config);
|
|
2800
|
-
return {
|
|
2801
|
-
config,
|
|
2802
|
-
update: () => update6(ctx),
|
|
2803
|
-
counts: () => counts(ctx),
|
|
2804
|
-
to_describe: (limit) => to_describe(ctx, limit),
|
|
2805
|
-
files: files_wiki(ctx),
|
|
2806
|
-
symbols: symbols_wiki(ctx),
|
|
2807
|
-
directories: directories_wiki(ctx),
|
|
2808
|
-
dependencies: dependencies_wiki(ctx)
|
|
2809
|
-
};
|
|
2810
|
-
}
|
|
2811
2695
|
async function load(db_path) {
|
|
2812
2696
|
const ctx = await context_from_db(db_path);
|
|
2813
2697
|
const stored = ctx.db.select().from(schema_exports.configs).get();
|
|
@@ -2820,6 +2704,7 @@ async function load(db_path) {
|
|
|
2820
2704
|
};
|
|
2821
2705
|
return {
|
|
2822
2706
|
config,
|
|
2707
|
+
update_config: (updates) => update_config(ctx, config, updates),
|
|
2823
2708
|
update: () => update6(ctx),
|
|
2824
2709
|
counts: () => counts(ctx),
|
|
2825
2710
|
to_describe: (limit) => to_describe(ctx, limit),
|
|
@@ -2831,30 +2716,18 @@ async function load(db_path) {
|
|
|
2831
2716
|
}
|
|
2832
2717
|
|
|
2833
2718
|
// src/cli/commands/_common.ts
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
return
|
|
2844
|
-
} catch (error) {
|
|
2845
|
-
if (error.type === "could_not_read_file") {
|
|
2846
|
-
env.error(`Error: Configuration file ${config_path} not found`);
|
|
2847
|
-
} else if (error.type === "invalid_json") {
|
|
2848
|
-
env.error(`Error: Invalid JSON in ${config_path}`);
|
|
2849
|
-
} else if (error.type === "invalid_config") {
|
|
2850
|
-
env.error("Error: Invalid configuration");
|
|
2851
|
-
} else if (error.message) {
|
|
2852
|
-
env.error(`Error: ${error.message}`);
|
|
2853
|
-
} else {
|
|
2854
|
-
env.error(`Error: ${String(error)}`);
|
|
2855
|
-
}
|
|
2856
|
-
process.exit(1);
|
|
2719
|
+
function get_db_path(...args) {
|
|
2720
|
+
const cmd = args[args.length - 1];
|
|
2721
|
+
return cmd.optsWithGlobals().db;
|
|
2722
|
+
}
|
|
2723
|
+
async function load_wiki(db_path) {
|
|
2724
|
+
if (!env.file_exists(db_path)) {
|
|
2725
|
+
env.error(`Error: No wiki found at ${db_path}`);
|
|
2726
|
+
env.error(`Run \`codewiki init\` to create one.`);
|
|
2727
|
+
env.exit(1);
|
|
2728
|
+
return void 0;
|
|
2857
2729
|
}
|
|
2730
|
+
return load(db_path);
|
|
2858
2731
|
}
|
|
2859
2732
|
function parse_options(options_json, schema, context) {
|
|
2860
2733
|
let parsed_json;
|
|
@@ -2902,8 +2775,8 @@ function count_text({ total, ...states }) {
|
|
|
2902
2775
|
// src/cli/commands/update.ts
|
|
2903
2776
|
var update7 = new import_commander.Command("update");
|
|
2904
2777
|
update7.description("Reads current files and updates the wiki database");
|
|
2905
|
-
update7.action(async () => {
|
|
2906
|
-
const wiki = await load_wiki();
|
|
2778
|
+
update7.action(async (...args) => {
|
|
2779
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
2907
2780
|
await wiki.update();
|
|
2908
2781
|
env.log("Update complete.\n");
|
|
2909
2782
|
const counts2 = wiki.counts();
|
|
@@ -2915,8 +2788,8 @@ update7.action(async () => {
|
|
|
2915
2788
|
var import_commander2 = require("commander");
|
|
2916
2789
|
var status = new import_commander2.Command("status");
|
|
2917
2790
|
status.description("Show the status of the wiki");
|
|
2918
|
-
status.action(async () => {
|
|
2919
|
-
const wiki = await load_wiki();
|
|
2791
|
+
status.action(async (...args) => {
|
|
2792
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
2920
2793
|
const counts2 = wiki.counts();
|
|
2921
2794
|
env.log(format_counts(counts2));
|
|
2922
2795
|
});
|
|
@@ -2926,14 +2799,25 @@ var import_dedent2 = __toESM(require("dedent"), 1);
|
|
|
2926
2799
|
var import_commander3 = require("commander");
|
|
2927
2800
|
var describe = new import_commander3.Command("describe");
|
|
2928
2801
|
describe.description("Show the next item to describe");
|
|
2929
|
-
describe.action(async () => {
|
|
2930
|
-
const wiki = await load_wiki();
|
|
2931
|
-
const
|
|
2932
|
-
if (
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2802
|
+
describe.action(async (...args) => {
|
|
2803
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
2804
|
+
const result = wiki.to_describe(1);
|
|
2805
|
+
if (result.type === "none") {
|
|
2806
|
+
return env.log("All items are described!");
|
|
2807
|
+
}
|
|
2808
|
+
if (result.type === "dependencies" && result.items.length > 0) {
|
|
2809
|
+
return describe_dependency(result.items[0]);
|
|
2810
|
+
}
|
|
2811
|
+
if (result.type === "symbols" && result.items.length > 0) {
|
|
2812
|
+
return describe_symbol(wiki, result.items[0]);
|
|
2813
|
+
}
|
|
2814
|
+
if (result.type === "files" && result.items.length > 0) {
|
|
2815
|
+
return describe_file(result.items[0]);
|
|
2816
|
+
}
|
|
2817
|
+
if (result.type === "directories" && result.items.length > 0) {
|
|
2818
|
+
return describe_directory(result.items[0]);
|
|
2819
|
+
}
|
|
2820
|
+
env.log("No items to describe.");
|
|
2937
2821
|
});
|
|
2938
2822
|
function describe_dependency(dep) {
|
|
2939
2823
|
env.log(import_dedent2.default`
|
|
@@ -2949,40 +2833,42 @@ function describe_dependency(dep) {
|
|
|
2949
2833
|
\`codewiki dependencies set-description ${dep.id} <markdown-file>\`
|
|
2950
2834
|
`);
|
|
2951
2835
|
}
|
|
2952
|
-
function
|
|
2953
|
-
const
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2836
|
+
function describe_symbol(wiki, sym) {
|
|
2837
|
+
const file = wiki.files.get(sym.file_id);
|
|
2838
|
+
env.log(import_dedent2.default`
|
|
2839
|
+
Your task is to describe the following symbol:
|
|
2840
|
+
|
|
2841
|
+
name: ${sym.name}
|
|
2842
|
+
type: ${sym.type}
|
|
2843
|
+
file: ${file?.path || "unknown"}
|
|
2844
|
+
exported: ${sym.is_exported}
|
|
2845
|
+
|
|
2846
|
+
Write a concise developer documentation for this ${sym.type} into a markdown file, then run:
|
|
2847
|
+
|
|
2848
|
+
codewiki symbols set-description ${sym.id} <markdown-file>
|
|
2849
|
+
`);
|
|
2850
|
+
}
|
|
2851
|
+
function describe_file(file) {
|
|
2852
|
+
env.log(import_dedent2.default`
|
|
2853
|
+
Your task is to describe the following file:
|
|
2854
|
+
|
|
2855
|
+
path: ${file.path}
|
|
2856
|
+
|
|
2857
|
+
Write a concise description of this file's purpose and contents into a markdown file, then run:
|
|
2858
|
+
|
|
2859
|
+
codewiki files set-description ${file.id} <markdown-file>
|
|
2860
|
+
`);
|
|
2861
|
+
}
|
|
2862
|
+
function describe_directory(dir) {
|
|
2863
|
+
env.log(import_dedent2.default`
|
|
2864
|
+
Your task is to describe the following directory:
|
|
2865
|
+
|
|
2866
|
+
path: ${dir.path}
|
|
2867
|
+
|
|
2868
|
+
Write a concise description of this directory's purpose and contents into a markdown file, then run:
|
|
2869
|
+
|
|
2870
|
+
codewiki directories set-description ${dir.id} <markdown-file>
|
|
2871
|
+
`);
|
|
2986
2872
|
}
|
|
2987
2873
|
|
|
2988
2874
|
// src/cli/commands/files/index.ts
|
|
@@ -2994,19 +2880,136 @@ var import_commander4 = require("commander");
|
|
|
2994
2880
|
var get6 = new import_commander4.Command("get");
|
|
2995
2881
|
get6.description("Get a file by ID");
|
|
2996
2882
|
get6.argument("<id>", "File ID");
|
|
2997
|
-
get6.action(async (
|
|
2998
|
-
const
|
|
2883
|
+
get6.action(async (...args) => {
|
|
2884
|
+
const [id] = args;
|
|
2885
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
2999
2886
|
const file = wiki.files.get(Number(id));
|
|
3000
2887
|
env.log(JSON.stringify(file, null, 2));
|
|
3001
2888
|
});
|
|
3002
2889
|
|
|
3003
2890
|
// src/cli/commands/files/search.ts
|
|
3004
2891
|
var import_commander5 = require("commander");
|
|
2892
|
+
|
|
2893
|
+
// src/cli/schema.ts
|
|
2894
|
+
var import_zod2 = require("zod");
|
|
2895
|
+
var Config = import_zod2.z.object({
|
|
2896
|
+
db_path: import_zod2.z.string().describe("Path to SQLite database"),
|
|
2897
|
+
project_path: import_zod2.z.string().describe("Path to TypeScript project"),
|
|
2898
|
+
description: import_zod2.z.string().optional(),
|
|
2899
|
+
package_json_path: import_zod2.z.string().optional(),
|
|
2900
|
+
node_modules_paths: import_zod2.z.array(import_zod2.z.string()).optional()
|
|
2901
|
+
});
|
|
2902
|
+
var StringFilter = import_zod2.z.union([
|
|
2903
|
+
import_zod2.z.string(),
|
|
2904
|
+
import_zod2.z.object({ contains: import_zod2.z.string() }),
|
|
2905
|
+
import_zod2.z.object({ starts_with: import_zod2.z.string() }),
|
|
2906
|
+
import_zod2.z.object({ ends_with: import_zod2.z.string() })
|
|
2907
|
+
]);
|
|
2908
|
+
var OrderDirection = import_zod2.z.enum(["asc", "desc"]);
|
|
2909
|
+
var FileField = import_zod2.z.enum(["id", "directory_id", "path", "description", "state", "error"]);
|
|
2910
|
+
var FileState = import_zod2.z.enum(["to_scan", "to_describe", "ready"]);
|
|
2911
|
+
var FileSearchOptions = import_zod2.z.object({
|
|
2912
|
+
select: import_zod2.z.array(FileField).optional(),
|
|
2913
|
+
limit: import_zod2.z.number().int().positive().optional(),
|
|
2914
|
+
offset: import_zod2.z.number().int().nonnegative().optional(),
|
|
2915
|
+
where: import_zod2.z.object({
|
|
2916
|
+
id: import_zod2.z.number().optional(),
|
|
2917
|
+
directory_id: import_zod2.z.number().optional(),
|
|
2918
|
+
path: StringFilter.optional(),
|
|
2919
|
+
description: StringFilter.optional(),
|
|
2920
|
+
state: import_zod2.z.union([FileState, import_zod2.z.object({ contains: import_zod2.z.string() })]).optional(),
|
|
2921
|
+
error: StringFilter.optional()
|
|
2922
|
+
}).optional(),
|
|
2923
|
+
order_by: import_zod2.z.tuple([FileField, OrderDirection]).optional()
|
|
2924
|
+
});
|
|
2925
|
+
var FileRelationOptions = import_zod2.z.object({
|
|
2926
|
+
select: import_zod2.z.array(FileField).optional(),
|
|
2927
|
+
limit: import_zod2.z.number().int().positive().optional(),
|
|
2928
|
+
offset: import_zod2.z.number().int().nonnegative().optional(),
|
|
2929
|
+
deep: import_zod2.z.boolean().optional()
|
|
2930
|
+
});
|
|
2931
|
+
var SymbolField = import_zod2.z.enum(["id", "file_id", "type", "name", "text", "meta", "description", "is_exported", "state", "error"]);
|
|
2932
|
+
var SymbolType = import_zod2.z.enum(["function", "class", "class_method", "class_property", "variable", "type"]);
|
|
2933
|
+
var SymbolState = import_zod2.z.enum(["to_link", "to_describe", "ready"]);
|
|
2934
|
+
var SymbolSearchOptions = import_zod2.z.object({
|
|
2935
|
+
select: import_zod2.z.array(SymbolField).optional(),
|
|
2936
|
+
limit: import_zod2.z.number().int().positive().optional(),
|
|
2937
|
+
offset: import_zod2.z.number().int().nonnegative().optional(),
|
|
2938
|
+
where: import_zod2.z.object({
|
|
2939
|
+
id: import_zod2.z.number().optional(),
|
|
2940
|
+
file_id: import_zod2.z.number().optional(),
|
|
2941
|
+
type: import_zod2.z.union([SymbolType, import_zod2.z.object({ contains: import_zod2.z.string() })]).optional(),
|
|
2942
|
+
name: StringFilter.optional(),
|
|
2943
|
+
text: StringFilter.optional(),
|
|
2944
|
+
meta: StringFilter.optional(),
|
|
2945
|
+
description: StringFilter.optional(),
|
|
2946
|
+
is_exported: import_zod2.z.boolean().optional(),
|
|
2947
|
+
state: import_zod2.z.union([SymbolState, import_zod2.z.object({ contains: import_zod2.z.string() })]).optional(),
|
|
2948
|
+
error: StringFilter.optional()
|
|
2949
|
+
}).optional(),
|
|
2950
|
+
order_by: import_zod2.z.tuple([SymbolField, OrderDirection]).optional()
|
|
2951
|
+
});
|
|
2952
|
+
var SymbolRelationOptions = import_zod2.z.object({
|
|
2953
|
+
select: import_zod2.z.array(SymbolField).optional(),
|
|
2954
|
+
limit: import_zod2.z.number().int().positive().optional(),
|
|
2955
|
+
offset: import_zod2.z.number().int().nonnegative().optional(),
|
|
2956
|
+
deep: import_zod2.z.boolean().optional()
|
|
2957
|
+
});
|
|
2958
|
+
var DirectoryField = import_zod2.z.enum(["id", "parent_id", "path", "description", "state", "error"]);
|
|
2959
|
+
var DirectoryState = import_zod2.z.enum(["to_describe", "ready"]);
|
|
2960
|
+
var DirectorySearchOptions = import_zod2.z.object({
|
|
2961
|
+
select: import_zod2.z.array(DirectoryField).optional(),
|
|
2962
|
+
limit: import_zod2.z.number().int().positive().optional(),
|
|
2963
|
+
offset: import_zod2.z.number().int().nonnegative().optional(),
|
|
2964
|
+
where: import_zod2.z.object({
|
|
2965
|
+
id: import_zod2.z.number().optional(),
|
|
2966
|
+
parent_id: import_zod2.z.number().optional(),
|
|
2967
|
+
path: StringFilter.optional(),
|
|
2968
|
+
description: StringFilter.optional(),
|
|
2969
|
+
state: import_zod2.z.union([DirectoryState, import_zod2.z.object({ contains: import_zod2.z.string() })]).optional(),
|
|
2970
|
+
error: StringFilter.optional()
|
|
2971
|
+
}).optional(),
|
|
2972
|
+
order_by: import_zod2.z.tuple([DirectoryField, OrderDirection]).optional()
|
|
2973
|
+
});
|
|
2974
|
+
var DirectoryRelationOptions = import_zod2.z.object({
|
|
2975
|
+
select: import_zod2.z.array(DirectoryField).optional(),
|
|
2976
|
+
limit: import_zod2.z.number().int().positive().optional(),
|
|
2977
|
+
offset: import_zod2.z.number().int().nonnegative().optional(),
|
|
2978
|
+
deep: import_zod2.z.boolean().optional()
|
|
2979
|
+
});
|
|
2980
|
+
var DependencyField = import_zod2.z.enum(["id", "package", "subpath", "name", "version", "github_repo", "is_builtin", "description", "state", "error"]);
|
|
2981
|
+
var DependencyState = import_zod2.z.enum(["to_describe", "ready"]);
|
|
2982
|
+
var DependencySearchOptions = import_zod2.z.object({
|
|
2983
|
+
select: import_zod2.z.array(DependencyField).optional(),
|
|
2984
|
+
limit: import_zod2.z.number().int().positive().optional(),
|
|
2985
|
+
offset: import_zod2.z.number().int().nonnegative().optional(),
|
|
2986
|
+
where: import_zod2.z.object({
|
|
2987
|
+
id: import_zod2.z.number().optional(),
|
|
2988
|
+
package: StringFilter.optional(),
|
|
2989
|
+
subpath: StringFilter.optional(),
|
|
2990
|
+
name: StringFilter.optional(),
|
|
2991
|
+
version: StringFilter.optional(),
|
|
2992
|
+
github_repo: StringFilter.optional(),
|
|
2993
|
+
is_builtin: import_zod2.z.boolean().optional(),
|
|
2994
|
+
description: StringFilter.optional(),
|
|
2995
|
+
state: import_zod2.z.union([DependencyState, import_zod2.z.object({ contains: import_zod2.z.string() })]).optional(),
|
|
2996
|
+
error: StringFilter.optional()
|
|
2997
|
+
}).optional(),
|
|
2998
|
+
order_by: import_zod2.z.tuple([DependencyField, OrderDirection]).optional()
|
|
2999
|
+
});
|
|
3000
|
+
var DependencySelectOptions = import_zod2.z.object({
|
|
3001
|
+
select: import_zod2.z.array(DependencyField).optional(),
|
|
3002
|
+
limit: import_zod2.z.number().int().positive().optional(),
|
|
3003
|
+
offset: import_zod2.z.number().int().nonnegative().optional()
|
|
3004
|
+
});
|
|
3005
|
+
|
|
3006
|
+
// src/cli/commands/files/search.ts
|
|
3005
3007
|
var search13 = new import_commander5.Command("search");
|
|
3006
3008
|
search13.description("Search files with JSON options");
|
|
3007
3009
|
search13.argument("<options>", "JSON options for search");
|
|
3008
|
-
search13.action(async (
|
|
3009
|
-
const
|
|
3010
|
+
search13.action(async (...args) => {
|
|
3011
|
+
const [options_json] = args;
|
|
3012
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3010
3013
|
const options = parse_options(options_json, FileSearchOptions, "files search");
|
|
3011
3014
|
const results = wiki.files.search(options);
|
|
3012
3015
|
env.log(JSON.stringify(results, null, 2));
|
|
@@ -3019,8 +3022,9 @@ var set_description5 = new import_commander6.Command("set-description");
|
|
|
3019
3022
|
set_description5.description("Set description for a file");
|
|
3020
3023
|
set_description5.argument("<file-id>", "File ID");
|
|
3021
3024
|
set_description5.argument("<markdown-file>", "Path to markdown file");
|
|
3022
|
-
set_description5.action(async (
|
|
3023
|
-
const
|
|
3025
|
+
set_description5.action(async (...args) => {
|
|
3026
|
+
const [id, file] = args;
|
|
3027
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3024
3028
|
try {
|
|
3025
3029
|
const content = (0, import_node_fs3.readFileSync)(file, "utf-8");
|
|
3026
3030
|
wiki.files.set_description(Number(id), content);
|
|
@@ -3037,8 +3041,9 @@ var imported_by_file2 = new import_commander7.Command("imported-by-file");
|
|
|
3037
3041
|
imported_by_file2.description("Files imported by the given file");
|
|
3038
3042
|
imported_by_file2.argument("<file-id>", "File ID");
|
|
3039
3043
|
imported_by_file2.argument("<options>", "JSON options");
|
|
3040
|
-
imported_by_file2.action(async (
|
|
3041
|
-
const
|
|
3044
|
+
imported_by_file2.action(async (...args) => {
|
|
3045
|
+
const [file_id, options_json] = args;
|
|
3046
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3042
3047
|
const options = parse_options(options_json, FileRelationOptions, "files imported-by-file");
|
|
3043
3048
|
const results = wiki.files.imported_by_file(Number(file_id), options);
|
|
3044
3049
|
env.log(JSON.stringify(results, null, 2));
|
|
@@ -3050,8 +3055,9 @@ var importing_file2 = new import_commander8.Command("importing-file");
|
|
|
3050
3055
|
importing_file2.description("Files importing the given file");
|
|
3051
3056
|
importing_file2.argument("<file-id>", "File ID");
|
|
3052
3057
|
importing_file2.argument("<options>", "JSON options");
|
|
3053
|
-
importing_file2.action(async (
|
|
3054
|
-
const
|
|
3058
|
+
importing_file2.action(async (...args) => {
|
|
3059
|
+
const [file_id, options_json] = args;
|
|
3060
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3055
3061
|
const options = parse_options(options_json, FileRelationOptions, "files importing-file");
|
|
3056
3062
|
const results = wiki.files.importing_file(Number(file_id), options);
|
|
3057
3063
|
env.log(JSON.stringify(results, null, 2));
|
|
@@ -3063,8 +3069,9 @@ var importing_dependency2 = new import_commander9.Command("importing-dependency"
|
|
|
3063
3069
|
importing_dependency2.description("Files importing the given dependency");
|
|
3064
3070
|
importing_dependency2.argument("<dep-id>", "Dependency ID");
|
|
3065
3071
|
importing_dependency2.argument("<options>", "JSON options");
|
|
3066
|
-
importing_dependency2.action(async (
|
|
3067
|
-
const
|
|
3072
|
+
importing_dependency2.action(async (...args) => {
|
|
3073
|
+
const [dep_id, options_json] = args;
|
|
3074
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3068
3075
|
const options = parse_options(options_json, FileRelationOptions, "files importing-dependency");
|
|
3069
3076
|
const results = wiki.files.importing_dependency(Number(dep_id), options);
|
|
3070
3077
|
env.log(JSON.stringify(results, null, 2));
|
|
@@ -3117,8 +3124,9 @@ var import_commander11 = require("commander");
|
|
|
3117
3124
|
var get7 = new import_commander11.Command("get");
|
|
3118
3125
|
get7.description("Get a symbol by ID");
|
|
3119
3126
|
get7.argument("<id>", "Symbol ID");
|
|
3120
|
-
get7.action(async (
|
|
3121
|
-
const
|
|
3127
|
+
get7.action(async (...args) => {
|
|
3128
|
+
const [id] = args;
|
|
3129
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3122
3130
|
const symbol = wiki.symbols.get(Number(id));
|
|
3123
3131
|
env.log(JSON.stringify(symbol, null, 2));
|
|
3124
3132
|
});
|
|
@@ -3128,8 +3136,9 @@ var import_commander12 = require("commander");
|
|
|
3128
3136
|
var search14 = new import_commander12.Command("search");
|
|
3129
3137
|
search14.description("Search symbols with JSON options");
|
|
3130
3138
|
search14.argument("<options>", "JSON options");
|
|
3131
|
-
search14.action(async (
|
|
3132
|
-
const
|
|
3139
|
+
search14.action(async (...args) => {
|
|
3140
|
+
const [options_json] = args;
|
|
3141
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3133
3142
|
const options = parse_options(options_json, SymbolSearchOptions, "symbols search");
|
|
3134
3143
|
const results = wiki.symbols.search(options);
|
|
3135
3144
|
env.log(JSON.stringify(results, null, 2));
|
|
@@ -3142,8 +3151,9 @@ var set_description6 = new import_commander13.Command("set-description");
|
|
|
3142
3151
|
set_description6.description("Set description for a symbol");
|
|
3143
3152
|
set_description6.argument("<symbol-id>", "Symbol ID");
|
|
3144
3153
|
set_description6.argument("<markdown-file>", "Path to markdown file");
|
|
3145
|
-
set_description6.action(async (
|
|
3146
|
-
const
|
|
3154
|
+
set_description6.action(async (...args) => {
|
|
3155
|
+
const [id, file] = args;
|
|
3156
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3147
3157
|
try {
|
|
3148
3158
|
const content = (0, import_node_fs4.readFileSync)(file, "utf-8");
|
|
3149
3159
|
wiki.symbols.set_description(Number(id), content);
|
|
@@ -3160,8 +3170,9 @@ var referencing_symbol2 = new import_commander14.Command("referencing-symbol");
|
|
|
3160
3170
|
referencing_symbol2.description("Symbols referencing the given symbol");
|
|
3161
3171
|
referencing_symbol2.argument("<symbol-id>", "Symbol ID");
|
|
3162
3172
|
referencing_symbol2.argument("<options>", "JSON options");
|
|
3163
|
-
referencing_symbol2.action(async (
|
|
3164
|
-
const
|
|
3173
|
+
referencing_symbol2.action(async (...args) => {
|
|
3174
|
+
const [symbol_id, options_json] = args;
|
|
3175
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3165
3176
|
const options = parse_options(options_json, SymbolRelationOptions, "symbols referencing-symbol");
|
|
3166
3177
|
const results = wiki.symbols.referencing_symbol(Number(symbol_id), options);
|
|
3167
3178
|
env.log(JSON.stringify(results, null, 2));
|
|
@@ -3173,8 +3184,9 @@ var referenced_by_symbol2 = new import_commander15.Command("referenced-by-symbol
|
|
|
3173
3184
|
referenced_by_symbol2.description("Symbols referenced by the given symbol");
|
|
3174
3185
|
referenced_by_symbol2.argument("<symbol-id>", "Symbol ID");
|
|
3175
3186
|
referenced_by_symbol2.argument("<options>", "JSON options");
|
|
3176
|
-
referenced_by_symbol2.action(async (
|
|
3177
|
-
const
|
|
3187
|
+
referenced_by_symbol2.action(async (...args) => {
|
|
3188
|
+
const [symbol_id, options_json] = args;
|
|
3189
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3178
3190
|
const options = parse_options(options_json, SymbolRelationOptions, "symbols referenced-by-symbol");
|
|
3179
3191
|
const results = wiki.symbols.referenced_by_symbol(Number(symbol_id), options);
|
|
3180
3192
|
env.log(JSON.stringify(results, null, 2));
|
|
@@ -3186,8 +3198,9 @@ var using_dependency4 = new import_commander16.Command("using-dependency");
|
|
|
3186
3198
|
using_dependency4.description("Symbols using the given dependency");
|
|
3187
3199
|
using_dependency4.argument("<dep-id>", "Dependency ID");
|
|
3188
3200
|
using_dependency4.argument("<options>", "JSON options");
|
|
3189
|
-
using_dependency4.action(async (
|
|
3190
|
-
const
|
|
3201
|
+
using_dependency4.action(async (...args) => {
|
|
3202
|
+
const [dep_id, options_json] = args;
|
|
3203
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3191
3204
|
const options = parse_options(options_json, SymbolRelationOptions, "symbols using-dependency");
|
|
3192
3205
|
const results = wiki.symbols.using_dependency(Number(dep_id), options);
|
|
3193
3206
|
env.log(JSON.stringify(results, null, 2));
|
|
@@ -3240,8 +3253,9 @@ var import_commander18 = require("commander");
|
|
|
3240
3253
|
var get8 = new import_commander18.Command("get");
|
|
3241
3254
|
get8.description("Get a directory by ID");
|
|
3242
3255
|
get8.argument("<id>", "Directory ID");
|
|
3243
|
-
get8.action(async (
|
|
3244
|
-
const
|
|
3256
|
+
get8.action(async (...args) => {
|
|
3257
|
+
const [id] = args;
|
|
3258
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3245
3259
|
const directory = wiki.directories.get(Number(id));
|
|
3246
3260
|
env.log(JSON.stringify(directory, null, 2));
|
|
3247
3261
|
});
|
|
@@ -3251,8 +3265,9 @@ var import_commander19 = require("commander");
|
|
|
3251
3265
|
var search15 = new import_commander19.Command("search");
|
|
3252
3266
|
search15.description("Search directories with JSON options");
|
|
3253
3267
|
search15.argument("<options>", "JSON options");
|
|
3254
|
-
search15.action(async (
|
|
3255
|
-
const
|
|
3268
|
+
search15.action(async (...args) => {
|
|
3269
|
+
const [options_json] = args;
|
|
3270
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3256
3271
|
const options = parse_options(options_json, DirectorySearchOptions, "directories search");
|
|
3257
3272
|
const results = wiki.directories.search(options);
|
|
3258
3273
|
env.log(JSON.stringify(results, null, 2));
|
|
@@ -3265,8 +3280,9 @@ var set_description7 = new import_commander20.Command("set-description");
|
|
|
3265
3280
|
set_description7.description("Set description for a directory");
|
|
3266
3281
|
set_description7.argument("<directory-id>", "Directory ID");
|
|
3267
3282
|
set_description7.argument("<markdown-file>", "Path to markdown file");
|
|
3268
|
-
set_description7.action(async (
|
|
3269
|
-
const
|
|
3283
|
+
set_description7.action(async (...args) => {
|
|
3284
|
+
const [id, file] = args;
|
|
3285
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3270
3286
|
try {
|
|
3271
3287
|
const content = (0, import_node_fs5.readFileSync)(file, "utf-8");
|
|
3272
3288
|
wiki.directories.set_description(Number(id), content);
|
|
@@ -3283,8 +3299,9 @@ var children2 = new import_commander21.Command("children");
|
|
|
3283
3299
|
children2.description("Child directories of the given directory");
|
|
3284
3300
|
children2.argument("<parent-id>", "Parent directory ID");
|
|
3285
3301
|
children2.argument("<options>", "JSON options");
|
|
3286
|
-
children2.action(async (
|
|
3287
|
-
const
|
|
3302
|
+
children2.action(async (...args) => {
|
|
3303
|
+
const [parent_id, options_json] = args;
|
|
3304
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3288
3305
|
const options = parse_options(options_json, DirectoryRelationOptions, "directories children");
|
|
3289
3306
|
const results = wiki.directories.children(Number(parent_id), options);
|
|
3290
3307
|
env.log(JSON.stringify(results, null, 2));
|
|
@@ -3296,8 +3313,9 @@ var files4 = new import_commander22.Command("files");
|
|
|
3296
3313
|
files4.description("Files in the given directory");
|
|
3297
3314
|
files4.argument("<directory-id>", "Directory ID");
|
|
3298
3315
|
files4.argument("<options>", "JSON options");
|
|
3299
|
-
files4.action(async (
|
|
3300
|
-
const
|
|
3316
|
+
files4.action(async (...args) => {
|
|
3317
|
+
const [directory_id, options_json] = args;
|
|
3318
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3301
3319
|
const options = parse_options(options_json, FileRelationOptions, "directories files");
|
|
3302
3320
|
const results = wiki.directories.files(Number(directory_id), options);
|
|
3303
3321
|
env.log(JSON.stringify(results, null, 2));
|
|
@@ -3349,8 +3367,9 @@ var import_commander24 = require("commander");
|
|
|
3349
3367
|
var get9 = new import_commander24.Command("get");
|
|
3350
3368
|
get9.description("Get a dependency by ID");
|
|
3351
3369
|
get9.argument("<id>", "Dependency ID");
|
|
3352
|
-
get9.action(async (
|
|
3353
|
-
const
|
|
3370
|
+
get9.action(async (...args) => {
|
|
3371
|
+
const [id] = args;
|
|
3372
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3354
3373
|
const dependency = wiki.dependencies.get(Number(id));
|
|
3355
3374
|
env.log(JSON.stringify(dependency, null, 2));
|
|
3356
3375
|
});
|
|
@@ -3360,8 +3379,9 @@ var import_commander25 = require("commander");
|
|
|
3360
3379
|
var search16 = new import_commander25.Command("search");
|
|
3361
3380
|
search16.description("Search dependencies with JSON options");
|
|
3362
3381
|
search16.argument("<options>", "JSON options");
|
|
3363
|
-
search16.action(async (
|
|
3364
|
-
const
|
|
3382
|
+
search16.action(async (...args) => {
|
|
3383
|
+
const [options_json] = args;
|
|
3384
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3365
3385
|
const options = parse_options(options_json, DependencySearchOptions, "dependencies search");
|
|
3366
3386
|
const results = wiki.dependencies.search(options);
|
|
3367
3387
|
env.log(JSON.stringify(results, null, 2));
|
|
@@ -3374,8 +3394,9 @@ var set_description8 = new import_commander26.Command("set-description");
|
|
|
3374
3394
|
set_description8.description("Set description for a dependency");
|
|
3375
3395
|
set_description8.argument("<dependency-id>", "Dependency ID");
|
|
3376
3396
|
set_description8.argument("<markdown-file>", "Path to markdown file");
|
|
3377
|
-
set_description8.action(async (
|
|
3378
|
-
const
|
|
3397
|
+
set_description8.action(async (...args) => {
|
|
3398
|
+
const [id, file] = args;
|
|
3399
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3379
3400
|
try {
|
|
3380
3401
|
const content = (0, import_node_fs6.readFileSync)(file, "utf-8");
|
|
3381
3402
|
wiki.dependencies.set_description(Number(id), content);
|
|
@@ -3392,8 +3413,9 @@ var used_by_file3 = new import_commander27.Command("used-by-file");
|
|
|
3392
3413
|
used_by_file3.description("Dependencies used by the given file");
|
|
3393
3414
|
used_by_file3.argument("<file-id>", "File ID");
|
|
3394
3415
|
used_by_file3.argument("<options>", "JSON options");
|
|
3395
|
-
used_by_file3.action(async (
|
|
3396
|
-
const
|
|
3416
|
+
used_by_file3.action(async (...args) => {
|
|
3417
|
+
const [file_id, options_json] = args;
|
|
3418
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3397
3419
|
const options = parse_options(options_json, DependencySelectOptions, "dependencies used-by-file");
|
|
3398
3420
|
const results = wiki.dependencies.used_by_file(Number(file_id), options);
|
|
3399
3421
|
env.log(JSON.stringify(results, null, 2));
|
|
@@ -3405,8 +3427,9 @@ var used_by_symbol3 = new import_commander28.Command("used-by-symbol");
|
|
|
3405
3427
|
used_by_symbol3.description("Dependencies used by the given symbol");
|
|
3406
3428
|
used_by_symbol3.argument("<symbol-id>", "Symbol ID");
|
|
3407
3429
|
used_by_symbol3.argument("<options>", "JSON options");
|
|
3408
|
-
used_by_symbol3.action(async (
|
|
3409
|
-
const
|
|
3430
|
+
used_by_symbol3.action(async (...args) => {
|
|
3431
|
+
const [symbol_id, options_json] = args;
|
|
3432
|
+
const wiki = await load_wiki(get_db_path(...args));
|
|
3410
3433
|
const options = parse_options(options_json, DependencySelectOptions, "dependencies used-by-symbol");
|
|
3411
3434
|
const results = wiki.dependencies.used_by_symbol(Number(symbol_id), options);
|
|
3412
3435
|
env.log(JSON.stringify(results, null, 2));
|
|
@@ -3455,6 +3478,7 @@ var commands = [update7, status, describe, files3, symbols3, directories3, depen
|
|
|
3455
3478
|
async function run(argv) {
|
|
3456
3479
|
const program = new import_commander30.Command();
|
|
3457
3480
|
program.name("codewiki").description("Describe and explore TypeScript codebases").version("0.0.1");
|
|
3481
|
+
program.option("--db <path>", "Database location", "./wiki.db");
|
|
3458
3482
|
for (const cmd of commands) program.addCommand(cmd);
|
|
3459
3483
|
return program.parseAsync(argv, { from: "user" });
|
|
3460
3484
|
}
|