madeby 0.3.10 → 0.3.11
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 +1 -1
- package/dist/madeby.mjs +38 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -156,7 +156,7 @@ Two modes, nothing more:
|
|
|
156
156
|
- optional `"recordModel": true` — written by `madeby init --record-model`: the repo asks AI
|
|
157
157
|
disclosures to name the model version as well as the tool. It adds one line to the AGENTS.md rule,
|
|
158
158
|
and `me --with-ai` / `ai` then read the model from the **tool's own record of the session** — Cursor's
|
|
159
|
-
`CURSOR_MODEL
|
|
159
|
+
`CURSOR_MODEL` or its chat store, the Copilot CLI and Claude Code session logs (locally; only the model id is read) —
|
|
160
160
|
which wins over an agent's `--model`, since an agent routed by "Auto" may not know which model served
|
|
161
161
|
it. Elsewhere `--model <version>` is used, never guessed. So `coverage` can list each **agent · model** pairing
|
|
162
162
|
(`Cursor · gpt-5.3-codex` vs `Claude Code · claude-sonnet-5`). A request, not a gate — an AI
|
package/dist/madeby.mjs
CHANGED
|
@@ -127,11 +127,12 @@ function classifyCommit(commit) {
|
|
|
127
127
|
const botText = `${commit.authorName ?? ""} ${commit.authorEmail ?? ""}`.trim();
|
|
128
128
|
const agentAi = botText ? matchAi(botText) : null;
|
|
129
129
|
if (agentAi) {
|
|
130
|
+
const named = [...commit.message.matchAll(AI_AUTHOR_TRAILER), ...commit.message.matchAll(TRAILER_RE)].map((m) => matchAiTrailer(m[1].trim())).filter((c) => c !== null);
|
|
130
131
|
return {
|
|
131
132
|
class: "ai",
|
|
132
133
|
confidence: CONF_AI,
|
|
133
|
-
signals: [`author:${agentAi.provider}`],
|
|
134
|
-
aiContributors: [{ ...agentAi, raw: botText }]
|
|
134
|
+
signals: [`author:${agentAi.provider}`, ...named.map((c) => `trailer:${c.provider}`)],
|
|
135
|
+
aiContributors: [{ ...agentAi, raw: botText }, ...named]
|
|
135
136
|
};
|
|
136
137
|
}
|
|
137
138
|
return { class: "bot", confidence: CONF_BOT, signals: ["author:bot"], aiContributors };
|
|
@@ -1833,12 +1834,13 @@ To disclose: add a Co-Authored-By / Generated-by trailer, affirm your own author
|
|
|
1833
1834
|
|
|
1834
1835
|
// src/commands/me.ts
|
|
1835
1836
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
1836
|
-
import { existsSync as existsSync5, readFileSync as
|
|
1837
|
+
import { existsSync as existsSync5, readFileSync as readFileSync7 } from "node:fs";
|
|
1837
1838
|
import { homedir as homedir3 } from "node:os";
|
|
1838
1839
|
import { join as join6 } from "node:path";
|
|
1839
1840
|
|
|
1840
1841
|
// src/model-source.ts
|
|
1841
|
-
import {
|
|
1842
|
+
import { createHash } from "node:crypto";
|
|
1843
|
+
import { closeSync, existsSync as existsSync4, openSync, readdirSync as readdirSync3, readFileSync as readFileSync6, readSync, statSync as statSync2 } from "node:fs";
|
|
1842
1844
|
import { homedir as homedir2 } from "node:os";
|
|
1843
1845
|
import { join as join5 } from "node:path";
|
|
1844
1846
|
var SESSION_ID = /^[0-9a-f-]{8,64}$/i;
|
|
@@ -1859,11 +1861,32 @@ function lastModelIn(path) {
|
|
|
1859
1861
|
if (fd !== void 0) closeSync(fd);
|
|
1860
1862
|
}
|
|
1861
1863
|
}
|
|
1864
|
+
var RECENT_MS = 30 * 60 * 1e3;
|
|
1865
|
+
function cursorChatModel(home, cwd) {
|
|
1866
|
+
const dir = join5(home, ".cursor", "chats", createHash("md5").update(cwd).digest("hex"));
|
|
1867
|
+
try {
|
|
1868
|
+
const chats = readdirSync3(dir).map((c) => ({ c, t: statSync2(join5(dir, c)).mtimeMs })).sort((a, b) => b.t - a.t);
|
|
1869
|
+
const newest = chats[0];
|
|
1870
|
+
if (!newest || Date.now() - newest.t > RECENT_MS) return null;
|
|
1871
|
+
const db = join5(dir, newest.c, "store.db");
|
|
1872
|
+
if (!existsSync4(db) || statSync2(db).size > 64 * 1024 * 1024) return null;
|
|
1873
|
+
const names = new Set([...readFileSync6(db).toString("latin1").matchAll(/"modelName"\s*:\s*"([^"]{1,80})"/g)].map((m) => m[1]));
|
|
1874
|
+
return names.size === 1 ? [...names][0] : null;
|
|
1875
|
+
} catch {
|
|
1876
|
+
return null;
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1862
1879
|
var MODEL_SOURCES = [
|
|
1863
1880
|
{
|
|
1864
1881
|
tool: "Cursor",
|
|
1865
1882
|
matches: /\bcursor/i,
|
|
1866
|
-
|
|
1883
|
+
// Cursor's agent shell sets CURSOR_MODEL — but not always (none of four Auto trials saw it), so its
|
|
1884
|
+
// chat store is the second witness. Either is the tool's record, not the agent's guess.
|
|
1885
|
+
detect: (env, home, cwd) => {
|
|
1886
|
+
if (env.CURSOR_AGENT === "1" && env.CURSOR_MODEL?.trim()) return { model: env.CURSOR_MODEL.trim(), source: "Cursor's CURSOR_MODEL" };
|
|
1887
|
+
const model = cursorChatModel(home, cwd);
|
|
1888
|
+
return model ? { model, source: "Cursor's chat store" } : null;
|
|
1889
|
+
}
|
|
1867
1890
|
},
|
|
1868
1891
|
{
|
|
1869
1892
|
tool: "GitHub Copilot CLI",
|
|
@@ -1897,11 +1920,11 @@ var MODEL_SOURCES = [
|
|
|
1897
1920
|
}
|
|
1898
1921
|
}
|
|
1899
1922
|
];
|
|
1900
|
-
function detectAgentModel(tool, env = process.env, home = homedir2()) {
|
|
1923
|
+
function detectAgentModel(tool, env = process.env, home = homedir2(), cwd = process.cwd()) {
|
|
1901
1924
|
const generic = /^(?:AI|an? AI)$/i.test(tool.trim());
|
|
1902
1925
|
for (const s of MODEL_SOURCES) {
|
|
1903
1926
|
if (!generic && !s.matches.test(tool)) continue;
|
|
1904
|
-
const hit = s.detect(env, home);
|
|
1927
|
+
const hit = s.detect(env, home, cwd);
|
|
1905
1928
|
if (hit) return { tool: generic ? s.tool : tool, ...hit };
|
|
1906
1929
|
}
|
|
1907
1930
|
return null;
|
|
@@ -1938,14 +1961,14 @@ function recordsModel(root) {
|
|
|
1938
1961
|
const p = join6(root, ".madeby", "policy.json");
|
|
1939
1962
|
if (!existsSync5(p)) return false;
|
|
1940
1963
|
try {
|
|
1941
|
-
return parseDisclosurePolicy(JSON.parse(
|
|
1964
|
+
return parseDisclosurePolicy(JSON.parse(readFileSync7(p, "utf8"))).recordModel === true;
|
|
1942
1965
|
} catch {
|
|
1943
1966
|
return false;
|
|
1944
1967
|
}
|
|
1945
1968
|
}
|
|
1946
1969
|
function resolveAi(root, o) {
|
|
1947
1970
|
const tool = o.tool && o.tool.trim() || "AI";
|
|
1948
|
-
const detected = recordsModel(root) ? detectAgentModel(tool, o.env ?? process.env, o.home ?? homedir3()) : null;
|
|
1971
|
+
const detected = recordsModel(root) ? detectAgentModel(tool, o.env ?? process.env, o.home ?? homedir3(), o.cwd ?? process.cwd()) : null;
|
|
1949
1972
|
if (detected) return { value: aiValue(detected.tool, detected.model), tool: detected.tool, model: detected.model, modelSource: detected.source };
|
|
1950
1973
|
const model = o.model?.trim() || void 0;
|
|
1951
1974
|
return { value: aiValue(tool, model), tool, ...model ? { model, modelSource: "as given (--model)" } : {} };
|
|
@@ -2213,13 +2236,13 @@ function whoCommand(args) {
|
|
|
2213
2236
|
}
|
|
2214
2237
|
|
|
2215
2238
|
// src/commands/coverage.ts
|
|
2216
|
-
import { existsSync as existsSync6, readFileSync as
|
|
2239
|
+
import { existsSync as existsSync6, readFileSync as readFileSync8 } from "node:fs";
|
|
2217
2240
|
import { join as join7 } from "node:path";
|
|
2218
2241
|
function policyIsRequired(root) {
|
|
2219
2242
|
const p = join7(root, ".madeby", "policy.json");
|
|
2220
2243
|
if (!existsSync6(p)) return false;
|
|
2221
2244
|
try {
|
|
2222
|
-
return parseDisclosurePolicy(JSON.parse(
|
|
2245
|
+
return parseDisclosurePolicy(JSON.parse(readFileSync8(p, "utf8"))).mode === "required";
|
|
2223
2246
|
} catch {
|
|
2224
2247
|
return false;
|
|
2225
2248
|
}
|
|
@@ -2281,7 +2304,7 @@ function coverageCommand(args) {
|
|
|
2281
2304
|
}
|
|
2282
2305
|
|
|
2283
2306
|
// src/init-repo.ts
|
|
2284
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as
|
|
2307
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync9, writeFileSync as writeFileSync2 } from "node:fs";
|
|
2285
2308
|
import { dirname as dirname2, join as join8 } from "node:path";
|
|
2286
2309
|
var ACO_VERSION = 2;
|
|
2287
2310
|
var ACO_OPEN = `<!-- madeby:aco v${ACO_VERSION} -->`;
|
|
@@ -2357,7 +2380,7 @@ function ensurePolicy(abs, rel, want, res) {
|
|
|
2357
2380
|
}
|
|
2358
2381
|
let raw;
|
|
2359
2382
|
try {
|
|
2360
|
-
raw = JSON.parse(
|
|
2383
|
+
raw = JSON.parse(readFileSync9(abs, "utf8"));
|
|
2361
2384
|
} catch {
|
|
2362
2385
|
res.skipped.push(rel);
|
|
2363
2386
|
return { mode: "advisory", recordModel: false, malformed: true };
|
|
@@ -2387,7 +2410,7 @@ ${block}`);
|
|
|
2387
2410
|
res.created.push(rel);
|
|
2388
2411
|
return;
|
|
2389
2412
|
}
|
|
2390
|
-
const content =
|
|
2413
|
+
const content = readFileSync9(abs, "utf8");
|
|
2391
2414
|
const status = acoStatus(content);
|
|
2392
2415
|
const loc = findAcoBlock(content);
|
|
2393
2416
|
if (status === "absent") {
|
|
@@ -2506,7 +2529,7 @@ madeby init \u2014 policy: ${r.policyMode}${r.recordModel ? " + records model" :
|
|
|
2506
2529
|
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
2507
2530
|
import { createInterface } from "node:readline";
|
|
2508
2531
|
var DEFAULT_PROTOCOL = "2024-11-05";
|
|
2509
|
-
var SERVER_INFO = { name: "madeby", version: "0.3.
|
|
2532
|
+
var SERVER_INFO = { name: "madeby", version: "0.3.11" };
|
|
2510
2533
|
function rootFor(path) {
|
|
2511
2534
|
const cwd = path && path.length ? path : process.cwd();
|
|
2512
2535
|
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
|
+
"version": "0.3.11",
|
|
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",
|