@klitchevo/code-council 0.0.14 → 0.0.15

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.
Files changed (2) hide show
  1. package/dist/index.js +49 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1308,6 +1308,7 @@ async function handlePlanReview(client2, input) {
1308
1308
  }
1309
1309
 
1310
1310
  // src/tools/tps-audit.ts
1311
+ import { existsSync as existsSync2, mkdirSync, writeFileSync } from "fs";
1311
1312
  import { join as join4 } from "path";
1312
1313
  import { z as z7 } from "zod";
1313
1314
 
@@ -1492,11 +1493,11 @@ var EXCLUDED_DIRS = [
1492
1493
  ".nyc_output"
1493
1494
  ];
1494
1495
  var HARD_LIMITS = {
1495
- MAX_FILES: 100,
1496
- MAX_FILE_SIZE: 100 * 1024,
1497
- // 100KB per file
1498
- MAX_TOTAL_SIZE: 1024 * 1024
1499
- // 1MB total
1496
+ MAX_FILES: 1e4,
1497
+ MAX_FILE_SIZE: 1024 * 1024,
1498
+ // 1MB per file
1499
+ MAX_TOTAL_SIZE: 50 * 1024 * 1024
1500
+ // 50MB total
1500
1501
  };
1501
1502
  var DEFAULT_OPTIONS = {
1502
1503
  maxFiles: 50,
@@ -1732,7 +1733,7 @@ var tpsAuditSchemaObj = z7.object({
1732
1733
  "Path to repo root (auto-detects current directory if not provided)"
1733
1734
  ),
1734
1735
  focus_areas: z7.array(z7.string()).optional().describe("Specific areas to focus on (e.g., 'performance', 'security')"),
1735
- max_files: z7.number().max(100).optional().describe("Maximum files to analyze (default: 50, max: 100)"),
1736
+ max_files: z7.number().optional().describe("Maximum files to analyze (default: 50)"),
1736
1737
  file_types: z7.array(z7.string()).optional().describe("File extensions to include (e.g., ['.ts', '.js'])"),
1737
1738
  include_sensitive: z7.boolean().optional().describe(
1738
1739
  "Include potentially sensitive files (default: false, use with caution)"
@@ -1810,18 +1811,39 @@ async function handleTpsAudit(client2, models, input) {
1810
1811
  outputFormat
1811
1812
  };
1812
1813
  }
1814
+ function writeReportToFolder(repoRoot, content, format) {
1815
+ try {
1816
+ const outputDir = join4(repoRoot, ".code-council");
1817
+ if (!existsSync2(outputDir)) {
1818
+ mkdirSync(outputDir, { recursive: true });
1819
+ }
1820
+ const ext = format === "json" ? "json" : format === "html" ? "html" : "md";
1821
+ const filename = `tps-audit.${ext}`;
1822
+ const filepath = join4(outputDir, filename);
1823
+ writeFileSync(filepath, content);
1824
+ logger.info("TPS audit report written", { filepath });
1825
+ return filepath;
1826
+ } catch (err) {
1827
+ logger.warn("Failed to write report to .code-council folder", {
1828
+ error: err instanceof Error ? err.message : String(err)
1829
+ });
1830
+ return null;
1831
+ }
1832
+ }
1813
1833
  function formatTpsAuditResults(auditResult) {
1814
1834
  const { results, scanResult, analysis, outputFormat } = auditResult;
1835
+ let content;
1815
1836
  switch (outputFormat) {
1816
1837
  case "html": {
1817
1838
  const templatePath = join4(getTemplatesDir(), "tps-report.html");
1818
- return formatResultsAsHtml(results, templatePath, {
1839
+ content = formatResultsAsHtml(results, templatePath, {
1819
1840
  analysis,
1820
1841
  repoName: scanResult.repoRoot.split("/").pop()
1821
1842
  });
1843
+ break;
1822
1844
  }
1823
1845
  case "json": {
1824
- return JSON.stringify(
1846
+ content = JSON.stringify(
1825
1847
  {
1826
1848
  analysis,
1827
1849
  scanStats: scanResult.stats,
@@ -1836,6 +1858,7 @@ function formatTpsAuditResults(auditResult) {
1836
1858
  null,
1837
1859
  2
1838
1860
  );
1861
+ break;
1839
1862
  }
1840
1863
  case "markdown":
1841
1864
  default: {
@@ -1882,7 +1905,7 @@ function formatTpsAuditResults(auditResult) {
1882
1905
  }
1883
1906
  }
1884
1907
  parts.push("\n## Model Perspectives\n");
1885
- results.forEach((r) => {
1908
+ for (const r of results) {
1886
1909
  if (r.error) {
1887
1910
  parts.push(`
1888
1911
  ### ${r.model}
@@ -1897,10 +1920,25 @@ ${r.review}
1897
1920
  `);
1898
1921
  }
1899
1922
  parts.push("\n---\n");
1900
- });
1901
- return parts.join("");
1923
+ }
1924
+ content = parts.join("");
1925
+ break;
1902
1926
  }
1903
1927
  }
1928
+ const filepath = writeReportToFolder(
1929
+ scanResult.repoRoot,
1930
+ content,
1931
+ outputFormat
1932
+ );
1933
+ if (filepath) {
1934
+ const fileNote = `
1935
+
1936
+ ---
1937
+ **Report saved to:** \`${filepath}\`
1938
+ `;
1939
+ return content + fileNote;
1940
+ }
1941
+ return content;
1904
1942
  }
1905
1943
 
1906
1944
  // src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klitchevo/code-council",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "Multi-model AI code review server using OpenRouter - get diverse perspectives from multiple LLMs in parallel",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",