wrapt-cli 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +77 -2
- package/assets/fonts/OFL.txt +93 -0
- package/assets/fonts/SpaceGrotesk-Bold.ttf +0 -0
- package/assets/fonts/SpaceGrotesk-Medium.ttf +0 -0
- package/assets/fonts/SpaceGrotesk-Regular.ttf +0 -0
- package/dist/analyze.js +35 -0
- package/dist/brand.js +11 -0
- package/dist/cli.js +261 -0
- package/dist/format.js +85 -0
- package/dist/index.js +5 -0
- package/dist/narrative.js +20 -0
- package/dist/parse/reader.js +200 -0
- package/dist/parse/schema.js +75 -0
- package/dist/publish.js +130 -0
- package/dist/render/cards.js +447 -0
- package/dist/render/h.js +25 -0
- package/dist/render/index.js +72 -0
- package/dist/render/measure.js +108 -0
- package/dist/render/theme.js +39 -0
- package/dist/share/page.js +218 -0
- package/dist/share/server.js +127 -0
- package/dist/site.js +56 -0
- package/dist/sources/copilot-cli.js +142 -0
- package/dist/sources/copilot-vscode.js +277 -0
- package/dist/sources/index.js +41 -0
- package/dist/sources/tools.js +86 -0
- package/dist/stats/engine.js +285 -0
- package/dist/stats/languages.js +45 -0
- package/dist/stats/schema.js +68 -0
- package/dist/stats/words.js +112 -0
- package/package.json +53 -4
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
// prettier-ignore
|
|
3
|
+
const BY_EXT = {
|
|
4
|
+
ts: "TypeScript", tsx: "TypeScript", mts: "TypeScript", cts: "TypeScript",
|
|
5
|
+
js: "JavaScript", jsx: "JavaScript", mjs: "JavaScript", cjs: "JavaScript",
|
|
6
|
+
py: "Python", pyi: "Python", ipynb: "Jupyter",
|
|
7
|
+
rb: "Ruby", go: "Go", rs: "Rust", java: "Java", kt: "Kotlin", kts: "Kotlin", scala: "Scala",
|
|
8
|
+
swift: "Swift", m: "Objective-C", mm: "Objective-C",
|
|
9
|
+
c: "C", h: "C", cc: "C++", cpp: "C++", cxx: "C++", hpp: "C++", hh: "C++",
|
|
10
|
+
cs: "C#", fs: "F#", php: "PHP", lua: "Lua", dart: "Dart", ex: "Elixir", exs: "Elixir",
|
|
11
|
+
erl: "Erlang", hs: "Haskell", clj: "Clojure", ml: "OCaml", r: "R", jl: "Julia", zig: "Zig", nim: "Nim",
|
|
12
|
+
sh: "Shell", bash: "Shell", zsh: "Shell", fish: "Shell", ps1: "PowerShell",
|
|
13
|
+
sql: "SQL", prisma: "Prisma", graphql: "GraphQL", gql: "GraphQL", proto: "Protobuf",
|
|
14
|
+
html: "HTML", htm: "HTML", css: "CSS", scss: "SCSS", sass: "SCSS", less: "CSS",
|
|
15
|
+
vue: "Vue", svelte: "Svelte", astro: "Astro",
|
|
16
|
+
md: "Markdown", mdx: "Markdown", rst: "reStructuredText", tex: "LaTeX",
|
|
17
|
+
json: "JSON", jsonc: "JSON", yaml: "YAML", yml: "YAML", toml: "TOML", xml: "XML",
|
|
18
|
+
tf: "Terraform", hcl: "Terraform", sol: "Solidity",
|
|
19
|
+
gd: "GDScript", glsl: "GLSL", wgsl: "WGSL", hlsl: "HLSL",
|
|
20
|
+
};
|
|
21
|
+
const BY_NAME = {
|
|
22
|
+
dockerfile: "Docker",
|
|
23
|
+
makefile: "Make",
|
|
24
|
+
gemfile: "Ruby",
|
|
25
|
+
rakefile: "Ruby",
|
|
26
|
+
"cmakelists.txt": "CMake",
|
|
27
|
+
};
|
|
28
|
+
export function languageForPath(p) {
|
|
29
|
+
const base = path.basename(p).toLowerCase();
|
|
30
|
+
if (BY_NAME[base])
|
|
31
|
+
return BY_NAME[base];
|
|
32
|
+
if (base.startsWith("dockerfile"))
|
|
33
|
+
return "Docker";
|
|
34
|
+
const ext = path.extname(base).slice(1);
|
|
35
|
+
return ext ? BY_EXT[ext] : undefined;
|
|
36
|
+
}
|
|
37
|
+
/** Tools whose input names a file the agent touched. */
|
|
38
|
+
export const FILE_TOOLS = {
|
|
39
|
+
Read: ["file_path"],
|
|
40
|
+
Edit: ["file_path"],
|
|
41
|
+
MultiEdit: ["file_path"],
|
|
42
|
+
Write: ["file_path"],
|
|
43
|
+
NotebookEdit: ["notebook_path"],
|
|
44
|
+
NotebookRead: ["notebook_path"],
|
|
45
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const Count = z.object({ name: z.string(), count: z.number() });
|
|
3
|
+
export const SOURCE_NAMES = {
|
|
4
|
+
claude: "Claude Code",
|
|
5
|
+
"copilot-vscode": "Copilot Chat (VS Code)",
|
|
6
|
+
"copilot-cli": "Copilot CLI",
|
|
7
|
+
};
|
|
8
|
+
export const StatsSchema = z.object({
|
|
9
|
+
version: z.literal(1),
|
|
10
|
+
year: z.number(),
|
|
11
|
+
generatedAt: z.string(),
|
|
12
|
+
timezone: z.string(),
|
|
13
|
+
range: z.object({ first: z.string().nullable(), last: z.string().nullable() }),
|
|
14
|
+
totals: z.object({
|
|
15
|
+
sessions: z.number(),
|
|
16
|
+
prompts: z.number(),
|
|
17
|
+
assistantTurns: z.number(),
|
|
18
|
+
tokens: z.object({
|
|
19
|
+
input: z.number(),
|
|
20
|
+
output: z.number(),
|
|
21
|
+
cacheCreation: z.number(),
|
|
22
|
+
cacheRead: z.number(),
|
|
23
|
+
total: z.number(),
|
|
24
|
+
}),
|
|
25
|
+
activeDays: z.number(),
|
|
26
|
+
hours: z.number(),
|
|
27
|
+
}),
|
|
28
|
+
rhythm: z.object({
|
|
29
|
+
/** Prompts per local hour 0..23. */
|
|
30
|
+
hours: z.array(z.number()).length(24),
|
|
31
|
+
/** Prompts per weekday, Monday first. */
|
|
32
|
+
weekdays: z.array(z.number()).length(7),
|
|
33
|
+
longestStreak: z.object({ days: z.number(), start: z.string().nullable(), end: z.string().nullable() }),
|
|
34
|
+
busiestDay: z.object({ date: z.string(), prompts: z.number() }).nullable(),
|
|
35
|
+
afterMidnight: z.number(),
|
|
36
|
+
label: z.enum(["Night Owl", "Early Bird", "9-to-5er", "Weekend Warrior"]),
|
|
37
|
+
shares: z.object({ night: z.number(), early: z.number(), weekend: z.number() }),
|
|
38
|
+
}),
|
|
39
|
+
stack: z.object({
|
|
40
|
+
projects: z.array(Count),
|
|
41
|
+
tools: z.array(Count),
|
|
42
|
+
models: z.array(z.object({ name: z.string(), count: z.number(), pct: z.number() })),
|
|
43
|
+
languages: z.array(Count),
|
|
44
|
+
}),
|
|
45
|
+
words: z.object({
|
|
46
|
+
wordOfYear: Count.nullable(),
|
|
47
|
+
topWords: z.array(Count),
|
|
48
|
+
repeatPrompts: z.array(z.object({ text: z.string(), count: z.number() })),
|
|
49
|
+
}),
|
|
50
|
+
/** Per-tool breakdown. Absent in stats.json files written before sources existed (= Claude only). */
|
|
51
|
+
sources: z
|
|
52
|
+
.array(z.object({
|
|
53
|
+
id: z.enum(["claude", "copilot-vscode", "copilot-cli"]),
|
|
54
|
+
name: z.string(),
|
|
55
|
+
prompts: z.number(),
|
|
56
|
+
sessions: z.number(),
|
|
57
|
+
assistantTurns: z.number(),
|
|
58
|
+
}))
|
|
59
|
+
.optional(),
|
|
60
|
+
parse: z.object({
|
|
61
|
+
files: z.number(),
|
|
62
|
+
lines: z.number(),
|
|
63
|
+
malformed: z.number(),
|
|
64
|
+
duplicates: z.number(),
|
|
65
|
+
skippedTypes: z.record(z.string(), z.number()),
|
|
66
|
+
excludedUser: z.record(z.string(), z.number()),
|
|
67
|
+
}),
|
|
68
|
+
});
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import os from "node:os";
|
|
2
|
+
/** Text helpers for word-of-the-year, repeat prompts and sample redaction. */
|
|
3
|
+
// prettier-ignore
|
|
4
|
+
export const STOPWORDS = new Set([
|
|
5
|
+
"a", "about", "above", "after", "again", "against", "all", "also", "am", "an", "and", "any", "are", "aren't", "as", "at",
|
|
6
|
+
"be", "because", "been", "before", "being", "below", "between", "both", "but", "by",
|
|
7
|
+
"can", "can't", "cannot", "could", "couldn't", "did", "didn't", "do", "does", "doesn't", "doing", "don't", "down", "during",
|
|
8
|
+
"each", "either", "else", "etc", "even", "ever", "every", "few", "for", "from", "further", "get", "gets", "got",
|
|
9
|
+
"had", "hadn't", "has", "hasn't", "have", "haven't", "having", "he", "her", "here", "hers", "herself", "him", "himself", "his", "how",
|
|
10
|
+
"i", "i'd", "i'll", "i'm", "i've", "if", "in", "into", "is", "isn't", "it", "it's", "its", "itself", "just", "let", "let's",
|
|
11
|
+
"may", "me", "might", "more", "most", "much", "must", "my", "myself", "need", "needs", "no", "nor", "not", "now",
|
|
12
|
+
"of", "off", "on", "once", "one", "only", "or", "other", "our", "ours", "ourselves", "out", "over", "own",
|
|
13
|
+
"please", "pls", "same", "she", "should", "shouldn't", "since", "so", "some", "still", "such",
|
|
14
|
+
"than", "that", "that's", "the", "their", "theirs", "them", "themselves", "then", "there", "there's", "these", "they", "they're",
|
|
15
|
+
"this", "those", "through", "to", "too", "under", "until", "up", "upon", "us", "use", "using", "very",
|
|
16
|
+
"want", "was", "wasn't", "way", "we", "we'd", "we'll", "we're", "we've", "well", "were", "weren't", "what", "what's", "when", "where",
|
|
17
|
+
"which", "while", "who", "whom", "why", "will", "with", "within", "without", "won't", "would", "wouldn't",
|
|
18
|
+
"yes", "yet", "you", "you'd", "you'll", "you're", "you've", "your", "yours", "yourself", "yourselves",
|
|
19
|
+
"make", "like", "okay", "ok", "thanks", "thank", "sure", "also", "really", "something", "thing", "things", "see", "know",
|
|
20
|
+
"go", "going", "look", "new", "now", "way", "one", "two", "via", "per", "used", "will", "shall", "dont", "im", "ive", "thats", "its", "cant", "lets",
|
|
21
|
+
]);
|
|
22
|
+
const SECRET_PATTERNS = [
|
|
23
|
+
/\bsk-[A-Za-z0-9_-]{8,}/g, // OpenAI / Anthropic style keys
|
|
24
|
+
/\b(?:ghp|gho|ghs|ghu|github_pat)_[A-Za-z0-9_]{10,}/g,
|
|
25
|
+
/\bAKIA[0-9A-Z]{16}\b/g,
|
|
26
|
+
/\bxox[abpors]-[A-Za-z0-9-]{10,}/g,
|
|
27
|
+
/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?/g, // JWT
|
|
28
|
+
/\b[a-fA-F0-9]{21,}\b/g, // long hex
|
|
29
|
+
// long random-looking tokens: 24+ chars mixing letters and digits
|
|
30
|
+
/\b(?=[A-Za-z0-9_+/=-]*\d)(?=[A-Za-z0-9_+/=-]*[A-Za-z])[A-Za-z0-9_+/=-]{24,}\b/g,
|
|
31
|
+
];
|
|
32
|
+
export function looksSecret(s) {
|
|
33
|
+
return SECRET_PATTERNS.some((re) => {
|
|
34
|
+
re.lastIndex = 0;
|
|
35
|
+
return re.test(s);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export function redactSecrets(s) {
|
|
39
|
+
let out = s;
|
|
40
|
+
for (const re of SECRET_PATTERNS)
|
|
41
|
+
out = out.replace(re, "[redacted]");
|
|
42
|
+
return out;
|
|
43
|
+
}
|
|
44
|
+
/** Remove code, URLs, paths, tags, emails and numbers, leaving prose. */
|
|
45
|
+
export function stripNonProse(text) {
|
|
46
|
+
return text
|
|
47
|
+
.replace(/```[\s\S]*?(```|$)/g, " ")
|
|
48
|
+
.replace(/`[^`\n]*`/g, " ")
|
|
49
|
+
.replace(/<\/?[A-Za-z_][\w:-]*[^>]*>/g, " ")
|
|
50
|
+
.replace(/\b(?:https?|ftp|file):\/\/\S+/gi, " ")
|
|
51
|
+
.replace(/\bwww\.\S+/gi, " ")
|
|
52
|
+
.replace(/\S+@\S+\.\S+/g, " ")
|
|
53
|
+
.replace(/\S*[\\/]\S*/g, " ") // anything path-like
|
|
54
|
+
.replace(/[\w-]+\.[A-Za-z0-9]{1,5}\b/g, " ") // file.ext / dotted.identifiers
|
|
55
|
+
.replace(/\S*\d\S*/g, " "); // any token with a digit: ids, uuids, versions, numbers
|
|
56
|
+
}
|
|
57
|
+
const WORD_RE = /\p{L}[\p{L}'’-]*\p{L}/gu;
|
|
58
|
+
/** Words that would identify this machine (OS username, hostname parts) — never surfaced. */
|
|
59
|
+
export function machineWords() {
|
|
60
|
+
const out = new Set();
|
|
61
|
+
const add = (s) => s?.toLowerCase().split(/[^\p{L}]+/u).forEach((w) => w.length >= 3 && out.add(w));
|
|
62
|
+
try {
|
|
63
|
+
add(os.userInfo().username);
|
|
64
|
+
}
|
|
65
|
+
catch { }
|
|
66
|
+
add(os.hostname().replace(/\.local$/, ""));
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
export function extractWords(text, exclude = new Set()) {
|
|
70
|
+
const prose = redactSecrets(stripNonProse(text)).toLowerCase();
|
|
71
|
+
const out = [];
|
|
72
|
+
for (const m of prose.matchAll(WORD_RE)) {
|
|
73
|
+
const w = m[0].replace(/’/g, "'").replace(/^['-]+|['-]+$/g, "");
|
|
74
|
+
if (w.length < 3)
|
|
75
|
+
continue;
|
|
76
|
+
if (STOPWORDS.has(w) || STOPWORDS.has(w.replace(/'/g, "")))
|
|
77
|
+
continue;
|
|
78
|
+
if (w === "redacted" || exclude.has(w))
|
|
79
|
+
continue;
|
|
80
|
+
out.push(w);
|
|
81
|
+
}
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Normalize a prompt for repeat counting. Returns null unless the prompt is
|
|
86
|
+
* short (1..5 words), free of code/URLs/paths and doesn't look like a secret.
|
|
87
|
+
*/
|
|
88
|
+
export function normalizeShortPrompt(text) {
|
|
89
|
+
const t = text.trim();
|
|
90
|
+
if (!t || t.length > 60)
|
|
91
|
+
return null;
|
|
92
|
+
if (/[`<>{}\\/]|https?:/i.test(t))
|
|
93
|
+
return null;
|
|
94
|
+
if (looksSecret(t))
|
|
95
|
+
return null;
|
|
96
|
+
const norm = t
|
|
97
|
+
.toLowerCase()
|
|
98
|
+
.replace(/\s+/g, " ")
|
|
99
|
+
.replace(/[.!?,;:…]+$/u, "")
|
|
100
|
+
.trim();
|
|
101
|
+
if (!norm)
|
|
102
|
+
return null;
|
|
103
|
+
const words = norm.split(" ");
|
|
104
|
+
if (words.length > 5)
|
|
105
|
+
return null;
|
|
106
|
+
return norm;
|
|
107
|
+
}
|
|
108
|
+
/** Truncate by code points so we never split a surrogate pair. */
|
|
109
|
+
export function truncate(s, max) {
|
|
110
|
+
const cps = Array.from(s);
|
|
111
|
+
return cps.length <= max ? s : cps.slice(0, max - 1).join("") + "…";
|
|
112
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrapt-cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Your year with Claude Code and GitHub Copilot, wrapped. Share cards made on your own computer.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"wrapt": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"assets"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=20"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc -p tsconfig.json",
|
|
19
|
+
"dev": "tsx src/cli.ts",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
22
|
+
"examples": "node dist/cli.js render --year 2026 --name Ada --show-projects --out ../../examples/demo && node scripts/contact-sheet.mjs ../../examples/demo/story 4 360 640 ../../examples/story-preview.png && node scripts/contact-sheet.mjs ../../examples/demo/carousel 4 432 540 ../../examples/carousel-preview.png && node scripts/site-images.mjs"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@resvg/resvg-js": "^2.6.2",
|
|
26
|
+
"pdf-lib": "^1.17.1",
|
|
27
|
+
"qrcode-terminal": "^0.12.0",
|
|
28
|
+
"satori": "^0.64.3",
|
|
29
|
+
"zod": "^4.1.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^20.17.0",
|
|
33
|
+
"@types/qrcode-terminal": "^0.12.2",
|
|
34
|
+
"tsx": "^4.19.0",
|
|
35
|
+
"typescript": "^5.7.0",
|
|
36
|
+
"vitest": "^3.0.0"
|
|
37
|
+
},
|
|
38
|
+
"main": "dist/index.js",
|
|
39
|
+
"exports": {
|
|
40
|
+
".": "./dist/index.js",
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://wrapt.cc",
|
|
44
|
+
"keywords": [
|
|
45
|
+
"claude",
|
|
46
|
+
"claude-code",
|
|
47
|
+
"copilot",
|
|
48
|
+
"github-copilot",
|
|
49
|
+
"wrapped",
|
|
50
|
+
"year-in-review",
|
|
51
|
+
"share-cards",
|
|
52
|
+
"cli",
|
|
53
|
+
"stats"
|
|
54
|
+
]
|
|
55
|
+
}
|