madeby 0.1.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 (3) hide show
  1. package/README.md +182 -0
  2. package/dist/madeby.mjs +2095 -0
  3. package/package.json +53 -0
package/README.md ADDED
@@ -0,0 +1,182 @@
1
+ # madeby
2
+
3
+ **Verifiable content provenance — disclosure, not detection.**
4
+
5
+ `madeby` recognizes what a commit *discloses* about its origin, and lets a project gate PRs on that
6
+ disclosure. It never tries to guess whether code is AI — no tool can do that honestly, and
7
+ false-accusing a contributor is worse than the problem. It reports what contributors **put on the
8
+ record**; what a project *requires* is the maintainer's policy, set in a file in the repo.
9
+
10
+ Zero hosted infrastructure. It runs entirely against your local git history — on a laptop or in any
11
+ CI. Nothing leaves your machine.
12
+
13
+ ## Install
14
+
15
+ ```sh
16
+ npx madeby check # no install needed
17
+ # or
18
+ npm i -g madeby
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```
24
+ madeby init Set MadeBy up: write .madeby/policy.json + the CI disclosure check.
25
+ madeby check [<range>] The gate: do commits meet .madeby/policy.json? (a verdict — exit code
26
+ gates). <range> e.g. origin/main..HEAD — a PR's own commits. --json too.
27
+ madeby who [<path>] Made by whom? What's on the record about who made this — one file's
28
+ (alias: whom) origin, or the whole repo with no path. --lines=A-B to scope. --json too.
29
+ madeby ai [<log>] [<ref>] Made by AI: record your AI session's witnessed spans into .madeby/spans.
30
+ madeby me Made by me: affirm you authored HEAD yourself (an Authored-by-human trailer).
31
+ madeby mcp Run the MCP server (stdio) — the tools, agent-callable.
32
+ madeby help
33
+ ```
34
+
35
+ The surface is your product thesis — **"made by ___"**: `who` reads it, `ai` and `me` write the two
36
+ sides of it, and `init`/`check` are the setup and the gate.
37
+
38
+ ### `madeby check` — the disclosure gate
39
+
40
+ Reads `.madeby/policy.json`, recognizes each commit's disclosure signals, and reports coverage.
41
+ A commit **discloses its origin** if it carries any of:
42
+
43
+ - an **AI-authorship trailer** — `Co-Authored-By:` / `Generated-by:` / `Assisted-by:` naming an AI
44
+ tool (Claude Code, Copilot, Cursor, aider, … already emit these);
45
+ - an **affirmative human-authorship trailer** — `Authored-by-human: <you>` (see below);
46
+ - a **DCO `Signed-off-by:`** line;
47
+ - a **commit signature**;
48
+ - a **`madeby ai`** attestation (your own AI session's witnessed spans).
49
+
50
+ Exit codes: **0** = pass · **1** = a `required` policy failed on an undisclosed commit · **2** = not
51
+ a git repository. Under `advisory` it only reports (always exit 0) — so it's safe to add to CI
52
+ before you decide to enforce anything.
53
+
54
+ In CI, omit `<range>` — on a pull-request build `madeby check` **auto-scopes to the PR's own
55
+ commits** from the CI environment (GitHub today; other hosts via their adapter). Pass an explicit
56
+ `<range>` to override.
57
+
58
+ ### `madeby me` — affirm human authorship
59
+
60
+ Disclosure runs both ways: if you wrote code yourself, affirm it so your work is *disclosed-human*,
61
+ not lumped into unknown. `madeby me` adds an `Authored-by-human` trailer to your last commit — the
62
+ symmetric human claim to `madeby ai`. (The "tool" underneath is just git; if you prefer it at commit
63
+ time, `git commit --trailer "Authored-by-human: …"` does the same thing.)
64
+
65
+ ```sh
66
+ madeby me # affirms human authorship of HEAD
67
+ ```
68
+
69
+ Human and AI disclosure ride the **same ladder** — a trailer is *asserted*; sign the commit and it's
70
+ *verified* (the signature authenticates *who* affirmed it, not the human-vs-AI content — equally true
71
+ of AI disclosure); a sworn declaration is *sworn*. The one asymmetry is evidence, not tier: AI can
72
+ leave a re-checkable artifact (a session log, `madeby ai`); human authorship is your firsthand
73
+ testimony. If you used AI, disclose the AI — don't claim human.
74
+
75
+ **The policy file is optional.** With no `.madeby/policy.json`, `check` defaults to **advisory** —
76
+ it reports coverage and never blocks, so you can run it (or add the CI check) with zero config. Add
77
+ the file only when you want to enforce:
78
+
79
+ ```json
80
+ // .madeby/policy.json
81
+ { "version": 0, "mode": "required" }
82
+ ```
83
+
84
+ Two modes, nothing more:
85
+
86
+ - `advisory` — report coverage on each run; never fails. **The default** (and what you get with no file).
87
+ - `required` — fail on any commit that discloses nothing your policy accepts.
88
+ - optional `"accept": ["dco-signoff", "ai-trailer", …]` — restrict what satisfies the policy
89
+ (omit ⇒ any recognized disclosure counts).
90
+
91
+ (There's no "off" — that's just not running the check. Advisory is the floor.)
92
+
93
+ Fail-safe by design: a missing or malformed policy degrades to `advisory`. `madeby` never blocks a PR
94
+ on its own error, and never invents a stricter gate than the maintainer wrote.
95
+
96
+ ## Use it as a PR check
97
+
98
+ A ready-made GitHub Action, an Azure DevOps Pipelines template, and a GitLab CI job wrap
99
+ `madeby check` — nothing hosted, nothing leaves your CI. See
100
+ [`packages/action`](https://github.com/MacDougherty/MadeBy/tree/main/packages/action#readme).
101
+
102
+ ## Extend it anywhere — primitives you run, not code you ship
103
+
104
+ MadeBy is composable primitives, not a plugin host. To support a **new CI host, a custom gate, or
105
+ your own dashboard**, you don't register code with us — you run the primitives **in your own
106
+ environment**:
107
+
108
+ - **`madeby check --json`** — the gate's structured result (`pass`, `mode`, `undisclosed[]`); the
109
+ exit code still gates, so CI can use either.
110
+ - The raw recognizer as a library: [`@madeby/core`](https://www.npmjs.com/package/@madeby/core)
111
+ (`commitDisclosureKinds`, `evaluateDisclosurePolicy`) — per-commit disclosure kinds, no policy.
112
+ Build any view or gate on top, in your own runtime.
113
+
114
+ **A new host needs no adapter from us** — compute the range however that host exposes it and pass it.
115
+ Any CI without a built-in adapter ships nothing to MadeBy; e.g. a Jenkins pipeline:
116
+
117
+ ```groovy
118
+ sh 'npx --yes madeby check "origin/${CHANGE_TARGET}...HEAD"'
119
+ ```
120
+
121
+ We ship built-in adapters (GitHub, Azure DevOps, GitLab) so those hosts are turnkey — the CI env
122
+ auto-scopes the range with no arguments — but they're a *convenience, not the extension path*.
123
+ Whatever you compose can only report what the primitives permit, so the trust guarantees hold no
124
+ matter who runs them.
125
+
126
+ ## Agent-native — the MCP server
127
+
128
+ `madeby mcp` runs a [Model Context Protocol](https://modelcontextprotocol.io) server over stdio, so
129
+ an AI agent can use MadeBy with no human in the loop. It exposes the same primitives as typed tools:
130
+
131
+ - **`init`** `{ path?, mode?, host? }` — set a repo up: create `.madeby/policy.json` + the CI check
132
+ (idempotent). The one-call setup. *write*
133
+ - **`check`** `{ path?, range? }` — the gate: do commits meet the policy? Returns `pass`, `mode`,
134
+ `undisclosed[]`. *read (verdict)*
135
+ - **`who`** `{ path?, repo?, startLine?, endLine?, prefix?, commitLimit? }` — made by whom? With a
136
+ `path`: what's *on the record* about that file's origin — witnessed AI spans (model/tool) where
137
+ captured, last-touch commit disclosure elsewhere, unknown otherwise. With no `path`: the repo-wide
138
+ map an agent reads *before* it works (the witnessed AI surface + commit-level coverage; cheap). The
139
+ line range is the contract — for a symbol, turn it into a range with your own tooling
140
+ (tree-sitter/LSP); MadeBy never parses code. *read (attribution)*
141
+ - **`ai`** `{ path?, log?, ref? }` — made by AI: record witnessed AI spans from the agent's own
142
+ session log into `.madeby/spans` (asserted tier, local; only spans structurally present are kept).
143
+ *write*
144
+
145
+ (`me` — affirming *human* authorship — is a CLI command, not an agent tool: an agent is AI, so it
146
+ discloses with `ai`, never `me`.)
147
+
148
+ The server is also **self-teaching** via MCP resources, so an agent can discover *how* to align a
149
+ repo, not just which verbs exist:
150
+
151
+ - **`madeby://guide/align`** — the step-by-step alignment workflow.
152
+ - **`madeby://guide/enforce`** — the exact commands to make the check *required* on a protected branch
153
+ (GitHub / Azure) — the host's control plane, so MadeBy doesn't do it for you, but it's not left to
154
+ the reader either.
155
+ - **`madeby://guide/backfill`** — how to account for pre-adoption history *honestly*: recognize
156
+ what's already disclosed, attach recoverable evidence, set an adoption boundary; unknown stays
157
+ unknown, never fabricated.
158
+ - **`madeby://schema/policy`** — the `.madeby/policy.json` schema.
159
+
160
+ So "align my repo with MadeBy" is fully agent-serviceable: the agent reads the guide, calls **`init`**
161
+ to write the policy + CI check, records its own AI work with **`ai`**, and verifies with **`check`** —
162
+ no human in the loop. (Two things stay outside the tools, by design: turning on branch protection is
163
+ the *host's* setting, and historical commits are never backfilled — disclosure is going-forward.
164
+ `ai` cannot claim a higher tier or attribute to anyone else, and nothing leaves the machine.)
165
+
166
+ Point an MCP client at the command (e.g. a `claude_desktop_config.json` / `.mcp.json` entry):
167
+
168
+ ```json
169
+ { "mcpServers": { "madeby": { "command": "npx", "args": ["-y", "madeby", "mcp"] } } }
170
+ ```
171
+
172
+ Dependency-free and self-contained: stdout carries only protocol messages, an unreadable repo or bad
173
+ input comes back as a tool error (the agent sees it, never a crash), and — like every surface — the
174
+ tools can only report what the primitives permit.
175
+
176
+ ## Honest scope
177
+
178
+ Disclosure and accountability, **not** an AI slop-blocker or detector. A `required` gate deters
179
+ low-effort drive-bys (as the DCO does) and gives a basis to triage — it does not, and will never,
180
+ claim to detect AI.
181
+
182
+ MIT · part of [MadeBy](https://github.com/MacDougherty/MadeBy)