citeclaw 2.0.7 → 2.0.8
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 +16 -3
- package/package.json +1 -1
- package/scripts/botcite.js +23 -5
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ It is designed for two related jobs:
|
|
|
15
15
|
- an HTTP service compatible with Citoid-style API flows
|
|
16
16
|
- an MCP server mode for agent/tool integrations
|
|
17
17
|
- Zotero automation for query, cite, add, update, notes, dedup, enrichment, and export
|
|
18
|
-
-
|
|
18
|
+
- optional translator/style sync commands for broader coverage and local CSL rendering
|
|
19
19
|
|
|
20
20
|
## Fast Start
|
|
21
21
|
|
|
@@ -37,7 +37,18 @@ npx citeclaw citoid bibtex "https://aclanthology.org/2023.emnlp-main.398/"
|
|
|
37
37
|
npx citeclaw cite mediawiki "https://arxiv.org/abs/1706.03762"
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
Fresh npm installs can run normal citation commands directly. `CiteClaw` will bootstrap Zotero and build a local translator runtime automatically from
|
|
40
|
+
Fresh npm installs can run normal citation commands directly. `CiteClaw` will bootstrap Zotero and build a local translator runtime automatically from Zotero's bundled translator set.
|
|
41
|
+
|
|
42
|
+
Runtime state is persisted in a user-level cache directory by default:
|
|
43
|
+
|
|
44
|
+
- Linux: `~/.cache/citeclaw`
|
|
45
|
+
- macOS: `~/Library/Caches/citeclaw`
|
|
46
|
+
- Windows: `%LOCALAPPDATA%\\citeclaw`
|
|
47
|
+
|
|
48
|
+
Override it with `CITECLAW_HOME=/path/to/runtime`.
|
|
49
|
+
|
|
50
|
+
By default, the Zotero translation server checkout is also stored under this runtime root, at `runtime/zotero`.
|
|
51
|
+
Override it with `ZOTERO_DIR=/path/to/zotero`.
|
|
41
52
|
|
|
42
53
|
## Local Service
|
|
43
54
|
|
|
@@ -120,7 +131,7 @@ Safety defaults:
|
|
|
120
131
|
|
|
121
132
|
## Runtime Sync
|
|
122
133
|
|
|
123
|
-
For npm installs, extra runtime assets can be synced explicitly when you want broader coverage or local style rendering:
|
|
134
|
+
For npm installs, extra runtime assets can be synced explicitly when you want broader translator coverage or local style rendering:
|
|
124
135
|
|
|
125
136
|
```bash
|
|
126
137
|
npx citeclaw translators sync
|
|
@@ -131,6 +142,8 @@ Notes:
|
|
|
131
142
|
|
|
132
143
|
- `translators sync` will clone or update the translator sources with `git` when needed
|
|
133
144
|
- `styles sync` will clone or update style repositories with `git` when local CSL styles are unavailable
|
|
145
|
+
- normal `cite` commands can run without manually syncing translators first
|
|
146
|
+
- `cite-style` will fetch style sources on demand if local styles are missing
|
|
134
147
|
- if `git` is not installed, the commands fail with an explicit message
|
|
135
148
|
|
|
136
149
|
## Bibliography Curation
|
package/package.json
CHANGED
package/scripts/botcite.js
CHANGED
|
@@ -19,13 +19,31 @@ const yaml = require( 'js-yaml' );
|
|
|
19
19
|
const citoidApp = require( '../app.js' );
|
|
20
20
|
|
|
21
21
|
const rootDir = path.resolve( __dirname, '..' );
|
|
22
|
-
const zoteroDir = process.env.ZOTERO_DIR || path.join( rootDir, 'vendor', 'zotero' );
|
|
23
22
|
const cnTranslatorsDir = process.env.CN_TRANSLATORS_DIR || path.join( rootDir, 'vendor', 'translators_CN' );
|
|
24
23
|
const officialTranslatorsDir = process.env.OFFICIAL_TRANSLATORS_DIR ||
|
|
25
24
|
path.join( rootDir, 'vendor', 'translators-official' );
|
|
26
25
|
const vendoredStylesDir = path.join( rootDir, 'vendor', 'styles' );
|
|
27
26
|
const vendoredOfficialStylesDir = path.join( rootDir, 'vendor', 'styles-official' );
|
|
28
|
-
|
|
27
|
+
|
|
28
|
+
function defaultRuntimeRoot() {
|
|
29
|
+
if ( process.env.CITECLAW_HOME ) {
|
|
30
|
+
return path.resolve( process.env.CITECLAW_HOME );
|
|
31
|
+
}
|
|
32
|
+
if ( process.env.XDG_CACHE_HOME ) {
|
|
33
|
+
return path.join( process.env.XDG_CACHE_HOME, 'citeclaw' );
|
|
34
|
+
}
|
|
35
|
+
if ( process.platform === 'win32' ) {
|
|
36
|
+
const base = process.env.LOCALAPPDATA || process.env.APPDATA || path.join( os.homedir(), 'AppData', 'Local' );
|
|
37
|
+
return path.join( base, 'citeclaw' );
|
|
38
|
+
}
|
|
39
|
+
if ( process.platform === 'darwin' ) {
|
|
40
|
+
return path.join( os.homedir(), 'Library', 'Caches', 'citeclaw' );
|
|
41
|
+
}
|
|
42
|
+
return path.join( os.homedir(), '.cache', 'citeclaw' );
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const localDir = defaultRuntimeRoot();
|
|
46
|
+
const zoteroDir = process.env.ZOTERO_DIR || path.join( localDir, 'runtime', 'zotero' );
|
|
29
47
|
const logDir = path.join( localDir, 'logs' );
|
|
30
48
|
const stateDir = path.join( localDir, 'state' );
|
|
31
49
|
const localTranslatorSourcesDir = path.join( localDir, 'translator-sources' );
|
|
@@ -165,7 +183,7 @@ function usageZotero( subAction = '' ) {
|
|
|
165
183
|
console.error( ' citeclaw zotero login --library-type groups --library-id <group-id> --api-key <key>' );
|
|
166
184
|
console.error( 'notes:' );
|
|
167
185
|
console.error( ' - personal library defaults to library-type users' );
|
|
168
|
-
console.error(
|
|
186
|
+
console.error( ` - credentials are saved to ${ zoteroAuthPath }` );
|
|
169
187
|
console.error( ' - API key can be created at https://www.zotero.org/settings/keys' );
|
|
170
188
|
return;
|
|
171
189
|
}
|
|
@@ -173,7 +191,7 @@ function usageZotero( subAction = '' ) {
|
|
|
173
191
|
console.error( 'usage:' );
|
|
174
192
|
console.error( ' citeclaw zotero logout' );
|
|
175
193
|
console.error( 'notes:' );
|
|
176
|
-
console.error(
|
|
194
|
+
console.error( ` - removes local credentials from ${ zoteroAuthPath }` );
|
|
177
195
|
return;
|
|
178
196
|
}
|
|
179
197
|
if ( action === 'whoami' ) {
|
|
@@ -639,7 +657,7 @@ function bootstrapLocalEnvironment() {
|
|
|
639
657
|
runCommandOrThrow( installer.command, installer.args, rootDir );
|
|
640
658
|
}
|
|
641
659
|
if ( !fileExists( path.join( zoteroDir, 'modules', 'translators' ) ) ) {
|
|
642
|
-
throw new Error(
|
|
660
|
+
throw new Error( `missing zotero translator contents under ${ path.join( zoteroDir, 'modules', 'translators' ) }` );
|
|
643
661
|
}
|
|
644
662
|
if ( !fileExists( path.join( zoteroDir, 'node_modules' ) ) ) {
|
|
645
663
|
runCommandOrThrow( installer.command, installer.args, zoteroDir );
|