@doquflow/cli 1.1.1 → 1.1.2
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.
|
@@ -334,6 +334,8 @@ Record of all wiki operations.
|
|
|
334
334
|
await promises_1.default.writeFile(claudeMdPath, claudeMdContent, "utf8");
|
|
335
335
|
}
|
|
336
336
|
console.log(" ✓ Created CLAUDE.md (Claude Code will read DocuFlow tool instructions automatically)");
|
|
337
|
+
// Register in global project registry so `docuflow ui` always finds this project
|
|
338
|
+
await (0, init_1.registerInGlobalRegistry)(process.cwd());
|
|
337
339
|
console.log("\n✅ Wiki successfully initialized!\n");
|
|
338
340
|
// Print summary and next steps
|
|
339
341
|
console.log("📋 Next Steps:");
|
package/dist/commands/init.js
CHANGED
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.registerInGlobalRegistry = registerInGlobalRegistry;
|
|
6
7
|
exports.buildClaudeMd = buildClaudeMd;
|
|
7
8
|
exports.buildAgentsMd = buildAgentsMd;
|
|
8
9
|
exports.run = run;
|
|
@@ -10,6 +11,29 @@ const node_fs_1 = __importDefault(require("node:fs"));
|
|
|
10
11
|
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
11
12
|
const node_path_1 = __importDefault(require("node:path"));
|
|
12
13
|
const node_os_1 = __importDefault(require("node:os"));
|
|
14
|
+
// ── Global project registry ───────────────────────────────────────────────────
|
|
15
|
+
// ~/.docuflow/projects.json — written by `docuflow init` so the UI can always
|
|
16
|
+
// find all initialized projects regardless of where they live on disk.
|
|
17
|
+
const GLOBAL_REGISTRY = node_path_1.default.join(node_os_1.default.homedir(), ".docuflow", "projects.json");
|
|
18
|
+
async function registerInGlobalRegistry(projectPath) {
|
|
19
|
+
try {
|
|
20
|
+
const dir = node_path_1.default.dirname(GLOBAL_REGISTRY);
|
|
21
|
+
await promises_1.default.mkdir(dir, { recursive: true });
|
|
22
|
+
let registry = { version: 1, projects: [] };
|
|
23
|
+
try {
|
|
24
|
+
const raw = await promises_1.default.readFile(GLOBAL_REGISTRY, "utf8");
|
|
25
|
+
const parsed = JSON.parse(raw);
|
|
26
|
+
if (Array.isArray(parsed.projects))
|
|
27
|
+
registry = parsed;
|
|
28
|
+
}
|
|
29
|
+
catch { /* file doesn't exist yet */ }
|
|
30
|
+
if (!registry.projects.includes(projectPath)) {
|
|
31
|
+
registry.projects.push(projectPath);
|
|
32
|
+
await promises_1.default.writeFile(GLOBAL_REGISTRY, JSON.stringify(registry, null, 2) + "\n", "utf8");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch { /* non-fatal — registry is best-effort */ }
|
|
36
|
+
}
|
|
13
37
|
function getClaudeDesktopConfigPath() {
|
|
14
38
|
const platform = process.platform;
|
|
15
39
|
if (platform === "darwin") {
|
|
@@ -388,6 +412,8 @@ async function run() {
|
|
|
388
412
|
}
|
|
389
413
|
// Install git post-commit hook (auto-sync on every commit)
|
|
390
414
|
await installGitHook(projectDir);
|
|
415
|
+
// Register in global project registry so `docuflow ui` always finds this project
|
|
416
|
+
await registerInGlobalRegistry(projectDir);
|
|
391
417
|
console.log("\u2713 DocuFlow initialised successfully.");
|
|
392
418
|
console.log("");
|
|
393
419
|
console.log("\ud83d\udcc1 Structure created:");
|
package/dist/commands/ui.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.run = run;
|
|
18
18
|
const node_child_process_1 = require("node:child_process");
|
|
19
19
|
const node_path_1 = __importDefault(require("node:path"));
|
|
20
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
20
21
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
21
22
|
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
22
23
|
const express_1 = __importDefault(require("express"));
|
|
@@ -187,24 +188,43 @@ async function run(opts = {}) {
|
|
|
187
188
|
app.get('/api/ping', (_req, res) => { res.json({ ok: true }); });
|
|
188
189
|
app.get('/api/projects', async (req, res) => {
|
|
189
190
|
try {
|
|
190
|
-
|
|
191
|
-
const scanRoots = [
|
|
192
|
-
home,
|
|
193
|
-
node_path_1.default.join(home, 'code'), node_path_1.default.join(home, 'dev'),
|
|
194
|
-
node_path_1.default.join(home, 'projects'), node_path_1.default.join(home, 'work'),
|
|
195
|
-
node_path_1.default.join(home, 'src'), node_path_1.default.join(home, 'Desktop'),
|
|
196
|
-
];
|
|
191
|
+
// ── Path-scoped query: only search within the provided path ──────────
|
|
197
192
|
if (typeof req.query.path === 'string') {
|
|
198
193
|
const qp = req.query.path;
|
|
194
|
+
// Direct match: the path itself is a docuflow project
|
|
199
195
|
if (node_fs_1.default.existsSync(node_path_1.default.join(qp, '.docuflow'))) {
|
|
200
196
|
return res.json([await getProjectStats(qp, lintWikiTool)]);
|
|
201
197
|
}
|
|
202
|
-
|
|
198
|
+
// Nested: scan one level inside the provided path
|
|
199
|
+
const nested = await findDocuflowProjects(qp);
|
|
200
|
+
if (nested.length === 0)
|
|
201
|
+
return res.json([]); // not found — no fallback to global scan
|
|
202
|
+
const nestedProjects = await Promise.all(nested.map(p => getProjectStats(p, lintWikiTool)));
|
|
203
|
+
return res.json(nestedProjects.sort((a, b) => a.name.localeCompare(b.name)));
|
|
203
204
|
}
|
|
205
|
+
// ── Full auto-discovery across common dev directories ─────────────────
|
|
206
|
+
const home = process.env.HOME ?? process.env.USERPROFILE ?? node_os_1.default.homedir();
|
|
207
|
+
const scanRoots = [
|
|
208
|
+
home,
|
|
209
|
+
node_path_1.default.join(home, 'code'), node_path_1.default.join(home, 'dev'),
|
|
210
|
+
node_path_1.default.join(home, 'projects'), node_path_1.default.join(home, 'work'),
|
|
211
|
+
node_path_1.default.join(home, 'src'), node_path_1.default.join(home, 'Desktop'),
|
|
212
|
+
];
|
|
204
213
|
const allPaths = new Set();
|
|
205
214
|
for (const root of scanRoots) {
|
|
206
215
|
(await findDocuflowProjects(root)).forEach(p => allPaths.add(p));
|
|
207
216
|
}
|
|
217
|
+
// Also include projects registered via `docuflow init` global registry
|
|
218
|
+
try {
|
|
219
|
+
const registryPath = node_path_1.default.join(node_os_1.default.homedir(), '.docuflow', 'projects.json');
|
|
220
|
+
const raw = await promises_1.default.readFile(registryPath, 'utf8');
|
|
221
|
+
const registry = JSON.parse(raw);
|
|
222
|
+
(registry.projects ?? []).forEach(p => {
|
|
223
|
+
if (node_fs_1.default.existsSync(node_path_1.default.join(p, '.docuflow')))
|
|
224
|
+
allPaths.add(p);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
catch { /* registry doesn't exist yet — skip */ }
|
|
208
228
|
const projects = await Promise.all([...allPaths].map(p => getProjectStats(p, lintWikiTool)));
|
|
209
229
|
return res.json(projects.sort((a, b) => a.name.localeCompare(b.name)));
|
|
210
230
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doquflow/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "CLI for setting up Docuflow in your project",
|
|
5
5
|
"author": "Docuflow <hello@doquflows.dev>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"build": "tsc && node -e \"const fs=require('fs'),p=require('path'),src=p.join(process.cwd(),'../ui/dist'),dst=p.join(process.cwd(),'ui-dist');if(!fs.existsSync(src)){console.log('Warning: packages/ui/dist not found — run npm run build:ui first');process.exit(0)}fs.mkdirSync(dst,{recursive:true});fs.cpSync(src,dst,{recursive:true,force:true});console.log(' ✓ ui-dist synced from packages/ui/dist ('+(fs.readdirSync(dst).length)+' files at root)')\""
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@doquflow/server": "1.1.
|
|
34
|
+
"@doquflow/server": "1.1.2",
|
|
35
35
|
"cors": "^2.8.5",
|
|
36
36
|
"express": "^4.19.2"
|
|
37
37
|
},
|