adhdev 0.5.26 → 0.5.28

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 CHANGED
@@ -21089,20 +21089,13 @@ var require_dist = __commonJS({
21089
21089
  // ─── Public API ────────────────────────────────
21090
21090
  /**
21091
21091
  * Load all providers (3-tier priority)
21092
- * 1. _builtin/ (bundled fallback, or multiple array dirs)
21093
- * 2. .upstream/ (GitHub auto-download)
21094
- * 3. User custom (~/.adhdev/providers/ excluding _upstream)
21095
- * Later loads override earlier ones, so user custom always wins.
21092
+ * 1. .upstream/ (GitHub auto-download primary source)
21093
+ * 2. User custom (~/.adhdev/providers/ excluding .upstream)
21094
+ * User custom always wins (highest priority).
21095
+ * If .upstream/ is empty, call fetchLatest() before loadAll().
21096
21096
  */
21097
21097
  loadAll() {
21098
21098
  this.providers.clear();
21099
- let builtinCount = 0;
21100
- for (const dir of this.builtinDirs) {
21101
- if (fs5.existsSync(dir)) {
21102
- builtinCount += this.loadDir(dir);
21103
- }
21104
- }
21105
- this.log(`Loaded ${builtinCount} builtin providers`);
21106
21099
  let upstreamCount = 0;
21107
21100
  if (fs5.existsSync(this.upstreamDir)) {
21108
21101
  upstreamCount = this.loadDir(this.upstreamDir);
@@ -21117,11 +21110,21 @@ var require_dist = __commonJS({
21117
21110
  }
21118
21111
  }
21119
21112
  this.log(`Total: ${this.providers.size} providers [${[...this.providers.keys()].join(", ")}]`);
21120
- if (upstreamCount === 0 && builtinCount > 0) {
21121
- this.log(`\u26A0 Using bundled providers only (upstream not available). Run 'adhdev daemon' with internet to auto-update.`);
21122
- }
21123
21113
  if (this.providers.size === 0) {
21124
- this.log(`\u274C No providers loaded! Check builtinDirs.`);
21114
+ this.log(`\u274C No providers loaded! Run 'adhdev daemon' with internet to download providers.`);
21115
+ }
21116
+ }
21117
+ /**
21118
+ * Check if upstream directory exists and has providers.
21119
+ */
21120
+ hasUpstream() {
21121
+ if (!fs5.existsSync(this.upstreamDir)) return false;
21122
+ try {
21123
+ return fs5.readdirSync(this.upstreamDir).some(
21124
+ (d) => fs5.statSync(path6.join(this.upstreamDir, d)).isDirectory()
21125
+ );
21126
+ } catch {
21127
+ return false;
21125
21128
  }
21126
21129
  }
21127
21130
  /**
@@ -28810,6 +28813,14 @@ data: ${JSON.stringify(msg.data)}
28810
28813
  const providerLoader = new ProviderLoader2({
28811
28814
  logFn: config2.providerLogFn
28812
28815
  });
28816
+ if (!providerLoader.hasUpstream()) {
28817
+ LOG5.info("Provider", "No upstream providers found \u2014 downloading from GitHub...");
28818
+ try {
28819
+ await providerLoader.fetchLatest();
28820
+ } catch (e) {
28821
+ LOG5.warn("Provider", `\u26A0 Failed to fetch providers: ${e?.message}`);
28822
+ }
28823
+ }
28813
28824
  providerLoader.loadAll();
28814
28825
  providerLoader.registerToDetector();
28815
28826
  const instanceManager = new ProviderInstanceManager();
@@ -30196,7 +30207,7 @@ var init_adhdev_daemon = __esm({
30196
30207
  path2 = __toESM(require("path"));
30197
30208
  crypto2 = __toESM(require("crypto"));
30198
30209
  import_chalk = __toESM(require("chalk"));
30199
- pkgVersion = "0.5.26";
30210
+ pkgVersion = "0.5.28";
30200
30211
  if (pkgVersion === "unknown") {
30201
30212
  try {
30202
30213
  const possiblePaths = [