@oc-forge/secret 0.1.0 → 0.1.1

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 (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +41 -78
  3. package/bin/secret +2 -0
  4. package/package.json +2 -2
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 oc-forge
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,115 +1,78 @@
1
1
  # @oc-forge/secret
2
2
 
3
- **Infisical secret management CLI with local caching for OpenClaw teams**
3
+ Infisical secret management CLI with local caching. Built for [OpenClaw](https://openclaw.ai) teams.
4
4
 
5
- 一个用于管理 [Infisical](https://infisical.com) secrets 的命令行工具,带本地缓存,专为 OpenClaw 团队设计。
6
-
7
- ---
8
-
9
- ## 安装 / Installation
10
-
11
- 需要 [Bun](https://bun.sh) runtime(v1.0+)。
5
+ ## Install
12
6
 
13
7
  ```bash
14
8
  npm i -g @oc-forge/secret
15
- # 或
16
- bun add -g @oc-forge/secret
17
9
  ```
18
10
 
19
- 安装后即可使用 `secret` 命令。
20
-
21
- ---
22
-
23
- ## 配置 / Configuration
11
+ > Requires [Bun](https://bun.sh) runtime (`curl -fsSL https://bun.sh/install | bash`)
24
12
 
25
- ### 方式一:配置文件(推荐)
13
+ ## Configure
26
14
 
27
- 创建 `~/.config/openclaw-fleet/config.json`:
15
+ ### Option 1: Config file (recommended)
28
16
 
29
- ```json
17
+ ```bash
18
+ mkdir -p ~/.config/openclaw-fleet
19
+ cat > ~/.config/openclaw-fleet/config.json << 'EOF'
30
20
  {
31
- "clientId": "your-machine-identity-client-id",
32
- "clientSecret": "your-machine-identity-client-secret",
21
+ "clientId": "your-infisical-client-id",
22
+ "clientSecret": "your-infisical-client-secret",
33
23
  "projectId": "your-infisical-project-id",
34
- "env": "dev"
24
+ "env": "dev",
25
+ "ttlMs": 86400000
35
26
  }
27
+ EOF
28
+ chmod 600 ~/.config/openclaw-fleet/config.json
36
29
  ```
37
30
 
38
- ### 方式二:环境变量
31
+ ### Option 2: Environment variables
39
32
 
40
33
  ```bash
41
- export INFISICAL_CLIENT_ID="your-client-id"
42
- export INFISICAL_CLIENT_SECRET="your-client-secret"
43
- export INFISICAL_PROJECT_ID="your-project-id"
44
- export INFISICAL_ENV="dev" # 可选,默认 dev
34
+ export INFISICAL_CLIENT_ID="..."
35
+ export INFISICAL_CLIENT_SECRET="..."
36
+ export INFISICAL_PROJECT_ID="..."
37
+ export INFISICAL_ENV="dev"
45
38
  ```
46
39
 
47
- > ⚠️ 不要将实际凭证提交到代码仓库。
48
-
49
- ---
50
-
51
- ## 命令 / Commands
40
+ ## Usage
52
41
 
53
42
  ```bash
54
- # 获取 secret(优先读取缓存)
55
- secret get <KEY>
56
- secret get <KEY> --fresh # 强制从 Infisical 拉取最新值
57
-
58
- # 设置 / 更新 secret
59
- secret set <KEY> <VALUE>
60
-
61
- # 列出所有 secret keys
62
- secret list
63
- secret list --show # 同时显示值
64
-
65
- # 全量同步到本地缓存
66
- secret sync
67
-
68
- # 注入所有 secrets 为环境变量并运行命令
69
- secret exec -- <command> [args...]
70
-
71
- # 帮助
72
- secret --help
43
+ secret list [--show] # List all secret keys (--show to reveal values)
44
+ secret get <KEY> # Get a secret value (cached)
45
+ secret get <KEY> --fresh # Get from Infisical (bypass cache)
46
+ secret set <KEY> <VALUE> # Create or update a secret
47
+ secret sync # Sync all secrets to local cache
48
+ secret exec -- <cmd> # Run command with secrets injected as env vars
73
49
  ```
74
50
 
75
- ### 示例 / Examples
51
+ ## Examples
76
52
 
77
53
  ```bash
78
- # 获取数据库密码
79
- secret get DATABASE_URL
54
+ # List all secrets
55
+ secret list
80
56
 
81
- # 设置 API key
82
- secret set OPENAI_API_KEY sk-...
57
+ # Get a specific secret
58
+ secret get GITHUB_TOKEN
83
59
 
84
- # 注入 secrets 运行应用
85
- secret exec -- node server.js
60
+ # Set a new secret
61
+ secret set MY_API_KEY sk-xxxxx
86
62
 
87
- # 同步所有 secrets 到缓存
88
- secret sync
63
+ # Run a command with all secrets as environment variables
64
+ secret exec -- node server.js
89
65
  ```
90
66
 
91
- ---
92
-
93
- ## 缓存 / Caching
94
-
95
- - 缓存文件:`~/.config/openclaw-fleet/cache.json`(权限 600)
96
- - 默认 TTL:24 小时
97
- - `secret get` 自动使用缓存;`secret exec` 在缓存过期时自动同步
98
- - 可在 config.json 中设置 `ttlMs` 自定义缓存时长
67
+ ## Cache
99
68
 
100
- ---
101
-
102
- ## 认证方式 / Authentication
69
+ Secrets are cached locally at `~/.config/openclaw-fleet/cache.json` with a default TTL of 24 hours. Use `--fresh` to bypass cache or `secret sync` to refresh all.
103
70
 
104
- 使用 Infisical [Universal Auth (Machine Identity)](https://infisical.com/docs/documentation/platform/identities/universal-auth) 认证。
71
+ ## Source
105
72
 
106
- 配置步骤:
107
- 1. Infisical 控制台创建 Machine Identity
108
- 2. 授予项目访问权限
109
- 3. 将 `clientId` 和 `clientSecret` 填入配置文件
73
+ - GitHub: https://github.com/shazhou-ww/secret-cli
74
+ - Gitee: https://gitee.com/xiaoju-neko/secret-cli
110
75
 
111
76
  ---
112
77
 
113
- ## License
114
-
115
- MIT © 小橘 🍊
78
+ Made with 🔨 by [oc-forge](https://www.npmjs.com/org/oc-forge) — 小橘 🍊
package/bin/secret ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ import "./secret.ts";
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@oc-forge/secret",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Infisical secret management CLI with local caching — for OpenClaw teams",
5
5
  "type": "module",
6
6
  "bin": {
7
- "secret": "./secret.ts"
7
+ "secret": "./bin/secret"
8
8
  },
9
9
  "files": ["secret.ts", "README.md", "LICENSE"],
10
10
  "keywords": ["infisical", "secret", "cli", "openclaw", "oc-forge"],