Skip to content

Add agentic workflow code-simplifier#34058

Merged
valentinpalkovic merged 3 commits into
nextfrom
add-workflow-code-simplifier-8402
Mar 7, 2026
Merged

Add agentic workflow code-simplifier#34058
valentinpalkovic merged 3 commits into
nextfrom
add-workflow-code-simplifier-8402

Conversation

@valentinpalkovic
Copy link
Copy Markdown
Contributor

@valentinpalkovic valentinpalkovic commented Mar 7, 2026

Add agentic workflow code-simplifier

Summary by CodeRabbit

  • New Features

    • Added an automated daily "Code Simplifier" workflow that analyzes recent changes across multiple languages and can create PRs to improve readability and maintainability.
  • Documentation

    • Added guidance for the Code Simplifier workflow and a standardized report format for workflow outputs.
  • Chores

    • Broadened repository text-file attributes and updated workflow metadata for consistency.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 7, 2026

Fails
🚫 PR title must be in the format of "Area: Summary", With both Area and Summary starting with a capital letter Good examples: - "Docs: Describe Canvas Doc Block" - "Svelte: Support Svelte v4" Bad examples: - "add new api docs" - "fix: Svelte 4 support" - "Vue: improve docs"
🚫 PR description is missing the mandatory "#### Manual testing" section. Please add it so that reviewers know how to manually test your changes.

Generated by 🚫 dangerJS against bd8ec13

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 7, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 216f34d7-ac34-4bf5-8f40-b3d4de366ae9

📥 Commits

Reviewing files that changed from the base of the PR and between 40325a8 and bd8ec13.

📒 Files selected for processing (1)
  • .github/workflows/code-simplifier.lock.yml

📝 Walkthrough

Walkthrough

Adds a new Code Simplifier GitHub Actions workflow and accompanying documentation, shared workflow docs, and a small .gitattributes tweak marking workflow lock files as linguist-generated.

Changes

Cohort / File(s) Summary
Git attributes
/.gitattributes
Minor update to attributes; marks .github/workflows/*.lock.yml as linguist-generated with merge=ours.
Code Simplifier workflow (primary)
.github/workflows/code-simplifier.lock.yml
New large workflow implementing activation/prechecks, Copilot-agent execution, prompt interpolation, allowed-tools whitelisting, log redaction, artifact handling, safe-outputs orchestration, optional threat detection, and multi-path result aggregation.
Code Simplifier workflow (docs/manifest)
.github/workflows/code-simplifier.md
New workflow manifest and embedded agent prompt describing scheduled runs, scope/exit criteria, language targets, validation steps, and standardized PR output format for safe-outputs-driven PR creation.
Shared workflow docs
.github/workflows/shared/mood.md, .github/workflows/shared/reporting.md
Added a small mood marker file and a reporting guidelines doc defining report structure, header rules, progressive disclosure patterns, and formatting examples.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Scheduler as GitHub Scheduler
  participant Runner as Actions Runner
  participant Repo as Repository
  participant Agent as Copilot CLI Agent
  participant Safe as Safe-Outputs MCP
  participant Detector as Threat Detector
  participant Artifacts as Artifact Store

  Scheduler->>Runner: trigger workflow
  Runner->>Repo: checkout code & fetch metadata
  Runner->>Runner: run pre-activation checks
  alt activation allowed
    Runner->>Agent: interpolate prompts & run Copilot CLI
    Agent->>Repo: read changed files
    Agent->>Artifacts: upload logs & interim outputs
    Runner->>Safe: configure/start MCP server
    Safe->>Artifacts: store safe outputs & PR payload
    opt threat detection enabled
      Runner->>Detector: run threat analysis on outputs
      Detector->>Artifacts: upload detection results
    end
    Runner->>Repo: create/update PR via safe-outputs or record no-op
  else skipped
    Runner->>Repo: record skipped run
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
.github/workflows/code-simplifier.md (4)

84-88: Add language specifier to fenced code block.

Static analysis flagged this code block as missing a language specifier. Since this represents plain text output, consider adding text or plaintext as the language.

📝 Suggested fix
-```
+```text
 ✅ No code changes detected in the last 24 hours.
 Code simplifier has nothing to process today.
-```
+```
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/code-simplifier.md around lines 84 - 88, The fenced code
block is missing a language specifier; update the block so the opening fence
includes a plaintext language (e.g., change ``` to ```text or ```plaintext)
around the output lines ("✅ No code changes detected..." and "Code simplifier
has nothing to process today.") so static analysis recognizes it as plain text.

386-395: Add language specifiers to output requirement code blocks.

These code blocks representing agent output messages should have language specifiers for consistency.

📝 Suggested fix
 1. **If no changes in last 24 hours**:
-   ```
+   ```text
    ✅ No code changes detected in the last 24 hours.
    Code simplifier has nothing to process today.
    ```

 2. **If no simplifications beneficial**:
-   ```
+   ```text
    ✅ Code analyzed from last 24 hours.
    No simplifications needed - code already meets quality standards.
    ```
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/code-simplifier.md around lines 386 - 395, Update the two
agent-output code blocks so they include an explicit language specifier "text";
locate the plain triple-backtick blocks containing the messages "✅ No code
changes detected in the last 24 hours..." and "✅ Code analyzed from last 24
hours..." and change the opening fences to ```text so both blocks are tagged
consistently.

259-262: Hardcoded filename in Python build check example.

The Python build verification uses a hardcoded filename changed_files.py, which doesn't align with the dynamic file discovery approach used elsewhere in the workflow. Consider using a placeholder or explaining this is an example pattern.

📝 Suggested fix
 # For Python projects
 # (typically no build step, but check imports)
-python -m py_compile changed_files.py
+python -m py_compile <changed_file.py>

Or use a loop pattern:

# For Python projects
for f in $(git diff --name-only HEAD~1 -- '*.py'); do
  python -m py_compile "$f"
done
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/code-simplifier.md around lines 259 - 262, The example in
.github/workflows/code-simplifier.md uses a hardcoded filename
"changed_files.py" for the Python build check; change the example to avoid a
fixed filename by either using a placeholder (e.g., "<python_file>") or
demonstrating the dynamic pattern used elsewhere (iterate over changed .py files
and run python -m py_compile on each). Update the Python section so the snippet
references the dynamic discovery approach rather than the literal
"changed_files.py", and ensure the text explains it is an example pattern to be
adapted for real repos.

280-284: Add language specifier to fenced code block.

Similar to the earlier block, this plain text output block should have a language specifier.

📝 Suggested fix
-```
+```text
 ✅ Code analyzed from last 24 hours.
 No simplifications needed - code already meets quality standards.
-```
+```
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/code-simplifier.md around lines 280 - 284, The fenced code
block containing "✅ Code analyzed from last 24 hours. No simplifications needed
- code already meets quality standards." should include a language specifier;
update the opening triple-backtick from ``` to ```text so the block becomes
```text ... ``` to explicitly mark it as plain text (leave the content unchanged
and keep the closing ```).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.gitattributes:
- Line 2: The global rule "* -text" in .gitattributes disables Git's EOL
normalization for every file; either add a clear comment above that line
explaining why global disabling is required (e.g., repository contains mixed
binary/generated files that must preserve native line endings) or replace the
broad rule with targeted patterns (e.g., list specific binary or generated file
globs such as *.png, *.jar, build/**, generated/** with "-text") so only those
file types are excluded from normalization; update the single "* -text" entry
accordingly and include a short rationale comment if you decide to keep a global
rule.

---

Nitpick comments:
In @.github/workflows/code-simplifier.md:
- Around line 84-88: The fenced code block is missing a language specifier;
update the block so the opening fence includes a plaintext language (e.g.,
change ``` to ```text or ```plaintext) around the output lines ("✅ No code
changes detected..." and "Code simplifier has nothing to process today.") so
static analysis recognizes it as plain text.
- Around line 386-395: Update the two agent-output code blocks so they include
an explicit language specifier "text"; locate the plain triple-backtick blocks
containing the messages "✅ No code changes detected in the last 24 hours..." and
"✅ Code analyzed from last 24 hours..." and change the opening fences to ```text
so both blocks are tagged consistently.
- Around line 259-262: The example in .github/workflows/code-simplifier.md uses
a hardcoded filename "changed_files.py" for the Python build check; change the
example to avoid a fixed filename by either using a placeholder (e.g.,
"<python_file>") or demonstrating the dynamic pattern used elsewhere (iterate
over changed .py files and run python -m py_compile on each). Update the Python
section so the snippet references the dynamic discovery approach rather than the
literal "changed_files.py", and ensure the text explains it is an example
pattern to be adapted for real repos.
- Around line 280-284: The fenced code block containing "✅ Code analyzed from
last 24 hours. No simplifications needed - code already meets quality
standards." should include a language specifier; update the opening
triple-backtick from ``` to ```text so the block becomes ```text ... ``` to
explicitly mark it as plain text (leave the content unchanged and keep the
closing ```).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0f398426-2cd7-4e51-a1ea-ebcfcf5f064c

📥 Commits

Reviewing files that changed from the base of the PR and between 90721f5 and 555b135.

📒 Files selected for processing (5)
  • .gitattributes
  • .github/workflows/code-simplifier.lock.yml
  • .github/workflows/code-simplifier.md
  • .github/workflows/shared/mood.md
  • .github/workflows/shared/reporting.md

Comment thread .gitattributes
@@ -1,2 +1,4 @@
/**/.yarn/** linguist-generated
* -text No newline at end of file
* -text
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if there was a previous .gitattributes rule and what it covered
git log -p --follow -1 -- .gitattributes 2>/dev/null | head -50 || echo "No git history available"

# Check for other text-related gitattributes in the repo
cat .gitattributes 2>/dev/null

Repository: storybookjs/storybook

Length of output: 169


Justify the global * -text setting or use more targeted patterns.

The * -text rule disables Git's automatic line ending normalization for all files in the repository. This is a broad setting that could cause inconsistent line endings across different operating systems (Windows vs. Linux/macOS) for contributors.

If this is intentional, add a comment explaining the rationale. If it's meant to apply only to specific file types (e.g., binary files or generated workflows), replace it with more targeted patterns instead.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.gitattributes at line 2, The global rule "* -text" in .gitattributes
disables Git's EOL normalization for every file; either add a clear comment
above that line explaining why global disabling is required (e.g., repository
contains mixed binary/generated files that must preserve native line endings) or
replace the broad rule with targeted patterns (e.g., list specific binary or
generated file globs such as *.png, *.jar, build/**, generated/** with "-text")
so only those file types are excluded from normalization; update the single "*
-text" entry accordingly and include a short rationale comment if you decide to
keep a global rule.

@valentinpalkovic valentinpalkovic self-assigned this Mar 7, 2026
@valentinpalkovic valentinpalkovic added build Internal-facing build tooling & test updates ci:normal labels Mar 7, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Mar 7, 2026

View your CI Pipeline Execution ↗ for commit bd8ec13

Command Status Duration Result
nx run-many -t compile,check,knip,test,pretty-d... ❌ Failed 6m 42s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-07 19:45:54 UTC

@valentinpalkovic valentinpalkovic merged commit e68b5f8 into next Mar 7, 2026
15 of 24 checks passed
@valentinpalkovic valentinpalkovic deleted the add-workflow-code-simplifier-8402 branch March 7, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Internal-facing build tooling & test updates ci:normal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant