madeby 0.3.9 → 0.3.10

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.
package/README.md CHANGED
@@ -54,6 +54,9 @@ madeby ai [tool] Made by AI: attest AI authorship of HEAD (an Auth
54
54
  `--witness [log]` instead records witnessed spans from a session log.
55
55
  madeby me [--with-ai [t]] Made by me: affirm you authored HEAD (Authored-by-human); --with-ai adds
56
56
  Assisted-by → with_ai. --model <version> names the model too.
57
+ --print (me / ai) print the trailer lines instead of amending HEAD — for a
58
+ platform that makes the commit itself (a cloud coding agent):
59
+ git commit -m "<msg>" -m "$(madeby ai <tool> --print)".
57
60
  madeby mcp Run the MCP server (stdio) — the tools, agent-callable.
58
61
  madeby help
59
62
  ```
package/dist/madeby.mjs CHANGED
@@ -1872,7 +1872,7 @@ var MODEL_SOURCES = [
1872
1872
  const id = env.COPILOT_AGENT_SESSION_ID;
1873
1873
  if (env.COPILOT_CLI !== "1" || !id || !SESSION_ID.test(id)) return null;
1874
1874
  const model = lastModelIn(join5(home, ".copilot", "session-state", id, "events.jsonl"));
1875
- return model ? { model, source: "Copilot CLI's session log" } : null;
1875
+ return model ? { model, source: "Copilot's session log" } : null;
1876
1876
  }
1877
1877
  },
1878
1878
  {
@@ -1979,6 +1979,24 @@ function attestAiAuthorship(root, opts = {}) {
1979
1979
  }
1980
1980
  return { ...base, ok: true, changed: trailers.length > 0, subject, added };
1981
1981
  }
1982
+ function disclosureTrailers(root, opts) {
1983
+ if (opts.category === "ai") {
1984
+ const ai2 = resolveAi(root, opts);
1985
+ return { ok: true, lines: [`Authored-by-ai: ${ai2.value}`], model: ai2.model, modelSource: ai2.modelSource };
1986
+ }
1987
+ let name = "";
1988
+ let email = "";
1989
+ try {
1990
+ name = git3(root, ["config", "user.name"]);
1991
+ email = git3(root, ["config", "user.email"]);
1992
+ } catch {
1993
+ }
1994
+ if (!name || !email) return { ok: false, reason: "no-identity", lines: [] };
1995
+ const lines = [`Authored-by-human: ${name} <${email}>`];
1996
+ if (opts.category === "human") return { ok: true, lines };
1997
+ const ai = resolveAi(root, opts);
1998
+ return { ok: true, lines: [...lines, `Assisted-by: ${ai.value}`], model: ai.model, modelSource: ai.modelSource };
1999
+ }
1982
2000
  function affirmAuthorship(root, opts = {}) {
1983
2001
  const withAi = opts.withAi ?? false;
1984
2002
  const ai = withAi ? resolveAi(root, opts) : void 0;
@@ -2037,6 +2055,16 @@ function meCommand(args) {
2037
2055
  process.exit(2);
2038
2056
  return;
2039
2057
  }
2058
+ if (args.includes("--print")) {
2059
+ const t = disclosureTrailers(root, { category: withAi ? "with_ai" : "human", tool, model });
2060
+ if (!t.ok) {
2061
+ console.error("madeby me: set your git identity first (git config user.name / user.email).");
2062
+ process.exit(1);
2063
+ return;
2064
+ }
2065
+ console.log(t.lines.join("\n"));
2066
+ return;
2067
+ }
2040
2068
  const r = affirmAuthorship(root, { withAi, tool, model });
2041
2069
  if (!r.ok) {
2042
2070
  if (r.reason === "no-identity") console.error("madeby me: set your git identity first (git config user.name / user.email).");
@@ -2111,6 +2139,10 @@ function aiCommand(args) {
2111
2139
  return;
2112
2140
  }
2113
2141
  const tool = positional[0] || "AI";
2142
+ if (args.includes("--print")) {
2143
+ console.log(disclosureTrailers(root, { category: "ai", tool, model }).lines.join("\n"));
2144
+ return;
2145
+ }
2114
2146
  const r = attestAiAuthorship(root, { tool, model });
2115
2147
  if (!r.ok) {
2116
2148
  if (r.reason === "staged-changes") {
@@ -2251,7 +2283,7 @@ function coverageCommand(args) {
2251
2283
  // src/init-repo.ts
2252
2284
  import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync8, writeFileSync as writeFileSync2 } from "node:fs";
2253
2285
  import { dirname as dirname2, join as join8 } from "node:path";
2254
- var ACO_VERSION = 1;
2286
+ var ACO_VERSION = 2;
2255
2287
  var ACO_OPEN = `<!-- madeby:aco v${ACO_VERSION} -->`;
2256
2288
  var ACO_CLOSE = `<!-- /madeby:aco -->`;
2257
2289
  var ACO_OPEN_RE = /<!-- madeby:aco(?: v(\d+))? -->/;
@@ -2265,6 +2297,10 @@ After you commit, run the command for the honest category (no install, no setup)
2265
2297
  - **with_ai** \u2014 a human authored it with AI assistance: \`npx madeby@latest me --with-ai [tool]\`
2266
2298
  - **human** \u2014 a human authored it: \`npx madeby@latest me\`
2267
2299
 
2300
+ If your platform makes the commit for you (a cloud coding agent that pushes through its own tool),
2301
+ amending afterwards can be lost \u2014 put the disclosure in the message instead, with \`--print\`:
2302
+ \`git commit -m "<message>" -m "$(npx madeby@latest ai [tool] --print)"\`.
2303
+
2268
2304
  Disclose per commit, honestly. Undisclosed content stays *unknown*, never guessed.
2269
2305
  `;
2270
2306
  var MODEL_LINE = `
@@ -2470,7 +2506,7 @@ madeby init \u2014 policy: ${r.policyMode}${r.recordModel ? " + records model" :
2470
2506
  import { execFileSync as execFileSync6 } from "node:child_process";
2471
2507
  import { createInterface } from "node:readline";
2472
2508
  var DEFAULT_PROTOCOL = "2024-11-05";
2473
- var SERVER_INFO = { name: "madeby", version: "0.3.9" };
2509
+ var SERVER_INFO = { name: "madeby", version: "0.3.10" };
2474
2510
  function rootFor(path) {
2475
2511
  const cwd = path && path.length ? path : process.cwd();
2476
2512
  return execFileSync6("git", ["-C", cwd, "-c", "core.quotePath=false", "rev-parse", "--show-toplevel"], { encoding: "utf8" }).trim();
@@ -2544,6 +2580,7 @@ var TOOLS = [
2544
2580
  category: { enum: ["human", "with_ai", "ai"], description: "the honest authorship category (see the description). Defaults from with_ai if omitted." },
2545
2581
  with_ai: { type: "boolean", description: "legacy shorthand: true \u21D2 category with_ai, false \u21D2 human. Prefer `category`." },
2546
2582
  tool: { type: "string", description: "the AI tool to name (Assisted-by for with_ai, Authored-by-ai for ai). Default: AI." },
2583
+ print: { type: "boolean", description: "return the disclosure trailer lines instead of amending HEAD \u2014 for platforms that make the commit themselves; put them in the commit message's last paragraph" },
2547
2584
  model: { type: "string", description: "the model version you are running as, e.g. claude-sonnet-5 \u2014 written as tool:model. Give it when the repo's AGENTS.md asks; omit it rather than guess." }
2548
2585
  }
2549
2586
  },
@@ -2552,6 +2589,10 @@ var TOOLS = [
2552
2589
  const tool = args.tool;
2553
2590
  const model = args.model;
2554
2591
  const category = args.category;
2592
+ if (args.print === true) {
2593
+ const c = category === "ai" ? "ai" : category === "with_ai" || args.with_ai === true ? "with_ai" : "human";
2594
+ return disclosureTrailers(root, { category: c, tool, model });
2595
+ }
2555
2596
  if (category === "ai") return attestAiAuthorship(root, { tool, model });
2556
2597
  const withAi = category === "with_ai" || args.with_ai === true;
2557
2598
  return affirmAuthorship(root, { withAi, tool, model: withAi ? model : void 0 });
@@ -2793,6 +2834,8 @@ Usage:
2793
2834
  madeby me --with-ai [tool] Made by me, with AI: also disclose AI assistance (Assisted-by:
2794
2835
  <tool>, default "AI") \u2014 the assisted middle state, classified with_ai.
2795
2836
  --model <version> names the model too (Assisted-by: <tool>:<version>).
2837
+ --print (me / ai) prints the trailer lines instead of amending HEAD,
2838
+ for the commit message itself: git commit -m <msg> -m "$(madeby ai <tool> --print)".
2796
2839
  madeby mcp Run the MCP server (stdio) \u2014 the tools, agent-callable.
2797
2840
  madeby help Show this help.
2798
2841
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "madeby",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "mcpName": "io.github.MadeByFYI/madeby",
5
5
  "description": "Disclose AI authorship of code. `npx madeby ai` adds an Authored-by-ai git trailer; AI coding agents disclose per the ACO standard (human/with_ai/ai) from an AGENTS.md convention. Disclosure, not detection. Gate PRs with `madeby check`.",
6
6
  "license": "MIT",