truecourse 0.1.16 → 0.1.17

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/cli.mjs CHANGED
@@ -13258,8 +13258,8 @@ var code_review_exports = {};
13258
13258
  __export(code_review_exports, {
13259
13259
  runCodeReviewCmd: () => runCodeReviewCmd
13260
13260
  });
13261
- async function runCodeReviewCmd({ noAutostart = false } = {}) {
13262
- we("Running code review");
13261
+ async function runCodeReviewCmd({ noAutostart = false, diff = false } = {}) {
13262
+ we(diff ? "Running code review (diff mode)" : "Running code review");
13263
13263
  if (noAutostart) {
13264
13264
  const url2 = getServerUrl();
13265
13265
  const res = await fetch(`${url2}/api/health`).catch(() => null);
@@ -13272,18 +13272,34 @@ async function runCodeReviewCmd({ noAutostart = false } = {}) {
13272
13272
  }
13273
13273
  const serverUrl = getServerUrl();
13274
13274
  const repo = await ensureRepo();
13275
- const analysesRes = await fetch(`${serverUrl}/api/repos/${repo.id}/analyses`);
13276
- if (!analysesRes.ok) {
13277
- v2.error("Failed to fetch analyses");
13278
- process.exit(1);
13279
- }
13280
- const analyses = await analysesRes.json();
13281
- if (analyses.length === 0) {
13282
- v2.error("No analysis found. Run 'truecourse analyze' first.");
13283
- process.exit(1);
13275
+ let analysisId;
13276
+ if (diff) {
13277
+ const diffRes = await fetch(`${serverUrl}/api/repos/${repo.id}/diff-check`);
13278
+ if (!diffRes.ok) {
13279
+ v2.error("Failed to fetch diff check");
13280
+ process.exit(1);
13281
+ }
13282
+ const diffResult = await diffRes.json();
13283
+ if (!diffResult?.diffAnalysisId) {
13284
+ v2.error("No diff analysis found. Run 'truecourse analyze --diff' first.");
13285
+ process.exit(1);
13286
+ }
13287
+ analysisId = diffResult.diffAnalysisId;
13288
+ v2.info(`Running code review on diff analysis (${analysisId.slice(0, 8)})`);
13289
+ } else {
13290
+ const analysesRes = await fetch(`${serverUrl}/api/repos/${repo.id}/analyses`);
13291
+ if (!analysesRes.ok) {
13292
+ v2.error("Failed to fetch analyses");
13293
+ process.exit(1);
13294
+ }
13295
+ const analyses = await analysesRes.json();
13296
+ if (analyses.length === 0) {
13297
+ v2.error("No analysis found. Run 'truecourse analyze' first.");
13298
+ process.exit(1);
13299
+ }
13300
+ analysisId = analyses[0].id;
13301
+ v2.info(`Running code review on latest analysis (${analysisId.slice(0, 8)})`);
13284
13302
  }
13285
- const latestAnalysis = analyses[0];
13286
- v2.info(`Running code review on latest analysis (${latestAnalysis.id.slice(0, 8)})`);
13287
13303
  const spinner = L2();
13288
13304
  spinner.start("Running code review...");
13289
13305
  const socket = connectSocket(repo.id);
@@ -13305,7 +13321,7 @@ async function runCodeReviewCmd({ noAutostart = false } = {}) {
13305
13321
  resolve2();
13306
13322
  }, 15 * 60 * 1e3);
13307
13323
  socket.on("code-review:ready", () => clearTimeout(timeout));
13308
- fetch(`${serverUrl}/api/repos/${repo.id}/analyses/${latestAnalysis.id}/code-review`, {
13324
+ fetch(`${serverUrl}/api/repos/${repo.id}/analyses/${analysisId}/code-review`, {
13309
13325
  method: "POST",
13310
13326
  headers: { "Content-Type": "application/json" }
13311
13327
  }).then((res) => {
@@ -13787,9 +13803,9 @@ program2.command("analyze").description("Analyze the current repository").option
13787
13803
  await runAnalyze({ noAutostart: !options.autostart, codeReview: options.codeReview ?? false });
13788
13804
  }
13789
13805
  });
13790
- program2.command("code-review").description("Run LLM code review on the latest analysis").option("--no-autostart", "Don't auto-start the server").action(async (options) => {
13806
+ program2.command("code-review").description("Run LLM code review on the latest analysis").option("--diff", "Run on the latest diff analysis instead").option("--no-autostart", "Don't auto-start the server").action(async (options) => {
13791
13807
  const { runCodeReviewCmd: runCodeReviewCmd2 } = await Promise.resolve().then(() => (init_code_review(), code_review_exports));
13792
- await runCodeReviewCmd2({ noAutostart: !options.autostart });
13808
+ await runCodeReviewCmd2({ noAutostart: !options.autostart, diff: options.diff ?? false });
13793
13809
  });
13794
13810
  program2.command("list").description("List violations from the latest analysis").option("--diff", "Show diff check results (new and resolved)").action(async (options) => {
13795
13811
  if (options.diff) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "truecourse",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "Visualize your codebase architecture as an interactive graph",
5
5
  "type": "module",
6
6
  "bin": {