keypin 0.0.0-stage → 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Caio Pizzol
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,105 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset=".github/assets/keypin-dark.svg">
4
+ <img src=".github/assets/keypin.svg" width="80" height="80" alt="keypin">
5
+ </picture>
6
+ </p>
2
7
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
8
+ <h1 align="center">keypin</h1>
9
+
10
+ <p align="center">
11
+ A map of every app key across your projects, published to the account it's pinned to.
12
+ <br>
13
+ Values stay in your vault.
14
+ </p>
15
+
16
+ <p align="center">
17
+ <img src="https://img.shields.io/badge/status-pre--release-8A5300" alt="Pre-release">
18
+ <img src="https://img.shields.io/badge/license-MIT-121311" alt="MIT">
19
+ <img src="https://img.shields.io/badge/runtime-Bun-121311" alt="Bun">
20
+ </p>
21
+
22
+ Each project lists its keys in a `keypin.toml`: names, vault items and destinations, never values. keypin reads
23
+ values from 1Password only while a command runs, and writes them nowhere on disk.
24
+
25
+ ## Requirements
26
+
27
+ - [Bun](https://bun.sh) 1.4.4 or newer. keypin refuses an older one, because Bun 1.3.12 misparses some TOML.
28
+ - The [1Password](https://1password.com/downloads) desktop app
29
+
30
+ ## Install
31
+
32
+ ```sh
33
+ bun add -g keypin
34
+ ```
35
+
36
+ ### From source
37
+
38
+ With git and [Node](https://nodejs.org) 22.18+ (the installer runs on Node):
39
+
40
+ ```sh
41
+ git clone https://github.com/caiopizzol/keypin.git ~/keypin
42
+ cd ~/keypin
43
+ bunx --package vite-plus@1.5.1 vp install
44
+ alias keypin='bunx bun@1.4.4 ~/keypin/apps/cli/src/main.ts'
45
+ ```
46
+
47
+ Add the alias to your shell profile. Package scripts don't load aliases, so call
48
+ `bunx bun@1.4.4 ~/keypin/apps/cli/src/main.ts` in full there.
49
+
50
+ > [!IMPORTANT]
51
+ > Run the install command again after every `git pull`, or keypin can't find its own packages.
52
+
53
+ ## Set up
54
+
55
+ 1. **1Password:** in Settings → Developer, under "Integrate with the 1Password SDKs", select **Integrate with other
56
+ apps**. 1Password then asks you to approve each keypin command.
57
+ 2. **Each vault item** needs:
58
+ - the value in its `password` field;
59
+ - a Date field `rotated`: the day the value last changed;
60
+ - a Text field `rotate_every`: `<n>d`, `<n>w`, `<n>m` or `never` (or set it in `keypin.toml`).
61
+ 3. **Each project:**
62
+
63
+ ```sh
64
+ cd ~/code/my-project
65
+ keypin init # registers the folder and writes a commented keypin.toml
66
+ $EDITOR keypin.toml
67
+ keypin status # exit 0 means no problems
68
+ ```
69
+
70
+ ## Commands
71
+
72
+ ```sh
73
+ keypin init [folder] # register a project and write a keypin.toml template
74
+ keypin unregister [folder] # stop listing a project; its keypin.toml stays
75
+ keypin status [--json] # every key, its rotation dates and receipts, then problems
76
+ keypin run -- <command> # run a command with the project's dev keys in its environment
77
+ keypin publish <key-id> # check accounts, show the plan, then write the key to every destination
78
+ ```
79
+
80
+ `publish` writes `prod` by default (`--env dev` for dev). It checks each destination is the account the map pins,
81
+ skips destinations that already have this value, and asks you to type `yes` before a first write or an account
82
+ change. `--yes` never gives that approval.
83
+
84
+ Destinations: GitHub Actions secrets (with `gh`'s login) and Cloudflare Worker secrets (with wrangler's login).
85
+
86
+ ## Notes
87
+
88
+ - **Cloudflare Workers:** `wrangler dev` passes environment variables to the Worker only for names in
89
+ `secrets.required`, and a `.dev.vars` file overrides them. Delete `.dev.vars`, then `keypin run -- wrangler dev`.
90
+ - **macOS only for now:** the Cloudflare destination reads wrangler's login from its macOS path.
91
+ - **Files on your machine:** the project registry (`~/.config/keypin/registry.json`) and receipts
92
+ (`~/.local/state/keypin/state.json`). Both honor `XDG_CONFIG_HOME` and `XDG_STATE_HOME`.
93
+
94
+ ## Development
95
+
96
+ ```sh
97
+ bun run check # format, lint and type-check
98
+ bun run test # tests
99
+ bun run typecheck # tsc in every package
100
+ ```
101
+
102
+ Install with the command above, never a plain `bun install`: Bun 1.3 rewrites `bun.lock` in an older format.
103
+
104
+ Releases: Release Please keeps a release PR open. On it, select **Approve workflows to run** so `check` runs, then
105
+ merge it to tag, create the GitHub Release and publish to npm.
@@ -0,0 +1,33 @@
1
+ // @bun
2
+ var __require = import.meta.require;
3
+
4
+ // src/install.ts
5
+ import { fileURLToPath } from "url";
6
+
7
+ // src/errors.ts
8
+ function messageOf(error) {
9
+ return error instanceof Error ? error.message : String(error);
10
+ }
11
+ function errorCode(error) {
12
+ if (error instanceof Error && "code" in error && typeof error.code === "string")
13
+ return error.code;
14
+ return;
15
+ }
16
+
17
+ // src/install.ts
18
+ var INSTALL = "bunx --package vite-plus@1.5.1 vp install";
19
+ var REINSTALL = "bun add -g keypin";
20
+ function checkout() {
21
+ if (!import.meta.url.endsWith("/apps/cli/src/install.ts"))
22
+ return null;
23
+ return fileURLToPath(new URL("../../..", import.meta.url)).replace(/\/$/, "");
24
+ }
25
+ function installProblem(error, repo = checkout()) {
26
+ if (errorCode(error) !== "ERR_MODULE_NOT_FOUND")
27
+ return null;
28
+ const name = /'([^']+)'/.exec(messageOf(error))?.[1];
29
+ const fix = repo === null ? `reinstall keypin with "${REINSTALL}"` : `run "${INSTALL}" in ${repo}`;
30
+ return `${name ? `the package ${name}` : "a package"} isn't installed; ${fix}`;
31
+ }
32
+
33
+ export { __require, messageOf, errorCode, installProblem };