@nathapp/nax 0.46.2 → 0.47.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/bin/nax.ts CHANGED
@@ -128,6 +128,7 @@ program
128
128
  .description("Initialize nax in the current project")
129
129
  .option("-d, --dir <path>", "Project directory", process.cwd())
130
130
  .option("-f, --force", "Force overwrite existing files", false)
131
+ .option("--package <dir>", "Scaffold per-package nax/context.md (e.g. packages/api)")
131
132
  .action(async (options) => {
132
133
  // Validate directory path
133
134
  let workdir: string;
@@ -138,6 +139,21 @@ program
138
139
  process.exit(1);
139
140
  }
140
141
 
142
+ // --package: scaffold per-package nax/context.md only
143
+ if (options.package) {
144
+ const { initPackage: initPkg } = await import("../src/cli/init-context");
145
+ try {
146
+ await initPkg(workdir, options.package, options.force);
147
+ console.log(chalk.green("\n[OK] Package scaffold created."));
148
+ console.log(chalk.dim(` Created: ${options.package}/nax/context.md`));
149
+ console.log(chalk.dim(`\nNext: nax generate --package ${options.package}`));
150
+ } catch (err) {
151
+ console.error(chalk.red(`Error: ${(err as Error).message}`));
152
+ process.exit(1);
153
+ }
154
+ return;
155
+ }
156
+
141
157
  const naxDir = join(workdir, "nax");
142
158
 
143
159
  if (existsSync(naxDir) && !options.force) {
@@ -1124,6 +1140,8 @@ program
1124
1140
  .option("-a, --agent <name>", "Specific agent (claude|opencode|cursor|windsurf|aider)")
1125
1141
  .option("--dry-run", "Preview without writing files", false)
1126
1142
  .option("--no-auto-inject", "Disable auto-injection of project metadata")
1143
+ .option("--package <dir>", "Generate CLAUDE.md for a specific package (e.g. packages/api)")
1144
+ .option("--all-packages", "Generate CLAUDE.md for all discovered packages", false)
1127
1145
  .action(async (options) => {
1128
1146
  try {
1129
1147
  await generateCommand({
@@ -1132,6 +1150,8 @@ program
1132
1150
  agent: options.agent,
1133
1151
  dryRun: options.dryRun,
1134
1152
  noAutoInject: !options.autoInject,
1153
+ package: options.package,
1154
+ allPackages: options.allPackages,
1135
1155
  });
1136
1156
  } catch (err) {
1137
1157
  console.error(chalk.red(`Error: ${(err as Error).message}`));