@joshski/dust 0.1.4 → 0.1.5
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/dust.js +40 -10
- package/package.json +1 -1
- package/templates/agents-md.txt +5 -0
- package/templates/claude-md.txt +5 -0
package/dist/dust.js
CHANGED
|
@@ -284,20 +284,50 @@ var DEFAULT_GOAL = `# Project Goal
|
|
|
284
284
|
|
|
285
285
|
Describe the high-level mission of this project.
|
|
286
286
|
`;
|
|
287
|
+
function detectPackageRunner(cwd, fs) {
|
|
288
|
+
if (process.versions.bun) {
|
|
289
|
+
return "bunx";
|
|
290
|
+
}
|
|
291
|
+
if (fs.exists(`${cwd}/bun.lockb`)) {
|
|
292
|
+
return "bunx";
|
|
293
|
+
}
|
|
294
|
+
if (fs.exists(`${cwd}/pnpm-lock.yaml`)) {
|
|
295
|
+
return "pnpx";
|
|
296
|
+
}
|
|
297
|
+
return "npx";
|
|
298
|
+
}
|
|
287
299
|
async function init(ctx, fs, _args) {
|
|
288
300
|
const dustPath = `${ctx.cwd}/.dust`;
|
|
301
|
+
const runner = detectPackageRunner(ctx.cwd, fs);
|
|
302
|
+
const agentInstruction = `Always immediately run \`${runner} dust agent\` when you start working in this repository.`;
|
|
289
303
|
if (fs.exists(dustPath)) {
|
|
290
|
-
ctx.
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
304
|
+
ctx.stdout("Note: .dust directory already exists, skipping creation");
|
|
305
|
+
} else {
|
|
306
|
+
await fs.mkdir(dustPath, { recursive: true });
|
|
307
|
+
for (const dir of DUST_DIRECTORIES) {
|
|
308
|
+
await fs.mkdir(`${dustPath}/${dir}`, { recursive: true });
|
|
309
|
+
}
|
|
310
|
+
await fs.writeFile(`${dustPath}/goals/project-goal.md`, DEFAULT_GOAL);
|
|
311
|
+
ctx.stdout("Initialized Dust repository in .dust/");
|
|
312
|
+
ctx.stdout(`Created directories: ${DUST_DIRECTORIES.join(", ")}`);
|
|
313
|
+
ctx.stdout("Created initial goal: .dust/goals/project-goal.md");
|
|
314
|
+
}
|
|
315
|
+
const claudeMdPath = `${ctx.cwd}/CLAUDE.md`;
|
|
316
|
+
if (fs.exists(claudeMdPath)) {
|
|
317
|
+
ctx.stdout(`Warning: CLAUDE.md already exists. Consider adding: "${agentInstruction}"`);
|
|
318
|
+
} else {
|
|
319
|
+
const claudeContent = loadTemplate("claude-md", { runner });
|
|
320
|
+
await fs.writeFile(claudeMdPath, claudeContent);
|
|
321
|
+
ctx.stdout("Created CLAUDE.md with agent instructions");
|
|
322
|
+
}
|
|
323
|
+
const agentsMdPath = `${ctx.cwd}/AGENTS.md`;
|
|
324
|
+
if (fs.exists(agentsMdPath)) {
|
|
325
|
+
ctx.stdout(`Warning: AGENTS.md already exists. Consider adding: "${agentInstruction}"`);
|
|
326
|
+
} else {
|
|
327
|
+
const agentsContent = loadTemplate("agents-md", { runner });
|
|
328
|
+
await fs.writeFile(agentsMdPath, agentsContent);
|
|
329
|
+
ctx.stdout("Created AGENTS.md with agent instructions");
|
|
296
330
|
}
|
|
297
|
-
await fs.writeFile(`${dustPath}/goals/project-goal.md`, DEFAULT_GOAL);
|
|
298
|
-
ctx.stdout("Initialized Dust repository in .dust/");
|
|
299
|
-
ctx.stdout(`Created directories: ${DUST_DIRECTORIES.join(", ")}`);
|
|
300
|
-
ctx.stdout("Created initial goal: .dust/goals/project-goal.md");
|
|
301
331
|
return { exitCode: 0 };
|
|
302
332
|
}
|
|
303
333
|
|
package/package.json
CHANGED