vaspera-pm 2.12.8 → 2.12.11

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/cli.js CHANGED
@@ -1623,14 +1623,37 @@ __export(folder_manager_exports, {
1623
1623
  });
1624
1624
  import { existsSync, mkdirSync, readdirSync, statSync, writeFileSync, readFileSync } from "fs";
1625
1625
  import { join, basename, dirname as dirname2 } from "path";
1626
+ function getProjectConfig(projectRoot) {
1627
+ const configPath = join(projectRoot, PROJECT_CONFIG_FILE);
1628
+ if (!existsSync(configPath)) {
1629
+ return null;
1630
+ }
1631
+ try {
1632
+ return JSON.parse(readFileSync(configPath, "utf-8"));
1633
+ } catch {
1634
+ return null;
1635
+ }
1636
+ }
1626
1637
  function detectOutputPath(projectRoot) {
1627
- const docsPath = join(projectRoot, "docs");
1628
- if (existsSync(docsPath) && statSync(docsPath).isDirectory()) {
1629
- return join(docsPath, VASPERA_FOLDER);
1638
+ const projectConfig = getProjectConfig(projectRoot);
1639
+ if (projectConfig?.outputPath) {
1640
+ return join(projectRoot, projectConfig.outputPath);
1641
+ }
1642
+ const standalonePath = join(projectRoot, VASPERA_STANDALONE);
1643
+ if (existsSync(standalonePath) && statSync(standalonePath).isDirectory()) {
1644
+ return standalonePath;
1630
1645
  }
1631
- const specPath = join(projectRoot, "spec");
1632
- if (existsSync(specPath) && statSync(specPath).isDirectory()) {
1633
- return join(specPath, VASPERA_FOLDER);
1646
+ for (const docFolder of DOC_FOLDER_NAMES) {
1647
+ const nestedPath = join(projectRoot, docFolder, VASPERA_FOLDER);
1648
+ if (existsSync(nestedPath) && statSync(nestedPath).isDirectory()) {
1649
+ return nestedPath;
1650
+ }
1651
+ }
1652
+ for (const docFolder of DOC_FOLDER_NAMES) {
1653
+ const docPath = join(projectRoot, docFolder);
1654
+ if (existsSync(docPath) && statSync(docPath).isDirectory()) {
1655
+ return join(docPath, VASPERA_FOLDER);
1656
+ }
1634
1657
  }
1635
1658
  return join(projectRoot, VASPERA_STANDALONE);
1636
1659
  }
@@ -1749,10 +1772,12 @@ function hasOutputFolder(projectRoot) {
1749
1772
  return existsSync(outputPath);
1750
1773
  }
1751
1774
  function ensureOutputStructure(outputPath) {
1752
- const isNestedInDocs = outputPath.endsWith(`/${VASPERA_FOLDER}`) || outputPath.endsWith(`/spec/${VASPERA_FOLDER}`);
1753
- const isStandalone = outputPath.endsWith(`/${VASPERA_STANDALONE}`) || basename(outputPath) === VASPERA_STANDALONE;
1775
+ const pathBasename = basename(outputPath);
1776
+ const parentDirName = basename(dirname2(outputPath));
1754
1777
  let projectRoot;
1755
- if (isNestedInDocs) {
1778
+ const isNestedInDocFolder = pathBasename === VASPERA_FOLDER && DOC_FOLDER_NAMES.includes(parentDirName);
1779
+ const isStandalone = pathBasename === VASPERA_STANDALONE;
1780
+ if (isNestedInDocFolder) {
1756
1781
  projectRoot = dirname2(dirname2(outputPath));
1757
1782
  } else if (isStandalone) {
1758
1783
  projectRoot = dirname2(outputPath);
@@ -1793,14 +1818,16 @@ function listCategoryFiles(outputPath, category) {
1793
1818
  }
1794
1819
  return files;
1795
1820
  }
1796
- var VASPERA_FOLDER, VASPERA_STANDALONE, CONFIG_FILE, HISTORY_FILE, FOLDER_STRUCTURE, SUBFOLDER_STRUCTURE;
1821
+ var VASPERA_FOLDER, VASPERA_STANDALONE, PROJECT_CONFIG_FILE, CONFIG_FILE, HISTORY_FILE, DOC_FOLDER_NAMES, FOLDER_STRUCTURE, SUBFOLDER_STRUCTURE;
1797
1822
  var init_folder_manager = __esm({
1798
1823
  "src/output/folder-manager.ts"() {
1799
1824
  "use strict";
1800
1825
  VASPERA_FOLDER = "vasperaPM";
1801
1826
  VASPERA_STANDALONE = "vasperaPM_Docs";
1827
+ PROJECT_CONFIG_FILE = ".vasperapm.json";
1802
1828
  CONFIG_FILE = "_metadata/config.json";
1803
1829
  HISTORY_FILE = "_metadata/history.json";
1830
+ DOC_FOLDER_NAMES = ["docs", "doc", "documentation", "specifications", "specs", "spec"];
1804
1831
  FOLDER_STRUCTURE = [
1805
1832
  "requirements",
1806
1833
  "prd",
@@ -28259,7 +28286,7 @@ var init_server = __esm({
28259
28286
  init_tools();
28260
28287
  init_dist();
28261
28288
  init_tasks();
28262
- VERSION6 = true ? "2.12.8" : "2.12.0";
28289
+ VERSION6 = true ? "2.12.9" : "2.12.0";
28263
28290
  stats = getToolStats();
28264
28291
  console.error(`[VasperaPM] Server initializing with ${stats.count} tools registered`);
28265
28292
  validation = validateToolsAtStartup();
@@ -31781,7 +31808,7 @@ var BANNER = `
31781
31808
  \u2551 \u2551
31782
31809
  \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\x1B[0m
31783
31810
  `;
31784
- var VERSION7 = true ? "2.12.8" : "2.12.0";
31811
+ var VERSION7 = true ? "2.12.9" : "2.12.0";
31785
31812
  var HELP = `
31786
31813
  \x1B[1mUsage:\x1B[0m npx vaspera-pm [command] [options]
31787
31814