adhdev 0.6.51 → 0.6.52
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/dist/cli/index.js +110 -65
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +80 -41
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5074,6 +5074,76 @@ var init_provider_loader = __esm({
|
|
|
5074
5074
|
}
|
|
5075
5075
|
// ─── Public API ────────────────────────────────
|
|
5076
5076
|
/**
|
|
5077
|
+
* Ordered builtin roots used for local fallback/reference data.
|
|
5078
|
+
*/
|
|
5079
|
+
getBuiltinDirs() {
|
|
5080
|
+
return [...this.builtinDirs];
|
|
5081
|
+
}
|
|
5082
|
+
/**
|
|
5083
|
+
* Primary builtin root used for local scaffolding/reference flows.
|
|
5084
|
+
*/
|
|
5085
|
+
getPrimaryBuiltinDir() {
|
|
5086
|
+
return this.builtinDirs[0];
|
|
5087
|
+
}
|
|
5088
|
+
/**
|
|
5089
|
+
* User override root (~/.adhdev/providers by default).
|
|
5090
|
+
*/
|
|
5091
|
+
getUserDir() {
|
|
5092
|
+
return this.userDir;
|
|
5093
|
+
}
|
|
5094
|
+
/**
|
|
5095
|
+
* Auto-updated upstream root (~/.adhdev/providers/.upstream by default).
|
|
5096
|
+
*/
|
|
5097
|
+
getUpstreamDir() {
|
|
5098
|
+
return this.upstreamDir;
|
|
5099
|
+
}
|
|
5100
|
+
/**
|
|
5101
|
+
* Provider search order for on-disk lookups.
|
|
5102
|
+
* Highest-priority editable overrides come first.
|
|
5103
|
+
*/
|
|
5104
|
+
getProviderRoots() {
|
|
5105
|
+
return [this.userDir, this.upstreamDir, ...this.builtinDirs];
|
|
5106
|
+
}
|
|
5107
|
+
/**
|
|
5108
|
+
* Canonical provider directory shape for a given root.
|
|
5109
|
+
*/
|
|
5110
|
+
getProviderDir(root, category, type) {
|
|
5111
|
+
return path6.join(root, category, type);
|
|
5112
|
+
}
|
|
5113
|
+
/**
|
|
5114
|
+
* Canonical user override directory for a provider.
|
|
5115
|
+
*/
|
|
5116
|
+
getUserProviderDir(category, type) {
|
|
5117
|
+
return this.getProviderDir(this.userDir, category, type);
|
|
5118
|
+
}
|
|
5119
|
+
/**
|
|
5120
|
+
* Canonical upstream directory for a provider.
|
|
5121
|
+
*/
|
|
5122
|
+
getUpstreamProviderDir(category, type) {
|
|
5123
|
+
return this.getProviderDir(this.upstreamDir, category, type);
|
|
5124
|
+
}
|
|
5125
|
+
/**
|
|
5126
|
+
* Canonical builtin directory for a provider.
|
|
5127
|
+
*/
|
|
5128
|
+
getBuiltinProviderDir(category, type) {
|
|
5129
|
+
return this.getProviderDir(this.getPrimaryBuiltinDir(), category, type);
|
|
5130
|
+
}
|
|
5131
|
+
/**
|
|
5132
|
+
* Find the on-disk directory for a provider by type.
|
|
5133
|
+
* Search order: user override → upstream → builtin fallback.
|
|
5134
|
+
*/
|
|
5135
|
+
findProviderDir(type) {
|
|
5136
|
+
return this.findProviderDirInternal(type);
|
|
5137
|
+
}
|
|
5138
|
+
/**
|
|
5139
|
+
* Resolve a file within a provider directory.
|
|
5140
|
+
*/
|
|
5141
|
+
resolveProviderFile(type, ...segments) {
|
|
5142
|
+
const dir = this.findProviderDirInternal(type);
|
|
5143
|
+
if (!dir) return null;
|
|
5144
|
+
return path6.join(dir, ...segments);
|
|
5145
|
+
}
|
|
5146
|
+
/**
|
|
5077
5147
|
* Load all providers (3-tier priority)
|
|
5078
5148
|
* 1. .upstream/ (GitHub auto-download — primary source)
|
|
5079
5149
|
* 2. User custom (~/.adhdev/providers/ excluding .upstream)
|
|
@@ -5399,7 +5469,7 @@ var init_provider_loader = __esm({
|
|
|
5399
5469
|
* Tries scripts.js first, then individual .js files.
|
|
5400
5470
|
*/
|
|
5401
5471
|
loadScriptsFromDir(type, scriptDir) {
|
|
5402
|
-
const providerDir = this.
|
|
5472
|
+
const providerDir = this.findProviderDirInternal(type);
|
|
5403
5473
|
if (!providerDir) {
|
|
5404
5474
|
this.log(` [loadScriptsFromDir] ${type}: providerDir not found`);
|
|
5405
5475
|
return null;
|
|
@@ -5760,16 +5830,16 @@ var init_provider_loader = __esm({
|
|
|
5760
5830
|
// ─── Private ───────────────────────────────────
|
|
5761
5831
|
/**
|
|
5762
5832
|
* Find the on-disk directory for a provider by type.
|
|
5763
|
-
*
|
|
5833
|
+
* Preferred shape: root/category/type. Legacy flat root/type is kept temporarily for compatibility.
|
|
5764
5834
|
*/
|
|
5765
|
-
|
|
5835
|
+
findProviderDirInternal(type) {
|
|
5766
5836
|
const provider = this.providers.get(type);
|
|
5767
5837
|
if (!provider) return null;
|
|
5768
5838
|
const cat = provider.category;
|
|
5769
|
-
const searchRoots =
|
|
5839
|
+
const searchRoots = this.getProviderRoots();
|
|
5770
5840
|
for (const root of searchRoots) {
|
|
5771
5841
|
if (!fs5.existsSync(root)) continue;
|
|
5772
|
-
for (const candidate of [
|
|
5842
|
+
for (const candidate of [this.getProviderDir(root, cat, type), path6.join(root, type)]) {
|
|
5773
5843
|
if (fs5.existsSync(path6.join(candidate, "provider.json"))) return candidate;
|
|
5774
5844
|
}
|
|
5775
5845
|
const catDir = path6.join(root, cat);
|
|
@@ -27300,37 +27370,7 @@ var init_dev_server = __esm({
|
|
|
27300
27370
|
// ─── Provider File Explorer ───
|
|
27301
27371
|
/** Find the provider directory on disk */
|
|
27302
27372
|
findProviderDir(type) {
|
|
27303
|
-
|
|
27304
|
-
if (!provider) return null;
|
|
27305
|
-
const cat = provider.category;
|
|
27306
|
-
const builtinDir = this.providerLoader.builtinDirs?.[0] || path12.resolve(__dirname, "../providers/_builtin");
|
|
27307
|
-
const userDir = path12.join(os14.homedir(), ".adhdev", "providers");
|
|
27308
|
-
const directCandidates = [
|
|
27309
|
-
path12.join(userDir, type),
|
|
27310
|
-
path12.join(builtinDir, cat, type),
|
|
27311
|
-
path12.join(builtinDir, type)
|
|
27312
|
-
];
|
|
27313
|
-
for (const d of directCandidates) {
|
|
27314
|
-
if (fs9.existsSync(path12.join(d, "provider.json"))) return d;
|
|
27315
|
-
}
|
|
27316
|
-
const catDir = path12.join(builtinDir, cat);
|
|
27317
|
-
if (fs9.existsSync(catDir)) {
|
|
27318
|
-
try {
|
|
27319
|
-
for (const entry of fs9.readdirSync(catDir, { withFileTypes: true })) {
|
|
27320
|
-
if (!entry.isDirectory()) continue;
|
|
27321
|
-
const jsonPath = path12.join(catDir, entry.name, "provider.json");
|
|
27322
|
-
if (fs9.existsSync(jsonPath)) {
|
|
27323
|
-
try {
|
|
27324
|
-
const data = JSON.parse(fs9.readFileSync(jsonPath, "utf-8"));
|
|
27325
|
-
if (data.type === type) return path12.join(catDir, entry.name);
|
|
27326
|
-
} catch {
|
|
27327
|
-
}
|
|
27328
|
-
}
|
|
27329
|
-
}
|
|
27330
|
-
} catch {
|
|
27331
|
-
}
|
|
27332
|
-
}
|
|
27333
|
-
return null;
|
|
27373
|
+
return this.providerLoader.findProviderDir(type);
|
|
27334
27374
|
}
|
|
27335
27375
|
/** GET /api/providers/:type/files — list all files in provider directory */
|
|
27336
27376
|
async handleListFiles(type, _req, res) {
|
|
@@ -27725,10 +27765,9 @@ var init_dev_server = __esm({
|
|
|
27725
27765
|
}
|
|
27726
27766
|
let targetDir;
|
|
27727
27767
|
if (location === "user") {
|
|
27728
|
-
targetDir =
|
|
27768
|
+
targetDir = this.providerLoader.getUserProviderDir(category, type);
|
|
27729
27769
|
} else {
|
|
27730
|
-
|
|
27731
|
-
targetDir = path12.join(builtinDir, category, type);
|
|
27770
|
+
targetDir = this.providerLoader.getBuiltinProviderDir(category, type);
|
|
27732
27771
|
}
|
|
27733
27772
|
const jsonPath = path12.join(targetDir, "provider.json");
|
|
27734
27773
|
if (fs9.existsSync(jsonPath)) {
|
|
@@ -28537,7 +28576,7 @@ var init_dev_server = __esm({
|
|
|
28537
28576
|
const domContext = null;
|
|
28538
28577
|
this.sendAutoImplSSE({ event: "progress", data: { function: "_init", status: "loading_reference", message: `\uB808\uD37C\uB7F0\uC2A4 \uC2A4\uD06C\uB9BD\uD2B8 \uB85C\uB4DC \uC911 (${reference})...` } });
|
|
28539
28578
|
let referenceScripts = {};
|
|
28540
|
-
const builtinDir = this.providerLoader.
|
|
28579
|
+
const builtinDir = this.providerLoader.getPrimaryBuiltinDir();
|
|
28541
28580
|
const refDir = path12.join(builtinDir, "ide", reference);
|
|
28542
28581
|
if (fs9.existsSync(refDir)) {
|
|
28543
28582
|
const scriptsDir = path12.join(refDir, "scripts");
|
|
@@ -30944,7 +30983,7 @@ var init_adhdev_daemon = __esm({
|
|
|
30944
30983
|
fs11 = __toESM(require("fs"));
|
|
30945
30984
|
path14 = __toESM(require("path"));
|
|
30946
30985
|
import_chalk2 = __toESM(require("chalk"));
|
|
30947
|
-
pkgVersion = "0.6.
|
|
30986
|
+
pkgVersion = "0.6.52";
|
|
30948
30987
|
if (pkgVersion === "unknown") {
|
|
30949
30988
|
try {
|
|
30950
30989
|
const possiblePaths = [
|