@hasna/configs 0.2.29 → 0.2.30

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/README.md CHANGED
@@ -1,292 +1,59 @@
1
1
  # @hasna/configs
2
2
 
3
- AI coding agent configuration manager — store, version, apply, and share all your AI coding configs.
3
+ AI coding agent configuration manager — store, version, apply, and share all your AI coding configs. CLI + MCP + REST API + Dashboard.
4
4
 
5
- **One command to capture your entire setup. One command to recreate it anywhere.**
6
-
7
- ```bash
8
- bun install -g @hasna/configs
9
- configs init # first-time setup: sync all known configs + create profile
10
- configs status # health check: drifted, secrets, templates
11
- configs pull # re-sync from disk → DB
12
- configs push # apply DB → disk
13
- ```
14
-
15
- ## What It Stores
16
-
17
- | Category | Examples |
18
- |----------|---------|
19
- | `agent` | CLAUDE.md, settings.json, keybindings.json, Codex config.toml, Gemini settings |
20
- | `rules` | ~/.claude/rules/*.md, AGENTS.md, GEMINI.md |
21
- | `mcp` | MCP server entries from ~/.claude.json, codex config |
22
- | `shell` | .zshrc, .zprofile, shell functions |
23
- | `secrets_schema` | Shape of .secrets (keys + descriptions, never values) |
24
- | `workspace` | Directory hierarchy conventions (reference doc) |
25
- | `git` | .gitconfig, .gitignore templates |
26
- | `tools` | .npmrc, tsconfig.json, bunfig.toml |
27
-
28
- Configs have two **kinds**:
29
- - `file` — has a `target_path`, can be applied to disk
30
- - `reference` — convention doc, no target path (workspace structure, secrets schema)
5
+ [![npm](https://img.shields.io/npm/v/@hasna/configs)](https://www.npmjs.com/package/@hasna/configs)
6
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
31
7
 
32
8
  ## Install
33
9
 
34
10
  ```bash
35
- bun install -g @hasna/configs
36
- ```
37
-
38
- ## Quick Start
39
-
40
- ```bash
41
- # Ingest your Claude Code setup
42
- configs sync --dir ~/.claude
43
-
44
- # See what's stored
45
- configs list
46
- configs whoami
47
-
48
- # View a config
49
- configs show claude-claude-md
50
-
51
- # Check diff between stored and disk
52
- configs diff claude-claude-md
53
-
54
- # Apply to disk (with preview first)
55
- configs apply claude-claude-md --dry-run
56
- configs apply claude-claude-md
57
-
58
- # Bundle everything for backup/sharing
59
- configs export -o my-setup.tar.gz
60
-
61
- # Restore on a new machine
62
- configs import my-setup.tar.gz
63
- ```
64
-
65
- ## CLI Reference
66
-
67
- ### Core Commands
68
-
69
- ```bash
70
- configs list [options]
71
- -c, --category <cat> filter by category
72
- -a, --agent <agent> filter by agent (claude|codex|gemini|zsh|git|npm|global)
73
- -k, --kind <kind> filter by kind (file|reference)
74
- -t, --tag <tag> filter by tag
75
- -s, --search <query> search name/description/content
76
- -f, --format <fmt> table|json|compact
77
-
78
- configs show <id|slug> show content + metadata
79
- configs add <path> ingest a file into the DB
80
- -n, --name <name> config name
81
- -c, --category <cat> category override
82
- -a, --agent <agent> agent override
83
- -k, --kind <kind> file|reference
84
-
85
- configs apply <id> write config to its target_path
86
- --dry-run preview without writing
87
-
88
- configs diff [id] show diff: stored vs disk (omit id for all)
89
- configs compare <a> <b> diff two stored configs against each other
90
-
91
- configs sync sync known AI coding configs from disk
92
- -a, --agent <agent> only sync this agent
93
- -p, --project [dir] sync project-scoped configs (CLAUDE.md, .mcp.json)
94
- --to-disk apply DB → disk instead
95
- --dry-run preview
96
- --list show which files would be synced
97
-
98
- configs pull alias for sync (disk → DB)
99
- configs push alias for sync --to-disk (DB → disk)
100
-
101
- configs export export as tar.gz bundle
102
- configs import <file> import from tar.gz bundle (--overwrite)
103
- configs backup timestamped export to ~/.configs/backups/
104
- configs restore <file> import from backup (--overwrite)
105
-
106
- configs init first-time setup: sync + seed + create profile
107
- configs status health check: drifted, secrets, templates
108
- configs whoami setup summary: DB path, counts by category
109
- configs doctor validate syntax, permissions, missing files, secrets
110
- configs scan [id] scan for unredacted secrets (--fix to redact)
111
- configs watch auto-sync on file changes (polls every 3s)
112
- configs update check for + install latest version
113
- configs completions output zsh/bash completion script
114
-
115
- configs mcp install install MCP server (--claude, --codex, --gemini, --all)
116
- configs mcp uninstall remove MCP server
117
- ```
118
-
119
- ### Profiles
120
-
121
- Profiles are named bundles of configs — your complete machine setup.
122
-
123
- ```bash
124
- configs profile create "fresh-mac-setup"
125
- configs profile list
126
- configs profile show fresh-mac-setup
127
- configs profile add fresh-mac-setup claude-claude-md
128
- configs profile add fresh-mac-setup zshrc
129
- configs profile apply fresh-mac-setup --dry-run
130
- configs profile apply fresh-mac-setup
131
- configs profile delete fresh-mac-setup
132
- ```
133
-
134
- ### Snapshots (Version History)
135
-
136
- Every time you apply a config, the previous version is snapshotted automatically.
137
-
138
- ```bash
139
- configs snapshot list claude-claude-md # list all snapshots
140
- configs snapshot show <snapshot-id> # view content
141
- configs snapshot restore <config> <id> # restore to that version
142
- ```
143
-
144
- ### Templates & Secret Redaction
145
-
146
- Secrets are automatically redacted when ingesting configs. Values matching API keys, tokens, passwords etc. are replaced with `{{VAR_NAME}}` placeholders.
147
-
148
- ```bash
149
- configs template vars npmrc # show: {{NPM_AUTH_TOKEN}}
150
- configs template render npmrc --env --apply # fill from env vars, write to disk
151
- configs template render npmrc --var NPM_AUTH_TOKEN=xxx --dry-run # preview
152
- configs scan # check for unredacted secrets
153
- configs scan --fix # redact any that slipped through
11
+ npm install -g @hasna/configs
154
12
  ```
155
13
 
156
- ### Agent Profiles (Token Optimization)
157
-
158
- Control which MCP tools are exposed via `CONFIGS_PROFILE` env var:
14
+ ## CLI Usage
159
15
 
160
16
  ```bash
161
- CONFIGS_PROFILE=minimal configs-mcp # 3 tools: get_status, get_config, sync_known
162
- CONFIGS_PROFILE=standard configs-mcp # 11 tools: CRUD + sync + profiles
163
- CONFIGS_PROFILE=full configs-mcp # 13 tools (default)
17
+ configs --help
18
+ configs profile resolve
19
+ configs profile apply --auto
164
20
  ```
165
21
 
166
22
  ## MCP Server
167
23
 
168
- Install the MCP server so AI agents can read/write configs directly:
169
-
170
- ```bash
171
- configs-mcp --claude # install into Claude Code
172
- ```
173
-
174
- Or manually:
175
24
  ```bash
176
- claude mcp add --transport stdio --scope user configs -- configs-mcp
25
+ configs-mcp
177
26
  ```
178
27
 
179
- ### Available MCP Tools
180
-
181
- | Tool | Description |
182
- |------|-------------|
183
- | `list_configs` | List by category/agent/kind/search |
184
- | `get_config` | Get full config including content |
185
- | `create_config` | Create a new config |
186
- | `update_config` | Update content/tags/metadata |
187
- | `apply_config` | Write to target_path on disk |
188
- | `sync_directory` | Bulk sync a directory |
189
- | `list_profiles` | List profiles |
190
- | `apply_profile` | Apply all configs in a profile |
191
- | `get_snapshot` | Get historical version |
192
- | `search_tools` | Search tool descriptions (token-efficient) |
193
- | `describe_tools` | Get full tool docs on demand |
194
-
195
28
  ## REST API
196
29
 
197
- Start the server: `configs-serve` (port 3457)
198
-
199
- ```
200
- GET /api/configs list configs (?category=&agent=&search=&fields=)
201
- POST /api/configs create config
202
- GET /api/configs/:id get config
203
- PUT /api/configs/:id update config
204
- DEL /api/configs/:id delete config
205
- POST /api/configs/:id/apply apply to disk {dry_run?}
206
- POST /api/configs/:id/snapshot create snapshot
207
- GET /api/configs/:id/snapshots list snapshots
208
- POST /api/sync sync directory {dir, direction, dry_run}
209
- GET /api/profiles list profiles
210
- POST /api/profiles create profile
211
- GET /api/profiles/:id get profile + configs
212
- PUT /api/profiles/:id update profile
213
- DEL /api/profiles/:id delete profile
214
- POST /api/profiles/:id/apply apply all configs in profile
215
- GET /api/machines list machines
216
- GET /api/stats counts by category
217
- GET /health health check
218
- ```
219
-
220
- ## SDK
221
-
222
30
  ```bash
223
- bun add @hasna/configs-sdk
31
+ configs-serve
224
32
  ```
225
33
 
226
- ```typescript
227
- import { ConfigsClient } from "@hasna/configs-sdk";
228
-
229
- const client = new ConfigsClient({ baseUrl: "http://localhost:3457" });
230
-
231
- // List all rules configs
232
- const rules = await client.listConfigs({ category: "rules" });
233
-
234
- // Get a specific config
235
- const claudeMd = await client.getConfig("claude-claude-md");
236
- console.log(claudeMd.content);
237
-
238
- // Update it
239
- await client.updateConfig("claude-claude-md", { content: "# Updated" });
240
-
241
- // Apply to disk
242
- const result = await client.applyConfig("claude-claude-md", /* dryRun */ false);
243
- console.log(result.changed, result.path);
244
-
245
- // Apply a whole profile
246
- const results = await client.applyProfile("fresh-mac-setup");
34
+ ## Cloud Sync
247
35
 
248
- // Sync from disk
249
- const sync = await client.syncDirectory("~/.claude");
250
- console.log(`+${sync.added} updated:${sync.updated}`);
251
-
252
- // Get cost stats
253
- const stats = await client.getStats();
254
- console.log(`Total: ${stats.total} configs`);
255
- ```
256
-
257
- ## Web Dashboard
36
+ This package supports cloud sync via `@hasna/cloud`:
258
37
 
259
38
  ```bash
260
- configs-serve &
261
- open http://localhost:3457
39
+ cloud setup
40
+ cloud sync push --service configs
41
+ cloud sync pull --service configs
262
42
  ```
263
43
 
264
- 5 pages: **Configs** (browse/edit), **Profiles** (manage bundles), **Apply** (preview + apply + sync), **History** (snapshots), **Machines** (where applied).
265
-
266
- ## Seed Your Setup
267
-
268
- Immediately useful after install:
269
-
270
- ```bash
271
- bun run seed # ingests ~/.claude/, ~/.zshrc, ~/.gitconfig, etc.
272
- ```
44
+ ## Data Directory
273
45
 
274
- ## Database Location
46
+ Data is stored in `~/.hasna/configs/`.
275
47
 
276
- Default: `~/.configs/configs.db`
48
+ ## Machine-aware Profiles
277
49
 
278
- Override: `CONFIGS_DB_PATH=/path/to/configs.db configs list`
50
+ `configs init` now seeds two platform profiles:
279
51
 
280
- ## Part of the @hasna Ecosystem
52
+ - `linux-arm64` for `spark01` / `spark02`
53
+ - `macos-arm64` for `apple01` / `apple03`
281
54
 
282
- - [`@hasna/todos`](https://npm.im/@hasna/todos) task management for AI agents
283
- - [`@hasna/mementos`](https://npm.im/@hasna/mementos) — persistent memory for AI agents
284
- - [`@hasna/conversations`](https://npm.im/@hasna/conversations) — real-time messaging between agents
285
- - [`@hasna/skills`](https://npm.im/@hasna/skills) — skill management (prompts + MCP installs)
286
- - [`@hasna/sessions`](https://npm.im/@hasna/sessions) — search across coding sessions
287
- - [`@hasna/economy`](https://npm.im/@hasna/economy) — AI coding cost tracker
288
- - **`@hasna/configs`** — this package
55
+ These profiles resolve machine variables like `{{WORKSPACE_ROOT}}`, `{{BUN_BIN_DIR}}`, `{{BUN_PATH}}`, and `{{PATH_PREFIX}}`, so synced configs can be portable across Linux and macOS arm64 machines.
289
56
 
290
57
  ## License
291
58
 
292
- Apache-2.0
59
+ Apache-2.0 -- see [LICENSE](LICENSE)