Skip to content

feat: 🎸 create ~/.site and site files from 1password at install - #58

Open
ChrisHirsch wants to merge 2 commits into
mainfrom
feat/site_from_1password
Open

ChrisHirsch wants to merge 2 commits into
mainfrom
feat/site_from_1password

Conversation

@ChrisHirsch

Copy link
Copy Markdown
Owner

Sign in to 1Password if needed, then fetch the site document and each SITE_FILES entry with op inject, never overwriting existing files and stopping on failure. Add macos/defaults.sh for hidden files in Finder and key repeat.

Sign in to 1Password if needed, then fetch the site document and
each SITE_FILES entry with op inject, never overwriting existing
files and stopping on failure. Add macos/defaults.sh for hidden
files in Finder and key repeat.
Comment thread README.md

1. Copy `~/.site` from the old Mac (see [Site settings](#site-settings-site)). It can hold tokens, so move it through a password manager, not a repo.
2. Clone the private Claude config repo and list it in `CLAUDE_EXTRA_DIRS` (see [Claude Code](#claude-code)).
1. Make sure the machine's site document exists in 1Password (see [Site settings](#site-settings-site)). The install script creates `~/.site` and the site's other files from it.
Comment thread README.md
1. Copy `~/.site` from the old Mac (see [Site settings](#site-settings-site)). It can hold tokens, so move it through a password manager, not a repo.
2. Clone the private Claude config repo and list it in `CLAUDE_EXTRA_DIRS` (see [Claude Code](#claude-code)).
1. Make sure the machine's site document exists in 1Password (see [Site settings](#site-settings-site)). The install script creates `~/.site` and the site's other files from it.
2. Clone the private Claude config repo, and list it in `CLAUDE_EXTRA_DIRS` in the site document (see [Claude Code](#claude-code)).
Comment thread README.md
During the install script:

- rebuilds the Dock and sets the system keyboard shortcuts
- after `brew bundle`, the script signs in to 1Password if needed (Touch ID with the app's CLI integration, or your password for an account added with `op account add`), then asks which site document to use
Comment thread README.md
During the install script:

- rebuilds the Dock and sets the system keyboard shortcuts
- after `brew bundle`, the script signs in to 1Password if needed (Touch ID with the app's CLI integration, or your password for an account added with `op account add`), then asks which site document to use
Comment thread README.md

- rebuilds the Dock and sets the system keyboard shortcuts
- after `brew bundle`, the script signs in to 1Password if needed (Touch ID with the app's CLI integration, or your password for an account added with `op account add`), then asks which site document to use
- the macOS step shows hidden files in Finder, makes held keys repeat, rebuilds the Dock, and sets the system keyboard shortcuts
Comment thread README.md

The `site_settings` step of the install script:

1. Creates `~/.site` from the site document you choose (default `chris_site_macbook`), with each secret reference replaced by its value.
Comment thread README.md
The `site_settings` step of the install script:

1. Creates `~/.site` from the site document you choose (default `chris_site_macbook`), with each secret reference replaced by its value.
2. Creates each file in the site's `SITE_FILES` the same way. Entries are `document:path`, separated by spaces, so document names can't contain spaces.
Comment thread README.md
1. Creates `~/.site` from the site document you choose (default `chris_site_macbook`), with each secret reference replaced by its value.
2. Creates each file in the site's `SITE_FILES` the same way. Entries are `document:path`, separated by spaces, so document names can't contain spaces.

It never overwrites an existing file; it warns and skips it. To refresh a file from 1Password, move it aside and re-run the script. Files are created with mode `600`. If `op` can't reach the vault or a reference doesn't resolve, the script stops; fix the problem and re-run it. `SITE_OP_VAULT` and `SITE_OP_DOCUMENT` override the vault and the default document.
Comment thread README.md

```bash
op document create ~/site.tpl --title acme_site --vault Clients
op document get acme_site --vault Clients | op inject > /dev/null && echo ok # check the references resolve
Comment thread README.md
command rm ~/site.tpl
```

To change one: `op document get acme_site --vault Clients > ~/site.tpl`, edit the file, run `op document edit acme_site ~/site.tpl --vault Clients`, and delete the local copy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants