@link-assistant/hive-mind 1.56.9 → 1.56.10
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/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/hive.mjs +4 -2
- package/src/memory-check.mjs +2 -1
- package/src/solve.config.lib.mjs +2 -1
- package/src/telegram-bot.mjs +2 -1
- package/src/yargs-factory.lib.mjs +17 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/hive.mjs
CHANGED
|
@@ -19,7 +19,8 @@ if (earlyArgs.includes('--help') || earlyArgs.includes('-h')) {
|
|
|
19
19
|
const { use } = eval(await (await fetch('https://unpkg.com/use-m/use.js')).text());
|
|
20
20
|
globalThis.use = use;
|
|
21
21
|
const yargsModule = await use('yargs@17.7.2');
|
|
22
|
-
const
|
|
22
|
+
const { resolveYargsFactory } = await import('./yargs-factory.lib.mjs');
|
|
23
|
+
const yargs = resolveYargsFactory(yargsModule);
|
|
23
24
|
const helpersModuleHelp = await use('yargs@17.7.2/helpers');
|
|
24
25
|
const _helpersHelp = helpersModuleHelp.default || helpersModuleHelp;
|
|
25
26
|
const hideBinHelp = _helpersHelp.hideBin || (argv => argv.slice(2));
|
|
@@ -71,7 +72,8 @@ if (isRunningDirectly) {
|
|
|
71
72
|
'loading command-stream'
|
|
72
73
|
);
|
|
73
74
|
const yargsModule = await withTimeout(use('yargs@17.7.2'), 30000, 'loading yargs');
|
|
74
|
-
const
|
|
75
|
+
const { resolveYargsFactory } = await import('./yargs-factory.lib.mjs');
|
|
76
|
+
const yargs = resolveYargsFactory(yargsModule);
|
|
75
77
|
const helpersModuleMain = await withTimeout(use('yargs@17.7.2/helpers'), 30000, 'loading yargs helpers');
|
|
76
78
|
const _helpersMain = helpersModuleMain.default || helpersModuleMain;
|
|
77
79
|
const hideBin = _helpersMain.hideBin || (argv => argv.slice(2));
|
package/src/memory-check.mjs
CHANGED
|
@@ -6,6 +6,7 @@ if (typeof globalThis.use === 'undefined') {
|
|
|
6
6
|
globalThis.use = (await eval(await (await fetch('https://unpkg.com/use-m/use.js')).text())).use;
|
|
7
7
|
}
|
|
8
8
|
const use = globalThis.use;
|
|
9
|
+
const { resolveYargsFactory } = await import('./yargs-factory.lib.mjs');
|
|
9
10
|
|
|
10
11
|
// Temporarily unset CI to avoid command-stream trace logs
|
|
11
12
|
const originalCI = process.env.CI;
|
|
@@ -18,7 +19,7 @@ const { $ } = await use('command-stream');
|
|
|
18
19
|
const $silent = $({ mirror: false, capture: true });
|
|
19
20
|
|
|
20
21
|
const yargsModule = await use('yargs@17.7.2');
|
|
21
|
-
const yargs = yargsModule
|
|
22
|
+
const yargs = resolveYargsFactory(yargsModule);
|
|
22
23
|
const helpersModule = await use('yargs@17.7.2/helpers');
|
|
23
24
|
// Node 24 CJS/ESM interop may return the whole module object instead of named exports directly
|
|
24
25
|
const _helpers = helpersModule.default || helpersModule;
|
package/src/solve.config.lib.mjs
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { enhanceErrorMessage, detectMalformedFlags } from './option-suggestions.lib.mjs';
|
|
11
11
|
import { defaultModels, buildModelOptionDescription, resolveDefaultFallbackModel, resolveRuntimeDefaultModel } from './models/index.mjs';
|
|
12
12
|
import { validateBranchName } from './solve.branch.lib.mjs';
|
|
13
|
+
import { resolveYargsFactory } from './yargs-factory.lib.mjs';
|
|
13
14
|
|
|
14
15
|
// Re-export for use by telegram-bot.mjs (avoids extra import lines there)
|
|
15
16
|
export { detectMalformedFlags };
|
|
@@ -18,7 +19,7 @@ export { detectMalformedFlags };
|
|
|
18
19
|
export const initializeConfig = async use => {
|
|
19
20
|
// Import yargs with specific version for hideBin support
|
|
20
21
|
const yargsModule = await use('yargs@17.7.2');
|
|
21
|
-
const yargs = yargsModule
|
|
22
|
+
const yargs = resolveYargsFactory(yargsModule);
|
|
22
23
|
const helpersModule = await use('yargs@17.7.2/helpers');
|
|
23
24
|
// Node 24 CJS/ESM interop may return the whole module object instead of named exports directly
|
|
24
25
|
const helpers = helpersModule.default || helpersModule;
|
package/src/telegram-bot.mjs
CHANGED
|
@@ -25,13 +25,14 @@ const dotenvxModule = await use('@dotenvx/dotenvx');
|
|
|
25
25
|
const dotenvx = dotenvxModule.default || dotenvxModule;
|
|
26
26
|
const getenvModule = await use('getenv');
|
|
27
27
|
const getenv = typeof getenvModule === 'function' ? getenvModule : getenvModule.default || getenvModule;
|
|
28
|
+
const { resolveYargsFactory } = await import('./yargs-factory.lib.mjs');
|
|
28
29
|
|
|
29
30
|
// Load .env/.lenv configuration (issue #1318)
|
|
30
31
|
dotenvx.config({ quiet: true, ignore: ['MISSING_ENV_FILE'] });
|
|
31
32
|
await loadLenvConfig({ override: true, quiet: true });
|
|
32
33
|
|
|
33
34
|
const yargsModule = await use('yargs@17.7.2');
|
|
34
|
-
const yargs = yargsModule
|
|
35
|
+
const yargs = resolveYargsFactory(yargsModule);
|
|
35
36
|
const helpersModuleBot = await use('yargs@17.7.2/helpers');
|
|
36
37
|
const _helpersBot = helpersModuleBot.default || helpersModuleBot;
|
|
37
38
|
const hideBin = _helpersBot.hideBin || (argv => argv.slice(2));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Resolve use-m's yargs import to the fresh parser factory.
|
|
2
|
+
//
|
|
3
|
+
// In the use-m yargs@17.7.2 shape, the module object is the factory that
|
|
4
|
+
// creates independent parser instances, while module.default is a singleton
|
|
5
|
+
// wrapper. Reusing the singleton accumulates options and duplicates choice
|
|
6
|
+
// values in validation errors.
|
|
7
|
+
export function resolveYargsFactory(yargsModule) {
|
|
8
|
+
if (typeof yargsModule === 'function' && typeof yargsModule.getInternalMethods === 'function') {
|
|
9
|
+
return yargsModule;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const candidate = yargsModule?.default || yargsModule;
|
|
13
|
+
if (typeof candidate !== 'function') {
|
|
14
|
+
throw new TypeError('Unable to resolve yargs factory from imported module');
|
|
15
|
+
}
|
|
16
|
+
return candidate;
|
|
17
|
+
}
|