Skip to content

Adopting codejson-core 0.3.0 - #176

Merged
sachin-panayil merged 7 commits into
devfrom
sachin/core-0.3.0
Oct 14, 2026
Merged

sachin-panayil merged 7 commits into
devfrom
sachin/core-0.3.0

Conversation

@sachin-panayil

@sachin-panayil sachin-panayil commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Adopting codejson-core 0.3.0

Problem

The action had two limitations. The first was how it merged an existing code.json with new values. That work was split between this action and codejson-core, and core only did a shallow merge. Nested objects got replaced as a whole and detected values always won, so manual edits like a custom name or description could be overwritten from GitHub on the next run.

The second was that the action only knew how to produce the CMS version of code.json. Every repository got CMS only fields, the CMS organization name, a CC0 license by default, and a pull request sent on behalf of the CMS Source Code Stewardship Taskforce. Other agencies couldn't use the action without ending up with a CMS file. With SHARE IT Act work ramping up, this is a problem.

Solution

This bumps codejson-core to 0.3.0, which now handles the full merge. Manual values are kept, values that change over time like labor hours and the repository URL are refreshed on every run, and tags and reused code are combined from both sides. Because core owns this now, the action just reports what it detected and the old merging code has been removed.

It also adds a new AGENCY input that accepts cms or neutral, with cms as the default for this specific repo. The SHARE IT Org version might be better suited to have neutral as its default. The selected agency is read once when the action starts and that profile is used everywhere after like building the file, validating it, and checking it on pull requests. This way a file is always checked against the same schema it was generated with. If someone enters an agency that doesn't exist, the action fails right away with a clear message listing the valid options.

A few CMS specific pieces now follow the selected agency. AI enrichment only asks the model for fields the schema actually has, so on neutral it only suggests tags and skips the long description entirely. Pull requests for neutral repositories leave out the Taskforce and Slack wording. The README explains the new input and what changes between the two agencies.

AI Usage

  • Generated AI was used in this contribution
  • Description:
    • AI was used to plan the work, implement it one piece at a time, and write tests. Every change was reviewed, understood and committed by hand.
  • Type of Assistance:
    • Code generation
    • Documentation
    • Debugging
    • Testing
    • Refactoring
    • Other:
  • AI System Used:
    • ChatGPT
    • Claude
    • Gemini
    • GitHub Copilot
  • Level of Modification:
    • As-is
    • Modified
    • Used as inspiration

Result

Current CMS users don't need to change anything. Without AGENCY set they get the same CMS file as before, except their manual edits now stick across runs.

Other agencies can set AGENCY to neutral and get a code.json with only the shared fields, a blank organization for them to fill in, no default license, tag suggestions from the AI, and pull request text that doesn't mention CMS. Supporting another agency later only needs a new codejson-core release and a version bump here.

One thing to note is that switching an existing repository from cms to neutral will remove its CMS-only fields on the next run. The README calls this out.

Test Plan

All unit tests, lint and the package build pass. New tests cover picking each agency and rejecting an unknown one, a neutral run producing no CMS-only fields, pull request validation using the selected agency, neutral AI enrichment asking only for tags, and neutral pull request text leaving out the CMS wording.

To check it end to end, run the action on DSACMS/testing-repository without AGENCY set and confirm an existing code.json only changes its metadataLastUpdated date. Then run it on a test repository with AGENCY set to neutral and confirm the pull request has no CMS fields or CMS wording. Finally, run it with an invalid agency and confirm the job fails with the "Unknown AGENCY" message.

@sachin-panayil sachin-panayil self-assigned this Oct 13, 2026
@sachin-panayil sachin-panayil changed the title Sachin/core 0.3.0 Adopting codejson-core 0.3.0 Oct 13, 2026
@sachin-panayil
sachin-panayil marked this pull request as draft October 13, 2026 18:27
@sachin-panayil
sachin-panayil marked this pull request as ready for review October 13, 2026 18:36

@DinneK DinneK left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

OK! I reviewed codejson.ts, create-deps.ts, main.ts, helper.ts, and enrich.ts. I ran the full test suite locally everything passed and I manually verified the fail-fast behavior on a bad AGENCY value.

This is really great work! LGTM!

Comment thread src/__tests__/unit/codejson.test.ts Resolved
Comment thread src/codejson.ts Resolved
Comment thread src/create-deps.ts Resolved
@sachin-panayil
sachin-panayil merged commit c1aee6c into dev Oct 14, 2026
7 checks passed
@sachin-panayil
sachin-panayil deleted the sachin/core-0.3.0 branch October 14, 2026 19:29
This was referenced Oct 14, 2026
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