@aarushpandey/gitagent 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CONTRIBUTING.md +104 -0
  2. package/LICENSE +21 -0
  3. package/README.md +570 -0
  4. package/TESTING.md +290 -0
  5. package/action.yml +113 -0
  6. package/examples/README.md +124 -0
  7. package/examples/sample-audit-trail-issue-4.md +112 -0
  8. package/examples/sample-review-tqec-pr894-v1-raw-flawed.md +71 -0
  9. package/examples/sample-review-tqec-pr894-v2-raw.md +48 -0
  10. package/examples/sample-review-tqec-pr894-v3-curated.md +118 -0
  11. package/examples/verify-marker-precedence/README.md +97 -0
  12. package/examples/verify-marker-precedence/conftest.py +15 -0
  13. package/examples/verify-marker-precedence/pyproject.toml +8 -0
  14. package/examples/verify-marker-precedence/test_marker_precedence.py +56 -0
  15. package/examples/verify-marker-precedence/verify_precedence.py +67 -0
  16. package/examples/workflows/issue-fix.yml +32 -0
  17. package/examples/workflows/pr-review.yml +34 -0
  18. package/package.json +75 -0
  19. package/scripts/verify.js +478 -0
  20. package/src/agents/agentLoop.js +176 -0
  21. package/src/agents/engineeringAgent.js +51 -0
  22. package/src/agents/reviewCopilot.js +79 -0
  23. package/src/agents/tools.js +486 -0
  24. package/src/cli/output.js +137 -0
  25. package/src/config.js +22 -0
  26. package/src/mapper/fileRelevance.js +113 -0
  27. package/src/mapper/repoMap.js +105 -0
  28. package/src/orchestrator.js +336 -0
  29. package/src/pipeline.js +985 -0
  30. package/src/prompts/engineering.js +189 -0
  31. package/src/prompts/review.js +149 -0
  32. package/src/utils/cost.js +47 -0
  33. package/src/utils/diffLines.js +67 -0
  34. package/src/utils/githubUrl.js +8 -0
  35. package/src/web/public/index.html +128 -0
  36. package/src/web/server.js +51 -0
@@ -0,0 +1,104 @@
1
+ # Contributing to github-agent
2
+
3
+ Thanks for your interest. This project ships real code to real repos, so we
4
+ hold the contributor workflow to the same bar as the runtime safety rails.
5
+
6
+ ## Getting the project running locally
7
+
8
+ ```bash
9
+ git clone https://github.com/Hadar01/github-agents.git
10
+ cd github-agents
11
+ npm install
12
+ cp .env.example .env
13
+ # ANTHROPIC_API_KEY=sk-ant-...
14
+ # GITHUB_TOKEN=ghp_... (scope: public_repo for OSS work, repo for private)
15
+ ```
16
+
17
+ Sanity-check your install:
18
+
19
+ ```bash
20
+ npm test
21
+ node src/pipeline.js # should print usage
22
+ ```
23
+
24
+ Everything should go green on Node 18, 20, or 22.
25
+
26
+ ## Before you open a PR
27
+
28
+ Run the full suite:
29
+
30
+ ```bash
31
+ npm test
32
+ ```
33
+
34
+ If you touched anything in `src/agents/` or `src/pipeline.js`, also smoke-test
35
+ the CLI end-to-end on a throwaway issue **in dry-run mode** (no push, no PR):
36
+
37
+ ```bash
38
+ node src/pipeline.js issue https://github.com/<you>/<sandbox>/issues/<n> --dry-run
39
+ ```
40
+
41
+ ## PR etiquette
42
+
43
+ - **One behavior change per PR.** Safety rails, features, and refactors ship
44
+ separately. Bundling makes review painful and audit trails muddy.
45
+ - **Add a test with every behavior change.** Every tool, every safety gate,
46
+ every verdict-handling branch is covered today — keep it that way.
47
+ - **Run `npm test` locally before pushing.** CI runs on Linux/Windows/macOS ×
48
+ Node 18/20/22; flakes caught locally are cheaper than matrix re-runs.
49
+ - **No emojis in code or commit messages** unless a file already uses them
50
+ (dashboard HTML, banner, and CONTRIBUTING are the only places with any).
51
+ - **Never commit secrets.** `.env` is gitignored — keep it that way.
52
+
53
+ ## Where things live
54
+
55
+ | Area | Directory |
56
+ |------|-----------|
57
+ | CLI entry / orchestration | `src/pipeline.js`, `src/orchestrator.js` |
58
+ | Engineering agent loop | `src/agents/agentLoop.js` |
59
+ | Tool schemas + sandboxed handlers | `src/agents/tools.js` |
60
+ | Prompt templates | `src/prompts/` |
61
+ | Repo walker (big-project safe) | `src/mapper/repoMap.js` |
62
+ | Cost math (source of the kill switch) | `src/utils/cost.js` |
63
+ | Terminal output + web dashboard | `src/cli/output.js`, `src/web/` |
64
+ | Tests | `tests/` |
65
+
66
+ ## Safety-critical code paths (extra review needed)
67
+
68
+ Changes here need a second pair of eyes and a dedicated test:
69
+
70
+ - `src/agents/tools.js` — `safeJoin`, `parseTestCommand`, path traversal, the
71
+ command allowlist. These are the security perimeter.
72
+ - `src/pipeline.js` — the PR gate in `runIssue`. Breaking this lets bad PRs
73
+ ship silently.
74
+ - `src/agents/agentLoop.js` — `sawPassingTests` bookkeeping and the cost
75
+ ceiling check. Breaking either unblocks shipment without verification.
76
+
77
+ ## Filing an issue
78
+
79
+ If you're reporting a bug you hit while running the agent, please include:
80
+
81
+ - The subcommand (`issue`, `review`, `triage`) and flags used.
82
+ - The `audit-trail.md` the agent produced (it's gitignored — copy/paste the
83
+ summary + final-turn output, redacting any repo-specific text).
84
+ - Node and npm versions (`node -v && npm -v`).
85
+ - OS.
86
+
87
+ ## Using the agent on repos you don't own
88
+
89
+ The CLI supports fork-based contributions without write access to the target:
90
+
91
+ ```bash
92
+ node src/pipeline.js issue <issue-url> --fork --comment
93
+ ```
94
+
95
+ `--fork` pushes to your own fork and opens the PR from there. `--comment`
96
+ posts a link-back to the original issue so the issue author sees your PR.
97
+ Same idea for PR review:
98
+
99
+ ```bash
100
+ node src/pipeline.js review <pr-url> --post
101
+ ```
102
+
103
+ `--post` submits the review as a PR review comment. Works on any public
104
+ repo — GitHub lets any authenticated user comment on public PRs.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hadar01
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.