mrvn-cli 0.2.9 → 0.2.10

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/marvin.js CHANGED
@@ -16730,6 +16730,11 @@ var DocumentStore = class {
16730
16730
  const raw = fs5.readFileSync(filePath, "utf-8");
16731
16731
  const doc = parseDocument(raw, filePath);
16732
16732
  if (doc.frontmatter.id) {
16733
+ if (this.index.has(doc.frontmatter.id)) {
16734
+ console.warn(
16735
+ `[marvin] Duplicate ID "${doc.frontmatter.id}" in ${file2} \u2014 conflicts with existing entry. Run ID repair to fix.`
16736
+ );
16737
+ }
16733
16738
  this.index.set(doc.frontmatter.id, doc.frontmatter);
16734
16739
  }
16735
16740
  }
@@ -16850,14 +16855,22 @@ var DocumentStore = class {
16850
16855
  if (!prefix) {
16851
16856
  throw new Error(`Unknown document type: ${type}`);
16852
16857
  }
16853
- const pattern = new RegExp(`^${prefix}-(\\d+)$`);
16858
+ const dirName = this.typeDirs[type];
16859
+ const dir = path5.join(this.docsDir, dirName);
16860
+ if (!fs5.existsSync(dir)) return `${prefix}-001`;
16861
+ const idPattern = new RegExp(`^${prefix}-(\\d+)$`);
16862
+ const files = fs5.readdirSync(dir).filter((f) => f.endsWith(".md"));
16854
16863
  let maxNum = 0;
16855
- for (const id of this.index.keys()) {
16856
- const match = id.match(pattern);
16864
+ for (const file2 of files) {
16865
+ const filePath = path5.join(dir, file2);
16866
+ const raw = fs5.readFileSync(filePath, "utf-8");
16867
+ const doc = parseDocument(raw, filePath);
16868
+ const match = doc.frontmatter.id?.match(idPattern);
16857
16869
  if (match) {
16858
16870
  maxNum = Math.max(maxNum, parseInt(match[1], 10));
16859
16871
  }
16860
16872
  }
16873
+ maxNum = Math.max(maxNum, files.length);
16861
16874
  return `${prefix}-${String(maxNum + 1).padStart(3, "0")}`;
16862
16875
  }
16863
16876
  counts() {
@@ -21397,7 +21410,7 @@ function createProgram() {
21397
21410
  const program2 = new Command();
21398
21411
  program2.name("marvin").description(
21399
21412
  "AI-powered product development assistant with Product Owner, Delivery Manager, and Technical Lead personas"
21400
- ).version("0.2.9");
21413
+ ).version("0.2.10");
21401
21414
  program2.command("init").description("Initialize a new Marvin project in the current directory").action(async () => {
21402
21415
  await initCommand();
21403
21416
  });