@klitchevo/code-council 0.0.13 → 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 +54 -12
  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,
@@ -1579,7 +1580,11 @@ async function scanRepository(startPath, options = {}) {
1579
1580
  maxTotalSize: Math.min(
1580
1581
  options.maxTotalSize ?? DEFAULT_OPTIONS.maxTotalSize,
1581
1582
  HARD_LIMITS.MAX_TOTAL_SIZE
1582
- )
1583
+ ),
1584
+ // Ensure fileTypes is never undefined
1585
+ fileTypes: options.fileTypes ?? DEFAULT_OPTIONS.fileTypes,
1586
+ skipSensitive: options.skipSensitive ?? DEFAULT_OPTIONS.skipSensitive,
1587
+ detectSecrets: options.detectSecrets ?? DEFAULT_OPTIONS.detectSecrets
1583
1588
  };
1584
1589
  const repoRoot = findGitRoot(startPath);
1585
1590
  logger.info("Scanning repository", { repoRoot, options: opts });
@@ -1728,7 +1733,7 @@ var tpsAuditSchemaObj = z7.object({
1728
1733
  "Path to repo root (auto-detects current directory if not provided)"
1729
1734
  ),
1730
1735
  focus_areas: z7.array(z7.string()).optional().describe("Specific areas to focus on (e.g., 'performance', 'security')"),
1731
- 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)"),
1732
1737
  file_types: z7.array(z7.string()).optional().describe("File extensions to include (e.g., ['.ts', '.js'])"),
1733
1738
  include_sensitive: z7.boolean().optional().describe(
1734
1739
  "Include potentially sensitive files (default: false, use with caution)"
@@ -1806,18 +1811,39 @@ async function handleTpsAudit(client2, models, input) {
1806
1811
  outputFormat
1807
1812
  };
1808
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
+ }
1809
1833
  function formatTpsAuditResults(auditResult) {
1810
1834
  const { results, scanResult, analysis, outputFormat } = auditResult;
1835
+ let content;
1811
1836
  switch (outputFormat) {
1812
1837
  case "html": {
1813
1838
  const templatePath = join4(getTemplatesDir(), "tps-report.html");
1814
- return formatResultsAsHtml(results, templatePath, {
1839
+ content = formatResultsAsHtml(results, templatePath, {
1815
1840
  analysis,
1816
1841
  repoName: scanResult.repoRoot.split("/").pop()
1817
1842
  });
1843
+ break;
1818
1844
  }
1819
1845
  case "json": {
1820
- return JSON.stringify(
1846
+ content = JSON.stringify(
1821
1847
  {
1822
1848
  analysis,
1823
1849
  scanStats: scanResult.stats,
@@ -1832,6 +1858,7 @@ function formatTpsAuditResults(auditResult) {
1832
1858
  null,
1833
1859
  2
1834
1860
  );
1861
+ break;
1835
1862
  }
1836
1863
  case "markdown":
1837
1864
  default: {
@@ -1878,7 +1905,7 @@ function formatTpsAuditResults(auditResult) {
1878
1905
  }
1879
1906
  }
1880
1907
  parts.push("\n## Model Perspectives\n");
1881
- results.forEach((r) => {
1908
+ for (const r of results) {
1882
1909
  if (r.error) {
1883
1910
  parts.push(`
1884
1911
  ### ${r.model}
@@ -1893,10 +1920,25 @@ ${r.review}
1893
1920
  `);
1894
1921
  }
1895
1922
  parts.push("\n---\n");
1896
- });
1897
- return parts.join("");
1923
+ }
1924
+ content = parts.join("");
1925
+ break;
1898
1926
  }
1899
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;
1900
1942
  }
1901
1943
 
1902
1944
  // src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klitchevo/code-council",
3
- "version": "0.0.13",
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",