@code-sentinel-cli/code-sentinel-cli 3.0.7 → 3.0.8

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/bin.js CHANGED
@@ -2383,11 +2383,11 @@ var definedBuildValue = (value, fallback) => typeof value === "string" && value.
2383
2383
  var getCliBuildMetadata = (version2) => ({
2384
2384
  version: version2,
2385
2385
  gitSha: definedBuildValue(
2386
- "dab1b770e3f0" ,
2386
+ "64891c9cc7b6" ,
2387
2387
  "unknown"
2388
2388
  ),
2389
2389
  buildTimestamp: definedBuildValue(
2390
- "2026-08-12T02:47:33.225Z" ,
2390
+ "2026-08-12T03:47:00.089Z" ,
2391
2391
  "unknown"
2392
2392
  ),
2393
2393
  configSchemaRange: definedBuildValue(
@@ -3454,11 +3454,30 @@ var runAnnotate = async (options) => {
3454
3454
 
3455
3455
  // src/auth/device-auth-client.ts
3456
3456
  var requestJson = async (serverUrl, path, init, fetchFn) => {
3457
- const response = await fetchFn(new URL(path, serverUrl), {
3458
- ...init,
3459
- headers: { accept: "application/json", "content-type": "application/json", ...init.headers }
3460
- });
3461
- const body = await response.json();
3457
+ let response;
3458
+ try {
3459
+ response = await fetchFn(new URL(path, serverUrl), {
3460
+ ...init,
3461
+ headers: { accept: "application/json", "content-type": "application/json", ...init.headers }
3462
+ });
3463
+ } catch (error) {
3464
+ throw new Error(
3465
+ `Failed to connect to ${serverUrl}: ${error instanceof Error ? error.message : "network error"}`
3466
+ );
3467
+ }
3468
+ const contentType = response.headers.get("content-type");
3469
+ if (!contentType || !contentType.includes("json")) {
3470
+ const text2 = await response.text().catch(() => "");
3471
+ throw new Error(
3472
+ `Unexpected non-JSON response from server (HTTP ${response.status}): ${text2.slice(0, 100).replace(/\s+/g, " ")}...`
3473
+ );
3474
+ }
3475
+ let body;
3476
+ try {
3477
+ body = await response.json();
3478
+ } catch {
3479
+ throw new Error(`Failed to parse JSON response from server (HTTP ${response.status})`);
3480
+ }
3462
3481
  return { status: response.status, body };
3463
3482
  };
3464
3483
  var startDeviceAuthorization = async (serverUrl, fetchFn = fetch) => {
@@ -3756,11 +3775,13 @@ try {
3756
3775
  $credential = [Runtime.InteropServices.Marshal]::PtrToStructure($credentialPtr, [type][CodeSentinelCredentialNative+CREDENTIAL])
3757
3776
  $bytes = New-Object byte[] $credential.CredentialBlobSize
3758
3777
  [Runtime.InteropServices.Marshal]::Copy($credential.CredentialBlob, $bytes, 0, $bytes.Length)
3759
- [Console]::Out.WriteLine([Convert]::ToBase64String($bytes))
3778
+ [Console]::Out.WriteLine("___CS_CLI_B64_START___$([Convert]::ToBase64String($bytes))___CS_CLI_B64_END___")
3760
3779
  } finally { [CodeSentinelCredentialNative]::CredFree($credentialPtr) }
3761
3780
  `
3762
3781
  );
3763
- return output2.trim() ? Buffer.from(output2.trim(), "base64").toString("utf8") : null;
3782
+ const match = output2.match(/___CS_CLI_B64_START___(.*?)___CS_CLI_B64_END___/);
3783
+ if (match?.[1]) return Buffer.from(match[1], "base64").toString("utf8");
3784
+ return null;
3764
3785
  }
3765
3786
  async write(service, account, value) {
3766
3787
  await this.run(
package/dist/index.d.ts CHANGED
@@ -625,12 +625,12 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
625
625
  groupBy: z.ZodDefault<z.ZodEnum<["severity", "file", "rule", "category"]>>;
626
626
  includeSnippets: z.ZodDefault<z.ZodBoolean>;
627
627
  }, "strip", z.ZodTypeAny, {
628
- format: "markdown" | "markdown-compact" | "json" | "sarif";
628
+ format: "json" | "markdown" | "markdown-compact" | "sarif";
629
629
  output: string;
630
630
  groupBy: "file" | "severity" | "category" | "rule";
631
631
  includeSnippets: boolean;
632
632
  }, {
633
- format?: "markdown" | "markdown-compact" | "json" | "sarif" | undefined;
633
+ format?: "json" | "markdown" | "markdown-compact" | "sarif" | undefined;
634
634
  output?: string | undefined;
635
635
  groupBy?: "file" | "severity" | "category" | "rule" | undefined;
636
636
  includeSnippets?: boolean | undefined;
@@ -1087,7 +1087,7 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
1087
1087
  };
1088
1088
  };
1089
1089
  report: {
1090
- format: "markdown" | "markdown-compact" | "json" | "sarif";
1090
+ format: "json" | "markdown" | "markdown-compact" | "sarif";
1091
1091
  output: string;
1092
1092
  groupBy: "file" | "severity" | "category" | "rule";
1093
1093
  includeSnippets: boolean;
@@ -1243,7 +1243,7 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
1243
1243
  } | undefined;
1244
1244
  } | undefined;
1245
1245
  report?: {
1246
- format?: "markdown" | "markdown-compact" | "json" | "sarif" | undefined;
1246
+ format?: "json" | "markdown" | "markdown-compact" | "sarif" | undefined;
1247
1247
  output?: string | undefined;
1248
1248
  groupBy?: "file" | "severity" | "category" | "rule" | undefined;
1249
1249
  includeSnippets?: boolean | undefined;
@@ -1399,7 +1399,7 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
1399
1399
  };
1400
1400
  };
1401
1401
  report: {
1402
- format: "markdown" | "markdown-compact" | "json" | "sarif";
1402
+ format: "json" | "markdown" | "markdown-compact" | "sarif";
1403
1403
  output: string;
1404
1404
  groupBy: "file" | "severity" | "category" | "rule";
1405
1405
  includeSnippets: boolean;
package/dist/index.js CHANGED
@@ -2383,11 +2383,11 @@ var definedBuildValue = (value, fallback) => typeof value === "string" && value.
2383
2383
  var getCliBuildMetadata = (version2) => ({
2384
2384
  version: version2,
2385
2385
  gitSha: definedBuildValue(
2386
- "dab1b770e3f0" ,
2386
+ "64891c9cc7b6" ,
2387
2387
  "unknown"
2388
2388
  ),
2389
2389
  buildTimestamp: definedBuildValue(
2390
- "2026-08-12T02:47:33.225Z" ,
2390
+ "2026-08-12T03:47:00.089Z" ,
2391
2391
  "unknown"
2392
2392
  ),
2393
2393
  configSchemaRange: definedBuildValue(
@@ -3454,11 +3454,30 @@ var runAnnotate = async (options) => {
3454
3454
 
3455
3455
  // src/auth/device-auth-client.ts
3456
3456
  var requestJson = async (serverUrl, path, init, fetchFn) => {
3457
- const response = await fetchFn(new URL(path, serverUrl), {
3458
- ...init,
3459
- headers: { accept: "application/json", "content-type": "application/json", ...init.headers }
3460
- });
3461
- const body = await response.json();
3457
+ let response;
3458
+ try {
3459
+ response = await fetchFn(new URL(path, serverUrl), {
3460
+ ...init,
3461
+ headers: { accept: "application/json", "content-type": "application/json", ...init.headers }
3462
+ });
3463
+ } catch (error) {
3464
+ throw new Error(
3465
+ `Failed to connect to ${serverUrl}: ${error instanceof Error ? error.message : "network error"}`
3466
+ );
3467
+ }
3468
+ const contentType = response.headers.get("content-type");
3469
+ if (!contentType || !contentType.includes("json")) {
3470
+ const text2 = await response.text().catch(() => "");
3471
+ throw new Error(
3472
+ `Unexpected non-JSON response from server (HTTP ${response.status}): ${text2.slice(0, 100).replace(/\s+/g, " ")}...`
3473
+ );
3474
+ }
3475
+ let body;
3476
+ try {
3477
+ body = await response.json();
3478
+ } catch {
3479
+ throw new Error(`Failed to parse JSON response from server (HTTP ${response.status})`);
3480
+ }
3462
3481
  return { status: response.status, body };
3463
3482
  };
3464
3483
  var startDeviceAuthorization = async (serverUrl, fetchFn = fetch) => {
@@ -3773,11 +3792,13 @@ try {
3773
3792
  $credential = [Runtime.InteropServices.Marshal]::PtrToStructure($credentialPtr, [type][CodeSentinelCredentialNative+CREDENTIAL])
3774
3793
  $bytes = New-Object byte[] $credential.CredentialBlobSize
3775
3794
  [Runtime.InteropServices.Marshal]::Copy($credential.CredentialBlob, $bytes, 0, $bytes.Length)
3776
- [Console]::Out.WriteLine([Convert]::ToBase64String($bytes))
3795
+ [Console]::Out.WriteLine("___CS_CLI_B64_START___$([Convert]::ToBase64String($bytes))___CS_CLI_B64_END___")
3777
3796
  } finally { [CodeSentinelCredentialNative]::CredFree($credentialPtr) }
3778
3797
  `
3779
3798
  );
3780
- return output2.trim() ? Buffer.from(output2.trim(), "base64").toString("utf8") : null;
3799
+ const match = output2.match(/___CS_CLI_B64_START___(.*?)___CS_CLI_B64_END___/);
3800
+ if (match?.[1]) return Buffer.from(match[1], "base64").toString("utf8");
3801
+ return null;
3781
3802
  }
3782
3803
  async write(service, account, value) {
3783
3804
  await this.run(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-sentinel-cli/code-sentinel-cli",
3
- "version": "3.0.7",
3
+ "version": "3.0.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "AI-assisted code review CLI for Angular, Spring Boot, and Flutter projects.",