@joshski/dust 0.1.4 → 0.1.6

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 CHANGED
@@ -27,22 +27,22 @@ var AGENT_SUBCOMMANDS = [
27
27
  "help"
28
28
  ];
29
29
  function generateAgentGreeting(settings) {
30
- return loadTemplate("agent-greeting", { bin: settings.binaryPath });
30
+ return loadTemplate("agent-greeting", { bin: settings.dustCommand });
31
31
  }
32
32
  function generateWorkInstructions(settings) {
33
- return loadTemplate("agent-work", { bin: settings.binaryPath });
33
+ return loadTemplate("agent-work", { bin: settings.dustCommand });
34
34
  }
35
35
  function generateTasksInstructions(settings) {
36
- return loadTemplate("agent-tasks", { bin: settings.binaryPath });
36
+ return loadTemplate("agent-tasks", { bin: settings.dustCommand });
37
37
  }
38
38
  function generateGoalsInstructions(settings) {
39
- return loadTemplate("agent-goals", { bin: settings.binaryPath });
39
+ return loadTemplate("agent-goals", { bin: settings.dustCommand });
40
40
  }
41
41
  function generateIdeasInstructions(settings) {
42
- return loadTemplate("agent-ideas", { bin: settings.binaryPath });
42
+ return loadTemplate("agent-ideas", { bin: settings.dustCommand });
43
43
  }
44
44
  function generateAgentHelp(settings) {
45
- return loadTemplate("agent-help", { bin: settings.binaryPath });
45
+ return loadTemplate("agent-help", { bin: settings.dustCommand });
46
46
  }
47
47
  async function agent(ctx, args, settings) {
48
48
  const subcommand = args[0];
@@ -278,6 +278,54 @@ async function check(ctx, fs, _args, runner = defaultProcessRunner, glob) {
278
278
  return { exitCode };
279
279
  }
280
280
 
281
+ // lib/cli/settings.ts
282
+ import { join as join2 } from "node:path";
283
+ var DEFAULT_SETTINGS = {
284
+ dustCommand: "npx dust"
285
+ };
286
+ function detectDustCommand(cwd, fs) {
287
+ if (fs.exists(join2(cwd, "bun.lockb"))) {
288
+ return "bunx dust";
289
+ }
290
+ if (fs.exists(join2(cwd, "pnpm-lock.yaml"))) {
291
+ return "pnpx dust";
292
+ }
293
+ if (fs.exists(join2(cwd, "package-lock.json"))) {
294
+ return "npx dust";
295
+ }
296
+ if (process.env.BUN_INSTALL) {
297
+ return "bunx dust";
298
+ }
299
+ return "npx dust";
300
+ }
301
+ async function loadSettings(cwd, fs) {
302
+ const settingsPath = join2(cwd, ".dust", "config", "settings.json");
303
+ if (!fs.exists(settingsPath)) {
304
+ return {
305
+ dustCommand: detectDustCommand(cwd, fs)
306
+ };
307
+ }
308
+ try {
309
+ const content = await fs.readFile(settingsPath);
310
+ const parsed = JSON.parse(content);
311
+ if (!parsed.dustCommand) {
312
+ return {
313
+ ...DEFAULT_SETTINGS,
314
+ ...parsed,
315
+ dustCommand: detectDustCommand(cwd, fs)
316
+ };
317
+ }
318
+ return {
319
+ ...DEFAULT_SETTINGS,
320
+ ...parsed
321
+ };
322
+ } catch {
323
+ return {
324
+ dustCommand: detectDustCommand(cwd, fs)
325
+ };
326
+ }
327
+ }
328
+
281
329
  // lib/cli/init.ts
282
330
  var DUST_DIRECTORIES = ["goals", "ideas", "tasks", "facts"];
283
331
  var DEFAULT_GOAL = `# Project Goal
@@ -286,18 +334,36 @@ Describe the high-level mission of this project.
286
334
  `;
287
335
  async function init(ctx, fs, _args) {
288
336
  const dustPath = `${ctx.cwd}/.dust`;
337
+ const dustCommand = detectDustCommand(ctx.cwd, fs);
338
+ const agentInstruction = `Always immediately run \`${dustCommand} agent\` when you start working in this repository.`;
289
339
  if (fs.exists(dustPath)) {
290
- ctx.stderr("Error: .dust directory already exists");
291
- return { exitCode: 1 };
292
- }
293
- await fs.mkdir(dustPath, { recursive: true });
294
- for (const dir of DUST_DIRECTORIES) {
295
- await fs.mkdir(`${dustPath}/${dir}`, { recursive: true });
340
+ ctx.stdout("Note: .dust directory already exists, skipping creation");
341
+ } else {
342
+ await fs.mkdir(dustPath, { recursive: true });
343
+ for (const dir of DUST_DIRECTORIES) {
344
+ await fs.mkdir(`${dustPath}/${dir}`, { recursive: true });
345
+ }
346
+ await fs.writeFile(`${dustPath}/goals/project-goal.md`, DEFAULT_GOAL);
347
+ ctx.stdout("Initialized Dust repository in .dust/");
348
+ ctx.stdout(`Created directories: ${DUST_DIRECTORIES.join(", ")}`);
349
+ ctx.stdout("Created initial goal: .dust/goals/project-goal.md");
350
+ }
351
+ const claudeMdPath = `${ctx.cwd}/CLAUDE.md`;
352
+ if (fs.exists(claudeMdPath)) {
353
+ ctx.stdout(`Warning: CLAUDE.md already exists. Consider adding: "${agentInstruction}"`);
354
+ } else {
355
+ const claudeContent = loadTemplate("claude-md", { dustCommand });
356
+ await fs.writeFile(claudeMdPath, claudeContent);
357
+ ctx.stdout("Created CLAUDE.md with agent instructions");
358
+ }
359
+ const agentsMdPath = `${ctx.cwd}/AGENTS.md`;
360
+ if (fs.exists(agentsMdPath)) {
361
+ ctx.stdout(`Warning: AGENTS.md already exists. Consider adding: "${agentInstruction}"`);
362
+ } else {
363
+ const agentsContent = loadTemplate("agents-md", { dustCommand });
364
+ await fs.writeFile(agentsMdPath, agentsContent);
365
+ ctx.stdout("Created AGENTS.md with agent instructions");
296
366
  }
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
367
  return { exitCode: 0 };
302
368
  }
303
369
 
@@ -442,28 +508,6 @@ async function prompt(ctx, fs, args) {
442
508
  return { exitCode: 0 };
443
509
  }
444
510
 
445
- // lib/cli/settings.ts
446
- import { join as join2 } from "node:path";
447
- var DEFAULT_SETTINGS = {
448
- binaryPath: "dust"
449
- };
450
- async function loadSettings(cwd, fs) {
451
- const settingsPath = join2(cwd, ".dust", "config", "settings.json");
452
- if (!fs.exists(settingsPath)) {
453
- return DEFAULT_SETTINGS;
454
- }
455
- try {
456
- const content = await fs.readFile(settingsPath);
457
- const parsed = JSON.parse(content);
458
- return {
459
- ...DEFAULT_SETTINGS,
460
- ...parsed
461
- };
462
- } catch {
463
- return DEFAULT_SETTINGS;
464
- }
465
- }
466
-
467
511
  // lib/cli/main.ts
468
512
  var COMMANDS = [
469
513
  "init",
@@ -476,9 +520,9 @@ var COMMANDS = [
476
520
  "help"
477
521
  ];
478
522
  function generateHelpText(settings) {
479
- return loadTemplate("help", { bin: settings.binaryPath });
523
+ return loadTemplate("help", { bin: settings.dustCommand });
480
524
  }
481
- var HELP_TEXT = generateHelpText({ binaryPath: "dust" });
525
+ var HELP_TEXT = generateHelpText({ dustCommand: "dust" });
482
526
  function isHelpRequest(command) {
483
527
  return !command || command === "help" || command === "--help" || command === "-h";
484
528
  }
@@ -518,7 +562,7 @@ async function main(options) {
518
562
  }
519
563
  if (!isValidCommand(command)) {
520
564
  ctx.stderr(`Unknown command: ${command}`);
521
- ctx.stderr(`Run '${settings.binaryPath} help' for available commands`);
565
+ ctx.stderr(`Run '${settings.dustCommand} help' for available commands`);
522
566
  return { exitCode: 1 };
523
567
  }
524
568
  return runCommand(command, commandArgs, ctx, fs, glob, settings);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joshski/dust",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "A lightweight planning system for human-AI collaboration",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,5 @@
1
+ # Agent Instructions
2
+
3
+ This project uses [dust](https://github.com/joshski/dust) for planning and documentation.
4
+
5
+ Always immediately run `{{dustCommand}} agent` when you start working in this repository.
@@ -0,0 +1,5 @@
1
+ # Claude Code Instructions
2
+
3
+ This project uses [dust](https://github.com/joshski/dust) for planning and documentation.
4
+
5
+ Always immediately run `{{dustCommand}} agent` when you start working in this repository.