harnesstap 1.2.0 → 1.3.1
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 +28 -15
- package/dist/apply-2GRNKR5H.js +67 -0
- package/dist/apply-2GRNKR5H.js.map +1 -0
- package/dist/approve-KQNCNH2R.js +181 -0
- package/dist/approve-KQNCNH2R.js.map +1 -0
- package/dist/audit-SLYOZCMI.js +434 -0
- package/dist/audit-SLYOZCMI.js.map +1 -0
- package/dist/auth-3IEVICFT.js +220 -0
- package/dist/auth-3IEVICFT.js.map +1 -0
- package/dist/bin.js +166 -0
- package/dist/bin.js.map +1 -0
- package/dist/chunk-2EIJYDNI.js +10945 -0
- package/dist/chunk-2EIJYDNI.js.map +1 -0
- package/dist/chunk-2H7UOFLK.js +11 -0
- package/dist/chunk-2H7UOFLK.js.map +1 -0
- package/dist/chunk-37E5M4JX.js +34 -0
- package/dist/chunk-37E5M4JX.js.map +1 -0
- package/dist/chunk-3FIWOI3H.js +98 -0
- package/dist/chunk-3FIWOI3H.js.map +1 -0
- package/dist/chunk-3IWTJCPA.js +6448 -0
- package/dist/chunk-3IWTJCPA.js.map +1 -0
- package/dist/chunk-3IZ7SEGT.js +346 -0
- package/dist/chunk-3IZ7SEGT.js.map +1 -0
- package/dist/chunk-3RBYT7QN.js +540 -0
- package/dist/chunk-3RBYT7QN.js.map +1 -0
- package/dist/chunk-4KNQZDZC.js +115 -0
- package/dist/chunk-4KNQZDZC.js.map +1 -0
- package/dist/chunk-5F3LNDZG.js +9 -0
- package/dist/chunk-5F3LNDZG.js.map +1 -0
- package/dist/chunk-63U7QWNY.js +364 -0
- package/dist/chunk-63U7QWNY.js.map +1 -0
- package/dist/chunk-6BY4BV5G.js +998 -0
- package/dist/chunk-6BY4BV5G.js.map +1 -0
- package/dist/chunk-7L2K4N25.js +610 -0
- package/dist/chunk-7L2K4N25.js.map +1 -0
- package/dist/chunk-7LWH5SWH.js +18 -0
- package/dist/chunk-7LWH5SWH.js.map +1 -0
- package/dist/chunk-BIBUCC2E.js +696 -0
- package/dist/chunk-BIBUCC2E.js.map +1 -0
- package/dist/chunk-BSOBXLYI.js +172 -0
- package/dist/chunk-BSOBXLYI.js.map +1 -0
- package/dist/chunk-C4QBVVEH.js +32 -0
- package/dist/chunk-C4QBVVEH.js.map +1 -0
- package/dist/chunk-CHQGE2HF.js +283 -0
- package/dist/chunk-CHQGE2HF.js.map +1 -0
- package/dist/chunk-DV74UZJI.js +87 -0
- package/dist/chunk-DV74UZJI.js.map +1 -0
- package/dist/chunk-DWVAR4BP.js +656 -0
- package/dist/chunk-DWVAR4BP.js.map +1 -0
- package/dist/chunk-DXKAKKLP.js +302 -0
- package/dist/chunk-DXKAKKLP.js.map +1 -0
- package/dist/chunk-EIWXS4RM.js +235 -0
- package/dist/chunk-EIWXS4RM.js.map +1 -0
- package/dist/chunk-EWBCFAF3.js +681 -0
- package/dist/chunk-EWBCFAF3.js.map +1 -0
- package/dist/chunk-F2L4VNQK.js +1759 -0
- package/dist/chunk-F2L4VNQK.js.map +1 -0
- package/dist/chunk-G26HZZDJ.js +1359 -0
- package/dist/chunk-G26HZZDJ.js.map +1 -0
- package/dist/chunk-GQKKX7OE.js +818 -0
- package/dist/chunk-GQKKX7OE.js.map +1 -0
- package/dist/chunk-GRJY22U6.js +691 -0
- package/dist/chunk-GRJY22U6.js.map +1 -0
- package/dist/chunk-H6DVP2SI.js +682 -0
- package/dist/chunk-H6DVP2SI.js.map +1 -0
- package/dist/chunk-HVVPTCKR.js +1173 -0
- package/dist/chunk-HVVPTCKR.js.map +1 -0
- package/dist/chunk-I6XFZLTJ.js +9 -0
- package/dist/chunk-I6XFZLTJ.js.map +1 -0
- package/dist/chunk-IBOABSIA.js +17 -0
- package/dist/chunk-IBOABSIA.js.map +1 -0
- package/dist/chunk-IK524ZDW.js +691 -0
- package/dist/chunk-IK524ZDW.js.map +1 -0
- package/dist/chunk-IRU7NBOT.js +141 -0
- package/dist/chunk-IRU7NBOT.js.map +1 -0
- package/dist/chunk-J4CKQXQ6.js +806 -0
- package/dist/chunk-J4CKQXQ6.js.map +1 -0
- package/dist/chunk-JKGSJGCC.js +311 -0
- package/dist/chunk-JKGSJGCC.js.map +1 -0
- package/dist/chunk-JQOKQKQT.js +158 -0
- package/dist/chunk-JQOKQKQT.js.map +1 -0
- package/dist/chunk-JRFUTIEH.js +426 -0
- package/dist/chunk-JRFUTIEH.js.map +1 -0
- package/dist/chunk-K2BPYEH5.js +491 -0
- package/dist/chunk-K2BPYEH5.js.map +1 -0
- package/dist/chunk-KCQC7YBK.js +7795 -0
- package/dist/chunk-KCQC7YBK.js.map +1 -0
- package/dist/chunk-KDAV2GUT.js +1357 -0
- package/dist/chunk-KDAV2GUT.js.map +1 -0
- package/dist/chunk-KDDXZBMC.js +583 -0
- package/dist/chunk-KDDXZBMC.js.map +1 -0
- package/dist/chunk-KMWHZSEG.js +41 -0
- package/dist/chunk-KMWHZSEG.js.map +1 -0
- package/dist/chunk-KRI4R7EM.js +25 -0
- package/dist/chunk-KRI4R7EM.js.map +1 -0
- package/dist/chunk-LNJ3WZZX.js +186 -0
- package/dist/chunk-LNJ3WZZX.js.map +1 -0
- package/dist/chunk-MWXA4PFE.js +103 -0
- package/dist/chunk-MWXA4PFE.js.map +1 -0
- package/dist/chunk-MY62SSKC.js +183 -0
- package/dist/chunk-MY62SSKC.js.map +1 -0
- package/dist/chunk-NAGAJ5UM.js +145 -0
- package/dist/chunk-NAGAJ5UM.js.map +1 -0
- package/dist/chunk-NJ7WRKIQ.js +532 -0
- package/dist/chunk-NJ7WRKIQ.js.map +1 -0
- package/dist/chunk-OS6NUIBJ.js +38 -0
- package/dist/chunk-OS6NUIBJ.js.map +1 -0
- package/dist/chunk-PXU2OS26.js +238 -0
- package/dist/chunk-PXU2OS26.js.map +1 -0
- package/dist/chunk-QO4LBDVI.js +496 -0
- package/dist/chunk-QO4LBDVI.js.map +1 -0
- package/dist/chunk-QRZPQNLX.js +65 -0
- package/dist/chunk-QRZPQNLX.js.map +1 -0
- package/dist/chunk-SNVAMWB7.js +40 -0
- package/dist/chunk-SNVAMWB7.js.map +1 -0
- package/dist/chunk-SPRVUATR.js +430 -0
- package/dist/chunk-SPRVUATR.js.map +1 -0
- package/dist/chunk-SY7G5QEI.js +35 -0
- package/dist/chunk-SY7G5QEI.js.map +1 -0
- package/dist/chunk-SZNBUIDR.js +6438 -0
- package/dist/chunk-SZNBUIDR.js.map +1 -0
- package/dist/chunk-TQ2NA4Z4.js +24 -0
- package/dist/chunk-TQ2NA4Z4.js.map +1 -0
- package/dist/chunk-TYULB6ZY.js +2959 -0
- package/dist/chunk-TYULB6ZY.js.map +1 -0
- package/dist/chunk-UJYFTXHV.js +296 -0
- package/dist/chunk-UJYFTXHV.js.map +1 -0
- package/dist/chunk-VC6OKCJF.js +184 -0
- package/dist/chunk-VC6OKCJF.js.map +1 -0
- package/dist/chunk-VL2NWCZV.js +118 -0
- package/dist/chunk-VL2NWCZV.js.map +1 -0
- package/dist/chunk-VL7BGD47.js +514 -0
- package/dist/chunk-VL7BGD47.js.map +1 -0
- package/dist/chunk-VQVUJYYY.js +244 -0
- package/dist/chunk-VQVUJYYY.js.map +1 -0
- package/dist/chunk-VZQG2JDV.js +9 -0
- package/dist/chunk-VZQG2JDV.js.map +1 -0
- package/dist/chunk-XFZQVYIN.js +115 -0
- package/dist/chunk-XFZQVYIN.js.map +1 -0
- package/dist/chunk-XGTTOO4R.js +84 -0
- package/dist/chunk-XGTTOO4R.js.map +1 -0
- package/dist/chunk-XQFT4PEP.js +60 -0
- package/dist/chunk-XQFT4PEP.js.map +1 -0
- package/dist/chunk-YDD3ES2K.js +571 -0
- package/dist/chunk-YDD3ES2K.js.map +1 -0
- package/dist/chunk-ZY2MZ2KQ.js +1140 -0
- package/dist/chunk-ZY2MZ2KQ.js.map +1 -0
- package/dist/compile-57EEIUMB.js +161 -0
- package/dist/compile-57EEIUMB.js.map +1 -0
- package/dist/config-4EJ3D7QJ.js +438 -0
- package/dist/config-4EJ3D7QJ.js.map +1 -0
- package/dist/doctor-EEV6P5CH.js +111 -0
- package/dist/doctor-EEV6P5CH.js.map +1 -0
- package/dist/environment-WFEG4DAT.js +2745 -0
- package/dist/environment-WFEG4DAT.js.map +1 -0
- package/dist/github-BSMQD72A.js +114 -0
- package/dist/github-BSMQD72A.js.map +1 -0
- package/dist/harness-VX3PNVQW.js +746 -0
- package/dist/harness-VX3PNVQW.js.map +1 -0
- package/dist/help-AW2HKX63.js +2079 -0
- package/dist/help-AW2HKX63.js.map +1 -0
- package/dist/help-BVFOZD7E.js +1892 -0
- package/dist/help-BVFOZD7E.js.map +1 -0
- package/dist/index.d.ts +164 -1
- package/dist/index.js +50 -59246
- package/dist/index.js.map +1 -1
- package/dist/init-SPN2GEZ4.js +873 -0
- package/dist/init-SPN2GEZ4.js.map +1 -0
- package/dist/lock-K2LLUU7H.js +455 -0
- package/dist/lock-K2LLUU7H.js.map +1 -0
- package/dist/marketplace-VEKSWGX3.js +495 -0
- package/dist/marketplace-VEKSWGX3.js.map +1 -0
- package/dist/mcp-T6DKIKSF.js +202 -0
- package/dist/mcp-T6DKIKSF.js.map +1 -0
- package/dist/migrate-OO37WSB2.js +1043 -0
- package/dist/migrate-OO37WSB2.js.map +1 -0
- package/dist/open-3V3QK5RK.js +32 -0
- package/dist/open-3V3QK5RK.js.map +1 -0
- package/dist/pack-V32UPC7W.js +99 -0
- package/dist/pack-V32UPC7W.js.map +1 -0
- package/dist/plugin-KOBNQ7GT.js +64 -0
- package/dist/plugin-KOBNQ7GT.js.map +1 -0
- package/dist/plugin-from-project-X3VO3MB6.js +16 -0
- package/dist/plugin-from-project-X3VO3MB6.js.map +1 -0
- package/dist/policy-F5MKZNOC.js +105 -0
- package/dist/policy-F5MKZNOC.js.map +1 -0
- package/dist/profile-H4PMH4XT.js +1886 -0
- package/dist/profile-H4PMH4XT.js.map +1 -0
- package/dist/project-QVNEJJGH.js +1392 -0
- package/dist/project-QVNEJJGH.js.map +1 -0
- package/dist/resource-GL4RLSGI.js +555 -0
- package/dist/resource-GL4RLSGI.js.map +1 -0
- package/dist/version-PBHZK44K.js +17 -0
- package/dist/version-PBHZK44K.js.map +1 -0
- package/package.json +21 -14
- package/schemas/ap-package.v1.json +36 -0
- package/schemas/fixtures/catalog-missing-schema.ap.json +13 -0
- package/schemas/fixtures/confidence.ap.json +13 -0
- package/schemas/fixtures/context7.ap.json +13 -0
- package/schemas/fixtures/minimal-with-schema.ap.json +13 -0
- package/schemas/fixtures/superpowers.ap.json +13 -0
- package/schemas/fixtures/third-party-skills.ap.json +13 -0
|
@@ -0,0 +1,2079 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CANONICAL_CATALOG_BASELINE,
|
|
3
|
+
CANONICAL_CATALOG_SEARCH_HINT
|
|
4
|
+
} from "./chunk-5F3LNDZG.js";
|
|
5
|
+
import {
|
|
6
|
+
PROFILE_PLUGIN_TAG,
|
|
7
|
+
listProfilePlugins
|
|
8
|
+
} from "./chunk-SY7G5QEI.js";
|
|
9
|
+
import {
|
|
10
|
+
listSnapshots
|
|
11
|
+
} from "./chunk-XQFT4PEP.js";
|
|
12
|
+
import {
|
|
13
|
+
findProjectConfig
|
|
14
|
+
} from "./chunk-3IZ7SEGT.js";
|
|
15
|
+
import "./chunk-7L2K4N25.js";
|
|
16
|
+
import {
|
|
17
|
+
getProjectByLocalPath
|
|
18
|
+
} from "./chunk-UJYFTXHV.js";
|
|
19
|
+
import {
|
|
20
|
+
getDedicatedSerializerPlatformIds
|
|
21
|
+
} from "./chunk-3IWTJCPA.js";
|
|
22
|
+
import "./chunk-HVVPTCKR.js";
|
|
23
|
+
import "./chunk-EWBCFAF3.js";
|
|
24
|
+
import {
|
|
25
|
+
LISTABLE_RESOURCE_TYPES,
|
|
26
|
+
PLUGIN_ATTACHMENT_TYPES,
|
|
27
|
+
formatPluginRef,
|
|
28
|
+
formatResourceSelector,
|
|
29
|
+
getAllPlatforms,
|
|
30
|
+
getPlugin,
|
|
31
|
+
getPluginResources,
|
|
32
|
+
listAttachedPluginRefs,
|
|
33
|
+
listEnvironments,
|
|
34
|
+
listPlugins,
|
|
35
|
+
listPluginsInScope,
|
|
36
|
+
listResources
|
|
37
|
+
} from "./chunk-2EIJYDNI.js";
|
|
38
|
+
import "./chunk-6BY4BV5G.js";
|
|
39
|
+
import "./chunk-GQKKX7OE.js";
|
|
40
|
+
import {
|
|
41
|
+
parseOutputFormat,
|
|
42
|
+
printJson
|
|
43
|
+
} from "./chunk-TQ2NA4Z4.js";
|
|
44
|
+
import {
|
|
45
|
+
GUIDE_SCENARIOS_URL,
|
|
46
|
+
fail,
|
|
47
|
+
formatCommand,
|
|
48
|
+
formatScenarioCommand
|
|
49
|
+
} from "./chunk-DXKAKKLP.js";
|
|
50
|
+
import {
|
|
51
|
+
ui
|
|
52
|
+
} from "./chunk-YDD3ES2K.js";
|
|
53
|
+
import {
|
|
54
|
+
createPersistingCloudClient,
|
|
55
|
+
formatPublishedSelector,
|
|
56
|
+
formatPublishedSelectorWithVersion,
|
|
57
|
+
getCloudAccount,
|
|
58
|
+
loadCloudAccounts
|
|
59
|
+
} from "./chunk-ZY2MZ2KQ.js";
|
|
60
|
+
import "./chunk-VQVUJYYY.js";
|
|
61
|
+
import {
|
|
62
|
+
closeDb,
|
|
63
|
+
getDb,
|
|
64
|
+
getHarnesstapDir
|
|
65
|
+
} from "./chunk-DWVAR4BP.js";
|
|
66
|
+
|
|
67
|
+
// src/generated/scenarios.ts
|
|
68
|
+
var GENERATED_SCENARIOS = [
|
|
69
|
+
{
|
|
70
|
+
"id": 1,
|
|
71
|
+
"filename": "01-bootstrap-machine.md",
|
|
72
|
+
"title": "Bootstrap HarnessTap on a machine and discover existing defaults",
|
|
73
|
+
"frequency": null,
|
|
74
|
+
"status": null,
|
|
75
|
+
"summaryLines": [
|
|
76
|
+
"Use this when setting up HarnessTap for the first time on a laptop, dev box,",
|
|
77
|
+
"or CI-like agent environment."
|
|
78
|
+
],
|
|
79
|
+
"commands": [
|
|
80
|
+
"harnesstap init",
|
|
81
|
+
"harnesstap init --main claude-code --aliases cursor,codex",
|
|
82
|
+
"harnesstap harness list",
|
|
83
|
+
"harnesstap plugin list --search fullstack --remote-only"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"id": 2,
|
|
88
|
+
"filename": "02-default-harness-aliases.md",
|
|
89
|
+
"title": "Choose a default main harness and alias harnesses",
|
|
90
|
+
"frequency": null,
|
|
91
|
+
"status": null,
|
|
92
|
+
"summaryLines": [
|
|
93
|
+
"Use this when you want one harness to be your canonical setup and a few",
|
|
94
|
+
"others to be kept aligned with it."
|
|
95
|
+
],
|
|
96
|
+
"commands": [
|
|
97
|
+
"harnesstap harness set --main claude-code --aliases cursor,codex",
|
|
98
|
+
"harnesstap harness status"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"id": 3,
|
|
103
|
+
"filename": "03-project-harness-preferences.md",
|
|
104
|
+
"title": "Override harness preferences for one repository",
|
|
105
|
+
"frequency": "Common",
|
|
106
|
+
"status": "Shipped",
|
|
107
|
+
"summaryLines": [
|
|
108
|
+
"Use this when your global preference is not the right fit for a specific repo.",
|
|
109
|
+
"For example, you may usually author in Claude Code but want one project to use",
|
|
110
|
+
"Codex as the canonical harness."
|
|
111
|
+
],
|
|
112
|
+
"commands": [
|
|
113
|
+
"harnesstap harness project set --project . --main codex --aliases claude-code,cursor",
|
|
114
|
+
"harnesstap harness project status --project ."
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"id": 4,
|
|
119
|
+
"filename": "04-scan-import-repo.md",
|
|
120
|
+
"title": "Scan an existing repository and import its current harness setup",
|
|
121
|
+
"frequency": "Common",
|
|
122
|
+
"status": "Shipped",
|
|
123
|
+
"summaryLines": [
|
|
124
|
+
"Use this when a repository already contains agent instructions, skills, MCP",
|
|
125
|
+
"config, rules, hooks, or agent files that you want HarnessTap to manage."
|
|
126
|
+
],
|
|
127
|
+
"commands": [
|
|
128
|
+
"harnesstap scan . --dry-run # preview what would be imported",
|
|
129
|
+
"harnesstap scan .",
|
|
130
|
+
"harnesstap scan . --harness claude-code # scope to a single harness",
|
|
131
|
+
"harnesstap resource list",
|
|
132
|
+
"harnesstap resource show <resource-name-or-id>"
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"id": 5,
|
|
137
|
+
"filename": "05-build-plugin-from-resources.md",
|
|
138
|
+
"title": "Build a reusable plugin from imported resources",
|
|
139
|
+
"frequency": "Occasional",
|
|
140
|
+
"status": "Shipped",
|
|
141
|
+
"summaryLines": [
|
|
142
|
+
"Use this when you want to turn a working repository setup into a named,",
|
|
143
|
+
"reusable harness baseline."
|
|
144
|
+
],
|
|
145
|
+
"commands": [
|
|
146
|
+
'harnesstap plugin create my-setup --description "Shared project assistant setup"',
|
|
147
|
+
"harnesstap resource list --search auth # find what to add",
|
|
148
|
+
"harnesstap plugin edit my-setup --add auth-helper --type skill",
|
|
149
|
+
"harnesstap plugin show my-setup"
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"id": 6,
|
|
154
|
+
"filename": "06-plugin-constraints.md",
|
|
155
|
+
"title": "Add plugin constraints to a plugin",
|
|
156
|
+
"frequency": "Rare",
|
|
157
|
+
"status": "Shipped",
|
|
158
|
+
"summaryLines": [
|
|
159
|
+
"Use this when your environment depends on Claude plugins and you want the",
|
|
160
|
+
"plugin to describe not just files, but also expected plugin versions."
|
|
161
|
+
],
|
|
162
|
+
"commands": [
|
|
163
|
+
'harnesstap plugin edit my-setup --add formatter@team-marketplace --type plugin_pin --version "^2.1.0"',
|
|
164
|
+
"harnesstap plugin edit my-setup --remove formatter@team-marketplace --type plugin_pin",
|
|
165
|
+
"harnesstap plugin show my-setup"
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"id": 7,
|
|
170
|
+
"filename": "07-preview-apply-plugin.md",
|
|
171
|
+
"title": "Preview and apply a plugin to one or more target harnesses",
|
|
172
|
+
"frequency": "Common",
|
|
173
|
+
"status": "Shipped",
|
|
174
|
+
"summaryLines": [
|
|
175
|
+
"Use this when you are ready to materialize a known-good setup into a project.",
|
|
176
|
+
"The dry-run preview is itself a frequent check before a real write."
|
|
177
|
+
],
|
|
178
|
+
"commands": [
|
|
179
|
+
"harnesstap apply my-setup --project . --harness claude-code,codex,cursor --dry-run",
|
|
180
|
+
"harnesstap apply my-setup --project . --harness claude-code,codex,cursor",
|
|
181
|
+
"harnesstap status .",
|
|
182
|
+
"harnesstap apply my-setup --strict-plugin-versions # exit 2 on pin violation",
|
|
183
|
+
"harnesstap apply my-setup --ignore-plugin-versions # skip validation"
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"id": 8,
|
|
188
|
+
"filename": "08-audit-plugins.md",
|
|
189
|
+
"title": "Audit plugin resources and plugin pins",
|
|
190
|
+
"frequency": "Occasional",
|
|
191
|
+
"status": "Shipped",
|
|
192
|
+
"summaryLines": [
|
|
193
|
+
"Use this when you want to understand which plugin resources are in the local",
|
|
194
|
+
"library, which plugin pins a plugin carries, and whether installed plugin trees",
|
|
195
|
+
"are still in sync with HarnessTap.",
|
|
196
|
+
"There are two related surfaces:",
|
|
197
|
+
"**Library plugin resources**: what HarnessTap knows about installed plugins:",
|
|
198
|
+
"```bash",
|
|
199
|
+
"harnesstap resource list --type plugin_pin_pin",
|
|
200
|
+
"harnesstap resource show formatter@team-marketplace",
|
|
201
|
+
"harnesstap resource sync --dry-run",
|
|
202
|
+
"harnesstap resource sync formatter@team-marketplace --overwrite",
|
|
203
|
+
"```",
|
|
204
|
+
"`resource sync` refreshes marketplace-linked plugin resources from install",
|
|
205
|
+
"trees under `~/.claude/plugins`, `~/.cursor/plugins`, and similar locations.",
|
|
206
|
+
"Stale rows are reported when the install path cannot be resolved.",
|
|
207
|
+
"**Plugin pins**: what a plugin expects at apply time:",
|
|
208
|
+
"```bash",
|
|
209
|
+
"harnesstap plugin show my-setup",
|
|
210
|
+
"harnesstap plugin doctor my-setup --check plugin-metadata",
|
|
211
|
+
"harnesstap apply my-setup --project . --dry-run --strict-plugin-versions",
|
|
212
|
+
"```",
|
|
213
|
+
'Use **library sync** when chasing *"is this plugin resource up to date?"* and',
|
|
214
|
+
'**plugin pins + apply validation** when chasing *"does this project satisfy the',
|
|
215
|
+
`plugin's plugin constraints?"*. See Scenario 18 for debugging when committed`,
|
|
216
|
+
"project settings and effective Claude plugin loads disagree."
|
|
217
|
+
],
|
|
218
|
+
"commands": [
|
|
219
|
+
"harnesstap resource list --type plugin_pin_pin",
|
|
220
|
+
"harnesstap resource show formatter@team-marketplace",
|
|
221
|
+
"harnesstap resource sync --dry-run",
|
|
222
|
+
"harnesstap resource sync formatter@team-marketplace --overwrite",
|
|
223
|
+
"harnesstap plugin show my-setup",
|
|
224
|
+
"harnesstap plugin doctor my-setup --check plugin-metadata",
|
|
225
|
+
"harnesstap apply my-setup --project . --dry-run --strict-plugin-versions"
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"id": 9,
|
|
230
|
+
"filename": "09-history-revert.md",
|
|
231
|
+
"title": "Review project state, history, and recover from a bad apply",
|
|
232
|
+
"frequency": "Rare",
|
|
233
|
+
"status": "Shipped",
|
|
234
|
+
"summaryLines": [
|
|
235
|
+
"Use this when a plugin write produced files you want to inspect or undo."
|
|
236
|
+
],
|
|
237
|
+
"commands": [
|
|
238
|
+
"harnesstap status .",
|
|
239
|
+
"harnesstap history .",
|
|
240
|
+
"harnesstap revert <snapshot-id>"
|
|
241
|
+
]
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"id": 10,
|
|
245
|
+
"filename": "10-export-import-plugin.md",
|
|
246
|
+
"title": "Export or import a plugin as a portable package",
|
|
247
|
+
"frequency": "Occasional",
|
|
248
|
+
"status": "Shipped",
|
|
249
|
+
"summaryLines": [
|
|
250
|
+
"Use this when you want to move a harness setup between machines, bootstrap a",
|
|
251
|
+
"new repo quickly, or share a team baseline."
|
|
252
|
+
],
|
|
253
|
+
"commands": [
|
|
254
|
+
"harnesstap plugin cut my-setup --version 1.0.1",
|
|
255
|
+
"harnesstap migrate export ./my-setup --plugin my-setup",
|
|
256
|
+
"harnesstap migrate export ./my-setup.ap.json --plugin my-setup --single-file",
|
|
257
|
+
"harnesstap migrate export ./team --plugin my-setup --embed-plugins",
|
|
258
|
+
"harnesstap migrate import ./my-setup",
|
|
259
|
+
"harnesstap migrate import ./my-setup.ap.json"
|
|
260
|
+
]
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"id": 11,
|
|
264
|
+
"filename": "11-builtin-plugin.md",
|
|
265
|
+
"title": "Start from a catalog baseline instead of building from scratch",
|
|
266
|
+
"frequency": "Common",
|
|
267
|
+
"status": "Shipped",
|
|
268
|
+
"summaryLines": [
|
|
269
|
+
"Use this when you want a fast starting point and only need to tailor it for",
|
|
270
|
+
"your repo afterward."
|
|
271
|
+
],
|
|
272
|
+
"commands": [
|
|
273
|
+
"harnesstap init --main codex --aliases claude-code,cursor",
|
|
274
|
+
"harnesstap plugin list --search foundation --remote-only",
|
|
275
|
+
"harnesstap apply engineering-foundation"
|
|
276
|
+
]
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"id": 12,
|
|
280
|
+
"filename": "12-scripts-agents.md",
|
|
281
|
+
"title": "Drive HarnessTap from scripts or other agents",
|
|
282
|
+
"frequency": null,
|
|
283
|
+
"status": null,
|
|
284
|
+
"summaryLines": [
|
|
285
|
+
"Use this when another automation plugin needs structured output instead of",
|
|
286
|
+
"human text."
|
|
287
|
+
],
|
|
288
|
+
"commands": [
|
|
289
|
+
"harnesstap init --format json",
|
|
290
|
+
"harnesstap harness list --format json",
|
|
291
|
+
"harnesstap resource list --format json",
|
|
292
|
+
"harnesstap plugin show my-setup --format json",
|
|
293
|
+
"harnesstap plugin doctor my-setup --format json",
|
|
294
|
+
"harnesstap history . --format json",
|
|
295
|
+
"harnesstap apply my-setup --project . --dry-run --format json",
|
|
296
|
+
"harnesstap resource sync --format json --dry-run"
|
|
297
|
+
]
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"id": 13,
|
|
301
|
+
"filename": "13-materialization-strategy.md",
|
|
302
|
+
"title": "Choose a materialization strategy (symlink vs copy)",
|
|
303
|
+
"frequency": "Occasional",
|
|
304
|
+
"status": "Shipped",
|
|
305
|
+
"summaryLines": [
|
|
306
|
+
"Use this when you need to decide whether a project's alias harness outputs",
|
|
307
|
+
"are written as **symlinks** (atomic, always in sync with the main reference)",
|
|
308
|
+
"or **copies** (independent files that can be committed and reviewed)."
|
|
309
|
+
],
|
|
310
|
+
"commands": [
|
|
311
|
+
"harnesstap harness project set --project . --materialization-strategy symlink-preferred",
|
|
312
|
+
"harnesstap harness project set --project . --materialization-strategy copy",
|
|
313
|
+
"harnesstap harness project status --project ."
|
|
314
|
+
]
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"id": 14,
|
|
318
|
+
"filename": "14-curate-resource-db.md",
|
|
319
|
+
"title": "Curate and clean up the local resource DB",
|
|
320
|
+
"frequency": "Rare",
|
|
321
|
+
"status": "Shipped",
|
|
322
|
+
"summaryLines": [
|
|
323
|
+
"Use this when months of scans have left the local DB with duplicates, stale",
|
|
324
|
+
"resources from deleted repos, or noisy imports you no longer need."
|
|
325
|
+
],
|
|
326
|
+
"commands": [
|
|
327
|
+
"harnesstap resource list --type skill",
|
|
328
|
+
"harnesstap resource list --type instruction --search legacy",
|
|
329
|
+
"harnesstap resource list --type plugin_pin_pin",
|
|
330
|
+
"harnesstap resource show skill:legacy-helper",
|
|
331
|
+
"harnesstap resource delete legacy-helper",
|
|
332
|
+
"harnesstap plugin delete <stale-plugin-name>"
|
|
333
|
+
]
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"id": 15,
|
|
337
|
+
"filename": "15-subset-platforms.md",
|
|
338
|
+
"title": "Apply a plugin to a subset of target platforms",
|
|
339
|
+
"frequency": "Common",
|
|
340
|
+
"status": "Shipped",
|
|
341
|
+
"summaryLines": [
|
|
342
|
+
"Use this when a repo opts into some harnesses but not others. For example, a",
|
|
343
|
+
"backend repo that supports Claude Code and Codex but never used Cursor."
|
|
344
|
+
],
|
|
345
|
+
"commands": [
|
|
346
|
+
"harnesstap apply my-setup --project . --harness claude-code,codex --dry-run",
|
|
347
|
+
"harnesstap apply my-setup --project . --harness claude-code,codex"
|
|
348
|
+
]
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"id": 16,
|
|
352
|
+
"filename": "16-ci-enforcement.md",
|
|
353
|
+
"title": "Enforce plugin and plugin state in CI",
|
|
354
|
+
"frequency": null,
|
|
355
|
+
"status": null,
|
|
356
|
+
"summaryLines": [
|
|
357
|
+
"Use this when you want CI to fail if the project drifts away from its plugin",
|
|
358
|
+
"or its pinned plugin versions.",
|
|
359
|
+
"Typical commands (each exits non-zero on a problem):",
|
|
360
|
+
"```bash",
|
|
361
|
+
"harnesstap status . --check --format json",
|
|
362
|
+
"harnesstap plugin doctor my-setup --format json",
|
|
363
|
+
"harnesstap apply my-setup --project . --dry-run --strict-plugin-versions --format json",
|
|
364
|
+
"harnesstap resource sync --format json --dry-run",
|
|
365
|
+
"harnesstap audit --ci --format json",
|
|
366
|
+
"```",
|
|
367
|
+
"When `executables:` is opted in, `--ci` also fails on `required-executable-untrusted`. Approve with `ht approve <ref>` or inspect with `ht policy explain <ref>`.",
|
|
368
|
+
"This pairs naturally with Scenario 12. The `--dry-run` keeps CI from writing",
|
|
369
|
+
"files, while `--strict-plugin-versions` forces failure (exit 2) on a pin",
|
|
370
|
+
'violation. Use `status --check` exit code 1 as the "working tree changed',
|
|
371
|
+
'since last apply/sync" signal, and `plugin doctor` exit code 1 as the "plugin',
|
|
372
|
+
'definition is invalid" signal.'
|
|
373
|
+
],
|
|
374
|
+
"commands": [
|
|
375
|
+
"harnesstap status . --check --format json",
|
|
376
|
+
"harnesstap plugin doctor my-setup --format json",
|
|
377
|
+
"harnesstap apply my-setup --project . --dry-run --strict-plugin-versions --format json",
|
|
378
|
+
"harnesstap resource sync --format json --dry-run",
|
|
379
|
+
"harnesstap audit --ci --format json"
|
|
380
|
+
]
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"id": 17,
|
|
384
|
+
"filename": "17-migrate-state.md",
|
|
385
|
+
"title": "Migrate HarnessTap state to a new machine",
|
|
386
|
+
"frequency": "Rare",
|
|
387
|
+
"status": "Shipped (manual workflow: see [Scenario 28](https://github.com/harnesstap/harnesstap/blob/main/docs/scenarios/details/28-machine-migration.md) for one-command migration)",
|
|
388
|
+
"summaryLines": [
|
|
389
|
+
"Use this when moving setups across laptops or onto a dev box. For a single",
|
|
390
|
+
"archive that includes harness preferences and config, prefer [Scenario 28](https://github.com/harnesstap/harnesstap/blob/main/docs/scenarios/details/28-machine-migration.md).",
|
|
391
|
+
"Manual workflow with current commands:",
|
|
392
|
+
"```bash",
|
|
393
|
+
"# On the old machine",
|
|
394
|
+
"mkdir -p ./bundles",
|
|
395
|
+
"for p in $(harnesstap plugin list --format json | jq -r '.[].name'); do",
|
|
396
|
+
'harnesstap migrate export "./bundles/$p" --plugin "$p" --embed-plugins',
|
|
397
|
+
"done",
|
|
398
|
+
"# Copy ./bundles/ to the new machine, then:",
|
|
399
|
+
"harnesstap init",
|
|
400
|
+
"for d in ./bundles/*/; do",
|
|
401
|
+
'harnesstap migrate import "$d"',
|
|
402
|
+
"done",
|
|
403
|
+
"harnesstap harness set --main claude-code --aliases cursor,codex # restore selection",
|
|
404
|
+
"```",
|
|
405
|
+
"`--embed-plugins` is recommended for portability so the new machine does not",
|
|
406
|
+
"need to re-fetch marketplace plugin trees. This workflow does not currently",
|
|
407
|
+
"carry over harness preferences or `~/.harnesstap/config.json`; copy those by",
|
|
408
|
+
"hand or use [Scenario 28](https://github.com/harnesstap/harnesstap/blob/main/docs/scenarios/details/28-machine-migration.md)."
|
|
409
|
+
],
|
|
410
|
+
"commands": [
|
|
411
|
+
"mkdir -p ./bundles",
|
|
412
|
+
"for p in $(harnesstap plugin list --format json | jq -r '.[].name'); do",
|
|
413
|
+
'harnesstap migrate export "./bundles/$p" --plugin "$p" --embed-plugins',
|
|
414
|
+
"done",
|
|
415
|
+
"harnesstap init",
|
|
416
|
+
"for d in ./bundles/*/; do",
|
|
417
|
+
'harnesstap migrate import "$d"',
|
|
418
|
+
"done",
|
|
419
|
+
"harnesstap harness set --main claude-code --aliases cursor,codex # restore selection"
|
|
420
|
+
]
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
"id": 18,
|
|
424
|
+
"filename": "18-plugin-merge-conflict.md",
|
|
425
|
+
"title": "Debug committed vs effective Claude plugin settings",
|
|
426
|
+
"frequency": "Rare",
|
|
427
|
+
"status": "Shipped",
|
|
428
|
+
"summaryLines": [
|
|
429
|
+
"Use this when the plugin set declared in the project's",
|
|
430
|
+
"`.claude/settings.json` differs from what Claude Code actually loads after",
|
|
431
|
+
"merging user, project, and local scopes."
|
|
432
|
+
],
|
|
433
|
+
"commands": [
|
|
434
|
+
"harnesstap scan . --harness claude-code --dry-run",
|
|
435
|
+
"harnesstap scan . --harness claude-code",
|
|
436
|
+
"harnesstap resource list --type plugin_pin_pin",
|
|
437
|
+
"harnesstap resource show formatter@team-marketplace --all-fields",
|
|
438
|
+
"harnesstap plugin show my-setup"
|
|
439
|
+
]
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
"id": 19,
|
|
443
|
+
"filename": "19-refresh-plugin-metadata.md",
|
|
444
|
+
"title": "Sync plugin resources from install trees",
|
|
445
|
+
"frequency": "Occasional",
|
|
446
|
+
"status": "Shipped",
|
|
447
|
+
"summaryLines": [
|
|
448
|
+
"Use this when plugin install trees on disk have changed and HarnessTap's",
|
|
449
|
+
"library copies are stale or missing resolved versions."
|
|
450
|
+
],
|
|
451
|
+
"commands": [
|
|
452
|
+
"harnesstap resource sync --dry-run",
|
|
453
|
+
"harnesstap resource sync --overwrite",
|
|
454
|
+
"harnesstap resource sync formatter@team-marketplace --overwrite --force"
|
|
455
|
+
]
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
"id": 20,
|
|
459
|
+
"filename": "20-inspect-platforms.md",
|
|
460
|
+
"title": "Inspect supported platforms before targeting",
|
|
461
|
+
"frequency": "Occasional",
|
|
462
|
+
"status": "Shipped",
|
|
463
|
+
"summaryLines": [
|
|
464
|
+
"Use this when planning which harnesses to use as main and aliases, or when",
|
|
465
|
+
"an unfamiliar harness ID appears in someone else's plugin."
|
|
466
|
+
],
|
|
467
|
+
"commands": [
|
|
468
|
+
"harnesstap harness list",
|
|
469
|
+
"harnesstap harness list --supported",
|
|
470
|
+
"harnesstap harness list --format json | jq '.[] | {id, supports}'"
|
|
471
|
+
]
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
"id": 21,
|
|
475
|
+
"filename": "21-detect-drift.md",
|
|
476
|
+
"title": "Detect drift between project files and the last applied plugin",
|
|
477
|
+
"frequency": "Occasional",
|
|
478
|
+
"status": "Shipped",
|
|
479
|
+
"summaryLines": [
|
|
480
|
+
"```bash",
|
|
481
|
+
"harnesstap status . --check",
|
|
482
|
+
"harnesstap status . --check --format json # exit 1 when drift exists",
|
|
483
|
+
"```"
|
|
484
|
+
],
|
|
485
|
+
"commands": [
|
|
486
|
+
"harnesstap status . --check",
|
|
487
|
+
"harnesstap status . --check --format json # exit 1 when drift exists"
|
|
488
|
+
]
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
"id": 22,
|
|
492
|
+
"filename": "22-diff-plugins.md",
|
|
493
|
+
"title": "Diff two plugins",
|
|
494
|
+
"frequency": "Occasional",
|
|
495
|
+
"status": "Shipped",
|
|
496
|
+
"summaryLines": [
|
|
497
|
+
"```bash",
|
|
498
|
+
"harnesstap plugin diff team-baseline my-fork",
|
|
499
|
+
"harnesstap plugin diff team-baseline ./incoming-bundle.harnesstap.json",
|
|
500
|
+
"```"
|
|
501
|
+
],
|
|
502
|
+
"commands": [
|
|
503
|
+
"harnesstap plugin diff team-baseline my-fork",
|
|
504
|
+
"harnesstap plugin diff team-baseline ./incoming-bundle.harnesstap.json"
|
|
505
|
+
]
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
"id": 23,
|
|
509
|
+
"filename": "23-validate-plugin.md",
|
|
510
|
+
"title": "Doctor-check a plugin without writing",
|
|
511
|
+
"frequency": "Occasional",
|
|
512
|
+
"status": "Shipped",
|
|
513
|
+
"summaryLines": [
|
|
514
|
+
"Use this when you want validation feedback on a plugin definition before",
|
|
515
|
+
"applying it to a project.",
|
|
516
|
+
"```bash",
|
|
517
|
+
"harnesstap plugin doctor my-setup",
|
|
518
|
+
"harnesstap plugin doctor my-setup --format json",
|
|
519
|
+
"harnesstap plugin doctor --list-checks",
|
|
520
|
+
"harnesstap plugin doctor my-setup --check plugin-metadata",
|
|
521
|
+
"```",
|
|
522
|
+
"Doctor checks cover empty plugins, duplicate resources, empty definition, and",
|
|
523
|
+
"plugin metadata. JSON mode exits with code `1` when the plugin is invalid."
|
|
524
|
+
],
|
|
525
|
+
"commands": [
|
|
526
|
+
"harnesstap plugin doctor my-setup",
|
|
527
|
+
"harnesstap plugin doctor my-setup --format json",
|
|
528
|
+
"harnesstap plugin doctor --list-checks",
|
|
529
|
+
"harnesstap plugin doctor my-setup --check plugin-metadata"
|
|
530
|
+
]
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
"id": 24,
|
|
534
|
+
"filename": "24-apply-from-url.md",
|
|
535
|
+
"title": "Apply a plugin directly from a URL",
|
|
536
|
+
"frequency": "Occasional",
|
|
537
|
+
"status": "Shipped",
|
|
538
|
+
"summaryLines": [
|
|
539
|
+
"```bash",
|
|
540
|
+
"harnesstap apply https://team.example.com/baselines/web.json --project .",
|
|
541
|
+
"```"
|
|
542
|
+
],
|
|
543
|
+
"commands": [
|
|
544
|
+
"harnesstap apply https://team.example.com/baselines/web.json --project ."
|
|
545
|
+
]
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
"id": 25,
|
|
549
|
+
"filename": "25-stack-plugins.md",
|
|
550
|
+
"title": "Stack multiple plugins",
|
|
551
|
+
"frequency": "Common",
|
|
552
|
+
"status": "Shipped",
|
|
553
|
+
"summaryLines": [
|
|
554
|
+
"Apply plugins in order; later plugins override earlier ones for matching resources.",
|
|
555
|
+
"```bash",
|
|
556
|
+
"harnesstap apply team-baseline my-overrides --project .",
|
|
557
|
+
"```",
|
|
558
|
+
"To share the full curated stack with another machine offline, export the workspace with `harnesstap migrate export` (see [Scenario 28](./28-machine-migration.md)) or export individual plugins with `migrate export --plugin` / `migrate import`."
|
|
559
|
+
],
|
|
560
|
+
"commands": [
|
|
561
|
+
"harnesstap apply team-baseline my-overrides --project ."
|
|
562
|
+
]
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
"id": 26,
|
|
566
|
+
"filename": "26-plugin-from-project.md",
|
|
567
|
+
"title": "Turn a project's current state into a plugin",
|
|
568
|
+
"frequency": "Common",
|
|
569
|
+
"status": "Shipped",
|
|
570
|
+
"summaryLines": [
|
|
571
|
+
"```bash",
|
|
572
|
+
'harnesstap plugin from-project my-setup --project . --description "Inferred from web repo"',
|
|
573
|
+
"```"
|
|
574
|
+
],
|
|
575
|
+
"commands": [
|
|
576
|
+
'harnesstap plugin from-project my-setup --project . --description "Inferred from web repo"'
|
|
577
|
+
]
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
"id": 27,
|
|
581
|
+
"filename": "27-project-sync.md",
|
|
582
|
+
"title": "True cross-harness `mirror`",
|
|
583
|
+
"frequency": "Common",
|
|
584
|
+
"status": "Shipped",
|
|
585
|
+
"summaryLines": [
|
|
586
|
+
"```bash",
|
|
587
|
+
"harnesstap mirror .",
|
|
588
|
+
"harnesstap mirror . --force-shift-reference codex",
|
|
589
|
+
"harnesstap mirror . --dry-run",
|
|
590
|
+
"```"
|
|
591
|
+
],
|
|
592
|
+
"commands": [
|
|
593
|
+
"harnesstap mirror .",
|
|
594
|
+
"harnesstap mirror . --force-shift-reference codex",
|
|
595
|
+
"harnesstap mirror . --dry-run"
|
|
596
|
+
]
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
"id": 28,
|
|
600
|
+
"filename": "28-machine-migration.md",
|
|
601
|
+
"title": "One-command machine migration",
|
|
602
|
+
"frequency": "Occasional",
|
|
603
|
+
"status": "Shipped",
|
|
604
|
+
"summaryLines": [
|
|
605
|
+
"Use this when moving HarnessTap state to a new machine or sharing your curated",
|
|
606
|
+
"workspace with a teammate offline. The archive includes plugins, environments",
|
|
607
|
+
"(secret refs only), harness preferences, and config in one step.",
|
|
608
|
+
"```bash",
|
|
609
|
+
"harnesstap migrate export ./harnesstap-state.tar.gz --include-plugins",
|
|
610
|
+
"harnesstap migrate import ./harnesstap-state.tar.gz",
|
|
611
|
+
"```",
|
|
612
|
+
"For a manual plugin-by-plugin export workflow, see [Scenario 17](./17-migrate-state.md).",
|
|
613
|
+
"For multiplayer distribution, publish plugins to HarnessTap Cloud with",
|
|
614
|
+
"`plugin publish` / `plugin pull` instead."
|
|
615
|
+
],
|
|
616
|
+
"commands": [
|
|
617
|
+
"harnesstap migrate export ./harnesstap-state.tar.gz --include-plugins",
|
|
618
|
+
"harnesstap migrate import ./harnesstap-state.tar.gz"
|
|
619
|
+
]
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
"id": 31,
|
|
623
|
+
"filename": "31-dual-mode-plugin-import.md",
|
|
624
|
+
"title": "Import dual-mode plugin repo",
|
|
625
|
+
"frequency": "Common",
|
|
626
|
+
"status": "Shipped",
|
|
627
|
+
"summaryLines": [
|
|
628
|
+
"Use this when a repository contains **both** harness project files (for example",
|
|
629
|
+
"`AGENTS.md`, `CLAUDE.md`) **and** a plugin manifest at the repo root (for example",
|
|
630
|
+
"`.claude-plugin/plugin.json`, `.codex-plugin/plugin.json`, or",
|
|
631
|
+
"`.github/plugin/plugin.json`). A normal scan automatically merges",
|
|
632
|
+
"harness files with repo-root `skills/`, `commands/`, and `hooks/` trees that the",
|
|
633
|
+
"plugin manifest describes."
|
|
634
|
+
],
|
|
635
|
+
"commands": [
|
|
636
|
+
"harnesstap scan . --dry-run",
|
|
637
|
+
"harnesstap scan . --harness claude-code",
|
|
638
|
+
"harnesstap plugin from-project my-plugin --project .",
|
|
639
|
+
"harnesstap plugin show my-plugin"
|
|
640
|
+
]
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
"id": 32,
|
|
644
|
+
"filename": "32-instruction-tier-apply.md",
|
|
645
|
+
"title": "Apply to instruction-tier harnesses",
|
|
646
|
+
"frequency": "Occasional",
|
|
647
|
+
"status": "Shipped",
|
|
648
|
+
"summaryLines": [
|
|
649
|
+
"Use this when applying a plugin to harnesses that load skills as **always-on",
|
|
650
|
+
"instructions or rules** rather than agent-requested skill directories. Harnesses",
|
|
651
|
+
"with registry `skillEmission: instruction-only` include `windsurf`, `cline`,",
|
|
652
|
+
"`github-copilot`, `gemini-cli`, and `kiro`."
|
|
653
|
+
],
|
|
654
|
+
"commands": [
|
|
655
|
+
"harnesstap apply my-setup --project . --harness windsurf,cline,github-copilot --dry-run",
|
|
656
|
+
"harnesstap apply my-setup --project . --harness claude-code,codex,windsurf,cursor",
|
|
657
|
+
"harnesstap harness list --format json",
|
|
658
|
+
"harnesstap harness project status --project . --format json"
|
|
659
|
+
]
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
"id": 33,
|
|
663
|
+
"filename": "33-mirror-plugin-fallback.md",
|
|
664
|
+
"title": "Mirror with plugin-source fallback",
|
|
665
|
+
"frequency": "Occasional",
|
|
666
|
+
"status": "Shipped",
|
|
667
|
+
"summaryLines": [
|
|
668
|
+
"Use this when `mirror` would fail because the project's **main harness**",
|
|
669
|
+
"has no on-disk resource tree: common in plugin-only repos that ship",
|
|
670
|
+
"`.claude-plugin/plugin.json` and repo-root `skills/` but no `.claude/` directory.",
|
|
671
|
+
"The `--reference` flag chooses which on-disk source drives alias harness output."
|
|
672
|
+
],
|
|
673
|
+
"commands": [
|
|
674
|
+
"harnesstap mirror . --dry-run",
|
|
675
|
+
"harnesstap mirror . --reference auto --dry-run",
|
|
676
|
+
"harnesstap mirror . --reference auto",
|
|
677
|
+
"harnesstap mirror . --reference plugin --dry-run",
|
|
678
|
+
"harnesstap mirror . --reference agents --dry-run",
|
|
679
|
+
"harnesstap mirror . --force-shift-reference codex --reference auto"
|
|
680
|
+
]
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
"id": 34,
|
|
684
|
+
"filename": "34-portability-limits.md",
|
|
685
|
+
"title": "Understand portability limits",
|
|
686
|
+
"frequency": "Occasional",
|
|
687
|
+
"status": "Shipped",
|
|
688
|
+
"summaryLines": [
|
|
689
|
+
"Use this when planning a multi-harness rollout, evaluating a plugin repo, or",
|
|
690
|
+
"debugging why `apply` / `mirror` did not reproduce every on-disk",
|
|
691
|
+
"artifact from the source repo.",
|
|
692
|
+
"Start with the full reference:",
|
|
693
|
+
"**[Portability limits](../../portability-limits.md)**",
|
|
694
|
+
"Quick checklist:",
|
|
695
|
+
"```bash",
|
|
696
|
+
"# See what HarnessTap can import from a dual-mode repo",
|
|
697
|
+
"harnesstap scan . --dry-run",
|
|
698
|
+
"# Preview what each harness would receive",
|
|
699
|
+
"harnesstap apply my-setup --project . --harness claude-code,codex,windsurf,opencode --dry-run",
|
|
700
|
+
"# Check mirror warnings for harness-specific surfaces",
|
|
701
|
+
"harnesstap mirror . --dry-run --format json",
|
|
702
|
+
"# List harness capabilities (use --supported for natively serialized hosts only)",
|
|
703
|
+
"harnesstap harness list --format json",
|
|
704
|
+
"```",
|
|
705
|
+
"**Fully bridgeable:** skills, instructions, rules, MCP (stdio/http), static",
|
|
706
|
+
"commands (md/toml), agents.",
|
|
707
|
+
"**Partially bridgeable:** hooks (importable, but `${*_PLUGIN_ROOT}` paths need",
|
|
708
|
+
"plugin install), Copilot namespaced commands.",
|
|
709
|
+
"**Harness-specific (mirror warnings):** OpenCode `.mjs` server plugins, pi",
|
|
710
|
+
"extensions, Gemini extension manifests, statusline hooks, runtime session config.",
|
|
711
|
+
"**Workarounds:** plugin pins + `resource sync`, automatic dual-mode scan,",
|
|
712
|
+
"mirror `--reference auto|plugin`, and native `copilot plugin install` for Copilot",
|
|
713
|
+
"plugin trees.",
|
|
714
|
+
"Related scenarios: [31](./31-dual-mode-plugin-import.md),"
|
|
715
|
+
],
|
|
716
|
+
"commands": [
|
|
717
|
+
"harnesstap scan . --dry-run",
|
|
718
|
+
"harnesstap apply my-setup --project . --harness claude-code,codex,windsurf,opencode --dry-run",
|
|
719
|
+
"harnesstap mirror . --dry-run --format json",
|
|
720
|
+
"harnesstap harness list --format json"
|
|
721
|
+
]
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
"id": 35,
|
|
725
|
+
"filename": "35-add-skill-package.md",
|
|
726
|
+
"title": "Add a remote skill package",
|
|
727
|
+
"frequency": "Common",
|
|
728
|
+
"status": "Shipped",
|
|
729
|
+
"summaryLines": [
|
|
730
|
+
"Use this when you want to install skills from a GitHub repo or local skill",
|
|
731
|
+
"package in one step: similar to `skills add`, but with HarnessTap library",
|
|
732
|
+
"import and optional plugin composition."
|
|
733
|
+
],
|
|
734
|
+
"commands": [
|
|
735
|
+
"harnesstap add mattpocock/skills --list",
|
|
736
|
+
"harnesstap add mattpocock/skills --skill caveman,tdd --global --yes",
|
|
737
|
+
"harnesstap add mattpocock/skills --all --global --create-plugin mattpocock-skills -y",
|
|
738
|
+
"harnesstap add ./vendor/skills --project . --skill triage --yes",
|
|
739
|
+
"harnesstap plugin show mattpocock-skills",
|
|
740
|
+
"harnesstap apply mattpocock-skills --project ."
|
|
741
|
+
]
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
"id": 36,
|
|
745
|
+
"filename": "36-switch-profile.md",
|
|
746
|
+
"title": "Switch global profile presets",
|
|
747
|
+
"frequency": "Common",
|
|
748
|
+
"status": "Shipped",
|
|
749
|
+
"summaryLines": [
|
|
750
|
+
"Use this when you maintain separate agent setups for work, personal, or",
|
|
751
|
+
"client contexts and want one command to apply the right stack to your",
|
|
752
|
+
"**machine home** harness files (`~/.claude/`, `~/.codex/`, ...)."
|
|
753
|
+
],
|
|
754
|
+
"commands": [
|
|
755
|
+
"harnesstap init",
|
|
756
|
+
"harnesstap profile list",
|
|
757
|
+
'harnesstap profile use "global default" --dry-run',
|
|
758
|
+
"harnesstap profile use work --harness claude-code,cursor",
|
|
759
|
+
"harnesstap profile status",
|
|
760
|
+
"ht work"
|
|
761
|
+
]
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
"id": 37,
|
|
765
|
+
"filename": "37-publish-profile-plugin.md",
|
|
766
|
+
"title": "Publish a profile plugin to the catalog",
|
|
767
|
+
"frequency": "Occasional",
|
|
768
|
+
"status": "Shipped",
|
|
769
|
+
"summaryLines": [
|
|
770
|
+
"Use this when you want teammates to discover and install a switchable global",
|
|
771
|
+
"preset from HarnessTap Cloud. Published profiles are ordinary published",
|
|
772
|
+
"plugins with the `profile` tag: there is no separate catalog entity."
|
|
773
|
+
],
|
|
774
|
+
"commands": [
|
|
775
|
+
"harnesstap auth login work",
|
|
776
|
+
'harnesstap profile create work --description "Work machine preset"',
|
|
777
|
+
"harnesstap plugin edit work --add plugin:engineering-foundation",
|
|
778
|
+
"harnesstap profile publish work --account work",
|
|
779
|
+
"harnesstap profile list --search foundation --remote-only --account work",
|
|
780
|
+
"harnesstap profile pull harnesstap-cloud/default/work@1.0.0",
|
|
781
|
+
"harnesstap profile use work"
|
|
782
|
+
]
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
"id": 38,
|
|
786
|
+
"filename": "38-plugin-from-skill-package.md",
|
|
787
|
+
"title": "Create a plugin from a skill package",
|
|
788
|
+
"frequency": "Common",
|
|
789
|
+
"status": "Shipped",
|
|
790
|
+
"summaryLines": [
|
|
791
|
+
"Use this when you want to configure a reusable plugin from a remote skill",
|
|
792
|
+
"package like `dbt-labs/dbt-agent-skills` without applying it to a project yet."
|
|
793
|
+
],
|
|
794
|
+
"commands": [
|
|
795
|
+
"harnesstap plugin create dbt-expert \\",
|
|
796
|
+
"--from dbt-labs/dbt-agent-skills \\",
|
|
797
|
+
"--all --exclude-category dbt-migration \\",
|
|
798
|
+
'-d "dbt analytics engineering baseline" -y',
|
|
799
|
+
"harnesstap plugin create dbt-expert --from dbt-labs/dbt-agent-skills",
|
|
800
|
+
"harnesstap plugin create dbt-expert \\",
|
|
801
|
+
"--from dbt-labs/dbt-agent-skills \\",
|
|
802
|
+
"--skill running-dbt-commands \\",
|
|
803
|
+
"--on-conflict merge -y",
|
|
804
|
+
"harnesstap plugin show dbt-expert"
|
|
805
|
+
]
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
"id": 39,
|
|
809
|
+
"filename": "39-mcp-auth-and-environments.md",
|
|
810
|
+
"title": "MCP auth, environments, and account switching",
|
|
811
|
+
"frequency": "Occasional",
|
|
812
|
+
"status": "Documented",
|
|
813
|
+
"summaryLines": [
|
|
814
|
+
"Use this when you need to switch Slack workspaces, API tokens, or deployment",
|
|
815
|
+
"targets across profiles/plugins: or when OAuth MCP servers do not respond after",
|
|
816
|
+
"an environment switch.",
|
|
817
|
+
"## Quick decision",
|
|
818
|
+
"| You have... | HarnessTap can... |",
|
|
819
|
+
"| --- | --- |",
|
|
820
|
+
"| Bot token / PAT in MCP `env` or `headers` | Switch via `environment use` + re-apply |",
|
|
821
|
+
"| OAuth MCP (browser login in Cursor/Claude) | **Not** switch sessions: re-auth in the host app |",
|
|
822
|
+
"Full reference: **[Environments: MCP authentication limitations](../../cli/concepts/environments.md#mcp-authentication-limitations)**",
|
|
823
|
+
"## Static token workflow (supported)",
|
|
824
|
+
"```bash",
|
|
825
|
+
"# Seed from plugin MCP env keys",
|
|
826
|
+
"ht environment create work --from-plugin my-setup",
|
|
827
|
+
"ht environment edit work --secret SLACK_BOT_TOKEN:keychain:harnesstap/slack-work",
|
|
828
|
+
"ht environment create personal --from-plugin my-setup",
|
|
829
|
+
"ht environment edit personal --secret SLACK_BOT_TOKEN:keychain:harnesstap/slack-personal",
|
|
830
|
+
"# Switch and materialize",
|
|
831
|
+
"ht environment use work",
|
|
832
|
+
'ht profile use "global default" --reapply',
|
|
833
|
+
"# or: ht apply my-setup --project . --harness claude-code,cursor",
|
|
834
|
+
"```",
|
|
835
|
+
"Plugin MCP definitions should use placeholders, not literals:",
|
|
836
|
+
"```json",
|
|
837
|
+
'"env": { "SLACK_BOT_TOKEN": "${SLACK_BOT_TOKEN}" }',
|
|
838
|
+
"```",
|
|
839
|
+
"Verify resolved keys before apply:",
|
|
840
|
+
"```bash",
|
|
841
|
+
"ht environment show work --plugin my-setup",
|
|
842
|
+
'ht profile use "global default" --dry-run',
|
|
843
|
+
"```",
|
|
844
|
+
"## OAuth MCP (host-managed)",
|
|
845
|
+
"After apply, open the target harness and complete OAuth there (Cursor MCP panel,",
|
|
846
|
+
"`claude mcp`, Copilot `/mcp auth`, etc.). HarnessTap only writes server URL /",
|
|
847
|
+
"transport: not OAuth tokens.",
|
|
848
|
+
"## Known gaps",
|
|
849
|
+
"- **Shipped:** Cursor MCP scan/emit and HTTP `headers` round-trip (via `mcp-config-bridge`).",
|
|
850
|
+
"- **OAuth sessions:** Browser OAuth tokens remain host-managed: environment switch does not re-auth for you.",
|
|
851
|
+
"Remaining limitations: [Known gaps and fix plan](../../cli/concepts/environments.md#known-gaps-and-fix-plan).",
|
|
852
|
+
"Related: [Portability limits](../../portability-limits.md#mcp-authentication-and-environments),"
|
|
853
|
+
],
|
|
854
|
+
"commands": [
|
|
855
|
+
"ht environment create work --from-plugin my-setup",
|
|
856
|
+
"ht environment edit work --secret SLACK_BOT_TOKEN:keychain:harnesstap/slack-work",
|
|
857
|
+
"ht environment create personal --from-plugin my-setup",
|
|
858
|
+
"ht environment edit personal --secret SLACK_BOT_TOKEN:keychain:harnesstap/slack-personal",
|
|
859
|
+
"ht environment use work",
|
|
860
|
+
'ht profile use "global default" --reapply',
|
|
861
|
+
"ht environment show work --plugin my-setup",
|
|
862
|
+
'ht profile use "global default" --dry-run'
|
|
863
|
+
]
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
"id": 40,
|
|
867
|
+
"filename": "40-use-project-profile.md",
|
|
868
|
+
"title": "Use project profile config",
|
|
869
|
+
"frequency": "Common",
|
|
870
|
+
"status": "Shipped",
|
|
871
|
+
"summaryLines": [
|
|
872
|
+
"Use this when a repository ships `apm.yml` with named profiles",
|
|
873
|
+
"so teammates can switch stacks without remembering plugin selectors.",
|
|
874
|
+
"Create the file with `ht config init` (from local profile plugins) or copy a team template. See [Project config](../../cli/concepts/projects.md) for the `apm.yml` shape.",
|
|
875
|
+
"## Inspect the config",
|
|
876
|
+
"```bash",
|
|
877
|
+
"ht config show",
|
|
878
|
+
"ht config validate",
|
|
879
|
+
"ht use --list",
|
|
880
|
+
"```",
|
|
881
|
+
"`config validate` checks that inline profiles reference plugins defined in the",
|
|
882
|
+
"same file and that default profile/environment keys resolve.",
|
|
883
|
+
"## Switch profiles",
|
|
884
|
+
"```bash",
|
|
885
|
+
"ht use --profile dev",
|
|
886
|
+
"ht use --profile prod --dry-run",
|
|
887
|
+
"ht use # interactive picker when multiple profiles exist",
|
|
888
|
+
"```",
|
|
889
|
+
"`ht use` resolves the profile source (local plugin, catalog selector, or inline",
|
|
890
|
+
"plugin table), applies the profile to home harness paths, and optionally switches",
|
|
891
|
+
"the active environment.",
|
|
892
|
+
"For machine-wide presets outside a repo, use `profile use` instead",
|
|
893
|
+
"([Scenario 36](./36-switch-profile.md)). For repo baselines without project",
|
|
894
|
+
"config, use `apply` ([Scenario 7](./07-preview-apply-plugin.md))."
|
|
895
|
+
],
|
|
896
|
+
"commands": [
|
|
897
|
+
"ht config show",
|
|
898
|
+
"ht config validate",
|
|
899
|
+
"ht use --list",
|
|
900
|
+
"ht use --profile dev",
|
|
901
|
+
"ht use --profile prod --dry-run",
|
|
902
|
+
"ht use # interactive picker when multiple profiles exist"
|
|
903
|
+
]
|
|
904
|
+
}
|
|
905
|
+
];
|
|
906
|
+
|
|
907
|
+
// src/services/scenario-guide.ts
|
|
908
|
+
var SCENARIOS = GENERATED_SCENARIOS.map((scenario) => ({
|
|
909
|
+
id: scenario.id,
|
|
910
|
+
filename: scenario.filename,
|
|
911
|
+
title: scenario.title,
|
|
912
|
+
frequency: scenario.frequency,
|
|
913
|
+
status: scenario.status,
|
|
914
|
+
summaryLines: [...scenario.summaryLines],
|
|
915
|
+
commands: [...scenario.commands]
|
|
916
|
+
}));
|
|
917
|
+
function listScenarioIds() {
|
|
918
|
+
return SCENARIOS.map((scenario) => scenario.id);
|
|
919
|
+
}
|
|
920
|
+
function listScenarioSummaries() {
|
|
921
|
+
return SCENARIOS.map((scenario) => ({
|
|
922
|
+
id: scenario.id,
|
|
923
|
+
title: scenario.title,
|
|
924
|
+
frequency: scenario.frequency,
|
|
925
|
+
status: scenario.status
|
|
926
|
+
}));
|
|
927
|
+
}
|
|
928
|
+
function loadScenarioGuide(id) {
|
|
929
|
+
const scenario = SCENARIOS.find((entry) => entry.id === id);
|
|
930
|
+
if (!scenario) {
|
|
931
|
+
throw new Error(`Scenario not found: ${id}`);
|
|
932
|
+
}
|
|
933
|
+
return scenario;
|
|
934
|
+
}
|
|
935
|
+
function parseScenarioId(input) {
|
|
936
|
+
const id = Number.parseInt(input.trim(), 10);
|
|
937
|
+
if (!Number.isFinite(id) || id < 1) {
|
|
938
|
+
throw new Error(`Invalid scenario id: ${input}`);
|
|
939
|
+
}
|
|
940
|
+
return id;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
// src/services/concepts-guide.ts
|
|
944
|
+
function buildConceptsGuidePayload() {
|
|
945
|
+
return {
|
|
946
|
+
concepts: [
|
|
947
|
+
{ term: "resource", definition: "Single canonical item (skill, rule, MCP, hook, agent, ...)" },
|
|
948
|
+
{ term: "plugin", definition: "Named bundle of resources you apply to projects" },
|
|
949
|
+
{ term: "profile", definition: "Plugin tagged profile; apply globally with profile use" },
|
|
950
|
+
{ term: "account", definition: "HarnessTap Cloud login identity stored locally" },
|
|
951
|
+
{ term: "environment", definition: "Named how-values (vars, secrets, model config)" },
|
|
952
|
+
{ term: "harness", definition: "Target CLI (claude-code, codex, cursor, ...)" }
|
|
953
|
+
],
|
|
954
|
+
harness_roles: [
|
|
955
|
+
{ term: "main harness", definition: "Canonical reference for imports and apply" },
|
|
956
|
+
{ term: "alias harness", definition: "Mirrors main harness output (symlink or copy)" }
|
|
957
|
+
],
|
|
958
|
+
commands: [
|
|
959
|
+
{
|
|
960
|
+
command: "plugin apply <plugin>",
|
|
961
|
+
purpose: "Materialize plugins onto a project"
|
|
962
|
+
},
|
|
963
|
+
{
|
|
964
|
+
command: "profile use <profile>",
|
|
965
|
+
purpose: "Apply a profile plugin globally to home harness files"
|
|
966
|
+
},
|
|
967
|
+
{
|
|
968
|
+
command: "migrate export <archive>",
|
|
969
|
+
purpose: "Share your full local workspace with another machine"
|
|
970
|
+
},
|
|
971
|
+
{
|
|
972
|
+
command: "mirror .",
|
|
973
|
+
purpose: "Sync alias harnesses from on-disk main"
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
command: `plugin list --search ${CANONICAL_CATALOG_SEARCH_HINT} --remote-only`,
|
|
977
|
+
purpose: "Browse public catalog plugins"
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
command: `plugin pull org/catalog/${CANONICAL_CATALOG_BASELINE}`,
|
|
981
|
+
purpose: "Cache a catalog plugin locally"
|
|
982
|
+
},
|
|
983
|
+
{
|
|
984
|
+
command: "plugin edit <plugin> --add <item> --type skill",
|
|
985
|
+
purpose: "Add a local resource to a plugin"
|
|
986
|
+
}
|
|
987
|
+
],
|
|
988
|
+
environment_cascade: "home env \u25C2 plugin default env (last wins on apply)"
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
function buildHelpCommandPayload() {
|
|
992
|
+
return {
|
|
993
|
+
concepts: buildConceptsGuidePayload(),
|
|
994
|
+
scenarios: listScenarioSummaries()
|
|
995
|
+
};
|
|
996
|
+
}
|
|
997
|
+
function printConceptSections(payload) {
|
|
998
|
+
console.log("");
|
|
999
|
+
ui.subheader("CORE CONCEPTS");
|
|
1000
|
+
console.log("");
|
|
1001
|
+
for (const entry of payload.concepts) {
|
|
1002
|
+
console.log(` ${entry.term.padEnd(13)} ${entry.definition}`);
|
|
1003
|
+
}
|
|
1004
|
+
console.log("");
|
|
1005
|
+
ui.subheader("HARNESS ROLES");
|
|
1006
|
+
console.log("");
|
|
1007
|
+
for (const entry of payload.harness_roles) {
|
|
1008
|
+
console.log(` ${entry.term.padEnd(13)} ${entry.definition}`);
|
|
1009
|
+
}
|
|
1010
|
+
console.log("");
|
|
1011
|
+
ui.subheader("COMMON COMMANDS");
|
|
1012
|
+
console.log("");
|
|
1013
|
+
for (const entry of payload.commands) {
|
|
1014
|
+
console.log(` ${ui.theme.command(formatCommand(entry.command))} ${entry.purpose}`);
|
|
1015
|
+
}
|
|
1016
|
+
console.log("");
|
|
1017
|
+
ui.subheader("ENVIRONMENT CASCADE");
|
|
1018
|
+
console.log("");
|
|
1019
|
+
console.log(` ${payload.environment_cascade}`);
|
|
1020
|
+
}
|
|
1021
|
+
function printScenarioIndex(scenarios) {
|
|
1022
|
+
console.log("");
|
|
1023
|
+
ui.subheader("SCENARIOS");
|
|
1024
|
+
console.log("");
|
|
1025
|
+
const maxIdWidth = Math.max(
|
|
1026
|
+
...scenarios.map((scenario) => String(scenario.id).length)
|
|
1027
|
+
);
|
|
1028
|
+
for (const scenario of scenarios) {
|
|
1029
|
+
const idStr = String(scenario.id).padStart(maxIdWidth);
|
|
1030
|
+
const meta = [scenario.frequency, scenario.status].filter(Boolean).join(" \xB7 ");
|
|
1031
|
+
const metaSuffix = meta.length > 0 ? ` ${ui.theme.muted(meta)}` : "";
|
|
1032
|
+
console.log(` ${idStr} ${scenario.title}${metaSuffix}`);
|
|
1033
|
+
}
|
|
1034
|
+
console.log("");
|
|
1035
|
+
ui.dim("Run ht help scenario <id> for a scenario playbook.");
|
|
1036
|
+
}
|
|
1037
|
+
function printHelpCommand() {
|
|
1038
|
+
const payload = buildHelpCommandPayload();
|
|
1039
|
+
printConceptSections(payload.concepts);
|
|
1040
|
+
printScenarioIndex(payload.scenarios);
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
// src/services/completion/engine.ts
|
|
1044
|
+
import { existsSync as existsSync2 } from "fs";
|
|
1045
|
+
|
|
1046
|
+
// src/services/completion/utils.ts
|
|
1047
|
+
function filterByPrefix(candidates, prefix) {
|
|
1048
|
+
const normalized = prefix.toLowerCase();
|
|
1049
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1050
|
+
const results = [];
|
|
1051
|
+
for (const candidate of candidates) {
|
|
1052
|
+
if (!candidate.value.toLowerCase().startsWith(normalized)) {
|
|
1053
|
+
continue;
|
|
1054
|
+
}
|
|
1055
|
+
if (seen.has(candidate.value)) {
|
|
1056
|
+
continue;
|
|
1057
|
+
}
|
|
1058
|
+
seen.add(candidate.value);
|
|
1059
|
+
results.push(candidate);
|
|
1060
|
+
}
|
|
1061
|
+
return results.sort((left, right) => left.value.localeCompare(right.value));
|
|
1062
|
+
}
|
|
1063
|
+
function normalizeFlagName(flag) {
|
|
1064
|
+
const trimmed = flag.trim();
|
|
1065
|
+
const longMatch = trimmed.match(/^--([^=]+)/);
|
|
1066
|
+
if (longMatch?.[1]) {
|
|
1067
|
+
return longMatch[1];
|
|
1068
|
+
}
|
|
1069
|
+
const shortMatch = trimmed.match(/^-([^-])/);
|
|
1070
|
+
if (shortMatch?.[1]) {
|
|
1071
|
+
return shortMatch[1];
|
|
1072
|
+
}
|
|
1073
|
+
return trimmed.replace(/^-+/, "");
|
|
1074
|
+
}
|
|
1075
|
+
function flagsMatch(flag, expected) {
|
|
1076
|
+
if (!flag) {
|
|
1077
|
+
return false;
|
|
1078
|
+
}
|
|
1079
|
+
const normalized = normalizeFlagName(flag);
|
|
1080
|
+
return normalized === expected || normalized === expected[0];
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
// src/services/completion/providers/catalog-timeout.ts
|
|
1084
|
+
var CATALOG_TIMEOUT_MS = 300;
|
|
1085
|
+
async function runWithCatalogTimeout(fn) {
|
|
1086
|
+
try {
|
|
1087
|
+
const result = await Promise.race([
|
|
1088
|
+
fn(),
|
|
1089
|
+
new Promise((resolve2) => {
|
|
1090
|
+
setTimeout(() => resolve2([]), CATALOG_TIMEOUT_MS);
|
|
1091
|
+
})
|
|
1092
|
+
]);
|
|
1093
|
+
return result;
|
|
1094
|
+
} catch {
|
|
1095
|
+
return [];
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
// src/services/completion/providers/catalog-plugin.ts
|
|
1100
|
+
async function completeCatalogPlugins(ctx) {
|
|
1101
|
+
const accountInfo = await getCloudAccount(ctx.account);
|
|
1102
|
+
if (!accountInfo.account?.accessToken) {
|
|
1103
|
+
return [];
|
|
1104
|
+
}
|
|
1105
|
+
return runWithCatalogTimeout(async () => {
|
|
1106
|
+
const plugins = await listPluginsInScope(
|
|
1107
|
+
{
|
|
1108
|
+
q: ctx.prefix.trim() || void 0,
|
|
1109
|
+
limit: 25,
|
|
1110
|
+
sort: "updated"
|
|
1111
|
+
},
|
|
1112
|
+
{ account: accountInfo.accountName ?? void 0 }
|
|
1113
|
+
);
|
|
1114
|
+
const candidates = plugins.flatMap((plugin) => {
|
|
1115
|
+
const selector = formatPublishedSelector({
|
|
1116
|
+
org: plugin.orgSlug,
|
|
1117
|
+
catalog: plugin.catalogSlug,
|
|
1118
|
+
name: plugin.slug
|
|
1119
|
+
});
|
|
1120
|
+
const withVersion = plugin.latestVersion ? formatPublishedSelectorWithVersion({
|
|
1121
|
+
org: plugin.orgSlug,
|
|
1122
|
+
catalog: plugin.catalogSlug,
|
|
1123
|
+
name: plugin.slug,
|
|
1124
|
+
version: plugin.latestVersion
|
|
1125
|
+
}) : selector;
|
|
1126
|
+
const entries = [
|
|
1127
|
+
{
|
|
1128
|
+
value: selector,
|
|
1129
|
+
description: plugin.name
|
|
1130
|
+
}
|
|
1131
|
+
];
|
|
1132
|
+
if (withVersion !== selector) {
|
|
1133
|
+
entries.push({
|
|
1134
|
+
value: withVersion,
|
|
1135
|
+
description: plugin.latestVersion ?? void 0
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
return entries;
|
|
1139
|
+
});
|
|
1140
|
+
return filterByPrefix(candidates, ctx.prefix);
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
// src/services/completion/providers/catalog-org.ts
|
|
1145
|
+
async function completeCatalogOrgs(ctx) {
|
|
1146
|
+
const created = await createPersistingCloudClient(ctx.account);
|
|
1147
|
+
if (!created) {
|
|
1148
|
+
return [];
|
|
1149
|
+
}
|
|
1150
|
+
try {
|
|
1151
|
+
const orgs = await created.client.listOrgs();
|
|
1152
|
+
const candidates = orgs.map((org) => ({
|
|
1153
|
+
value: String(org.slug),
|
|
1154
|
+
description: String(org.name ?? org.slug)
|
|
1155
|
+
}));
|
|
1156
|
+
return filterByPrefix(candidates, ctx.prefix);
|
|
1157
|
+
} catch {
|
|
1158
|
+
return [];
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
// src/services/completion/providers/catalog-connect-value.ts
|
|
1163
|
+
async function completeCatalogConnectValue(ctx) {
|
|
1164
|
+
const target = ctx.consumedPositionals?.[0]?.toLowerCase();
|
|
1165
|
+
if (target === "org") {
|
|
1166
|
+
return completeCatalogOrgs(ctx);
|
|
1167
|
+
}
|
|
1168
|
+
if (target === "plugin") {
|
|
1169
|
+
return completeCatalogPlugins(ctx);
|
|
1170
|
+
}
|
|
1171
|
+
return [];
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
// src/services/completion/providers/catalog-profile.ts
|
|
1175
|
+
async function completeCatalogProfiles(ctx) {
|
|
1176
|
+
const accountInfo = await getCloudAccount(ctx.account);
|
|
1177
|
+
if (!accountInfo.account?.accessToken) {
|
|
1178
|
+
return [];
|
|
1179
|
+
}
|
|
1180
|
+
return runWithCatalogTimeout(async () => {
|
|
1181
|
+
const plugins = await listPluginsInScope(
|
|
1182
|
+
{
|
|
1183
|
+
q: ctx.prefix.trim() || void 0,
|
|
1184
|
+
tag: PROFILE_PLUGIN_TAG,
|
|
1185
|
+
limit: 25,
|
|
1186
|
+
sort: "updated"
|
|
1187
|
+
},
|
|
1188
|
+
{ account: accountInfo.accountName ?? void 0 }
|
|
1189
|
+
);
|
|
1190
|
+
const candidates = plugins.flatMap((plugin) => {
|
|
1191
|
+
const selector = formatPublishedSelector({
|
|
1192
|
+
org: plugin.orgSlug,
|
|
1193
|
+
catalog: plugin.catalogSlug,
|
|
1194
|
+
name: plugin.slug
|
|
1195
|
+
});
|
|
1196
|
+
const withVersion = plugin.latestVersion ? formatPublishedSelectorWithVersion({
|
|
1197
|
+
org: plugin.orgSlug,
|
|
1198
|
+
catalog: plugin.catalogSlug,
|
|
1199
|
+
name: plugin.slug,
|
|
1200
|
+
version: plugin.latestVersion
|
|
1201
|
+
}) : selector;
|
|
1202
|
+
const entries = [
|
|
1203
|
+
{
|
|
1204
|
+
value: selector,
|
|
1205
|
+
description: plugin.name
|
|
1206
|
+
}
|
|
1207
|
+
];
|
|
1208
|
+
if (withVersion !== selector) {
|
|
1209
|
+
entries.push({
|
|
1210
|
+
value: withVersion,
|
|
1211
|
+
description: plugin.latestVersion ?? void 0
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
return entries;
|
|
1215
|
+
});
|
|
1216
|
+
return filterByPrefix(candidates, ctx.prefix);
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
// src/services/completion/providers/cloud-account.ts
|
|
1221
|
+
async function completeCloudAccounts(ctx) {
|
|
1222
|
+
if (!ctx.localDataAvailable) {
|
|
1223
|
+
return [];
|
|
1224
|
+
}
|
|
1225
|
+
try {
|
|
1226
|
+
const store = await loadCloudAccounts();
|
|
1227
|
+
const candidates = Object.keys(store.accounts ?? {}).map((name) => ({
|
|
1228
|
+
value: name,
|
|
1229
|
+
description: store.default_account === name ? "default" : void 0
|
|
1230
|
+
}));
|
|
1231
|
+
return filterByPrefix(candidates, ctx.prefix);
|
|
1232
|
+
} catch {
|
|
1233
|
+
return [];
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
// src/services/completion/providers/file-path.ts
|
|
1238
|
+
import { existsSync, readdirSync, statSync } from "fs";
|
|
1239
|
+
import { dirname, join, resolve } from "path";
|
|
1240
|
+
function listPathCandidates(prefix, mode) {
|
|
1241
|
+
const resolvedPrefix = resolve(prefix || ".");
|
|
1242
|
+
const directory = dirname(resolvedPrefix);
|
|
1243
|
+
const baseName = resolvedPrefix === directory ? "" : resolvedPrefix.slice(directory.length + 1);
|
|
1244
|
+
if (!existsSync(directory)) {
|
|
1245
|
+
return [];
|
|
1246
|
+
}
|
|
1247
|
+
let entries;
|
|
1248
|
+
try {
|
|
1249
|
+
entries = readdirSync(directory);
|
|
1250
|
+
} catch {
|
|
1251
|
+
return [];
|
|
1252
|
+
}
|
|
1253
|
+
const candidates = [];
|
|
1254
|
+
for (const entry of entries) {
|
|
1255
|
+
if (!entry.startsWith(baseName)) {
|
|
1256
|
+
continue;
|
|
1257
|
+
}
|
|
1258
|
+
const fullPath = join(directory, entry);
|
|
1259
|
+
let isDirectory = false;
|
|
1260
|
+
try {
|
|
1261
|
+
isDirectory = statSync(fullPath).isDirectory();
|
|
1262
|
+
} catch {
|
|
1263
|
+
continue;
|
|
1264
|
+
}
|
|
1265
|
+
if (mode === "directory" && !isDirectory) {
|
|
1266
|
+
continue;
|
|
1267
|
+
}
|
|
1268
|
+
if (mode === "plugin-import" && !isDirectory) {
|
|
1269
|
+
const lower = entry.toLowerCase();
|
|
1270
|
+
if (!lower.endsWith(".toml") && !lower.endsWith(".jsonc")) {
|
|
1271
|
+
continue;
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
const value = directory === process.cwd() ? join(entry) : fullPath;
|
|
1275
|
+
candidates.push({ value });
|
|
1276
|
+
}
|
|
1277
|
+
return candidates;
|
|
1278
|
+
}
|
|
1279
|
+
function completeFilePath(ctx) {
|
|
1280
|
+
return filterByPrefix(listPathCandidates(ctx.prefix, "file"), ctx.prefix);
|
|
1281
|
+
}
|
|
1282
|
+
function completeDirectoryPath(ctx) {
|
|
1283
|
+
return filterByPrefix(listPathCandidates(ctx.prefix, "directory"), ctx.prefix);
|
|
1284
|
+
}
|
|
1285
|
+
function completePluginImportPath(ctx) {
|
|
1286
|
+
return filterByPrefix(listPathCandidates(ctx.prefix, "plugin-import"), ctx.prefix);
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
// src/services/completion/providers/harness-slug.ts
|
|
1290
|
+
function completeHarnessSlugs(ctx) {
|
|
1291
|
+
const slugs = /* @__PURE__ */ new Set([
|
|
1292
|
+
...getDedicatedSerializerPlatformIds(),
|
|
1293
|
+
...getAllPlatforms().map((platform) => platform.id)
|
|
1294
|
+
]);
|
|
1295
|
+
const candidates = [...slugs].map((slug) => {
|
|
1296
|
+
const platform = getAllPlatforms().find((entry) => entry.id === slug);
|
|
1297
|
+
return {
|
|
1298
|
+
value: slug,
|
|
1299
|
+
description: platform?.name
|
|
1300
|
+
};
|
|
1301
|
+
});
|
|
1302
|
+
return filterByPrefix(candidates, ctx.prefix);
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
// src/services/completion/providers/plugin-attachment.ts
|
|
1306
|
+
function completeCombineAttachments(pluginId) {
|
|
1307
|
+
const candidates = [];
|
|
1308
|
+
for (const resource of listResources({ includeComposition: true })) {
|
|
1309
|
+
candidates.push({
|
|
1310
|
+
value: formatResourceSelector(resource, { includeType: true }),
|
|
1311
|
+
description: resource.description || resource.type
|
|
1312
|
+
});
|
|
1313
|
+
}
|
|
1314
|
+
for (const plugin of listPlugins()) {
|
|
1315
|
+
if (plugin.id === pluginId) {
|
|
1316
|
+
continue;
|
|
1317
|
+
}
|
|
1318
|
+
candidates.push({
|
|
1319
|
+
value: `plugin:${plugin.name}`,
|
|
1320
|
+
description: plugin.version
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
return candidates;
|
|
1324
|
+
}
|
|
1325
|
+
function completeUncombineAttachments(pluginId) {
|
|
1326
|
+
const candidates = [];
|
|
1327
|
+
for (const resource of getPluginResources(pluginId)) {
|
|
1328
|
+
if (resource.type === "plugin") {
|
|
1329
|
+
candidates.push({
|
|
1330
|
+
value: formatResourceSelector(resource, { includeType: true }),
|
|
1331
|
+
description: formatPluginRef(resource)
|
|
1332
|
+
});
|
|
1333
|
+
continue;
|
|
1334
|
+
}
|
|
1335
|
+
candidates.push({
|
|
1336
|
+
value: formatResourceSelector(resource, { includeType: true }),
|
|
1337
|
+
description: resource.description || resource.type
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
for (const pluginRef of listAttachedPluginRefs(pluginId)) {
|
|
1341
|
+
candidates.push({
|
|
1342
|
+
value: `plugin:${pluginRef.dependency_name}`,
|
|
1343
|
+
description: pluginRef.version_constraint || void 0
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
return candidates;
|
|
1347
|
+
}
|
|
1348
|
+
function completePluginEditAddAttachment(ctx) {
|
|
1349
|
+
return completePluginAttachmentCandidates(ctx, "add");
|
|
1350
|
+
}
|
|
1351
|
+
function completePluginEditRemoveAttachment(ctx) {
|
|
1352
|
+
return completePluginAttachmentCandidates(ctx, "remove");
|
|
1353
|
+
}
|
|
1354
|
+
function completePluginAttachmentCandidates(ctx, mode) {
|
|
1355
|
+
if (!ctx.localDataAvailable) {
|
|
1356
|
+
return [];
|
|
1357
|
+
}
|
|
1358
|
+
const pluginSelector = ctx.consumedPositionals?.[0];
|
|
1359
|
+
if (!pluginSelector) {
|
|
1360
|
+
return [];
|
|
1361
|
+
}
|
|
1362
|
+
try {
|
|
1363
|
+
const plugin = getPlugin(pluginSelector);
|
|
1364
|
+
if (!plugin) {
|
|
1365
|
+
return [];
|
|
1366
|
+
}
|
|
1367
|
+
const candidates = mode === "remove" ? completeUncombineAttachments(plugin.id) : completeCombineAttachments(plugin.id);
|
|
1368
|
+
return filterByPrefix(candidates, ctx.prefix);
|
|
1369
|
+
} catch {
|
|
1370
|
+
return [];
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
// src/services/completion/providers/local-environment.ts
|
|
1375
|
+
function completeLocalEnvironments(ctx) {
|
|
1376
|
+
if (!ctx.localDataAvailable) {
|
|
1377
|
+
return [];
|
|
1378
|
+
}
|
|
1379
|
+
try {
|
|
1380
|
+
const candidates = listEnvironments().map((environment) => ({
|
|
1381
|
+
value: environment.name,
|
|
1382
|
+
description: environment.description || void 0
|
|
1383
|
+
}));
|
|
1384
|
+
return filterByPrefix(candidates, ctx.prefix);
|
|
1385
|
+
} catch {
|
|
1386
|
+
return [];
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
// src/services/completion/providers/local-plugin.ts
|
|
1391
|
+
function completeLocalPlugins(ctx) {
|
|
1392
|
+
if (!ctx.localDataAvailable) {
|
|
1393
|
+
return [];
|
|
1394
|
+
}
|
|
1395
|
+
try {
|
|
1396
|
+
const candidates = [];
|
|
1397
|
+
for (const plugin of listPlugins()) {
|
|
1398
|
+
const selector = `${plugin.name}@${plugin.version}`;
|
|
1399
|
+
candidates.push({
|
|
1400
|
+
value: plugin.name,
|
|
1401
|
+
description: plugin.version
|
|
1402
|
+
});
|
|
1403
|
+
candidates.push({
|
|
1404
|
+
value: selector,
|
|
1405
|
+
description: plugin.description || void 0
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1408
|
+
return filterByPrefix(candidates, ctx.prefix);
|
|
1409
|
+
} catch {
|
|
1410
|
+
return [];
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
// src/services/completion/providers/profile-plugin.ts
|
|
1415
|
+
function completeProfilePlugins(ctx) {
|
|
1416
|
+
if (!ctx.localDataAvailable) {
|
|
1417
|
+
return [];
|
|
1418
|
+
}
|
|
1419
|
+
try {
|
|
1420
|
+
const names = [...new Set(listProfilePlugins().map((plugin) => plugin.name))];
|
|
1421
|
+
const candidates = names.map((name) => ({ value: name }));
|
|
1422
|
+
return filterByPrefix(candidates, ctx.prefix);
|
|
1423
|
+
} catch {
|
|
1424
|
+
return [];
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
// src/services/completion/providers/project-profile.ts
|
|
1429
|
+
function completeProjectProfileKeys(ctx) {
|
|
1430
|
+
try {
|
|
1431
|
+
const config = findProjectConfig(process.cwd());
|
|
1432
|
+
if (!config) {
|
|
1433
|
+
return [];
|
|
1434
|
+
}
|
|
1435
|
+
const candidates = config.profiles.map((profile) => ({
|
|
1436
|
+
value: profile.name,
|
|
1437
|
+
description: profile.source
|
|
1438
|
+
}));
|
|
1439
|
+
return filterByPrefix(candidates, ctx.prefix);
|
|
1440
|
+
} catch {
|
|
1441
|
+
return [];
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
// src/services/completion/providers/local-resource.ts
|
|
1446
|
+
function completeLocalResources(ctx) {
|
|
1447
|
+
if (!ctx.localDataAvailable) {
|
|
1448
|
+
return [];
|
|
1449
|
+
}
|
|
1450
|
+
try {
|
|
1451
|
+
const candidates = listResources().map((resource) => ({
|
|
1452
|
+
value: formatResourceSelector(resource),
|
|
1453
|
+
description: resource.type
|
|
1454
|
+
}));
|
|
1455
|
+
return filterByPrefix(candidates, ctx.prefix);
|
|
1456
|
+
} catch {
|
|
1457
|
+
return [];
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
// src/services/completion/providers/resource-type.ts
|
|
1462
|
+
function completeResourceTypes(ctx) {
|
|
1463
|
+
const candidates = LISTABLE_RESOURCE_TYPES.map((type) => ({
|
|
1464
|
+
value: type
|
|
1465
|
+
}));
|
|
1466
|
+
return filterByPrefix(candidates, ctx.prefix);
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
// src/services/completion/providers/scenario-id.ts
|
|
1470
|
+
var completeScenarioIds = (ctx) => filterByPrefix(
|
|
1471
|
+
listScenarioIds().map((id) => ({ value: String(id) })),
|
|
1472
|
+
ctx.prefix
|
|
1473
|
+
);
|
|
1474
|
+
|
|
1475
|
+
// src/services/completion/providers/snapshot-id.ts
|
|
1476
|
+
function listAllSnapshotCandidates() {
|
|
1477
|
+
const db = getDb();
|
|
1478
|
+
const rows = db.prepare("SELECT id, label, created_at FROM snapshots ORDER BY created_at DESC").all();
|
|
1479
|
+
return rows.map((row) => ({
|
|
1480
|
+
value: row.id,
|
|
1481
|
+
description: row.label || row.created_at
|
|
1482
|
+
}));
|
|
1483
|
+
}
|
|
1484
|
+
function completeSnapshotIds(ctx) {
|
|
1485
|
+
if (!ctx.localDataAvailable) {
|
|
1486
|
+
return [];
|
|
1487
|
+
}
|
|
1488
|
+
try {
|
|
1489
|
+
const project = getProjectByLocalPath(process.cwd());
|
|
1490
|
+
const candidates = project ? listSnapshots(project.id).map((snapshot) => ({
|
|
1491
|
+
value: snapshot.id,
|
|
1492
|
+
description: snapshot.label || snapshot.created_at
|
|
1493
|
+
})) : listAllSnapshotCandidates();
|
|
1494
|
+
return filterByPrefix(candidates, ctx.prefix);
|
|
1495
|
+
} catch {
|
|
1496
|
+
return [];
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
// src/services/completion/providers/static-enum.ts
|
|
1501
|
+
function staticEnumProvider(values) {
|
|
1502
|
+
return (ctx) => filterByPrefix(
|
|
1503
|
+
values.map((value) => ({ value })),
|
|
1504
|
+
ctx.prefix
|
|
1505
|
+
);
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
// src/services/completion/registry.ts
|
|
1509
|
+
var LOCAL_PLUGIN_OR_FILE = [
|
|
1510
|
+
completeLocalPlugins,
|
|
1511
|
+
completeFilePath
|
|
1512
|
+
];
|
|
1513
|
+
var POSITIONAL_PROVIDERS = {
|
|
1514
|
+
"plugin show:0": [completeLocalPlugins],
|
|
1515
|
+
"plugin edit:0": [completeLocalPlugins],
|
|
1516
|
+
"plugin editor:0": [completeLocalPlugins],
|
|
1517
|
+
"plugin delete:0": [completeLocalPlugins],
|
|
1518
|
+
"apply:0": [completeLocalPlugins, completeFilePath],
|
|
1519
|
+
"plugin diff:0": LOCAL_PLUGIN_OR_FILE,
|
|
1520
|
+
"plugin diff:1": LOCAL_PLUGIN_OR_FILE,
|
|
1521
|
+
"plugin pull:0": [completeCatalogPlugins],
|
|
1522
|
+
"plugin publish:0": [completeLocalPlugins],
|
|
1523
|
+
"profile use:0": [completeProfilePlugins],
|
|
1524
|
+
"use:profile": [completeProjectProfileKeys],
|
|
1525
|
+
"profile use:profile": [completeProjectProfileKeys],
|
|
1526
|
+
"profile show:0": [completeProfilePlugins],
|
|
1527
|
+
"profile delete:0": [completeProfilePlugins],
|
|
1528
|
+
"profile pull:0": [completeCatalogProfiles],
|
|
1529
|
+
":0": [completeProfilePlugins],
|
|
1530
|
+
"plugin catalog connect:1": [completeCatalogConnectValue],
|
|
1531
|
+
"plugin catalog disconnect:1": [completeCatalogConnectValue],
|
|
1532
|
+
"resource show:0": [completeLocalResources],
|
|
1533
|
+
"resource delete:0": [completeLocalResources],
|
|
1534
|
+
"resource list:0": [completeResourceTypes],
|
|
1535
|
+
"resource sync:0": [completeLocalResources],
|
|
1536
|
+
"environment edit:0": [completeLocalEnvironments],
|
|
1537
|
+
"environment show:0": [completeLocalEnvironments],
|
|
1538
|
+
"environment delete:0": [completeLocalEnvironments],
|
|
1539
|
+
"environment use:0": [completeLocalEnvironments],
|
|
1540
|
+
"migrate export:environment": [completeLocalEnvironments],
|
|
1541
|
+
"revert:0": [completeSnapshotIds],
|
|
1542
|
+
"migrate export:0": [completeFilePath],
|
|
1543
|
+
"migrate import:0": [completePluginImportPath, completeFilePath],
|
|
1544
|
+
"auth login:0": [completeCloudAccounts],
|
|
1545
|
+
"help scenario:0": [completeScenarioIds]
|
|
1546
|
+
};
|
|
1547
|
+
var FLAG_PROVIDERS = {
|
|
1548
|
+
"init:main": [completeHarnessSlugs],
|
|
1549
|
+
"init:aliases": [completeHarnessSlugs],
|
|
1550
|
+
"init:harnesses": [completeHarnessSlugs],
|
|
1551
|
+
"harness set:main": [completeHarnessSlugs],
|
|
1552
|
+
"harness set:aliases": [completeHarnessSlugs],
|
|
1553
|
+
"harness set:harnesses": [completeHarnessSlugs],
|
|
1554
|
+
"harness project set:main": [completeHarnessSlugs],
|
|
1555
|
+
"harness project set:aliases": [completeHarnessSlugs],
|
|
1556
|
+
"harness project set:harnesses": [completeHarnessSlugs],
|
|
1557
|
+
"migrate export:plugin": [completeLocalPlugins],
|
|
1558
|
+
"migrate export:resource": [completeLocalResources],
|
|
1559
|
+
"plugin edit:type": [staticEnumProvider(PLUGIN_ATTACHMENT_TYPES)],
|
|
1560
|
+
"plugin edit:add": [completePluginEditAddAttachment],
|
|
1561
|
+
"plugin edit:remove": [completePluginEditRemoveAttachment],
|
|
1562
|
+
"plugin edit:environment": [completeLocalEnvironments],
|
|
1563
|
+
"plugin publish:org": [completeCatalogOrgs],
|
|
1564
|
+
"add:plugin": [completeLocalPlugins],
|
|
1565
|
+
"add:create-plugin": [completeLocalPlugins],
|
|
1566
|
+
"add:harness": [completeHarnessSlugs],
|
|
1567
|
+
"add:project": [completeDirectoryPath],
|
|
1568
|
+
"compile:target": [completeHarnessSlugs],
|
|
1569
|
+
"compile:t": [completeHarnessSlugs],
|
|
1570
|
+
"compile:harness": [completeHarnessSlugs],
|
|
1571
|
+
"compile:project": [completeDirectoryPath],
|
|
1572
|
+
"targets:project": [completeDirectoryPath],
|
|
1573
|
+
"lock export:format": [staticEnumProvider(["cyclonedx", "spdx"])],
|
|
1574
|
+
"lock export:f": [staticEnumProvider(["cyclonedx", "spdx"])],
|
|
1575
|
+
"lock export:output": [completeFilePath],
|
|
1576
|
+
"lock export:o": [completeFilePath],
|
|
1577
|
+
"lock export:project": [completeDirectoryPath],
|
|
1578
|
+
"pack:output": [completeDirectoryPath],
|
|
1579
|
+
"pack:o": [completeDirectoryPath],
|
|
1580
|
+
"pack:project": [completeDirectoryPath],
|
|
1581
|
+
"audit:project": [completeDirectoryPath],
|
|
1582
|
+
"audit:file": [completeFilePath],
|
|
1583
|
+
"audit:policy": [completeFilePath],
|
|
1584
|
+
"approve:project": [completeDirectoryPath],
|
|
1585
|
+
"deny:project": [completeDirectoryPath],
|
|
1586
|
+
"policy explain:project": [completeDirectoryPath],
|
|
1587
|
+
"auth status:account": [completeCloudAccounts],
|
|
1588
|
+
"auth logout:account": [completeCloudAccounts],
|
|
1589
|
+
"auth orgs:account": [completeCloudAccounts],
|
|
1590
|
+
"auth orgs:switch": [completeCatalogOrgs]
|
|
1591
|
+
};
|
|
1592
|
+
var GLOBAL_FLAG_PROVIDERS = {
|
|
1593
|
+
format: [staticEnumProvider(["human", "json"])],
|
|
1594
|
+
harness: [completeHarnessSlugs],
|
|
1595
|
+
h: [completeHarnessSlugs],
|
|
1596
|
+
target: [completeHarnessSlugs],
|
|
1597
|
+
t: [completeHarnessSlugs],
|
|
1598
|
+
account: [completeCloudAccounts]
|
|
1599
|
+
};
|
|
1600
|
+
var PLUGIN_ACCOUNT_FLAGS = /* @__PURE__ */ new Set(["account"]);
|
|
1601
|
+
function positionalKey(commandPath, index) {
|
|
1602
|
+
return `${commandPath.join(" ")}:${index}`;
|
|
1603
|
+
}
|
|
1604
|
+
function flagKey(commandPath, flag) {
|
|
1605
|
+
return `${commandPath.join(" ")}:${flag}`;
|
|
1606
|
+
}
|
|
1607
|
+
function resolvePluginWildcardProviders(ctx, slot) {
|
|
1608
|
+
if (!ctx.commandPath[0] || ctx.commandPath[0] !== "plugin") {
|
|
1609
|
+
return [];
|
|
1610
|
+
}
|
|
1611
|
+
if (slot === "flag-value" && ctx.flag && PLUGIN_ACCOUNT_FLAGS.has(ctx.flag)) {
|
|
1612
|
+
return [completeCloudAccounts];
|
|
1613
|
+
}
|
|
1614
|
+
return [];
|
|
1615
|
+
}
|
|
1616
|
+
function lookupProviders(ctx) {
|
|
1617
|
+
const providers = [];
|
|
1618
|
+
if (ctx.slot === "flag-value" && ctx.flag) {
|
|
1619
|
+
const specific = FLAG_PROVIDERS[flagKey(ctx.commandPath, ctx.flag)];
|
|
1620
|
+
if (specific) {
|
|
1621
|
+
providers.push(...specific);
|
|
1622
|
+
}
|
|
1623
|
+
const global = GLOBAL_FLAG_PROVIDERS[ctx.flag];
|
|
1624
|
+
if (global) {
|
|
1625
|
+
providers.push(...global);
|
|
1626
|
+
}
|
|
1627
|
+
providers.push(...resolvePluginWildcardProviders(ctx, "flag-value"));
|
|
1628
|
+
if (flagsMatch(ctx.flag, "file")) {
|
|
1629
|
+
providers.push(completeFilePath);
|
|
1630
|
+
}
|
|
1631
|
+
if (flagsMatch(ctx.flag, "project")) {
|
|
1632
|
+
providers.push(completeDirectoryPath);
|
|
1633
|
+
}
|
|
1634
|
+
if (flagsMatch(ctx.flag, "main") || flagsMatch(ctx.flag, "aliases")) {
|
|
1635
|
+
providers.push(completeHarnessSlugs);
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
if (ctx.slot === "positional" && ctx.positionalIndex !== void 0) {
|
|
1639
|
+
const specific = POSITIONAL_PROVIDERS[positionalKey(ctx.commandPath, ctx.positionalIndex)];
|
|
1640
|
+
if (specific) {
|
|
1641
|
+
providers.push(...specific);
|
|
1642
|
+
}
|
|
1643
|
+
providers.push(...resolvePluginWildcardProviders(ctx, "positional"));
|
|
1644
|
+
}
|
|
1645
|
+
return providers;
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
// src/services/completion/engine.ts
|
|
1649
|
+
var INVOCATION_NAMES = /* @__PURE__ */ new Set(["ht", "harnesstap"]);
|
|
1650
|
+
var GLOBAL_FLAG_NAMES = [
|
|
1651
|
+
"-v",
|
|
1652
|
+
"--verbose",
|
|
1653
|
+
"--no-color",
|
|
1654
|
+
"--no-interactive",
|
|
1655
|
+
"-h",
|
|
1656
|
+
"--help",
|
|
1657
|
+
"--format",
|
|
1658
|
+
"--harness"
|
|
1659
|
+
];
|
|
1660
|
+
function tokenizeCompletionLine(line) {
|
|
1661
|
+
const tokens = [];
|
|
1662
|
+
let current = "";
|
|
1663
|
+
let quote = null;
|
|
1664
|
+
for (const character of line) {
|
|
1665
|
+
if (quote) {
|
|
1666
|
+
if (character === quote) {
|
|
1667
|
+
quote = null;
|
|
1668
|
+
} else {
|
|
1669
|
+
current += character;
|
|
1670
|
+
}
|
|
1671
|
+
continue;
|
|
1672
|
+
}
|
|
1673
|
+
if (character === "'" || character === '"') {
|
|
1674
|
+
quote = character;
|
|
1675
|
+
continue;
|
|
1676
|
+
}
|
|
1677
|
+
if (character === " " || character === " ") {
|
|
1678
|
+
if (current.length > 0) {
|
|
1679
|
+
tokens.push(current);
|
|
1680
|
+
current = "";
|
|
1681
|
+
}
|
|
1682
|
+
continue;
|
|
1683
|
+
}
|
|
1684
|
+
current += character;
|
|
1685
|
+
}
|
|
1686
|
+
if (current.length > 0) {
|
|
1687
|
+
tokens.push(current);
|
|
1688
|
+
}
|
|
1689
|
+
return tokens;
|
|
1690
|
+
}
|
|
1691
|
+
function stripInvocationName(tokens) {
|
|
1692
|
+
const first = tokens[0];
|
|
1693
|
+
if (first && INVOCATION_NAMES.has(first)) {
|
|
1694
|
+
return tokens.slice(1);
|
|
1695
|
+
}
|
|
1696
|
+
return tokens;
|
|
1697
|
+
}
|
|
1698
|
+
function isHiddenCommand(command) {
|
|
1699
|
+
const hidden = command._hidden === true;
|
|
1700
|
+
return hidden || command.description() === false;
|
|
1701
|
+
}
|
|
1702
|
+
function getVisibleSubcommands(command) {
|
|
1703
|
+
return command.commands.filter(
|
|
1704
|
+
(subcommand) => subcommand.name() && !isHiddenCommand(subcommand)
|
|
1705
|
+
);
|
|
1706
|
+
}
|
|
1707
|
+
function findSubcommand(parent, token) {
|
|
1708
|
+
return parent.commands.find(
|
|
1709
|
+
(subcommand) => subcommand.name() === token || subcommand.aliases().includes(token)
|
|
1710
|
+
);
|
|
1711
|
+
}
|
|
1712
|
+
function collectOptions(command) {
|
|
1713
|
+
const options = [];
|
|
1714
|
+
let current = command;
|
|
1715
|
+
while (current) {
|
|
1716
|
+
options.push(...current.options.filter((option) => !option.hidden));
|
|
1717
|
+
current = current.parent;
|
|
1718
|
+
}
|
|
1719
|
+
return options;
|
|
1720
|
+
}
|
|
1721
|
+
function optionTakesValue(option) {
|
|
1722
|
+
return Boolean(option.attributeName());
|
|
1723
|
+
}
|
|
1724
|
+
function findOption(command, token) {
|
|
1725
|
+
const normalized = normalizeFlagName(token);
|
|
1726
|
+
return collectOptions(command).find((option) => {
|
|
1727
|
+
const flags = option.flags.split(/[ ,|]+/).filter(Boolean);
|
|
1728
|
+
return flags.some((flag) => {
|
|
1729
|
+
const flagName = normalizeFlagName(flag);
|
|
1730
|
+
return flag === token || flag.startsWith(`${token}=`) || flagName === normalized || flag === `-${normalized}` || flag === `--${normalized}`;
|
|
1731
|
+
});
|
|
1732
|
+
});
|
|
1733
|
+
}
|
|
1734
|
+
function optionFlagNames(option) {
|
|
1735
|
+
return option.flags.split(/[ ,|]+/).filter((flag) => flag.startsWith("-")).map((flag) => flag.replace(/=<.*>$/, ""));
|
|
1736
|
+
}
|
|
1737
|
+
function splitFlagToken(token) {
|
|
1738
|
+
const equalsIndex = token.indexOf("=");
|
|
1739
|
+
if (equalsIndex > 0 && token.startsWith("-")) {
|
|
1740
|
+
return {
|
|
1741
|
+
flag: token.slice(0, equalsIndex),
|
|
1742
|
+
value: token.slice(equalsIndex + 1)
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
return { flag: token };
|
|
1746
|
+
}
|
|
1747
|
+
function tokenHasEmbeddedFlagValue(token) {
|
|
1748
|
+
return token.startsWith("-") && token.includes("=") && token.indexOf("=") > 0;
|
|
1749
|
+
}
|
|
1750
|
+
function extractAccount(consumed) {
|
|
1751
|
+
for (let index = 0; index < consumed.length; index += 1) {
|
|
1752
|
+
const token = consumed[index];
|
|
1753
|
+
if (!token) {
|
|
1754
|
+
continue;
|
|
1755
|
+
}
|
|
1756
|
+
const split = splitFlagToken(token);
|
|
1757
|
+
if (normalizeFlagName(split.flag) === "account") {
|
|
1758
|
+
if (split.value !== void 0) {
|
|
1759
|
+
return split.value.length > 0 ? split.value : void 0;
|
|
1760
|
+
}
|
|
1761
|
+
const next = consumed[index + 1];
|
|
1762
|
+
if (next && !next.startsWith("-")) {
|
|
1763
|
+
return next;
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
return void 0;
|
|
1768
|
+
}
|
|
1769
|
+
function walkConsumedTokens(command, tokens) {
|
|
1770
|
+
let currentCommand = command;
|
|
1771
|
+
const commandPath = [];
|
|
1772
|
+
let positionalIndex = 0;
|
|
1773
|
+
const consumedPositionals = [];
|
|
1774
|
+
for (let index = 0; index < tokens.length; index += 1) {
|
|
1775
|
+
const token = tokens[index];
|
|
1776
|
+
if (!token) {
|
|
1777
|
+
continue;
|
|
1778
|
+
}
|
|
1779
|
+
if (token.startsWith("-")) {
|
|
1780
|
+
if (tokenHasEmbeddedFlagValue(token)) {
|
|
1781
|
+
continue;
|
|
1782
|
+
}
|
|
1783
|
+
const option = findOption(currentCommand, token);
|
|
1784
|
+
if (option && optionTakesValue(option)) {
|
|
1785
|
+
const next = tokens[index + 1];
|
|
1786
|
+
if (next && !next.startsWith("-")) {
|
|
1787
|
+
index += 1;
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
continue;
|
|
1791
|
+
}
|
|
1792
|
+
const subcommand = findSubcommand(currentCommand, token);
|
|
1793
|
+
if (subcommand && !isHiddenCommand(subcommand)) {
|
|
1794
|
+
currentCommand = subcommand;
|
|
1795
|
+
commandPath.push(subcommand.name());
|
|
1796
|
+
positionalIndex = 0;
|
|
1797
|
+
consumedPositionals.length = 0;
|
|
1798
|
+
continue;
|
|
1799
|
+
}
|
|
1800
|
+
consumedPositionals.push(token);
|
|
1801
|
+
positionalIndex += 1;
|
|
1802
|
+
}
|
|
1803
|
+
return {
|
|
1804
|
+
command: currentCommand,
|
|
1805
|
+
commandPath,
|
|
1806
|
+
positionalIndex,
|
|
1807
|
+
consumedPositionals
|
|
1808
|
+
};
|
|
1809
|
+
}
|
|
1810
|
+
function subcommandMatchesPrefix(command, prefix) {
|
|
1811
|
+
const normalized = prefix.toLowerCase();
|
|
1812
|
+
return getVisibleSubcommands(command).some((subcommand) => {
|
|
1813
|
+
const names = [subcommand.name(), ...subcommand.aliases()];
|
|
1814
|
+
return names.some((name) => name.toLowerCase().startsWith(normalized));
|
|
1815
|
+
});
|
|
1816
|
+
}
|
|
1817
|
+
function resolveSlot(command, positionalIndex, consumed, prefix, endsWithSpace) {
|
|
1818
|
+
if (prefix.startsWith("-")) {
|
|
1819
|
+
return { slot: "flag", positionalIndex };
|
|
1820
|
+
}
|
|
1821
|
+
const lastConsumed = consumed[consumed.length - 1];
|
|
1822
|
+
if (lastConsumed?.startsWith("-") && !tokenHasEmbeddedFlagValue(lastConsumed)) {
|
|
1823
|
+
const option = findOption(command, lastConsumed);
|
|
1824
|
+
if (option && optionTakesValue(option)) {
|
|
1825
|
+
return {
|
|
1826
|
+
slot: "flag-value",
|
|
1827
|
+
flag: normalizeFlagName(lastConsumed),
|
|
1828
|
+
positionalIndex
|
|
1829
|
+
};
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
const visibleSubcommands = getVisibleSubcommands(command);
|
|
1833
|
+
if (visibleSubcommands.length > 0 && (prefix === "" ? endsWithSpace : subcommandMatchesPrefix(command, prefix))) {
|
|
1834
|
+
return { slot: "subcommand", positionalIndex };
|
|
1835
|
+
}
|
|
1836
|
+
return { slot: "positional", positionalIndex };
|
|
1837
|
+
}
|
|
1838
|
+
function parseCompletionContext(program, line) {
|
|
1839
|
+
const endsWithSpace = /[ \t]$/.test(line);
|
|
1840
|
+
const tokens = stripInvocationName(tokenizeCompletionLine(line.trimStart()));
|
|
1841
|
+
const consumed = endsWithSpace ? tokens : tokens.slice(0, -1);
|
|
1842
|
+
let prefix = endsWithSpace ? "" : tokens[tokens.length - 1] ?? "";
|
|
1843
|
+
const walked = walkConsumedTokens(program, consumed);
|
|
1844
|
+
let slotInfo = resolveSlot(
|
|
1845
|
+
walked.command,
|
|
1846
|
+
walked.positionalIndex,
|
|
1847
|
+
consumed,
|
|
1848
|
+
prefix,
|
|
1849
|
+
endsWithSpace
|
|
1850
|
+
);
|
|
1851
|
+
if (prefix.startsWith("-") && prefix.includes("=")) {
|
|
1852
|
+
const equalsIndex = prefix.indexOf("=");
|
|
1853
|
+
const flagToken = prefix.slice(0, equalsIndex);
|
|
1854
|
+
const valuePrefix = prefix.slice(equalsIndex + 1);
|
|
1855
|
+
const option = findOption(walked.command, flagToken);
|
|
1856
|
+
if (option && optionTakesValue(option)) {
|
|
1857
|
+
slotInfo = {
|
|
1858
|
+
slot: "flag-value",
|
|
1859
|
+
flag: normalizeFlagName(flagToken),
|
|
1860
|
+
positionalIndex: walked.positionalIndex
|
|
1861
|
+
};
|
|
1862
|
+
prefix = valuePrefix;
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
return {
|
|
1866
|
+
commandPath: walked.commandPath,
|
|
1867
|
+
consumedPositionals: walked.consumedPositionals,
|
|
1868
|
+
prefix,
|
|
1869
|
+
account: extractAccount(consumed),
|
|
1870
|
+
localDataAvailable: existsSync2(getHarnesstapDir()),
|
|
1871
|
+
...slotInfo
|
|
1872
|
+
};
|
|
1873
|
+
}
|
|
1874
|
+
function completeFlags(command, prefix) {
|
|
1875
|
+
const normalized = prefix.toLowerCase();
|
|
1876
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1877
|
+
const candidates = [];
|
|
1878
|
+
for (const option of collectOptions(command)) {
|
|
1879
|
+
for (const flag of optionFlagNames(option)) {
|
|
1880
|
+
if (!flag.toLowerCase().startsWith(normalized) || seen.has(flag)) {
|
|
1881
|
+
continue;
|
|
1882
|
+
}
|
|
1883
|
+
seen.add(flag);
|
|
1884
|
+
candidates.push({
|
|
1885
|
+
value: flag,
|
|
1886
|
+
description: option.description
|
|
1887
|
+
});
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
for (const flag of GLOBAL_FLAG_NAMES) {
|
|
1891
|
+
if (!flag.toLowerCase().startsWith(normalized) || seen.has(flag)) {
|
|
1892
|
+
continue;
|
|
1893
|
+
}
|
|
1894
|
+
seen.add(flag);
|
|
1895
|
+
candidates.push({ value: flag });
|
|
1896
|
+
}
|
|
1897
|
+
return candidates.sort((left, right) => left.value.localeCompare(right.value));
|
|
1898
|
+
}
|
|
1899
|
+
function completeSubcommands(command, prefix) {
|
|
1900
|
+
const normalized = prefix.toLowerCase();
|
|
1901
|
+
const candidates = [];
|
|
1902
|
+
for (const subcommand of getVisibleSubcommands(command)) {
|
|
1903
|
+
const names = [subcommand.name(), ...subcommand.aliases()];
|
|
1904
|
+
for (const name of names) {
|
|
1905
|
+
if (!name.toLowerCase().startsWith(normalized)) {
|
|
1906
|
+
continue;
|
|
1907
|
+
}
|
|
1908
|
+
candidates.push({
|
|
1909
|
+
value: name,
|
|
1910
|
+
description: subcommand.description()
|
|
1911
|
+
});
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
return candidates.sort((left, right) => left.value.localeCompare(right.value));
|
|
1915
|
+
}
|
|
1916
|
+
async function runProviders(providers, ctx) {
|
|
1917
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1918
|
+
const merged = [];
|
|
1919
|
+
for (const provider of providers) {
|
|
1920
|
+
const results = await provider(ctx);
|
|
1921
|
+
for (const candidate of results) {
|
|
1922
|
+
if (seen.has(candidate.value)) {
|
|
1923
|
+
continue;
|
|
1924
|
+
}
|
|
1925
|
+
seen.add(candidate.value);
|
|
1926
|
+
merged.push(candidate);
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
return merged.sort((left, right) => left.value.localeCompare(right.value));
|
|
1930
|
+
}
|
|
1931
|
+
function resolveCommandAtPath(program, commandPath) {
|
|
1932
|
+
let current = program;
|
|
1933
|
+
for (const segment of commandPath) {
|
|
1934
|
+
const next = findSubcommand(current, segment);
|
|
1935
|
+
if (!next) {
|
|
1936
|
+
break;
|
|
1937
|
+
}
|
|
1938
|
+
current = next;
|
|
1939
|
+
}
|
|
1940
|
+
return current;
|
|
1941
|
+
}
|
|
1942
|
+
async function resolveCompletions(program, ctx) {
|
|
1943
|
+
const command = resolveCommandAtPath(program, ctx.commandPath);
|
|
1944
|
+
switch (ctx.slot) {
|
|
1945
|
+
case "flag":
|
|
1946
|
+
return completeFlags(command, ctx.prefix);
|
|
1947
|
+
case "subcommand":
|
|
1948
|
+
return completeSubcommands(command, ctx.prefix);
|
|
1949
|
+
case "flag-value":
|
|
1950
|
+
return runProviders(lookupProviders(ctx), ctx);
|
|
1951
|
+
case "positional":
|
|
1952
|
+
return runProviders(lookupProviders(ctx), ctx);
|
|
1953
|
+
default: {
|
|
1954
|
+
const unexpected = ctx.slot;
|
|
1955
|
+
return unexpected;
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
async function completeLine(program, line) {
|
|
1960
|
+
try {
|
|
1961
|
+
const context = parseCompletionContext(program, line);
|
|
1962
|
+
return await resolveCompletions(program, context);
|
|
1963
|
+
} catch {
|
|
1964
|
+
return [];
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
// src/services/completion/run-complete.ts
|
|
1969
|
+
var COMPLETE_CACHE_TTL_MS = 100;
|
|
1970
|
+
var completeCache;
|
|
1971
|
+
function formatCandidates(candidates, shell) {
|
|
1972
|
+
if (candidates.length === 0) {
|
|
1973
|
+
return "";
|
|
1974
|
+
}
|
|
1975
|
+
const lines = candidates.map((candidate) => {
|
|
1976
|
+
if ((shell === "zsh" || shell === "fish") && candidate.description) {
|
|
1977
|
+
return `${candidate.value} ${candidate.description}`;
|
|
1978
|
+
}
|
|
1979
|
+
return candidate.value;
|
|
1980
|
+
});
|
|
1981
|
+
return `${lines.join("\n")}
|
|
1982
|
+
`;
|
|
1983
|
+
}
|
|
1984
|
+
async function runCompleteCommand(shell, lineParts, program) {
|
|
1985
|
+
const previousComplete = process.env.HARNESSTAP_COMPLETE;
|
|
1986
|
+
closeDb();
|
|
1987
|
+
process.env.HARNESSTAP_COMPLETE = "1";
|
|
1988
|
+
process.exitCode = 0;
|
|
1989
|
+
try {
|
|
1990
|
+
const line = lineParts.filter((part) => part !== "--").join(" ");
|
|
1991
|
+
const now = Date.now();
|
|
1992
|
+
const cacheKey = line;
|
|
1993
|
+
const cached = completeCache?.key === cacheKey && completeCache.expiresAt > now ? completeCache.candidates : void 0;
|
|
1994
|
+
const candidates = cached ?? await completeLine(program, line);
|
|
1995
|
+
if (!cached) {
|
|
1996
|
+
completeCache = {
|
|
1997
|
+
key: cacheKey,
|
|
1998
|
+
expiresAt: now + COMPLETE_CACHE_TTL_MS,
|
|
1999
|
+
candidates
|
|
2000
|
+
};
|
|
2001
|
+
}
|
|
2002
|
+
process.stdout.write(formatCandidates(candidates, shell));
|
|
2003
|
+
} catch {
|
|
2004
|
+
} finally {
|
|
2005
|
+
closeDb();
|
|
2006
|
+
if (previousComplete === void 0) {
|
|
2007
|
+
delete process.env.HARNESSTAP_COMPLETE;
|
|
2008
|
+
} else {
|
|
2009
|
+
process.env.HARNESSTAP_COMPLETE = previousComplete;
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
// src/cli/commands/help.ts
|
|
2015
|
+
function handleHelpCommand(opts) {
|
|
2016
|
+
const format = parseOutputFormat(opts.format);
|
|
2017
|
+
if (format === "json") {
|
|
2018
|
+
printJson(buildHelpCommandPayload());
|
|
2019
|
+
return;
|
|
2020
|
+
}
|
|
2021
|
+
printHelpCommand();
|
|
2022
|
+
}
|
|
2023
|
+
function handleScenarioGuideCommand(scenarioInput, opts) {
|
|
2024
|
+
const format = parseOutputFormat(opts.format);
|
|
2025
|
+
try {
|
|
2026
|
+
const scenario = loadScenarioGuide(parseScenarioId(scenarioInput));
|
|
2027
|
+
if (format === "json") {
|
|
2028
|
+
printJson(scenario);
|
|
2029
|
+
return;
|
|
2030
|
+
}
|
|
2031
|
+
console.log("");
|
|
2032
|
+
ui.subheader(`SCENARIO ${scenario.id}: ${scenario.title.toUpperCase()}`);
|
|
2033
|
+
if (scenario.frequency || scenario.status) {
|
|
2034
|
+
console.log("");
|
|
2035
|
+
ui.dim(
|
|
2036
|
+
[scenario.frequency, scenario.status].filter(Boolean).join(" \xB7 ")
|
|
2037
|
+
);
|
|
2038
|
+
}
|
|
2039
|
+
if (scenario.summaryLines.length > 0) {
|
|
2040
|
+
console.log("");
|
|
2041
|
+
for (const line of scenario.summaryLines) {
|
|
2042
|
+
console.log(` ${line}`);
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
if (scenario.commands.length > 0) {
|
|
2046
|
+
console.log("");
|
|
2047
|
+
ui.subheader("TYPICAL COMMANDS");
|
|
2048
|
+
console.log("");
|
|
2049
|
+
for (const command of scenario.commands) {
|
|
2050
|
+
console.log(` ${formatScenarioCommand(command)}`);
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
console.log("");
|
|
2054
|
+
ui.dim(
|
|
2055
|
+
`Full doc: https://github.com/harnesstap/harnesstap/blob/main/docs/scenarios/details/${scenario.filename}`
|
|
2056
|
+
);
|
|
2057
|
+
ui.dim(`All scenarios: ${GUIDE_SCENARIOS_URL}`);
|
|
2058
|
+
} catch (err) {
|
|
2059
|
+
process.exitCode = 1;
|
|
2060
|
+
fail(err instanceof Error ? err.message : String(err), {
|
|
2061
|
+
hints: [`ht help scenario 11`, `See ${GUIDE_SCENARIOS_URL}`]
|
|
2062
|
+
});
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
function registerHelpCommands(root) {
|
|
2066
|
+
const helpCommand = root.command("help").description("Core concepts and scenario playbooks").option("--format <mode>", "Output format: human or json", "human").action((opts) => {
|
|
2067
|
+
handleHelpCommand(opts);
|
|
2068
|
+
});
|
|
2069
|
+
helpCommand.command("scenario").argument("<id>", "Scenario number from docs/scenarios/scenarios.md").description("Show a numbered scenario playbook from the docs").option("--format <mode>", "Output format: human or json", "human").action((id, opts) => {
|
|
2070
|
+
handleScenarioGuideCommand(id, opts);
|
|
2071
|
+
});
|
|
2072
|
+
root.command("__complete").argument("<shell>", "bash | zsh | fish").argument("[line...]", "Partial command line").description(false).action(async (shell, line) => {
|
|
2073
|
+
await runCompleteCommand(shell, line, root);
|
|
2074
|
+
});
|
|
2075
|
+
}
|
|
2076
|
+
export {
|
|
2077
|
+
registerHelpCommands
|
|
2078
|
+
};
|
|
2079
|
+
//# sourceMappingURL=help-AW2HKX63.js.map
|