@doquflow/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/dist/commands/init.js +67 -0
- package/dist/commands/status.js +51 -0
- package/dist/index.js +48 -0
- package/package.json +16 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.run = run;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
11
|
+
function getClaudeDesktopConfigPath() {
|
|
12
|
+
const platform = process.platform;
|
|
13
|
+
if (platform === "darwin") {
|
|
14
|
+
return node_path_1.default.join(node_os_1.default.homedir(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
15
|
+
}
|
|
16
|
+
else if (platform === "win32") {
|
|
17
|
+
return node_path_1.default.join(node_os_1.default.homedir(), "AppData", "Roaming", "Claude", "claude_desktop_config.json");
|
|
18
|
+
}
|
|
19
|
+
return node_path_1.default.join(node_os_1.default.homedir(), ".config", "Claude", "claude_desktop_config.json");
|
|
20
|
+
}
|
|
21
|
+
function resolveServerBin() {
|
|
22
|
+
// Try npm-installed package first
|
|
23
|
+
try {
|
|
24
|
+
return require.resolve("@doquflow/server/dist/index.js");
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
// Fallback: monorepo sibling path (dev environment)
|
|
28
|
+
return node_path_1.default.resolve(__dirname, "..", "..", "server", "dist", "index.js");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async function run() {
|
|
32
|
+
const configPath = getClaudeDesktopConfigPath();
|
|
33
|
+
const serverBin = resolveServerBin();
|
|
34
|
+
const nodeBin = process.execPath;
|
|
35
|
+
// Read or initialise Claude Desktop config
|
|
36
|
+
let config = {};
|
|
37
|
+
try {
|
|
38
|
+
const raw = await promises_1.default.readFile(configPath, "utf8");
|
|
39
|
+
config = JSON.parse(raw);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
// File doesn't exist yet — that's fine, we'll create it
|
|
43
|
+
}
|
|
44
|
+
if (!config.mcpServers)
|
|
45
|
+
config.mcpServers = {};
|
|
46
|
+
config.mcpServers.docuflow = { command: nodeBin, args: [serverBin] };
|
|
47
|
+
await promises_1.default.mkdir(node_path_1.default.dirname(configPath), { recursive: true });
|
|
48
|
+
await promises_1.default.writeFile(configPath, JSON.stringify(config, null, 2) + "\n", "utf8");
|
|
49
|
+
// Create .docuflow/specs/ in cwd
|
|
50
|
+
const specsDir = node_path_1.default.join(process.cwd(), ".docuflow", "specs");
|
|
51
|
+
await promises_1.default.mkdir(specsDir, { recursive: true });
|
|
52
|
+
// Add .docuflow/ to .gitignore if present and not already listed
|
|
53
|
+
const gitignorePath = node_path_1.default.join(process.cwd(), ".gitignore");
|
|
54
|
+
if (node_fs_1.default.existsSync(gitignorePath)) {
|
|
55
|
+
const gitignore = await promises_1.default.readFile(gitignorePath, "utf8");
|
|
56
|
+
if (!gitignore.includes(".docuflow/") && !gitignore.includes(".docuflow")) {
|
|
57
|
+
await promises_1.default.appendFile(gitignorePath, "\n# Docuflow\n.docuflow/\n");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
console.log("Docuflow initialised successfully.");
|
|
61
|
+
console.log("");
|
|
62
|
+
console.log(` MCP key: mcpServers.docuflow`);
|
|
63
|
+
console.log(` Config file: ${configPath}`);
|
|
64
|
+
console.log(` Specs dir: ${specsDir}`);
|
|
65
|
+
console.log("");
|
|
66
|
+
console.log("Restart Claude Desktop to activate.");
|
|
67
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.run = run;
|
|
7
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
10
|
+
function getClaudeDesktopConfigPath() {
|
|
11
|
+
const platform = process.platform;
|
|
12
|
+
if (platform === "darwin") {
|
|
13
|
+
return node_path_1.default.join(node_os_1.default.homedir(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
14
|
+
}
|
|
15
|
+
else if (platform === "win32") {
|
|
16
|
+
return node_path_1.default.join(node_os_1.default.homedir(), "AppData", "Roaming", "Claude", "claude_desktop_config.json");
|
|
17
|
+
}
|
|
18
|
+
return node_path_1.default.join(node_os_1.default.homedir(), ".config", "Claude", "claude_desktop_config.json");
|
|
19
|
+
}
|
|
20
|
+
async function run() {
|
|
21
|
+
const configPath = getClaudeDesktopConfigPath();
|
|
22
|
+
// Check MCP registration
|
|
23
|
+
let registered = false;
|
|
24
|
+
try {
|
|
25
|
+
const raw = await promises_1.default.readFile(configPath, "utf8");
|
|
26
|
+
const config = JSON.parse(raw);
|
|
27
|
+
registered = Boolean(config?.mcpServers?.docuflow);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// Config doesn't exist
|
|
31
|
+
}
|
|
32
|
+
// Count spec files
|
|
33
|
+
let specCount = 0;
|
|
34
|
+
const specsDir = node_path_1.default.join(process.cwd(), ".docuflow", "specs");
|
|
35
|
+
try {
|
|
36
|
+
const entries = await promises_1.default.readdir(specsDir);
|
|
37
|
+
specCount = entries.filter(e => e.endsWith(".md")).length;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
// .docuflow/specs doesn't exist
|
|
41
|
+
}
|
|
42
|
+
console.log("Docuflow status");
|
|
43
|
+
console.log("───────────────────────────────");
|
|
44
|
+
console.log(` MCP registered: ${registered ? "yes" : "no"}`);
|
|
45
|
+
console.log(` Specs written: ${specCount}`);
|
|
46
|
+
console.log(` Config file: ${configPath}`);
|
|
47
|
+
if (!registered) {
|
|
48
|
+
console.log("");
|
|
49
|
+
console.log(' Run "docuflow init" to register.');
|
|
50
|
+
}
|
|
51
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
const [, , cmd] = process.argv;
|
|
37
|
+
if (cmd === 'init') {
|
|
38
|
+
Promise.resolve().then(() => __importStar(require('./commands/init'))).then(m => m.run());
|
|
39
|
+
}
|
|
40
|
+
else if (cmd === 'status') {
|
|
41
|
+
Promise.resolve().then(() => __importStar(require('./commands/status'))).then(m => m.run());
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
console.log('Usage: npx @doquflow/cli <init|status>');
|
|
45
|
+
console.log('');
|
|
46
|
+
console.log(' init Register Docuflow MCP server in Claude Desktop config');
|
|
47
|
+
console.log(' status Show spec count and MCP registration status');
|
|
48
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@doquflow/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CLI for setting up Docuflow in your project",
|
|
5
|
+
"author": "Docuflow <hello@doquflows.dev>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/doquflows/docuflow",
|
|
8
|
+
"repository": { "type": "git", "url": "https://github.com/doquflows/docuflow.git" },
|
|
9
|
+
"bugs": { "url": "https://github.com/doquflows/docuflow/issues" },
|
|
10
|
+
"keywords": ["mcp", "ai-agents", "claude-code", "documentation", "developer-tools"],
|
|
11
|
+
"bin": { "docuflow": "./dist/index.js" },
|
|
12
|
+
"files": ["dist/**"],
|
|
13
|
+
"scripts": { "build": "tsc" },
|
|
14
|
+
"dependencies": { "@doquflow/server": "0.1.0" },
|
|
15
|
+
"devDependencies": { "@types/node": "^22.0.0", "typescript": "^5.6.0" }
|
|
16
|
+
}
|