-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathsmoke_test_tool.sh
More file actions
297 lines (249 loc) · 10.3 KB
/
Copy pathsmoke_test_tool.sh
File metadata and controls
297 lines (249 loc) · 10.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
#!/usr/bin/env bash
set -euo pipefail
package_source="${1:-artifacts/nuget}"
tool_path="${RUNNER_TEMP:-/tmp}/dotnet-skills-tool"
skills_path="${RUNNER_TEMP:-/tmp}/dotnet-skills-installed-skills"
bundle_path="${RUNNER_TEMP:-/tmp}/dotnet-skills-bundle-target"
workspace_path="${RUNNER_TEMP:-/tmp}/dotnet-skills-workspace"
codex_workspace="$workspace_path/codex"
claude_workspace="$workspace_path/claude"
hybrid_workspace="$workspace_path/hybrid"
shared_workspace="$workspace_path/shared"
plain_workspace="$workspace_path/plain"
gemini_workspace="$workspace_path/gemini"
grok_workspace="$workspace_path/grok"
rm -rf "$tool_path" "$skills_path" "$bundle_path" "$workspace_path"
mkdir -p \
"$tool_path" \
"$skills_path" \
"$bundle_path" \
"$codex_workspace/.codex" \
"$claude_workspace/.claude" \
"$workspace_path/.claude" \
"$hybrid_workspace/.codex" \
"$hybrid_workspace/.codex/agents" \
"$hybrid_workspace/.claude" \
"$hybrid_workspace/.claude/agents" \
"$shared_workspace/.codex" \
"$shared_workspace/.claude" \
"$shared_workspace/.agents" \
"$plain_workspace" \
"$gemini_workspace/.gemini" \
"$grok_workspace/.grok"
shopt -s nullglob
if [[ -f "$package_source" ]]; then
package_feed="$(dirname "$package_source")"
elif [[ -d "$package_source" ]]; then
package_feed="$package_source"
else
echo "Package source must be a .nupkg file or a directory: $package_source" >&2
exit 1
fi
resolve_package() {
local package_id="$1"
local packages=( "$package_feed"/"$package_id".*.nupkg )
if [[ ${#packages[@]} -eq 0 ]]; then
echo "No $package_id package found in $package_feed" >&2
exit 1
fi
ls -t "${packages[@]}" | head -n 1
}
skills_package="$(resolve_package dotnet-skills)"
agents_package="$(resolve_package dotnet-agents)"
plain_agents_package="$(resolve_package agents)"
skills_version="$(basename "$skills_package")"
skills_version="${skills_version#dotnet-skills.}"
skills_version="${skills_version%.nupkg}"
agents_version="$(basename "$agents_package")"
agents_version="${agents_version#dotnet-agents.}"
agents_version="${agents_version%.nupkg}"
plain_agents_version="$(basename "$plain_agents_package")"
plain_agents_version="${plain_agents_version#agents.}"
plain_agents_version="${plain_agents_version%.nupkg}"
dotnet tool install \
--tool-path "$tool_path" \
--version "$skills_version" \
dotnet-skills \
--add-source "$package_feed"
dotnet tool install \
--tool-path "$tool_path" \
--version "$agents_version" \
dotnet-agents \
--add-source "$package_feed"
dotnet tool install \
--tool-path "$tool_path" \
--version "$plain_agents_version" \
agents \
--add-source "$package_feed"
export PATH="$tool_path:$PATH"
export DOTNET_SKILLS_SKIP_UPDATE_CHECK=1
export DOTNET_AGENTS_SKIP_UPDATE_CHECK=1
export AGENTS_SKIP_UPDATE_CHECK=1
dotnet skills version --no-check > "$skills_path/version.txt"
grep -q "dotnet-skills" "$skills_path/version.txt"
dotnet agents version --no-check > "$skills_path/agents-version.txt"
grep -q "dotnet-agents" "$skills_path/agents-version.txt"
agents version --no-check > "$skills_path/plain-agents-version.txt"
grep -q "agents" "$skills_path/plain-agents-version.txt"
dotnet skills list --available-only --bundled --target "$skills_path" > "$skills_path/available-list.txt"
grep -q "aspire" "$skills_path/available-list.txt"
dotnet skills bundle list --bundled > "$skills_path/bundle-list.txt"
grep -q "quality" "$skills_path/bundle-list.txt"
if grep -Eq '(^|[[:space:]])mcaf([[:space:]]|$)' "$skills_path/bundle-list.txt"; then
echo "MCAF must be a direct skill, not a bundle." >&2
exit 1
fi
dotnet skills install mcaf --bundled --target "$skills_path"
test -f "$skills_path/mcaf/SKILL.md"
dotnet skills remove mcaf --bundled --target "$skills_path"
test ! -e "$skills_path/mcaf"
if dotnet skills install bundle mcaf --bundled --target "$skills_path" >/dev/null 2>&1; then
echo "The removed MCAF bundle unexpectedly installed successfully." >&2
exit 1
fi
dotnet agents list --agent claude --scope project --project-dir "$workspace_path" > "$skills_path/agents-list.txt"
grep -q "router" "$skills_path/agents-list.txt"
dotnet skills install aspire --bundled --target "$skills_path"
test -f "$skills_path/aspire/SKILL.md"
dotnet skills list --local --bundled --target "$skills_path" > "$skills_path/local-list.txt"
grep -q "aspire" "$skills_path/local-list.txt"
dotnet skills remove --all --bundled --target "$skills_path"
test ! -e "$skills_path/aspire"
dotnet skills install bundle orleans --bundled --target "$bundle_path"
test -f "$bundle_path/orleans/SKILL.md"
test -f "$bundle_path/managedcode-orleans-graph/SKILL.md"
test -f "$bundle_path/managedcode-orleans-signalr/SKILL.md"
dotnet skills remove collection distributed --bundled --target "$bundle_path"
test ! -e "$bundle_path/orleans"
test ! -e "$bundle_path/managedcode-orleans-graph"
test ! -e "$bundle_path/managedcode-orleans-signalr"
dotnet skills install aspire --bundled --agent anthropic --scope project --project-dir "$workspace_path"
test -f "$workspace_path/.claude/skills/aspire/SKILL.md"
auto_codex_target="$(dotnet skills where --project-dir "$codex_workspace")"
case "$auto_codex_target" in
*/.codex/skills) ;;
*)
echo "Unexpected auto Codex target: $auto_codex_target" >&2
exit 1
;;
esac
dotnet skills install aspire --bundled --project-dir "$codex_workspace"
test -f "$codex_workspace/.codex/skills/aspire/SKILL.md"
test ! -e "$codex_workspace/.agents"
auto_claude_target="$(dotnet skills where --project-dir "$claude_workspace")"
case "$auto_claude_target" in
*/.claude/skills) ;;
*)
echo "Unexpected auto Claude target: $auto_claude_target" >&2
exit 1
;;
esac
dotnet skills install aspire --bundled --project-dir "$claude_workspace"
test -f "$claude_workspace/.claude/skills/aspire/SKILL.md"
dotnet skills install aspire --bundled --project-dir "$hybrid_workspace"
test -f "$hybrid_workspace/.codex/skills/aspire/SKILL.md"
test -f "$hybrid_workspace/.claude/skills/aspire/SKILL.md"
test ! -e "$hybrid_workspace/.agents"
dotnet skills install aspire --bundled --project-dir "$shared_workspace"
test -f "$shared_workspace/.agents/skills/aspire/SKILL.md"
test ! -e "$shared_workspace/.codex/skills/aspire"
test ! -e "$shared_workspace/.claude/skills/aspire"
auto_plain_target="$(dotnet skills where --project-dir "$plain_workspace")"
case "$auto_plain_target" in
*/.agents/skills) ;;
*)
echo "Unexpected plain fallback target: $auto_plain_target" >&2
exit 1
;;
esac
dotnet skills install aspire --bundled --project-dir "$plain_workspace"
test -f "$plain_workspace/.agents/skills/aspire/SKILL.md"
copilot_project_target="$(dotnet skills where --agent copilot --scope project)"
case "$copilot_project_target" in
*/.github/skills) ;;
*)
echo "Unexpected Copilot project target: $copilot_project_target" >&2
exit 1
;;
esac
gemini_project_target="$(dotnet skills where --agent gemini --scope project)"
case "$gemini_project_target" in
*/.gemini/skills) ;;
*)
echo "Unexpected Gemini project target: $gemini_project_target" >&2
exit 1
;;
esac
auto_gemini_target="$(dotnet skills where --project-dir "$gemini_workspace")"
case "$auto_gemini_target" in
*/.gemini/skills) ;;
*)
echo "Unexpected auto Gemini target: $auto_gemini_target" >&2
exit 1
;;
esac
auto_grok_target="$(dotnet skills where --project-dir "$grok_workspace")"
case "$auto_grok_target" in
*/.grok/skills) ;;
*)
echo "Unexpected auto Grok target: $auto_grok_target" >&2
exit 1
;;
esac
grok_agents_target="$(dotnet agents where --agent grok --scope project --project-dir "$grok_workspace")"
case "$grok_agents_target" in
*/.grok/agents) ;;
*)
echo "Unexpected Grok agents target: $grok_agents_target" >&2
exit 1
;;
esac
configured_skills_target="$(DOTNET_SKILLS_DEFAULT_TARGET=.configured/skills dotnet skills where --scope project --project-dir "$plain_workspace")"
test "$configured_skills_target" = "$plain_workspace/.configured/skills"
configured_agents_target="$(DOTNET_AGENTS_DEFAULT_TARGET=.configured/agents dotnet agents where --scope project --project-dir "$plain_workspace")"
test "$configured_agents_target" = "$plain_workspace/.configured/agents"
configured_plain_agents_target="$(AGENTS_DEFAULT_TARGET=.standalone/agents agents where --scope project --project-dir "$plain_workspace")"
test "$configured_plain_agents_target" = "$plain_workspace/.standalone/agents"
claude_agents_target="$(dotnet agents where --agent claude --scope project --project-dir "$workspace_path")"
case "$claude_agents_target" in
*/.claude/agents) ;;
*)
echo "Unexpected Claude agents target: $claude_agents_target" >&2
exit 1
;;
esac
dotnet agents install router --agent claude --scope project --project-dir "$workspace_path"
test -f "$workspace_path/.claude/agents/dotnet-router.md"
dotnet agents remove router --agent claude --scope project --project-dir "$workspace_path"
test ! -e "$workspace_path/.claude/agents/dotnet-router.md"
auto_agents_target="$(dotnet agents where --project-dir "$hybrid_workspace")"
case "$auto_agents_target" in
*/.codex/agents) ;;
*)
echo "Unexpected auto agents target: $auto_agents_target" >&2
exit 1
;;
esac
dotnet agents install router --auto --scope project --project-dir "$hybrid_workspace"
test -f "$hybrid_workspace/.codex/agents/dotnet-router.toml"
test -f "$hybrid_workspace/.claude/agents/dotnet-router.md"
plain_agents_target="$(agents where --project-dir "$hybrid_workspace")"
case "$plain_agents_target" in
*/.codex/agents) ;;
*)
echo "Unexpected plain agents target: $plain_agents_target" >&2
exit 1
;;
esac
agents install router --agent claude --scope project --project-dir "$workspace_path"
test -f "$workspace_path/.claude/agents/dotnet-router.md"
agents remove router --agent claude --scope project --project-dir "$workspace_path"
test ! -e "$workspace_path/.claude/agents/dotnet-router.md"
dotnet agents install router --scope project --project-dir "$plain_workspace"
test -f "$plain_workspace/.agents/agents/dotnet-router.md"
dotnet agents remove router --scope project --project-dir "$plain_workspace"
test ! -e "$plain_workspace/.agents/agents/dotnet-router.md"
agents install router --target "$plain_workspace/custom-agents"
test -f "$plain_workspace/custom-agents/dotnet-router.md"
agents remove router --target "$plain_workspace/custom-agents"
test ! -e "$plain_workspace/custom-agents/dotnet-router.md"