putitoutthere 0.1.44 → 0.1.45

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/MIGRATIONS.md +82 -5
  3. package/README.md +16 -42
  4. package/action.yml +1 -1
  5. package/dist/cascade.d.ts +1 -1
  6. package/dist/cascade.js +2 -2
  7. package/dist/cli.d.ts +5 -0
  8. package/dist/cli.d.ts.map +1 -1
  9. package/dist/cli.js +7 -383
  10. package/dist/cli.js.map +1 -1
  11. package/dist/config.d.ts +6 -55
  12. package/dist/config.d.ts.map +1 -1
  13. package/dist/config.js +1 -32
  14. package/dist/config.js.map +1 -1
  15. package/dist/publish.d.ts +0 -10
  16. package/dist/publish.d.ts.map +1 -1
  17. package/dist/publish.js +6 -52
  18. package/dist/publish.js.map +1 -1
  19. package/dist/types.d.ts +1 -21
  20. package/dist/types.d.ts.map +1 -1
  21. package/dist/types.js.map +1 -1
  22. package/package.json +1 -1
  23. package/dist/auth.d.ts +0 -68
  24. package/dist/auth.d.ts.map +0 -1
  25. package/dist/auth.js +0 -285
  26. package/dist/auth.js.map +0 -1
  27. package/dist/doctor.d.ts +0 -115
  28. package/dist/doctor.d.ts.map +0 -1
  29. package/dist/doctor.js +0 -292
  30. package/dist/doctor.js.map +0 -1
  31. package/dist/keyring.d.ts +0 -35
  32. package/dist/keyring.d.ts.map +0 -1
  33. package/dist/keyring.js +0 -88
  34. package/dist/keyring.js.map +0 -1
  35. package/dist/oidc-policy.d.ts +0 -145
  36. package/dist/oidc-policy.d.ts.map +0 -1
  37. package/dist/oidc-policy.js +0 -388
  38. package/dist/oidc-policy.js.map +0 -1
  39. package/dist/preflight-run.d.ts +0 -47
  40. package/dist/preflight-run.d.ts.map +0 -1
  41. package/dist/preflight-run.js +0 -197
  42. package/dist/preflight-run.js.map +0 -1
  43. package/dist/registries/crates-trust.d.ts +0 -69
  44. package/dist/registries/crates-trust.d.ts.map +0 -1
  45. package/dist/registries/crates-trust.js +0 -95
  46. package/dist/registries/crates-trust.js.map +0 -1
  47. package/dist/release.d.ts +0 -36
  48. package/dist/release.d.ts.map +0 -1
  49. package/dist/release.js +0 -102
  50. package/dist/release.js.map +0 -1
  51. package/dist/token-scope.d.ts +0 -65
  52. package/dist/token-scope.d.ts.map +0 -1
  53. package/dist/token-scope.js +0 -163
  54. package/dist/token-scope.js.map +0 -1
  55. package/dist/token.d.ts +0 -211
  56. package/dist/token.d.ts.map +0 -1
  57. package/dist/token.js +0 -719
  58. package/dist/token.js.map +0 -1
package/dist/token.d.ts DELETED
@@ -1,211 +0,0 @@
1
- /**
2
- * `putitoutthere token inspect` — decode/introspect registry tokens.
3
- *
4
- * Scaffolding and PyPI offline decode: #107.
5
- * npm live probe: #108 (whoami + SHA-512 match against /-/npm/v1/tokens).
6
- * crates.io live probe: #109 (/api/v1/me + /api/v1/me/tokens).
7
- *
8
- * Dispatch is driven by token format, not by a hardcoded registry list:
9
- * - `pypi-` prefix → PyPI macaroon decode (offline, full scope)
10
- * - `npm_` prefix → npm (live probe)
11
- * - otherwise → crates.io (live probe), unless `--registry` overrides
12
- *
13
- * Token values are never logged. Logs identify a token by the first 8
14
- * hex chars of its SHA-256. Live probes are timeboxed at 5s per request.
15
- */
16
- import { type Package } from './config.js';
17
- import { type Keyring } from './keyring.js';
18
- export type Registry = 'pypi' | 'npm' | 'crates';
19
- export interface InspectOptions {
20
- token: string;
21
- registry?: Registry;
22
- /** Override live-probe base URL. Tests only. */
23
- baseUrl?: string;
24
- /** Override live-probe timeout in ms (default 5000). Tests only. */
25
- timeoutMs?: number;
26
- }
27
- export type InspectResult = PypiInspectResult | NpmInspectResult | CratesInspectResult | InspectErrorResult;
28
- interface BaseResult {
29
- registry: Registry;
30
- source_digest: string;
31
- }
32
- export interface PypiInspectResult extends BaseResult {
33
- registry: 'pypi';
34
- format: 'macaroon';
35
- identifier: Record<string, unknown> | null;
36
- restrictions: Restriction[];
37
- expired: boolean;
38
- }
39
- export type Restriction = {
40
- type: 'ProjectNames';
41
- names: string[];
42
- } | {
43
- type: 'ProjectIDs';
44
- ids: string[];
45
- } | {
46
- type: 'Date';
47
- not_before?: number;
48
- not_after?: number;
49
- } | {
50
- type: 'Unknown';
51
- raw: Record<string, unknown>;
52
- };
53
- export interface NpmScopeRow {
54
- readonly: boolean;
55
- automation: boolean;
56
- packages: string[] | null;
57
- scopes: string[] | null;
58
- orgs: string[] | null;
59
- expires_at: string | null;
60
- cidr_whitelist: string[] | null;
61
- created: string | null;
62
- }
63
- export interface NpmInspectResult extends BaseResult {
64
- registry: 'npm';
65
- format: 'granular' | 'legacy' | 'unknown';
66
- username: string;
67
- scope_row: NpmScopeRow | null;
68
- note?: string;
69
- }
70
- export interface CratesTokenRow {
71
- name: string;
72
- endpoint_scopes: string[] | null;
73
- crate_scopes: string[] | null;
74
- expired_at: string | null;
75
- }
76
- export interface CratesInspectResult extends BaseResult {
77
- registry: 'crates';
78
- username: string;
79
- account_tokens: CratesTokenRow[] | null;
80
- bearer_row: null;
81
- note: string;
82
- }
83
- export interface InspectErrorResult {
84
- registry: Registry | 'unknown';
85
- source_digest: string;
86
- error: string;
87
- }
88
- export declare function isError(r: InspectResult): r is InspectErrorResult;
89
- export declare function inspect(opts: InspectOptions): Promise<InspectResult>;
90
- export declare function detectRegistry(token: string): Registry;
91
- export interface TokenListRow {
92
- registry: Registry;
93
- source: 'env' | 'repo-secret' | 'environment-secret';
94
- name: string;
95
- details: string;
96
- /** Populated only when source = 'environment-secret'. */
97
- environment?: string;
98
- }
99
- export interface TokenListOptions {
100
- /** Working dir used to locate putitoutthere.toml when no `packages` is passed. */
101
- cwd?: string;
102
- configPath?: string;
103
- /** Env to scan. Defaults to process.env. */
104
- env?: NodeJS.ProcessEnv;
105
- /**
106
- * Override the packages list (skips config load). Tests pass this
107
- * directly; the CLI path loads it from disk.
108
- */
109
- packages?: readonly Package[];
110
- }
111
- /**
112
- * Enumerate registry tokens discoverable to the CLI from the environment.
113
- *
114
- * Classification is by *value format*:
115
- * - `pypi-` prefix → PyPI macaroon
116
- * - `npm_` prefix → npm granular
117
- * - opaque value under a crates-recognized env var, iff the config has a
118
- * crates package → crates.io
119
- *
120
- * Token values are never returned or logged.
121
- *
122
- * Issue #106. Ships env-only; `--secrets` (repo/env/org secret listing via
123
- * the stored GitHub user access token) is gated on #105.
124
- */
125
- export declare function tokenList(opts?: TokenListOptions): TokenListRow[];
126
- /**
127
- * Classify a GitHub Actions secret *by name* to a registry. The API never
128
- * exposes secret values, so prefix-by-value classification (the env-var
129
- * path) is unavailable here. Conservative: unrecognized names return
130
- * `null` and are omitted from the listing rather than dumping every
131
- * secret on the repo.
132
- *
133
- * Exact matches line up with `src/preflight.ts#TOKEN_ENV`, plus the
134
- * common `TWINE_PASSWORD` / `PYPI_TOKEN` aliases used in the wild.
135
- * Prefixed names (`NPM_FOO`, `PYPI_BAR`, `CARGO_FOO`, `TWINE_FOO`)
136
- * are treated as likely-registry.
137
- */
138
- export declare function classifySecretName(name: string): Registry | null;
139
- export interface SecretListOptions {
140
- /** Working dir used to resolve the git remote when `repo` is omitted. */
141
- cwd?: string;
142
- /** Repo as "owner/name". Defaults to $GITHUB_REPOSITORY or parsed from `git remote get-url origin`. */
143
- repo?: string;
144
- keyring?: Keyring;
145
- fetchFn?: typeof fetch;
146
- /** Per-request timeout. Defaults to 5000ms. */
147
- timeoutMs?: number;
148
- env?: NodeJS.ProcessEnv;
149
- }
150
- /**
151
- * Internal options type that additionally allows overriding the GitHub
152
- * API base URL. Kept off the public surface so an SDK caller cannot
153
- * redirect the request (which carries the stored user access token) to
154
- * an attacker-controlled host (#139). Only the `__testOnly` export
155
- * honors this field.
156
- */
157
- interface SecretListOptionsInternal extends SecretListOptions {
158
- apiBase?: string;
159
- }
160
- export interface EnvSecretError {
161
- environment: string;
162
- message: string;
163
- }
164
- export type SecretListOutcome = {
165
- kind: 'not_logged_in';
166
- message: string;
167
- } | {
168
- kind: 'no_repo';
169
- message: string;
170
- } | {
171
- kind: 'error';
172
- message: string;
173
- rows: TokenListRow[];
174
- } | {
175
- kind: 'ok';
176
- rows: TokenListRow[];
177
- envErrors?: EnvSecretError[];
178
- };
179
- /**
180
- * List GitHub Actions secrets (repo + environment) whose names look like
181
- * registry credentials. Uses the stored user access token from the
182
- * `Keyring` (populated by `auth login`).
183
- *
184
- * Secret *values* are never returned — the GitHub API doesn't expose
185
- * them. Classification is by name (see `classifySecretName`).
186
- *
187
- * Degrades gracefully: missing keyring, unresolvable repo, 401/403 from
188
- * GitHub, and network errors all become outcome kinds rather than
189
- * thrown errors. The caller decides whether to surface them.
190
- */
191
- export declare function tokenListSecrets(opts?: SecretListOptions): Promise<SecretListOutcome>;
192
- /**
193
- * Test-only entry point. Accepts an `apiBase` override so tests can
194
- * point at a mocked GitHub API. Not part of the public SDK surface —
195
- * do not re-export from the SDK index (#139).
196
- *
197
- * @internal
198
- */
199
- export declare function __tokenListSecretsForTests(opts: SecretListOptionsInternal): Promise<SecretListOutcome>;
200
- /**
201
- * Resolve "owner/repo" from, in order:
202
- * 1. `GITHUB_REPOSITORY` env var (CI case)
203
- * 2. `git remote get-url origin`, parsing common GitHub URL shapes:
204
- * - `https://github.com/owner/repo(.git)?`
205
- * - `git@github.com:owner/repo(.git)?`
206
- * - `ssh://git@github.com/owner/repo(.git)?`
207
- */
208
- export declare function resolveRepo(env: NodeJS.ProcessEnv, cwd: string): string | null;
209
- export declare function parseGithubRemote(url: string): string | null;
210
- export {};
211
- //# sourceMappingURL=token.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5D,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,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