aigc-paper 1.0.0
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 +18 -0
- package/index.js +59 -0
- package/package.json +16 -0
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# aigc-paper CLI
|
|
2
|
+
|
|
3
|
+
Install the [aigc skill](https://github.com/SAKURAfan1023/aigc-skill) for Claude Code.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install
|
|
9
|
+
npx aigc-paper install
|
|
10
|
+
|
|
11
|
+
# Uninstall
|
|
12
|
+
npx aigc-paper uninstall
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
- Node.js >= 14
|
|
18
|
+
- Claude Code
|
package/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const https = require('https');
|
|
6
|
+
const os = require('os');
|
|
7
|
+
|
|
8
|
+
const SKILL_URL = 'https://raw.githubusercontent.com/SAKURAfan1023/aigc-skill/main/.claude/skills/aigc/SKILL.md';
|
|
9
|
+
const SKILL_DIR = path.join(os.homedir(), '.claude', 'skills', 'aigc');
|
|
10
|
+
const SKILL_FILE = path.join(SKILL_DIR, 'SKILL.md');
|
|
11
|
+
|
|
12
|
+
const command = process.argv[2];
|
|
13
|
+
|
|
14
|
+
function download(url, dest, cb) {
|
|
15
|
+
const file = fs.createWriteStream(dest);
|
|
16
|
+
https.get(url, (res) => {
|
|
17
|
+
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
18
|
+
file.close();
|
|
19
|
+
download(res.headers.location, dest, cb);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (res.statusCode !== 200) {
|
|
23
|
+
file.close();
|
|
24
|
+
fs.unlinkSync(dest);
|
|
25
|
+
cb(new Error(`Download failed: HTTP ${res.statusCode}`));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
res.pipe(file);
|
|
29
|
+
file.on('finish', () => file.close(cb));
|
|
30
|
+
}).on('error', (err) => {
|
|
31
|
+
fs.unlinkSync(dest);
|
|
32
|
+
cb(err);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (command === 'install') {
|
|
37
|
+
console.log('Installing aigc skill...');
|
|
38
|
+
fs.mkdirSync(SKILL_DIR, { recursive: true });
|
|
39
|
+
download(SKILL_URL, SKILL_FILE, (err) => {
|
|
40
|
+
if (err) {
|
|
41
|
+
console.error('Installation failed:', err.message);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
console.log(`✓ aigc skill installed to ${SKILL_FILE}`);
|
|
45
|
+
console.log(' Restart Claude Code to activate.');
|
|
46
|
+
});
|
|
47
|
+
} else if (command === 'uninstall') {
|
|
48
|
+
if (fs.existsSync(SKILL_FILE)) {
|
|
49
|
+
fs.rmSync(SKILL_DIR, { recursive: true, force: true });
|
|
50
|
+
console.log('✓ aigc skill uninstalled.');
|
|
51
|
+
} else {
|
|
52
|
+
console.log('aigc skill is not installed, nothing to do.');
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
console.log('Usage:');
|
|
56
|
+
console.log(' aigc-paper install Install the aigc skill');
|
|
57
|
+
console.log(' aigc-paper uninstall Remove the aigc skill');
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "aigc-paper",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI installer for aigc skill - 学术写作与 AIGC 降重",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"aigc-paper": "index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"index.js"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=14"
|
|
15
|
+
}
|
|
16
|
+
}
|