@hyperdrive.bot/gut 0.1.12 → 0.1.14-alpha.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 +21 -6
- package/dist/commands/context.d.ts +4 -0
- package/dist/commands/context.js +91 -6
- package/dist/commands/focus.js +3 -0
- package/dist/commands/worktree/create.d.ts +1 -0
- package/dist/commands/worktree/create.js +64 -12
- package/dist/commands/worktree/gc.d.ts +13 -0
- package/dist/commands/worktree/gc.js +126 -0
- package/dist/commands/worktree/list.d.ts +12 -0
- package/dist/commands/worktree/list.js +63 -0
- package/dist/commands/worktree/list.test.d.ts +1 -0
- package/dist/commands/worktree/list.test.js +182 -0
- package/dist/commands/worktree/prune.d.ts +6 -0
- package/dist/commands/worktree/prune.js +28 -0
- package/dist/commands/worktree/prune.test.d.ts +1 -0
- package/dist/commands/worktree/prune.test.js +105 -0
- package/dist/commands/worktree/remove.d.ts +12 -0
- package/dist/commands/worktree/remove.js +48 -0
- package/dist/commands/worktree/status.d.ts +9 -0
- package/dist/commands/worktree/status.js +58 -0
- package/dist/services/worktree.service.d.ts +24 -0
- package/dist/services/worktree.service.js +90 -0
- package/dist/utils/duration.d.ts +1 -0
- package/dist/utils/duration.js +26 -0
- package/dist/utils/entity-spec.d.ts +15 -0
- package/dist/utils/entity-spec.js +29 -0
- package/oclif.manifest.json +193 -6
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function parseEntitySpecs(specs) {
|
|
2
|
+
if (!specs || specs.length === 0)
|
|
3
|
+
return [];
|
|
4
|
+
const parsed = [];
|
|
5
|
+
for (const raw of specs) {
|
|
6
|
+
const trimmed = raw.trim();
|
|
7
|
+
if (!trimmed)
|
|
8
|
+
continue;
|
|
9
|
+
const colonIdx = trimmed.indexOf(':');
|
|
10
|
+
if (colonIdx === -1) {
|
|
11
|
+
parsed.push({ name: trimmed });
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
const name = trimmed.slice(0, colonIdx).trim();
|
|
15
|
+
const branch = trimmed.slice(colonIdx + 1).trim();
|
|
16
|
+
if (!name) {
|
|
17
|
+
throw new Error(`Invalid --entity spec "${raw}": missing entity name before ":"`);
|
|
18
|
+
}
|
|
19
|
+
if (branch) {
|
|
20
|
+
parsed.push({ branch, name });
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
// "name:" is tolerated — same as bare name. Useful if a caller builds
|
|
24
|
+
// specs programmatically and omits the branch for some entities.
|
|
25
|
+
parsed.push({ name });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return parsed;
|
|
29
|
+
}
|
package/oclif.manifest.json
CHANGED
|
@@ -301,9 +301,24 @@
|
|
|
301
301
|
"args": {},
|
|
302
302
|
"description": "Show current focus context with entity details",
|
|
303
303
|
"examples": [
|
|
304
|
-
"<%= config.bin %> <%= command.id %>"
|
|
304
|
+
"<%= config.bin %> <%= command.id %>",
|
|
305
|
+
"<%= config.bin %> <%= command.id %> --json",
|
|
306
|
+
"<%= config.bin %> <%= command.id %> --json --all"
|
|
305
307
|
],
|
|
306
|
-
"flags": {
|
|
308
|
+
"flags": {
|
|
309
|
+
"all": {
|
|
310
|
+
"description": "Include all registered entities, not just focused ones (implies --json or adds to text output)",
|
|
311
|
+
"name": "all",
|
|
312
|
+
"allowNo": false,
|
|
313
|
+
"type": "boolean"
|
|
314
|
+
},
|
|
315
|
+
"json": {
|
|
316
|
+
"description": "Emit structured JSON for programmatic consumption (includes per-entity branch + hasUncommitted)",
|
|
317
|
+
"name": "json",
|
|
318
|
+
"allowNo": false,
|
|
319
|
+
"type": "boolean"
|
|
320
|
+
}
|
|
321
|
+
},
|
|
307
322
|
"hasDynamicHelp": false,
|
|
308
323
|
"hiddenAliases": [],
|
|
309
324
|
"id": "context",
|
|
@@ -2186,17 +2201,26 @@
|
|
|
2186
2201
|
"examples": [
|
|
2187
2202
|
"<%= config.bin %> worktree create workflow/deploy-batch",
|
|
2188
2203
|
"<%= config.bin %> worktree create workflow/deploy-batch --from master --install",
|
|
2189
|
-
"<%= config.bin %> worktree create feature/story-42 --base-dir /home/user/worktrees"
|
|
2204
|
+
"<%= config.bin %> worktree create feature/story-42 --base-dir /home/user/worktrees",
|
|
2205
|
+
"<%= config.bin %> worktree create seo-lake --entity serverless-api:feature/seo-lake --entity sign",
|
|
2206
|
+
"GUT_WORKTREE_DIR=/tmp/gut-worktrees <%= config.bin %> worktree create feature/ci-run"
|
|
2190
2207
|
],
|
|
2191
2208
|
"flags": {
|
|
2192
2209
|
"base-dir": {
|
|
2193
|
-
"description": "Root directory for worktrees",
|
|
2210
|
+
"description": "Root directory for worktrees (default: ~/.local/share/gut/worktrees, override via GUT_WORKTREE_DIR env var; explicit --base-dir wins)",
|
|
2194
2211
|
"name": "base-dir",
|
|
2195
|
-
"default": "/
|
|
2212
|
+
"default": "/root/.local/share/gut/worktrees",
|
|
2196
2213
|
"hasDynamicHelp": false,
|
|
2197
2214
|
"multiple": false,
|
|
2198
2215
|
"type": "option"
|
|
2199
2216
|
},
|
|
2217
|
+
"entity": {
|
|
2218
|
+
"description": "Entity to include, optionally pinned to a branch via \"name:branch\". Repeatable. Overrides current focus when provided.",
|
|
2219
|
+
"name": "entity",
|
|
2220
|
+
"hasDynamicHelp": false,
|
|
2221
|
+
"multiple": true,
|
|
2222
|
+
"type": "option"
|
|
2223
|
+
},
|
|
2200
2224
|
"from": {
|
|
2201
2225
|
"description": "Base branch to create from (defaults to current branch)",
|
|
2202
2226
|
"name": "from",
|
|
@@ -2225,7 +2249,170 @@
|
|
|
2225
2249
|
"worktree",
|
|
2226
2250
|
"create.js"
|
|
2227
2251
|
]
|
|
2252
|
+
},
|
|
2253
|
+
"worktree:gc": {
|
|
2254
|
+
"aliases": [],
|
|
2255
|
+
"args": {},
|
|
2256
|
+
"description": "Remove worktrees older than a given duration (garbage collection)",
|
|
2257
|
+
"examples": [
|
|
2258
|
+
"<%= config.bin %> worktree gc --older-than 7d",
|
|
2259
|
+
"<%= config.bin %> worktree gc --older-than 14d --force",
|
|
2260
|
+
"<%= config.bin %> worktree gc --older-than 7d --dry-run"
|
|
2261
|
+
],
|
|
2262
|
+
"flags": {
|
|
2263
|
+
"dry-run": {
|
|
2264
|
+
"char": "n",
|
|
2265
|
+
"description": "List candidates without removing anything",
|
|
2266
|
+
"name": "dry-run",
|
|
2267
|
+
"allowNo": false,
|
|
2268
|
+
"type": "boolean"
|
|
2269
|
+
},
|
|
2270
|
+
"force": {
|
|
2271
|
+
"char": "f",
|
|
2272
|
+
"description": "Remove even worktrees with uncommitted changes",
|
|
2273
|
+
"name": "force",
|
|
2274
|
+
"allowNo": false,
|
|
2275
|
+
"type": "boolean"
|
|
2276
|
+
},
|
|
2277
|
+
"older-than": {
|
|
2278
|
+
"char": "o",
|
|
2279
|
+
"description": "Duration threshold (e.g. '7d', '24h', '30m', '90s')",
|
|
2280
|
+
"name": "older-than",
|
|
2281
|
+
"required": true,
|
|
2282
|
+
"hasDynamicHelp": false,
|
|
2283
|
+
"multiple": false,
|
|
2284
|
+
"type": "option"
|
|
2285
|
+
}
|
|
2286
|
+
},
|
|
2287
|
+
"hasDynamicHelp": false,
|
|
2288
|
+
"hiddenAliases": [],
|
|
2289
|
+
"id": "worktree:gc",
|
|
2290
|
+
"pluginAlias": "@hyperdrive.bot/gut",
|
|
2291
|
+
"pluginName": "@hyperdrive.bot/gut",
|
|
2292
|
+
"pluginType": "core",
|
|
2293
|
+
"strict": true,
|
|
2294
|
+
"isESM": true,
|
|
2295
|
+
"relativePath": [
|
|
2296
|
+
"dist",
|
|
2297
|
+
"commands",
|
|
2298
|
+
"worktree",
|
|
2299
|
+
"gc.js"
|
|
2300
|
+
]
|
|
2301
|
+
},
|
|
2302
|
+
"worktree:list": {
|
|
2303
|
+
"aliases": [],
|
|
2304
|
+
"args": {},
|
|
2305
|
+
"description": "List all active worktrees with metadata and staleness detection",
|
|
2306
|
+
"examples": [
|
|
2307
|
+
"<%= config.bin %> <%= command.id %>"
|
|
2308
|
+
],
|
|
2309
|
+
"flags": {},
|
|
2310
|
+
"hasDynamicHelp": false,
|
|
2311
|
+
"hiddenAliases": [],
|
|
2312
|
+
"id": "worktree:list",
|
|
2313
|
+
"pluginAlias": "@hyperdrive.bot/gut",
|
|
2314
|
+
"pluginName": "@hyperdrive.bot/gut",
|
|
2315
|
+
"pluginType": "core",
|
|
2316
|
+
"strict": true,
|
|
2317
|
+
"isESM": true,
|
|
2318
|
+
"relativePath": [
|
|
2319
|
+
"dist",
|
|
2320
|
+
"commands",
|
|
2321
|
+
"worktree",
|
|
2322
|
+
"list.js"
|
|
2323
|
+
]
|
|
2324
|
+
},
|
|
2325
|
+
"worktree:prune": {
|
|
2326
|
+
"aliases": [],
|
|
2327
|
+
"args": {},
|
|
2328
|
+
"description": "Remove worktree records whose paths no longer exist on disk",
|
|
2329
|
+
"examples": [
|
|
2330
|
+
"<%= config.bin %> worktree prune"
|
|
2331
|
+
],
|
|
2332
|
+
"flags": {},
|
|
2333
|
+
"hasDynamicHelp": false,
|
|
2334
|
+
"hiddenAliases": [],
|
|
2335
|
+
"id": "worktree:prune",
|
|
2336
|
+
"pluginAlias": "@hyperdrive.bot/gut",
|
|
2337
|
+
"pluginName": "@hyperdrive.bot/gut",
|
|
2338
|
+
"pluginType": "core",
|
|
2339
|
+
"strict": true,
|
|
2340
|
+
"isESM": true,
|
|
2341
|
+
"relativePath": [
|
|
2342
|
+
"dist",
|
|
2343
|
+
"commands",
|
|
2344
|
+
"worktree",
|
|
2345
|
+
"prune.js"
|
|
2346
|
+
]
|
|
2347
|
+
},
|
|
2348
|
+
"worktree:remove": {
|
|
2349
|
+
"aliases": [],
|
|
2350
|
+
"args": {
|
|
2351
|
+
"name": {
|
|
2352
|
+
"description": "Worktree name to remove",
|
|
2353
|
+
"name": "name",
|
|
2354
|
+
"required": true
|
|
2355
|
+
}
|
|
2356
|
+
},
|
|
2357
|
+
"description": "Remove a worktree and all entity worktrees",
|
|
2358
|
+
"examples": [
|
|
2359
|
+
"<%= config.bin %> worktree remove workflow/batch",
|
|
2360
|
+
"<%= config.bin %> worktree remove workflow/batch --force"
|
|
2361
|
+
],
|
|
2362
|
+
"flags": {
|
|
2363
|
+
"force": {
|
|
2364
|
+
"char": "f",
|
|
2365
|
+
"description": "Remove even with uncommitted changes",
|
|
2366
|
+
"name": "force",
|
|
2367
|
+
"allowNo": false,
|
|
2368
|
+
"type": "boolean"
|
|
2369
|
+
}
|
|
2370
|
+
},
|
|
2371
|
+
"hasDynamicHelp": false,
|
|
2372
|
+
"hiddenAliases": [],
|
|
2373
|
+
"id": "worktree:remove",
|
|
2374
|
+
"pluginAlias": "@hyperdrive.bot/gut",
|
|
2375
|
+
"pluginName": "@hyperdrive.bot/gut",
|
|
2376
|
+
"pluginType": "core",
|
|
2377
|
+
"strict": true,
|
|
2378
|
+
"isESM": true,
|
|
2379
|
+
"relativePath": [
|
|
2380
|
+
"dist",
|
|
2381
|
+
"commands",
|
|
2382
|
+
"worktree",
|
|
2383
|
+
"remove.js"
|
|
2384
|
+
]
|
|
2385
|
+
},
|
|
2386
|
+
"worktree:status": {
|
|
2387
|
+
"aliases": [],
|
|
2388
|
+
"args": {
|
|
2389
|
+
"name": {
|
|
2390
|
+
"description": "Worktree name (shows all if omitted)",
|
|
2391
|
+
"name": "name",
|
|
2392
|
+
"required": false
|
|
2393
|
+
}
|
|
2394
|
+
},
|
|
2395
|
+
"description": "Show per-entity git status for worktrees",
|
|
2396
|
+
"examples": [
|
|
2397
|
+
"<%= config.bin %> worktree status",
|
|
2398
|
+
"<%= config.bin %> worktree status workflow/deploy-batch"
|
|
2399
|
+
],
|
|
2400
|
+
"flags": {},
|
|
2401
|
+
"hasDynamicHelp": false,
|
|
2402
|
+
"hiddenAliases": [],
|
|
2403
|
+
"id": "worktree:status",
|
|
2404
|
+
"pluginAlias": "@hyperdrive.bot/gut",
|
|
2405
|
+
"pluginName": "@hyperdrive.bot/gut",
|
|
2406
|
+
"pluginType": "core",
|
|
2407
|
+
"strict": true,
|
|
2408
|
+
"isESM": true,
|
|
2409
|
+
"relativePath": [
|
|
2410
|
+
"dist",
|
|
2411
|
+
"commands",
|
|
2412
|
+
"worktree",
|
|
2413
|
+
"status.js"
|
|
2414
|
+
]
|
|
2228
2415
|
}
|
|
2229
2416
|
},
|
|
2230
|
-
"version": "0.1.
|
|
2417
|
+
"version": "0.1.14-alpha.0"
|
|
2231
2418
|
}
|
package/package.json
CHANGED