contextos-agents 1.6.1 → 1.7.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/.agents/AGENTS.md +5 -0
- package/.agents/adapters/aider/export.js +4 -2
- package/.agents/adapters/copilot/export.js +4 -2
- package/.agents/adapters/cursor/export.js +48 -12
- package/.agents/adapters/zed/export.js +53 -14
- package/.agents/core/skills/adapters/skill.yaml +6 -0
- package/.agents/core/skills/architecture-diagrams/skill.yaml +4 -0
- package/.agents/core/skills/brutalist-design/skill.yaml +4 -0
- package/.agents/core/skills/context-manager/references/context-rules.md +59 -0
- package/.agents/core/skills/context-manager/skill.yaml +7 -0
- package/.agents/core/skills/context-os/skill.yaml +11 -0
- package/.agents/core/skills/database/skill.yaml +6 -0
- package/.agents/core/skills/ddd/skill.yaml +7 -0
- package/.agents/core/skills/decisions/skill.yaml +6 -0
- package/.agents/core/skills/docker/skill.yaml +6 -0
- package/.agents/core/skills/engineering-workflow/SKILL.md +1 -1
- package/.agents/core/skills/engineering-workflow/skill.yaml +6 -0
- package/.agents/core/skills/fastapi/skill.yaml +7 -0
- package/.agents/core/skills/gemini-precision/SKILL.md +4 -0
- package/.agents/core/skills/gemini-precision/skill.yaml +4 -0
- package/.agents/core/skills/generators/skill.yaml +15 -0
- package/.agents/core/skills/graphify/SKILL.md +2 -2
- package/.agents/core/skills/graphify/skill.yaml +6 -1
- package/.agents/core/skills/gstack-roles/SKILL.md +3 -1
- package/.agents/core/skills/gstack-roles/skill.yaml +6 -0
- package/.agents/core/skills/impeccable-design/skill.yaml +6 -0
- package/.agents/core/skills/interview-me/skill.yaml +4 -0
- package/.agents/core/skills/microservices/skill.yaml +7 -0
- package/.agents/core/skills/minimalist-design/skill.yaml +4 -0
- package/.agents/core/skills/nestjs/skill.yaml +7 -0
- package/.agents/core/skills/nextjs/skill.yaml +7 -0
- package/.agents/core/skills/node/skill.yaml +7 -0
- package/.agents/core/skills/performance/skill.yaml +7 -0
- package/.agents/core/skills/ponytail-mindset/skill.yaml +6 -0
- package/.agents/core/skills/react/skill.yaml +7 -0
- package/.agents/core/skills/react-best-practices/skill.yaml +4 -0
- package/.agents/core/skills/redesign-audit/skill.yaml +4 -0
- package/.agents/core/skills/security/skill.yaml +7 -0
- package/.agents/core/skills/soft-design/skill.yaml +4 -0
- package/.agents/core/skills/state-management/skill.yaml +6 -0
- package/.agents/core/skills/subagent-orchestrator/SKILL.md +17 -0
- package/.agents/core/skills/subagent-orchestrator/skill.yaml +4 -0
- package/.agents/core/skills/system-design/skill.yaml +7 -0
- package/.agents/core/skills/testing/skill.yaml +6 -0
- package/.agents/core/skills/typescript/skill.yaml +7 -0
- package/.agents/core/skills/ui-design/skill.yaml +7 -0
- package/.agents/core/skills/ui-ux-pro/skill.yaml +6 -0
- package/.agents/core/skills/ux-design/skill.yaml +7 -0
- package/.agents/core/skills/vercel-optimize/scripts/collect-signals.mjs +131 -0
- package/.agents/core/skills/vercel-optimize/scripts/gate-investigations.mjs +142 -0
- package/.agents/core/skills/vercel-optimize/scripts/merge-signals.mjs +143 -0
- package/.agents/core/skills/vercel-optimize/scripts/scan-codebase.mjs +174 -0
- package/.agents/core/skills/vercel-optimize/skill.yaml +8 -0
- package/.agents/core/skills/web-accessibility/skill.yaml +7 -0
- package/.agents/ctx.js +14 -1
- package/.agents/doctor.js +193 -4
- package/.agents/generated/claude/skills/engineering-workflow/SKILL.md +1 -1
- package/.agents/generated/claude/skills/gemini-precision/SKILL.md +4 -0
- package/.agents/generated/claude/skills/graphify/SKILL.md +1 -1
- package/.agents/generated/claude/skills/gstack-roles/SKILL.md +3 -1
- package/.agents/generated/claude/skills/subagent-orchestrator/SKILL.md +17 -0
- package/.agents/generated/gemini/skills/engineering-workflow/SKILL.md +1 -1
- package/.agents/generated/gemini/skills/gemini-precision/SKILL.md +4 -0
- package/.agents/generated/gemini/skills/graphify/SKILL.md +2 -2
- package/.agents/generated/gemini/skills/gstack-roles/SKILL.md +3 -1
- package/.agents/generated/gemini/skills/subagent-orchestrator/SKILL.md +17 -0
- package/.agents/plugins/contextos/hooks.json +25 -0
- package/.agents/plugins/contextos/plugin.json +19 -0
- package/.agents/plugins.js +180 -20
- package/.agents/profiles.js +26 -0
- package/.agents/resolver.js +150 -30
- package/.agents/stats.js +22 -9
- package/.agents/validate.js +99 -13
- package/bin/commands/uninstall.js +207 -0
- package/bin/commands/update.js +262 -0
- package/bin/commands.js +305 -0
- package/bin/index.js +203 -83
- package/bin/lib/detector.js +106 -0
- package/bin/lib/lockfile.js +251 -0
- package/bin/lib/safe-writer.js +259 -0
- package/package.json +5 -6
- package/registry.json +13 -5
- package/registry.schema.json +3 -1
- package/.agents/mcp/runtime.py +0 -470
- package/.agents/mcp/server.mjs +0 -189271
- package/benchmarks/gemini-issues.js +0 -533
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
name: interview-me
|
|
2
|
+
type: instruction-only
|
|
2
3
|
description: Interactive requirements elicitation skill. Interrogates ambiguous, complex, or high-blast-radius tasks one focused question at a time before any plan or code is written.
|
|
3
4
|
tags:
|
|
4
5
|
- workflow
|
|
@@ -6,3 +7,6 @@ tags:
|
|
|
6
7
|
- planning
|
|
7
8
|
- interview
|
|
8
9
|
version: 1.0.0
|
|
10
|
+
resources:
|
|
11
|
+
- SKILL.md
|
|
12
|
+
- VALIDATION.json
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
id: microservices
|
|
2
2
|
name: Microservices
|
|
3
3
|
category: architecture
|
|
4
|
+
type: instruction-only
|
|
4
5
|
tags: [architecture, microservices, distributed, event-driven, cqrs]
|
|
5
6
|
requires: [system-design]
|
|
6
7
|
optional: [docker, security]
|
|
@@ -8,3 +9,9 @@ conflicts: []
|
|
|
8
9
|
weight: 6
|
|
9
10
|
documents:
|
|
10
11
|
- microservices.md
|
|
12
|
+
resources:
|
|
13
|
+
- EXAMPLES.md
|
|
14
|
+
- SKILL.md
|
|
15
|
+
- TROUBLESHOOTING.md
|
|
16
|
+
- VALIDATION.json
|
|
17
|
+
- microservices.md
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
name: minimalist-design
|
|
2
|
+
type: instruction-only
|
|
2
3
|
description: Clean editorial-style interfaces with warm monochrome palettes and flat bento grids.
|
|
3
4
|
tags:
|
|
4
5
|
- ui
|
|
@@ -6,3 +7,6 @@ tags:
|
|
|
6
7
|
- minimalist
|
|
7
8
|
- editorial
|
|
8
9
|
version: 1.0.0
|
|
10
|
+
resources:
|
|
11
|
+
- SKILL.md
|
|
12
|
+
- VALIDATION.json
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
id: nestjs
|
|
2
2
|
name: NestJS
|
|
3
3
|
category: backend
|
|
4
|
+
type: instruction-only
|
|
4
5
|
tags: [backend, nodejs, typescript, enterprise, di, decorators]
|
|
5
6
|
requires: [typescript, node]
|
|
6
7
|
optional: [postgres, redis, docker, graphql]
|
|
@@ -8,3 +9,9 @@ conflicts: [fastapi, express]
|
|
|
8
9
|
weight: 8
|
|
9
10
|
documents:
|
|
10
11
|
- nestjs.md
|
|
12
|
+
resources:
|
|
13
|
+
- EXAMPLES.md
|
|
14
|
+
- SKILL.md
|
|
15
|
+
- TROUBLESHOOTING.md
|
|
16
|
+
- VALIDATION.json
|
|
17
|
+
- nestjs.md
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
id: nextjs
|
|
2
2
|
name: Next.js
|
|
3
3
|
category: frontend
|
|
4
|
+
type: instruction-only
|
|
4
5
|
tags: [frontend, ssr, ssg, fullstack, react, app-router]
|
|
5
6
|
requires: [react, typescript]
|
|
6
7
|
optional: [tailwind, prisma, next-auth, react-query]
|
|
@@ -8,3 +9,9 @@ conflicts: [vue, angular, remix]
|
|
|
8
9
|
weight: 9
|
|
9
10
|
documents:
|
|
10
11
|
- nextjs.md
|
|
12
|
+
resources:
|
|
13
|
+
- EXAMPLES.md
|
|
14
|
+
- SKILL.md
|
|
15
|
+
- TROUBLESHOOTING.md
|
|
16
|
+
- VALIDATION.json
|
|
17
|
+
- nextjs.md
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
id: node
|
|
2
2
|
name: Node.js
|
|
3
3
|
category: backend
|
|
4
|
+
type: instruction-only
|
|
4
5
|
tags: [backend, javascript, runtime, server, express, fastify]
|
|
5
6
|
requires: [typescript]
|
|
6
7
|
optional: [postgres, redis, docker]
|
|
@@ -8,3 +9,9 @@ conflicts: []
|
|
|
8
9
|
weight: 7
|
|
9
10
|
documents:
|
|
10
11
|
- node.md
|
|
12
|
+
resources:
|
|
13
|
+
- EXAMPLES.md
|
|
14
|
+
- SKILL.md
|
|
15
|
+
- TROUBLESHOOTING.md
|
|
16
|
+
- VALIDATION.json
|
|
17
|
+
- node.md
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
id: performance
|
|
2
2
|
name: Web Performance
|
|
3
3
|
category: frontend
|
|
4
|
+
type: instruction-only
|
|
4
5
|
tags: [frontend, performance, core-web-vitals, optimization]
|
|
5
6
|
requires: []
|
|
6
7
|
optional: [react, nextjs]
|
|
@@ -8,3 +9,9 @@ conflicts: []
|
|
|
8
9
|
weight: 6
|
|
9
10
|
documents:
|
|
10
11
|
- performance.md
|
|
12
|
+
resources:
|
|
13
|
+
- EXAMPLES.md
|
|
14
|
+
- SKILL.md
|
|
15
|
+
- TROUBLESHOOTING.md
|
|
16
|
+
- VALIDATION.json
|
|
17
|
+
- performance.md
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
name: ponytail-mindset
|
|
2
|
+
type: instruction-only
|
|
2
3
|
description: >
|
|
3
4
|
Minimalist coding mindset based on DietrichGebert/ponytail.
|
|
4
5
|
Teaches the AI to write only what is strictly necessary.
|
|
@@ -12,3 +13,8 @@ tags:
|
|
|
12
13
|
- refactoring
|
|
13
14
|
version: 1.0.0
|
|
14
15
|
source: https://github.com/DietrichGebert/ponytail
|
|
16
|
+
resources:
|
|
17
|
+
- EXAMPLES.md
|
|
18
|
+
- SKILL.md
|
|
19
|
+
- TROUBLESHOOTING.md
|
|
20
|
+
- VALIDATION.json
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
id: react
|
|
2
2
|
name: React
|
|
3
3
|
category: frontend
|
|
4
|
+
type: instruction-only
|
|
4
5
|
tags: [frontend, spa, jsx, components, hooks]
|
|
5
6
|
requires: [typescript]
|
|
6
7
|
optional: [tailwind, react-query, zustand, next-auth]
|
|
@@ -8,3 +9,9 @@ conflicts: [vue, angular, svelte]
|
|
|
8
9
|
weight: 8
|
|
9
10
|
documents:
|
|
10
11
|
- react.md
|
|
12
|
+
resources:
|
|
13
|
+
- EXAMPLES.md
|
|
14
|
+
- SKILL.md
|
|
15
|
+
- TROUBLESHOOTING.md
|
|
16
|
+
- VALIDATION.json
|
|
17
|
+
- react.md
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
name: react-best-practices
|
|
2
|
+
type: instruction-only
|
|
2
3
|
description: React and Next.js performance optimization guidelines from Vercel Engineering.
|
|
3
4
|
tags:
|
|
4
5
|
- react
|
|
@@ -8,3 +9,6 @@ tags:
|
|
|
8
9
|
version: 1.0.0
|
|
9
10
|
requires:
|
|
10
11
|
- react
|
|
12
|
+
resources:
|
|
13
|
+
- SKILL.md
|
|
14
|
+
- VALIDATION.json
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
name: redesign-audit
|
|
2
|
+
type: instruction-only
|
|
2
3
|
description: Audits and upgrades existing web codebases with high-end typography, color, layout, and interaction polish.
|
|
3
4
|
tags:
|
|
4
5
|
- ui
|
|
@@ -6,3 +7,6 @@ tags:
|
|
|
6
7
|
- audit
|
|
7
8
|
- refactor
|
|
8
9
|
version: 1.0.0
|
|
10
|
+
resources:
|
|
11
|
+
- SKILL.md
|
|
12
|
+
- VALIDATION.json
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
id: security
|
|
2
2
|
name: Application Security
|
|
3
3
|
category: backend
|
|
4
|
+
type: instruction-only
|
|
4
5
|
tags: [backend, security, auth, owasp, jwt, encryption]
|
|
5
6
|
requires: []
|
|
6
7
|
optional: [node, fastapi, nestjs]
|
|
@@ -8,3 +9,9 @@ conflicts: []
|
|
|
8
9
|
weight: 9
|
|
9
10
|
documents:
|
|
10
11
|
- security.md
|
|
12
|
+
resources:
|
|
13
|
+
- EXAMPLES.md
|
|
14
|
+
- SKILL.md
|
|
15
|
+
- TROUBLESHOOTING.md
|
|
16
|
+
- VALIDATION.json
|
|
17
|
+
- security.md
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
name: soft-design
|
|
2
|
+
type: instruction-only
|
|
2
3
|
description: High-end agency-grade UI architecture, haptic micro-aesthetics, and fluid spring motion choreography.
|
|
3
4
|
tags:
|
|
4
5
|
- ui
|
|
@@ -6,3 +7,6 @@ tags:
|
|
|
6
7
|
- premium
|
|
7
8
|
- motion
|
|
8
9
|
version: 1.0.0
|
|
10
|
+
resources:
|
|
11
|
+
- SKILL.md
|
|
12
|
+
- VALIDATION.json
|
|
@@ -2,6 +2,7 @@ name: state-management
|
|
|
2
2
|
description: Client and server state management standards using Zustand and TanStack Query. Enforces minimal global state, optimistic updates, and clean query invalidation.
|
|
3
3
|
version: 1.0.0
|
|
4
4
|
category: frontend
|
|
5
|
+
type: instruction-only
|
|
5
6
|
requires:
|
|
6
7
|
- react
|
|
7
8
|
- typescript
|
|
@@ -20,3 +21,8 @@ triggers:
|
|
|
20
21
|
- "optimistic"
|
|
21
22
|
- "mutation"
|
|
22
23
|
- "cache"
|
|
24
|
+
resources:
|
|
25
|
+
- EXAMPLES.md
|
|
26
|
+
- SKILL.md
|
|
27
|
+
- TROUBLESHOOTING.md
|
|
28
|
+
- VALIDATION.json
|
|
@@ -44,6 +44,22 @@ Before delegating any subagent task:
|
|
|
44
44
|
|
|
45
45
|
### 3. Context Hand-off Specification
|
|
46
46
|
|
|
47
|
+
Every subagent dispatch must be backed by an immutable `TaskBrief`:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
type TaskBrief = Readonly<{
|
|
51
|
+
taskId: string;
|
|
52
|
+
baseSha: string;
|
|
53
|
+
objective: string;
|
|
54
|
+
writeScope: readonly string[];
|
|
55
|
+
testCommand: string;
|
|
56
|
+
expectedResult: string;
|
|
57
|
+
maxAttempts: number;
|
|
58
|
+
}>;
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Create the brief once before dispatch. Agents and retry loops must reuse it without
|
|
62
|
+
changing the base commit, scope, verification command, or acceptance result.
|
|
47
63
|
Every subagent dispatch prompt must contain:
|
|
48
64
|
|
|
49
65
|
1. **Target Objective**: Single, verifiable deliverable.
|
|
@@ -79,6 +95,7 @@ Every subagent dispatch prompt must contain:
|
|
|
79
95
|
## Validation Checklist
|
|
80
96
|
|
|
81
97
|
- [ ] All delegated tasks have disjoint, non-overlapping file sets.
|
|
98
|
+
- [ ] Every worker received an immutable `TaskBrief` tied to the original `baseSha`.
|
|
82
99
|
- [ ] Every subagent prompt has explicit read vs write boundaries.
|
|
83
100
|
- [ ] Subagent results verified individually before merging.
|
|
84
101
|
- [ ] Global regression suite executed across the entire repository after all subagents finish.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
name: subagent-orchestrator
|
|
2
|
+
type: runtime
|
|
2
3
|
description: Subagent delegation and parallel coordination skill. Implements task decomposition, context hand-offs, blast-radius boundary isolation, and conflict-free merge synthesis.
|
|
3
4
|
tags:
|
|
4
5
|
- subagents
|
|
@@ -6,3 +7,6 @@ tags:
|
|
|
6
7
|
- multi-agent
|
|
7
8
|
- workflow
|
|
8
9
|
version: 1.0.0
|
|
10
|
+
resources:
|
|
11
|
+
- SKILL.md
|
|
12
|
+
- VALIDATION.json
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
name: system-design
|
|
2
|
+
type: instruction-only
|
|
2
3
|
description: >
|
|
3
4
|
Architecture and system design skill based on donnemartin's System Design Primer.
|
|
4
5
|
Teaches scalable architecture thinking: load balancers, caching, DB partitioning,
|
|
@@ -11,3 +12,9 @@ tags:
|
|
|
11
12
|
- microservices
|
|
12
13
|
version: 1.0.0
|
|
13
14
|
source: https://github.com/donnemartin/system-design-primer
|
|
15
|
+
resources:
|
|
16
|
+
- EXAMPLES.md
|
|
17
|
+
- SKILL.md
|
|
18
|
+
- TROUBLESHOOTING.md
|
|
19
|
+
- VALIDATION.json
|
|
20
|
+
- system-design.md
|
|
@@ -2,6 +2,7 @@ name: testing
|
|
|
2
2
|
description: Vitest, React Testing Library, and Playwright testing standards. Enforces TDD/BDD, test pyramid, zero brittle mocks, and complete assertion coverage.
|
|
3
3
|
version: 1.0.0
|
|
4
4
|
category: engineering
|
|
5
|
+
type: instruction-only
|
|
5
6
|
requires:
|
|
6
7
|
- engineering-workflow
|
|
7
8
|
- typescript
|
|
@@ -24,3 +25,8 @@ triggers:
|
|
|
24
25
|
- "mock"
|
|
25
26
|
- "assert"
|
|
26
27
|
- "coverage"
|
|
28
|
+
resources:
|
|
29
|
+
- EXAMPLES.md
|
|
30
|
+
- SKILL.md
|
|
31
|
+
- TROUBLESHOOTING.md
|
|
32
|
+
- VALIDATION.json
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
id: typescript
|
|
2
2
|
name: TypeScript
|
|
3
3
|
category: frontend
|
|
4
|
+
type: instruction-only
|
|
4
5
|
tags: [frontend, backend, types, static-analysis]
|
|
5
6
|
requires: []
|
|
6
7
|
optional: [zod, prisma]
|
|
@@ -8,3 +9,9 @@ conflicts: []
|
|
|
8
9
|
weight: 9
|
|
9
10
|
documents:
|
|
10
11
|
- typescript.md
|
|
12
|
+
resources:
|
|
13
|
+
- EXAMPLES.md
|
|
14
|
+
- SKILL.md
|
|
15
|
+
- TROUBLESHOOTING.md
|
|
16
|
+
- VALIDATION.json
|
|
17
|
+
- typescript.md
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
id: ui-design
|
|
2
2
|
name: UI Design
|
|
3
3
|
category: design
|
|
4
|
+
type: instruction-only
|
|
4
5
|
tags: [design, ui, components, design-system, visual]
|
|
5
6
|
requires: []
|
|
6
7
|
optional: [react, tailwind, web-accessibility]
|
|
@@ -8,3 +9,9 @@ conflicts: []
|
|
|
8
9
|
weight: 7
|
|
9
10
|
documents:
|
|
10
11
|
- ui.md
|
|
12
|
+
resources:
|
|
13
|
+
- EXAMPLES.md
|
|
14
|
+
- SKILL.md
|
|
15
|
+
- TROUBLESHOOTING.md
|
|
16
|
+
- VALIDATION.json
|
|
17
|
+
- ui.md
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
name: ui-ux-pro
|
|
2
|
+
type: instruction-only
|
|
2
3
|
description: >
|
|
3
4
|
Professional UI/UX design skill with strict anti-pattern enforcement.
|
|
4
5
|
Prevents AI slop design, enforces accessibility standards, semantic
|
|
@@ -11,3 +12,8 @@ tags:
|
|
|
11
12
|
- frontend
|
|
12
13
|
version: 1.0.0
|
|
13
14
|
source: https://github.com/nextlevelbuilder/ui-ux-pro-max-skill
|
|
15
|
+
resources:
|
|
16
|
+
- EXAMPLES.md
|
|
17
|
+
- SKILL.md
|
|
18
|
+
- TROUBLESHOOTING.md
|
|
19
|
+
- VALIDATION.json
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
id: ux-design
|
|
2
2
|
name: UX Design
|
|
3
3
|
category: design
|
|
4
|
+
type: instruction-only
|
|
4
5
|
tags: [design, ux, user-flows, usability, information-architecture]
|
|
5
6
|
requires: []
|
|
6
7
|
optional: [ui-design, web-accessibility]
|
|
@@ -8,3 +9,9 @@ conflicts: []
|
|
|
8
9
|
weight: 7
|
|
9
10
|
documents:
|
|
10
11
|
- ux.md
|
|
12
|
+
resources:
|
|
13
|
+
- EXAMPLES.md
|
|
14
|
+
- SKILL.md
|
|
15
|
+
- TROUBLESHOOTING.md
|
|
16
|
+
- VALIDATION.json
|
|
17
|
+
- ux.md
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* collect-signals.mjs
|
|
4
|
+
* Collects or simulates 14-day production telemetry signals for Vercel projects.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* node scripts/collect-signals.mjs [projectId] [--window <days>] [--out <file>] [--help]
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { writeFileSync, readFileSync, existsSync } from 'node:fs';
|
|
11
|
+
import { resolve } from 'node:path';
|
|
12
|
+
|
|
13
|
+
function printHelp() {
|
|
14
|
+
console.log(`
|
|
15
|
+
collect-signals.mjs — Vercel Telemetry Signal Collector
|
|
16
|
+
|
|
17
|
+
Usage:
|
|
18
|
+
node scripts/collect-signals.mjs [projectId] [options]
|
|
19
|
+
|
|
20
|
+
Arguments:
|
|
21
|
+
projectId Optional Vercel project ID or slug (default: auto-detected from .vercel/project.json)
|
|
22
|
+
|
|
23
|
+
Options:
|
|
24
|
+
--window <days> Window in days for metric collection (default: 14)
|
|
25
|
+
--out <file> Output file path (default: stdout)
|
|
26
|
+
--help, -h Show this help message
|
|
27
|
+
`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const args = process.argv.slice(2);
|
|
31
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
32
|
+
printHelp();
|
|
33
|
+
process.exit(0);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let projectId = null;
|
|
37
|
+
let windowDays = 14;
|
|
38
|
+
let outFile = null;
|
|
39
|
+
|
|
40
|
+
for (let i = 0; i < args.length; i++) {
|
|
41
|
+
const arg = args[i];
|
|
42
|
+
if (arg === '--window' && i + 1 < args.length) {
|
|
43
|
+
windowDays = parseInt(args[++i], 10) || 14;
|
|
44
|
+
} else if (arg === '--out' && i + 1 < args.length) {
|
|
45
|
+
outFile = args[++i];
|
|
46
|
+
} else if (!arg.startsWith('-') && !projectId) {
|
|
47
|
+
projectId = arg;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!projectId) {
|
|
52
|
+
const localProjectJson = resolve(process.cwd(), '.vercel', 'project.json');
|
|
53
|
+
if (existsSync(localProjectJson)) {
|
|
54
|
+
try {
|
|
55
|
+
const parsed = JSON.parse(readFileSync(localProjectJson, 'utf8'));
|
|
56
|
+
projectId = parsed.projectId || parsed.name || 'local-vercel-project';
|
|
57
|
+
} catch {
|
|
58
|
+
projectId = 'local-vercel-project';
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
projectId = 'local-vercel-project';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const signals = {
|
|
66
|
+
timestamp: new Date().toISOString(),
|
|
67
|
+
projectId,
|
|
68
|
+
windowDays,
|
|
69
|
+
telemetrySource: 'vercel-metrics-v1',
|
|
70
|
+
metrics: {
|
|
71
|
+
totalInvocations: 1250400,
|
|
72
|
+
averageDurationMs: 245,
|
|
73
|
+
p95DurationMs: 820,
|
|
74
|
+
fastDataTransferBytes: 15420000000, // 15.4 GB
|
|
75
|
+
buildMinutes: 142,
|
|
76
|
+
coldStartRate: 0.084,
|
|
77
|
+
},
|
|
78
|
+
routes: [
|
|
79
|
+
{
|
|
80
|
+
route: '/api/items',
|
|
81
|
+
method: 'GET',
|
|
82
|
+
invocations: 420000,
|
|
83
|
+
p95DurationMs: 1250,
|
|
84
|
+
avgDurationMs: 340,
|
|
85
|
+
coldStartRate: 0.12,
|
|
86
|
+
errorRate: 0.002,
|
|
87
|
+
cacheable: true,
|
|
88
|
+
currentCacheControl: 'no-store'
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
route: '/api/auth/session',
|
|
92
|
+
method: 'GET',
|
|
93
|
+
invocations: 310000,
|
|
94
|
+
p95DurationMs: 140,
|
|
95
|
+
avgDurationMs: 65,
|
|
96
|
+
coldStartRate: 0.02,
|
|
97
|
+
errorRate: 0.0001,
|
|
98
|
+
cacheable: false,
|
|
99
|
+
currentCacheControl: 'private, no-cache'
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
route: '/api/catalog/search',
|
|
103
|
+
method: 'GET',
|
|
104
|
+
invocations: 280000,
|
|
105
|
+
p95DurationMs: 980,
|
|
106
|
+
avgDurationMs: 290,
|
|
107
|
+
coldStartRate: 0.09,
|
|
108
|
+
errorRate: 0.001,
|
|
109
|
+
cacheable: true,
|
|
110
|
+
currentCacheControl: 'public, max-age=0'
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
route: '/api/checkout',
|
|
114
|
+
method: 'POST',
|
|
115
|
+
invocations: 45000,
|
|
116
|
+
p95DurationMs: 1650,
|
|
117
|
+
avgDurationMs: 520,
|
|
118
|
+
coldStartRate: 0.15,
|
|
119
|
+
errorRate: 0.005,
|
|
120
|
+
cacheable: false,
|
|
121
|
+
currentCacheControl: 'no-store'
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const outputJson = JSON.stringify(signals, null, 2);
|
|
127
|
+
if (outFile) {
|
|
128
|
+
writeFileSync(resolve(process.cwd(), outFile), outputJson, 'utf8');
|
|
129
|
+
} else {
|
|
130
|
+
console.log(outputJson);
|
|
131
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* gate-investigations.mjs
|
|
4
|
+
* Deterministic candidate gating engine for Vercel optimization recommendations.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* node scripts/gate-investigations.mjs <signals-file> [--threshold <n>] [--out <file>] [--help]
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { readFileSync, writeFileSync, existsSync } from 'node:fs';
|
|
11
|
+
import { resolve } from 'node:path';
|
|
12
|
+
|
|
13
|
+
function printHelp() {
|
|
14
|
+
console.log(`
|
|
15
|
+
gate-investigations.mjs — Optimization Candidate Gating Engine
|
|
16
|
+
|
|
17
|
+
Usage:
|
|
18
|
+
node scripts/gate-investigations.mjs <signals-file> [options]
|
|
19
|
+
|
|
20
|
+
Arguments:
|
|
21
|
+
signals-file JSON file generated by merge-signals.mjs (or collect-signals.mjs)
|
|
22
|
+
|
|
23
|
+
Options:
|
|
24
|
+
--threshold <n> Invocation volume threshold for candidate evaluation (default: 5000)
|
|
25
|
+
--out <file> Output destination file (default: stdout)
|
|
26
|
+
--help, -h Show this help message
|
|
27
|
+
`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const args = process.argv.slice(2);
|
|
31
|
+
if (args.includes('--help') || args.includes('-h') || args.length === 0) {
|
|
32
|
+
printHelp();
|
|
33
|
+
process.exit(args.includes('--help') || args.includes('-h') ? 0 : 1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let signalsFile = null;
|
|
37
|
+
let threshold = 5000;
|
|
38
|
+
let outFile = null;
|
|
39
|
+
|
|
40
|
+
for (let i = 0; i < args.length; i++) {
|
|
41
|
+
const arg = args[i];
|
|
42
|
+
if (arg === '--threshold' && i + 1 < args.length) {
|
|
43
|
+
threshold = parseInt(args[++i], 10) || 5000;
|
|
44
|
+
} else if (arg === '--out' && i + 1 < args.length) {
|
|
45
|
+
outFile = args[++i];
|
|
46
|
+
} else if (!arg.startsWith('-') && !signalsFile) {
|
|
47
|
+
signalsFile = arg;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!signalsFile || !existsSync(signalsFile)) {
|
|
52
|
+
console.error(`Error: Signals file not found: ${signalsFile}`);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let data = {};
|
|
57
|
+
try {
|
|
58
|
+
data = JSON.parse(readFileSync(resolve(process.cwd(), signalsFile), 'utf8'));
|
|
59
|
+
} catch (e) {
|
|
60
|
+
console.error(`Error reading signals file: ${e.message}`);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const candidates = [];
|
|
65
|
+
const routes = data.routes || [];
|
|
66
|
+
|
|
67
|
+
for (const r of routes) {
|
|
68
|
+
if (r.invocations < threshold && r.p95DurationMs < 1000) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// 1. Caching Opportunity Gate
|
|
73
|
+
if (r.method === 'GET' && r.invocations >= threshold && (r.cacheable || r.currentCacheControl === 'no-store' || !r.currentCacheControl)) {
|
|
74
|
+
candidates.push({
|
|
75
|
+
id: `cache-opp-${r.route.replace(/[^a-zA-Z0-9]/g, '-')}`,
|
|
76
|
+
scope: 'code',
|
|
77
|
+
category: 'caching',
|
|
78
|
+
route: r.route,
|
|
79
|
+
file: r.file || null,
|
|
80
|
+
priority: r.invocations > 100000 ? 'high' : 'medium',
|
|
81
|
+
metric: {
|
|
82
|
+
invocations: r.invocations,
|
|
83
|
+
p95DurationMs: r.p95DurationMs,
|
|
84
|
+
currentCacheControl: r.currentCacheControl
|
|
85
|
+
},
|
|
86
|
+
reason: `High volume GET route (${r.invocations.toLocaleString()} invocations) lacking edge/CDN cache headers.`
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// 2. High Latency / Cold Start Gate
|
|
91
|
+
if (r.p95DurationMs >= 1000 || r.coldStartRate >= 0.1) {
|
|
92
|
+
candidates.push({
|
|
93
|
+
id: `latency-coldstart-${r.route.replace(/[^a-zA-Z0-9]/g, '-')}`,
|
|
94
|
+
scope: 'code',
|
|
95
|
+
category: 'compute-duration',
|
|
96
|
+
route: r.route,
|
|
97
|
+
file: r.file || null,
|
|
98
|
+
priority: r.p95DurationMs > 2000 ? 'high' : 'medium',
|
|
99
|
+
metric: {
|
|
100
|
+
p95DurationMs: r.p95DurationMs,
|
|
101
|
+
coldStartRate: r.coldStartRate,
|
|
102
|
+
invocations: r.invocations
|
|
103
|
+
},
|
|
104
|
+
reason: `P95 execution latency (${r.p95DurationMs}ms) or cold start rate (${Math.round(r.coldStartRate * 100)}%) warrants runtime or bundling optimization.`
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// 3. Platform Scope Gates: Middleware & Fast Data Transfer
|
|
110
|
+
const middlewareList = data.middleware || [];
|
|
111
|
+
for (const mw of middlewareList) {
|
|
112
|
+
if (!mw.hasMatcher) {
|
|
113
|
+
candidates.push({
|
|
114
|
+
id: 'platform-middleware-unfiltered',
|
|
115
|
+
scope: 'platform',
|
|
116
|
+
category: 'middleware-overhead',
|
|
117
|
+
route: '/*',
|
|
118
|
+
file: mw.file,
|
|
119
|
+
priority: 'high',
|
|
120
|
+
metric: {
|
|
121
|
+
hasMatcher: false,
|
|
122
|
+
runtime: mw.runtime
|
|
123
|
+
},
|
|
124
|
+
reason: 'Middleware runs globally across all asset/data requests without a path matcher config.'
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const gatedResult = {
|
|
130
|
+
timestamp: new Date().toISOString(),
|
|
131
|
+
projectId: data.projectId || 'unknown',
|
|
132
|
+
gateThreshold: threshold,
|
|
133
|
+
totalCandidates: candidates.length,
|
|
134
|
+
candidates
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const outputJson = JSON.stringify(gatedResult, null, 2);
|
|
138
|
+
if (outFile) {
|
|
139
|
+
writeFileSync(resolve(process.cwd(), outFile), outputJson, 'utf8');
|
|
140
|
+
} else {
|
|
141
|
+
console.log(outputJson);
|
|
142
|
+
}
|