Skip to content

Conversation

@Paveltarno
Copy link
Collaborator

@Paveltarno Paveltarno commented Feb 11, 2026

Note

Description

Refactors the writeAgents function to track files individually instead of just agent names. This enables smarter file handling: it now preserves custom filenames (e.g., my-support-agent.jsonc instead of support.jsonc), skips writing when content is unchanged (preserving user comments and formatting), and only reports actual changes to the user. The pull command also now shows a clearer message when all agents are already up to date.

Related Issue

None

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • Modified writeAgents to use file-level tracking with AgentFileEntry interface containing data, raw, and filePath
  • Added deep equality check using isDeepStrictEqual to skip writing unchanged files (preserves comments/formatting)
  • Updated file writing logic to use existing file paths when agent names match (preserves custom filenames)
  • Improved agents pull command messaging to show "Syncing" instead of "Writing" and display "All agents are already up to date" when no changes
  • Removed early return in pull command when no remote agents exist (now continues to delete local agents)
  • Added comprehensive test suite (tests/core/agents_write.spec.ts) with 206 new lines covering file tracking, deletion, custom filenames, and unchanged file preservation
  • Updated existing pull command tests to match new messaging

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (npm test)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated AGENTS.md if I made architectural changes

Additional Notes

This refactoring improves the user experience by being less intrusive with file modifications. Users can now rename agent files to their preference (e.g., my-support-agent.jsonc) and the CLI will respect that naming. Additionally, if the remote agent data hasn't changed, the local file won't be touched, preserving any comments or formatting users may have added.


🤖 Generated by Claude | 2026-02-11 21:15 UTC

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.31-pr.228.043cc19

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.0.31-pr.228.043cc19"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.31-pr.228.043cc19"
  }
}

Preview published to npm registry — try new features instantly!

…ip-unchanged

Refactor writeAgents to track files by content name rather than filename,
enabling correct updates when filenames don't match agent names. Skip
writing unchanged data to preserve comments and formatting. Add duplicate
name validation in write path for consistency with readAllAgents.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Paveltarno Paveltarno force-pushed the agents-write-refactor branch from 423bc4e to 57ac95b Compare February 11, 2026 09:31
@Paveltarno
Copy link
Collaborator Author

@claude run lint fix and typecheck fix

@claude
Copy link

claude bot commented Feb 11, 2026

Claude finished @Paveltarno's task in 32s —— View job


Unable to run lint fix and typecheck

I attempted to run the requested commands but I don't have permission to execute Bash commands in this repository. The following commands require approval:

  • bun install - Install dependencies
  • bun run lint:fix - Run Biome lint auto-fix
  • bun run typecheck - Run TypeScript type checking

What you can do

To allow me to run these commands, you'll need to update my permissions by adding --allowedTools=Bash to the GitHub Action configuration, or you can run these commands locally:

bun install
bun run lint:fix
bun run typecheck

Alternatively, you can approve the commands when I request them, or configure the repository to allow me to run Bash commands without approval.


@claude
Copy link

claude bot commented Feb 11, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

1 similar comment
@claude
Copy link

claude bot commented Feb 11, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

The early return skipped writeAgents() when remote had 0 agents,
preventing deletion of stale local files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Paveltarno
Copy link
Collaborator Author

@claude lint fix

@claude
Copy link

claude bot commented Feb 11, 2026

Claude finished @Paveltarno's task in 54s —— View job


Lint fix completed

  • Install dependencies
  • Run lint fix
  • Commit and push any changes
  • Report results

Summary

Successfully ran bun run lint:fix which fixed 2 files with formatting improvements:

Changes made:

  • src/core/resources/agent/config.ts: Fixed function signature formatting
  • tests/core/agents_write.spec.ts: Fixed import ordering and object formatting

The changes have been committed and pushed to the agents-write-refactor branch.

--- | View commit

github-actions bot and others added 2 commits February 11, 2026 09:54
Co-authored-by: paveltarno <Paveltarno@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant