Skip to content

Add jsweep daily workflow for automated JavaScript cleanup#6854

Merged
pelikhan merged 4 commits into
mainfrom
copilot/clean-cjs-files-daily
Dec 18, 2025
Merged

Add jsweep daily workflow for automated JavaScript cleanup#6854
pelikhan merged 4 commits into
mainfrom
copilot/clean-cjs-files-daily

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 18, 2025

Creates a scheduled agent that cleans one .cjs file per day from pkg/workflow/js/, focusing on modernization and removing code bloat.

Workflow Configuration

  • Schedule: Daily (fuzzy scheduled)
  • Engine: Copilot (default model)
  • Tools: serena (TypeScript/JavaScript), github (read-only), edit, bash, cache-memory
  • Scope: 154 non-test .cjs files in rotation

Agent Capabilities

The agent is an expert at:

  • Context detection (github-script vs Node.js execution)
  • Removing unnecessary try/catch blocks that don't handle control flow
  • Applying ES6+ patterns: spread operators, map, reduce, arrow functions, optional chaining (?.)
  • Increasing test coverage during cleanup
  • Logic preservation while improving clarity
  • Static code analysis using serena for better code understanding

Pull Request Automation

  • Title prefix: [jsweep]
  • Labels: unbloat, automation
  • Non-draft PRs for immediate review
  • Tracking via jsweep-daily tracker-id

Example Cleanup Patterns

// Remove unnecessary try/catch
- try { return await op(); } catch (e) { throw e; }
+ return await op();

// Modern JavaScript
- const items = []; for (let i = 0; i < arr.length; i++) items.push(arr[i].name);
+ const items = arr.map(item => item.name);

- const value = obj && obj.prop && obj.prop.value;
+ const value = obj?.prop?.value;

Cache-memory tracks cleaned files with timestamps to ensure systematic coverage without duplication.

Custom agent used: create-agentic-workflow
Design agentic workflows using GitHub Agentic Workflows (gh-aw) extension with interactive guidance on triggers, tools, and security best practices.

Custom agent used: create-agentic-workflow
Design agentic workflows using GitHub Agentic Workflows (gh-aw) extension with interactive guidance on triggers, tools, and security best practices.

Original prompt

Create a JavaScript unbloater daily agent that focuses on cleaning one .cjs file per day. Call it jsweep"

The agent is an expert at creating and maintaining solid, simple JavaScript (commonjs)

  • use cache and timestamps to find the next .cjs to cleanup

Principals:

  • determines if the file runs in github-script context or node.js context. Expert in actions/github-script
  • always increase testing when cleaning
  • remove try/catch unless the exception is handled with control flow. Let errors bubble up otherwise.
  • leverage spread operators, map, reduce, lambda syntax, ?. operator
  • do not change logic, just cleaner leaner code

Provides a pull request with label "unbloat" and title "[jsweep] "

Custom agent used: create-agentic-workflow
Design agentic workflows using GitHub Agentic Workflows (gh-aw) extension with interactive guidance on triggers, tools, and security best practices.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add jsweep daily .cjs file cleaner Add jsweep daily workflow for automated JavaScript cleanup Dec 18, 2025
Copilot AI requested a review from pelikhan December 18, 2025 13:04
Comment thread .github/workflows/jsweep.md Outdated
tracker-id: jsweep-daily
engine:
id: copilot
model: gpt-5
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot don't specify model

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in ea43808 - removed model specification from engine config.

Comment thread .github/workflows/jsweep.md Outdated
Comment on lines +4 to +5
schedule:
- cron: daily
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

schedule: daily

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in ea43808 - simplified schedule to schedule: daily format.

…ed schedule format

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot add serena for JavaScript

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 18, 2025

@copilot add serena for JavaScript

Done in 61d7d5d - added serena with typescript support for JavaScript/CommonJS analysis.

@pelikhan pelikhan marked this pull request as ready for review December 18, 2025 13:25
@pelikhan pelikhan merged commit 61fcd68 into main Dec 18, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/clean-cjs-files-daily branch December 18, 2025 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants