worktrust 0.10.32 → 0.10.34

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 CHANGED
@@ -1,5 +1,31 @@
1
1
  # worktrust
2
2
 
3
+ ## 0.10.34: your own commits, measured on this computer (`npx worktrust git`)
4
+
5
+ GitHub shows an App that reads commits as "Read access to code", and has no narrower permission. `npx worktrust git`
6
+ reads your own commits HERE instead, with `git log`, only those whose author e-mail is yours (git's `user.email`, plus
7
+ any you add with `git emails add`), in the repositories your AI sessions ran in or that you add with `git add <folder>`.
8
+ It asks once, with the list; Enter and `--yes` are No, and a No is remembered. Each commit's file names are turned into
9
+ the same closed keys the GitHub sync makes (kinds of files, technologies, architecture and security markers, one-way
10
+ markers per folder and file) on this computer, and what is sent is counts, keys and markers: never a file name, a
11
+ message, code, the commit's id or the remote's address. A commit travels as an owner-keyed reference only WorkTrust's
12
+ side can match against what GitHub saw. `git list` shows what is offered and agreed, `git remove <folder>` reads nothing
13
+ more from it, `--dry-run` reads and sends nothing.
14
+
15
+ ## 0.10.33: one line per autonomous process per day; a fair-use limit keeps the line
16
+
17
+ A finished headless or scheduled run (a run no person started) is no longer a line of its own. It waits on this
18
+ computer, in `~/.worktrust/process-days`, folded into its process's UTC day: a process is the AI app, how the session
19
+ was started, the timer's opaque reference when a timer started it, and the project folder, as a hash (`process_ref`),
20
+ never a name or a path. Once the day is over and quiet it goes as ONE line with how many runs it holds
21
+ (`process_runs`); the runs' timelines are joined at minute resolution, which keeps every counted second, with each
22
+ run's call outcomes, its turns' length buckets and its subagent runs kept in step (every turn and each minute's first
23
+ completed call stay). A run that
24
+ finishes after its day was sent becomes the day's next part, and once WorkTrust holds its parts it is merged into the
25
+ last one, which goes again whole. When WorkTrust answers a fair-use limit (429 with Retry-After) nothing is lost: the
26
+ line stays where it was and goes after the wait. What is measured is unchanged, so the measure rules stay 2 and no
27
+ re-measure is offered.
28
+
3
29
  ## 0.10.32: a re-measure sends only the days that changed; which subagents were active at once; each call's outcome
4
30
 
5
31
  Before a re-measure sends anything, the CLI asks WorkTrust, once per AI app, which of this computer's days it holds as
@@ -0,0 +1,447 @@
1
+ // GENERATED by scripts/build-commit-rules.mjs from packages/core/src/scoring (the sources of truth). Do not edit:
2
+ // `node scripts/build-commit-rules.mjs` rewrites it and `--check` refuses a copy that drifted from core.
3
+ /**
4
+ * WHAT A COMMIT'S FILE NAMES SAY, AS CLOSED KEYS (docs/GITHUB.md): the GitHub walk's own classifiers, transpiled, so a
5
+ * commit read on this computer carries the keys GitHub's copy of it would. The paths never leave this computer.
6
+ */
7
+ // ── packages/core/src/scoring/stack.ts ──
8
+ const stack = (() => {
9
+ const TECHNOLOGIES = [
10
+ "typescript", "javascript", "python", "go", "rust", "java", "kotlin", "swift", "csharp", "ruby", "php", "cpp", "sql", "shell",
11
+ "react", "nextjs", "vue", "svelte", "angular", "reactNative", "expo", "tailwind", "nodejs", "django", "fastapi", "rails", "dotnet", "spring", "flutter",
12
+ "postgres", "supabase", "prisma", "graphql", "docker", "kubernetes", "terraform", "githubActions", "vercel", "aws", "gcp", "azure",
13
+ "redis", "sqlite", "vitest", "jest", "playwright", "storybook", "cloudflare", "deno", "bun", "drizzle", "vite", "webpack", "electron", "firebase", "sentry", "mcp", "claude",
14
+ "retrieval", "pgvector", "pinecone", "weaviate", "qdrant", "chroma", "langchain", "llamaindex",
15
+ ];
16
+ function isTechnology(value) {
17
+ return typeof value === "string" && TECHNOLOGIES.includes(value);
18
+ }
19
+ const BY_EXTENSION = [
20
+ [/\.(ts|mts|cts)$/i, ["typescript"]],
21
+ [/\.tsx$/i, ["typescript", "react"]],
22
+ [/\.jsx$/i, ["javascript", "react"]],
23
+ [/\.(js|mjs|cjs)$/i, ["javascript"]],
24
+ [/\.py$/i, ["python"]],
25
+ [/\.go$/i, ["go"]],
26
+ [/\.rs$/i, ["rust"]],
27
+ [/\.java$/i, ["java"]],
28
+ [/\.kt$/i, ["kotlin"]],
29
+ [/\.swift$/i, ["swift"]],
30
+ [/\.cs$/i, ["csharp"]],
31
+ [/\.rb$/i, ["ruby"]],
32
+ [/\.php$/i, ["php"]],
33
+ [/\.(c|cc|cpp|h|hpp)$/i, ["cpp"]],
34
+ [/\.sql$/i, ["sql"]],
35
+ [/\.(sqlite|sqlite3)$/i, ["sqlite"]],
36
+ [/\.(sh|bash|zsh)$/i, ["shell"]],
37
+ [/\.vue$/i, ["vue"]],
38
+ [/\.svelte$/i, ["svelte"]],
39
+ [/\.dart$/i, ["flutter"]],
40
+ [/\.prisma$/i, ["prisma"]],
41
+ [/\.(graphql|gql)$/i, ["graphql"]],
42
+ [/\.tf$/i, ["terraform"]],
43
+ ];
44
+ const BY_NAME = [
45
+ [/(^|\/)next\.config\.(js|mjs|ts)$/i, ["nextjs"]],
46
+ [/(^|\/)tailwind\.config\.(js|mjs|ts)$|(^|\/)postcss\.config\./i, ["tailwind"]],
47
+ [/(^|\/)package(-lock)?\.json$|(^|\/)pnpm-lock\.yaml$|(^|\/)yarn\.lock$/i, ["nodejs"]],
48
+ [/(^|\/)app\.json$|(^|\/)eas\.json$/i, ["expo", "reactNative"]],
49
+ [/(^|\/)angular\.json$/i, ["angular"]],
50
+ [/(^|\/)manage\.py$|(^|\/)settings\.py$/i, ["django"]],
51
+ [/(^|\/)(requirements\.txt|pyproject\.toml|Pipfile)$/i, ["python"]],
52
+ [/(^|\/)Gemfile(\.lock)?$|(^|\/)config\/routes\.rb$/i, ["rails"]],
53
+ [/\.csproj$|(^|\/)Program\.cs$/i, ["dotnet"]],
54
+ [/(^|\/)pom\.xml$|(^|\/)build\.gradle(\.kts)?$/i, ["spring"]],
55
+ [/(^|\/)pubspec\.yaml$/i, ["flutter"]],
56
+ [/(^|\/)supabase\//i, ["supabase", "postgres"]],
57
+ [/(^|\/)(Dockerfile|docker-compose[^/]*\.ya?ml)$/i, ["docker"]],
58
+ [/(^|\/)(k8s|kubernetes|helm)\//i, ["kubernetes"]],
59
+ [/(^|\/)\.github\/workflows\//i, ["githubActions"]],
60
+ [/(^|\/)vercel\.json$/i, ["vercel"]],
61
+ [/(^|\/)(cloudformation|cdk)\/|(^|\/)serverless\.ya?ml$/i, ["aws"]],
62
+ [/(^|\/)app\.yaml$|(^|\/)cloudbuild\.ya?ml$/i, ["gcp"]],
63
+ [/(^|\/)azure-pipelines\.ya?ml$|(^|\/)host\.json$/i, ["azure"]],
64
+ [/(^|\/)redis\.conf$|(^|\/)redis\//i, ["redis"]],
65
+ [/(^|\/)vitest\.(config|workspace)\.[cm]?[jt]s$/i, ["vitest"]],
66
+ [/(^|\/)jest\.config\.[cm]?[jt]s$|(^|\/)jest\.setup\.[cm]?[jt]s$/i, ["jest"]],
67
+ [/(^|\/)playwright\.config\.[cm]?[jt]s$/i, ["playwright"]],
68
+ [/(^|\/)\.storybook\/|\.stories\.[jt]sx?$/i, ["storybook"]],
69
+ [/(^|\/)wrangler\.(toml|jsonc?)$/i, ["cloudflare"]],
70
+ [/(^|\/)deno\.(jsonc?|lock)$/i, ["deno"]],
71
+ [/(^|\/)bun\.lockb?$|(^|\/)bunfig\.toml$/i, ["bun"]],
72
+ [/(^|\/)drizzle\.config\.[cm]?[jt]s$|(^|\/)drizzle\//i, ["drizzle"]],
73
+ [/(^|\/)vite\.config\.[cm]?[jt]s$/i, ["vite"]],
74
+ [/(^|\/)webpack\.config\.[cm]?[jt]s$/i, ["webpack"]],
75
+ [/(^|\/)electron-builder\.(ya?ml|json)$|(^|\/)electron\.vite\.config\.[cm]?[jt]s$/i, ["electron"]],
76
+ [/(^|\/)firebase\.json$|(^|\/)\.firebaserc$/i, ["firebase"]],
77
+ [/(^|\/)sentry\.[a-z]+\.config\.[cm]?[jt]s$/i, ["sentry"]],
78
+ [/(^|\/)\.mcp\.json$|(^|\/)mcp\.json$/i, ["mcp"]],
79
+ [/(^|\/)\.claude\/|(^|\/)CLAUDE\.md$/i, ["claude"]],
80
+ [/(^|\/)(rag|retrieval|embeddings?|vector[-_]?stores?)(\/|\.)/i, ["retrieval"]],
81
+ [/(^|\/)pgvector(\/|\.)|(^|\/)migrations?\/[^/]*(vector|embedding)[^/]*\.sql$/i, ["pgvector", "retrieval"]],
82
+ [/(^|\/)pinecone[^/]*(\/|\.)/i, ["pinecone", "retrieval"]],
83
+ [/(^|\/)weaviate[^/]*(\/|\.)/i, ["weaviate", "retrieval"]],
84
+ [/(^|\/)qdrant[^/]*(\/|\.)/i, ["qdrant", "retrieval"]],
85
+ [/(^|\/)chroma(\/|\.sqlite3$)/i, ["chroma", "retrieval"]],
86
+ [/(^|\/)langchain[^/]*(\/|\.)|(^|\/)langgraph\.json$/i, ["langchain"]],
87
+ [/(^|\/)llama[-_]?index[^/]*(\/|\.)/i, ["llamaindex", "retrieval"]],
88
+ ];
89
+ function stackOfFile(path) {
90
+ const found = new Set();
91
+ for (const [pattern, keys] of BY_NAME)
92
+ if (pattern.test(path))
93
+ for (const key of keys)
94
+ found.add(key);
95
+ for (const [pattern, keys] of BY_EXTENSION)
96
+ if (pattern.test(path))
97
+ for (const key of keys)
98
+ found.add(key);
99
+ return [...found].sort();
100
+ }
101
+ function manifestsOfFiles(paths) {
102
+ const out = new Set();
103
+ for (const path of paths)
104
+ for (const [pattern, techs] of BY_NAME)
105
+ if (pattern.test(path))
106
+ for (const tech of techs)
107
+ out.add(tech);
108
+ return [...out].sort();
109
+ }
110
+ function stackOfFiles(paths) {
111
+ const found = new Set();
112
+ for (const path of paths)
113
+ for (const key of stackOfFile(path))
114
+ found.add(key);
115
+ return [...found].sort();
116
+ }
117
+ function technologiesBlock(counts, marks = new Map()) {
118
+ return counts
119
+ .filter((count) => isTechnology(count.technology) && count.repositoryEvents + count.reportedEvents > 0)
120
+ .map((count) => {
121
+ const mark = marks.get(count.technology);
122
+ return { technology: count.technology, repositoryEvents: count.repositoryEvents, reportedEvents: count.reportedEvents, ...(mark ? { level: mark.level, ...(mark.state ? { state: mark.state } : {}) } : {}) };
123
+ })
124
+ .sort((a, b) => b.repositoryEvents - a.repositoryEvents || b.reportedEvents - a.reportedEvents);
125
+ }
126
+ return { TECHNOLOGIES, isTechnology, stackOfFile, manifestsOfFiles, stackOfFiles, technologiesBlock };
127
+ })();
128
+
129
+ // ── packages/core/src/scoring/git-classes.ts ──
130
+ const gitClasses = (() => {
131
+ const TEST = /(^|\/)(__tests__|tests?|spec)\/|\.(test|spec)\.[a-z]+$|_test\.(go|py|rb)$/i;
132
+ const DATABASE = /(^|\/)migrations?\/|\.sql$|(^|\/)(schema|seed)s?\.(prisma|sql|ts|rb)$/i;
133
+ const CICD = /(^|\/)\.github\/workflows\/[^/]+\.ya?ml$|(^|\/)\.circleci\/[^/]+\.ya?ml$|(^|\/)\.buildkite\/[^/]+\.ya?ml$|(^|\/)\.gitlab-ci\.ya?ml$|(^|\/)\.travis\.ya?ml$|(^|\/)Jenkinsfile(\.groovy)?$|(^|\/)azure-pipelines[^/]*\.ya?ml$|(^|\/)bitbucket-pipelines\.ya?ml$|(^|\/)cloudbuild\.ya?ml$|(^|\/)\.drone\.ya?ml$/i;
134
+ const INFRA = /(^|\/)\.github\/|(^|\/)(infra|terraform|k8s|helm|deploy|ansible)\/|\.(tf|tfvars|yaml|yml)$|(^|\/)(Dockerfile|docker-compose[^/]*|Makefile|Procfile)$/i;
135
+ const AGENT_CONFIG = /(^|\/)\.claude\/|(^|\/)(CLAUDE|AGENTS)\.md$|(^|\/)\.cursor(rules|\/)|(^|\/)\.github\/copilot-instructions\.md$|(^|\/)(mcp|\.mcp)\.json$|(^|\/)skills\/[^/]+\/SKILL\.md$|(^|\/)agents\/[^/]+\.md$/i;
136
+ const RD = /(^|\/)(experiments?|spikes?|prototypes?|research|labs?|sandbox|playground|pocs?|proof-of-concepts?|notebooks?)\/|\.ipynb$/i;
137
+ const CLASSIFIER_VERSION = "1.0.36";
138
+ const ARCHITECTURE = /(^|\/)(adrs?|rfcs?|architecture|design-docs?|decisions|proposals?)\/.*\.(md|mdx|rst|adoc|txt)$|(^|\/)(ARCHITECTURE|DESIGN)\.md$|(^|\/)adr-?\d+[^/]*\.(md|mdx)$/i;
139
+ const ML = /^((ml|research|experiments?)\/)?(training|checkpoints?|datasets?|fine-?tun\w*|finetun\w*|wandb|mlruns|machine-?learning|inference)\/.*\.(py|ts|js|yaml|yml|json|csv|parquet|jsonl)$|(^|\/)(train|training|finetune|fine-tune)\.py$|\.(safetensors|pt|pth|ckpt|gguf|onnx|h5|tflite)$/i;
140
+ const DATA = /^(data\/)?(etl|elt|dags?|airflow|dbt|warehouse|lakehouse|data-?pipelines?)\/.*\.(py|sql|ts|js|scala|r|go)$/i;
141
+ const SECURITY_DIRS = "auth|authn|authz|authentication|authorization|oauth|permissions?|rbac|acl|security|signing|jwt|jwks|mfa|totp|secrets?|vault|csp";
142
+ const SECURITY_NAMES = "auth|authn|authz|authentication|authorization|oauth|jwt|jwks|mfa|totp|rbac|acl|csp|permissions?";
143
+ const SECURITY_EXT = "\\.(ts|js|mjs|cjs|mts|cts|py|go|rs|java|kt|rb|php|cs|scala|ex|exs|swift|dart|prisma)$";
144
+ const SECURITY = new RegExp(`(^|\\/)(${SECURITY_DIRS})\\/.*${SECURITY_EXT}|(^|\\/)([^/]*[._-])?(${SECURITY_NAMES})([._-][^/]*)?${SECURITY_EXT}`, "i");
145
+ const MOBILE_EXT = "\\.(swift|kt|kts|java|dart|m|mm|ts|tsx|js|jsx|gradle|plist|storyboard|xib|xcconfig|pbxproj)$";
146
+ const MOBILE = new RegExp(`(^|\\/)(ios|android|mobile|react-native|expo)\\/.*${MOBILE_EXT}|(^|\\/)app\\/src\\/main\\/.*${MOBILE_EXT}|AndroidManifest\\.xml$|\\.(swift|dart|storyboard|xib)$|(^|\\/)eas\\.json$|(mobile|expo|native)[^/]*\\/[^/]*\\bapp\\.json$|(^|\\/)(Podfile|Podfile\\.lock|Info\\.plist|\\.xcconfig)$|\\.xcodeproj(\\/|$)`, "i");
147
+ const BACKEND_HOMES = /(^|\/)(app|pages|src\/app|src\/pages)\/api\/.*\.(ts|js|mjs|cjs|mts|cts)$|^(server|backend|controllers?|db)\/.*\.(ts|js|mjs|cjs|mts|cts)$|(^|\/)(server|backend|controllers?)\/.*\.(ts|js|mjs|cjs|mts|cts)$|(^|\/)(supabase|netlify|firebase)\/functions\/.*\.(ts|js|mjs|cjs|mts|cts)$|^functions\/.*\.(ts|js|mjs|cjs|mts|cts)$|(^|\/)lib\/db\/.*\.(ts|js|mjs|cjs|mts|cts)$/i;
148
+ const DOCS = /\.(md|mdx|rst|txt|adoc)$|(^|\/)(docs?|LICENSE|README)(\/|$)/i;
149
+ const FRONTEND = /\.(css|scss|sass|less|html|vue|svelte|astro|jsx|tsx)$/i;
150
+ const BACKEND = /\.(py|go|rs|java|kt|rb|php|cs|scala|ex|exs|clj|swift|c|cc|cpp|h|hpp)$/i;
151
+ const INTEGRATION = /(^|\/)(integrations?|connectors?|webhooks?|clients?|sdk)\/|\.(proto|graphql|gql)$|(^|\/)openapi\.(yaml|yml|json)$/i;
152
+ const CODE_EXT = "\\.(ts|tsx|js|jsx|mjs|cjs|mts|cts|py|go|rs|java|kt|rb|php|cs|scala|ex|exs|swift|dart|vue|svelte|prisma)$";
153
+ const PROVIDERS = "stripe|adyen|mollie|rootline|paypal|braintree|klarna";
154
+ const PAYMENT_HOMES = "checkout|billing|payments?|invoices?";
155
+ const PAYMENTS = new RegExp(`(^|\\/)[^/]*(${PROVIDERS})[^/]*${CODE_EXT}|(^|\\/)(${PROVIDERS}|${PAYMENT_HOMES})\\/.*${CODE_EXT}|(^|\\/)(${PAYMENT_HOMES})${CODE_EXT}`, "i");
156
+ const TENANCY = new RegExp(`(^|\\/)[^/]*(tenants?|tenancy|multi-?tenant|workspaces?)[^/]*${CODE_EXT}|(^|\\/)(tenants?|tenancy|multi-?tenant|workspaces?|organi[sz]ations?|rls|row-level-security)(\\/.*)?${CODE_EXT}`, "i");
157
+ const CONTAINERS = /(^|\/)(Dockerfile[^/]*|Containerfile|docker-compose[^/]*\.ya?ml|compose\.ya?ml|\.dockerignore)$|(^|\/)(docker|containers?)\/.*\.(ya?ml|Dockerfile|sh|conf|env)$/i;
158
+ const ORCHESTRATION = /(^|\/)(k8s|kubernetes|helm|kustomize|manifests|argocd|argo|flux)\/.*\.(ya?ml|tpl|json)$|^charts?\/.*\.(ya?ml|tpl)$|(^|\/)(Chart|kustomization|skaffold)\.ya?ml$|(^|\/)(helm|charts?)\/[^/]*values[^/]*\.ya?ml$/i;
159
+ const API_CODE = "\\.(ts|js|mjs|cjs|mts|cts|py|go|rs|java|kt|rb|php|cs|scala|ex|exs)$";
160
+ const API = new RegExp(`(^|\\/)(app|pages|src\\/app|src\\/pages)\\/api\\/.*${API_CODE}|^(api|server\\/api|backend\\/api)\\/.*${API_CODE}|(^|\\/)openapi\\.(ya?ml|json)$|(^|\\/)swagger\\.(ya?ml|json)$|\\.(proto|graphql|gql)$`, "i");
161
+ const OBSERVABILITY = new RegExp(`(^|\\/)(observability|telemetry|tracing|monitoring|alerts?|alerting|metrics|logging|loggers?)\\/.*${API_CODE}|(^|\\/)(otel|opentelemetry|sentry|datadog|prometheus|grafana|newrelic|honeycomb)[^/]*\\.(ts|js|mjs|py|go|ya?ml|json|toml)$|(^|\\/)([^/]*[._-])?(logger|tracing|telemetry)\\.(ts|js|mjs|py|go|rs)$`, "i");
162
+ const ASYNC = new RegExp(`(^|\\/)(queues?|jobs|consumers?|subscribers?|pubsub|kafka|rabbitmq|sqs|bullmq|temporal|cron|schedulers?|background)\\/.*${API_CODE}|(^|\\/)[^/]*\\.(job|consumer|queue|cron)\\.(ts|js|mjs|py|go|rs)$`, "i");
163
+ const GOVERNANCE = /(^|\/)(\.github\/)?(CODEOWNERS|CODE_OF_CONDUCT|CONTRIBUTING|GOVERNANCE|MAINTAINERS|RELEASING)(\.(md|mdx|rst|txt))?$|(^|\/)(\.github\/)?(CHANGELOG|CHANGES|HISTORY|SECURITY)\.(md|mdx|rst|txt)$|(^|\/)\.github\/(PULL_REQUEST_TEMPLATE|pull_request_template)(\.md)?$|(^|\/)\.github\/PULL_REQUEST_TEMPLATE\/[^/]+$|(^|\/)\.github\/(ISSUE_TEMPLATE|issue_template)\/[^/]+$|(^|\/)\.changeset\/(?!README\.md$)[^/]+\.md$/;
164
+ const CODE = /\.(ts|js|mjs|cjs|mts|cts)$/i;
165
+ const CLASS_RULES = [
166
+ { id: "agentConfig", test: AGENT_CONFIG, cls: "agentConfig" },
167
+ { id: "test", test: TEST, cls: "testing" },
168
+ { id: "governance", test: GOVERNANCE, cls: "governance" },
169
+ { id: "architecture", test: ARCHITECTURE, cls: "architecture" },
170
+ { id: "rd", test: RD, cls: "rd" },
171
+ { id: "ml", test: ML, cls: "ai_ml" },
172
+ { id: "data", test: DATA, cls: "data" },
173
+ { id: "database", test: DATABASE, cls: "database" },
174
+ { id: "tenancy", test: TENANCY, cls: "tenancy" },
175
+ { id: "payments", test: PAYMENTS, cls: "payments" },
176
+ { id: "api", test: API, cls: "api" },
177
+ { id: "cicd", test: CICD, cls: "ci_cd" },
178
+ { id: "containers", test: CONTAINERS, cls: "containers" },
179
+ { id: "orchestration", test: ORCHESTRATION, cls: "orchestration" },
180
+ { id: "infra", test: INFRA, cls: "infrastructure" },
181
+ { id: "integration", test: INTEGRATION, cls: "integration" },
182
+ { id: "security", test: SECURITY, cls: "security" },
183
+ { id: "observability", test: OBSERVABILITY, cls: "observability" },
184
+ { id: "async", test: ASYNC, cls: "async" },
185
+ { id: "docs", test: DOCS, cls: "docs" },
186
+ { id: "mobile", test: MOBILE, cls: "mobile" },
187
+ { id: "frontend", test: FRONTEND, cls: "frontend" },
188
+ { id: "backendHomes", test: BACKEND_HOMES, cls: "backend" },
189
+ { id: "backend", test: BACKEND, cls: "backend" },
190
+ { id: "code", test: CODE, cls: "code" },
191
+ ];
192
+ function classRuleOf(path) {
193
+ for (const rule of CLASS_RULES)
194
+ if (rule.test.test(path))
195
+ return { id: rule.id, cls: rule.cls };
196
+ return null;
197
+ }
198
+ function classOfFile(path) {
199
+ return classRuleOf(path)?.cls ?? null;
200
+ }
201
+ function classesOfFiles(paths) {
202
+ const classes = new Set();
203
+ for (const path of paths) {
204
+ const cls = classOfFile(path);
205
+ if (cls)
206
+ classes.add(cls);
207
+ }
208
+ return [...classes].sort();
209
+ }
210
+ const isBotLogin = (login, type) => type === "Bot" || /\[bot\]$/i.test(login ?? "");
211
+ return { CLASSIFIER_VERSION, CLASS_RULES, classRuleOf, classOfFile, classesOfFiles, isBotLogin };
212
+ })();
213
+
214
+ // ── packages/core/src/scoring/architecture.ts ──
215
+ const architecture = (() => {
216
+ const ARCHITECTURE_POINTS = ["observability", "performance", "migrationDiscipline", "securityAccessControls", "operations", "architectureComplexity"];
217
+ const OBSERVABILITY = /(^|\/)(logging|logger|metrics|telemetry|tracing|monitoring|alerts?|observab)[^/]*(\/|\.|$)|sentry|opentelemetry|otel|prometheus|grafana|datadog/i;
218
+ const PERFORMANCE = /(^|\/)(perf|performance|cache|caching|benchmark|profil)[^/]*(\/|\.|$)|_index\.sql$|(^|\/)indexes?\.(sql|ts)$|explain|redis/i;
219
+ const MIGRATION = /(^|\/)migrations?\/[^/]+\.(sql|ts|js|rb|py)$/i;
220
+ const SECURITY = /(^|\/)(auth|oauth|rls|polic(y|ies)|permissions?|rbac|acl|secur|crypto|signing|signature|jwt|jwks|mfa|totp|secrets?|vault|csp|security-headers)[^/]*(\/|\.|$)/i;
221
+ const OPERATIONS = /(^|\/)\.github\/workflows\/|(^|\/)(infra|terraform|k8s|kubernetes|helm|deploy|ansible|ops|runbooks?|cron)\/|(^|\/)(Dockerfile|docker-compose[^/]*\.ya?ml|vercel\.json|fly\.toml|Procfile)$|\.tf$/i;
222
+ function archOfFile(path) {
223
+ const found = [];
224
+ if (OBSERVABILITY.test(path))
225
+ found.push("observability");
226
+ if (PERFORMANCE.test(path))
227
+ found.push("performance");
228
+ if (MIGRATION.test(path))
229
+ found.push("migrationDiscipline");
230
+ if (SECURITY.test(path))
231
+ found.push("securityAccessControls");
232
+ if (OPERATIONS.test(path))
233
+ found.push("operations");
234
+ return found;
235
+ }
236
+ const packageOf = (path) => {
237
+ const m = /^(apps|packages|services|libs|modules)\/([^/]+)\//.exec(path);
238
+ return m ? `${m[1]}/${m[2]}` : null;
239
+ };
240
+ function archOfFiles(paths) {
241
+ const found = new Set();
242
+ const packages = new Set();
243
+ for (const path of paths) {
244
+ for (const key of archOfFile(path))
245
+ found.add(key);
246
+ const pkg = packageOf(path);
247
+ if (pkg)
248
+ packages.add(pkg);
249
+ }
250
+ if (packages.size >= 2)
251
+ found.add("architectureComplexity");
252
+ return [...found].sort();
253
+ }
254
+ const ARCHITECTURE_DIMENSION = "architecture";
255
+ return { ARCHITECTURE_POINTS, archOfFile, archOfFiles, ARCHITECTURE_DIMENSION };
256
+ })();
257
+
258
+ // ── packages/core/src/scoring/security-markers.ts ──
259
+ const securityMarkers = (() => {
260
+ const SECURITY_MARKERS = [
261
+ "authentication", "authorization", "identityFederation", "secretsManagement", "encryption", "signing",
262
+ "rateLimiting", "auditLogging", "transportSecurity", "backupRecovery", "dependencyHygiene",
263
+ ];
264
+ const CODE = "\\.(ts|tsx|js|jsx|mjs|cjs|mts|cts|py|go|rs|java|kt|rb|php|cs|scala|ex|exs|swift|dart|sql|prisma|ya?ml|json|toml|tf)$";
265
+ const dirOrName = (tokens) => new RegExp(`(^|\\/)(${tokens})\\/.*${CODE}|(^|\\/)([^/]*[._-])?(${tokens})([._-][^/]*)?${CODE}`, "i");
266
+ const RULES = [
267
+ { marker: "authentication", test: dirOrName("auth|authn|authentication|login|oauth|oidc-client|jwt|jwks|mfa|totp|passkeys?|webauthn") },
268
+ { marker: "authorization", test: dirOrName("authz|authorization|permissions?|rbac|abac|acl|(access|auth)-?polic(y|ies)|rls|guards?") },
269
+ { marker: "identityFederation", test: dirOrName("sso|oidc|saml|scim|openid|federation|idp") },
270
+ { marker: "secretsManagement", test: dirOrName("secrets?|vault|kms|keyvault|sops|dotenv-vault") },
271
+ { marker: "encryption", test: dirOrName("encrypt(ion)?|cipher|crypto|pseudonymi[sz]|anonymi[sz]|tokeni[sz]|argon2?|bcrypt|scrypt") },
272
+ { marker: "signing", test: new RegExp(`(^|\\/)(signing|cosign|sigstore|gpg|attestations?)\\/.*${CODE}|(^|\\/)(signing|crypto)\\/[^/]*signatures?[^/]*${CODE}|(^|\\/)([^/]*[._-])?(signing|cosign|sigstore|gpg|hmac|attestations?)([._-][^/]*)?${CODE}`, "i") },
273
+ { marker: "rateLimiting", test: dirOrName("rate-?limit(er|ing)?|ratelimit|throttl(e|ing)|quota") },
274
+ { marker: "auditLogging", test: dirOrName("audit(-?log|-?trail)?|audits") },
275
+ { marker: "transportSecurity", test: dirOrName("csp|security-?headers|cors|hsts|tls|ssl|certs?|certificates?|helmet") },
276
+ { marker: "backupRecovery", test: dirOrName("backups?|restore|pitr|disaster-?recovery") },
277
+ { marker: "dependencyHygiene", test: /(^|\/)\.github\/dependabot\.ya?ml$|(^|\/)renovate\.json5?$|(^|\/)\.renovaterc(\.json)?$|(^|\/)\.snyk$|(^|\/)(trivy|grype|audit-ci)[^/]*\.(ya?ml|json)$|(^|\/)\.github\/workflows\/[^/]*(codeql|dependency|security|audit|scan)[^/]*\.ya?ml$/i },
278
+ ];
279
+ function securityMarkersOfFile(path) {
280
+ return RULES.filter((rule) => rule.test.test(path)).map((rule) => rule.marker);
281
+ }
282
+ function securityMarkersOfFiles(paths) {
283
+ const found = new Set();
284
+ for (const path of paths)
285
+ for (const marker of securityMarkersOfFile(path))
286
+ found.add(marker);
287
+ return [...found].sort();
288
+ }
289
+ const num = (value) => (typeof value === "number" && Number.isFinite(value) ? value : typeof value === "string" && value.trim() !== "" && Number.isFinite(Number(value)) ? Number(value) : null);
290
+ const isMarker = (value) => SECURITY_MARKERS.includes(String(value));
291
+ function securityCoverageOf(value) {
292
+ if (!value || typeof value !== "object")
293
+ return null;
294
+ const raw = value.markers;
295
+ if (!Array.isArray(raw))
296
+ return null;
297
+ const markers = [];
298
+ for (const row of raw) {
299
+ const units = num(row.units), strictUnits = num(row.strictUnits), projects = num(row.projects);
300
+ if (!isMarker(row.marker) || units === null || strictUnits === null || projects === null || typeof row.production !== "boolean")
301
+ continue;
302
+ markers.push({ marker: row.marker, units, strictUnits, projects, production: row.production, lastAt: typeof row.lastAt === "string" ? new Date(row.lastAt).toISOString() : null });
303
+ }
304
+ return {
305
+ total: SECURITY_MARKERS.length,
306
+ covered: markers.filter((m) => m.units > 0).length,
307
+ inProduction: markers.filter((m) => m.units > 0 && m.production).length,
308
+ strictCovered: markers.filter((m) => m.strictUnits > 0).length,
309
+ markers: markers.sort((a, b) => b.units - a.units || a.marker.localeCompare(b.marker)),
310
+ };
311
+ }
312
+ return { SECURITY_MARKERS, securityMarkersOfFile, securityMarkersOfFiles, securityCoverageOf };
313
+ })();
314
+
315
+ // ── packages/core/src/scoring/agent-markers.ts ──
316
+ const agentMarkers = (() => {
317
+ const AGENT_MARKERS = [
318
+ "agentDefinition",
319
+ "skillDefinition",
320
+ "hookDefinition",
321
+ "slashCommand",
322
+ "assistantBrief",
323
+ "mcpManifest",
324
+ "mcpServer",
325
+ "promptTemplate",
326
+ "evalHarness",
327
+ ];
328
+ const RULES = [
329
+ { marker: "agentDefinition", test: /(^|\/)\.(claude|opencode|kilocode)\/agents\/[^/]+\.(md|ya?ml|json)$|(^|\/)agents\/[^/]+\.md$/i },
330
+ { marker: "skillDefinition", test: /(^|\/)skills\/[^/]+\/SKILL\.(md|ya?ml)$|(^|\/)\.(claude|opencode)\/skills\//i },
331
+ { marker: "hookDefinition", test: /(^|\/)\.(claude|opencode|cursor)\/hooks\/|(^|\/)hooks\/[^/]*(session|pretool|posttool|prompt|stop)[^/]*\.(m?[jt]s|py|sh)$/i },
332
+ { marker: "slashCommand", test: /(^|\/)\.(claude|opencode)\/commands\/[^/]+\.(md|ya?ml)$/i },
333
+ { marker: "assistantBrief", test: /(^|\/)(CLAUDE|AGENTS|GEMINI|CONVENTIONS)\.md$|(^|\/)\.cursorrules$|(^|\/)\.cursor\/rules\/|(^|\/)\.github\/copilot-instructions\.md$|(^|\/)\.windsurfrules$|(^|\/)\.aider\.conf\.ya?ml$/i },
334
+ { marker: "mcpManifest", test: /(^|\/)\.?mcp\.json$|(^|\/)\.(claude|cursor|vscode)\/mcp\.json$/i },
335
+ { marker: "mcpServer", test: /(^|\/)mcp(-server)?\/.*\.(m?[jt]sx?|py|go|rs|rb|java|cs)$|(^|\/)[^/]*mcp[-_]?server[^/]*\.(m?[jt]sx?|py|go|rs)$/i },
336
+ { marker: "promptTemplate", test: /(^|\/)prompts?\/[^/]+\.(md|txt|ya?ml|json|jinja2?|hbs|mustache)$|(^|\/)[^/]*\.prompt\.(md|txt|ya?ml)$/i },
337
+ { marker: "evalHarness", test: /(^|\/)(evals?|evaluations?|benchmarks?\/(llm|model|prompt)[^/]*)\/[^/]+\.(m?[jt]sx?|py)$|(^|\/)evals\/[^/]+\.jsonl$|(^|\/)[^/]*\.eval\.(m?[jt]s|py)$/i },
338
+ ];
339
+ const MARKER_VERSION = "1.0.2";
340
+ function agentMarkersOfFile(path) {
341
+ return RULES.filter((rule) => rule.test.test(path)).map((rule) => rule.marker);
342
+ }
343
+ function agentMarkersOfFiles(paths) {
344
+ const found = new Set();
345
+ for (const path of paths)
346
+ for (const marker of agentMarkersOfFile(path))
347
+ found.add(marker);
348
+ return [...found].sort();
349
+ }
350
+ function isAgentMarker(value) {
351
+ return typeof value === "string" && AGENT_MARKERS.includes(value);
352
+ }
353
+ const AGENT_MARKER_AREA = {
354
+ agentDefinition: "agentsTools",
355
+ skillDefinition: "agentsTools",
356
+ hookDefinition: "agentsTools",
357
+ slashCommand: "agentsTools",
358
+ assistantBrief: "agentsTools",
359
+ mcpManifest: "agentsTools",
360
+ mcpServer: "agentsTools",
361
+ promptTemplate: "models",
362
+ evalHarness: "evaluation",
363
+ };
364
+ function decodeAgentMarkerRows(raw) {
365
+ if (!Array.isArray(raw))
366
+ return null;
367
+ const rows = [];
368
+ for (const value of raw) {
369
+ if (!value || typeof value !== 'object' || Array.isArray(value))
370
+ return null;
371
+ const entry = value;
372
+ if (!isAgentMarker(entry.marker))
373
+ continue;
374
+ if (typeof entry.units !== 'number' || !Number.isSafeInteger(entry.units) || entry.units < 0 ||
375
+ typeof entry.projects !== 'number' || !Number.isSafeInteger(entry.projects) || entry.projects < 0)
376
+ return null;
377
+ rows.push({ marker: entry.marker, units: entry.units, projects: entry.projects,
378
+ firstAt: typeof entry.firstAt === 'string' ? entry.firstAt : null,
379
+ lastAt: typeof entry.lastAt === 'string' ? entry.lastAt : null });
380
+ }
381
+ return rows;
382
+ }
383
+ return { AGENT_MARKERS, MARKER_VERSION, agentMarkersOfFile, agentMarkersOfFiles, isAgentMarker, AGENT_MARKER_AREA, decodeAgentMarkerRows };
384
+ })();
385
+
386
+ // ── packages/core/src/scoring/project-links.ts ──
387
+ const projectLinks = (() => {
388
+ const PROPOSED = { rootPrefixDepth: { value: 3 } };
389
+ const PROJECT_LINK_KINDS = ["repository", "provider_project", "root_directory", "deploy_target"];
390
+ const rootPrefixDepth = () => Math.round(PROPOSED.rootPrefixDepth.value);
391
+ function normaliseRootDirectory(value, depth = rootPrefixDepth()) {
392
+ if (typeof value !== "string")
393
+ return null;
394
+ const trimmed = value.trim().replace(/^(\.\/)+/, "").replace(/^\/+|\/+$/g, "");
395
+ if (trimmed === "" || trimmed === ".")
396
+ return null;
397
+ return trimmed.split("/").filter(Boolean).slice(0, Math.max(1, depth)).join("/");
398
+ }
399
+ function rootPrefixesOf(paths, depth = rootPrefixDepth()) {
400
+ const out = new Set();
401
+ for (const path of paths) {
402
+ const trimmed = path.trim().replace(/^(\.\/)+/, "").replace(/^\/+|\/+$/g, "");
403
+ const parts = trimmed === "" ? [] : trimmed.split("/").filter(Boolean);
404
+ for (let i = 1; i < parts.length && i <= depth; i += 1)
405
+ out.add(parts.slice(0, i).join("/"));
406
+ }
407
+ return [...out].sort();
408
+ }
409
+ return { PROJECT_LINK_KINDS, rootPrefixDepth, normaliseRootDirectory, rootPrefixesOf };
410
+ })();
411
+
412
+ // ── packages/core/src/scoring/commit-features.ts ──
413
+ const commitFeatures = (() => {
414
+ const { CLASSIFIER_VERSION, classRuleOf } = gitClasses;
415
+ const { manifestsOfFiles } = stack;
416
+ const { archOfFiles } = architecture;
417
+ const EXTENSION = /\.([A-Za-z0-9]{1,12})$/;
418
+ function extensionOf(path) {
419
+ const base = path.split("/").pop() ?? path;
420
+ if (base.startsWith(".") && base.indexOf(".", 1) < 0)
421
+ return "(none)";
422
+ const match = EXTENSION.exec(base);
423
+ const ext = match?.[1];
424
+ return ext ? ext.toLowerCase() : "(none)";
425
+ }
426
+ function featuresOfFiles(paths) {
427
+ const extensions = {};
428
+ const rules = new Set();
429
+ for (const path of paths) {
430
+ const ext = extensionOf(path);
431
+ extensions[ext] = (extensions[ext] ?? 0) + 1;
432
+ const rule = classRuleOf(path);
433
+ if (rule)
434
+ rules.add(rule.id);
435
+ }
436
+ return { files: paths.length, extensions, classRules: [...rules].sort(), manifests: manifestsOfFiles(paths), archPoints: [...archOfFiles(paths)].sort(), classifier: CLASSIFIER_VERSION };
437
+ }
438
+ return { extensionOf, featuresOfFiles };
439
+ })();
440
+
441
+ export const { stackOfFiles, manifestsOfFiles, TECHNOLOGIES } = stack;
442
+ export const { classesOfFiles, CLASSIFIER_VERSION, CLASS_RULES } = gitClasses;
443
+ export const { archOfFiles, ARCHITECTURE_POINTS } = architecture;
444
+ export const { securityMarkersOfFiles, SECURITY_MARKERS } = securityMarkers;
445
+ export const { agentMarkersOfFiles, MARKER_VERSION, AGENT_MARKERS } = agentMarkers;
446
+ export const { rootPrefixesOf } = projectLinks;
447
+ export const { featuresOfFiles } = commitFeatures;
@@ -1 +1 @@
1
- {"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"chat-exports.mjs":"04eafe333940ec03d5058d8d51062124aa12ab882bf04db03bcda5613ec69298","claude-mod.mjs":"02d86b0cdddf39879efc5194c0a5be6b41456faedec28963dc123a4e88dc3942","config-edits.mjs":"0eba2f176ef6f7afba071d6e00de0ff19ba2b283180a801dfd957aa38c1edd94","count-behaviour.mjs":"1beaec2a4d0aead76d166f89cc52441a9cf48f2e69da9888ca2091dd3a10a37b","credential-store.mjs":"a4b3540a61f4ce19e535c7f1d260c0d817686cd066d559a76db2ab108144abba","credential-vault-scripts.mjs":"7e42fe1db3885c2dec6f1de87bebfbefe2292d29179a68f3da87d19eb6c7704b","credential-vault.mjs":"279baabb217e2a3f170e8d7f2b271a88484531f9031c441360ea91561a70da99","history-outbox.mjs":"b84e22542bb2d8195a469ee5f4116356ae9eac4a53ff2d40f0268b5b1de99dc5","log-session.mjs":"35d01fb00a472c022560a880c0863b57f24cb8311040bba21c3f0cf903b9074c","orchestration-contract.mjs":"ec08f303a166365b99e70b675de4cfe76c6156c2567e14b5569f6d992f0231b7","orchestration-evidence.mjs":"d0d06cecf0eb08e5c6e653c62a4f45b1eddf2119c2acb8341056b34f488d214a","orchestration-report.mjs":"d4e0a9ad8e4a01b462d22c6b1866aac291565c533ff476085d3367cb6d59bc1b","package-integrity.mjs":"a8210c9494a56bfb9a5ea3d10064c7a269f0b6330c0af7c0700e706c3c0224e3","preserve-lines.mjs":"2df64a69687aa51219bf7b86b88d175cc50990fa29574b31897e41a9ebeecf43","preserve-summary.mjs":"137f781ed7021596a3f0ea67afcf2ab8616ac293f833dbb8f176e838e0ed8321","preserve.mjs":"3e369083ba43bcda2fa0622fd526aa64fcf8ad66e7b6e8f23821752c4d47ad27","runtime-install.mjs":"aab47b52c79d726ef428a24f982c648fa3f1c2dc2b574f633611d02924864e5f","session-databases.mjs":"543fd3b82d28d96d789be0a1dc9186c5fafa783e98b87e5b3b17b211542e2b4d","setup-mcp.mjs":"0c29113179561af1c1e9ff8b7a786e7240edf48a2244993e12335e5ee362c812","stack-rules.mjs":"b23c56e72ec56ba02b17ed895f869172d988c468a697e8d6026b0e268f61e489","stretch-evidence.mjs":"5f5667b92adf11b1a5a6330a0f26dd6db73d56fe60823d9a5246dab71d27d380","transcript-readers.mjs":"ed6fef364aa28f39361d8f627abcda2162498cbaa13e90cc5860a768cb355fa2","worktrust-launch.mjs":"84801bd29d472d48188c126b9ebe3989a3132b54e13cc4fe534ff7c383a294ee","worktrust.mjs":"0e481fde109620dd23f750d7b9b0741c0ea831c45961a176164ef2a74f3dd7c0"},"format":"worktrust-package/1","kind":"engine","version":"0.10.32"},"signature":"j7kCqXaW7lS8jyExo_Ag4eCHLtVYFSMIOJY745sZrrFyRTOfOc59k8kYFKCST-KMkQQctNK9QuLZAox_1UzwDQ"}
1
+ {"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"chat-exports.mjs":"04eafe333940ec03d5058d8d51062124aa12ab882bf04db03bcda5613ec69298","claude-mod.mjs":"02d86b0cdddf39879efc5194c0a5be6b41456faedec28963dc123a4e88dc3942","commit-rules.mjs":"e94cc32a5415f6d9e978145ab9505ac4ae0bac9431e6e9104b9b37155260b51f","config-edits.mjs":"0eba2f176ef6f7afba071d6e00de0ff19ba2b283180a801dfd957aa38c1edd94","count-behaviour.mjs":"1beaec2a4d0aead76d166f89cc52441a9cf48f2e69da9888ca2091dd3a10a37b","credential-store.mjs":"a4b3540a61f4ce19e535c7f1d260c0d817686cd066d559a76db2ab108144abba","credential-vault-scripts.mjs":"7e42fe1db3885c2dec6f1de87bebfbefe2292d29179a68f3da87d19eb6c7704b","credential-vault.mjs":"279baabb217e2a3f170e8d7f2b271a88484531f9031c441360ea91561a70da99","git-commits.mjs":"f9c084c54937a86df8fe30a0db2a58e04eeef0dbae69c54b8e368efc9964d6d8","history-outbox.mjs":"b88072a28aa1dd94d9fab880f96b711b5fbed76ca62e5de24d612c08171e5b71","log-session.mjs":"d20e20c4fa5e4dd6a48a2c3b7caf4cefb090063503f38dc4716d8daee6d3bf22","orchestration-contract.mjs":"ec08f303a166365b99e70b675de4cfe76c6156c2567e14b5569f6d992f0231b7","orchestration-evidence.mjs":"d0d06cecf0eb08e5c6e653c62a4f45b1eddf2119c2acb8341056b34f488d214a","orchestration-report.mjs":"d4e0a9ad8e4a01b462d22c6b1866aac291565c533ff476085d3367cb6d59bc1b","package-integrity.mjs":"a8210c9494a56bfb9a5ea3d10064c7a269f0b6330c0af7c0700e706c3c0224e3","preserve-lines.mjs":"2df64a69687aa51219bf7b86b88d175cc50990fa29574b31897e41a9ebeecf43","preserve-summary.mjs":"137f781ed7021596a3f0ea67afcf2ab8616ac293f833dbb8f176e838e0ed8321","preserve.mjs":"3e369083ba43bcda2fa0622fd526aa64fcf8ad66e7b6e8f23821752c4d47ad27","runtime-install.mjs":"aab47b52c79d726ef428a24f982c648fa3f1c2dc2b574f633611d02924864e5f","session-databases.mjs":"543fd3b82d28d96d789be0a1dc9186c5fafa783e98b87e5b3b17b211542e2b4d","setup-mcp.mjs":"0c29113179561af1c1e9ff8b7a786e7240edf48a2244993e12335e5ee362c812","stack-rules.mjs":"b23c56e72ec56ba02b17ed895f869172d988c468a697e8d6026b0e268f61e489","stretch-evidence.mjs":"5f5667b92adf11b1a5a6330a0f26dd6db73d56fe60823d9a5246dab71d27d380","transcript-readers.mjs":"ed6fef364aa28f39361d8f627abcda2162498cbaa13e90cc5860a768cb355fa2","worktrust-launch.mjs":"84801bd29d472d48188c126b9ebe3989a3132b54e13cc4fe534ff7c383a294ee","worktrust.mjs":"dd947a3de77a3db3f17c7027f16a2e5a2da1001ed954808614e20eb871691e6b"},"format":"worktrust-package/1","kind":"engine","version":"0.10.34"},"signature":"i0BO8j2ozw0p-expMu9OV86XI2WzR1OMIMdQ5ROS5-1qEZHI5OVORsz_ZbTd90jgkjcxiP424600KA-Ig1NLAA"}