refactor: share rule skill manifest
This commit is contained in:
1 parent
78667b182f
commit
d308bc037e
10 files changed
+11
-11
No files matched your search
File renamed without changes.
+1
-1
@@ -5,7 +5,7 @@ $root = Split-Path $PSScriptRoot -Parent
|
|||||||
$shared = Join-Path $root 'shared'
|
$shared = Join-Path $root 'shared'
|
||||||
$output = Join-Path $root 'generated'
|
$output = Join-Path $root 'generated'
|
||||||
$pluginManifest = Join-Path $root 'adapters/plugins.tsv'
|
$pluginManifest = Join-Path $root 'adapters/plugins.tsv'
|
||||||
$ruleSkillManifest = Join-Path $root 'adapters/claude/rule-skills.tsv'
|
$ruleSkillManifest = Join-Path $root 'adapters/rule-skills.tsv'
|
||||||
$capabilityManifest = Join-Path $root 'adapters/claude/capabilities.tsv'
|
$capabilityManifest = Join-Path $root 'adapters/claude/capabilities.tsv'
|
||||||
|
|
||||||
if (-not (Test-Path -LiteralPath $pluginManifest)) { throw "Missing plugin manifest: $pluginManifest" }
|
if (-not (Test-Path -LiteralPath $pluginManifest)) { throw "Missing plugin manifest: $pluginManifest" }
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
|
|||||||
shared="$root/shared"
|
shared="$root/shared"
|
||||||
output="$root/generated"
|
output="$root/generated"
|
||||||
plugin_manifest="$root/adapters/plugins.tsv"
|
plugin_manifest="$root/adapters/plugins.tsv"
|
||||||
rule_skill_manifest="$root/adapters/claude/rule-skills.tsv"
|
rule_skill_manifest="$root/adapters/rule-skills.tsv"
|
||||||
capability_manifest="$root/adapters/claude/capabilities.tsv"
|
capability_manifest="$root/adapters/claude/capabilities.tsv"
|
||||||
|
|
||||||
[ -f "$plugin_manifest" ] || { printf 'Missing plugin manifest: %s\n' "$plugin_manifest" >&2; exit 1; }
|
[ -f "$plugin_manifest" ] || { printf 'Missing plugin manifest: %s\n' "$plugin_manifest" >&2; exit 1; }
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ if (Get-Command jq -ErrorAction SilentlyContinue) { Result 'PASS' 'jq available
|
|||||||
|
|
||||||
$sourceAgentCount = @(Get-ChildItem (Join-Path $root 'shared/agents') -Directory -ErrorAction SilentlyContinue).Count
|
$sourceAgentCount = @(Get-ChildItem (Join-Path $root 'shared/agents') -Directory -ErrorAction SilentlyContinue).Count
|
||||||
$sourceSkillCount = @(Get-ChildItem (Join-Path $root 'shared/skills') -Filter 'SKILL.md' -Recurse -ErrorAction SilentlyContinue).Count
|
$sourceSkillCount = @(Get-ChildItem (Join-Path $root 'shared/skills') -Filter 'SKILL.md' -Recurse -ErrorAction SilentlyContinue).Count
|
||||||
$ruleSkillManifestPath = Join-Path $root 'adapters/claude/rule-skills.tsv'
|
$ruleSkillManifestPath = Join-Path $root 'adapters/rule-skills.tsv'
|
||||||
$ruleSkillCount = if (Test-Path -LiteralPath $ruleSkillManifestPath) { @(Import-Csv -LiteralPath $ruleSkillManifestPath -Delimiter ([char]9)).Count } else { 0 }
|
$ruleSkillCount = if (Test-Path -LiteralPath $ruleSkillManifestPath) { @(Import-Csv -LiteralPath $ruleSkillManifestPath -Delimiter ([char]9)).Count } else { 0 }
|
||||||
|
|
||||||
foreach ($shell in @('powershell','bash')) {
|
foreach ($shell in @('powershell','bash')) {
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ command -v jq >/dev/null && result PASS 'jq available for Claude Bash status lin
|
|||||||
|
|
||||||
source_agent_count=$(find "$root/shared/agents" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l)
|
source_agent_count=$(find "$root/shared/agents" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l)
|
||||||
source_skill_count=$(find "$root/shared/skills" -name SKILL.md 2>/dev/null | wc -l)
|
source_skill_count=$(find "$root/shared/skills" -name SKILL.md 2>/dev/null | wc -l)
|
||||||
rule_skill_manifest="$root/adapters/claude/rule-skills.tsv"
|
rule_skill_manifest="$root/adapters/rule-skills.tsv"
|
||||||
rule_skill_count=0
|
rule_skill_count=0
|
||||||
[ -f "$rule_skill_manifest" ] && rule_skill_count=$(($(wc -l < "$rule_skill_manifest") - 1))
|
[ -f "$rule_skill_manifest" ] && rule_skill_count=$(($(wc -l < "$rule_skill_manifest") - 1))
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ function Tokens([int64]$bytes) { return [int][Math]::Ceiling($bytes / 4.0) }
|
|||||||
$claude = (Get-Item (Join-Path $generated 'claude-bash/CLAUDE.md')).Length
|
$claude = (Get-Item (Join-Path $generated 'claude-bash/CLAUDE.md')).Length
|
||||||
$codex = (Get-Item (Join-Path $generated 'codex-bash/AGENTS.md')).Length
|
$codex = (Get-Item (Join-Path $generated 'codex-bash/AGENTS.md')).Length
|
||||||
$skills = Measure-Tree (Join-Path $generated 'claude-bash/skills')
|
$skills = Measure-Tree (Join-Path $generated 'claude-bash/skills')
|
||||||
$triggers = (Get-Item (Join-Path $root 'adapters/claude/rule-skills.tsv')).Length
|
$triggers = (Get-Item (Join-Path $root 'adapters/rule-skills.tsv')).Length
|
||||||
$lazyItem = Get-ChildItem (Join-Path $root 'shared/rules') -File -Recurse | Sort-Object Length -Descending | Select-Object -First 1
|
$lazyItem = Get-ChildItem (Join-Path $root 'shared/rules') -File -Recurse | Sort-Object Length -Descending | Select-Object -First 1
|
||||||
$lazy = if ($lazyItem) { [int64]$lazyItem.Length } else { 0 }
|
$lazy = if ($lazyItem) { [int64]$lazyItem.Length } else { 0 }
|
||||||
$baseline = Join-Path $root 'adapters/prompt-budget-baseline.json'
|
$baseline = Join-Path $root 'adapters/prompt-budget-baseline.json'
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ generated="$root/generated"
|
|||||||
bytes() { wc -c < "$1" | tr -d ' '; }
|
bytes() { wc -c < "$1" | tr -d ' '; }
|
||||||
tree_bytes() { find "$1" -type f -printf '%s\n' 2>/dev/null | awk '{s+=$1} END {print s+0}'; }
|
tree_bytes() { find "$1" -type f -printf '%s\n' 2>/dev/null | awk '{s+=$1} END {print s+0}'; }
|
||||||
tokens() { awk -v b="$1" 'BEGIN { printf "%d", (b + 3) / 4 }'; }
|
tokens() { awk -v b="$1" 'BEGIN { printf "%d", (b + 3) / 4 }'; }
|
||||||
claude=$(bytes "$generated/claude-bash/CLAUDE.md"); codex=$(bytes "$generated/codex-bash/AGENTS.md"); skills=$(tree_bytes "$generated/claude-bash/skills"); triggers=$(bytes "$root/adapters/claude/rule-skills.tsv"); lazy=$(find "$root/shared/rules" -type f -printf '%s %p\n' | sort -nr | awk 'NR==1 {print $1+0}'); fail=false
|
claude=$(bytes "$generated/claude-bash/CLAUDE.md"); codex=$(bytes "$generated/codex-bash/AGENTS.md"); skills=$(tree_bytes "$generated/claude-bash/skills"); triggers=$(bytes "$root/adapters/rule-skills.tsv"); lazy=$(find "$root/shared/rules" -type f -printf '%s %p\n' | sort -nr | awk 'NR==1 {print $1+0}'); fail=false
|
||||||
claude_baseline=0; codex_baseline=0; claude_absolute=0; codex_absolute=0
|
claude_baseline=0; codex_baseline=0; claude_absolute=0; codex_absolute=0
|
||||||
if [ -f "$root/adapters/prompt-budget-baseline.tsv" ]; then
|
if [ -f "$root/adapters/prompt-budget-baseline.tsv" ]; then
|
||||||
while IFS=$'\t' read -r name old absolute; do
|
while IFS=$'\t' read -r name old absolute; do
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ $cacheDir = Join-Path $root '.ai-session'
|
|||||||
$cachePath = Join-Path $cacheDir 'repository-context.json'
|
$cachePath = Join-Path $cacheDir 'repository-context.json'
|
||||||
$safeRoot = $root.Replace('\','/')
|
$safeRoot = $root.Replace('\','/')
|
||||||
$head = (& git -c "safe.directory=$safeRoot" -C $root rev-parse HEAD 2>$null).Trim()
|
$head = (& git -c "safe.directory=$safeRoot" -C $root rev-parse HEAD 2>$null).Trim()
|
||||||
$inputs = @('AI-Instructions.md','adapters/plugins.tsv','adapters/claude/rule-skills.tsv','adapters/claude/capabilities.tsv','adapters/prompt-budget-baseline.json','adapters/prompt-budget-baseline.tsv','adapters/codex/config/config.toml','adapters/claude/config/settings.json')
|
$inputs = @('AI-Instructions.md','adapters/plugins.tsv','adapters/rule-skills.tsv','adapters/claude/capabilities.tsv','adapters/prompt-budget-baseline.json','adapters/prompt-budget-baseline.tsv','adapters/codex/config/config.toml','adapters/claude/config/settings.json')
|
||||||
$inputs += @(Get-ChildItem $root -File -Recurse | Where-Object { $_.FullName -notmatch '\\(generated|\.git|node_modules|bin|obj|vendor|\.ai-session)\\' -and $_.Extension -in @('.sln','.csproj','.fsproj','.ts','.tsx','.json','.toml','.yaml','.yml','.cs','.fs','.py','.sh','.ps1') } | ForEach-Object { $_.FullName.Substring($root.Length + 1) } | Sort-Object)
|
$inputs += @(Get-ChildItem $root -File -Recurse | Where-Object { $_.FullName -notmatch '\\(generated|\.git|node_modules|bin|obj|vendor|\.ai-session)\\' -and $_.Extension -in @('.sln','.csproj','.fsproj','.ts','.tsx','.json','.toml','.yaml','.yml','.cs','.fs','.py','.sh','.ps1') } | ForEach-Object { $_.FullName.Substring($root.Length + 1) } | Sort-Object)
|
||||||
$keyText = $head + "`n" + (($inputs | Sort-Object -Unique | ForEach-Object { $_ + ':' + (Get-FileHash (Join-Path $root $_) -Algorithm SHA256).Hash }) -join "`n")
|
$keyText = $head + "`n" + (($inputs | Sort-Object -Unique | ForEach-Object { $_ + ':' + (Get-FileHash (Join-Path $root $_) -Algorithm SHA256).Hash }) -join "`n")
|
||||||
$key = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($keyText)).TrimEnd('=')
|
$key = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($keyText)).TrimEnd('=')
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ if ($buildSummaryOutput.Count -ne 1) { throw 'Build summary must contain only on
|
|||||||
if ($plainStatusOutput -ne $expectedStatusOutput) { throw 'PowerShell status line output is incorrect.' }
|
if ($plainStatusOutput -ne $expectedStatusOutput) { throw 'PowerShell status line output is incorrect.' }
|
||||||
$sourceAgentCount = @(Get-ChildItem (Join-Path $root 'shared/agents') -Directory).Count
|
$sourceAgentCount = @(Get-ChildItem (Join-Path $root 'shared/agents') -Directory).Count
|
||||||
$sourceSkillCount = @(Get-ChildItem (Join-Path $root 'shared/skills') -Filter 'SKILL.md' -Recurse).Count
|
$sourceSkillCount = @(Get-ChildItem (Join-Path $root 'shared/skills') -Filter 'SKILL.md' -Recurse).Count
|
||||||
$ruleSkillCount = @(Import-Csv -LiteralPath (Join-Path $root 'adapters/claude/rule-skills.tsv') -Delimiter ([char]9)).Count
|
$ruleSkillCount = @(Import-Csv -LiteralPath (Join-Path $root 'adapters/rule-skills.tsv') -Delimiter ([char]9)).Count
|
||||||
foreach ($shell in @('powershell','bash')) {
|
foreach ($shell in @('powershell','bash')) {
|
||||||
foreach ($client in @('codex','claude')) {
|
foreach ($client in @('codex','claude')) {
|
||||||
$package = Join-Path $root "generated/$client-$shell"
|
$package = Join-Path $root "generated/$client-$shell"
|
||||||
$file = if ($client -eq 'codex') { 'config.toml' } else { 'settings.json' }
|
$file = if ($client -eq 'codex') { 'config.toml' } else { 'settings.json' }
|
||||||
$content = Get-Content -LiteralPath (Join-Path $package $file) -Raw
|
$content = Get-Content -LiteralPath (Join-Path $package $file) -Raw
|
||||||
if ($client -eq 'codex') {
|
if ($client -eq 'codex') {
|
||||||
foreach ($entry in @(Import-Csv (Join-Path $root 'adapters/claude/rule-skills.tsv') -Delimiter ([char]9))) {
|
foreach ($entry in @(Import-Csv (Join-Path $root 'adapters/rule-skills.tsv') -Delimiter ([char]9))) {
|
||||||
$rulePath = $entry.rule_file
|
$rulePath = $entry.rule_file
|
||||||
if (Test-Path (Join-Path $root "shared/rules/$($entry.rule_file)") -PathType Container) { $rulePath = "$($entry.rule_file)/index.md" }
|
if (Test-Path (Join-Path $root "shared/rules/$($entry.rule_file)") -PathType Container) { $rulePath = "$($entry.rule_file)/index.md" }
|
||||||
if ((Get-Content (Join-Path $package 'AGENTS.md') -Raw) -notmatch [regex]::Escape("- rules/$rulePath for $($entry.trigger).")) { throw "Codex rule loading is missing $($entry.rule_file) in $package" }
|
if ((Get-Content (Join-Path $package 'AGENTS.md') -Raw) -notmatch [regex]::Escape("- rules/$rulePath for $($entry.trigger).")) { throw "Codex rule loading is missing $($entry.rule_file) in $package" }
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ expected_status_output=$'Test Model \xc2\xb7 Effort high \xc2\xb7 TestRepo @ '"$
|
|||||||
[ "$plain_status_output" = "$expected_status_output" ]
|
[ "$plain_status_output" = "$expected_status_output" ]
|
||||||
source_agent_count=$(find "$root/shared/agents" -mindepth 1 -maxdepth 1 -type d | wc -l)
|
source_agent_count=$(find "$root/shared/agents" -mindepth 1 -maxdepth 1 -type d | wc -l)
|
||||||
source_skill_count=$(find "$root/shared/skills" -name SKILL.md | wc -l)
|
source_skill_count=$(find "$root/shared/skills" -name SKILL.md | wc -l)
|
||||||
rule_skill_count=$(($(wc -l < "$root/adapters/claude/rule-skills.tsv") - 1))
|
rule_skill_count=$(($(wc -l < "$root/adapters/rule-skills.tsv") - 1))
|
||||||
for shell in powershell bash; do
|
for shell in powershell bash; do
|
||||||
for client in codex claude; do
|
for client in codex claude; do
|
||||||
package="$root/generated/$client-$shell"
|
package="$root/generated/$client-$shell"
|
||||||
@@ -38,7 +38,7 @@ for shell in powershell bash; do
|
|||||||
rule_path=$rule_file
|
rule_path=$rule_file
|
||||||
[ -d "$root/shared/rules/$rule_file" ] && rule_path="$rule_file/index.md"
|
[ -d "$root/shared/rules/$rule_file" ] && rule_path="$rule_file/index.md"
|
||||||
grep -Fq -- "- rules/$rule_path for $trigger." "$package/AGENTS.md"
|
grep -Fq -- "- rules/$rule_path for $trigger." "$package/AGENTS.md"
|
||||||
done < "$root/adapters/claude/rule-skills.tsv"
|
done < "$root/adapters/rule-skills.tsv"
|
||||||
fi
|
fi
|
||||||
test "$(find "$package/agents" -type f | wc -l)" -eq "$source_agent_count"
|
test "$(find "$package/agents" -type f | wc -l)" -eq "$source_agent_count"
|
||||||
if [ "$client" = claude ]; then grep -q '^tools: Read,Diff,Search$' "$package/agents/reviewer.md"; fi
|
if [ "$client" = claude ]; then grep -q '^tools: Read,Diff,Search$' "$package/agents/reviewer.md"; fi
|
||||||
|
|||||||
Reference in new issue
Block a user