@seekrit/cli 0.40.0 → 0.41.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.
- package/dist/index.js +516 -7
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1664,7 +1664,10 @@ const SYNC_PROVIDER_KINDS = [
|
|
|
1664
1664
|
"northflank",
|
|
1665
1665
|
"digitalocean",
|
|
1666
1666
|
"heroku",
|
|
1667
|
-
"netlify"
|
|
1667
|
+
"netlify",
|
|
1668
|
+
"bunnyshell",
|
|
1669
|
+
"github-actions",
|
|
1670
|
+
"gcp-secret-manager"
|
|
1668
1671
|
];
|
|
1669
1672
|
z.enum(SYNC_PROVIDER_KINDS);
|
|
1670
1673
|
/**
|
|
@@ -1869,6 +1872,82 @@ const netlifyConnectionConfigSchema = z.object({
|
|
|
1869
1872
|
/** Netlify team slug (`acme`) or account id — `{account_id}` accepts either. */
|
|
1870
1873
|
accountId: z.string().trim().min(1).max(128).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/, "must be a Netlify team slug or account ID — no slashes or spaces")
|
|
1871
1874
|
});
|
|
1875
|
+
/**
|
|
1876
|
+
* Bunnyshell account scope — empty, as Fly's, Heroku's, and Northflank's are.
|
|
1877
|
+
*
|
|
1878
|
+
* A Bunnyshell access token (from `environments.bunnyshell.com/access-token`)
|
|
1879
|
+
* belongs to a *user* and carries their access to every organization they are
|
|
1880
|
+
* in, exactly as a Heroku token does. Unlike Netlify's, that does not force an
|
|
1881
|
+
* organization onto the connection, because nothing here is addressed *through*
|
|
1882
|
+
* one: both variable collections name their parent by an opaque, globally
|
|
1883
|
+
* unique id (`environment` or `project`), so the token plus the destination's
|
|
1884
|
+
* id is the whole address. The API offers an `organization` filter, but it
|
|
1885
|
+
* narrows a listing — it is not part of an address.
|
|
1886
|
+
*/
|
|
1887
|
+
const bunnyshellConnectionConfigSchema = z.object({ provider: z.literal("bunnyshell") });
|
|
1888
|
+
/**
|
|
1889
|
+
* GitHub account scope — empty for github.com, which is the whole point.
|
|
1890
|
+
*
|
|
1891
|
+
* A GitHub token addresses everything by `{owner}/{repo}` or `{org}`, and those
|
|
1892
|
+
* are the destination's business, so there is no account half to state the way
|
|
1893
|
+
* Cloudflare and Netlify need one. `baseUrl` is the single exception, and it is
|
|
1894
|
+
* not an account scope at all: it names a **GitHub Enterprise Server** install,
|
|
1895
|
+
* whose API lives on the customer's own host rather than on `api.github.com`.
|
|
1896
|
+
*
|
|
1897
|
+
* Left unset for github.com and for Enterprise Cloud (which is `api.github.com`
|
|
1898
|
+
* with a different plan behind it). Set only for a self-hosted GHES appliance,
|
|
1899
|
+
* where the REST API is at `https://<host>/api/v3`.
|
|
1900
|
+
*/
|
|
1901
|
+
const githubActionsConnectionConfigSchema = z.object({
|
|
1902
|
+
provider: z.literal("github-actions"),
|
|
1903
|
+
/**
|
|
1904
|
+
* GitHub Enterprise Server API root, e.g. `https://github.acme.com/api/v3`.
|
|
1905
|
+
* Omit for github.com. Must be `https:` — this URL carries the token.
|
|
1906
|
+
*/
|
|
1907
|
+
baseUrl: z.string().trim().max(300).refine((value) => {
|
|
1908
|
+
let parsed;
|
|
1909
|
+
try {
|
|
1910
|
+
parsed = new URL(value);
|
|
1911
|
+
} catch {
|
|
1912
|
+
return false;
|
|
1913
|
+
}
|
|
1914
|
+
return parsed.protocol === "https:" && !parsed.username && !parsed.password;
|
|
1915
|
+
}, "must be an https:// URL — the GitHub Enterprise Server API root, e.g. https://github.acme.com/api/v3").optional()
|
|
1916
|
+
});
|
|
1917
|
+
/**
|
|
1918
|
+
* A Google Cloud project, as `projects/{project}` accepts one: either the
|
|
1919
|
+
* project **ID** (`acme-prod`, 6–30 characters, what the console shows) or the
|
|
1920
|
+
* project **number** (all digits). Both are accepted because both work, and
|
|
1921
|
+
* the id is the one an operator can read off their own dashboard.
|
|
1922
|
+
*
|
|
1923
|
+
* Validated by shape for the reason Cloudflare's account id is: every Secret
|
|
1924
|
+
* Manager URL is built from this string, and a typo would otherwise surface as
|
|
1925
|
+
* a 403 from Google hours later inside an alarm, with nobody watching.
|
|
1926
|
+
*/
|
|
1927
|
+
const gcpProjectSchema = z.string().trim().refine((value) => /^[a-z][a-z0-9-]{4,28}[a-z0-9]$/.test(value) || /^\d{1,20}$/.test(value), "must be a Google Cloud project ID (e.g. acme-prod) or project number");
|
|
1928
|
+
/**
|
|
1929
|
+
* Google Cloud project scope — which project's Secret Manager to write.
|
|
1930
|
+
*
|
|
1931
|
+
* The service account is *not* here, unlike AWS's access key id: a GCP
|
|
1932
|
+
* credential is a key JSON that names its own `client_email`, so the identity
|
|
1933
|
+
* arrives with the credential the way a Vercel token's does. What the
|
|
1934
|
+
* credential cannot say is which project to write, because a service account
|
|
1935
|
+
* can be granted access to secrets in projects other than its own — so that is
|
|
1936
|
+
* this field, exactly as Cloudflare's account id is.
|
|
1937
|
+
*
|
|
1938
|
+
* One project per connection. Syncing an environment into two projects means
|
|
1939
|
+
* two connections, which also keeps their key grants separate.
|
|
1940
|
+
*
|
|
1941
|
+
* Global secrets only: v1 addresses `secretmanager.googleapis.com`, not the
|
|
1942
|
+
* per-location `secretmanager.<location>.rep.googleapis.com` endpoints that
|
|
1943
|
+
* regional secrets live behind. Data residency is expressed instead through the
|
|
1944
|
+
* destination's user-managed replication.
|
|
1945
|
+
*/
|
|
1946
|
+
const gcpSecretManagerConnectionConfigSchema = z.object({
|
|
1947
|
+
provider: z.literal("gcp-secret-manager"),
|
|
1948
|
+
/** Project ID (`acme-prod`) or project number. */
|
|
1949
|
+
projectId: gcpProjectSchema
|
|
1950
|
+
});
|
|
1872
1951
|
const syncConnectionConfigSchema = z.discriminatedUnion("provider", [
|
|
1873
1952
|
vercelConnectionConfigSchema,
|
|
1874
1953
|
cloudflareWorkersConnectionConfigSchema,
|
|
@@ -1882,7 +1961,10 @@ const syncConnectionConfigSchema = z.discriminatedUnion("provider", [
|
|
|
1882
1961
|
northflankConnectionConfigSchema,
|
|
1883
1962
|
digitalOceanConnectionConfigSchema,
|
|
1884
1963
|
herokuConnectionConfigSchema,
|
|
1885
|
-
netlifyConnectionConfigSchema
|
|
1964
|
+
netlifyConnectionConfigSchema,
|
|
1965
|
+
bunnyshellConnectionConfigSchema,
|
|
1966
|
+
githubActionsConnectionConfigSchema,
|
|
1967
|
+
gcpSecretManagerConnectionConfigSchema
|
|
1886
1968
|
]);
|
|
1887
1969
|
/** Vercel's three deployment targets. A binding writes to one or more. */
|
|
1888
1970
|
const VERCEL_TARGETS = [
|
|
@@ -2307,6 +2389,292 @@ const netlifyDestinationSchema = z.object({
|
|
|
2307
2389
|
message: "a branch context needs the branch name it applies to",
|
|
2308
2390
|
path: ["branch"]
|
|
2309
2391
|
});
|
|
2392
|
+
/**
|
|
2393
|
+
* A Bunnyshell resource id, as the platform hands it out.
|
|
2394
|
+
*
|
|
2395
|
+
* Deliberately loose. Bunnyshell documents no format for these — they are
|
|
2396
|
+
* opaque strings from `bns environments list` or the dashboard URL — so
|
|
2397
|
+
* asserting a shape here would be inventing a rule the platform never stated,
|
|
2398
|
+
* and the failure mode would be seekrit refusing an id that works.
|
|
2399
|
+
*
|
|
2400
|
+
* Being loose is affordable here in a way it is not on Netlify, where an
|
|
2401
|
+
* unresolved `site_id` silently widens a write to the whole team. Both
|
|
2402
|
+
* Bunnyshell variable collections name their parent in the **request body** of
|
|
2403
|
+
* a create, as a required relation: an id the platform cannot resolve is a 422
|
|
2404
|
+
* naming the field, not a write that lands somewhere broader. The listing side
|
|
2405
|
+
* is fenced separately — the connector re-checks every variable's own parent
|
|
2406
|
+
* before it touches it, so a filter that failed to bite cannot turn into an
|
|
2407
|
+
* edit of a neighbouring environment's variables.
|
|
2408
|
+
*/
|
|
2409
|
+
const bunnyshellIdSchema = z.string().trim().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/, "must be a Bunnyshell ID — no slashes or spaces");
|
|
2410
|
+
/**
|
|
2411
|
+
* Variables on one Bunnyshell **environment** — the set every component in it
|
|
2412
|
+
* inherits, and the closest match to a seekrit environment.
|
|
2413
|
+
*
|
|
2414
|
+
* This is the destination for an environment that already exists and stays
|
|
2415
|
+
* around: a primary environment, or a long-lived ephemeral one.
|
|
2416
|
+
*/
|
|
2417
|
+
const bunnyshellEnvironmentDestinationSchema = z.object({
|
|
2418
|
+
provider: z.literal("bunnyshell"),
|
|
2419
|
+
kind: z.literal("environment"),
|
|
2420
|
+
/** Environment ID, as `bns environments list` prints it. */
|
|
2421
|
+
environmentId: bunnyshellIdSchema,
|
|
2422
|
+
/** Mark what seekrit creates as a Bunnyshell secret (default true). */
|
|
2423
|
+
secret: z.boolean().optional()
|
|
2424
|
+
});
|
|
2425
|
+
/**
|
|
2426
|
+
* Variables on a Bunnyshell **project** — inherited by every environment
|
|
2427
|
+
* created in it from then on.
|
|
2428
|
+
*
|
|
2429
|
+
* Worth thinking about twice, for the reason a Render environment group is:
|
|
2430
|
+
* the blast radius is the project, not one environment. It earns its place
|
|
2431
|
+
* anyway, because it is the only destination that reaches an environment which
|
|
2432
|
+
* *does not exist yet*. Bunnyshell's whole shape is ephemeral environments spun
|
|
2433
|
+
* up per branch or per pull request; pushing to the environment cannot seed one
|
|
2434
|
+
* that a webhook will create tomorrow, and pushing to the project can.
|
|
2435
|
+
*
|
|
2436
|
+
* An environment inherits the project's value at creation and may then be
|
|
2437
|
+
* overridden at its own scope — so a project binding does not fight an
|
|
2438
|
+
* environment binding pointed at the same name, it loses to it.
|
|
2439
|
+
*/
|
|
2440
|
+
const bunnyshellProjectDestinationSchema = z.object({
|
|
2441
|
+
provider: z.literal("bunnyshell"),
|
|
2442
|
+
kind: z.literal("project"),
|
|
2443
|
+
/** Project ID, as `bns projects list` prints it. */
|
|
2444
|
+
projectId: bunnyshellIdSchema,
|
|
2445
|
+
/** Mark what seekrit creates as a Bunnyshell secret (default true). */
|
|
2446
|
+
secret: z.boolean().optional()
|
|
2447
|
+
});
|
|
2448
|
+
/**
|
|
2449
|
+
* Where in Bunnyshell a binding writes.
|
|
2450
|
+
*
|
|
2451
|
+
* Split on `kind` rather than into two providers — the way Render's service and
|
|
2452
|
+
* environment group are, and unlike Cloudflare's three — because the two are the
|
|
2453
|
+
* same API twice over: `/v1/environment_variables` and `/v1/project_variables`
|
|
2454
|
+
* take the same fields, fail the same ways, and differ only in which parent they
|
|
2455
|
+
* name. One connector serves both, so one provider does too.
|
|
2456
|
+
*
|
|
2457
|
+
* `secret` is Bunnyshell's `isSecret`, and means less than Netlify's flag of the
|
|
2458
|
+
* same name: Bunnyshell encrypts every variable with an organization key whether
|
|
2459
|
+
* or not the flag is set, so this only decides whether the value is obscured in
|
|
2460
|
+
* the dashboard and stored encrypted in an exported definition. It is on by
|
|
2461
|
+
* default all the same — a value pushed from a secrets manager should not be
|
|
2462
|
+
* sitting in plain view of everyone with project access. It applies only to
|
|
2463
|
+
* variables seekrit **creates**: an update never sends the flag, so a variable
|
|
2464
|
+
* an operator deliberately un-secreted stays that way.
|
|
2465
|
+
*/
|
|
2466
|
+
const bunnyshellDestinationSchema = z.discriminatedUnion("kind", [bunnyshellEnvironmentDestinationSchema, bunnyshellProjectDestinationSchema]);
|
|
2467
|
+
/**
|
|
2468
|
+
* Which repositories in an organization can read an org-level secret.
|
|
2469
|
+
*
|
|
2470
|
+
* GitHub's own enum, unchanged. There is deliberately **no default**: `all` hands
|
|
2471
|
+
* the value to every repository in the organization — including ones added
|
|
2472
|
+
* tomorrow, and including forks' workflows to the extent the org allows them —
|
|
2473
|
+
* and that is not a blast radius a secrets manager should pick on an operator's
|
|
2474
|
+
* behalf. Naming it is the point.
|
|
2475
|
+
*/
|
|
2476
|
+
const GITHUB_ACTIONS_VISIBILITIES = [
|
|
2477
|
+
"all",
|
|
2478
|
+
"private",
|
|
2479
|
+
"selected"
|
|
2480
|
+
];
|
|
2481
|
+
/**
|
|
2482
|
+
* A GitHub account or organization login, matching GitHub's own rule:
|
|
2483
|
+
* alphanumeric with single internal hyphens, 39 characters at most.
|
|
2484
|
+
*
|
|
2485
|
+
* Checked here so the habitual slip — pasting a URL, or `owner/repo` into the
|
|
2486
|
+
* owner field — fails at the form rather than as a 404 from an alarm with nobody
|
|
2487
|
+
* watching.
|
|
2488
|
+
*/
|
|
2489
|
+
const githubOwnerSchema = z.string().trim().min(1).max(39).regex(/^[A-Za-z0-9](?:-?[A-Za-z0-9])*$/, "must be a GitHub user or organization login — not a URL or an owner/repo pair");
|
|
2490
|
+
/**
|
|
2491
|
+
* A repository name. GitHub's rules are looser than an owner's: letters,
|
|
2492
|
+
* numbers, hyphens, underscores, and periods, up to 100 characters. `.` and `..`
|
|
2493
|
+
* are refused outright — they would traverse the API path rather than name a
|
|
2494
|
+
* repository.
|
|
2495
|
+
*/
|
|
2496
|
+
const githubRepoSchema = z.string().trim().min(1).max(100).regex(/^[A-Za-z0-9._-]+$/, "must be a repository name alone (`api`), not `owner/repo` or a URL").refine((value) => value !== "." && value !== "..", "is not a repository name");
|
|
2497
|
+
/**
|
|
2498
|
+
* A deployment environment name.
|
|
2499
|
+
*
|
|
2500
|
+
* Deliberately permissive: GitHub allows spaces and most punctuation here, and
|
|
2501
|
+
* the dashboard shows names like `prod (eu-west)`. Only the two things that would
|
|
2502
|
+
* break the request are refused — an empty name, and the path separators that
|
|
2503
|
+
* would let a name escape its URL segment. Everything else is GitHub's to reject.
|
|
2504
|
+
*/
|
|
2505
|
+
const githubEnvironmentSchema = z.string().trim().min(1).max(255).refine((value) => !value.includes("/") && !value.includes("\\"), "cannot contain a slash — that is a path separator, not part of an environment name");
|
|
2506
|
+
/**
|
|
2507
|
+
* One repository's Actions secrets.
|
|
2508
|
+
*
|
|
2509
|
+
* Every workflow in the repository can read these, including one added by a pull
|
|
2510
|
+
* request from a collaborator with write access. That is GitHub's model, not a
|
|
2511
|
+
* choice this connector makes — but it is the reason `environment` exists below,
|
|
2512
|
+
* and the reason to prefer it for anything that touches production.
|
|
2513
|
+
*/
|
|
2514
|
+
const githubActionsRepoDestinationSchema = z.object({
|
|
2515
|
+
provider: z.literal("github-actions"),
|
|
2516
|
+
kind: z.literal("repo"),
|
|
2517
|
+
/** Repository owner — a user or organization login. */
|
|
2518
|
+
owner: githubOwnerSchema,
|
|
2519
|
+
/** Repository name, without the owner. */
|
|
2520
|
+
repo: githubRepoSchema
|
|
2521
|
+
});
|
|
2522
|
+
/**
|
|
2523
|
+
* One deployment environment's Actions secrets — the narrowest scope GitHub has.
|
|
2524
|
+
*
|
|
2525
|
+
* A job reads these only by declaring `environment: <name>`, which also subjects
|
|
2526
|
+
* it to that environment's protection rules: required reviewers, wait timers, and
|
|
2527
|
+
* the branch policy. That combination is the closest GitHub gets to "this secret
|
|
2528
|
+
* is for production, and reaching it requires approval", and it is the scope to
|
|
2529
|
+
* reach for by default.
|
|
2530
|
+
*
|
|
2531
|
+
* The environment must already exist. This connector will not create one: an
|
|
2532
|
+
* environment is a deployment gate, and silently creating an unprotected one
|
|
2533
|
+
* because a name was misspelled would quietly remove the protection the operator
|
|
2534
|
+
* was relying on.
|
|
2535
|
+
*/
|
|
2536
|
+
const githubActionsEnvironmentDestinationSchema = z.object({
|
|
2537
|
+
provider: z.literal("github-actions"),
|
|
2538
|
+
kind: z.literal("environment"),
|
|
2539
|
+
owner: githubOwnerSchema,
|
|
2540
|
+
repo: githubRepoSchema,
|
|
2541
|
+
/** Environment name, exactly as the repository's Settings → Environments shows it. */
|
|
2542
|
+
environment: githubEnvironmentSchema
|
|
2543
|
+
});
|
|
2544
|
+
/**
|
|
2545
|
+
* An organization's Actions secrets.
|
|
2546
|
+
*
|
|
2547
|
+
* The widest scope in the product, and the only destination on any provider that
|
|
2548
|
+
* can hand a value to repositories nobody named. Read {@link
|
|
2549
|
+
* GITHUB_ACTIONS_VISIBILITIES} before using it.
|
|
2550
|
+
*
|
|
2551
|
+
* `selectedRepositoryIds` takes numeric repository **ids**, not names, because
|
|
2552
|
+
* that is what GitHub's API takes. An id is visible at
|
|
2553
|
+
* `GET /repos/{owner}/{repo}` as `id`, and in the dashboard nowhere at all —
|
|
2554
|
+
* which is friction worth accepting rather than resolving names to ids here: name
|
|
2555
|
+
* resolution would mean this connector picking which repository an ambiguous
|
|
2556
|
+
* name meant, and getting that wrong widens a secret's reach silently.
|
|
2557
|
+
*/
|
|
2558
|
+
const githubActionsOrgDestinationSchema = z.object({
|
|
2559
|
+
provider: z.literal("github-actions"),
|
|
2560
|
+
kind: z.literal("org"),
|
|
2561
|
+
/** Organization login. */
|
|
2562
|
+
org: githubOwnerSchema,
|
|
2563
|
+
/** Which repositories may read these secrets. Stated, never defaulted. */
|
|
2564
|
+
visibility: z.enum(GITHUB_ACTIONS_VISIBILITIES),
|
|
2565
|
+
/** Numeric repository ids, required when `visibility` is `selected`. */
|
|
2566
|
+
selectedRepositoryIds: z.array(z.number().int().positive()).max(500).optional()
|
|
2567
|
+
}).refine((dest) => dest.visibility !== "selected" || dest.selectedRepositoryIds !== void 0 && dest.selectedRepositoryIds.length > 0, {
|
|
2568
|
+
message: "selected visibility needs at least one repository id",
|
|
2569
|
+
path: ["selectedRepositoryIds"]
|
|
2570
|
+
}).refine((dest) => dest.visibility === "selected" || dest.selectedRepositoryIds === void 0, {
|
|
2571
|
+
message: "repository ids only apply to selected visibility — remove them, or select it",
|
|
2572
|
+
path: ["selectedRepositoryIds"]
|
|
2573
|
+
});
|
|
2574
|
+
const githubActionsDestinationSchema = z.discriminatedUnion("kind", [
|
|
2575
|
+
githubActionsRepoDestinationSchema,
|
|
2576
|
+
githubActionsEnvironmentDestinationSchema,
|
|
2577
|
+
githubActionsOrgDestinationSchema
|
|
2578
|
+
]);
|
|
2579
|
+
/**
|
|
2580
|
+
* How a binding lays its secrets out in Secret Manager. The same two shapes the
|
|
2581
|
+
* AWS Secrets Manager destination offers, and for the same reasons:
|
|
2582
|
+
*
|
|
2583
|
+
* - `secret-per-name` — one GCP secret per seekrit secret. The direct
|
|
2584
|
+
* translation, and what Cloud Run's `--set-secrets` and GKE's Secret Manager
|
|
2585
|
+
* CSI driver mount one at a time.
|
|
2586
|
+
* - `json-bundle` — every value as one JSON object in a single secret. Costs one
|
|
2587
|
+
* active version instead of fifty, which is the whole billing unit here.
|
|
2588
|
+
*/
|
|
2589
|
+
const GCP_SECRET_MANAGER_LAYOUTS = ["secret-per-name", "json-bundle"];
|
|
2590
|
+
/**
|
|
2591
|
+
* Where Google keeps the copies of a secret. Chosen at creation and
|
|
2592
|
+
* **immutable** afterwards — changing it means deleting the secret and letting
|
|
2593
|
+
* the next run recreate it.
|
|
2594
|
+
*
|
|
2595
|
+
* - `automatic` — Google picks the locations. One billable replica, and what
|
|
2596
|
+
* you want unless a policy says otherwise.
|
|
2597
|
+
* - `user-managed` — the binding names the regions. This is how data residency
|
|
2598
|
+
* is expressed for global secrets, and each region is billed as its own
|
|
2599
|
+
* active version.
|
|
2600
|
+
*/
|
|
2601
|
+
const GCP_REPLICATION_POLICIES = ["automatic", "user-managed"];
|
|
2602
|
+
/**
|
|
2603
|
+
* A Secret Manager secret ID. Google's own rule, quoted from the API reference:
|
|
2604
|
+
* "a string with a maximum length of 255 characters and can contain uppercase
|
|
2605
|
+
* and lowercase letters, numerals, and the hyphen (`-`) and underscore (`_`)
|
|
2606
|
+
* characters."
|
|
2607
|
+
*
|
|
2608
|
+
* Notably **no slashes and no dots**, which is what makes this a different
|
|
2609
|
+
* field from AWS's `pathPrefix` rather than the same idea renamed: a Secret
|
|
2610
|
+
* Manager namespace is spelled `prod-storefront-DB_URL`, not
|
|
2611
|
+
* `prod/storefront/DB_URL`.
|
|
2612
|
+
*/
|
|
2613
|
+
const gcpSecretIdSchema = z.string().trim().min(1).max(255).regex(/^[A-Za-z0-9_-]+$/, "may contain letters, digits, hyphens, and underscores");
|
|
2614
|
+
/**
|
|
2615
|
+
* A GCP region for a user-managed replica (`us-east1`, `europe-west4`,
|
|
2616
|
+
* `northamerica-northeast1`). Validated by shape rather than against a list,
|
|
2617
|
+
* because Google adds regions faster than we ship — a name Secret Manager does
|
|
2618
|
+
* not know is refused by Google with a clear message at creation.
|
|
2619
|
+
*/
|
|
2620
|
+
const gcpLocationSchema = z.string().trim().regex(/^[a-z]+-[a-z]+\d+$/, "must be a GCP region ID, e.g. us-east1");
|
|
2621
|
+
/**
|
|
2622
|
+
* A Cloud KMS key, as its full resource name — the only form the API accepts:
|
|
2623
|
+
* `projects/p/locations/l/keyRings/r/cryptoKeys/k`.
|
|
2624
|
+
*
|
|
2625
|
+
* Stricter than AWS's `kmsKeyId` (which tolerates five spellings) because
|
|
2626
|
+
* Google tolerates exactly one, and because a key in the wrong *location* is
|
|
2627
|
+
* rejected at creation: an automatic-replication secret needs a `global` key,
|
|
2628
|
+
* and a user-managed replica needs one in its own region.
|
|
2629
|
+
*/
|
|
2630
|
+
const gcpKmsKeyNameSchema = z.string().trim().max(1024).regex(/^projects\/[^/]+\/locations\/[^/]+\/keyRings\/[^/]+\/cryptoKeys\/[^/]+$/, "must be a full Cloud KMS key name (projects/…/locations/…/keyRings/…/cryptoKeys/…)");
|
|
2631
|
+
/**
|
|
2632
|
+
* Where inside a project's Secret Manager a binding writes.
|
|
2633
|
+
*
|
|
2634
|
+
* ## Every push would otherwise cost a version
|
|
2635
|
+
*
|
|
2636
|
+
* Secret Manager has no "set the value" call — only `addVersion`, which appends.
|
|
2637
|
+
* A run pushes the whole environment (never a diff), so changing one secret in
|
|
2638
|
+
* an environment of fifty would leave fifty new versions behind, forty-nine of
|
|
2639
|
+
* them identical to their predecessors, each one billed for as long as it stays
|
|
2640
|
+
* active.
|
|
2641
|
+
*
|
|
2642
|
+
* So this connector writes a version only when the value actually changed,
|
|
2643
|
+
* decided from a keyed digest it keeps in the secret's own **annotations** — see
|
|
2644
|
+
* `apps/api/src/lib/sync/connectors/gcp-secret-manager.ts` for why it is keyed
|
|
2645
|
+
* and what that costs. `pruneVersions` is the other half of the bill: with it
|
|
2646
|
+
* on, the version a push supersedes is destroyed as soon as the new one lands,
|
|
2647
|
+
* so a secret keeps exactly one active version.
|
|
2648
|
+
*/
|
|
2649
|
+
const gcpSecretManagerDestinationSchema = z.object({
|
|
2650
|
+
provider: z.literal("gcp-secret-manager"),
|
|
2651
|
+
layout: z.enum(GCP_SECRET_MANAGER_LAYOUTS).default("secret-per-name"),
|
|
2652
|
+
/**
|
|
2653
|
+
* `secret-per-name` only: prepended to every secret ID, e.g.
|
|
2654
|
+
* `prod-storefront-`. Optional, but strongly advised in a project that holds
|
|
2655
|
+
* anything else — without it a binding writes at the root of a namespace it
|
|
2656
|
+
* does not own, and Secret Manager has no folders to hide behind.
|
|
2657
|
+
*/
|
|
2658
|
+
idPrefix: z.string().trim().max(200).regex(/^[A-Za-z0-9_-]*$/, "may contain letters, digits, hyphens, and underscores").optional(),
|
|
2659
|
+
/** `json-bundle` only: the one secret that holds every value, e.g. `prod-storefront-env`. */
|
|
2660
|
+
secretId: gcpSecretIdSchema.optional(),
|
|
2661
|
+
replication: z.enum(GCP_REPLICATION_POLICIES).default("automatic"),
|
|
2662
|
+
/** `user-managed` only: the regions to replicate to. At least one. */
|
|
2663
|
+
locations: z.array(gcpLocationSchema).min(1).max(16).optional(),
|
|
2664
|
+
/** Customer-managed encryption key. Omitted means Google-managed keys. */
|
|
2665
|
+
kmsKeyName: gcpKmsKeyNameSchema.optional(),
|
|
2666
|
+
/** Destroy the version each push supersedes, keeping one active version. */
|
|
2667
|
+
pruneVersions: z.boolean().optional()
|
|
2668
|
+
}).refine((d) => d.layout !== "json-bundle" || d.secretId !== void 0, {
|
|
2669
|
+
message: "a json-bundle destination needs the ID of the secret to write",
|
|
2670
|
+
path: ["secretId"]
|
|
2671
|
+
}).refine((d) => d.replication !== "user-managed" || (d.locations?.length ?? 0) > 0, {
|
|
2672
|
+
message: "user-managed replication needs at least one location",
|
|
2673
|
+
path: ["locations"]
|
|
2674
|
+
}).refine((d) => d.kmsKeyName === void 0 || d.replication === "automatic" || (d.locations?.length ?? 0) === 1, {
|
|
2675
|
+
message: "a customer-managed key covers one location — use automatic replication, or a single location",
|
|
2676
|
+
path: ["kmsKeyName"]
|
|
2677
|
+
});
|
|
2310
2678
|
const syncDestinationSchema = z.discriminatedUnion("provider", [
|
|
2311
2679
|
vercelDestinationSchema,
|
|
2312
2680
|
cloudflareWorkersDestinationSchema,
|
|
@@ -2320,7 +2688,10 @@ const syncDestinationSchema = z.discriminatedUnion("provider", [
|
|
|
2320
2688
|
northflankDestinationSchema,
|
|
2321
2689
|
digitalOceanDestinationSchema,
|
|
2322
2690
|
herokuDestinationSchema,
|
|
2323
|
-
netlifyDestinationSchema
|
|
2691
|
+
netlifyDestinationSchema,
|
|
2692
|
+
bunnyshellDestinationSchema,
|
|
2693
|
+
githubActionsDestinationSchema,
|
|
2694
|
+
gcpSecretManagerDestinationSchema
|
|
2324
2695
|
]);
|
|
2325
2696
|
/**
|
|
2326
2697
|
* How seekrit secret names become destination key names. Applied in order:
|
|
@@ -3526,7 +3897,7 @@ function isCliSessionToken(value) {
|
|
|
3526
3897
|
}
|
|
3527
3898
|
//#endregion
|
|
3528
3899
|
//#region package.json
|
|
3529
|
-
var version = "0.
|
|
3900
|
+
var version = "0.41.0";
|
|
3530
3901
|
//#endregion
|
|
3531
3902
|
//#region ../../packages/api-client/src/index.ts
|
|
3532
3903
|
var SeekritApiError = class extends Error {
|
|
@@ -7643,6 +8014,61 @@ function assertNetlifySite(value) {
|
|
|
7643
8014
|
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(site)) fail(`--netlify-site "${site}" is not a site API ID — Netlify shows it under Project configuration → General → Project information, and it is a UUID, not the site name or its .netlify.app address`);
|
|
7644
8015
|
return site;
|
|
7645
8016
|
}
|
|
8017
|
+
/**
|
|
8018
|
+
* A Bunnyshell environment or project ID, as the platform hands it out.
|
|
8019
|
+
*
|
|
8020
|
+
* Checked only for shape, not format: Bunnyshell documents none for these, so
|
|
8021
|
+
* asserting one would be inventing a rule and refusing IDs that work. Both
|
|
8022
|
+
* variable collections name their parent in the **body** of a create, as a
|
|
8023
|
+
* required relation, so an ID Bunnyshell cannot resolve is a 422 naming the
|
|
8024
|
+
* field — not a write that lands somewhere wider. That is why this is loose
|
|
8025
|
+
* where {@link assertNetlifySite} is strict.
|
|
8026
|
+
*/
|
|
8027
|
+
function assertBunnyshellId(value, flag) {
|
|
8028
|
+
if (!value) fail(`${flag} is required for bunnyshell (the ID from \`bns\` or the dashboard URL)`);
|
|
8029
|
+
const id = value.trim();
|
|
8030
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.test(id)) fail(`${flag} "${id}" is not a Bunnyshell ID — no slashes or spaces`);
|
|
8031
|
+
return id;
|
|
8032
|
+
}
|
|
8033
|
+
/**
|
|
8034
|
+
* Split `--gh-repo owner/name` into the two halves GitHub's paths need.
|
|
8035
|
+
*
|
|
8036
|
+
* Taken as one flag rather than two because `owner/name` is how GitHub writes a
|
|
8037
|
+
* repository everywhere — in its URLs, in `gh repo view`, in every workflow file —
|
|
8038
|
+
* and asking for it in two pieces invites the mistake of pasting the pair into
|
|
8039
|
+
* one of them.
|
|
8040
|
+
*/
|
|
8041
|
+
function assertGithubRepo(value) {
|
|
8042
|
+
if (!value) fail("--gh-repo is required for github-actions (owner/name)");
|
|
8043
|
+
const parts = value.trim().split("/");
|
|
8044
|
+
if (parts.length !== 2 || !parts[0] || !parts[1]) fail(`--gh-repo "${value}" should be owner/name, e.g. acme/storefront`);
|
|
8045
|
+
const [owner, repo] = parts;
|
|
8046
|
+
if (!/^[A-Za-z0-9](?:-?[A-Za-z0-9])*$/.test(owner) || owner.length > 39) fail(`--gh-repo owner "${owner}" is not a GitHub login`);
|
|
8047
|
+
if (!/^[A-Za-z0-9._-]+$/.test(repo) || repo === "." || repo === "..") fail(`--gh-repo name "${repo}" is not a repository name`);
|
|
8048
|
+
return {
|
|
8049
|
+
owner,
|
|
8050
|
+
repo
|
|
8051
|
+
};
|
|
8052
|
+
}
|
|
8053
|
+
/** Parse `--gh-repo-ids 1,2,3` — GitHub's org endpoint takes numeric ids, not names. */
|
|
8054
|
+
function assertRepoIds(raw) {
|
|
8055
|
+
const parts = list(raw, "");
|
|
8056
|
+
if (parts.length === 0) fail("--gh-repo-ids is required with `--gh-visibility selected` — numeric repository IDs, which `gh api repos/<owner>/<name> --jq .id` prints");
|
|
8057
|
+
return parts.map((part) => {
|
|
8058
|
+
const id = Number(part);
|
|
8059
|
+
if (!Number.isInteger(id) || id <= 0) fail(`--gh-repo-ids "${part}" is not a repository ID — GitHub takes numeric IDs, not names`);
|
|
8060
|
+
return id;
|
|
8061
|
+
});
|
|
8062
|
+
}
|
|
8063
|
+
/**
|
|
8064
|
+
* What `sync connect` calls the secret it reads from stdin. Only the wording
|
|
8065
|
+
* differs — every provider's credential is wrapped the same way.
|
|
8066
|
+
*/
|
|
8067
|
+
function credentialNoun(provider) {
|
|
8068
|
+
if (provider.startsWith("aws-")) return "secret access key";
|
|
8069
|
+
if (provider === "gcp-secret-manager") return "service-account key JSON";
|
|
8070
|
+
return "API token";
|
|
8071
|
+
}
|
|
7646
8072
|
/** Account-scope config for a connection (never the credential itself). */
|
|
7647
8073
|
function buildConfig(provider, options) {
|
|
7648
8074
|
switch (provider) {
|
|
@@ -7686,6 +8112,17 @@ function buildConfig(provider, options) {
|
|
|
7686
8112
|
provider: "netlify",
|
|
7687
8113
|
accountId: options.accountId
|
|
7688
8114
|
};
|
|
8115
|
+
case "bunnyshell": return { provider: "bunnyshell" };
|
|
8116
|
+
case "github-actions": return {
|
|
8117
|
+
provider: "github-actions",
|
|
8118
|
+
...options.baseUrl ? { baseUrl: options.baseUrl } : {}
|
|
8119
|
+
};
|
|
8120
|
+
case "gcp-secret-manager":
|
|
8121
|
+
if (!options.projectId) fail("--project-id is required for gcp-secret-manager — the project ID (or number) whose Secret Manager to write");
|
|
8122
|
+
return {
|
|
8123
|
+
provider: "gcp-secret-manager",
|
|
8124
|
+
projectId: options.projectId
|
|
8125
|
+
};
|
|
7689
8126
|
}
|
|
7690
8127
|
}
|
|
7691
8128
|
/** Where inside the platform a binding writes. */
|
|
@@ -7819,6 +8256,71 @@ function buildDestination(provider, options) {
|
|
|
7819
8256
|
secret: options.netlifySecret !== false
|
|
7820
8257
|
};
|
|
7821
8258
|
}
|
|
8259
|
+
case "bunnyshell": {
|
|
8260
|
+
const environmentId = options.bunnyshellEnvironment?.trim();
|
|
8261
|
+
const projectId = options.project?.trim();
|
|
8262
|
+
if (environmentId && projectId) fail("pass --bunnyshell-environment or --project for bunnyshell, not both — a binding writes to one");
|
|
8263
|
+
const secret = options.bunnyshellSecret !== false;
|
|
8264
|
+
if (projectId) return {
|
|
8265
|
+
provider: "bunnyshell",
|
|
8266
|
+
kind: "project",
|
|
8267
|
+
projectId: assertBunnyshellId(projectId, "--project"),
|
|
8268
|
+
secret
|
|
8269
|
+
};
|
|
8270
|
+
return {
|
|
8271
|
+
provider: "bunnyshell",
|
|
8272
|
+
kind: "environment",
|
|
8273
|
+
environmentId: assertBunnyshellId(environmentId, "--bunnyshell-environment"),
|
|
8274
|
+
secret
|
|
8275
|
+
};
|
|
8276
|
+
}
|
|
8277
|
+
case "github-actions": {
|
|
8278
|
+
if (options.ghOrg) {
|
|
8279
|
+
if (options.ghRepo || options.ghEnvironment) fail("--gh-org writes organization secrets — drop --gh-repo and --gh-environment");
|
|
8280
|
+
const visibility = assertMember(options.ghVisibility, GITHUB_ACTIONS_VISIBILITIES, "--gh-visibility", "private");
|
|
8281
|
+
if (visibility !== "selected" && options.ghRepoIds) fail(`--gh-repo-ids only applies to \`--gh-visibility selected\`, not ${visibility}`);
|
|
8282
|
+
return {
|
|
8283
|
+
provider: "github-actions",
|
|
8284
|
+
kind: "org",
|
|
8285
|
+
org: options.ghOrg.trim(),
|
|
8286
|
+
visibility,
|
|
8287
|
+
...visibility === "selected" ? { selectedRepositoryIds: assertRepoIds(options.ghRepoIds) } : {}
|
|
8288
|
+
};
|
|
8289
|
+
}
|
|
8290
|
+
const { owner, repo } = assertGithubRepo(options.ghRepo);
|
|
8291
|
+
const environment = options.ghEnvironment?.trim();
|
|
8292
|
+
if (!environment) return {
|
|
8293
|
+
provider: "github-actions",
|
|
8294
|
+
kind: "repo",
|
|
8295
|
+
owner,
|
|
8296
|
+
repo
|
|
8297
|
+
};
|
|
8298
|
+
return {
|
|
8299
|
+
provider: "github-actions",
|
|
8300
|
+
kind: "environment",
|
|
8301
|
+
owner,
|
|
8302
|
+
repo,
|
|
8303
|
+
environment
|
|
8304
|
+
};
|
|
8305
|
+
}
|
|
8306
|
+
case "gcp-secret-manager": {
|
|
8307
|
+
const layout = assertMember(options.layout, GCP_SECRET_MANAGER_LAYOUTS, "--layout", "secret-per-name");
|
|
8308
|
+
if (layout === "json-bundle" && !options.secretName) fail("--secret-name is required for --layout json-bundle (the one secret to write)");
|
|
8309
|
+
const replication = assertMember(options.gcpReplication, GCP_REPLICATION_POLICIES, "--gcp-replication", "automatic");
|
|
8310
|
+
const locations = options.gcpLocations ? list(options.gcpLocations, "") : [];
|
|
8311
|
+
if (replication === "user-managed" && locations.length === 0) fail("--gcp-locations is required with --gcp-replication user-managed, e.g. us-east1");
|
|
8312
|
+
if (options.gcpKmsKey && replication === "user-managed" && locations.length > 1) fail("--gcp-kms-key covers one location — use automatic replication, or a single --gcp-locations entry");
|
|
8313
|
+
return {
|
|
8314
|
+
provider: "gcp-secret-manager",
|
|
8315
|
+
layout,
|
|
8316
|
+
replication,
|
|
8317
|
+
...options.gcpPrefix ? { idPrefix: options.gcpPrefix } : {},
|
|
8318
|
+
...layout === "json-bundle" && options.secretName ? { secretId: options.secretName } : {},
|
|
8319
|
+
...replication === "user-managed" ? { locations } : {},
|
|
8320
|
+
...options.gcpKmsKey ? { kmsKeyName: options.gcpKmsKey } : {},
|
|
8321
|
+
...options.gcpPruneVersions ? { pruneVersions: true } : {}
|
|
8322
|
+
};
|
|
8323
|
+
}
|
|
7822
8324
|
}
|
|
7823
8325
|
}
|
|
7824
8326
|
/** One-line description of a destination, for list output. */
|
|
@@ -7837,6 +8339,13 @@ function describeDestination(destination) {
|
|
|
7837
8339
|
case "digitalocean": return `${destination.appId}${destination.kind === "component" ? ` / ${destination.componentName}` : ""} (${destination.scope})`;
|
|
7838
8340
|
case "heroku": return destination.app;
|
|
7839
8341
|
case "netlify": return `${destination.siteId} (${destination.contexts.map((context) => context === "branch" ? `branch @${destination.branch}` : context).join(", ")})`;
|
|
8342
|
+
case "bunnyshell": return destination.kind === "environment" ? `environment ${destination.environmentId}` : `project ${destination.projectId} (inherited by new environments)`;
|
|
8343
|
+
case "gcp-secret-manager": return destination.layout === "json-bundle" ? `${destination.secretId} · json` : `${destination.idPrefix ?? ""}* · one per name`;
|
|
8344
|
+
case "github-actions": switch (destination.kind) {
|
|
8345
|
+
case "repo": return `${destination.owner}/${destination.repo}`;
|
|
8346
|
+
case "environment": return `${destination.owner}/${destination.repo} @${destination.environment}`;
|
|
8347
|
+
case "org": return `org ${destination.org} (${destination.visibility}${destination.selectedRepositoryIds ? `: ${destination.selectedRepositoryIds.length} repos` : ""})`;
|
|
8348
|
+
}
|
|
7840
8349
|
}
|
|
7841
8350
|
}
|
|
7842
8351
|
/**
|
|
@@ -7847,7 +8356,7 @@ function describeDestination(destination) {
|
|
|
7847
8356
|
* application whose environment the binding reads from.
|
|
7848
8357
|
*/
|
|
7849
8358
|
function destinationOptions(command) {
|
|
7850
|
-
return command.option("--project <id>", "vercel: project id or name · cloudflare-pages / northflank: project name or slug").option("--target <list>", "vercel / cloudflare-pages: comma-separated deployment targets", "production").option("--git-branch <branch>", "vercel: restrict preview writes to one branch").option("--script <name>", "cloudflare-workers: Worker script name").option("--store-id <id>", "cloudflare-secrets-store: store ID (32 hex)").option("--scopes <list>", "cloudflare-secrets-store: comma-separated scopes", "workers").option("--railway-project <id>", "railway: project ID (a UUID)").option("--railway-environment <id>", "railway: environment ID (a UUID)").option("--service <id>", "railway: service ID (omit for the environment's shared variables) · render: service ID (srv-…, or crn-… for a cron job)").option("--skip-deploys", "railway: stage values without triggering a redeploy").option("--path <path>", "aws-parameter-store: hierarchy, e.g. /prod/storefront/ · aws-secrets-manager: name prefix").option("--layout <layout>", `aws-secrets-manager: ${AWS_SECRETS_MANAGER_LAYOUTS.join(" | ")}`).option("--secret-name <name>", "aws-secrets-manager: the secret a json-bundle writes to").option("--param-type <type>", `aws-parameter-store: ${AWS_PARAMETER_TYPES.join(" | ")}`).option("--tier <tier>", `aws-parameter-store: ${AWS_PARAMETER_TIERS.join(" | ")}`).option("--kms-key-id <id>", "aws: customer-managed KMS key id, ARN, or alias").option("--env-group <id>", "render: environment group ID (evg-…)").option("--fly-app <name>", "fly: app name, as `fly apps list` shows it").option("--secret-group <id>", "northflank: secret group ID (the slug in its URL)").option("--do-app <id>", "digitalocean: App Platform app ID (the UUID in its URL)").option("--component <name>", "digitalocean: write to one component's variables (omit for app-level)").option("--env-scope <scope>", `digitalocean: ${DIGITALOCEAN_ENV_SCOPES.join(" | ")}`).option("--heroku-app <name>", "heroku: app name, as `heroku apps` shows it (or its UUID)").option("--netlify-site <id>", "netlify: site API ID (the UUID under Project configuration)").option("--no-netlify-secret", "netlify: create readable variables instead of Netlify secrets (write-only)");
|
|
8359
|
+
return command.option("--project <id>", "vercel: project id or name · cloudflare-pages / northflank: project name or slug · bunnyshell: project ID (writes variables new environments inherit)").option("--target <list>", "vercel / cloudflare-pages: comma-separated deployment targets", "production").option("--git-branch <branch>", "vercel: restrict preview writes to one branch").option("--script <name>", "cloudflare-workers: Worker script name").option("--store-id <id>", "cloudflare-secrets-store: store ID (32 hex)").option("--scopes <list>", "cloudflare-secrets-store: comma-separated scopes", "workers").option("--railway-project <id>", "railway: project ID (a UUID)").option("--railway-environment <id>", "railway: environment ID (a UUID)").option("--service <id>", "railway: service ID (omit for the environment's shared variables) · render: service ID (srv-…, or crn-… for a cron job)").option("--skip-deploys", "railway: stage values without triggering a redeploy").option("--path <path>", "aws-parameter-store: hierarchy, e.g. /prod/storefront/ · aws-secrets-manager: name prefix").option("--layout <layout>", `aws-secrets-manager: ${AWS_SECRETS_MANAGER_LAYOUTS.join(" | ")}`).option("--secret-name <name>", "aws-secrets-manager: the secret a json-bundle writes to").option("--param-type <type>", `aws-parameter-store: ${AWS_PARAMETER_TYPES.join(" | ")}`).option("--tier <tier>", `aws-parameter-store: ${AWS_PARAMETER_TIERS.join(" | ")}`).option("--kms-key-id <id>", "aws: customer-managed KMS key id, ARN, or alias").option("--env-group <id>", "render: environment group ID (evg-…)").option("--fly-app <name>", "fly: app name, as `fly apps list` shows it").option("--secret-group <id>", "northflank: secret group ID (the slug in its URL)").option("--do-app <id>", "digitalocean: App Platform app ID (the UUID in its URL)").option("--component <name>", "digitalocean: write to one component's variables (omit for app-level)").option("--env-scope <scope>", `digitalocean: ${DIGITALOCEAN_ENV_SCOPES.join(" | ")}`).option("--heroku-app <name>", "heroku: app name, as `heroku apps` shows it (or its UUID)").option("--netlify-site <id>", "netlify: site API ID (the UUID under Project configuration)").option("--no-netlify-secret", "netlify: create readable variables instead of Netlify secrets (write-only)").option("--bunnyshell-environment <id>", "bunnyshell: environment ID (omit to write a project)").option("--no-bunnyshell-secret", "bunnyshell: create variables visible in the dashboard instead of secret ones").option("--gh-repo <owner/name>", "github-actions: repository, e.g. acme/storefront").option("--gh-environment <name>", "github-actions: write to one deployment environment's secrets (needs --gh-repo)").option("--gh-org <login>", "github-actions: write organization secrets instead of a repo's").option("--gh-visibility <v>", `github-actions org secrets: ${GITHUB_ACTIONS_VISIBILITIES.join(" | ")}`).option("--gh-repo-ids <ids>", "github-actions: comma-separated numeric repository IDs for --gh-visibility selected").option("--gcp-prefix <prefix>", "gcp: prepended to every secret ID, e.g. prod-storefront-").option("--gcp-replication <policy>", `gcp: ${GCP_REPLICATION_POLICIES.join(" | ")}`, "automatic").option("--gcp-locations <list>", "gcp: regions for user-managed replication, e.g. us-east1").option("--gcp-kms-key <name>", "gcp: Cloud KMS key (projects/…/cryptoKeys/…)").option("--gcp-prune-versions", "gcp: destroy the version each push supersedes, keeping one active version");
|
|
7851
8360
|
}
|
|
7852
8361
|
/** Find a connection by id or name — nobody keeps `syc_…` ids in their head. */
|
|
7853
8362
|
async function resolveConnection(ctx, orgId, ref) {
|
|
@@ -7871,11 +8380,11 @@ function registerSyncCommands(program) {
|
|
|
7871
8380
|
col("id", (c) => c.id)
|
|
7872
8381
|
], "no connections — add one with `seekrit sync connect`"));
|
|
7873
8382
|
});
|
|
7874
|
-
sync.command("connect").description("register a destination account (reads its API token from stdin)").option("--org <slug>").requiredOption("--name <name>", "what to call this account, e.g. acme-vercel").option("--provider <kind>", SYNC_PROVIDER_KINDS.join(" | "), "vercel").option("--team-id <id>", "vercel: Team id (omit for a personal account)").option("--token-kind <kind>", `railway: ${RAILWAY_TOKEN_KINDS.join(" | ")}`, "account").option("--account-id <id>", "cloudflare: account ID (32 hex, from the dashboard sidebar) · netlify: team slug or account ID").option("--region <region>", "aws: region ID, e.g. us-east-1").option("--access-key-id <id>", "aws: IAM access key ID (the secret key is read from stdin)").action(async (options) => {
|
|
8383
|
+
sync.command("connect").description("register a destination account (reads its API token from stdin)").option("--org <slug>").requiredOption("--name <name>", "what to call this account, e.g. acme-vercel").option("--provider <kind>", SYNC_PROVIDER_KINDS.join(" | "), "vercel").option("--team-id <id>", "vercel: Team id (omit for a personal account)").option("--token-kind <kind>", `railway: ${RAILWAY_TOKEN_KINDS.join(" | ")}`, "account").option("--account-id <id>", "cloudflare: account ID (32 hex, from the dashboard sidebar) · netlify: team slug or account ID").option("--region <region>", "aws: region ID, e.g. us-east-1").option("--access-key-id <id>", "aws: IAM access key ID (the secret key is read from stdin)").option("--base-url <url>", "github-actions: GitHub Enterprise Server API root (omit for github.com)").option("--project-id <id>", "gcp: project ID or number whose Secret Manager to write").action(async (options) => {
|
|
7875
8384
|
const provider = assertProvider(options.provider);
|
|
7876
8385
|
const ctx = buildContext();
|
|
7877
8386
|
const ref = await resolveOrg(ctx, options.org);
|
|
7878
|
-
const noun = provider
|
|
8387
|
+
const noun = credentialNoun(provider);
|
|
7879
8388
|
const credential = (process.stdin.isTTY ? await promptHidden(`${provider} ${noun}: `) : await readStdin()).trim();
|
|
7880
8389
|
if (!credential) fail(`no ${noun} given`);
|
|
7881
8390
|
const id = randomId("syc");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seekrit/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "End-to-end encrypted secrets manager CLI — inject decrypted secrets into any command.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"@types/node": "^26.1.0",
|
|
28
28
|
"tsdown": "^0.22.3",
|
|
29
29
|
"vitest": "^4.1.9",
|
|
30
|
+
"@seekrit/api-client": "0.0.1",
|
|
30
31
|
"@seekrit/core": "0.0.1",
|
|
31
|
-
"@seekrit/crypto": "0.0.1"
|
|
32
|
-
"@seekrit/api-client": "0.0.1"
|
|
32
|
+
"@seekrit/crypto": "0.0.1"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "tsdown",
|