feat(build): add compact summary mode
This commit is contained in:
1 parent
1355cbe3cd
commit
ab3007cf48
2 files changed
+16
-18
No files matched your search
+5
-9
@@ -79,7 +79,7 @@ function Test-CodexSchema($configPath) {
|
||||
}
|
||||
}
|
||||
|
||||
& (Join-Path $root 'shared/hooks/scripts/Test-SessionConfig.ps1') -RepositoryRoot $root
|
||||
& (Join-Path $root 'shared/hooks/scripts/Test-SessionConfig.ps1') -RepositoryRoot $root | Where-Object { -not $Summary -or $_ -ne 'PASS session configuration' }
|
||||
|
||||
$sourceAgentDirs = @(Get-ChildItem (Join-Path $shared 'agents') -Directory | Sort-Object Name)
|
||||
if ($sourceAgentDirs.Count -eq 0) { throw 'No agents found under shared/agents.' }
|
||||
@@ -119,7 +119,7 @@ Load rule files when their subject applies:
|
||||
- rules/git.md for Git operations.
|
||||
- rules/refactoring.md for refactoring work.
|
||||
- rules/definition-of-done.md when validating completion.
|
||||
- rules/decision-rule.md when requirements, behavior, or technical choices need to be evaluated.
|
||||
- rules/decision-rule.md when requirements are unresolved, behavior is ambiguous, or a meaningful technical choice remains.
|
||||
'@
|
||||
|
||||
foreach ($platform in @('windows','linux')) {
|
||||
@@ -132,12 +132,8 @@ foreach ($platform in @('windows','linux')) {
|
||||
Copy-Directory (Join-Path $shared 'hooks') (Join-Path $output "claude-$platform/hooks")
|
||||
Copy-Directory (Join-Path $shared 'statusline') (Join-Path $output "claude-$platform/statusline")
|
||||
|
||||
# Claude: general.md stays a plain, always-applied rule file. Every technology- or
|
||||
# situation-specific rule becomes a skill instead, so only its name and description
|
||||
# sit permanently in context; the full text loads only when the skill is invoked.
|
||||
$claudeRulesDir = Join-Path $output "claude-$platform/rules"
|
||||
New-Item $claudeRulesDir -ItemType Directory -Force | Out-Null
|
||||
Copy-Item (Join-Path $shared 'rules/general.md') (Join-Path $claudeRulesDir 'general.md') -Force
|
||||
|
||||
$claudeRuleSkillLines = @()
|
||||
foreach ($entry in $ruleSkillEntries) {
|
||||
@@ -147,7 +143,7 @@ foreach ($platform in @('windows','linux')) {
|
||||
$skillDir = Join-Path $output "claude-$platform/skills/rules/$($entry.skill_name)"
|
||||
New-Item $skillDir -ItemType Directory -Force | Out-Null
|
||||
$ruleContent = Get-Content $ruleBodyPath -Raw
|
||||
$skillBody = "---`r`nname: $($entry.skill_name)`r`ndescription: Use for $($entry.trigger).`r`n---`r`n`r`n$ruleContent"
|
||||
$skillBody = "---`r`nname: $($entry.skill_name)`r`ndescription: $(Quote-Toml "Use for $($entry.trigger).")`r`n---`r`n`r`n$ruleContent"
|
||||
Set-Content (Join-Path $skillDir 'SKILL.md') $skillBody -Encoding UTF8
|
||||
if ($isDirectory) {
|
||||
$referencesSource = Join-Path $ruleSourcePath 'references'
|
||||
@@ -155,7 +151,7 @@ foreach ($platform in @('windows','linux')) {
|
||||
}
|
||||
$claudeRuleSkillLines += "- $($entry.skill_name) for $($entry.trigger)."
|
||||
}
|
||||
$claudeRuleLoading = "Always apply ``rules/general.md`` before starting any task, embedded below.`r`n`r`nDetect the languages, frameworks, tools, and change areas from the repository and the requested work. Invoke every matching rule skill before editing. Invoke all matching rule skills when multiple technologies apply.`r`n`r`nInvoke rule skills when their subject applies:`r`n`r`n" + ($claudeRuleSkillLines -join "`r`n")
|
||||
$claudeRuleLoading = "General rules are embedded below.`r`n`r`nDetect the languages, frameworks, tools, and change areas from the repository and the requested work. Invoke every matching rule skill before editing. Invoke all matching rule skills when multiple technologies apply.`r`n`r`nInvoke rule skills when their subject applies:`r`n`r`n" + ($claudeRuleSkillLines -join "`r`n")
|
||||
|
||||
$sharedTemplate = Get-Content (Join-Path $shared 'global-instructions.md') -Raw
|
||||
$generalContent = Get-Content (Join-Path $shared 'rules/general.md') -Raw
|
||||
@@ -214,5 +210,5 @@ $leftoverPlaceholders = @(Get-ChildItem $output -File -Recurse | ForEach-Object
|
||||
})
|
||||
if ($leftoverPlaceholders.Count) { throw "Unresolved template placeholders in: $($leftoverPlaceholders -join ', ')" }
|
||||
|
||||
Write-Output 'PASS build: codex-windows, claude-windows, codex-linux, claude-linux'
|
||||
if ($Summary) { Write-Output 'Build: PASS | 4 packages' } else { Write-Output 'PASS build: codex-windows, claude-windows, codex-linux, claude-linux' }
|
||||
exit 0
|
||||
+11
-9
@@ -34,6 +34,7 @@ rule_skill_files=()
|
||||
rule_skill_names=()
|
||||
rule_skill_triggers=()
|
||||
while IFS=$'\t' read -r rule_file skill_name trigger; do
|
||||
trigger=${trigger%$'\r'}
|
||||
[ "$rule_file" != rule_file ] || continue
|
||||
[ -n "$rule_file" ] || continue
|
||||
[ -n "$skill_name" ] || { printf 'Missing skill_name in rule-skill manifest row for %s.\n' "$rule_file" >&2; exit 1; }
|
||||
@@ -69,7 +70,12 @@ quote_toml() {
|
||||
printf '"%s"' "$value"
|
||||
}
|
||||
|
||||
bash "$shared/hooks/scripts/test-session-config.sh" "$root"
|
||||
session_output=$(bash "$shared/hooks/scripts/test-session-config.sh" "$root") || { printf '%s\n' "$session_output" >&2; exit 1; }
|
||||
if [ "$summary" = true ]; then
|
||||
printf '%s\n' "$session_output" | sed '/^PASS session configuration$/d'
|
||||
else
|
||||
printf '%s\n' "$session_output"
|
||||
fi
|
||||
rm -rf -- "$output"
|
||||
|
||||
agent_dirs=("$shared"/agents/*/)
|
||||
@@ -109,7 +115,7 @@ Load rule files when their subject applies:
|
||||
- rules/git.md for Git operations.
|
||||
- rules/refactoring.md for refactoring work.
|
||||
- rules/definition-of-done.md when validating completion.
|
||||
- rules/decision-rule.md when requirements, behavior, or technical choices need to be evaluated.
|
||||
- rules/decision-rule.md when requirements are unresolved, behavior is ambiguous, or a meaningful technical choice remains.
|
||||
BLOCK
|
||||
|
||||
for platform in windows linux; do
|
||||
@@ -121,11 +127,7 @@ copy_directory "$shared/hooks" "$output/codex-$platform/hooks"
|
||||
copy_directory "$shared/hooks" "$output/claude-$platform/hooks"
|
||||
copy_directory "$shared/statusline" "$output/claude-$platform/statusline"
|
||||
|
||||
# Claude: general.md stays a plain, always-applied rule file. Every technology- or
|
||||
# situation-specific rule becomes a skill instead, so only its name and description
|
||||
# sit permanently in context; the full text loads only when the skill is invoked.
|
||||
mkdir -p "$output/claude-$platform/rules"
|
||||
cp "$shared/rules/general.md" "$output/claude-$platform/rules/general.md"
|
||||
|
||||
claude_rule_loading_list=""
|
||||
for i in "${!rule_skill_names[@]}"; do
|
||||
@@ -137,14 +139,14 @@ for i in "${!rule_skill_names[@]}"; do
|
||||
[ -d "$rule_source" ] && rule_body="$rule_source/index.md"
|
||||
skill_dir="$output/claude-$platform/skills/rules/$skill_name"
|
||||
mkdir -p "$skill_dir"
|
||||
{ printf -- '---\nname: %s\ndescription: Use for %s.\n---\n\n' "$skill_name" "$trigger"; cat "$rule_body"; } > "$skill_dir/SKILL.md"
|
||||
{ printf -- '---\nname: %s\ndescription: %s\n---\n\n' "$skill_name" "$(quote_toml "Use for $trigger.")"; cat "$rule_body"; } > "$skill_dir/SKILL.md"
|
||||
if [ -d "$rule_source/references" ]; then
|
||||
copy_directory "$rule_source/references" "$skill_dir/references"
|
||||
fi
|
||||
claude_rule_loading_list="${claude_rule_loading_list}- ${skill_name} for ${trigger}.
|
||||
"
|
||||
done
|
||||
claude_rule_loading="Always apply \`rules/general.md\` before starting any task, embedded below.
|
||||
claude_rule_loading="General rules are embedded below.
|
||||
|
||||
Detect the languages, frameworks, tools, and change areas from the repository and the requested work. Invoke every matching rule skill before editing. Invoke all matching rule skills when multiple technologies apply.
|
||||
|
||||
@@ -228,4 +230,4 @@ if [ -n "$leftover_tokens" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf 'PASS build: codex-windows, claude-windows, codex-linux, claude-linux\n'
|
||||
if [ "$summary" = true ]; then printf 'Build: PASS | 4 packages\n'; else printf 'PASS build: codex-windows, claude-windows, codex-linux, claude-linux\n'; fi
|
||||
Reference in new issue
Block a user