frontmatter-matters 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/bin/fmm +16 -0
- package/package.json +30 -0
- package/scripts/install.js +73 -0
package/bin/fmm
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync } = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
|
|
7
|
+
const localBin = path.join(__dirname, "..", "scripts", "fmm");
|
|
8
|
+
const binary = fs.existsSync(localBin) ? localBin : "fmm";
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
execFileSync(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
12
|
+
} catch (e) {
|
|
13
|
+
if (e.status !== null) process.exit(e.status);
|
|
14
|
+
console.error("fmm not found. Run: npm rebuild fmm");
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "frontmatter-matters",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Auto-generate code metadata sidecars for LLM-optimized navigation. No AST dumps, no embeddings — just structured YAML.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/srobinson/fmm"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://mdcontext.github.io/fmm/",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"llm",
|
|
13
|
+
"code-analysis",
|
|
14
|
+
"ast",
|
|
15
|
+
"mcp",
|
|
16
|
+
"sidecar",
|
|
17
|
+
"frontmatter",
|
|
18
|
+
"tree-sitter"
|
|
19
|
+
],
|
|
20
|
+
"bin": {
|
|
21
|
+
"fmm": "bin/fmm"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"postinstall": "node scripts/install.js"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"bin/fmm",
|
|
28
|
+
"scripts/install.js"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const https = require("https");
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const { execSync } = require("child_process");
|
|
5
|
+
|
|
6
|
+
const REPO = "srobinson/fmm";
|
|
7
|
+
const VERSION = require("../package.json").version;
|
|
8
|
+
const TAG = `v${VERSION}`;
|
|
9
|
+
|
|
10
|
+
const TARGETS = {
|
|
11
|
+
"darwin-arm64": "aarch64-apple-darwin",
|
|
12
|
+
"darwin-x64": "x86_64-apple-darwin",
|
|
13
|
+
"linux-arm64": "aarch64-unknown-linux-gnu",
|
|
14
|
+
"linux-x64": "x86_64-unknown-linux-gnu",
|
|
15
|
+
"win32-x64": "x86_64-pc-windows-msvc",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const key = `${process.platform}-${process.arch}`;
|
|
19
|
+
const target = TARGETS[key];
|
|
20
|
+
|
|
21
|
+
if (!target) {
|
|
22
|
+
console.warn(`fmm: unsupported platform ${key}, skipping binary download`);
|
|
23
|
+
process.exit(0);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const isWindows = process.platform === "win32";
|
|
27
|
+
const ext = isWindows ? ".zip" : ".tar.gz";
|
|
28
|
+
const url = `https://github.com/${REPO}/releases/download/${TAG}/fmm-${target}${ext}`;
|
|
29
|
+
const dest = path.join(__dirname, isWindows ? "fmm.exe" : "fmm");
|
|
30
|
+
|
|
31
|
+
function download(url, cb) {
|
|
32
|
+
https.get(url, (res) => {
|
|
33
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
34
|
+
return download(res.headers.location, cb);
|
|
35
|
+
}
|
|
36
|
+
if (res.statusCode !== 200) {
|
|
37
|
+
console.warn(`fmm: download failed (${res.statusCode}) from ${url}`);
|
|
38
|
+
console.warn(`fmm: install manually from https://github.com/${REPO}/releases`);
|
|
39
|
+
return process.exit(0);
|
|
40
|
+
}
|
|
41
|
+
cb(res);
|
|
42
|
+
}).on("error", (e) => {
|
|
43
|
+
console.warn(`fmm: download error: ${e.message}`);
|
|
44
|
+
process.exit(0);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
download(url, (stream) => {
|
|
49
|
+
if (isWindows) {
|
|
50
|
+
const tmp = path.join(__dirname, `fmm-${target}.zip`);
|
|
51
|
+
const out = fs.createWriteStream(tmp);
|
|
52
|
+
stream.pipe(out);
|
|
53
|
+
out.on("finish", () => {
|
|
54
|
+
try {
|
|
55
|
+
execSync(`powershell -Command "Expand-Archive -Path '${tmp}' -DestinationPath '${__dirname}' -Force"`, { stdio: "ignore" });
|
|
56
|
+
fs.unlinkSync(tmp);
|
|
57
|
+
} catch (e) {
|
|
58
|
+
console.warn("fmm: failed to extract windows archive");
|
|
59
|
+
process.exit(0);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
} else {
|
|
63
|
+
const tar = require("child_process").spawn("tar", ["xzf", "-", "-C", __dirname]);
|
|
64
|
+
stream.pipe(tar.stdin);
|
|
65
|
+
tar.on("close", (code) => {
|
|
66
|
+
if (code !== 0) {
|
|
67
|
+
console.warn("fmm: tar extraction failed");
|
|
68
|
+
process.exit(0);
|
|
69
|
+
}
|
|
70
|
+
fs.chmodSync(dest, 0o755);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|