npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yhonda/gcloud-secrets

v3.2.1

Published

Google Drive + age 暗号化でシークレットを管理する CLI ツール

Readme

@yhonda/gcloud-secrets

複数の GCP プロジェクトの .env / .dev.vars を1つの Secret Manager で一元管理する CLI ツール。

Claude Code のスキルとしても利用可能。

概要

Secret Manager (中央プロジェクト)
├── project-a/ [dev]
│   ├── DATABASE_URL
│   ├── API_KEY
│   └── CLOUDFLARE_SECRET
├── project-a/ [prod]
│   ├── DATABASE_URL
│   └── API_KEY
├── project-b/ [dev]
│   ├── DATABASE_URL
│   └── STRIPE_KEY
└── project-c/
    └── ...

インストール

npm install -g @yhonda/gcloud-secrets

前提条件

  • Node.js 18 以上
  • GCP 認証済み(gcloud auth application-default login

初期設定

gcloud-secrets init <project-id> [--env <default-env>]

設定は ~/.secrets-manager.conf に保存されます。

CLI コマンド

基本操作

# フォルダ一覧(環境ごとにグループ化)
gcloud-secrets list

# フォルダ内のシークレット一覧
gcloud-secrets list my-project --env dev

# シークレットを取得(.env 形式で標準出力)
gcloud-secrets pull my-project --env prod

# シークレットをアップロード
gcloud-secrets push my-project .env --env dev

スキャン & 検索

# 全リポジトリの .env 同期状況をスキャン
gcloud-secrets scan

# 指定パス以下をスキャン(特定環境のみ)
gcloud-secrets scan ~/projects --env dev

# 値から逆引き検索
gcloud-secrets search "api-key-12345"

自動同期 (pre-commit hook)

# グローバル git hook をインストール(全リポジトリ対象)
gcloud-secrets hook install

# アンインストール
gcloud-secrets hook uninstall

# 手動実行
gcloud-secrets pre-commit

hook install すると、全リポジトリで git commit のたびに .env が自動で Secret Manager に同期されます。

高速化の仕組み:

  • キャッシュ (~/.secrets-manager-cache.json) で .env の変更を検知
  • 変更なし → 0 API コール(即座に終了)
  • 変更あり → フィルタ付き API + 並列取得で高速チェック&自動 push
  • 常に exit 0(commit をブロックしない)
  • 既存の .husky/.git/hooks/ と互換性あり

環境 (Environment)

--env または -e で環境を指定できます:

gcloud-secrets push --env dev     # dev 環境にアップロード
gcloud-secrets pull -e prod       # prod 環境から取得
gcloud-secrets scan --env staging # staging のみスキャン

デフォルト環境は ~/.secrets-manager.confDEFAULT_ENVIRONMENT で設定。

コマンド一覧

| コマンド | 説明 | |---------|------| | init <project-id> [--env <default>] | 中央プロジェクトを設定 | | list [folder] [--env <env>] | 一覧表示 | | pull [folder] [--env <env>] | シークレットを取得 | | push [folder] [file] [--env <env>] | アップロード | | scan [basePath] [--env <env>] | Git リポジトリの同期状況をスキャン | | search <keyword> [--env <env>] | 値から逆引き検索 | | pre-commit | .env 自動同期(git hook 用) | | hook install | グローバル git hook をインストール | | hook uninstall | グローバル git hook をアンインストール |

フォルダ名の正規化

ディレクトリ名は自動で kebab-case に変換されます:

  • gcloudSecgcloud-sec
  • myAppTestmy-app-test

シークレット名の形式

{folder}_{env}_{KEY} (例: gcloud-sec_dev_DATABASE_URL)

設定

環境変数または設定ファイルで中央プロジェクトを指定:

# 環境変数
export SECRETS_CENTRAL_PROJECT=your-project-id

# または設定ファイル (~/.secrets-manager.conf)
SECRETS_CENTRAL_PROJECT=your-project-id
DEFAULT_ENVIRONMENT=dev

Claude Code スキル

インストール時に ~/.claude/skills/secrets.md が自動作成され、/secrets コマンドが使えます:

  • 「このプロジェクトの .env を Secret Manager にアップロードして」
  • 「dev 環境のシークレットを確認して」
  • 「全リポジトリの同期状況をスキャンして」

ライセンス

MIT