citeclaw 2.0.9 → 2.0.11
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/package.json +2 -2
- package/scripts/botcite.js +39 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "citeclaw",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.11",
|
|
4
4
|
"description": "Citation and bibliography toolkit for DOI, URL, arXiv, PDF, Zotero, and MCP workflows.",
|
|
5
5
|
"homepage": "https://github.com/trotsky1997/citeclaw",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"coverage": "nyc --reporter=lcov _mocha"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
|
-
"node": "20 || 22"
|
|
38
|
+
"node": "20 || 22 || 24"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"bluebird": "3.7.2",
|
package/scripts/botcite.js
CHANGED
|
@@ -343,6 +343,41 @@ function fileExists( filePath ) {
|
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
|
|
346
|
+
function normalizeCommandForSpawn( command, platform ) {
|
|
347
|
+
const activePlatform = platform || process.platform;
|
|
348
|
+
if ( activePlatform !== 'win32' ) {
|
|
349
|
+
return command;
|
|
350
|
+
}
|
|
351
|
+
if ( /[\\/]/.test( command ) || /\.[^\\/]+$/.test( command ) ) {
|
|
352
|
+
return command;
|
|
353
|
+
}
|
|
354
|
+
const windowsCommands = {
|
|
355
|
+
npm: 'npm.cmd',
|
|
356
|
+
npx: 'npx.cmd',
|
|
357
|
+
git: 'git.exe',
|
|
358
|
+
curl: 'curl.exe',
|
|
359
|
+
bun: 'bun.exe'
|
|
360
|
+
};
|
|
361
|
+
return windowsCommands[ command ] || command;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
function resolveSpawnSettings( command, platform ) {
|
|
365
|
+
const resolvedCommand = normalizeCommandForSpawn( command, platform );
|
|
366
|
+
const activePlatform = platform || process.platform;
|
|
367
|
+
return {
|
|
368
|
+
command: resolvedCommand,
|
|
369
|
+
shell: activePlatform === 'win32' && /\.(?:cmd|bat)$/i.test( resolvedCommand )
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
function spawnSyncResolved( command, args, options ) {
|
|
374
|
+
const resolved = resolveSpawnSettings( command );
|
|
375
|
+
return spawnSync( resolved.command, args, {
|
|
376
|
+
...( options || {} ),
|
|
377
|
+
shell: resolved.shell
|
|
378
|
+
} );
|
|
379
|
+
}
|
|
380
|
+
|
|
346
381
|
function commandExists( command ) {
|
|
347
382
|
const args = process.platform === 'win32' ? [ '/c', 'where', command ] : [ '-lc', `command -v ${ command }` ];
|
|
348
383
|
const found = spawnSync( process.platform === 'win32' ? 'cmd' : 'bash', args, {
|
|
@@ -439,7 +474,7 @@ function jsonOut( value ) {
|
|
|
439
474
|
}
|
|
440
475
|
|
|
441
476
|
function runCommandText( command, args ) {
|
|
442
|
-
const result =
|
|
477
|
+
const result = spawnSyncResolved( command, args, {
|
|
443
478
|
stdio: 'pipe',
|
|
444
479
|
encoding: 'utf8'
|
|
445
480
|
} );
|
|
@@ -454,7 +489,7 @@ function runCommandText( command, args ) {
|
|
|
454
489
|
}
|
|
455
490
|
|
|
456
491
|
function runCommandOrThrow( command, args, cwd ) {
|
|
457
|
-
const result =
|
|
492
|
+
const result = spawnSyncResolved( command, args, {
|
|
458
493
|
cwd: cwd || rootDir,
|
|
459
494
|
stdio: 'pipe',
|
|
460
495
|
encoding: 'utf8'
|
|
@@ -5191,8 +5226,10 @@ module.exports = {
|
|
|
5191
5226
|
extractBestDoiCandidate,
|
|
5192
5227
|
extractPdfCandidates,
|
|
5193
5228
|
main,
|
|
5229
|
+
normalizeCommandForSpawn,
|
|
5194
5230
|
normalizeArxivId,
|
|
5195
5231
|
normalizeDoi,
|
|
5232
|
+
resolveSpawnSettings,
|
|
5196
5233
|
syncStyles,
|
|
5197
5234
|
shouldAttemptPdfOcr
|
|
5198
5235
|
};
|