@nuucognition/flint-cli 0.1.0-beta.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 ADDED
@@ -0,0 +1,344 @@
1
+
2
+ # Flint CLI
3
+
4
+ Command-line interface for managing Flint cognitive workspaces.
5
+
6
+ Flint extends Mesh with shards, git integration, and structured modules for AI-assisted workflows.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ # Install via the internal Flint install script.
12
+ # For local development in this monorepo:
13
+ pnpm install
14
+ pnpm --filter @nuucognition/flint-cli dev
15
+ ```
16
+
17
+ ## Commands
18
+
19
+ ### `flint init <name>`
20
+
21
+ Create a new flint workspace.
22
+
23
+ ```bash
24
+ flint init my-project
25
+ flint init my-project --path ~/workspaces
26
+ flint init my-project --preset default
27
+ ```
28
+
29
+ **Options:**
30
+ | Flag | Description |
31
+ |------|-------------|
32
+ | `-p, --path <dir>` | Parent directory |
33
+ | `--preset <name>` | Use a preset (e.g., "default") |
34
+
35
+ **Creates:**
36
+ ```
37
+ (Flint) my-project/
38
+ ├── .flint/
39
+ │ └── flint.lock
40
+ ├── flint.toml
41
+ ├── Imports/
42
+ ├── Exports/
43
+ ├── Workspace/
44
+ ├── Shards/
45
+ ├── Media/
46
+ └── Mesh/
47
+ ```
48
+
49
+ `flint init` creates the minimal structure and then runs `flint sync` to clone `.obsidian` and install any preset shards/mods.
50
+
51
+ ### `flint list`
52
+
53
+ List all registered flints.
54
+
55
+ ```bash
56
+ flint list
57
+ flint list --json
58
+ flint list --full-path
59
+ ```
60
+
61
+ **Options:**
62
+ | Flag | Description |
63
+ |------|-------------|
64
+ | `--json` | Output as JSON |
65
+ | `--full-path` | Show full paths |
66
+ | `-s, --status` | Show valid/broken status |
67
+ | `--sub` | Include subflints (dev mode only) |
68
+
69
+ **Aliases:** `flint ls`
70
+
71
+ ### `flint index`
72
+
73
+ Index all markdown files (same as `mesh index`).
74
+
75
+ ```bash
76
+ flint index
77
+ flint index --dry-run
78
+ flint index --verbose
79
+ ```
80
+
81
+ ### `flint sync`
82
+
83
+ Sync flint.toml with installed shards/mods, workspace references, imports, and `.obsidian`.
84
+
85
+ ```bash
86
+ flint sync
87
+ flint sync --path /path/to/(Flint) my-project
88
+ ```
89
+
90
+ ### `flint shard`
91
+
92
+ Manage shards.
93
+
94
+ #### `flint shard list`
95
+
96
+ List installed or available shards.
97
+
98
+ ```bash
99
+ flint shard list # List installed shards
100
+ flint shard list --available # List all available shards
101
+ ```
102
+
103
+ #### `flint shard install <shorthand>`
104
+
105
+ Install a shard.
106
+
107
+ ```bash
108
+ flint shard install ld # Living Documents
109
+ flint shard install inc # Increments (depends on ld)
110
+ flint shard install ma # Mesh Agent (depends on ld)
111
+ flint shard install cc # Claude Code (depends on ma)
112
+ flint shard install cc --force # Overwrite existing files
113
+ ```
114
+
115
+ **Options:**
116
+ | Flag | Description |
117
+ |------|-------------|
118
+ | `-p, --path <dir>` | Path to flint (default: auto-detect) |
119
+ | `-f, --force` | Overwrite existing files for integration shards |
120
+
121
+ **Available Shards:**
122
+
123
+ | Shorthand | Name | Type | Depends |
124
+ |-----------|------|------|---------|
125
+ | `ld` | Living Document | prompt | - |
126
+ | `inc` | Increments | prompt | ld |
127
+ | `ma` | Mesh Agent | prompt | ld |
128
+ | `cc` | Claude Code | integration | ma |
129
+
130
+ ### `flint mod`
131
+
132
+ Manage mods (environment modifications).
133
+
134
+ ```bash
135
+ flint mod list
136
+ flint mod list --available
137
+ flint mod install git
138
+ ```
139
+
140
+ ### `flint open`
141
+
142
+ Open a flint in configured applications.
143
+
144
+ ```bash
145
+ flint open # Open current flint
146
+ flint open my-project # Open by name from registry
147
+ ```
148
+
149
+ **Dev-only:** enable with `flint mode dev` or `flint --dev open ...`.
150
+
151
+ **Behavior:**
152
+ - Opens the flint in all apps configured in `~/.flint/config.toml`
153
+ - Default (no config): opens in Obsidian only
154
+ - Supports: obsidian, cursor, vscode, or any custom app
155
+
156
+ **Configure with:**
157
+ ```bash
158
+ flint config set open.apps '["obsidian", "cursor"]'
159
+ ```
160
+
161
+ ### `flint config`
162
+
163
+ Manage global Flint configuration stored at `~/.flint/config.toml`.
164
+
165
+ ```bash
166
+ flint config # View all config
167
+ flint config get open.apps # Get specific value
168
+ flint config set open.apps '["obsidian", "cursor"]' # Set value
169
+ ```
170
+
171
+ **Available Settings:**
172
+
173
+ | Key | Type | Default | Description |
174
+ |-----|------|---------|-------------|
175
+ | `mode` | string | build default | Feature mode (use `flint mode` to manage) |
176
+ | `open.apps` | string[] | `["obsidian"]` | Apps to open flints in |
177
+
178
+ ### `flint mode`
179
+
180
+ Manage feature tiers (production, experimental, dev). This setting is persisted in `~/.flint/config.toml`.
181
+
182
+ ```bash
183
+ flint mode
184
+ flint mode experimental
185
+ flint mode --list
186
+ ```
187
+
188
+ Use `--experimental` or `--dev` on a single command to override the current mode.
189
+ Dev-only commands include `open` and `upgrade`.
190
+
191
+ ### `flint git`
192
+
193
+ Git operations with flint awareness.
194
+
195
+ #### `flint git init`
196
+
197
+ Initialize git repository with managed `.gitignore`.
198
+
199
+ ```bash
200
+ flint git init
201
+ ```
202
+
203
+ #### `flint git sync`
204
+
205
+ Update `.gitignore` with workspace entries.
206
+
207
+ ```bash
208
+ flint git sync
209
+ ```
210
+
211
+ #### `flint git <command>`
212
+
213
+ Passthrough to git.
214
+
215
+ ```bash
216
+ flint git status
217
+ flint git add .
218
+ flint git commit -m "message"
219
+ ```
220
+
221
+ ### `flint export`
222
+
223
+ Manage exports defined in `Exports/`.
224
+
225
+ ```bash
226
+ flint export list
227
+ flint export build
228
+ flint export build <name>
229
+ ```
230
+
231
+ ### `flint import`
232
+
233
+ Manage imports from other registered flints.
234
+
235
+ ```bash
236
+ flint import list
237
+ flint import add "NUU Flint/Guide"
238
+ flint import remove "NUU Flint/Guide"
239
+ ```
240
+
241
+ ## Configuration
242
+
243
+ ### flint.toml
244
+
245
+ Located at the flint root:
246
+
247
+ ```toml
248
+ [flint]
249
+ name = "My Project"
250
+ type = "flint"
251
+
252
+ [shards]
253
+ required = ["core"]
254
+
255
+ [mods]
256
+ required = ["git"]
257
+ ```
258
+
259
+ Optional sections include `[imports]` and `[workspace]` declarations.
260
+
261
+ ### flint.lock
262
+
263
+ Stored at `.flint/flint.lock` and tracks the current Flint version plus installed shards/mods.
264
+
265
+ ### Shard Manifest (shard.yaml)
266
+
267
+ Shards are defined by `shard.yaml`:
268
+
269
+ ```yaml
270
+ version: 1
271
+ name: 'My Shard'
272
+ shorthand: 'ms'
273
+ description: 'What this shard does'
274
+ depends:
275
+ - ld # Optional dependencies
276
+ ```
277
+
278
+ **Integration shards** can also specify setup:
279
+
280
+ ```yaml
281
+ setup:
282
+ directories:
283
+ - path: '.my-tool'
284
+ files:
285
+ - path: 'CONFIG.md'
286
+ template: 'templates/config.md.tmpl'
287
+ state:
288
+ installed: true
289
+ version: '1.0.0'
290
+ ```
291
+
292
+ ## Shard Types
293
+
294
+ ### Prompt Shards
295
+
296
+ Markdown files that provide context and skills for AI agents.
297
+
298
+ - Installed to `Shards/<Name>/`
299
+ - Read by agents for context
300
+ - No runtime execution
301
+
302
+ ### Integration Shards
303
+
304
+ Create files outside the `Shards/` directory.
305
+
306
+ - Can create directories and files anywhere in the flint
307
+ - Use templates with variable substitution
308
+ - Store state in `Shards/<Name>/.installed.json`
309
+
310
+ **Template Variables:**
311
+
312
+ | Variable | Value |
313
+ |----------|-------|
314
+ | `{{uuid}}` | Random UUID |
315
+ | `{{date}}` | Current date (YYYY-MM-DD) |
316
+
317
+ ## Programmatic Usage
318
+
319
+ ```typescript
320
+ import {
321
+ createFlint,
322
+ findFlintRoot,
323
+ installShard,
324
+ listAvailableShards,
325
+ initGit,
326
+ } from '@nuucognition/flint';
327
+
328
+ // Create a new flint
329
+ const entry = await createFlint({
330
+ name: 'my-project',
331
+ });
332
+
333
+ // Install a shard
334
+ await installShard(entry.path, 'ld');
335
+
336
+ // List available shards
337
+ const shards = await listAvailableShards();
338
+
339
+ // Initialize git in the current flint (if detected)
340
+ const flintPath = await findFlintRoot(process.cwd());
341
+ if (flintPath) {
342
+ await initGit(flintPath);
343
+ }
344
+ ```
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { fileURLToPath } from 'node:url';
4
+ import { dirname, join } from 'node:path';
5
+
6
+ const __dirname = dirname(fileURLToPath(import.meta.url));
7
+ await import(join(__dirname, '..', 'dist', 'index.js'));
package/bin/flint.js ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawnSync } from 'node:child_process';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { dirname, join } from 'node:path';
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const srcEntry = join(__dirname, '..', 'src', 'index.ts');
9
+
10
+ // Find tsx in node_modules (works in monorepo)
11
+ const tsxPath = join(__dirname, '..', 'node_modules', '.bin', 'tsx');
12
+
13
+ // Set dev mode for local development (running from source)
14
+ const result = spawnSync(tsxPath, [srcEntry, ...process.argv.slice(2)], {
15
+ stdio: 'inherit',
16
+ env: { ...process.env, FLINT_MODE: 'dev' },
17
+ });
18
+
19
+ process.exit(result.status ?? 0);