Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 21, 2025

Establishes monitoring for large Go files and documents when to consider splitting them. Current analysis shows 4 files approaching the 50-function threshold, all justified by domain complexity.

Changes

  • Documentation (specs/code-organization.md)

    • Added 50-function threshold guideline for considering file splits
    • Documented current large files with domain justifications:
      • js.go (41 functions) - JavaScript bundling/execution
      • permissions.go (37 functions) - Permission handling
      • scripts.go (37 functions) - Script generation
      • compiler_safe_outputs_consolidated.go (30 functions) - Consolidated safe outputs
    • Clarified when to split vs when NOT to split (cohesive domains warrant larger files)
  • Monitoring (scripts/check-file-sizes.sh, Makefile)

    • Non-blocking script that counts functions in Go files
    • Two-tier warnings: INFO (40-49 functions), WARNING (50+ functions)
    • Integrated via make check-file-sizes target
    • Script references specs/code-organization.md for detailed guidelines

Usage

make check-file-sizes

Example output:

ℹ️  INFO: pkg/workflow/js.go
   Functions: 41 | Lines: 914
   Approaching threshold (40-50 functions)

Summary:
ℹ️  1 file(s) approaching threshold (40-50 functions)

These files are getting large but still within acceptable range.
Consider reviewing them if adding significant functionality.

Note: This is an informational check only. Large files may be justified
by domain complexity. See specs/code-organization.md for guidelines.
Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Monitor and document large file size guidelines</issue_title>
<issue_description>## Objective

Establish monitoring for large files and document guidelines for when to consider splitting files.

Context

The analysis identified files approaching the "consider splitting" threshold:

  • js.go (41 functions) - JavaScript bundling/execution
  • scripts.go (37 functions) - Script generation
  • permissions.go (37 functions) - Permission handling
  • compiler_safe_outputs_consolidated.go (30 functions) - Already consolidated

Current guideline: Consider splitting when files exceed 50 functions.

Approach

  1. Document file size guidelines in developer documentation:

    • Add to AGENTS.md or DEVGUIDE.md
    • Specify: 50+ functions warrants consideration for splitting
    • Clarify: Domain complexity may justify larger files
    • Note: Current large files are appropriately sized for their domains
  2. Create monitoring mechanism:

    • Add a simple script or test that warns when files exceed thresholds
    • Could be integrated into CI or make targets
    • Non-blocking - just informational
  3. Document current large files:

    • Note why each large file is justified (domain complexity)
    • Set baseline for future comparison

Files to Create/Modify

  • AGENTS.md or DEVGUIDE.md - Add file size guidelines
  • scripts/check-file-sizes.sh (optional) - Monitoring script
  • .github/workflows/code-quality.yml (optional) - CI integration

Acceptance Criteria

AI generated by Plan Command for #7136

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Dec 21, 2025
- Add file size guidelines to AGENTS.md with 50-function threshold
- Document current large files with justifications
- Create check-file-sizes.sh monitoring script
- Add make check-file-sizes target
- Update specs/code-organization.md with monitoring info

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Document large file size guidelines and monitoring Add file size monitoring and documentation guidelines Dec 21, 2025
Copilot AI requested a review from mnkiefer December 21, 2025 18:07
AGENTS.md Outdated
- Add new files for new features rather than extending existing ones
- Use console formatting instead of plain fmt.* for CLI output

### File Size Guidelines
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot remove agents.md modifications

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed file size guidelines from AGENTS.md in commit 1b56f7b. The guidelines remain documented in specs/code-organization.md where they provide detailed context alongside other code organization patterns.

Copilot AI and others added 2 commits December 21, 2025 18:13
Remove the File Size Guidelines section from AGENTS.md as requested.
The guidelines remain in specs/code-organization.md where they provide
detailed context alongside other code organization patterns.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Since file size guidelines were removed from AGENTS.md, update the
monitoring script to reference specs/code-organization.md instead.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan December 21, 2025 18:17
@pelikhan pelikhan marked this pull request as ready for review December 21, 2025 18:32
@pelikhan pelikhan merged commit 02f0062 into main Dec 21, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/document-large-file-guidelines branch December 21, 2025 18:32
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.

[plan] Monitor and document large file size guidelines

3 participants