Skip to content

Commit 4ef0355

Browse files
committed
feat: improve SKILL.md copy MSBuild target
- Use BeforeTargets="PrepareForBuild" instead of AfterTargets="Build" - Add AGENTS.md-based repo root fallback - Add MakeDir step before Copy to ensure destination exists - Update destination to .agents/skills/cloudactors/
1 parent 72a3685 commit 4ef0355

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/CloudActors.Abstractions.Package/buildTransitive/Devlooped.CloudActors.Abstractions.targets

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
<!--
77
Copies SKILL.md from this package to .agents/skills/cloudactors/ in the consuming repo root.
88
Uses InitializeSourceControlInformation (SourceLink) to locate the repo root.
9-
Falls back to $(SolutionDir) if no git root can be determined.
10-
Silently skips if neither source can be determined.
9+
Falls back to SolutionDir if the git root cannot be determined.
10+
Falls back to the directory containing the nearest AGENTS.md file found above the project file.
11+
Silently skips if the base directory cannot be determined.
1112
Opt-out: set <CloudActorsSkill>false</CloudActorsSkill> in your project or Directory.Build.props.
1213
-->
1314
<Target Name="CopyCloudActorsSkill"
14-
AfterTargets="Build"
15+
BeforeTargets="PrepareForBuild"
1516
DependsOnTargets="InitializeSourceControlInformation"
1617
Condition="'$(CloudActorsSkill)' != 'false'">
1718

@@ -21,10 +22,15 @@
2122

2223
<PropertyGroup>
2324
<_CloudActorsSkillRepoRoot>@(_CloudActorsSkillSourceRoot)</_CloudActorsSkillRepoRoot>
24-
<!-- Fall back to solution directory if no git root was found -->
2525
<_CloudActorsSkillRepoRoot Condition="'$(_CloudActorsSkillRepoRoot)' == '' and '$(SolutionDir)' != '' and '$(SolutionDir)' != '*Undefined*'">$(SolutionDir)</_CloudActorsSkillRepoRoot>
26+
<_CloudActorsSkillAgentsMd Condition="'$(_CloudActorsSkillRepoRoot)' == ''">$([MSBuild]::GetPathOfFileAbove('AGENTS.md', '$(MSBuildProjectDirectory)'))</_CloudActorsSkillAgentsMd>
27+
<_CloudActorsSkillRepoRoot Condition="'$(_CloudActorsSkillRepoRoot)' == '' and '$(_CloudActorsSkillAgentsMd)' != ''">$([System.IO.Path]::GetDirectoryName('$(_CloudActorsSkillAgentsMd)'))\</_CloudActorsSkillRepoRoot>
2628
</PropertyGroup>
2729

30+
<MakeDir Directories="$(_CloudActorsSkillRepoRoot).agents\skills\cloudactors"
31+
Condition="'$(_CloudActorsSkillRepoRoot)' != '' and Exists('$(MSBuildThisFileDirectory)..\skills\cloudactors\SKILL.md')"
32+
ContinueOnError="true" />
33+
2834
<Copy SourceFiles="$(MSBuildThisFileDirectory)..\skills\cloudactors\SKILL.md"
2935
DestinationFiles="$(_CloudActorsSkillRepoRoot).agents\skills\cloudactors\SKILL.md"
3036
SkipUnchangedFiles="true"

0 commit comments

Comments
 (0)