Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .build/just/index.just
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import "utilities.just"
# pipeline-pr, pipeline-build, pipeline-tests - local runs of the Purview.Build pipeline
import "purview-build.just"

# skills-* - the Purview.BuildSdk agent-skill targets
# skills-* - agent skills through the skills CLI, run by skills.mts (no .NET involved)
import "skills.just"

# Optional. pipeline-pack-validate, pipeline-local-release, pipeline-release - for a repository that
Expand Down
49 changes: 28 additions & 21 deletions .build/just/skills.just
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
# The Purview.BuildSdk agent-skill targets. Each recipe names one target; the behaviour lives there.
# The agent-skill recipes: a thin wrapper over the standard skills CLI (`bun x skills@1` by default).
#
# The targets are a thin wrapper over the standard skills CLI (`bun x skills` by default), run from the
# repository root. Every skill target runs once for the whole solution, however many projects it holds,
# so the recipes name the solution, not a hand-picked project.
# The work is done by skills.mts, beside this file, which needs no .NET at all - no solution to
# evaluate, no restore and no build - so a repository whose build is broken can still install the
# skills that might help fix it. It runs under Bun, then Deno, and falls back to Node with the
# generated skills.mjs. Set PURVIEW_SKILLS_RUNTIME to choose, for example `node`, `bun` or `deno run -A`.
#
# Every recipe here is run by a person, on purpose. Never make one a dependency of build, test or
# default, or call skills-add, -install, -update or -fix from a git hook: they change the repository,
# and the SDK refuses to run them inside a build (PRSKL0009). skills-check is read-only.
# default, or call skills-add, -install, -update or -fix from a git hook: they change the repository.
# skills-check is read-only.
#
# The runner and agents are MSBuild properties (PurviewSkillsRunner, PurviewSkillsAgents), set once in
# Directory.Build.props. Pass a one-off through *args; `dotnet msbuild -p:` splits on `,` and `;`, so
# escape the separator: `just skills-update -p:PurviewSkillsAgents=claude-code%2Ccodex`.
# Settings live in the "Skills" section of .config/purview-build-sdk.json:
#
# { "Skills": { "Agents": ["claude-code", "codex"], "Runner": "bun" } }
#
# Pass a one-off through *args, for example `just skills-update --dry-run --agents claude-code,codex`,
# or set the matching PURVIEW_SKILLS_* environment variable.

skills_script := source_directory() / "skills"

skills_project := solution_file
# Runs skills.mts (or skills.mjs) from the repository root with the given arguments.
_skills_run := 'purview_skills() { if [ -n "${PURVIEW_SKILLS_RUNTIME:-}" ]; then case "$PURVIEW_SKILLS_RUNTIME" in node*) $PURVIEW_SKILLS_RUNTIME "' + skills_script + '.mjs" "$@" ;; *) $PURVIEW_SKILLS_RUNTIME "' + skills_script + '.mts" "$@" ;; esac; elif command -v bun >/dev/null 2>&1; then bun "' + skills_script + '.mts" "$@"; elif command -v deno >/dev/null 2>&1; then deno run -A "' + skills_script + '.mts" "$@"; elif command -v node >/dev/null 2>&1; then node "' + skills_script + '.mjs" "$@"; else echo "error PRSKL0004: the skills recipes need Bun, Deno or Node.js on PATH." >&2; return 1; fi; }; purview_skills'

# Install skills from another repository through the skills CLI (append '#<ref>' to pin it)
#
Expand All @@ -21,32 +28,32 @@ skills_project := solution_file
[group('Agent Skills')]
skills-add source *args:
echo "==> Installing skills from {{ BLUE }}{{ source }}{{ NORMAL }}"
dotnet msbuild "{{ skills_project }}" -t:InstallPurviewSkills -p:PurviewSkillsSource={{ source }} -v:n {{ args }}
{{ _skills_run }} add {{ quote(source) }} --root "{{ justfile_directory() }}" {{ args }}

# Restore every skill skills-lock.json records - how a fresh clone gets the repository's skills back
[group('Agent Skills')]
skills-install *args:
dotnet msbuild "{{ skills_project }}" -t:InstallPurviewSkills -v:n {{ args }}
{{ _skills_run }} install --root "{{ justfile_directory() }}" {{ args }}

# Update the agent skills by re-adding every unique source in skills-lock.json
#
# Each source is re-added at its latest with every skill it has, which refreshes the installed skills
# and adds any a source has gained; `skills update` is never run. FixPurviewSkills then removes links
# from agent directories PurviewSkillsAgents does not select, and does nothing when it is unset.
# The -t: value is quoted because sh would otherwise end the command at the `;`.
# and adds any a source has gained; `skills update` is never run. skills-fix then removes links from
# agent directories Skills.Agents does not select, and does nothing when it is unset.
#
# just skills-update -p:PurviewSkillsDryRun=true
# just skills-update --dry-run
[doc('Update the agent skills by re-adding every unique source in skills-lock.json')]
[group('Agent Skills')]
skills-update *args:
dotnet msbuild "{{ skills_project }}" "-t:UpdatePurviewSkills;FixPurviewSkills" -v:n {{ args }}
{{ _skills_run }} update --root "{{ justfile_directory() }}" {{ args }}
{{ _skills_run }} fix --root "{{ justfile_directory() }}" {{ args }}

# Check that only the skill directories of the agents in PurviewSkillsAgents exist
# Check that only the skill directories of the agents in Skills.Agents exist
[group('Agent Skills')]
skills-check *args:
dotnet msbuild "{{ skills_project }}" -t:CheckPurviewSkills -v:n {{ args }}
{{ _skills_run }} check --root "{{ justfile_directory() }}" {{ args }}

# Remove the skills CLI's links from agent directories PurviewSkillsAgents does not select
# Remove the skills CLI's links from agent directories Skills.Agents does not select
[group('Agent Skills')]
skills-fix *args:
dotnet msbuild "{{ skills_project }}" -t:FixPurviewSkills -v:n {{ args }}
{{ _skills_run }} fix --root "{{ justfile_directory() }}" {{ args }}
Loading
Loading