madeby 0.1.0 → 0.2.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.
- package/dist/madeby.mjs +25 -6
- package/package.json +1 -1
package/dist/madeby.mjs
CHANGED
|
@@ -1633,11 +1633,20 @@ function aiCommand(args) {
|
|
|
1633
1633
|
|
|
1634
1634
|
// src/commands/me.ts
|
|
1635
1635
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
1636
|
+
function parseWithAi(args) {
|
|
1637
|
+
const i = args.findIndex((a2) => a2 === "--with-ai" || a2.startsWith("--with-ai="));
|
|
1638
|
+
if (i === -1) return { withAi: false, tool: "AI" };
|
|
1639
|
+
const a = args[i];
|
|
1640
|
+
if (a.startsWith("--with-ai=")) return { withAi: true, tool: a.slice("--with-ai=".length).trim() || "AI" };
|
|
1641
|
+
const next = args[i + 1];
|
|
1642
|
+
return { withAi: true, tool: next && !next.startsWith("-") ? next : "AI" };
|
|
1643
|
+
}
|
|
1636
1644
|
function git3(root, args) {
|
|
1637
1645
|
return execFileSync5("git", ["-C", root, ...args], { encoding: "utf8" }).trim();
|
|
1638
1646
|
}
|
|
1639
1647
|
var HUMAN_ATTEST = /^[ \t]*(?:Authored-by-human|Human-authored(?:-by)?)[ \t]*:/im;
|
|
1640
|
-
function meCommand(
|
|
1648
|
+
function meCommand(args) {
|
|
1649
|
+
const { withAi, tool } = parseWithAi(args);
|
|
1641
1650
|
const root = repoRoot();
|
|
1642
1651
|
if (!root) {
|
|
1643
1652
|
console.error("madeby me: not a git repository.");
|
|
@@ -1673,13 +1682,21 @@ function meCommand(_args) {
|
|
|
1673
1682
|
process.exit(1);
|
|
1674
1683
|
return;
|
|
1675
1684
|
}
|
|
1676
|
-
|
|
1677
|
-
|
|
1685
|
+
const hasHuman = HUMAN_ATTEST.test(message);
|
|
1686
|
+
const hasAssist = /^[ \t]*Assisted-by[ \t]*:/im.test(message);
|
|
1687
|
+
const trailers = [];
|
|
1688
|
+
if (!hasHuman) trailers.push("--trailer", `Authored-by-human: ${name} <${email}>`);
|
|
1689
|
+
if (withAi && !hasAssist) trailers.push("--trailer", `Assisted-by: ${tool}`);
|
|
1690
|
+
if (trailers.length === 0) {
|
|
1691
|
+
const already = withAi ? "already affirms human authorship and discloses AI assistance" : "already affirms human authorship";
|
|
1692
|
+
console.log(`madeby me: HEAD ${already}. Nothing to do.`);
|
|
1678
1693
|
process.exit(0);
|
|
1679
1694
|
return;
|
|
1680
1695
|
}
|
|
1681
|
-
execFileSync5("git", ["-C", root, "commit", "--amend", "--no-edit",
|
|
1682
|
-
console.log(
|
|
1696
|
+
execFileSync5("git", ["-C", root, "commit", "--amend", "--no-edit", ...trailers]);
|
|
1697
|
+
console.log(
|
|
1698
|
+
withAi ? `madeby me: made by me, with AI \u2014 affirmed human authorship + disclosed AI assistance on HEAD \u2014 "${subject}" (Authored-by-human: ${name}; Assisted-by: ${tool}).` : `madeby me: affirmed human authorship on HEAD \u2014 "${subject}" (Authored-by-human: ${name}).`
|
|
1699
|
+
);
|
|
1683
1700
|
}
|
|
1684
1701
|
|
|
1685
1702
|
// src/commands/who.ts
|
|
@@ -1741,7 +1758,7 @@ jobs:
|
|
|
1741
1758
|
- uses: actions/checkout@v4
|
|
1742
1759
|
with:
|
|
1743
1760
|
fetch-depth: 0
|
|
1744
|
-
- uses: MacDougherty/MadeBy/packages/action@v0.
|
|
1761
|
+
- uses: MacDougherty/MadeBy/packages/action@v0.2.0
|
|
1745
1762
|
`;
|
|
1746
1763
|
function writeIfAbsent(abs, rel, content, created, skipped) {
|
|
1747
1764
|
if (existsSync3(abs)) {
|
|
@@ -2054,6 +2071,8 @@ Usage:
|
|
|
2054
2071
|
<log> defaults to the auto-discovered Claude Code transcript.
|
|
2055
2072
|
madeby me Made by me: affirm you authored HEAD yourself (an Authored-by-human
|
|
2056
2073
|
trailer \u2014 the symmetric human claim to \`ai\`).
|
|
2074
|
+
madeby me --with-ai [tool] Made by me, with AI: also disclose AI assistance (Assisted-by:
|
|
2075
|
+
<tool>, default "AI") \u2014 the assisted middle state, classified with_ai.
|
|
2057
2076
|
madeby mcp Run the MCP server (stdio) \u2014 the tools, agent-callable.
|
|
2058
2077
|
madeby help Show this help.
|
|
2059
2078
|
|
package/package.json
CHANGED