@reporails/cli 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 +56 -0
- package/bin/reporails.mjs +167 -0
- package/package.json +30 -0
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @reporails/cli
|
|
2
|
+
|
|
3
|
+
Score your CLAUDE.md files. See what's missing. Improve your AI coding setup.
|
|
4
|
+
|
|
5
|
+
## Install MCP Server (Claude Code)
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @reporails/cli install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This registers the reporails MCP server with Claude Code. Then ask Claude:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
> What ails claude?
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## CLI Usage
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Score your setup
|
|
21
|
+
npx @reporails/cli check .
|
|
22
|
+
|
|
23
|
+
# JSON output (for CI)
|
|
24
|
+
npx @reporails/cli check . -f json
|
|
25
|
+
|
|
26
|
+
# Explain a rule
|
|
27
|
+
npx @reporails/cli explain S1
|
|
28
|
+
|
|
29
|
+
# Show project structure
|
|
30
|
+
npx @reporails/cli map .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Commands
|
|
34
|
+
|
|
35
|
+
| Command | Description |
|
|
36
|
+
|---------|-------------|
|
|
37
|
+
| `install [--scope user\|project]` | Register MCP server with Claude Code |
|
|
38
|
+
| `uninstall [--scope user\|project]` | Remove MCP server from Claude Code |
|
|
39
|
+
| `check [PATH]` | Validate instruction files |
|
|
40
|
+
| `map [PATH]` | Discover project structure |
|
|
41
|
+
| `explain RULE_ID` | Show rule details |
|
|
42
|
+
| `version` | Show version info |
|
|
43
|
+
|
|
44
|
+
## Prerequisites
|
|
45
|
+
|
|
46
|
+
- **Node.js >= 18**
|
|
47
|
+
- **uv** — auto-installed if missing ([manual install](https://docs.astral.sh/uv/))
|
|
48
|
+
- **Claude Code** — required for `install`/`uninstall` commands ([install](https://docs.anthropic.com/en/docs/claude-code))
|
|
49
|
+
|
|
50
|
+
## How It Works
|
|
51
|
+
|
|
52
|
+
This is a thin Node.js wrapper around the [reporails-cli](https://pypi.org/project/reporails-cli/) Python package. Commands are proxied via `uvx` — no Python installation required.
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
Apache-2.0
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { execSync, spawn } from "node:child_process";
|
|
4
|
+
import { platform } from "node:os";
|
|
5
|
+
import { argv, exit } from "node:process";
|
|
6
|
+
|
|
7
|
+
const PYPI_PACKAGE = "reporails-cli";
|
|
8
|
+
const MCP_COMMAND = "ails-mcp";
|
|
9
|
+
const CLI_COMMAND = "ails";
|
|
10
|
+
|
|
11
|
+
const HELP = `
|
|
12
|
+
reporails — Score your CLAUDE.md files
|
|
13
|
+
|
|
14
|
+
Usage:
|
|
15
|
+
reporails install [--scope user|project] Register MCP server with Claude Code
|
|
16
|
+
reporails uninstall [--scope user|project] Remove MCP server from Claude Code
|
|
17
|
+
reporails check [PATH] [OPTIONS] Validate instruction files
|
|
18
|
+
reporails <command> [args...] Proxy any command to ails CLI
|
|
19
|
+
|
|
20
|
+
Examples:
|
|
21
|
+
npx @reporails/cli install # Add MCP server (user scope)
|
|
22
|
+
npx @reporails/cli check . # Score your setup
|
|
23
|
+
npx @reporails/cli explain S1 # Explain a rule
|
|
24
|
+
|
|
25
|
+
Prerequisites:
|
|
26
|
+
Node.js >= 18 (uv is auto-installed if missing)
|
|
27
|
+
`.trim();
|
|
28
|
+
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
// Helpers
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
|
|
33
|
+
function commandExists(cmd) {
|
|
34
|
+
try {
|
|
35
|
+
execSync(`${platform() === "win32" ? "where" : "which"} ${cmd}`, {
|
|
36
|
+
stdio: "ignore",
|
|
37
|
+
});
|
|
38
|
+
return true;
|
|
39
|
+
} catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function ensureUv() {
|
|
45
|
+
if (commandExists("uv")) return;
|
|
46
|
+
|
|
47
|
+
console.log("uv not found — installing...");
|
|
48
|
+
try {
|
|
49
|
+
if (platform() === "win32") {
|
|
50
|
+
execSync(
|
|
51
|
+
'powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"',
|
|
52
|
+
{ stdio: "inherit" },
|
|
53
|
+
);
|
|
54
|
+
} else {
|
|
55
|
+
execSync("curl -LsSf https://astral.sh/uv/install.sh | sh", {
|
|
56
|
+
stdio: "inherit",
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
} catch {
|
|
60
|
+
console.error("Failed to install uv. Install manually: https://docs.astral.sh/uv/");
|
|
61
|
+
exit(1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!commandExists("uv")) {
|
|
65
|
+
console.error(
|
|
66
|
+
"uv was installed but is not on PATH. Restart your shell or add it to PATH, then retry.",
|
|
67
|
+
);
|
|
68
|
+
exit(1);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function parseScope(args) {
|
|
73
|
+
const idx = args.indexOf("--scope");
|
|
74
|
+
if (idx !== -1 && idx + 1 < args.length) {
|
|
75
|
+
return args[idx + 1];
|
|
76
|
+
}
|
|
77
|
+
return "user";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
// Subcommands
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
|
|
84
|
+
function install(args) {
|
|
85
|
+
if (!commandExists("claude")) {
|
|
86
|
+
console.error(
|
|
87
|
+
"Claude Code CLI not found.\nInstall it from: https://docs.anthropic.com/en/docs/claude-code",
|
|
88
|
+
);
|
|
89
|
+
exit(1);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
ensureUv();
|
|
93
|
+
|
|
94
|
+
const scope = parseScope(args);
|
|
95
|
+
const cmd = `claude mcp add --scope ${scope} reporails -- uvx --from ${PYPI_PACKAGE} ${MCP_COMMAND}`;
|
|
96
|
+
console.log(`Registering MCP server (scope: ${scope})...`);
|
|
97
|
+
|
|
98
|
+
try {
|
|
99
|
+
execSync(cmd, { stdio: "inherit" });
|
|
100
|
+
console.log("\nDone. Restart Claude Code to activate the MCP server.");
|
|
101
|
+
} catch {
|
|
102
|
+
console.error("Failed to register MCP server.");
|
|
103
|
+
exit(1);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function uninstall(args) {
|
|
108
|
+
if (!commandExists("claude")) {
|
|
109
|
+
console.error(
|
|
110
|
+
"Claude Code CLI not found.\nInstall it from: https://docs.anthropic.com/en/docs/claude-code",
|
|
111
|
+
);
|
|
112
|
+
exit(1);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const scope = parseScope(args);
|
|
116
|
+
const cmd = `claude mcp remove --scope ${scope} reporails`;
|
|
117
|
+
console.log(`Removing MCP server (scope: ${scope})...`);
|
|
118
|
+
|
|
119
|
+
try {
|
|
120
|
+
execSync(cmd, { stdio: "inherit" });
|
|
121
|
+
console.log("\nDone. MCP server removed.");
|
|
122
|
+
} catch {
|
|
123
|
+
console.error("Failed to remove MCP server.");
|
|
124
|
+
exit(1);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function proxy(args) {
|
|
129
|
+
ensureUv();
|
|
130
|
+
|
|
131
|
+
const child = spawn("uvx", ["--from", PYPI_PACKAGE, CLI_COMMAND, ...args], {
|
|
132
|
+
stdio: "inherit",
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
child.on("error", (err) => {
|
|
136
|
+
console.error(`Failed to run ails: ${err.message}`);
|
|
137
|
+
exit(1);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
child.on("close", (code) => {
|
|
141
|
+
exit(code ?? 0);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ---------------------------------------------------------------------------
|
|
146
|
+
// Main
|
|
147
|
+
// ---------------------------------------------------------------------------
|
|
148
|
+
|
|
149
|
+
const args = argv.slice(2);
|
|
150
|
+
const subcommand = args[0];
|
|
151
|
+
|
|
152
|
+
if (!subcommand || subcommand === "--help" || subcommand === "-h") {
|
|
153
|
+
console.log(HELP);
|
|
154
|
+
exit(0);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
switch (subcommand) {
|
|
158
|
+
case "install":
|
|
159
|
+
install(args.slice(1));
|
|
160
|
+
break;
|
|
161
|
+
case "uninstall":
|
|
162
|
+
uninstall(args.slice(1));
|
|
163
|
+
break;
|
|
164
|
+
default:
|
|
165
|
+
proxy(args);
|
|
166
|
+
break;
|
|
167
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@reporails/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Score your CLAUDE.md files. See what's missing. Improve your AI coding setup.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"reporails": "bin/reporails.mjs"
|
|
8
|
+
},
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=18"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"bin/",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"keywords": [
|
|
17
|
+
"claude",
|
|
18
|
+
"claude-code",
|
|
19
|
+
"mcp",
|
|
20
|
+
"linter",
|
|
21
|
+
"ai-instructions",
|
|
22
|
+
"claude-md"
|
|
23
|
+
],
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/reporails/cli"
|
|
27
|
+
},
|
|
28
|
+
"license": "Apache-2.0",
|
|
29
|
+
"author": "Reporails"
|
|
30
|
+
}
|