@hasna/configs 0.1.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/README.md +264 -0
- package/dashboard/dist/assets/index-DQ3P1g1z.css +1 -0
- package/dashboard/dist/assets/index-DbXmAL_d.js +11 -0
- package/dashboard/dist/index.html +14 -0
- package/dashboard/dist/vite.svg +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +3087 -0
- package/dist/db/configs.d.ts +10 -0
- package/dist/db/configs.d.ts.map +1 -0
- package/dist/db/configs.test.d.ts +2 -0
- package/dist/db/configs.test.d.ts.map +1 -0
- package/dist/db/database.d.ts +7 -0
- package/dist/db/database.d.ts.map +1 -0
- package/dist/db/machines.d.ts +8 -0
- package/dist/db/machines.d.ts.map +1 -0
- package/dist/db/machines.test.d.ts +2 -0
- package/dist/db/machines.test.d.ts.map +1 -0
- package/dist/db/profiles.d.ts +11 -0
- package/dist/db/profiles.d.ts.map +1 -0
- package/dist/db/profiles.test.d.ts +2 -0
- package/dist/db/profiles.test.d.ts.map +1 -0
- package/dist/db/snapshots.d.ts +8 -0
- package/dist/db/snapshots.d.ts.map +1 -0
- package/dist/db/snapshots.test.d.ts +2 -0
- package/dist/db/snapshots.test.d.ts.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +896 -0
- package/dist/lib/apply.d.ts +11 -0
- package/dist/lib/apply.d.ts.map +1 -0
- package/dist/lib/apply.test.d.ts +2 -0
- package/dist/lib/apply.test.d.ts.map +1 -0
- package/dist/lib/export.d.ts +12 -0
- package/dist/lib/export.d.ts.map +1 -0
- package/dist/lib/import.d.ts +14 -0
- package/dist/lib/import.d.ts.map +1 -0
- package/dist/lib/sync.d.ts +19 -0
- package/dist/lib/sync.d.ts.map +1 -0
- package/dist/lib/sync.test.d.ts +2 -0
- package/dist/lib/sync.test.d.ts.map +1 -0
- package/dist/lib/template.d.ts +10 -0
- package/dist/lib/template.d.ts.map +1 -0
- package/dist/lib/template.test.d.ts +2 -0
- package/dist/lib/template.test.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +662 -0
- package/dist/mcp/mcp.test.d.ts +2 -0
- package/dist/mcp/mcp.test.d.ts.map +1 -0
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +2390 -0
- package/dist/server/server.test.d.ts +2 -0
- package/dist/server/server.test.d.ts.map +1 -0
- package/dist/types/index.d.ts +152 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +78 -0
package/README.md
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# @hasna/configs
|
|
2
|
+
|
|
3
|
+
AI coding agent configuration manager — store, version, apply, and share all your AI coding configs.
|
|
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 sync --dir ~/.claude # ingest all Claude Code configs
|
|
10
|
+
configs whoami # see what's stored
|
|
11
|
+
configs apply claude-claude-md # write a config back to disk
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## What It Stores
|
|
15
|
+
|
|
16
|
+
| Category | Examples |
|
|
17
|
+
|----------|---------|
|
|
18
|
+
| `agent` | CLAUDE.md, settings.json, keybindings.json, Codex config.toml, Gemini settings |
|
|
19
|
+
| `rules` | ~/.claude/rules/*.md, AGENTS.md, GEMINI.md |
|
|
20
|
+
| `mcp` | MCP server entries from ~/.claude.json, codex config |
|
|
21
|
+
| `shell` | .zshrc, .zprofile, shell functions |
|
|
22
|
+
| `secrets_schema` | Shape of .secrets (keys + descriptions, never values) |
|
|
23
|
+
| `workspace` | Directory hierarchy conventions (reference doc) |
|
|
24
|
+
| `git` | .gitconfig, .gitignore templates |
|
|
25
|
+
| `tools` | .npmrc, tsconfig.json, bunfig.toml |
|
|
26
|
+
|
|
27
|
+
Configs have two **kinds**:
|
|
28
|
+
- `file` — has a `target_path`, can be applied to disk
|
|
29
|
+
- `reference` — convention doc, no target path (workspace structure, secrets schema)
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
bun install -g @hasna/configs
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Ingest your Claude Code setup
|
|
41
|
+
configs sync --dir ~/.claude
|
|
42
|
+
|
|
43
|
+
# See what's stored
|
|
44
|
+
configs list
|
|
45
|
+
configs whoami
|
|
46
|
+
|
|
47
|
+
# View a config
|
|
48
|
+
configs show claude-claude-md
|
|
49
|
+
|
|
50
|
+
# Check diff between stored and disk
|
|
51
|
+
configs diff claude-claude-md
|
|
52
|
+
|
|
53
|
+
# Apply to disk (with preview first)
|
|
54
|
+
configs apply claude-claude-md --dry-run
|
|
55
|
+
configs apply claude-claude-md
|
|
56
|
+
|
|
57
|
+
# Bundle everything for backup/sharing
|
|
58
|
+
configs export -o my-setup.tar.gz
|
|
59
|
+
|
|
60
|
+
# Restore on a new machine
|
|
61
|
+
configs import my-setup.tar.gz
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## CLI Reference
|
|
65
|
+
|
|
66
|
+
### Core Commands
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
configs list [options]
|
|
70
|
+
-c, --category <cat> filter by category
|
|
71
|
+
-a, --agent <agent> filter by agent (claude|codex|gemini|zsh|git|npm|global)
|
|
72
|
+
-k, --kind <kind> filter by kind (file|reference)
|
|
73
|
+
-t, --tag <tag> filter by tag
|
|
74
|
+
-s, --search <query> search name/description/content
|
|
75
|
+
-f, --format <fmt> table|json|compact
|
|
76
|
+
|
|
77
|
+
configs show <id|slug> show content + metadata
|
|
78
|
+
configs add <path> ingest a file into the DB
|
|
79
|
+
-n, --name <name> config name
|
|
80
|
+
-c, --category <cat> category override
|
|
81
|
+
-a, --agent <agent> agent override
|
|
82
|
+
-k, --kind <kind> file|reference
|
|
83
|
+
|
|
84
|
+
configs apply <id> write config to its target_path
|
|
85
|
+
--dry-run preview without writing
|
|
86
|
+
|
|
87
|
+
configs diff <id> show diff: stored vs disk
|
|
88
|
+
|
|
89
|
+
configs sync bulk sync a directory
|
|
90
|
+
-d, --dir <dir> directory (default: ~/.claude)
|
|
91
|
+
--from-disk read files from disk into DB (default)
|
|
92
|
+
--to-disk apply DB configs back to disk
|
|
93
|
+
--dry-run preview
|
|
94
|
+
|
|
95
|
+
configs export export as tar.gz bundle
|
|
96
|
+
-o, --output <path> output file (default: ./configs-export.tar.gz)
|
|
97
|
+
-c, --category <cat> filter by category
|
|
98
|
+
|
|
99
|
+
configs import <file> import from tar.gz bundle
|
|
100
|
+
--overwrite overwrite existing configs
|
|
101
|
+
|
|
102
|
+
configs whoami setup summary (DB path, counts by category)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Profiles
|
|
106
|
+
|
|
107
|
+
Profiles are named bundles of configs — your complete machine setup.
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
configs profile create "fresh-mac-setup"
|
|
111
|
+
configs profile list
|
|
112
|
+
configs profile show fresh-mac-setup
|
|
113
|
+
configs profile add fresh-mac-setup claude-claude-md
|
|
114
|
+
configs profile add fresh-mac-setup zshrc
|
|
115
|
+
configs profile apply fresh-mac-setup --dry-run
|
|
116
|
+
configs profile apply fresh-mac-setup
|
|
117
|
+
configs profile delete fresh-mac-setup
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Snapshots (Version History)
|
|
121
|
+
|
|
122
|
+
Every time you apply a config, the previous version is snapshotted automatically.
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
configs snapshot list claude-claude-md # list all snapshots
|
|
126
|
+
configs snapshot show <snapshot-id> # view content
|
|
127
|
+
configs snapshot restore <config> <id> # restore to that version
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Templates
|
|
131
|
+
|
|
132
|
+
Configs with `{{VAR_NAME}}` placeholders are templates.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
configs template vars my-zshrc-template # show required variables
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## MCP Server
|
|
139
|
+
|
|
140
|
+
Install the MCP server so AI agents can read/write configs directly:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
configs-mcp --claude # install into Claude Code
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Or manually:
|
|
147
|
+
```bash
|
|
148
|
+
claude mcp add --transport stdio --scope user configs -- configs-mcp
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Available MCP Tools
|
|
152
|
+
|
|
153
|
+
| Tool | Description |
|
|
154
|
+
|------|-------------|
|
|
155
|
+
| `list_configs` | List by category/agent/kind/search |
|
|
156
|
+
| `get_config` | Get full config including content |
|
|
157
|
+
| `create_config` | Create a new config |
|
|
158
|
+
| `update_config` | Update content/tags/metadata |
|
|
159
|
+
| `apply_config` | Write to target_path on disk |
|
|
160
|
+
| `sync_directory` | Bulk sync a directory |
|
|
161
|
+
| `list_profiles` | List profiles |
|
|
162
|
+
| `apply_profile` | Apply all configs in a profile |
|
|
163
|
+
| `get_snapshot` | Get historical version |
|
|
164
|
+
| `search_tools` | Search tool descriptions (token-efficient) |
|
|
165
|
+
| `describe_tools` | Get full tool docs on demand |
|
|
166
|
+
|
|
167
|
+
## REST API
|
|
168
|
+
|
|
169
|
+
Start the server: `configs-serve` (port 3457)
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
GET /api/configs list configs (?category=&agent=&search=&fields=)
|
|
173
|
+
POST /api/configs create config
|
|
174
|
+
GET /api/configs/:id get config
|
|
175
|
+
PUT /api/configs/:id update config
|
|
176
|
+
DEL /api/configs/:id delete config
|
|
177
|
+
POST /api/configs/:id/apply apply to disk {dry_run?}
|
|
178
|
+
POST /api/configs/:id/snapshot create snapshot
|
|
179
|
+
GET /api/configs/:id/snapshots list snapshots
|
|
180
|
+
POST /api/sync sync directory {dir, direction, dry_run}
|
|
181
|
+
GET /api/profiles list profiles
|
|
182
|
+
POST /api/profiles create profile
|
|
183
|
+
GET /api/profiles/:id get profile + configs
|
|
184
|
+
PUT /api/profiles/:id update profile
|
|
185
|
+
DEL /api/profiles/:id delete profile
|
|
186
|
+
POST /api/profiles/:id/apply apply all configs in profile
|
|
187
|
+
GET /api/machines list machines
|
|
188
|
+
GET /api/stats counts by category
|
|
189
|
+
GET /health health check
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## SDK
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
bun add @hasna/configs-sdk
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
import { ConfigsClient } from "@hasna/configs-sdk";
|
|
200
|
+
|
|
201
|
+
const client = new ConfigsClient({ baseUrl: "http://localhost:3457" });
|
|
202
|
+
|
|
203
|
+
// List all rules configs
|
|
204
|
+
const rules = await client.listConfigs({ category: "rules" });
|
|
205
|
+
|
|
206
|
+
// Get a specific config
|
|
207
|
+
const claudeMd = await client.getConfig("claude-claude-md");
|
|
208
|
+
console.log(claudeMd.content);
|
|
209
|
+
|
|
210
|
+
// Update it
|
|
211
|
+
await client.updateConfig("claude-claude-md", { content: "# Updated" });
|
|
212
|
+
|
|
213
|
+
// Apply to disk
|
|
214
|
+
const result = await client.applyConfig("claude-claude-md", /* dryRun */ false);
|
|
215
|
+
console.log(result.changed, result.path);
|
|
216
|
+
|
|
217
|
+
// Apply a whole profile
|
|
218
|
+
const results = await client.applyProfile("fresh-mac-setup");
|
|
219
|
+
|
|
220
|
+
// Sync from disk
|
|
221
|
+
const sync = await client.syncDirectory("~/.claude");
|
|
222
|
+
console.log(`+${sync.added} updated:${sync.updated}`);
|
|
223
|
+
|
|
224
|
+
// Get cost stats
|
|
225
|
+
const stats = await client.getStats();
|
|
226
|
+
console.log(`Total: ${stats.total} configs`);
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Web Dashboard
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
configs-serve &
|
|
233
|
+
open http://localhost:3457
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
5 pages: **Configs** (browse/edit), **Profiles** (manage bundles), **Apply** (preview + apply + sync), **History** (snapshots), **Machines** (where applied).
|
|
237
|
+
|
|
238
|
+
## Seed Your Setup
|
|
239
|
+
|
|
240
|
+
Immediately useful after install:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
bun run seed # ingests ~/.claude/, ~/.zshrc, ~/.gitconfig, etc.
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Database Location
|
|
247
|
+
|
|
248
|
+
Default: `~/.configs/configs.db`
|
|
249
|
+
|
|
250
|
+
Override: `CONFIGS_DB_PATH=/path/to/configs.db configs list`
|
|
251
|
+
|
|
252
|
+
## Part of the @hasna Ecosystem
|
|
253
|
+
|
|
254
|
+
- [`@hasna/todos`](https://npm.im/@hasna/todos) — task management for AI agents
|
|
255
|
+
- [`@hasna/mementos`](https://npm.im/@hasna/mementos) — persistent memory for AI agents
|
|
256
|
+
- [`@hasna/conversations`](https://npm.im/@hasna/conversations) — real-time messaging between agents
|
|
257
|
+
- [`@hasna/skills`](https://npm.im/@hasna/skills) — skill management (prompts + MCP installs)
|
|
258
|
+
- [`@hasna/sessions`](https://npm.im/@hasna/sessions) — search across coding sessions
|
|
259
|
+
- [`@hasna/economy`](https://npm.im/@hasna/economy) — AI coding cost tracker
|
|
260
|
+
- **`@hasna/configs`** — this package
|
|
261
|
+
|
|
262
|
+
## License
|
|
263
|
+
|
|
264
|
+
Apache-2.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{font-family:system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0;display:flex;place-items:center;min-width:320px;min-height:100vh}h1{font-size:3.2em;line-height:1.1}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media(prefers-color-scheme:light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}
|