mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
[ai] Normalize line endings by Codex on Windows.
This commit is contained in:
@@ -6,6 +6,7 @@ Use these templates as Codex subagent messages or, if delegation is unavailable,
|
||||
|
||||
- Phase 0 runs in the main session.
|
||||
- For Phases 1 through 6, prefer a fresh subagent per phase to keep phase context isolated.
|
||||
- Phase 7 runs in the main session on Windows because it depends on the final local diff and touched-file set.
|
||||
- Write each phase prompt to `.ai/<PROJECT>/<LETTER>/logs/phase-<name>.prompt.md` before execution.
|
||||
- If you delegate a phase, send the prompt file contents as the initial `spawn_agent` message.
|
||||
- After each phase completes, write `.ai/<PROJECT>/<LETTER>/logs/phase-<name>.result.md` summarizing the status, files touched, and any follow-up notes.
|
||||
@@ -327,7 +328,7 @@ LOOP:
|
||||
|
||||
FINISH:
|
||||
- Update plan.md: change `- [ ] Code review` to `- [x] Code review`
|
||||
- Proceed to Completion
|
||||
- Proceed to Phase 7 on Windows, otherwise proceed to Completion
|
||||
```
|
||||
|
||||
### Step 6a: Code Review
|
||||
@@ -415,15 +416,53 @@ After all changes are made:
|
||||
When finished, report what changes were made and which files you touched.
|
||||
```
|
||||
|
||||
## Phase 7: Windows Line Ending Normalization
|
||||
|
||||
Run this phase only on Windows hosts and only after the review loop has finished.
|
||||
|
||||
Use the current task's result logs as the source of truth for what Codex touched. Do not sweep the whole repo and do not rewrite unrelated files from a dirty worktree.
|
||||
|
||||
```text
|
||||
You are performing the final Windows-only line ending normalization phase for task-think.
|
||||
|
||||
Read these files:
|
||||
- .ai/<PROJECT>/<LETTER>/plan.md
|
||||
- .ai/<PROJECT>/<LETTER>/logs/phase-4*.result.md
|
||||
- .ai/<PROJECT>/<LETTER>/logs/phase-5*.result.md
|
||||
- .ai/<PROJECT>/<LETTER>/logs/phase-6*.result.md
|
||||
|
||||
Your job:
|
||||
- Collect the union of repo file paths listed under "Touched files" in those result logs.
|
||||
- Keep only files inside the repository that currently exist and are textual project files: source, headers, build/config files, localization files, style files, and similar text assets.
|
||||
- Exclude `.ai/`, `out/`, binary files, and unrelated user files that were not touched by Codex in this task.
|
||||
- Rewrite each kept file so all line endings are CRLF.
|
||||
- Preserve file content otherwise. Preserve whether the file ended with a trailing newline.
|
||||
|
||||
Rules:
|
||||
- Run this phase in the main session on Windows.
|
||||
- Do not modify files outside the touched-file set for the current task.
|
||||
- Do not rewrite binary files.
|
||||
- If a file cannot be normalized safely, record it as a failure instead of silently skipping it.
|
||||
|
||||
When finished:
|
||||
1. Write `.ai/<PROJECT>/<LETTER>/logs/phase-7-line-endings.result.md`
|
||||
2. Include:
|
||||
- whether the phase completed
|
||||
- which files were normalized
|
||||
- which files were skipped and why
|
||||
- any failures that need to be mentioned in the final summary
|
||||
```
|
||||
|
||||
## Completion
|
||||
|
||||
When all phases, including build verification and code review, are done:
|
||||
When all phases, including build verification, code review, and Windows line ending normalization when applicable, are done:
|
||||
1. Read the final `plan.md` and report the summary to the user.
|
||||
2. Show which files were modified or created.
|
||||
3. Note any issues encountered during implementation.
|
||||
4. Summarize the code review iterations: how many rounds, what was found and fixed, or whether it was approved on the first pass.
|
||||
5. Calculate and display the total elapsed time since `$START_TIME` (format as `Xh Ym Zs`, omitting zero components).
|
||||
6. Remind the user of the project name so they can request follow-up tasks within the same project.
|
||||
5. On Windows, mention the line-ending normalization result briefly: which project files were normalized or whether nothing needed changes.
|
||||
6. Calculate and display the total elapsed time since `$START_TIME` (format as `Xh Ym Zs`, omitting zero components).
|
||||
7. Remind the user of the project name so they can request follow-up tasks within the same project.
|
||||
|
||||
## Error Handling
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ Run these phases sequentially:
|
||||
5. Phase 4: Implementation - Execute one implementation unit per plan phase.
|
||||
6. Phase 5: Build Verification - Build the project, fix any build errors. Skip if no source code was modified.
|
||||
7. Phase 6: Code Review Loop - Run review and fix iterations until approved or the iteration limit is reached.
|
||||
8. Phase 7: Windows Line Ending Normalization - On Windows only, after review passes and before the final summary, normalize LF to CRLF for the text source/config files Codex edited in this task.
|
||||
|
||||
Use the phase prompt templates in `PROMPTS.md`.
|
||||
|
||||
@@ -78,6 +79,7 @@ Use the phase prompt templates in `PROMPTS.md`.
|
||||
Use Codex subagents as the primary orchestration mechanism.
|
||||
|
||||
- Spawn a fresh subagent for context gathering, planning, plan assessment, each implementation phase, and each review or review-fix pass when delegation is available.
|
||||
- Run Phase 7 in the main session on Windows because it depends on the final local file state and the exact touched-file set for the current task.
|
||||
- Prefer `worker` for phases that write files. Use `explorer` only for narrow read-only questions that unblock your next local step.
|
||||
- Keep `fork_context` off by default. Pass the phase prompt and explicit file paths instead of the whole thread unless the phase truly needs prior conversational context or thread-only attachments.
|
||||
- When the platform supports it, request `model: gpt-5.4` and `reasoning_effort: xhigh` for spawned phase agents. If overrides are unavailable, inherit the current session settings.
|
||||
@@ -94,6 +96,7 @@ Use Codex subagents as the primary orchestration mechanism.
|
||||
- implemented code changes present
|
||||
- build attempt results recorded
|
||||
- review pass documented with any follow-up fixes
|
||||
- on Windows, if the task edited project source/config text files, a line-ending normalization pass recorded after review
|
||||
|
||||
## Completion Criteria
|
||||
|
||||
@@ -101,6 +104,7 @@ Mark complete only when:
|
||||
- All plan phases are done
|
||||
- Build verification is recorded
|
||||
- Review issues are addressed or explicitly deferred with rationale
|
||||
- On Windows, Codex-edited project source/config text files have been normalized to CRLF and the result is logged
|
||||
- Display total elapsed time since start (format: `Xh Ym Zs`, omitting zero components)
|
||||
- Remind the user of the project name so they can request follow-up tasks within the same project
|
||||
|
||||
@@ -110,6 +114,7 @@ Mark complete only when:
|
||||
- If `context.md` or `plan.md` is not written properly by a phase, rerun that phase with more specific instructions.
|
||||
- If build errors persist after the build phase's attempts, report the remaining errors to the user.
|
||||
- If a review-fix phase introduces new build errors that it cannot resolve, report to the user.
|
||||
- If Phase 7 cannot safely normalize a touched file on Windows, record the failure in the result log and report it in the final summary instead of silently skipping it.
|
||||
|
||||
## User Invocation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user