@aisdlc/cli 2.5.0 → 3.0.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/dist/index.js CHANGED
@@ -1667,12 +1667,15 @@ function runGitCheckout(taskId, options = {}) {
1667
1667
  function runGitHookInstall(options = {}) {
1668
1668
  const rootDir = options.root || process.cwd();
1669
1669
  console.log(pc4.cyan(`
1670
- \u{1F527} [AI-SDLC Git] Installing deterministic hook for commit trailers...`));
1670
+ \u{1F527} [AI-SDLC Git] Installing deterministic Git hooks (pre-commit & prepare-commit-msg)...`));
1671
1671
  const result = installGitHooks(rootDir);
1672
1672
  if (result.success) {
1673
- console.log(pc4.green(`\u2714 [COMPLIANT] Git Hook successfully installed at:`));
1674
- console.log(` \u{1F449} ${pc4.bold(result.hookPath || ".git/hooks/prepare-commit-msg")}
1675
- `);
1673
+ console.log(pc4.green(`\u2714 [COMPLIANT] Git Hooks successfully installed:`));
1674
+ const hooks = result.installedHooks || [result.hookPath || ".git/hooks/prepare-commit-msg"];
1675
+ for (const h of hooks) {
1676
+ console.log(` \u{1F449} ${pc4.bold(h)}`);
1677
+ }
1678
+ console.log();
1676
1679
  return true;
1677
1680
  } else {
1678
1681
  console.error(pc4.red(`
@@ -1795,6 +1798,7 @@ function emitInitJson(result, isSuccess, dryRun) {
1795
1798
  targetDir: result.targetDir,
1796
1799
  directoriesCreated: result.directoriesCreated,
1797
1800
  filesCreated: result.filesCreated,
1801
+ filesUpdated: result.filesUpdated || [],
1798
1802
  ciProvider: result.ciProvider,
1799
1803
  agentsConfigured: result.agentsConfigured,
1800
1804
  architectureGranularity: result.architectureGranularity,
@@ -1821,8 +1825,11 @@ function printGitHookStatus(dryRun, installed) {
1821
1825
  }
1822
1826
  function printCreatedItems(items, type, dryRun) {
1823
1827
  const isDir = type === "directory";
1828
+ const isUpdated = type === "updated-file";
1824
1829
  for (const item of items) {
1825
- const prefix = dryRun ? pc5.blue("DRY-RUN") + ` ${isDir ? "Create directory:" : "Create file:"}` : pc5.green("\u2714") + ` ${isDir ? "Directory created:" : "File generated:"}`;
1830
+ const actionLabel = isDir ? "Create directory:" : isUpdated ? "Update file:" : "Create file:";
1831
+ const doneLabel = isDir ? "Directory created:" : isUpdated ? "File updated:" : "File generated:";
1832
+ const prefix = dryRun ? pc5.blue("DRY-RUN") + ` ${actionLabel}` : pc5.green("\u2714") + ` ${doneLabel}`;
1826
1833
  console.log(` ${prefix} ${item}`);
1827
1834
  }
1828
1835
  }
@@ -1832,6 +1839,9 @@ function printInitSuccess(result, dryRun) {
1832
1839
  `)));
1833
1840
  printCreatedItems(result.directoriesCreated, "directory", dryRun);
1834
1841
  printCreatedItems(result.filesCreated, "file", dryRun);
1842
+ if (result.filesUpdated && result.filesUpdated.length > 0) {
1843
+ printCreatedItems(result.filesUpdated, "updated-file", dryRun);
1844
+ }
1835
1845
  if (result.ciProvider) {
1836
1846
  console.log(pc5.cyan(`
1837
1847
  \u2714 CI/CD configuration generated for provider: ${pc5.bold(result.ciProvider)}`));
@@ -1877,7 +1887,8 @@ function runInit(targetDir = ".", options = {}) {
1877
1887
  ci: options.ci,
1878
1888
  agents: options.agents === "none" ? false : options.agents,
1879
1889
  architecture: options.architecture,
1880
- dryRun
1890
+ dryRun,
1891
+ force: Boolean(options.force)
1881
1892
  });
1882
1893
  return handleInitResult(result, { isSilent, useJson, dryRun });
1883
1894
  }
@@ -2084,6 +2095,26 @@ function runReportQuality(options = {}) {
2084
2095
  return result.verdict === "PASS";
2085
2096
  }
2086
2097
 
2098
+ // src/commands/inspect.ts
2099
+ import { inspectElement, formatInspectResultMarkdown } from "@aisdlc/core";
2100
+ function isJsonOutput2(options = {}) {
2101
+ if (options.json !== void 0) return Boolean(options.json);
2102
+ if (options.format !== void 0) return options.format.trim().toLowerCase() === "json";
2103
+ const env = process.env.AISDLC_FORMAT?.trim().toLowerCase() || process.env.AISDLC_OUTPUT?.trim().toLowerCase();
2104
+ return env === "json";
2105
+ }
2106
+ function runInspect(query, options = {}) {
2107
+ const root = options.root || process.cwd();
2108
+ const result = inspectElement(query, { rootDir: root });
2109
+ if (isJsonOutput2(options)) {
2110
+ console.log(JSON.stringify(result, null, 2));
2111
+ return result.found;
2112
+ }
2113
+ const markdown = formatInspectResultMarkdown(result);
2114
+ console.log(markdown);
2115
+ return result.found;
2116
+ }
2117
+
2087
2118
  // src/commands/sdd.ts
2088
2119
  import * as path3 from "path";
2089
2120
  import pc9 from "picocolors";
@@ -2443,7 +2474,7 @@ function runChangeNew(options) {
2443
2474
 
2444
2475
  // src/index.ts
2445
2476
  var program = new Command();
2446
- program.name("aisdlc").description("AI-SDLC: Spec-Driven Development, Governance & Quality Gates for AI & Humans").version("2.5.0");
2477
+ program.name("aisdlc").description("AI-SDLC: Spec-Driven Development, Governance & Quality Gates for AI & Humans").version("3.0.0");
2447
2478
  program.command("check").description("Unified pre-flight command: validates Quality Gates with optional non-destructive auto-fix").option("--fix", "Automatically synchronize Gherkin scenarios (.feature) and cryptographic digests of PDaC citations").option("-r, --root <path>", "Project root directory").option("--vuln", "Scan for known vulnerabilities (CVE/GHSA) in dependencies").option("--json", "Emit verification results in structured JSON format").option("-F, --format <format>", "Output format: text or json").action((opts) => {
2448
2479
  const passed = runCheck({
2449
2480
  fix: opts.fix,
@@ -2730,7 +2761,15 @@ sddCommand.command("integrate").description("Integrate and synchronize implement
2730
2761
  });
2731
2762
  process.exit(passed ? 0 : 1);
2732
2763
  });
2733
- program.command("init [directory]").description("Initialize a new repository with AI-SDLC guidelines, schemas, and policies").option("-d, --dry-run", "Simulate file and directory creation without writing to disk").option("--ci <provider>", "CI/CD provider for pipeline generation (github, gitlab, azure, bitbucket)").option("--agents [targets]", "AI agent environments to configure (all, cursor, claude, antigravity, copilot, mcp, or comma-separated combination)").option("--arch, --architecture <granularity>", "Architecture templates granularity level (minimal, full, complete, none)").option("--json", "Structured JSON format output").option("-F, --format <format>", "Output format: text or json").action(async (directory, opts) => {
2764
+ program.command("inspect <element>").description("Inspect an element (FR, UC, CMP, task, or source file) to display technical summary and relationships").option("-r, --root <path>", "Project root directory").option("--json", "Structured JSON format output").option("-F, --format <format>", "Output format: text or json").action((element, opts) => {
2765
+ const passed = runInspect(element, {
2766
+ root: opts.root,
2767
+ json: opts.json,
2768
+ format: opts.format
2769
+ });
2770
+ process.exit(passed ? 0 : 1);
2771
+ });
2772
+ program.command("init [directory]").description("Initialize a new repository with AI-SDLC guidelines, schemas, and policies").option("-d, --dry-run", "Simulate file and directory creation without writing to disk").option("-f, --force", "Force overwrite existing agent, rule, and policy configurations with canonical templates").option("--ci <provider>", "CI/CD provider for pipeline generation (github, gitlab, azure, bitbucket)").option("--agents [targets]", "AI agent environments to configure (all, cursor, claude, antigravity, copilot, mcp, or comma-separated combination)").option("--arch, --architecture <granularity>", "Architecture templates granularity level (minimal, full, complete, none)").option("--json", "Structured JSON format output").option("-F, --format <format>", "Output format: text or json").action(async (directory, opts) => {
2734
2773
  let agents = opts.agents;
2735
2774
  let arch = opts.architecture || opts.arch;
2736
2775
  let ci = opts.ci;
@@ -2746,6 +2785,7 @@ program.command("init [directory]").description("Initialize a new repository wit
2746
2785
  }
2747
2786
  const passed = runInit(directory, {
2748
2787
  dryRun: opts.dryRun,
2788
+ force: opts.force,
2749
2789
  ci,
2750
2790
  agents,
2751
2791
  architecture: arch,
@@ -2754,6 +2794,18 @@ program.command("init [directory]").description("Initialize a new repository wit
2754
2794
  });
2755
2795
  process.exit(passed ? 0 : 1);
2756
2796
  });
2797
+ program.command("sync [directory]").description("Synchronize and refresh AI agent configurations, skills, and rules from canonical templates").option("-d, --dry-run", "Simulate file updates without writing to disk").option("--agents [targets]", "AI agent environments to configure (all, cursor, claude, antigravity, copilot, mcp, or comma-separated combination)").option("--json", "Structured JSON format output").option("-F, --format <format>", "Output format: text or json").action((directory, opts) => {
2798
+ const passed = runInit(directory, {
2799
+ dryRun: opts.dryRun,
2800
+ force: true,
2801
+ agents: opts.agents || "all",
2802
+ ci: "none",
2803
+ architecture: "none",
2804
+ json: opts.json,
2805
+ format: opts.format
2806
+ });
2807
+ process.exit(passed ? 0 : 1);
2808
+ });
2757
2809
  program.command("mcp").description("Start native AI-SDLC Model Context Protocol (MCP) server (stdio)").option("-r, --root <path>", "Project root directory").option("--role <role>", "Role context for MCP server authorization").action(async (opts) => {
2758
2810
  await runMcpServer({ root: opts.root, role: opts.role });
2759
2811
  });