@donkeylabs/cli 2.0.18 → 2.0.19
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/package.json +1 -1
- package/src/commands/docs.ts +35 -15
- package/src/commands/init-enhanced.ts +2 -0
- package/src/commands/init.ts +10 -10
package/package.json
CHANGED
package/src/commands/docs.ts
CHANGED
|
@@ -23,35 +23,30 @@ interface DocsCommandOptions {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Find the
|
|
26
|
+
* Find the server package directory from installed @donkeylabs/server
|
|
27
27
|
*/
|
|
28
|
-
function
|
|
29
|
-
// Try common locations
|
|
28
|
+
function findServerPkgDir(): string | null {
|
|
30
29
|
const possiblePaths = [
|
|
31
|
-
|
|
32
|
-
join(process.cwd(), "node_modules", "
|
|
33
|
-
|
|
34
|
-
join(process.cwd(), "
|
|
35
|
-
// Workspace/monorepo
|
|
36
|
-
join(process.cwd(), "..", "server", "docs"),
|
|
37
|
-
join(process.cwd(), "..", "..", "packages", "server", "docs"),
|
|
30
|
+
join(process.cwd(), "node_modules", "@donkeylabs", "server"),
|
|
31
|
+
join(process.cwd(), "node_modules", ".bun", "@donkeylabs", "server"),
|
|
32
|
+
join(process.cwd(), "..", "server"),
|
|
33
|
+
join(process.cwd(), "..", "..", "packages", "server"),
|
|
38
34
|
];
|
|
39
35
|
|
|
40
36
|
for (const path of possiblePaths) {
|
|
41
|
-
|
|
37
|
+
const docsDir = join(path, "docs");
|
|
38
|
+
if (existsSync(docsDir) && statSync(docsDir).isDirectory()) {
|
|
42
39
|
return path;
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
42
|
|
|
46
|
-
// Try to resolve from require
|
|
47
43
|
try {
|
|
48
44
|
const serverPkgPath = require.resolve("@donkeylabs/server/package.json", {
|
|
49
45
|
paths: [process.cwd()],
|
|
50
46
|
});
|
|
51
47
|
const serverDir = dirname(serverPkgPath);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return docsPath;
|
|
48
|
+
if (existsSync(join(serverDir, "docs"))) {
|
|
49
|
+
return serverDir;
|
|
55
50
|
}
|
|
56
51
|
} catch {
|
|
57
52
|
// Package not found
|
|
@@ -60,6 +55,30 @@ function findDocsPath(): string | null {
|
|
|
60
55
|
return null;
|
|
61
56
|
}
|
|
62
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Find the docs directory from installed @donkeylabs/server
|
|
60
|
+
*/
|
|
61
|
+
function findDocsPath(): string | null {
|
|
62
|
+
const serverDir = findServerPkgDir();
|
|
63
|
+
if (!serverDir) return null;
|
|
64
|
+
return join(serverDir, "docs");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Sync agents.md from the server package root to the project root
|
|
69
|
+
*/
|
|
70
|
+
function syncAgentsMd(): void {
|
|
71
|
+
const serverDir = findServerPkgDir();
|
|
72
|
+
if (!serverDir) return;
|
|
73
|
+
|
|
74
|
+
const agentsMdSrc = join(serverDir, "agents.md");
|
|
75
|
+
if (!existsSync(agentsMdSrc)) return;
|
|
76
|
+
|
|
77
|
+
const content = readFileSync(agentsMdSrc, "utf-8");
|
|
78
|
+
writeFileSync(join(process.cwd(), "agents.md"), content);
|
|
79
|
+
console.log(pc.green("✓ Synced agents.md"));
|
|
80
|
+
}
|
|
81
|
+
|
|
63
82
|
/**
|
|
64
83
|
* Get list of available doc files
|
|
65
84
|
*/
|
|
@@ -201,6 +220,7 @@ export async function docsCommand(args: string[], options: DocsCommandOptions =
|
|
|
201
220
|
console.log(pc.dim(`Target: ${outputDir}/\n`));
|
|
202
221
|
|
|
203
222
|
const synced = syncAllDocs(docsPath, outputDir);
|
|
223
|
+
syncAgentsMd();
|
|
204
224
|
|
|
205
225
|
console.log(pc.green(`\n✓ Synced ${synced} documentation files to ${outputDir}/`));
|
|
206
226
|
console.log(pc.dim(`\nTip: Add ${outputDir}/ to your .gitignore if you don't want to commit docs.`));
|
|
@@ -374,6 +374,7 @@ function createPackageJson(projectDir: string, options: InitOptions) {
|
|
|
374
374
|
"prepare": "bun --bun svelte-kit sync && bun run gen:types || echo ''",
|
|
375
375
|
"check": "bun --bun svelte-kit sync && bun --bun svelte-check --tsconfig ./tsconfig.json",
|
|
376
376
|
"gen:types": "donkeylabs generate",
|
|
377
|
+
"update": "donkeylabs update",
|
|
377
378
|
"cli": "donkeylabs",
|
|
378
379
|
"test": "bun test",
|
|
379
380
|
...(options.deployment === "docker" && {
|
|
@@ -386,6 +387,7 @@ function createPackageJson(projectDir: string, options: InitOptions) {
|
|
|
386
387
|
"build": "bun build src/server/index.ts --outdir=dist",
|
|
387
388
|
"start": "bun run dist/index.js",
|
|
388
389
|
"gen:types": "bunx donkeylabs generate",
|
|
390
|
+
"update": "bunx donkeylabs update",
|
|
389
391
|
"test": "bun test",
|
|
390
392
|
"lint": "bun --bun tsc --noEmit",
|
|
391
393
|
...(options.deployment === "docker" && {
|
package/src/commands/init.ts
CHANGED
|
@@ -167,7 +167,7 @@ export async function initCommand(args: string[]) {
|
|
|
167
167
|
} else {
|
|
168
168
|
console.log(pc.green("\n✓ Dependencies installed\n"));
|
|
169
169
|
|
|
170
|
-
// Copy
|
|
170
|
+
// Copy agents.md and docs/ from @donkeylabs/server to project root
|
|
171
171
|
await copyDocsFromServer(targetDir);
|
|
172
172
|
}
|
|
173
173
|
|
|
@@ -324,7 +324,7 @@ async function copyDirectory(src: string, dest: string): Promise<void> {
|
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
/**
|
|
327
|
-
* Copy
|
|
327
|
+
* Copy agents.md and docs/ from @donkeylabs/server to project root
|
|
328
328
|
* for AI-assisted development
|
|
329
329
|
*/
|
|
330
330
|
async function copyDocsFromServer(targetDir: string): Promise<void> {
|
|
@@ -334,19 +334,19 @@ async function copyDocsFromServer(targetDir: string): Promise<void> {
|
|
|
334
334
|
return; // Server package not installed
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
-
// Copy
|
|
338
|
-
const
|
|
339
|
-
if (existsSync(
|
|
340
|
-
const
|
|
341
|
-
await copyFile(
|
|
342
|
-
console.log(pc.green(" Created:"), "
|
|
337
|
+
// Copy agents.md
|
|
338
|
+
const agentsMdSrc = join(serverPkgPath, "agents.md");
|
|
339
|
+
if (existsSync(agentsMdSrc)) {
|
|
340
|
+
const agentsMdDest = join(targetDir, "agents.md");
|
|
341
|
+
await copyFile(agentsMdSrc, agentsMdDest);
|
|
342
|
+
console.log(pc.green(" Created:"), "agents.md (AI instructions)");
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
// Copy docs/ directory
|
|
346
346
|
const docsSrc = join(serverPkgPath, "docs");
|
|
347
347
|
if (existsSync(docsSrc)) {
|
|
348
|
-
const docsDest = join(targetDir, "docs");
|
|
348
|
+
const docsDest = join(targetDir, "docs", "donkeylabs");
|
|
349
349
|
await copyDirectory(docsSrc, docsDest);
|
|
350
|
-
console.log(pc.green(" Created:"), "docs/ (detailed documentation)");
|
|
350
|
+
console.log(pc.green(" Created:"), "docs/donkeylabs/ (detailed documentation)");
|
|
351
351
|
}
|
|
352
352
|
}
|