@lousy-agents/cli 2.11.0 → 3.1.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.
@@ -45574,6 +45574,15 @@ const RulesetSchema = schemas_object({
45574
45574
  enforcement: schemas_string(),
45575
45575
  rules: schemas_array(RulesetRuleSchema).optional()
45576
45576
  });
45577
+ const RepoSecuritySchema = schemas_object({
45578
+ // biome-ignore lint/style/useNamingConvention: GitHub API schema requires snake_case
45579
+ security_and_analysis: schemas_object({
45580
+ // biome-ignore lint/style/useNamingConvention: GitHub API schema requires snake_case
45581
+ advanced_security: schemas_object({
45582
+ status: schemas_string()
45583
+ })
45584
+ }).optional()
45585
+ });
45577
45586
  /**
45578
45587
  * Parses a GitHub remote URL to extract owner and repo name
45579
45588
  */ function parseRepoFromRemoteUrl(remoteUrl) {
@@ -45648,6 +45657,24 @@ function defaultExec(command, args, options) {
45648
45657
  return null;
45649
45658
  }
45650
45659
  }
45660
+ async hasAdvancedSecurity(owner, repo) {
45661
+ if (!this.octokit) {
45662
+ return false;
45663
+ }
45664
+ try {
45665
+ const { data } = await this.octokit.rest.repos.get({
45666
+ owner,
45667
+ repo
45668
+ });
45669
+ const parsed = RepoSecuritySchema.safeParse(data);
45670
+ if (!parsed.success) {
45671
+ return false;
45672
+ }
45673
+ return parsed.data.security_and_analysis?.advanced_security?.status === "enabled";
45674
+ } catch {
45675
+ return false;
45676
+ }
45677
+ }
45651
45678
  async listRulesets(owner, repo) {
45652
45679
  if (!this.octokit) {
45653
45680
  throw new Error("Not authenticated");
@@ -45681,18 +45708,16 @@ function defaultExec(command, args, options) {
45681
45708
  }
45682
45709
  /**
45683
45710
  * Resolves a GitHub token from GH_TOKEN/GITHUB_TOKEN env vars, with gh CLI fallback
45684
- */ async function resolveGitHubToken() {
45685
- const envToken = process.env.GH_TOKEN || process.env.GITHUB_TOKEN;
45711
+ */ async function resolveGitHubToken(exec = defaultExec) {
45712
+ const envToken = process.env.GH_TOKEN?.trim() || process.env.GITHUB_TOKEN?.trim();
45686
45713
  if (envToken) {
45687
45714
  return envToken;
45688
45715
  }
45689
45716
  try {
45690
- const { stdout } = await execFileAsync("gh", [
45717
+ const { stdout } = await exec("gh", [
45691
45718
  "auth",
45692
45719
  "token"
45693
- ], {
45694
- encoding: "utf-8"
45695
- });
45720
+ ]);
45696
45721
  const token = stdout.trim();
45697
45722
  return token || null;
45698
45723
  } catch {