@joshski/dust 0.1.5 → 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 +61 -47
- package/package.json +1 -1
- package/templates/agents-md.txt +1 -1
- package/templates/claude-md.txt +1 -1
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.
|
|
30
|
+
return loadTemplate("agent-greeting", { bin: settings.dustCommand });
|
|
31
31
|
}
|
|
32
32
|
function generateWorkInstructions(settings) {
|
|
33
|
-
return loadTemplate("agent-work", { bin: settings.
|
|
33
|
+
return loadTemplate("agent-work", { bin: settings.dustCommand });
|
|
34
34
|
}
|
|
35
35
|
function generateTasksInstructions(settings) {
|
|
36
|
-
return loadTemplate("agent-tasks", { bin: settings.
|
|
36
|
+
return loadTemplate("agent-tasks", { bin: settings.dustCommand });
|
|
37
37
|
}
|
|
38
38
|
function generateGoalsInstructions(settings) {
|
|
39
|
-
return loadTemplate("agent-goals", { bin: settings.
|
|
39
|
+
return loadTemplate("agent-goals", { bin: settings.dustCommand });
|
|
40
40
|
}
|
|
41
41
|
function generateIdeasInstructions(settings) {
|
|
42
|
-
return loadTemplate("agent-ideas", { bin: settings.
|
|
42
|
+
return loadTemplate("agent-ideas", { bin: settings.dustCommand });
|
|
43
43
|
}
|
|
44
44
|
function generateAgentHelp(settings) {
|
|
45
|
-
return loadTemplate("agent-help", { bin: settings.
|
|
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,28 +278,64 @@ 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
|
|
284
332
|
|
|
285
333
|
Describe the high-level mission of this project.
|
|
286
334
|
`;
|
|
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
|
-
}
|
|
299
335
|
async function init(ctx, fs, _args) {
|
|
300
336
|
const dustPath = `${ctx.cwd}/.dust`;
|
|
301
|
-
const
|
|
302
|
-
const agentInstruction = `Always immediately run \`${
|
|
337
|
+
const dustCommand = detectDustCommand(ctx.cwd, fs);
|
|
338
|
+
const agentInstruction = `Always immediately run \`${dustCommand} agent\` when you start working in this repository.`;
|
|
303
339
|
if (fs.exists(dustPath)) {
|
|
304
340
|
ctx.stdout("Note: .dust directory already exists, skipping creation");
|
|
305
341
|
} else {
|
|
@@ -316,7 +352,7 @@ async function init(ctx, fs, _args) {
|
|
|
316
352
|
if (fs.exists(claudeMdPath)) {
|
|
317
353
|
ctx.stdout(`Warning: CLAUDE.md already exists. Consider adding: "${agentInstruction}"`);
|
|
318
354
|
} else {
|
|
319
|
-
const claudeContent = loadTemplate("claude-md", {
|
|
355
|
+
const claudeContent = loadTemplate("claude-md", { dustCommand });
|
|
320
356
|
await fs.writeFile(claudeMdPath, claudeContent);
|
|
321
357
|
ctx.stdout("Created CLAUDE.md with agent instructions");
|
|
322
358
|
}
|
|
@@ -324,7 +360,7 @@ async function init(ctx, fs, _args) {
|
|
|
324
360
|
if (fs.exists(agentsMdPath)) {
|
|
325
361
|
ctx.stdout(`Warning: AGENTS.md already exists. Consider adding: "${agentInstruction}"`);
|
|
326
362
|
} else {
|
|
327
|
-
const agentsContent = loadTemplate("agents-md", {
|
|
363
|
+
const agentsContent = loadTemplate("agents-md", { dustCommand });
|
|
328
364
|
await fs.writeFile(agentsMdPath, agentsContent);
|
|
329
365
|
ctx.stdout("Created AGENTS.md with agent instructions");
|
|
330
366
|
}
|
|
@@ -472,28 +508,6 @@ async function prompt(ctx, fs, args) {
|
|
|
472
508
|
return { exitCode: 0 };
|
|
473
509
|
}
|
|
474
510
|
|
|
475
|
-
// lib/cli/settings.ts
|
|
476
|
-
import { join as join2 } from "node:path";
|
|
477
|
-
var DEFAULT_SETTINGS = {
|
|
478
|
-
binaryPath: "dust"
|
|
479
|
-
};
|
|
480
|
-
async function loadSettings(cwd, fs) {
|
|
481
|
-
const settingsPath = join2(cwd, ".dust", "config", "settings.json");
|
|
482
|
-
if (!fs.exists(settingsPath)) {
|
|
483
|
-
return DEFAULT_SETTINGS;
|
|
484
|
-
}
|
|
485
|
-
try {
|
|
486
|
-
const content = await fs.readFile(settingsPath);
|
|
487
|
-
const parsed = JSON.parse(content);
|
|
488
|
-
return {
|
|
489
|
-
...DEFAULT_SETTINGS,
|
|
490
|
-
...parsed
|
|
491
|
-
};
|
|
492
|
-
} catch {
|
|
493
|
-
return DEFAULT_SETTINGS;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
|
|
497
511
|
// lib/cli/main.ts
|
|
498
512
|
var COMMANDS = [
|
|
499
513
|
"init",
|
|
@@ -506,9 +520,9 @@ var COMMANDS = [
|
|
|
506
520
|
"help"
|
|
507
521
|
];
|
|
508
522
|
function generateHelpText(settings) {
|
|
509
|
-
return loadTemplate("help", { bin: settings.
|
|
523
|
+
return loadTemplate("help", { bin: settings.dustCommand });
|
|
510
524
|
}
|
|
511
|
-
var HELP_TEXT = generateHelpText({
|
|
525
|
+
var HELP_TEXT = generateHelpText({ dustCommand: "dust" });
|
|
512
526
|
function isHelpRequest(command) {
|
|
513
527
|
return !command || command === "help" || command === "--help" || command === "-h";
|
|
514
528
|
}
|
|
@@ -548,7 +562,7 @@ async function main(options) {
|
|
|
548
562
|
}
|
|
549
563
|
if (!isValidCommand(command)) {
|
|
550
564
|
ctx.stderr(`Unknown command: ${command}`);
|
|
551
|
-
ctx.stderr(`Run '${settings.
|
|
565
|
+
ctx.stderr(`Run '${settings.dustCommand} help' for available commands`);
|
|
552
566
|
return { exitCode: 1 };
|
|
553
567
|
}
|
|
554
568
|
return runCommand(command, commandArgs, ctx, fs, glob, settings);
|
package/package.json
CHANGED
package/templates/agents-md.txt
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
This project uses [dust](https://github.com/joshski/dust) for planning and documentation.
|
|
4
4
|
|
|
5
|
-
Always immediately run `{{
|
|
5
|
+
Always immediately run `{{dustCommand}} agent` when you start working in this repository.
|
package/templates/claude-md.txt
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
This project uses [dust](https://github.com/joshski/dust) for planning and documentation.
|
|
4
4
|
|
|
5
|
-
Always immediately run `{{
|
|
5
|
+
Always immediately run `{{dustCommand}} agent` when you start working in this repository.
|