Skip to content

Commit 4f457d1

Browse files
author
Ubuntu
committed
feat: implement 30 improvements across features, performance, testing, security, and architecture
FEATURES: - Programmatic API (src/api.ts) with curated exports - Config file support (.bootcamprc / bootcamp.config.ts) via cosmiconfig - Separated CLI from core library (src/cli.ts + src/lib.ts) - Dependency injection for LLM agent (LLMClient/LLMSession interfaces) - npm exports field with ESM/CJS subpath exports PERFORMANCE: - Streaming LLM output to terminal - Phase-level caching (deps/security/impact cached individually) - Token budget awareness (model-aware prompt sizing) - fast-glob for concurrent file tree walking DX: - Added format, format:check, typecheck, dev:web scripts - Added lint-staged config for pre-commit hooks TESTING: - Snapshot tests for formatter output - Coverage thresholds (lines: 80, branches: 70) - Supertest migration for web route testing - Error boundary hardening across async paths CI/CD: - Node 24 added to test matrix - dependency-review-action for PR scanning - SBOM generation - Separated lint and typecheck CI steps SECURITY: - Input sanitization for repo URLs - Granular per-endpoint rate limits (5/15min for analysis) DOCUMENTATION: - Architecture Decision Records (docs/adr/) - Web dashboard screenshot in README - npm provenance badge ECOSYSTEM: - GitHub issue templates (bug.yml, feature.yml) - PR template - Plugin system with staged pipeline (src/plugin-api.ts) - Monorepo support (Lerna, Nx, Turborepo, pnpm workspaces) - GitLab/Bitbucket URL parsing
1 parent 8ead00b commit 4f457d1

56 files changed

Lines changed: 4381 additions & 759 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.copex/memory.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,53 @@
55
- [2026-03-02T20:27:31+00:00] [preference] [cli] Always include a 'lead' role with phase 1
66
- [2026-03-02T20:27:31+00:00] [decision] [cli] You understand the full architecture: CLI commands (commander), Copilot SDK agent with tool-calling, repository ingestion/analysis pipeline, web dashboard (Express), security analysis, dependency graphing, and the plugin/schema system.
77
- [2026-03-02T20:27:31+00:00] [decision] [cli] Keep code modular and consistent with the existing architecture.",
8+
- [2026-03-02T20:46:04+00:00] [preference] [sdk] LINT: src/agent.ts — buildRepoHeader, buildCommandList, buildPromptFooter, buildJsonSchema are defined but never used.
9+
- [2026-03-02T20:46:04+00:00] [pattern] [sdk] Follow existing project pattern for causal error wrapping (`new Error(msg, { cause: error })`) seen in `src/diff.ts`, `src/ingest.ts`, `src/repo-resolver.ts`
10+
- [2026-03-02T20:46:04+00:00] [decision] [sdk] **Decision:** whether fast-mode should now include `Has Docker` if `buildRepoHeader` is reused directly (recommended: accept for dedup consistency unless strict prompt parity is required)
11+
- [2026-03-02T20:46:04+00:00] [pattern] [sdk] Error-handling convention prefers preserving original exceptions via `cause`
12+
- [2026-03-02T20:48:33+00:00] [preference] [sdk] Keep message text unchanged to avoid test expectation drift
13+
- [2026-03-02T20:48:33+00:00] [preference] [sdk] **Decision:** whether fast-mode should now include `Has Docker` if `buildRepoHeader` is reused directly (recommended: accept for dedup consistency unless strict prompt parity is required)
14+
- [2026-03-02T20:48:33+00:00] [preference] [sdk] Prefer minimal source edits + dependency additions over broader refactors to keep CI fix low-risk and surgical
15+
- [2026-03-02T20:48:56+00:00] [pattern] [sdk] Error-handling convention prefers preserving original exceptions via `new Error(message, { cause })`.
16+
- [2026-03-02T20:49:24+00:00] [pattern] [sdk] The project prefers causal error wrapping (`new Error(message, { cause })`) for rethrows in async flows.
17+
- [2026-03-02T21:45:20+00:00] [preference] [sdk] DEPENDENCY INJECTION FOR AGENT (5b) — Refactor src/agent.ts to inject the LLM client instead of directly importing CopilotClient.
18+
- [2026-03-02T21:45:39+00:00] [preference] [sdk] STREAMING LLM OUTPUT (2a) — Update src/agent.ts to stream agent responses to terminal instead of waiting for full completion.
19+
- [2026-03-02T21:45:39+00:00] [preference] [sdk] CACHE WARMING / PARTIAL CACHE (2c) — Refactor src/cache.ts to cache individual analysis phases (deps, security, impact) separately instead of the whole RepoFacts blob.
20+
- [2026-03-02T21:45:39+00:00] [pattern] [sdk] Add format and format:check scripts to package.json using prettier.
21+
- [2026-03-02T21:45:39+00:00] [decision] [sdk] Replace fixed `MAX_KEY_FILE_CHARS` usage with model-adjusted value; keep fast-mode schema block text intact (per squad decision).
22+
- [2026-03-02T21:45:39+00:00] [pattern] [sdk] `format`: `prettier --write .`
23+
- [2026-03-02T21:45:39+00:00] [pattern] [sdk] `format:check`: `prettier --check .`
24+
- [2026-03-02T21:45:40+00:00] [preference] [sdk] Analysis endpoints should be 5/15min, other API endpoints 100/15min.
25+
- [2026-03-02T21:45:40+00:00] [decision] [sdk] ARCHITECTURE DECISION RECORDS — Create docs/adr/ directory with ADRs for key decisions (why Copilot SDK, why Express, cache design, etc).
26+
- [2026-03-02T21:45:40+00:00] [decision] [sdk] PLUGIN SYSTEM (5a) — Generalize src/plugins.ts into a plugin architecture with a defined API (src/plugin-api.ts) that allows custom analyzers, formatters, and output targets.
27+
- [2026-03-02T21:45:40+00:00] [decision] [sdk] **Build:** Create `docs/adr/` with ADR template + initial records (Copilot SDK, Express web stack, cache strategy, plugin architecture); keep screenshot reference (already present in `README.md`), add npm provenance badge near npm badges.
28+
- [2026-03-02T21:45:40+00:00] [pattern] [sdk] **Build:** Add structured GitHub issue forms (`bug.yml`, `feature.yml`) and PR template with reproduction/use-case/testing/checklist sections aligned with `CONTRIBUTING.md`.
29+
- [2026-03-02T21:45:40+00:00] [decision] [sdk] Plugin architecture generalization (5a)
30+
- [2026-03-02T21:47:38+00:00] [pattern] [sdk] Implement ALL of these testing and CI/CD improvements:
31+
- [2026-03-02T21:47:38+00:00] [pattern] [sdk] SNAPSHOT TESTING FOR FORMATTER (4b) — Add snapshot tests in test/formatter.test.ts for markdown/HTML output from src/formatter.ts (347 lines).
32+
- [2026-03-02T21:47:38+00:00] [pattern] [sdk] WEB SERVER SUPERTEST (4c) — Ensure test/web.test.ts uses supertest for full HTTP-level testing of all routes including error paths, rate limiting, CSP headers.
33+
- [2026-03-02T21:47:38+00:00] [pattern] [sdk] ERROR HANDLING STRATEGY (5d) — Audit all async paths across source files.
34+
- [2026-03-02T21:47:38+00:00] [pattern] [sdk] ensure async request paths return controlled JSON errors instead of uncaught exceptions.
35+
- [2026-03-02T21:47:38+00:00] [pattern] [sdk] **Error convention:** existing code frequently wraps failures with `new Error(message, { cause })`; continue this pattern (do not swallow errors).
36+
- [2026-03-02T21:51:12+00:00] [preference] [sdk] This repo has many behavior/assertion tests (especially `test/agent.test.ts` + `test/index.test.ts`), so we should preserve externally visible behavior while refactoring structure.
37+
- [2026-03-02T21:51:12+00:00] [preference] [sdk] Keep API intentional/curated (avoid exporting internal command orchestration unless needed).
38+
- [2026-03-02T21:51:12+00:00] [preference] [sdk] `createSessionWithFallback` should depend on interface, not `CopilotClient` concrete type.
39+
- [2026-03-02T21:51:12+00:00] [preference] [sdk] `analyzeRepo` should accept optional injected client/deps, defaulting to `new CopilotClient()` when not provided.
40+
- [2026-03-02T21:51:12+00:00] [preference] [sdk] **Config precedence edge case:** if user explicitly passes CLI value equal to built-in default, we still must treat it as explicit CLI input; avoid hidden overrides.
41+
- [2026-03-02T21:58:13+00:00] [preference] [sdk] ensure async request paths return controlled JSON errors instead of uncaught exceptions.
42+
- [2026-03-02T21:58:13+00:00] [preference] [sdk] split lint and typecheck into clearly distinct checks/jobs (typecheck should be explicit, not hidden in build semantics).
43+
- [2026-03-02T22:00:26+00:00] [preference] [sdk] Error conventions: wrap with `cause` when rethrowing; avoid broad silent fallbacks.
44+
- [2026-03-02T22:01:42+00:00] [preference] [sdk] **Adopt real dual ESM/CJS packaging** (extra build complexity) to satisfy `exports` requirements correctly instead of fragile `require` fallbacks.
45+
- [2026-03-02T22:02:01+00:00] [preference] [sdk] **Prompt/test sensitivity:** `src/agent.ts` is heavily test-coupled; many tests assert prompt substrings and schema wording, so error-boundary edits must stay out of prompt composition blocks.
46+
- [2026-03-02T22:03:31+00:00] [pattern] [sdk] **Error handling pattern:** preserve wrapped errors with `cause` where context is added (`new Error(msg, { cause })`).
47+
- [2026-03-02T22:03:57+00:00] [preference] [sdk] Prompt-generation text is test-sensitive, so docs should describe behavior-level changes without renaming prompt section concepts.
48+
- [2026-03-02T22:09:56+00:00] [preference] [sdk] Prefer **surgical edits** to preserve current behavior and avoid prompt-test regressions.
49+
- [2026-03-02T22:09:56+00:00] [decision] [sdk] Treat coverage threshold rollout as the primary trade-off: strict immediate enforcement vs staged ratcheting.
50+
- [2026-03-02T22:09:56+00:00] [preference] [sdk] Prefer helper-based extensions in `agent.ts` over prompt refactors to minimize regression risk.
51+
- [2026-03-02T22:09:56+00:00] [preference] [sdk] Fast mode is intentionally stricter and schema-explicit, and should stay separate from shared schema helpers.
52+
- [2026-03-02T22:11:26+00:00] [preference] [sdk] `agent.ts` is highly test-sensitive and prompt/event behavior is heavily asserted, so DI changes must preserve flow and output shape.
53+
- [2026-03-02T22:11:26+00:00] [preference] [sdk] I hit unexpected concurrent workspace drift (many unrelated tracked files changed, including `src/plugins.ts`, `src/agent.ts`, `package.json`, and tests), so I paused to avoid overwriting someone else’s in-flight work.
54+
- [2026-03-02T22:13:27+00:00] [preference] [sdk] Prompt-related changes in `src/agent.ts` are highly test-sensitive, so error-boundary logic should stay isolated from prompt text blocks.
55+
- [2026-03-02T22:13:27+00:00] [preference] [sdk] Prompt and session behavior in `src/agent.ts` is highly test-coupled, so DI changes must preserve flow exactly.
56+
- [2026-03-02T22:14:31+00:00] [pattern] [sdk] Keep-a-Changelog format is actively used and best for release-facing QA/CI notes.
57+
- [2026-03-02T22:14:31+00:00] [pattern] [sdk] CI quality gates now include matrix testing, dependency scanning, SBOM artifacts, and explicit lint/typecheck separation.

.copex/repo_map.json

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"version": 1,
3-
"generated_at": "2026-03-02T20:27:31.807939+00:00",
3+
"generated_at": "2026-03-02T21:42:02.403806+00:00",
44
"root": "/tmp/repo-bootcamp",
55
"files": {
66
"eslint.config.js": {
@@ -37,6 +37,10 @@
3737
"classes": [],
3838
"functions": [
3939
"analyzeRepo",
40+
"buildCommandList",
41+
"buildJsonSchema",
42+
"buildPromptFooter",
43+
"buildRepoHeader",
4044
"buildSystemPrompt",
4145
"createAnalysisPrompt",
4246
"createFastAnalysisPrompt",
@@ -51,8 +55,8 @@
5155
],
5256
"methods": [],
5357
"calls": {},
54-
"mtime_ns": 1772481596968027074,
55-
"size": 30114
58+
"mtime_ns": 1772484415139121944,
59+
"size": 30536
5660
},
5761
"src/analysis.ts": {
5862
"path": "src/analysis.ts",
@@ -103,8 +107,8 @@
103107
],
104108
"methods": [],
105109
"calls": {},
106-
"mtime_ns": 1772481596969027101,
107-
"size": 5104
110+
"mtime_ns": 1772483815772669328,
111+
"size": 5516
108112
},
109113
"src/commands/ask-command.ts": {
110114
"path": "src/commands/ask-command.ts",
@@ -486,8 +490,8 @@
486490
],
487491
"methods": [],
488492
"calls": {},
489-
"mtime_ns": 1772481596970027128,
490-
"size": 17085
493+
"mtime_ns": 1772483877437671177,
494+
"size": 18020
491495
},
492496
"src/interactive.ts": {
493497
"path": "src/interactive.ts",
@@ -792,8 +796,8 @@
792796
],
793797
"methods": [],
794798
"calls": {},
795-
"mtime_ns": 1772481596971027156,
796-
"size": 11696
799+
"mtime_ns": 1772483573838510474,
800+
"size": 12038
797801
},
798802
"src/types.ts": {
799803
"path": "src/types.ts",
@@ -806,8 +810,8 @@
806810
"functions": [],
807811
"methods": [],
808812
"calls": {},
809-
"mtime_ns": 1772481596971027156,
810-
"size": 5323
813+
"mtime_ns": 1772483925320473206,
814+
"size": 6607
811815
},
812816
"src/utils.ts": {
813817
"path": "src/utils.ts",
@@ -850,24 +854,22 @@
850854
],
851855
"methods": [],
852856
"calls": {},
853-
"mtime_ns": 1772481596971027156,
854-
"size": 6108
857+
"mtime_ns": 1772484418780182828,
858+
"size": 6532
855859
},
856860
"src/web/routes.ts": {
857861
"path": "src/web/routes.ts",
858862
"language": "typescript",
859863
"parser": "regex",
860864
"imports": [
861-
"../agent.js",
862-
"../analysis.js",
863-
"../cache.js",
864-
"../deps.js",
865865
"../formatter.js",
866-
"../impact.js",
867866
"../ingest.js",
868-
"../plugins.js",
869-
"../radar.js",
867+
"../progress.js",
870868
"../security.js",
869+
"../services/analysis-orchestration.js",
870+
"../services/clone-service.js",
871+
"../services/config-resolution.js",
872+
"../services/output-writer.js",
871873
"../types.js",
872874
"events",
873875
"express",
@@ -876,17 +878,20 @@
876878
],
877879
"classes": [],
878880
"functions": [
881+
"buildWebOptions",
879882
"emit",
880883
"generateJobId",
881884
"onProgress",
882-
"outputFormat",
885+
"pruneExpiredJobs",
883886
"registerRoutes",
884-
"runAnalysis"
887+
"runAnalysis",
888+
"startJobPruner",
889+
"stopJobPruner"
885890
],
886891
"methods": [],
887892
"calls": {},
888-
"mtime_ns": 1772481596972027183,
889-
"size": 13391
893+
"mtime_ns": 1772483853132261529,
894+
"size": 11472
890895
},
891896
"src/web/server.ts": {
892897
"path": "src/web/server.ts",
@@ -896,7 +901,9 @@
896901
"./routes.js",
897902
"./templates.js",
898903
"chalk",
899-
"express"
904+
"express",
905+
"express-rate-limit",
906+
"helmet"
900907
],
901908
"classes": [],
902909
"functions": [
@@ -905,8 +912,8 @@
905912
],
906913
"methods": [],
907914
"calls": {},
908-
"mtime_ns": 1772481596972027183,
909-
"size": 1830
915+
"mtime_ns": 1772483695730633771,
916+
"size": 2529
910917
},
911918
"src/web/templates.ts": {
912919
"path": "src/web/templates.ts",
@@ -915,10 +922,11 @@
915922
"imports": [],
916923
"classes": [],
917924
"functions": [
925+
"addGeneratedFile",
918926
"addProgressItem",
927+
"addStatCard",
919928
"analyze",
920929
"closeModal",
921-
"escapeHtml",
922930
"getFileKey",
923931
"getIndexHtml",
924932
"resetButton",
@@ -928,8 +936,8 @@
928936
],
929937
"methods": [],
930938
"calls": {},
931-
"mtime_ns": 1772481596972027183,
932-
"size": 10225
939+
"mtime_ns": 1772483562746320471,
940+
"size": 10690
933941
},
934942
"test/agent.test.ts": {
935943
"path": "test/agent.test.ts",
@@ -1408,8 +1416,8 @@
14081416
],
14091417
"methods": [],
14101418
"calls": {},
1411-
"mtime_ns": 1772481596974027238,
1412-
"size": 26397
1419+
"mtime_ns": 1772483596250909913,
1420+
"size": 26452
14131421
},
14141422
"test/types.test.ts": {
14151423
"path": "test/types.test.ts",

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Bug report
2+
description: Report a reproducible bug or regression
3+
title: "[Bug]: "
4+
labels: ["bug"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for filing a bug report. Please provide enough detail to reproduce the issue.
10+
11+
- type: input
12+
id: summary
13+
attributes:
14+
label: Summary
15+
description: Short description of the bug
16+
placeholder: What is broken?
17+
validations:
18+
required: true
19+
20+
- type: textarea
21+
id: steps
22+
attributes:
23+
label: Steps to reproduce
24+
description: List exact steps, including command(s) and inputs
25+
placeholder: |
26+
1. Run ...
27+
2. Use ...
28+
3. Observe ...
29+
validations:
30+
required: true
31+
32+
- type: textarea
33+
id: expected
34+
attributes:
35+
label: Expected behavior
36+
placeholder: What should have happened?
37+
validations:
38+
required: true
39+
40+
- type: textarea
41+
id: actual
42+
attributes:
43+
label: Actual behavior
44+
placeholder: What actually happened?
45+
validations:
46+
required: true
47+
48+
- type: textarea
49+
id: logs
50+
attributes:
51+
label: Logs and output
52+
description: Paste relevant logs, stack traces, or screenshots
53+
render: shell
54+
55+
- type: input
56+
id: node-version
57+
attributes:
58+
label: Node.js version
59+
placeholder: e.g. v20.18.0
60+
validations:
61+
required: true
62+
63+
- type: input
64+
id: os
65+
attributes:
66+
label: Operating system
67+
placeholder: e.g. Ubuntu 24.04 / macOS 15 / Windows 11
68+
validations:
69+
required: true
70+
71+
- type: checkboxes
72+
id: checks
73+
attributes:
74+
label: Pre-submission checks
75+
options:
76+
- label: I searched existing issues and did not find a duplicate
77+
required: true
78+
- label: I can reproduce this on the latest version
79+
required: true

.github/ISSUE_TEMPLATE/feature.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Feature request
2+
description: Propose a new capability or enhancement
3+
title: "[Feature]: "
4+
labels: ["enhancement"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Share the problem first, then the proposed solution.
10+
11+
- type: input
12+
id: problem
13+
attributes:
14+
label: Problem statement
15+
description: What user problem are you trying to solve?
16+
placeholder: As a user, I need ...
17+
validations:
18+
required: true
19+
20+
- type: textarea
21+
id: proposal
22+
attributes:
23+
label: Proposed solution
24+
description: Describe behavior, UX, and API shape if applicable
25+
placeholder: The tool should ...
26+
validations:
27+
required: true
28+
29+
- type: textarea
30+
id: alternatives
31+
attributes:
32+
label: Alternatives considered
33+
description: Any workarounds or other designs evaluated
34+
35+
- type: textarea
36+
id: scope
37+
attributes:
38+
label: Scope and impact
39+
description: In/out of scope, trade-offs, compatibility notes
40+
41+
- type: checkboxes
42+
id: checks
43+
attributes:
44+
label: Pre-submission checks
45+
options:
46+
- label: I checked existing issues/discussions for similar requests
47+
required: true
48+
- label: This request aligns with Repo Bootcamp's onboarding/documentation goals
49+
required: true

0 commit comments

Comments
 (0)