buildanchor 0.3.2__tar.gz

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.
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative Works
95
+ a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing
141
+ the origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,12 @@
1
+ BuildAnchor
2
+ Copyright 2026 Tensilestream and BuildAnchor contributors.
3
+
4
+ BuildAnchor is distributed under the Apache License, Version 2.0. Redistributions and
5
+ derivative works must retain the LICENSE file, this NOTICE file, copyright notices, and
6
+ required modification notices.
7
+
8
+ "BuildAnchor", "Tensilestream", and associated logos and marks identify the upstream
9
+ project. The Apache License does not grant permission to use those names or marks to
10
+ brand a fork, imply endorsement, or present a derivative work as the official project.
11
+ Descriptive references such as "based on BuildAnchor" are permitted when they are
12
+ accurate and do not imply endorsement.
@@ -0,0 +1,453 @@
1
+ Metadata-Version: 2.4
2
+ Name: buildanchor
3
+ Version: 0.3.2
4
+ Summary: Local-first Build Truth and change validation for AI coding agents
5
+ Author: Tensilestream & BuildAnchor contributors
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/tensilestream/buildanchor
8
+ Project-URL: Documentation, https://github.com/tensilestream/buildanchor#readme
9
+ Project-URL: Repository, https://github.com/tensilestream/buildanchor.git
10
+ Project-URL: Issues, https://github.com/tensilestream/buildanchor/issues
11
+ Project-URL: Discussions, https://github.com/tensilestream/buildanchor/discussions
12
+ Project-URL: Changelog, https://github.com/tensilestream/buildanchor/blob/main/CHANGELOG.md
13
+ Keywords: ai-agents,ai-coding-assistant,build-system,build-validation,change-validation,code-intelligence,developer-productivity,developer-tools,local-first,mcp,polyglot-repository,repository-analysis,software-supply-chain,verification
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Operating System :: MacOS
18
+ Classifier: Operating System :: Microsoft :: Windows
19
+ Classifier: Operating System :: POSIX
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Topic :: Software Development :: Build Tools
26
+ Classifier: Topic :: Software Development :: Quality Assurance
27
+ Classifier: Topic :: Software Development :: Testing
28
+ Classifier: Topic :: Utilities
29
+ Requires-Python: >=3.10
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ License-File: NOTICE
33
+ Provides-Extra: tokens
34
+ Requires-Dist: tiktoken>=0.7; extra == "tokens"
35
+ Provides-Extra: dev
36
+ Requires-Dist: tiktoken>=0.7; extra == "dev"
37
+ Dynamic: license-file
38
+
39
+ <p align="center">
40
+ <img src="docs/branding/buildanchor_project_shield.png" width="120" alt="BuildAnchor Logo">
41
+ </p>
42
+
43
+ # BuildAnchor
44
+
45
+ [![CI](https://github.com/tensilestream/buildanchor/actions/workflows/ci.yml/badge.svg)](https://github.com/tensilestream/buildanchor/actions/workflows/ci.yml)
46
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
47
+ [![Python](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/)
48
+ [![Organization](https://img.shields.io/badge/org-Tensilestream-orange.svg)](https://github.com/tensilestream)
49
+
50
+ BuildAnchor is an open-source, local-first **Build Truth and change-validation layer for AI coding agents** by [Tensilestream](https://github.com/tensilestream).
51
+
52
+ Every time a coding agent guesses which test command to run, which Java runtime a repo targets, or whether to use `javax.persistence` or `jakarta.persistence`, it wastes tokens and risks making an incompatible change. BuildAnchor answers those questions in milliseconds — locally, offline, and with zero LLM calls — so the agent doesn't have to.
53
+
54
+ ## How it saves LLM tokens
55
+
56
+ | Without BuildAnchor | With BuildAnchor |
57
+ |---|---|
58
+ | Agent reads `pom.xml`, `build.gradle`, `pyproject.toml`, `package.json`, … | Agent injects one ~150-token block from `build.llm_prompt` |
59
+ | Agent guesses `javax.persistence` vs `jakarta.persistence` | BuildAnchor detects Spring Boot 3+ and flags the correct namespace |
60
+ | Agent tries the wrong test command and wastes a turn repairing it | BuildAnchor proves the exact validated test command |
61
+ | Agent silently uses the 2015 Rust edition | BuildAnchor warns and recommends edition 2021 |
62
+
63
+ **Typical savings: 500–2000 tokens per agent invocation** on polyglot repositories.
64
+
65
+ ## Universal Kickstart by Ecosystem
66
+
67
+ BuildAnchor works automatically across all major programming stacks without manual configuration. Run these from your project root:
68
+
69
+ ```bash
70
+ # Initialize your project: auto-detects stack and writes AGENT.md rules
71
+ buildanchor init
72
+
73
+ # Get instant, zero-noise context to inject into your agent
74
+ buildanchor llm-prompt --agent
75
+
76
+ # Check if a package is already installed before adding duplicate dependencies
77
+ buildanchor find --package express # Node / TypeScript
78
+ buildanchor find --package pydantic # Python
79
+ buildanchor find --package jackson # Java / Kotlin
80
+
81
+ # Run verified tests without guessing test runners or flags
82
+ buildanchor cmd test
83
+ ```
84
+
85
+ ### Monorepo Intelligence & Targeted Test Scoping
86
+
87
+ In multi-package repositories (Turborepo, Nx, pnpm/npm/yarn workspaces, Cargo, Maven multi-module, Gradle multi-project, Go workspaces, and Python monorepos), running the entire repository test suite wastes minutes and tokens, and frequently causes coding agents to fail. BuildAnchor detects monorepo topology and enables targeted, scoped testing:
88
+
89
+ ```bash
90
+ # Discover all packages, directories, and categories (UI vs BACKEND vs SHARED)
91
+ buildanchor modules
92
+
93
+ # Run ONLY UI / frontend tests
94
+ buildanchor cmd test --scope ui
95
+
96
+ # Run ONLY backend / API / database tests
97
+ buildanchor cmd test --scope backend
98
+
99
+ # Target a specific package or directory
100
+ buildanchor cmd test --scope @acme/web
101
+ buildanchor cmd test --scope apps/api
102
+
103
+ # Automatically detect and test ONLY packages modified in git diff
104
+ buildanchor cmd test --changed
105
+ ```
106
+
107
+ ### Real-World Developer Tasks & Agent Prompts
108
+
109
+ Below are generic prompts that work across the most common project types in the world:
110
+
111
+ | Ecosystem | Common Generic Task | BuildAnchor Pre-Flight Command |
112
+ |---|---|---|
113
+ | **Node / TypeScript** | *"Add a JWT authentication middleware"* | `buildanchor plan --workspace . --objective "Add a JWT authentication middleware"` |
114
+ | **Python (FastAPI / Django)** | *"Add an async health check route with DB ping"* | `buildanchor plan --workspace . --objective "Add an async health check route with DB ping"` |
115
+ | **Java (Spring Boot)** | *"Add a REST controller with validation"* | `buildanchor plan --workspace . --objective "Add a REST controller with validation"` |
116
+ | **Go** | *"Implement structured logging and graceful shutdown"* | `buildanchor plan --workspace . --objective "Implement structured logging and graceful shutdown"` |
117
+ | **Rust** | *"Implement request rate limiting worker"* | `buildanchor plan --workspace . --objective "Implement request rate limiting worker"` |
118
+ | **.NET (C#)** | *"Add an EF Core DbContext entity and migration"* | `buildanchor plan --workspace . --objective "Add an EF Core DbContext entity and migration"` |
119
+
120
+ ### Ready-to-Use Agent Prompt Templates
121
+
122
+ Copy and paste these snippets into your agent's instructions (`.cursorrules`, `AGENT.md`, `CLAUDE.md`, or System Prompt):
123
+
124
+ #### For Cursor / Windsurf / Copilot (`.cursorrules` or instructions):
125
+ ```markdown
126
+ Before modifying build configs, adding dependencies, or running tests:
127
+ 1. Run `buildanchor preflight --agent` to inspect repository runtime truth.
128
+ 2. If adding an import or package, run `buildanchor find --package <name>` first to verify existing versions and import conventions.
129
+ 3. Run verified tests using `buildanchor cmd test`.
130
+ 4. After completing code changes, run `buildanchor validate-change --baseline HEAD`.
131
+ ```
132
+
133
+ #### For Terminal Agents (Claude Code, Aider, OpenCodeInterpreter):
134
+ ```bash
135
+ # In your agent prompt or slash-command:
136
+ "Please implement [TASK]. First run `buildanchor plan --objective '[TASK]' --agent` to verify stack constraints and baseline, then write the code and run `buildanchor cmd test`."
137
+ ```
138
+
139
+ ## Recommended call sequence for agents
140
+
141
+ ```
142
+ 1. build.llm_prompt → inject into system prompt (150 tokens, zero risk)
143
+ 2. build.preflight → gate before touching build/dependency files
144
+ 3. [agent acts]
145
+ 4. build.validate_change → confirm the change is coherent
146
+ 5. build.repair_guidance → fix if invalid/inconclusive
147
+ ```
148
+
149
+ Use `build.token_estimate` first if you want to see the cost of each tool before calling.
150
+
151
+ ## Ecosystem compatibility rules (catches what LLMs hallucinate)
152
+
153
+ | Rule | Languages | What it catches |
154
+ |---|---|---|
155
+ | Jakarta namespace migration | Java, Kotlin | `javax.persistence/validation/servlet` → `jakarta.*` (Spring Boot 3+) |
156
+ | Python packaging | Python | `setup.py`-only, deprecated `distutils`, `pkg_resources` → `importlib` |
157
+ | Node ESM | JavaScript, TypeScript | `"main"` without `"exports"`, deprecated `request` package |
158
+ | Go modules | Go | Pre-module layout (no `go.mod`) |
159
+ | Rust edition | Rust | Edition 2015 → recommend 2021 |
160
+ | Objective mismatch | All | JPA objective on a Node.js repo → explicit warning |
161
+
162
+ It helps an agent follow this lifecycle:
163
+
164
+ ```text
165
+ Inspect → Act → Validate → Repair → Validate again
166
+ ```
167
+
168
+ BuildAnchor reports what a repository can prove about its build system, runtime, dependencies, compatibility constraints, and validation commands. It does not claim that a build passed unless an approved validation runner actually ran it.
169
+
170
+
171
+ ## Who this is for
172
+
173
+ BuildAnchor is designed for:
174
+
175
+ - Teams building AI coding agents that need repository-aware context before editing code.
176
+ - Developer-platform and DevOps teams supporting many repositories and build systems.
177
+ - Maintainers who want a repeatable pre-change check and evidence-backed change validation.
178
+ - Security-conscious engineering teams that need local-first, bounded, auditable diagnostics.
179
+
180
+ ## What it saves
181
+
182
+ BuildAnchor is intended to save investigation time and wasted validation cycles by answering the
183
+ questions that usually slow down an automated or unfamiliar change: which build system is active,
184
+ which runtimes and dependencies are present, which compatibility constraints matter, what changed,
185
+ and which validation commands are appropriate. It reports evidence and uncertainty instead of
186
+ guessing, so teams can compare its local latency with their own workflow before adopting it.
187
+
188
+ It is a repository inspection and change-validation layer, not a replacement for the repository's
189
+ build tool, test runner, CI system, or security sandbox.
190
+
191
+ ## Copyright and project identity
192
+
193
+ BuildAnchor is copyright © 2026 Tensilestream and BuildAnchor contributors and is distributed
194
+ under the Apache License, Version 2.0. Projects may use, modify, and include the code when they
195
+ retain the required license, copyright, attribution, NOTICE, and modification notices.
196
+
197
+ The BuildAnchor and Tensilestream names and marks identify the upstream project. A fork or
198
+ derivative must not remove attribution, present the upstream code as entirely original, use the
199
+ upstream name as its own product branding, or imply official endorsement. See
200
+ [`TRADEMARKS.md`](TRADEMARKS.md) for the project identity policy.
201
+
202
+ ## Quick start
203
+
204
+ ### Install the CLI
205
+
206
+ For a contributor checkout, install the local files globally with the platform installer:
207
+
208
+ ```bash
209
+ ./scripts/install.sh --local --global
210
+ ```
211
+
212
+ From macOS/Linux without a checkout:
213
+
214
+ ```bash
215
+ curl -fsSL https://raw.githubusercontent.com/tensilestream/buildanchor/main/scripts/install.sh | bash
216
+ ```
217
+
218
+ For Windows PowerShell:
219
+
220
+ ```powershell
221
+ irm https://raw.githubusercontent.com/tensilestream/buildanchor/main/scripts/install.ps1 | iex
222
+ ```
223
+
224
+ ### Inspect another repository
225
+
226
+ Once installed, BuildAnchor can be run from any directory:
227
+
228
+ ```bash
229
+ buildanchor inspect --workspace /path/to/another/repository --format text
230
+ cd /path/to/another/repository
231
+ buildanchor context --workspace . --format json
232
+ ```
233
+
234
+ ### Contributor quick start
235
+
236
+ To test the current checkout before installing a package:
237
+
238
+ ```bash
239
+ uv sync
240
+ uv run python -m unittest discover -s tests -v
241
+ uv run buildanchor inspect --workspace /path/to/another/repository --format text
242
+ ```
243
+
244
+ The platform installer below is for contributors who specifically need the current checkout
245
+ exposed as a command outside `uv run`.
246
+
247
+ ### Run directly from the source checkout
248
+
249
+ ```bash
250
+ uv sync
251
+ uv run buildanchor inspect --workspace . --format text
252
+ uv run buildanchor compatibility --workspace . --format json
253
+ uv run buildanchor plan --workspace . --objective "Add a health check endpoint" --format json
254
+ uv run buildanchor context --workspace . --format json
255
+ uv run buildanchor validate-change --workspace . --baseline HEAD --format json
256
+ # Execute the detected, bounded validation probes as an explicit opt-in:
257
+ uv run buildanchor validate-change --workspace . --baseline HEAD --execute --format json
258
+ ```
259
+
260
+ `uv sync` creates and manages the project virtual environment automatically. The current reference implementation uses Python 3.10+ and has no runtime dependencies.
261
+
262
+ If `uv` is unavailable, the equivalent standard-library fallback is:
263
+
264
+ ```bash
265
+ python3 -m venv .venv
266
+ . .venv/bin/activate
267
+ python -m pip install -e .
268
+ buildanchor inspect --workspace . --format text
269
+ ```
270
+
271
+ ### Install the current checkout globally for development
272
+
273
+ Run the installer from the repository root. It installs this checkout, including uncommitted
274
+ source changes, globally for your user account:
275
+
276
+ ```bash
277
+ ./scripts/install.sh --local --global
278
+ ```
279
+
280
+ On Windows PowerShell:
281
+
282
+ ```powershell
283
+ .\scripts\install.ps1 -Local -Global
284
+ ```
285
+
286
+ The script uses `pipx` or a user-scoped Python installation and does not clone or fetch the
287
+ repository when run from a checkout. If a Python virtual environment is active, deactivate it
288
+ first or install `pipx`; the script intentionally avoids turning a project virtual environment
289
+ into a global installation.
290
+
291
+ ### One-command installers
292
+
293
+ From a macOS or Linux shell, install the latest main branch with:
294
+
295
+ ```bash
296
+ curl -fsSL https://raw.githubusercontent.com/tensilestream/buildanchor/main/scripts/install.sh | bash
297
+ ```
298
+
299
+ When run from this checkout, the script installs the local source tree, including uncommitted
300
+ changes. It does not clone or fetch the repository.
301
+
302
+ Homebrew installation is reserved for a published formula/tap; it is not used by this local
303
+ checkout installer because contributors need to test the files before pushing them.
304
+
305
+ From Windows PowerShell, use:
306
+
307
+ ```powershell
308
+ irm https://raw.githubusercontent.com/tensilestream/buildanchor/main/scripts/install.ps1 | iex
309
+ ```
310
+
311
+ The bootstrap scripts use `pipx` or a user-scoped Python installation. Review the script before
312
+ piping it to a shell in a restricted environment. Set `BUILDANCHOR_SOURCE_URL` to install from a
313
+ pinned release archive or an internal mirror. The Homebrew formula is intended for a published
314
+ tap, not for pre-push local testing.
315
+
316
+ ## Agent integration
317
+
318
+ Start the MCP server with a bounded workspace:
319
+
320
+ ```bash
321
+ buildanchor mcp --stdio --allow-root /path/to/repository
322
+ ```
323
+
324
+ Available MCP tools:
325
+
326
+ - `build.inspect`
327
+ - `build.context`
328
+ - `build.preflight`
329
+ - `build.plan`
330
+ - `build.change_impact`
331
+ - `build.validate_change`
332
+ - `build.repair_guidance`
333
+ - `build.explain_dependency`
334
+
335
+ `build.validate_change` is static by default. Pass `execute: true` and an optional `timeout` to run detected validation probes with `shell=False`, bounded output, and per-command timeouts. BuildAnchor reports each probe as `passed`, `failed`, `timed_out`, or `unavailable`; it never turns a missing baseline or missing tool into a pass.
336
+
337
+ For automation, `validate-change` exits `0` for `valid`, `1` for `invalid`, `2` for `inconclusive`, and `3` for `blocked`.
338
+
339
+ The compact context pack gives an agent authoritative facts first and evidence references on demand.
340
+
341
+ Call `build.plan` or the SDK `plan()` method before the agent acts. The plan contains the objective, baseline digest, authoritative context, compatibility decisions, ordered steps, and validation gates. For example, a Spring Boot 3 repository using `javax.persistence` receives an evidence-backed recommendation to use `jakarta.persistence` and the `jakarta.persistence:jakarta.persistence-api` coordinate instead. Framework-managed versions are reported as managed rather than guessed.
342
+
343
+ ## HTTP integration
344
+
345
+ ```bash
346
+ buildanchor serve --workspace . --listen 127.0.0.1:8787
347
+ curl -X POST http://127.0.0.1:8787/v1/inspect \
348
+ -H 'content-type: application/json' \
349
+ -d '{}'
350
+ ```
351
+
352
+ ## Python SDK
353
+
354
+ ```python
355
+ from buildanchor import BuildAnchorClient
356
+
357
+ client = BuildAnchorClient(workspace=".")
358
+ baseline = client.inspect()
359
+ result = client.validate_change()
360
+ ```
361
+
362
+ Use `AsyncBuildAnchorClient` for asynchronous orchestration or set `endpoint="http://127.0.0.1:8787"` for a remote HTTP server. See [`sdk/python/README.md`](sdk/python/README.md).
363
+
364
+ ## Java SDK
365
+
366
+ Maven coordinates:
367
+
368
+ ```text
369
+ com.buildanchor:buildanchor-sdk:0.1.0
370
+ ```
371
+
372
+ ```java
373
+ try (BuildAnchorClient client = BuildAnchorClient.builder()
374
+ .workspace(Path.of("."))
375
+ .build()) {
376
+ BuildAnchorResponse baseline = client.inspect();
377
+ BuildAnchorResponse result = client.validateChange("HEAD");
378
+ }
379
+ ```
380
+
381
+ See [`sdk/java/README.md`](sdk/java/README.md).
382
+
383
+ ## GitHub and agent integration
384
+
385
+ BuildAnchor needs a Git baseline for change validation. In a new checkout, create one before validating:
386
+
387
+ ```bash
388
+ git add .
389
+ git commit -m "baseline"
390
+ buildanchor validate-change --baseline HEAD --execute --format markdown
391
+ ```
392
+
393
+ For pull requests, use the base commit supplied by GitHub Actions:
394
+
395
+ ```yaml
396
+ - uses: actions/checkout@v4
397
+ with:
398
+ fetch-depth: 0
399
+ - uses: astral-sh/setup-uv@v6
400
+ - run: uvx --from buildanchor buildanchor validate-change --baseline "${{ github.event.pull_request.base.sha }}" --execute --format sarif > buildanchor.sarif
401
+ ```
402
+
403
+ To connect an agent through MCP, point it at a bounded checkout:
404
+
405
+ ```json
406
+ {
407
+ "mcpServers": {
408
+ "buildanchor": {
409
+ "command": "buildanchor",
410
+ "args": ["mcp", "--stdio", "--allow-root", "/path/to/repository"]
411
+ }
412
+ }
413
+ }
414
+ ```
415
+
416
+ ## Supported ecosystems
417
+
418
+ The first MVP detects Maven, Gradle, Node, Python, Go, Rust, .NET, and generic build markers such as Make, CMake, Bazel, Swift Package Manager, Composer, Bundler, and pub. Static inspection is always explicit about unsupported, unavailable, and policy-blocked capabilities. Validation is intentionally two-stage: static Git/change analysis first, then explicit probe execution when the caller opts in.
419
+
420
+ ## Security model
421
+
422
+ BuildAnchor is read-only and offline-capable by default. It contains workspace paths, uses fixed probe names, does not accept raw agent commands, limits output and execution, redacts credential-bearing values, and records evidence digests. Live resolution and validation should run only through an enterprise-approved sandbox and policy.
423
+
424
+ Read [`SECURITY.md`](SECURITY.md) before enabling networked or executable probes.
425
+
426
+ ## Support and feedback
427
+
428
+ Use [GitHub Discussions](https://github.com/tensilestream/buildanchor/discussions) for usage
429
+ questions and design conversations. Use [GitHub Issues](https://github.com/tensilestream/buildanchor/issues)
430
+ for reproducible bugs, installation problems, and feature requests. Use the private reporting
431
+ channel described in [`SECURITY.md`](SECURITY.md) for vulnerabilities.
432
+
433
+ ## Development
434
+
435
+ ```bash
436
+ uv run python -m unittest discover -s tests -v
437
+ javac --release 17 -d /tmp/buildanchor-java-classes sdk/java/src/main/java/com/buildanchor/*.java
438
+ ```
439
+
440
+ Run the local benchmark harness when changing inspection, context, or planning behavior:
441
+
442
+ ```bash
443
+ uv run python benchmarks/benchmark_cli.py --iterations 20 --warmups 3 --format text
444
+ ```
445
+
446
+ The benchmarks report local latency for a deterministic representative fixture. They are
447
+ engineering baselines, not claims of guaranteed time saved for every repository or team.
448
+
449
+ See [`CONTRIBUTING.md`](CONTRIBUTING.md) for development, testing, adapter, and release guidelines.
450
+
451
+ ## License
452
+
453
+ Apache-2.0. See [`LICENSE`](LICENSE).