skill-flow 1.0.2 → 1.0.4

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 (57) hide show
  1. package/README.md +62 -23
  2. package/README.zh.md +63 -25
  3. package/dist/cli.js +13 -39
  4. package/dist/cli.js.map +1 -1
  5. package/dist/domain/types.d.ts +12 -1
  6. package/dist/services/doctor-service.js +1 -1
  7. package/dist/services/doctor-service.js.map +1 -1
  8. package/dist/services/skill-flow.d.ts +16 -13
  9. package/dist/services/skill-flow.js +158 -5
  10. package/dist/services/skill-flow.js.map +1 -1
  11. package/dist/services/source-service.d.ts +11 -1
  12. package/dist/services/source-service.js +60 -18
  13. package/dist/services/source-service.js.map +1 -1
  14. package/dist/services/workflow-service.d.ts +2 -2
  15. package/dist/services/workflow-service.js +17 -4
  16. package/dist/services/workflow-service.js.map +1 -1
  17. package/dist/services/workspace-bootstrap-service.d.ts +25 -0
  18. package/dist/services/workspace-bootstrap-service.js +148 -0
  19. package/dist/services/workspace-bootstrap-service.js.map +1 -0
  20. package/dist/state/store.js +1 -0
  21. package/dist/state/store.js.map +1 -1
  22. package/dist/tests/skill-flow.test.js +1458 -0
  23. package/dist/tests/skill-flow.test.js.map +1 -1
  24. package/dist/tui/config-app.d.ts +3 -0
  25. package/dist/tui/config-app.js +61 -1
  26. package/dist/tui/config-app.js.map +1 -1
  27. package/dist/tui/find-app.d.ts +1 -1
  28. package/dist/tui/find-app.js +36 -4
  29. package/dist/tui/find-app.js.map +1 -1
  30. package/dist/utils/format.js +1 -1
  31. package/dist/utils/format.js.map +1 -1
  32. package/dist/utils/naming.d.ts +1 -0
  33. package/dist/utils/naming.js +7 -1
  34. package/dist/utils/naming.js.map +1 -1
  35. package/dist/utils/source-id.js +4 -0
  36. package/dist/utils/source-id.js.map +1 -1
  37. package/package.json +10 -1
  38. package/.gstack/browse-network.log +0 -1
  39. package/.gstack/browse.json +0 -7
  40. package/.gstack/qa-reports/base-branch.txt +0 -1
  41. package/.gstack/qa-reports/qa-report-skill-flow-cli-2026-03-22.md +0 -159
  42. package/.gstack/qa-reports/qa-report-skill-manager-2026-03-22.md +0 -60
  43. package/docs/DESIGN.md +0 -407
  44. package/docs/PRD/PRD-1.0.0.md +0 -1862
  45. package/docs/PRD/renew/PRD-0.0.0.md +0 -26
  46. package/docs/PRD/renew/PRD-0.0.1.md +0 -408
  47. package/docs/PRD/renew/PRD-0.0.2.md +0 -705
  48. package/docs/PRD/renew/PRD-0.0.3.md +0 -740
  49. package/docs/PRD/renew/PRD-0.0.4.md +0 -1494
  50. package/docs/README.md +0 -242
  51. package/docs/plan/PLAN_v1.0.0.md +0 -663
  52. package/docs/plan/PLAN_v1.0.1.md +0 -845
  53. package/docs/refrences/README.md +0 -9
  54. package/docs/refrences/agent-skill-paths.md +0 -274
  55. package/docs/refrences/config-state-reconciliation.md +0 -199
  56. package/docs/refrences/naming-dedupe-warning-rules.md +0 -482
  57. package/img/img-1.jpg +0 -0
@@ -1,845 +0,0 @@
1
- # Skill Flow Implementation Plan
2
-
3
- Version: v1.0.1
4
- Status: ENGINEERING REVIEWED
5
- Date: 2026-03-22
6
- Product mode: Source Expansion + Discovery Entry
7
- Platform: macOS
8
- CLI entry: `skill-flow`
9
- State root: `~/.skillflow/`
10
-
11
- ## 1. Executive Summary
12
-
13
- `v1.0.1` adds two product capabilities:
14
- - expanded `add` beyond plain Git clone
15
- - a first `find` / `search` discovery flow
16
-
17
- This release does not try to become a full ecosystem registry.
18
- It stays narrow:
19
- - Git sources still matter
20
- - built-in Git catalogs provide a fixed discovery corpus
21
- - ClawHub becomes the only new remote structured source
22
- - `find` merges local inventory, built-in Git catalogs, and ClawHub search
23
-
24
- The engineering goal is not "support every source."
25
- The engineering goal is:
26
-
27
- ```text
28
- take the existing Git-only workflow manager
29
- ->
30
- make source ingestion multi-kind without breaking state
31
- ->
32
- add a small discovery entrypoint that always leads back to `add`
33
- ```
34
-
35
- This plan explicitly avoids:
36
- - broad Git host search
37
- - persistent discovery cache
38
- - a plugin SDK
39
- - importing `.clawhub` local state
40
- - a new `install <candidate>` command
41
-
42
- ## 2. Why This Release Exists
43
-
44
- `v1.0.0` shipped a narrow but real baseline:
45
- - Git source add / update / uninstall
46
- - grouped workflow management
47
- - config / apply / doctor
48
- - explicit `manifest.json + lock.json`
49
-
50
- That baseline is useful, but two gaps are now visible:
51
- - users still need to know a source before they can do anything
52
- - `add` still behaves like a Git clone wrapper instead of a source-ingestion command
53
-
54
- `v1.0.1` closes those gaps without changing the product's core identity.
55
-
56
- ## 3. Research Summary
57
-
58
- Research date: 2026-03-22
59
-
60
- Primary references:
61
- - Vercel skills repo: <https://github.com/vercel-labs/skills>
62
- - Vercel `find-skills` skill: <https://github.com/vercel-labs/skills/tree/main/skills/find-skills>
63
- - OpenAI `skill-installer` skill: <https://github.com/openai/skills/blob/main/skills/.system/skill-installer/SKILL.md>
64
- - OpenClaw ClawHub docs: <https://docs.openclaw.ai/tools/clawhub>
65
-
66
- ### 3.1 Vercel `skills`
67
-
68
- Observed behavior:
69
- - installation is still repo-centric
70
- - accepted inputs include `owner/repo`, full URL, repo tree URL, and local path
71
- - discovery is a workflow that helps users choose a source, then route into installation
72
-
73
- Takeaways:
74
- - `find` and `add` should be one journey
75
- - repo subpath install is a real need
76
- - discovery can start with explicit rules and curated sources
77
-
78
- ### 3.2 OpenAI `skill-installer`
79
-
80
- Observed behavior:
81
- - supports repo, URL, local path, and repo subpath installation
82
- - prefers direct download for public content
83
- - falls back to sparse checkout when needed
84
-
85
- Takeaways:
86
- - path-scoped install is worth doing
87
- - source identity should still remain repo-first
88
- - direct path input does not require inventing a separate package model
89
-
90
- ### 3.3 ClawHub
91
-
92
- Observed behavior:
93
- - `clawhub search` is a structured discovery surface
94
- - `clawhub install` installs named skills with optional version selection
95
- - installation lands in the current workspace `./skills`
96
- - state is tracked under `.clawhub/`
97
-
98
- Takeaways:
99
- - ClawHub is a real source kind, not just another Git locator
100
- - its identity model is `slug + version`, not `remote + commit`
101
- - its install UX is useful reference
102
- - its on-disk state model should not be reused inside `skill-flow`
103
-
104
- Engineering conclusion:
105
- - do not shell out to `clawhub install` and absorb `.clawhub/lock.json`
106
- - do implement ClawHub fetch/search against `skill-flow`'s own state and cache model
107
-
108
- ## 4. What Already Exists
109
-
110
- Existing code and flows this plan must reuse:
111
-
112
- - [src/services/source-service.ts](/Users/Vint/仓库/03%20Project/skill-manager/src/services/source-service.ts)
113
- Reuse:
114
- - source add/update/remove orchestration
115
- - leaf scan + manifest/lock write flow
116
- - source-level update semantics
117
-
118
- - [src/services/skill-flow.ts](/Users/Vint/仓库/03%20Project/skill-manager/src/services/skill-flow.ts)
119
- Reuse:
120
- - application service entrypoints
121
- - existing orchestration pattern for CLI commands
122
-
123
- - [src/state/store.ts](/Users/Vint/仓库/03%20Project/skill-manager/src/state/store.ts)
124
- Reuse:
125
- - manifest / lock path ownership
126
- - state root initialization
127
- Change:
128
- - source cache path resolution must become source-kind aware
129
-
130
- - [src/tests/skill-flow.test.ts](/Users/Vint/仓库/03%20Project/skill-manager/src/tests/skill-flow.test.ts)
131
- Reuse:
132
- - temp repo + temp state test harness
133
- - integration-heavy testing style
134
- - existing backward-compat lock read pattern
135
-
136
- - [src/cli.tsx](/Users/Vint/仓库/03%20Project/skill-manager/src/cli.tsx)
137
- Reuse:
138
- - existing command registration shell
139
- Change:
140
- - add `find`
141
- - add `search` alias
142
- - widen `add` argument semantics
143
-
144
- Existing things this plan must not rebuild:
145
- - a second state layer for discovery
146
- - a second service layer parallel to `SkillFlowApp`
147
- - a generalized source plugin system
148
-
149
- ## 5. NOT In Scope
150
-
151
- - Broad GitHub / GitLab keyword search
152
- Reason: low-signal results and unclear trust model
153
-
154
- - Persistent discovery cache files
155
- Reason: no demonstrated performance need yet
156
-
157
- - `install <candidate>` top-level command
158
- Reason: `find -> add` is sufficient for this release
159
-
160
- - Importing `.clawhub` local state
161
- Reason: it would couple two source-of-truth systems
162
-
163
- - Stars / install counts / leaderboard aggregation from arbitrary public hosts
164
- Reason: data quality and trust are not stable enough
165
-
166
- - Registry / source plugin SDK
167
- Reason: two concrete source kinds do not justify a framework
168
-
169
- ## 6. Step 0 Scope Challenge
170
-
171
- This plan is intentionally split into two bounded delivery tracks:
172
-
173
- ```text
174
- Track A: Source expansion
175
- - naming alignment
176
- - multi-kind storage
177
- - ClawHub add/update/uninstall
178
- - Git repo-subpath add
179
-
180
- Track B: Discovery
181
- - find/search
182
- - local + built-in Git + ClawHub result merge
183
- - ranking
184
- - candidate -> add command bridge
185
- ```
186
-
187
- This is not a scope reduction in product value.
188
- It is a scope reduction in simultaneous moving parts.
189
-
190
- Without this split, one release would change:
191
- - naming and state paths
192
- - source fetch/update semantics
193
- - CLI surface
194
- - result ranking
195
- - follow-up action generation
196
-
197
- That is too much blast radius for one undifferentiated implementation batch.
198
-
199
- ## 7. Architecture Decisions
200
-
201
- ### 7.1 Phase 0: Naming And State-Root Alignment
202
-
203
- Before new behavior is added, `v1.0.1` must align plan and code on one product identity.
204
-
205
- Lock for this release:
206
- - CLI name: `skill-flow`
207
- - state root: `~/.skillflow/`
208
- - env var prefix: `SKILL_FLOW_`
209
-
210
- Do not mix:
211
- - `skill-manager`
212
- - `.skillmanager`
213
- - future rename ideas
214
-
215
- If product rename work is desired later, it must be a separate plan.
216
-
217
- ### 7.2 Keep The Existing Source Of Truth
218
-
219
- Keep:
220
- - `manifest.json`
221
- - `lock.json`
222
-
223
- Do not add:
224
- - `inventory-index.json`
225
- - `discovery-cache.json`
226
- - `channels.json`
227
-
228
- Discovery results are ephemeral.
229
- Only actual installed sources modify persistent state.
230
-
231
- ### 7.3 Multi-Kind Source Storage Is Explicit
232
-
233
- Current code assumes one cache root: Git.
234
- That is no longer enough.
235
-
236
- New required cache layout:
237
-
238
- ```text
239
- ~/.skillflow/
240
- ├── source/
241
- │ ├── git/
242
- │ │ └── <source-id>/
243
- │ └── clawhub/
244
- │ └── <source-id>/
245
- ├── manifest.json
246
- └── lock.json
247
- ```
248
-
249
- `StateStore` owns this path resolution.
250
- Adapters must not construct cache paths themselves.
251
-
252
- Required API direction:
253
- - `getSourceRoot(kind)`
254
- - `getSourceCheckoutPath(kind, sourceId)`
255
-
256
- ### 7.4 Source Identity Stays Source-First
257
-
258
- Direct path installs do not create a new source identity.
259
-
260
- Rules:
261
- - source identity is based on normalized source locator
262
- - `--path` is not part of source identity
263
- - the same repo cannot be registered twice just because the requested path differs
264
- - `--path` is an add-time selection filter and optional persisted preference only
265
-
266
- This preserves update and uninstall semantics at source granularity.
267
-
268
- ### 7.5 Minimal Source Adapter Seam
269
-
270
- Do not build a plugin system.
271
- Do not let adapters own state writes or scanning.
272
-
273
- Only extract source-specific IO:
274
- - `resolve(locator)`
275
- - `fetch(resolved, destination)`
276
- - `update(existingSnapshot, checkoutPath)`
277
-
278
- Keep in `SourceService`:
279
- - manifest/lock writes
280
- - inventory scan
281
- - source diffing
282
- - duplicate detection
283
- - source lifecycle orchestration
284
-
285
- This is the smallest seam that cleanly supports:
286
- - Git
287
- - ClawHub
288
-
289
- ### 7.6 `find` Is A Read-Time Aggregation Service
290
-
291
- `find` aggregates:
292
- - local installed inventory
293
- - built-in Git catalogs
294
- - ClawHub search metadata
295
-
296
- It does not:
297
- - download bundles during search
298
- - mutate manifest/lock
299
- - create background cache state
300
-
301
- Search fetch policy:
302
- - `find` requests metadata only
303
- - `add` downloads source content
304
-
305
- ### 7.7 Built-In Git Catalogs Are Fixed And Curated
306
-
307
- `find` includes a fixed built-in Git catalog list.
308
-
309
- This list merges the original default catalog and the expanded catalog set, de-duplicated by repository:
310
-
311
- | Repository | Branch |
312
- | --- | --- |
313
- | `anthropics/skills` | `main` |
314
- | `obra/superpowers` | `main` |
315
- | `affaan-m/everything-claude-code` | `main` |
316
- | `msitarzewski/agency-agents` | `main` |
317
- | `nextlevelbuilder/ui-ux-pro-max-skill` | `main` |
318
- | `sickn33/antigravity-awesome-skills` | `main` |
319
- | `coreyhaines31/marketingskills` | `main` |
320
- | `agentskills/agentskills` | `main` |
321
- | `Leonxlnx/taste-skill` | `main` |
322
- | `Affitor/affiliate-skills` | `main` |
323
- | `luongnv89/skills` | `main` |
324
- | `ComposioHQ/awesome-claude-skills` | `master` |
325
- | `cexll/myclaude` | `master` |
326
- | `JimLiu/baoyu-skills` | `main` |
327
- | `dontbesilent2025/dbskill` | `main` |
328
- | `garrytan/gstack` | `main` |
329
- | `pbakaus/impeccable` | `main` |
330
- | `zarazhangrui/frontend-slides` | `main` |
331
-
332
- ### 7.8 Candidate-To-Command Bridge Is A First-Class Boundary
333
-
334
- `find` output must not hand-build `add` command strings in CLI formatting code.
335
-
336
- Instead:
337
- - candidate assembly produces normalized `SkillCandidate`
338
- - a single command-builder maps candidate -> follow-up `add` command
339
- - text output and JSON output both consume the same mapping source
340
-
341
- This avoids formatter drift between:
342
- - Git candidates
343
- - Git + path candidates
344
- - ClawHub floating candidates
345
- - ClawHub pinned candidates
346
-
347
- ## 8. Data Flow Diagrams
348
-
349
- ### 8.1 Expanded `add`
350
-
351
- ```text
352
- user input
353
- |
354
- v
355
- parse locator + optional --path
356
- |
357
- v
358
- resolve source kind
359
- |
360
- +--> git resolver
361
- |
362
- +--> clawhub resolver
363
- |
364
- v
365
- fetch source checkout into source/<kind>/<source-id>
366
- |
367
- v
368
- scan checkout for valid leafs
369
- |
370
- v
371
- apply optional path filter / preference
372
- |
373
- v
374
- write manifest + lock
375
- |
376
- v
377
- optional follow-up apply/config
378
- ```
379
-
380
- ### 8.2 `find`
381
-
382
- ```text
383
- query
384
- |
385
- +--> local inventory matcher
386
- |
387
- +--> built-in git catalog matcher
388
- |
389
- +--> clawhub search metadata
390
- |
391
- v
392
- merge candidates
393
- |
394
- v
395
- rank with explicit rule table
396
- |
397
- v
398
- candidate -> add command builder
399
- |
400
- +--> text output
401
- |
402
- +--> json output
403
- ```
404
-
405
- ## 9. Command Design
406
-
407
- ### 9.1 `skill-flow add`
408
-
409
- ```bash
410
- skill-flow add <locator>
411
- [--path <repoSubpath>]
412
- [--channel <channel...>]
413
- [--yes]
414
- [--json]
415
- ```
416
-
417
- Supported locators:
418
- - GitHub shorthand: `owner/repo`
419
- - full Git URL
420
- - SSH Git URL
421
- - local path
422
- - GitHub tree URL
423
- - `clawhub:<slug>`
424
- - `clawhub:<slug>@<version>`
425
-
426
- Behavior:
427
- - detect source kind before fetch
428
- - normalize source identity
429
- - for GitHub tree URL:
430
- - resolve repo locator
431
- - extract subpath as `--path` intent
432
- - for `--path`:
433
- - narrow the initial result to matching leafs
434
- - do not create a distinct source identity
435
- - for `--channel`:
436
- - reuse existing apply flow after add
437
-
438
- ### 9.2 `skill-flow find`
439
-
440
- ```bash
441
- skill-flow find <query>
442
- [--source local|clawhub|all]
443
- [--limit <n>]
444
- [--json]
445
- ```
446
-
447
- Behavior:
448
- - default source is `all`
449
- - search local inventory and ClawHub metadata
450
- - return structured candidates
451
- - annotate installed matches
452
- - show exact follow-up `add` command for each result
453
-
454
- ### 9.3 `skill-flow search`
455
-
456
- ```bash
457
- skill-flow search <query>
458
- ```
459
-
460
- Behavior:
461
- - exact alias of `find`
462
- - same output shape
463
- - same options
464
-
465
- ## 10. Data Model Changes
466
-
467
- ### 10.1 Source kinds
468
-
469
- ```ts
470
- type SourceKind = "git" | "clawhub";
471
- ```
472
-
473
- ### 10.2 Source manifest
474
-
475
- Keep current manifest structure.
476
- Extend only enough to allow:
477
- - `kind = "git" | "clawhub"`
478
- - normalized locators for ClawHub
479
-
480
- ### 10.3 Source lock
481
-
482
- Keep one `sources[]` array.
483
- Do not split by kind.
484
-
485
- Required fields:
486
- - shared:
487
- - `id`
488
- - `locator`
489
- - `kind`
490
- - `displayName`
491
- - `checkoutPath`
492
- - `updatedAt`
493
- - `leafIds`
494
- - `invalidLeafs`
495
-
496
- - Git-specific:
497
- - `commitSha`
498
-
499
- - ClawHub-specific:
500
- - `packageSlug`
501
- - `resolvedVersion`
502
- - `contentHash`
503
- - `versionMode`
504
-
505
- `versionMode` is:
506
- - `pinned`
507
- - `floating`
508
-
509
- ### 10.4 `SkillCandidate`
510
-
511
- `SkillCandidate` is an internal result object for `find`.
512
-
513
- Group fields by responsibility.
514
-
515
- Identity:
516
- - `candidateId`
517
- - `sourceKind`
518
- - `locator`
519
- - `skillPath?`
520
- - `version?`
521
-
522
- Display:
523
- - `title`
524
- - `summary`
525
- - `official`
526
- - `alreadyInstalled`
527
- - `installedSourceId?`
528
-
529
- Action:
530
- - `installCommand`
531
-
532
- Internal-only:
533
- - `score`
534
-
535
- Rules:
536
- - `score` is not a stable public contract
537
- - do not add leaderboard or popularity fields in this release
538
-
539
- ## 11. Ranking Rules For `find`
540
-
541
- Do not implement free-form numeric tuning first.
542
- Implement a rule table.
543
-
544
- Ordering rules:
545
-
546
- ```text
547
- Step 1: group by trust tier
548
- Tier 0 = local installed inventory
549
- Tier 1 = ClawHub registry results
550
-
551
- Step 2: within a tier, exact token overlap beats partial overlap
552
-
553
- Step 3: installed exact match beats installed partial match
554
-
555
- Step 4: remote result with exact title/path match beats remote partial text match
556
-
557
- Step 5: stable tie-break by:
558
- sourceKind
559
- title
560
- locator
561
- ```
562
-
563
- Notes:
564
- - no broad Git host search in `v1.0.1`
565
- - `score` may exist internally, but implementation must preserve the rule table above
566
-
567
- ## 12. Implementation Plan
568
-
569
- ### Phase 0: Naming And Path Alignment
570
-
571
- Goal:
572
- - remove naming drift before new behavior lands
573
-
574
- Tasks:
575
- - align plan, README, and implementation on `skill-flow`
576
- - align state root references on `~/.skillflow/`
577
- - align env var references on `SKILL_FLOW_*`
578
- - document that any future rename is out of scope
579
-
580
- Exit criteria:
581
- - no mixed `skill-manager` / `skill-flow` references remain in the active implementation plan
582
-
583
- ### Phase 1: Source Storage And Resolver Refactor
584
-
585
- Goal:
586
- - make source ingestion multi-kind without broad refactor
587
-
588
- Tasks:
589
- - make `StateStore` source-kind aware
590
- - add a source-kind resolver
591
- - keep orchestration in `SourceService`
592
- - extract only source-specific IO seam
593
- - preserve existing Git behavior
594
-
595
- Exit criteria:
596
- - current Git add/update/uninstall tests still pass
597
- - source cache path is resolved by store, not by callers
598
-
599
- ### Phase 2: ClawHub Source Support
600
-
601
- Goal:
602
- - support ClawHub as a real source kind in local state
603
-
604
- Tasks:
605
- - parse `clawhub:<slug>`
606
- - parse `clawhub:<slug>@<version>`
607
- - fetch source bundle into `source/clawhub/<source-id>`
608
- - persist ClawHub lock metadata
609
- - support update semantics:
610
- - floating source resolves latest only on `update`
611
- - pinned source remains pinned
612
- - support uninstall through the existing source lifecycle path
613
-
614
- Exit criteria:
615
- - add works for floating and pinned ClawHub locators
616
- - update differentiates pinned and floating behavior
617
- - uninstall removes ClawHub cache and deployments cleanly
618
-
619
- ### Phase 3: Git Path-Scoped Add
620
-
621
- Goal:
622
- - support Git installs that begin from a repo subpath
623
-
624
- Tasks:
625
- - support `--path`
626
- - parse GitHub tree URLs into repo + path intent
627
- - validate whether requested path maps to:
628
- - a valid leaf
629
- - or a valid source subtree
630
- - reject existing-but-invalid paths clearly
631
- - preserve source identity without duplicating the repo
632
-
633
- Exit criteria:
634
- - repo path installs work without duplicating source identity
635
- - same repo cannot be registered twice by changing only `--path`
636
-
637
- ### Phase 4: Discovery
638
-
639
- Goal:
640
- - provide a small, reliable discovery entrypoint
641
-
642
- Tasks:
643
- - add `find`
644
- - add `search` alias
645
- - build local inventory matcher
646
- - build ClawHub metadata search integration
647
- - merge candidates
648
- - rank by the explicit rule table
649
- - annotate installed state
650
- - use the shared candidate-to-command builder for all outputs
651
-
652
- Exit criteria:
653
- - local-only results work
654
- - remote-only results work
655
- - mixed local+remote results are stable
656
- - every actionable result produces a correct `add` command
657
-
658
- ### Phase 5: Docs And Verification
659
-
660
- Goal:
661
- - make the release verifiable and understandable
662
-
663
- Tasks:
664
- - update README command examples
665
- - update help text
666
- - add diagrams to the plan
667
- - add any inline ASCII diagrams needed in touched implementation files
668
- - expand tests for new branches and failure modes
669
-
670
- Exit criteria:
671
- - command surface and docs match implementation
672
- - new codepaths are covered by tests, not just happy paths
673
-
674
- ## 13. Test Plan
675
-
676
- ### 13.1 New flow diagram
677
-
678
- ```text
679
- A. Expanded add
680
- git shorthand/url/local path/tree url
681
- clawhub slug / slug@version
682
- optional --path filter
683
-
684
- B. Discovery
685
- local inventory
686
- remote clawhub metadata
687
- merge
688
- rank
689
- command build
690
-
691
- C. Mixed state
692
- git-only old state
693
- git + clawhub new state
694
- update / uninstall / reconcile
695
- ```
696
-
697
- ### 13.2 Required unit tests
698
-
699
- - locator parsing
700
- - Git shorthand
701
- - Git URL
702
- - local path
703
- - GitHub tree URL
704
- - ClawHub floating
705
- - ClawHub pinned
706
-
707
- - ranking rule table
708
- - local exact > local partial
709
- - local > remote
710
- - remote exact > remote partial
711
- - stable tie-break order
712
-
713
- - candidate-to-command builder
714
- - Git candidate
715
- - Git candidate with path
716
- - ClawHub floating candidate
717
- - ClawHub pinned candidate
718
-
719
- ### 13.3 Required integration tests
720
-
721
- - add Git source by shorthand / URL / local path
722
- - add GitHub tree URL
723
- - add Git source with `--path`
724
- - reject `--path` when it exists but is not a valid skill root
725
- - reject duplicate repo registration when only `--path` differs
726
-
727
- - add ClawHub floating source
728
- - add ClawHub pinned source
729
- - reject missing ClawHub package
730
- - reject ClawHub bundle with zero valid skills
731
-
732
- - update floating ClawHub source to newer version
733
- - keep pinned ClawHub source fixed on update
734
- - uninstall ClawHub source cleanly
735
-
736
- - `find` local-only hit
737
- - `find` remote-only hit
738
- - `find` mixed local+remote hit
739
- - `search` alias parity with `find`
740
- - `find --json` output shape
741
-
742
- ### 13.4 Required failure-path tests
743
-
744
- - local inventory success + remote ClawHub failure -> return local results with warning
745
- - local empty + remote ClawHub failure -> clear error
746
- - malformed remote candidate payload -> clear drop/error behavior
747
- - failed ClawHub fetch must not dirty manifest/lock
748
- - mixed git + clawhub state survives:
749
- - list
750
- - update
751
- - uninstall
752
- - reconcile
753
-
754
- ### 13.5 Backward compatibility tests
755
-
756
- - old git-only lock remains readable
757
- - optional ClawHub lock fields do not break Git-only reads
758
- - mixed git/clawhub sources coexist in one lock file
759
-
760
- ## 14. Failure Modes
761
-
762
- | Codepath | Realistic failure | Test required | Error handling required | User-visible outcome |
763
- |---|---|---:|---:|---|
764
- | Git `add --path` | path exists but is not a valid skill root | yes | yes | clear validation error |
765
- | ClawHub `add` | package found but bundle has no valid skills | yes | yes | clear add failure |
766
- | ClawHub `update` | resolved version changes but lock/inventory diverge | yes | yes | clear update failure, no partial state |
767
- | `find` | remote search fails | yes | yes | warning + partial results, or clear error |
768
- | command builder | wrong follow-up `add` command | yes | yes | no silent mismatch |
769
- | mixed-state reconcile | Git-only assumptions break ClawHub records | yes | yes | no silent corruption |
770
-
771
- Critical rule:
772
- - if a failure mode has no test and no clear user-visible error, implementation is not done
773
-
774
- ## 15. Open Questions And Locked Recommendations
775
-
776
- ### 15.1 ClawHub fetch method
777
-
778
- Question:
779
- - use documented HTTP contract directly, or shell out to CLI?
780
-
781
- Locked recommendation:
782
- - prefer documented HTTP / bundle fetch directly
783
- - CLI bridge is fallback only if HTTP contract is incomplete
784
-
785
- ### 15.2 Path-scoped add semantics
786
-
787
- Question:
788
- - should `--path` auto-select and auto-bind the leaf?
789
-
790
- Locked recommendation:
791
- - no hidden auto-apply
792
- - use `--path` only to narrow the add result / optional persisted preference
793
- - let `config` remain the binding surface
794
-
795
- ### 15.3 Floating ClawHub version policy
796
-
797
- Question:
798
- - when should a floating source advance?
799
-
800
- Locked recommendation:
801
- - resolve version on add
802
- - persist resolved version in lock
803
- - only advance on explicit `update`
804
-
805
- ## 16. Inline Diagram Targets In Code
806
-
807
- When implementing this plan, add or update inline ASCII diagrams in:
808
-
809
- - [src/services/source-service.ts](/Users/Vint/仓库/03%20Project/skill-manager/src/services/source-service.ts)
810
- For:
811
- - source resolve -> fetch -> scan -> persist pipeline
812
-
813
- - [src/services/skill-flow.ts](/Users/Vint/仓库/03%20Project/skill-manager/src/services/skill-flow.ts)
814
- For:
815
- - `find` orchestration
816
- - candidate -> command output flow
817
-
818
- - new ranking / command-builder files
819
- For:
820
- - ranking rule table
821
- - candidate-to-command decision tree
822
-
823
- ## 17. Definition Of Done
824
-
825
- `v1.0.1` is done when all of the following are true:
826
-
827
- - naming and state-root references are aligned on `skill-flow`
828
- - source cache layout is `source/<kind>/<source-id>`
829
- - `add` supports Git and ClawHub locators
830
- - `add` supports repo subpath intent without duplicating source identity
831
- - `find` exists
832
- - `search` aliases to `find`
833
- - `find` merges local inventory and ClawHub metadata
834
- - ranking follows the explicit rule table
835
- - all `find` outputs use the shared candidate-to-command builder
836
- - partial remote failure behavior is implemented and tested
837
- - mixed git/clawhub lock state is implemented and tested
838
- - docs match the shipped command surface
839
-
840
- ## 18. References
841
-
842
- - <https://github.com/vercel-labs/skills>
843
- - <https://github.com/vercel-labs/skills/tree/main/skills/find-skills>
844
- - <https://github.com/openai/skills/blob/main/skills/.system/skill-installer/SKILL.md>
845
- - <https://docs.openclaw.ai/tools/clawhub>