Skip to content

Phase 2: Expand reusedCode detection to federal npm and PyPI dependencies - #126

Open
haseebmalik18 wants to merge 6 commits into
DSACMS:devfrom
haseebmalik18:DSACMS/haseeb/add-gov-dependencies
Open

Phase 2: Expand reusedCode detection to federal npm and PyPI dependencies#126
haseebmalik18 wants to merge 6 commits into
DSACMS:devfrom
haseebmalik18:DSACMS/haseeb/add-gov-dependencies

Conversation

@haseebmalik18

@haseebmalik18 haseebmalik18 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Auto-fills code.json's reusedCode field with the federal dependencies detected in a repository's manifests. Phase 2 of #124.

Changes

  • Federal npm + PyPI package → agency mapping in src/gov-dependencies.data.ts. Every entry maps a package to the federal repo it comes from.
  • Detects npm deps from package.json and PyPI deps from requirements.txt, each through its own lookup since PyPI normalizes names differently.
  • Exact package names map 1:1 to their own entry with the repository URL.
  • Refactor: agency constants and maps moved to src/gov-dependencies.data.ts. src/gov-dependencies.ts keeps the lookup logic only.

Note

  • The list was generated with the auto-discovery tooling (#136)

@haseebmalik18
haseebmalik18 force-pushed the DSACMS/haseeb/add-gov-dependencies branch from 944d244 to bc2a3b3 Compare July 15, 2026 15:55
@haseebmalik18 haseebmalik18 changed the title Dsacms/haseeb/add gov dependencies Phase 2: Expand reusedCode detection to federal npm and PyPI dependencies Jul 15, 2026
@haseebmalik18

Copy link
Copy Markdown
Collaborator Author

Not ready for review yet

@haseebmalik18
haseebmalik18 force-pushed the DSACMS/haseeb/add-gov-dependencies branch from bc2a3b3 to 4170e82 Compare July 16, 2026 15:08
@haseebmalik18
haseebmalik18 marked this pull request as ready for review July 16, 2026 15:35
@haseebmalik18

Copy link
Copy Markdown
Collaborator Author

@natalialuzuriaga Ready for review

@sachin-panayil sachin-panayil left a comment

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.

this is a great start. i left some general comments but before approving, i want to see this actually work and populate the reusedCode field in a repo. can you use testing-repo or any test repo to use this branch and actually show the reusedCode being detected and added?

Comment thread src/gov-dependencies.data.ts
Comment thread src/__tests__/unit/helper.test.ts
@haseebmalik18
haseebmalik18 force-pushed the DSACMS/haseeb/add-gov-dependencies branch from 4170e82 to 3043f02 Compare July 27, 2026 18:26
@haseebmalik18

haseebmalik18 commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

@sachin-panayil Here is the successful run in test-repo:
https://github.com/DSACMS/testing-repository/actions/runs/30384490568

And the generated code.json with populated reusedCode field:
DSACMS/testing-repository@d01420c

@decause-gov decause-gov 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.

In the interest of completing this rotation before EoW, we're going to merge this and see what happens... that's what git is for ;)

@haseebmalik18

Copy link
Copy Markdown
Collaborator Author

Something that can be a follow up is crawling through gitlab repos aswell?

@natalialuzuriaga natalialuzuriaga left a comment

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.

LGTM! Amazing job with phase 2

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.

4 participants