@rachel_rotenberg/ai-contribution-tracker 1.0.17 → 1.0.18
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/index.ts +9 -1
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -60,6 +60,13 @@ function loadState(g: string): TrackerState {
|
|
|
60
60
|
}
|
|
61
61
|
function saveState(g: string, s: TrackerState) { s.lastUpdated = new Date().toISOString(); fs.writeFileSync(getStatePath(g), JSON.stringify(s, null, 2)); }
|
|
62
62
|
function formatK(n: number) { return n >= 1000 ? `${Math.round(n / 1000)}k` : String(n); }
|
|
63
|
+
function buildCoAuthoredBy(s: TrackerState): string {
|
|
64
|
+
const models = s.models.join(", ");
|
|
65
|
+
const coAuthorName = models || s.promptCount > 0
|
|
66
|
+
? `OpenCode (${[models, s.promptCount > 0 ? `${s.promptCount}p` : ""].filter(Boolean).join(", ")})`
|
|
67
|
+
: "OpenCode";
|
|
68
|
+
return `Co-authored-by: ${coAuthorName} <noreply@opencode.dev>`;
|
|
69
|
+
}
|
|
63
70
|
function formatMarker(s: TrackerState): string {
|
|
64
71
|
const p: string[] = [];
|
|
65
72
|
const ma = [...new Set(s.mainAgentTypes)]; if (ma.length) p.push(`Agent mode: ${ma.join(", ")}`);
|
|
@@ -74,7 +81,8 @@ function formatMarker(s: TrackerState): string {
|
|
|
74
81
|
if (t.reasoningTokens > 0) r += ` +${formatK(t.reasoningTokens)} reasoning`;
|
|
75
82
|
return r;
|
|
76
83
|
}).join(" | ")}`); }
|
|
77
|
-
|
|
84
|
+
const marker = p.length ? `Impacted by AI (${p.join(" | ")})` : "Impacted by AI";
|
|
85
|
+
return `${marker}\n${buildCoAuthoredBy(s)}`;
|
|
78
86
|
}
|
|
79
87
|
function writeFlag(g: string, s: TrackerState) {
|
|
80
88
|
if (s.promptCount === 0 && s.mainAgentTypes.length === 0 && s.subagentTypes.length === 0 && s.subagentCount === 0 && Object.keys(s.tokensByModel).length === 0) return;
|
package/package.json
CHANGED