magicmd 0.1.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 +35 -0
- package/bin/magicmd.js +27 -0
- package/package.json +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# MagicMD npm Wrapper
|
|
2
|
+
|
|
3
|
+
This package is a thin npm wrapper for the Python MagicMD CLI.
|
|
4
|
+
|
|
5
|
+
It does not reimplement article parsing in JavaScript. It forwards commands to the PyPI package with:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uvx --from magicmd magicmd
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
- Node.js 18+
|
|
14
|
+
- `uv` available on `PATH`
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
After the npm package is published:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g magicmd
|
|
22
|
+
magicmd --version
|
|
23
|
+
magicmd batch urls.txt -o output/
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Until then, install MagicMD directly from PyPI:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
uv tool install magicmd
|
|
30
|
+
magicmd doctor
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Why This Wrapper Exists
|
|
34
|
+
|
|
35
|
+
MagicMD's core implementation lives in Python so that the CLI, PyPI package, and Agent Skill use the same parsing and conversion code. The npm package is only an installation convenience for users who expect a global `magicmd` command from npm.
|
package/bin/magicmd.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require("node:child_process");
|
|
4
|
+
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
const command = process.platform === "win32" ? "uvx.cmd" : "uvx";
|
|
7
|
+
// Equivalent command: uvx --from magicmd magicmd ...
|
|
8
|
+
const result = spawnSync(command, ["--from", "magicmd", "magicmd", ...args], {
|
|
9
|
+
stdio: "inherit",
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
if (result.error) {
|
|
13
|
+
if (result.error.code === "ENOENT") {
|
|
14
|
+
console.error(
|
|
15
|
+
"MagicMD npm wrapper requires uv. Install it from https://docs.astral.sh/uv/getting-started/installation/ or use: pipx install magicmd"
|
|
16
|
+
);
|
|
17
|
+
process.exit(127);
|
|
18
|
+
}
|
|
19
|
+
console.error(result.error.message);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (result.signal) {
|
|
24
|
+
process.kill(process.pid, result.signal);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
process.exit(result.status ?? 1);
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "magicmd",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "npm wrapper for the MagicMD article-to-Markdown CLI.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"private": false,
|
|
7
|
+
"bin": {
|
|
8
|
+
"magicmd": "bin/magicmd.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=18"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"markdown",
|
|
19
|
+
"article",
|
|
20
|
+
"wechat",
|
|
21
|
+
"juejin",
|
|
22
|
+
"crawler"
|
|
23
|
+
],
|
|
24
|
+
"homepage": "https://github.com/didilili/MagicMD#readme",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/didilili/MagicMD.git",
|
|
28
|
+
"directory": "npm/magicmd"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/didilili/MagicMD/issues"
|
|
32
|
+
}
|
|
33
|
+
}
|