spec-kit icon indicating copy to clipboard operation
spec-kit copied to clipboard

Bug noticed when running scripts/update-agent-context.sh

Open peterson-umoke opened this issue 1 year ago • 6 comments

I have this error when scripts/update-agent-context.sh runs for copilot: scripts/update-agent-context.sh copilot

=== Updating agent context files for feature 001-build-a-secure ===
sed: 1: "s/^**Language\/Version* ...": RE error: repetition-operator operand invalid
sed: 1: "s/^**Primary Dependenci ...": RE error: repetition-operator operand invalid
sed: 1: "s/^**Testing**: //": RE error: repetition-operator operand invalid
sed: 1: "s/^**Storage**: //": RE error: repetition-operator operand invalid
sed: 1: "s/^**Project Type**: //": RE error: repetition-operator operand invalid
Updating GitHub Copilot context file: /<project-path>/.github/copilot-instructions.md
Updating existing GitHub Copilot context file...
scripts/update-agent-context.sh: line 100: bad substitution: no closing "`" in `bash" in content:
            content = re.sub(r'(## Commands\n\`\`\`bash\n).*?(\n\`\`\`)', 
                            f'\\1{new_commands}\\2', content, flags=re.DOTALL)
        else:
            content = re.sub(r'(## Commands\n).*?(\n\n)', 
                            f'\\1{new_commands}\\2', content, flags=re.DOTALL)

# Update recent changes (keep only last 3)
changes_section = re.search(r'## Recent Changes\n(.*?)(\n\n|$)', content, re.DOTALL)
if changes_section:
    changes = changes_section.group(1).strip().split('\n')
    changes.insert(0, f"- $CURRENT_BRANCH: Added $NEW_LANG + $NEW_FRAMEWORK")
    # Keep only last 3
    changes = changes[:3]
    content = re.sub(r'(## Recent Changes\n).*?(\n\n|$)', 
                    f'\\1{chr(10).join(changes)}\\2', content, flags=re.DOTALL)

# Update date
content = re.sub(r'Last updated: \d{4}-\d{2}-\d{2}', 
                f'Last updated: {datetime.now().strftime("%Y-%m-%d")}', content)

# Write to temp file
with open("$temp_file", 'w') as f:
    f.write(content)

peterson-umoke avatar Sep 06 '25 22:09 peterson-umoke

But if you run it with claude code, there is no error, script works flawlessly

peterson-umoke avatar Sep 06 '25 22:09 peterson-umoke

#55

MDfly7 avatar Sep 07 '25 11:09 MDfly7

Image

Same for me

npupko avatar Sep 10 '25 09:09 npupko

I had a similar problem: scripts/update-agent-context.sh copilot === Updating agent context files for feature 001-provider-connectivity-errors === sed: -e expression #1, char 28: Invalid preceding regular expression sed: -e expression #1, char 31: Invalid preceding regular expression sed: -e expression #1, char 18: Invalid preceding regular expression sed: -e expression #1, char 18: Invalid preceding regular expression sed: -e expression #1, char 23: Invalid preceding regular expression

I am on macOS, and I was script was launched by Copilot in VSCode

efe-mumoglu avatar Sep 10 '25 12:09 efe-mumoglu

● Bash(scripts/update-agent-context.sh claude) ⎿  Error: sed: -e expression #1, char 28: Invalid preceding regular expression sed: -e expression #1, char 31: Invalid preceding regular expression sed: -e expression #1, char 18: Invalid preceding regular expression sed: -e expression #1, char 18: Invalid preceding regular expression sed: -e expression #1, char 23: Invalid preceding regular expression scripts/update-agent-context.sh: line 100: bad substitution: no closing "" in bash" in content: content = re.sub(r'(## Commands\n```bash\n).?(\n```)', f'\1{new_commands}\2', content, flags=re.DOTALL) else: content = re.sub(r'(## Commands\n).?(\n\n)',

amondnet avatar Sep 11 '25 01:09 amondnet

This should now be fixed. Thank you for the report!

localden avatar Sep 22 '25 17:09 localden