-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
P2-mediumMedium priorityMedium priorityarea/templateTemplate engine and skeleton filesTemplate engine and skeleton filesbugSomething isn't workingSomething isn't working
Description
Overview
File: lib/src/cli/utils/workflow_generator.dart line 145
The user section regex uses literal \n:
RegExp(r'# --- BEGIN USER: (\S+) ---\n(.*?)# --- END USER: \1 ---', dotAll: true)If a CI file has CRLF line endings (e.g., edited on Windows, or checked out with core.autocrlf=true), the regex won't match \r\n. All user sections are silently discarded and overwritten with empty ones. This is a data-loss bug.
Similarly, the empty-section replacement on line 163 uses \n literally in the pattern string.
Reproduction
sed -i 's/$/\r/' .github/workflows/ci.yaml
dart run runtime_ci_tooling:manage_cicd update --workflows
# All user content vanishesFix
Normalize line endings at the top of _preserveUserSections:
existing = existing.replaceAll('\r\n', '\n');
rendered = rendered.replaceAll('\r\n', '\n');Or use \r?\n in the regex.
Acceptance Criteria
- User sections preserved regardless of line ending style
- Test added with CRLF content
- Warning logged if CRLF detected in input
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2-mediumMedium priorityMedium priorityarea/templateTemplate engine and skeleton filesTemplate engine and skeleton filesbugSomething isn't workingSomething isn't working