@nathapp/nax 0.36.1 → 0.37.0

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/README.md CHANGED
@@ -317,6 +317,25 @@ If `testScoped` is not configured, nax falls back to a heuristic that replaces t
317
317
 
318
318
  ---
319
319
 
320
+ ## Customization
321
+
322
+ ### Prompt Customization
323
+
324
+ Customize the instructions sent to each agent role for your project's specific needs. Override prompts to enforce coding style, domain knowledge, or architectural constraints.
325
+
326
+ **Quick start:**
327
+
328
+ ```bash
329
+ nax prompts --init # Create default templates
330
+ # Edit nax/templates/*.md
331
+ nax prompts --export test-writer # Preview a role's prompt
332
+ nax run -f my-feature # Uses your custom prompts
333
+ ```
334
+
335
+ **Full guide:** See [Prompt Customization Guide](docs/prompt-customization.md) for detailed instructions, role reference, and best practices.
336
+
337
+ ---
338
+
320
339
  ## Test Strategies
321
340
 
322
341
  nax selects a test strategy per story based on complexity and tags:
package/bin/nax.ts CHANGED
@@ -51,6 +51,7 @@ import {
51
51
  displayFeatureStatus,
52
52
  displayLastRunMetrics,
53
53
  displayModelEfficiency,
54
+ exportPromptCommand,
54
55
  planCommand,
55
56
  pluginsListCommand,
56
57
  promptsCommand,
@@ -191,13 +192,31 @@ Run \`nax generate\` to regenerate agent config files (CLAUDE.md, AGENTS.md, .cu
191
192
  `,
192
193
  );
193
194
 
195
+ // Initialize prompt templates (final step, don't auto-wire config)
196
+ try {
197
+ await promptsInitCommand({
198
+ workdir,
199
+ force: options.force,
200
+ autoWireConfig: false,
201
+ });
202
+ } catch (err) {
203
+ console.error(chalk.red(`Failed to initialize templates: ${(err as Error).message}`));
204
+ process.exit(1);
205
+ }
206
+
194
207
  console.log(chalk.green("✅ Initialized nax"));
195
208
  console.log(chalk.dim(` ${naxDir}/`));
196
209
  console.log(chalk.dim(" ├── config.json"));
197
210
  console.log(chalk.dim(" ├── context.md"));
198
211
  console.log(chalk.dim(" ├── hooks.json"));
199
212
  console.log(chalk.dim(" ├── features/"));
200
- console.log(chalk.dim(" └── hooks/"));
213
+ console.log(chalk.dim(" ├── hooks/"));
214
+ console.log(chalk.dim(" └── templates/"));
215
+ console.log(chalk.dim(" ├── test-writer.md"));
216
+ console.log(chalk.dim(" ├── implementer.md"));
217
+ console.log(chalk.dim(" ├── verifier.md"));
218
+ console.log(chalk.dim(" ├── single-session.md"));
219
+ console.log(chalk.dim(" └── tdd-simple.md"));
201
220
  console.log(chalk.dim("\nNext: nax features create <name>"));
202
221
  });
203
222
 
@@ -860,11 +879,12 @@ program
860
879
  program
861
880
  .command("prompts")
862
881
  .description("Assemble or initialize prompts")
863
- .option("-f, --feature <name>", "Feature name (required unless using --init)")
882
+ .option("-f, --feature <name>", "Feature name (required unless using --init or --export)")
864
883
  .option("--init", "Initialize default prompt templates", false)
884
+ .option("--export <role>", "Export default prompt for a role to stdout or --out file")
865
885
  .option("--force", "Overwrite existing template files", false)
866
886
  .option("--story <id>", "Filter to a single story ID (e.g., US-003)")
867
- .option("--out <dir>", "Output directory for prompt files (default: stdout)")
887
+ .option("--out <path>", "Output file path for --export, or directory for regular prompts (default: stdout)")
868
888
  .option("-d, --dir <path>", "Project directory", process.cwd())
869
889
  .action(async (options) => {
870
890
  // Validate directory path
@@ -890,9 +910,23 @@ program
890
910
  return;
891
911
  }
892
912
 
913
+ // Handle --export command
914
+ if (options.export) {
915
+ try {
916
+ await exportPromptCommand({
917
+ role: options.export,
918
+ out: options.out,
919
+ });
920
+ } catch (err) {
921
+ console.error(chalk.red(`Error: ${(err as Error).message}`));
922
+ process.exit(1);
923
+ }
924
+ return;
925
+ }
926
+
893
927
  // Handle regular prompts command (requires --feature)
894
928
  if (!options.feature) {
895
- console.error(chalk.red("Error: --feature is required (unless using --init)"));
929
+ console.error(chalk.red("Error: --feature is required (unless using --init or --export)"));
896
930
  process.exit(1);
897
931
  }
898
932