madeby 0.3.3 → 0.3.4

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 (2) hide show
  1. package/dist/madeby.mjs +42 -7
  2. package/package.json +1 -1
package/dist/madeby.mjs CHANGED
@@ -1880,8 +1880,9 @@ function whoCommand(args) {
1880
1880
  }
1881
1881
 
1882
1882
  // src/init-repo.ts
1883
- import { existsSync as existsSync4, mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
1883
+ import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync6, writeFileSync as writeFileSync2 } from "node:fs";
1884
1884
  import { dirname as dirname2, join as join5 } from "node:path";
1885
+ var ACO_SENTINEL = "<!-- madeby:aco -->";
1885
1886
  var GH_WORKFLOW = `name: Disclosure
1886
1887
  on: pull_request
1887
1888
  jobs:
@@ -1894,6 +1895,7 @@ jobs:
1894
1895
  - uses: MadeByFYI/MadeBy/packages/action@v0.2.0
1895
1896
  `;
1896
1897
  var AGENTS_CONVENTION = `# AGENTS.md \u2014 Authorship disclosure convention (ACO)
1898
+ ${ACO_SENTINEL}
1897
1899
 
1898
1900
  This repository asks any AI agent \u2014 or a human working with one \u2014 to **disclose who authored the
1899
1901
  changes they make**, per **ACO, the Authorship Certificate of Origin**
@@ -1921,6 +1923,17 @@ After you commit, run the matching command (works with no install via \`npx\`):
1921
1923
 
1922
1924
  Undisclosed content stays *unknown*, never guessed. See ACO for the standard.
1923
1925
  `;
1926
+ var ACO_SECTION = `
1927
+ ${ACO_SENTINEL}
1928
+ ## Authorship disclosure (ACO)
1929
+
1930
+ Disclose who authored your changes, per [ACO](https://github.com/MadeByFYI/MadeBy/blob/main/ACO.md).
1931
+ After committing, run the command for the honest category (no install needed):
1932
+
1933
+ - **ai** \u2014 an AI authored it (the committer stays accountable): \`npx madeby@latest ai [tool]\`
1934
+ - **with_ai** \u2014 a human authored it with AI assistance: \`npx madeby@latest me --with-ai [tool]\`
1935
+ - **human** \u2014 a human authored it: \`npx madeby@latest me\`
1936
+ `;
1924
1937
  function writeIfAbsent(abs, rel, content, created, skipped) {
1925
1938
  if (existsSync4(abs)) {
1926
1939
  skipped.push(rel);
@@ -1930,21 +1943,42 @@ function writeIfAbsent(abs, rel, content, created, skipped) {
1930
1943
  writeFileSync2(abs, content);
1931
1944
  created.push(rel);
1932
1945
  }
1946
+ function ensureAco(abs, rel, res, opts) {
1947
+ if (!existsSync4(abs)) {
1948
+ if (!opts.createIfAbsent) return;
1949
+ mkdirSync2(dirname2(abs), { recursive: true });
1950
+ writeFileSync2(abs, AGENTS_CONVENTION);
1951
+ res.created.push(rel);
1952
+ return;
1953
+ }
1954
+ const current = readFileSync6(abs, "utf8");
1955
+ if (current.includes(ACO_SENTINEL)) {
1956
+ res.skipped.push(rel);
1957
+ return;
1958
+ }
1959
+ const sep = current.endsWith("\n") ? "\n" : "\n\n";
1960
+ writeFileSync2(abs, current + sep + ACO_SECTION);
1961
+ res.merged.push(rel);
1962
+ }
1933
1963
  function initRepo(root, opts = {}) {
1934
1964
  const mode = opts.mode ?? "advisory";
1935
1965
  const host = opts.host ?? "github";
1936
1966
  const created = [];
1937
1967
  const skipped = [];
1968
+ const merged = [];
1969
+ const res = { created, skipped, merged };
1938
1970
  writeIfAbsent(join5(root, ".madeby", "policy.json"), ".madeby/policy.json", JSON.stringify({ version: 0, mode }, null, 2) + "\n", created, skipped);
1939
- writeIfAbsent(join5(root, "AGENTS.md"), "AGENTS.md", AGENTS_CONVENTION, created, skipped);
1971
+ ensureAco(join5(root, "AGENTS.md"), "AGENTS.md", res, { createIfAbsent: true });
1972
+ ensureAco(join5(root, "CLAUDE.md"), "CLAUDE.md", res, { createIfAbsent: false });
1940
1973
  if (host === "github") {
1941
1974
  writeIfAbsent(join5(root, ".github", "workflows", "disclosure.yml"), ".github/workflows/disclosure.yml", GH_WORKFLOW, created, skipped);
1942
1975
  }
1943
1976
  const nextSteps = ["Commit the created files."];
1944
1977
  if (created.includes("AGENTS.md")) {
1945
- nextSteps.push("An AGENTS.md ACO convention was added \u2014 agents that read it disclose authorship (e.g. 'npx madeby@latest me --with-ai <tool>'). Tune it to your repo's tools.");
1946
- } else if (skipped.includes("AGENTS.md")) {
1947
- nextSteps.push("You already have an AGENTS.md \u2014 add the ACO disclosure rule to it (reference: https://github.com/MadeByFYI/MadeBy/blob/main/AGENTS.md).");
1978
+ nextSteps.push("An AGENTS.md ACO convention was added \u2014 agents that read it disclose authorship (e.g. 'npx madeby@latest ai [tool]'). Tune it to your repo's tools.");
1979
+ }
1980
+ if (merged.length > 0) {
1981
+ nextSteps.push(`Merged the ACO disclosure rule into your existing ${merged.join(" + ")} \u2014 review the appended "Authorship disclosure (ACO)" section and tune it to your repo.`);
1948
1982
  }
1949
1983
  if (host === "azure-devops") {
1950
1984
  nextSteps.push("Add the Azure Pipelines template (packages/action/azure-pipelines-disclosure.yml) and wire it as a PR build-validation branch policy.");
@@ -1956,7 +1990,7 @@ function initRepo(root, opts = {}) {
1956
1990
  }
1957
1991
  nextSteps.push("Contributors disclose origin with a Co-Authored-By / Generated-by trailer (AI), an Authored-by-human trailer ('madeby me'), an Authored-by-ai trailer ('madeby ai' \u2014 AI authored, committer accountable), a DCO Signed-off-by, or a signed commit. Evidence upgrade: 'madeby ai --witness' records your own AI session's witnessed spans.");
1958
1992
  nextSteps.push("Existing history is accounted for honestly, not fabricated: run 'madeby check' over full history to recognize what's already disclosed; pre-adoption commits stay unknown. See madeby://guide/backfill.");
1959
- return { created, skipped, policyMode: mode, host, nextSteps };
1993
+ return { created, skipped, merged, policyMode: mode, host, nextSteps };
1960
1994
  }
1961
1995
 
1962
1996
  // src/commands/init.ts
@@ -1972,6 +2006,7 @@ function initCommand(args) {
1972
2006
  const host = hostIdx >= 0 ? args[hostIdx + 1] : void 0;
1973
2007
  const r = initRepo(root, { mode, host });
1974
2008
  for (const f of r.created) console.log(` + ${f}`);
2009
+ for (const f of r.merged) console.log(` ~ ${f} (merged in the ACO rule)`);
1975
2010
  for (const f of r.skipped) console.log(` \xB7 ${f} (exists \u2014 left as-is)`);
1976
2011
  console.log(`
1977
2012
  madeby init \u2014 policy: ${r.policyMode}, host: ${r.host}`);
@@ -1983,7 +2018,7 @@ madeby init \u2014 policy: ${r.policyMode}, host: ${r.host}`);
1983
2018
  import { execFileSync as execFileSync6 } from "node:child_process";
1984
2019
  import { createInterface } from "node:readline";
1985
2020
  var DEFAULT_PROTOCOL = "2024-11-05";
1986
- var SERVER_INFO = { name: "madeby", version: "0.3.3" };
2021
+ var SERVER_INFO = { name: "madeby", version: "0.3.4" };
1987
2022
  function rootFor(path) {
1988
2023
  const cwd = path && path.length ? path : process.cwd();
1989
2024
  return execFileSync6("git", ["-C", cwd, "-c", "core.quotePath=false", "rev-parse", "--show-toplevel"], { encoding: "utf8" }).trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "madeby",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
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",