@imransiddique/cpla 1.0.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/README.md +202 -0
- package/SECURITY.md +85 -0
- package/dist/analyzer.d.ts +62 -0
- package/dist/analyzer.d.ts.map +1 -0
- package/dist/analyzer.js +547 -0
- package/dist/analyzer.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +244 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -0
package/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# CPLA MCP Server
|
|
2
|
+
|
|
3
|
+
> **Secure, Private AI Self-Awareness for GitHub Copilot**
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@paceutils/cpla)
|
|
6
|
+
[](SECURITY.md)
|
|
7
|
+
[](https://github.com/flora131/agent-os)
|
|
8
|
+
|
|
9
|
+
An MCP server that gives GitHub Copilot self-awareness about YOUR personal coding patterns - **100% local, zero cloud, completely private**.
|
|
10
|
+
|
|
11
|
+
**Part of the [Agent-OS](https://github.com/flora131/agent-os) ecosystem.**
|
|
12
|
+
|
|
13
|
+
## 🔒 Security First
|
|
14
|
+
|
|
15
|
+
| Guarantee | Status |
|
|
16
|
+
|-----------|--------|
|
|
17
|
+
| **Data stays local** | ✅ Never leaves your machine |
|
|
18
|
+
| **No cloud** | ✅ Works completely offline |
|
|
19
|
+
| **No telemetry** | ✅ Zero analytics or tracking |
|
|
20
|
+
| **Read-only** | ✅ Never modifies your data |
|
|
21
|
+
| **Minimal deps** | ✅ Only `@modelcontextprotocol/sdk` |
|
|
22
|
+
|
|
23
|
+
[Read our full Security Policy →](SECURITY.md)
|
|
24
|
+
|
|
25
|
+
## 🎯 What Makes This Different
|
|
26
|
+
|
|
27
|
+
| Tool | What It Does |
|
|
28
|
+
|------|--------------|
|
|
29
|
+
| **Copilot Memory** | Remembers project/repo context |
|
|
30
|
+
| **MemoriPilot** | Tracks project decisions & architecture |
|
|
31
|
+
| **ContextIQ** | Indexes code & stores rules |
|
|
32
|
+
| **CPLA** | **Understands YOU** - your patterns, schedule, trust level |
|
|
33
|
+
|
|
34
|
+
**CPLA is the only tool that gives Copilot self-awareness about the human using it.**
|
|
35
|
+
|
|
36
|
+
## 📦 Quick Install
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install -g @paceutils/cpla
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## ⚡ Quick Setup
|
|
43
|
+
|
|
44
|
+
### 1. Add to Copilot MCP Config
|
|
45
|
+
|
|
46
|
+
**For GitHub Copilot CLI** (`~/.copilot/config.json`):
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"mcpServers": {
|
|
50
|
+
"cpla": {
|
|
51
|
+
"command": "cpla-server"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**For VS Code Copilot Chat** (settings.json):
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"github.copilot.chat.mcpServers": {
|
|
61
|
+
"cpla": {
|
|
62
|
+
"command": "cpla-server"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 2. Start Using!
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
You: "What have I been working on?"
|
|
72
|
+
Copilot: "In the last 7 days you've focused on agent-os (40 mentions)
|
|
73
|
+
and octane (31 mentions). You're a night coder - peak at 9 PM!"
|
|
74
|
+
|
|
75
|
+
You: "Should I auto-run tests?"
|
|
76
|
+
Copilot: "Yes! You approve test runs 94% of the time. Safe to automate."
|
|
77
|
+
|
|
78
|
+
You: "What skills should I add?"
|
|
79
|
+
Copilot: "Based on your patterns, add these to copilot-instructions.md:
|
|
80
|
+
- Run tests before every commit
|
|
81
|
+
- Use conventional commit messages"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## 🛠️ Available Tools
|
|
85
|
+
|
|
86
|
+
| Tool | Description | When Copilot Uses It |
|
|
87
|
+
|------|-------------|---------------------|
|
|
88
|
+
| `get_my_profile` | Full personality profile | "Who am I?", "What's my coding style?" |
|
|
89
|
+
| `get_my_activity` | Recent requests & projects | "What have I been doing?", "Recent activity" |
|
|
90
|
+
| `get_my_patterns` | Tool usage, workflows | "What are my patterns?", "How do I work?" |
|
|
91
|
+
| `get_my_schedule` | Coding hours, peak times | "When do I code?", "Am I a night coder?" |
|
|
92
|
+
| `get_my_approvals` | Trust level, responses | "Do I trust you?", "My approval rate?" |
|
|
93
|
+
| `get_my_projects` | Projects worked on | "What projects?", "My focus areas?" |
|
|
94
|
+
| `suggest_skills` | Personal skill suggestions | "What should I automate?", "Improve my workflow" |
|
|
95
|
+
| `should_i_automate` | Check if action is auto-worthy | "Should I auto-run tests?" |
|
|
96
|
+
|
|
97
|
+
## 📦 Installation
|
|
98
|
+
|
|
99
|
+
### 1. Install dependencies
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
cd mcp-server
|
|
103
|
+
npm install
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 2. Build
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
npm run build
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 3. Configure Copilot
|
|
113
|
+
|
|
114
|
+
Add to your Copilot MCP settings (`~/.copilot/config.json` or VS Code settings):
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"mcpServers": {
|
|
119
|
+
"cpla": {
|
|
120
|
+
"command": "node",
|
|
121
|
+
"args": ["path/to/cpla-mcp-server/dist/index.js"]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Or for VS Code, add to your Copilot Chat settings.
|
|
128
|
+
|
|
129
|
+
## 🔒 Privacy
|
|
130
|
+
|
|
131
|
+
- **100% Local**: All data stays on your machine
|
|
132
|
+
- **No Cloud**: Nothing is sent anywhere
|
|
133
|
+
- **Your Data**: Reads only from `~/.copilot/session-state/`
|
|
134
|
+
- **Transparent**: See exactly what it analyzes
|
|
135
|
+
|
|
136
|
+
## 📊 Data Sources
|
|
137
|
+
|
|
138
|
+
CPLA reads from your existing Copilot CLI session data:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
~/.copilot/session-state/
|
|
142
|
+
├── [session-id]/
|
|
143
|
+
│ └── events.jsonl # Your interactions
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
It analyzes:
|
|
147
|
+
- User messages (your requests)
|
|
148
|
+
- Tool executions (what Copilot did)
|
|
149
|
+
- Timestamps (when you code)
|
|
150
|
+
- Response patterns (approvals/denials)
|
|
151
|
+
|
|
152
|
+
## 🚀 Why This Matters
|
|
153
|
+
|
|
154
|
+
1. **Personalized Assistance**: Copilot can now tailor responses to YOUR style
|
|
155
|
+
2. **Proactive Suggestions**: "You usually run tests here, should I?"
|
|
156
|
+
3. **Skill Discovery**: Automatically suggests skills based on YOUR patterns
|
|
157
|
+
4. **Trust Calibration**: Knows when to ask vs. when to just do it
|
|
158
|
+
|
|
159
|
+
## 🎬 Example Session
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
You: "I want to improve my Copilot experience"
|
|
163
|
+
|
|
164
|
+
Copilot: Let me analyze your patterns...
|
|
165
|
+
|
|
166
|
+
[calls get_my_profile]
|
|
167
|
+
|
|
168
|
+
Based on your last 14 days:
|
|
169
|
+
|
|
170
|
+
🎯 You mainly do: Automation/Agents (197), PR/Code Review (180), Exploring (167)
|
|
171
|
+
📁 Your projects: agent-os, octane, agent-mesh
|
|
172
|
+
✅ Trust level: 90% approval rate - you trust me!
|
|
173
|
+
🕐 Schedule: Night coder (peak at 9 PM)
|
|
174
|
+
|
|
175
|
+
Suggestions for your copilot-instructions.md:
|
|
176
|
+
- "Run tests before every commit" (you approve 94% of test runs)
|
|
177
|
+
- "Use conventional commits" (you do 91 git operations)
|
|
178
|
+
- "Be careful with late-night changes" (you code until 1 AM)
|
|
179
|
+
|
|
180
|
+
Want me to add these to your instructions?
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## 📝 License
|
|
184
|
+
|
|
185
|
+
Proprietary - Part of [PaceUtils](https://paceutils.com)
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## 🌐 Part of the Agent-OS Ecosystem
|
|
190
|
+
|
|
191
|
+
CPLA is built on the same security-first principles as:
|
|
192
|
+
|
|
193
|
+
- **[Agent-OS](https://github.com/flora131/agent-os)** - Secure agent orchestration framework
|
|
194
|
+
- **[Agent-Mesh](https://github.com/flora131/agent-mesh)** - Distributed agent communication
|
|
195
|
+
|
|
196
|
+
Together, these tools provide a complete, secure AI agent infrastructure.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
**"Secure AI that understands how YOU use AI"**
|
|
201
|
+
|
|
202
|
+
*Built by [PaceUtils](https://paceutils.com) with security and privacy at the core.*
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## 🔒 Security-First Design
|
|
4
|
+
|
|
5
|
+
CPLA is built with security and privacy as core principles, following the [Agent-OS](https://github.com/flora131/agent-os) security guidelines.
|
|
6
|
+
|
|
7
|
+
### Data Handling
|
|
8
|
+
|
|
9
|
+
| Aspect | Guarantee |
|
|
10
|
+
|--------|-----------|
|
|
11
|
+
| **Data Location** | 100% local - never leaves your machine |
|
|
12
|
+
| **Cloud Connectivity** | None - works completely offline |
|
|
13
|
+
| **Data Storage** | Reads only, never writes to session data |
|
|
14
|
+
| **Network Calls** | Zero - no telemetry, no analytics, no phone-home |
|
|
15
|
+
| **Third-Party Sharing** | None - your data is yours |
|
|
16
|
+
|
|
17
|
+
### What CPLA Reads
|
|
18
|
+
|
|
19
|
+
CPLA only reads from your existing Copilot CLI session data:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
~/.copilot/session-state/[session-id]/events.jsonl
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
This data is **already on your machine** from your normal Copilot CLI usage. CPLA does not:
|
|
26
|
+
- ❌ Create new data
|
|
27
|
+
- ❌ Modify existing data
|
|
28
|
+
- ❌ Send data anywhere
|
|
29
|
+
- ❌ Store data in new locations
|
|
30
|
+
- ❌ Access any other files
|
|
31
|
+
|
|
32
|
+
### What CPLA Outputs
|
|
33
|
+
|
|
34
|
+
CPLA only outputs to:
|
|
35
|
+
1. **stdout** - Responses to MCP tool calls (in-memory, to Copilot)
|
|
36
|
+
2. **stderr** - Debug logs (optional, local only)
|
|
37
|
+
|
|
38
|
+
No files are written. No network calls are made.
|
|
39
|
+
|
|
40
|
+
### Permissions Required
|
|
41
|
+
|
|
42
|
+
| Permission | Required? | Why |
|
|
43
|
+
|------------|-----------|-----|
|
|
44
|
+
| File System (read) | ✅ Yes | Read `~/.copilot/session-state/` |
|
|
45
|
+
| File System (write) | ❌ No | Never writes files |
|
|
46
|
+
| Network | ❌ No | Works offline |
|
|
47
|
+
| Environment Variables | ❌ No | No secrets needed |
|
|
48
|
+
|
|
49
|
+
### Security Audit
|
|
50
|
+
|
|
51
|
+
The codebase follows these security practices:
|
|
52
|
+
|
|
53
|
+
1. **No eval()** - No dynamic code execution
|
|
54
|
+
2. **No network calls** - Zero fetch/http/https usage
|
|
55
|
+
3. **No child processes** - Doesn't spawn subprocesses
|
|
56
|
+
4. **No file writes** - Read-only operations
|
|
57
|
+
5. **Typed inputs** - TypeScript with strict mode
|
|
58
|
+
6. **Minimal dependencies** - Only `@modelcontextprotocol/sdk`
|
|
59
|
+
|
|
60
|
+
### Vulnerability Reporting
|
|
61
|
+
|
|
62
|
+
If you discover a security vulnerability, please report it to:
|
|
63
|
+
- Email: security@paceutils.com
|
|
64
|
+
- Or via [Agent-OS security issues](https://github.com/flora131/agent-os/security/advisories)
|
|
65
|
+
|
|
66
|
+
We follow responsible disclosure practices.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 🛡️ Part of the Agent-OS Ecosystem
|
|
71
|
+
|
|
72
|
+
CPLA follows the security standards established by:
|
|
73
|
+
|
|
74
|
+
- **[Agent-OS](https://github.com/flora131/agent-os)** - Secure agent orchestration
|
|
75
|
+
- **[Agent-Mesh](https://github.com/flora131/agent-mesh)** - Distributed agent communication
|
|
76
|
+
|
|
77
|
+
These projects share security principles:
|
|
78
|
+
- Local-first architecture
|
|
79
|
+
- Zero-trust by default
|
|
80
|
+
- Minimal permissions
|
|
81
|
+
- Transparent operations
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
*Your data. Your machine. Your privacy.*
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Analyzer - Analyzes Copilot CLI session data
|
|
3
|
+
*
|
|
4
|
+
* Reads events.jsonl files from ~/.copilot/session-state/
|
|
5
|
+
* and provides insights about user behavior.
|
|
6
|
+
*/
|
|
7
|
+
export declare class SessionAnalyzer {
|
|
8
|
+
private copilotDir;
|
|
9
|
+
private sessionStateDir;
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Get list of session directories
|
|
13
|
+
*/
|
|
14
|
+
private getSessionDirs;
|
|
15
|
+
/**
|
|
16
|
+
* Load events from a session
|
|
17
|
+
*/
|
|
18
|
+
private loadSessionEvents;
|
|
19
|
+
/**
|
|
20
|
+
* Analyze sessions within a date range
|
|
21
|
+
*/
|
|
22
|
+
private analyzeRange;
|
|
23
|
+
/**
|
|
24
|
+
* Get user's Copilot personality profile
|
|
25
|
+
*/
|
|
26
|
+
getProfile(days: number): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Get recent activity
|
|
29
|
+
*/
|
|
30
|
+
getActivity(days: number, limit: number): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Get user's patterns
|
|
33
|
+
*/
|
|
34
|
+
getPatterns(days: number): Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Get coding schedule
|
|
37
|
+
*/
|
|
38
|
+
getSchedule(days: number): Promise<string>;
|
|
39
|
+
/**
|
|
40
|
+
* Get approval patterns
|
|
41
|
+
*/
|
|
42
|
+
getApprovals(days: number): Promise<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Get project focus
|
|
45
|
+
*/
|
|
46
|
+
getProjects(days: number): Promise<string>;
|
|
47
|
+
/**
|
|
48
|
+
* Suggest skills based on patterns
|
|
49
|
+
*/
|
|
50
|
+
suggestSkills(days: number, limit: number): Promise<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Check if an action should be automated
|
|
53
|
+
*/
|
|
54
|
+
shouldAutomate(action: string, days: number): Promise<string>;
|
|
55
|
+
private categorizeActivities;
|
|
56
|
+
private detectProjects;
|
|
57
|
+
private analyzeApprovals;
|
|
58
|
+
private analyzeSchedule;
|
|
59
|
+
private countTools;
|
|
60
|
+
private extractPhrases;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2DH,qBAAa,eAAe;IAC1B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,eAAe,CAAS;;IAOhC;;OAEG;IACH,OAAO,CAAC,cAAc;IAWtB;;OAEG;YACW,iBAAiB;IA0B/B;;OAEG;YACW,YAAY;IAqD1B;;OAEG;IACG,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA+D/C;;OAEG;IACG,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA4B/D;;OAEG;IACG,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA2ChD;;OAEG;IACG,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA2BhD;;OAEG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAgCjD;;OAEG;IACG,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmBhD;;OAEG;IACG,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAiFjE;;OAEG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAqDnE,OAAO,CAAC,oBAAoB;IAuB5B,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,gBAAgB;IAqCxB,OAAO,CAAC,eAAe;IAqCvB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,cAAc;CAuBvB"}
|
package/dist/analyzer.js
ADDED
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Analyzer - Analyzes Copilot CLI session data
|
|
3
|
+
*
|
|
4
|
+
* Reads events.jsonl files from ~/.copilot/session-state/
|
|
5
|
+
* and provides insights about user behavior.
|
|
6
|
+
*/
|
|
7
|
+
import * as fs from "fs";
|
|
8
|
+
import * as path from "path";
|
|
9
|
+
import * as os from "os";
|
|
10
|
+
import * as readline from "readline";
|
|
11
|
+
// Activity categories for classification
|
|
12
|
+
const ACTIVITY_CATEGORIES = {
|
|
13
|
+
"PR/Code Review": ["pr", "pull request", "review", "comments", "feedback", "approve"],
|
|
14
|
+
"Testing": ["test", "coverage", "spec", "failing", "pass"],
|
|
15
|
+
"Git Operations": ["commit", "push", "merge", "checkin", "branch", "checkout"],
|
|
16
|
+
"Fixing Issues": ["fix", "bug", "error", "issue", "failing", "broken"],
|
|
17
|
+
"Building/Running": ["build", "run", "install", "npm", "pip", "start"],
|
|
18
|
+
"Reading/Exploring": ["look at", "see", "check", "find", "what is", "show me"],
|
|
19
|
+
"Creating": ["create", "add", "write", "generate", "make"],
|
|
20
|
+
"Automation/Agents": ["agent", "copilot", "automate", "skill", "prompt"],
|
|
21
|
+
};
|
|
22
|
+
// Project keywords to detect
|
|
23
|
+
const PROJECT_KEYWORDS = [
|
|
24
|
+
"octane", "agent-os", "ms-agents-poc", "sdlc", "agent-mesh",
|
|
25
|
+
"azure-automation", "atomic", "crewai", "hve-core", "workshop"
|
|
26
|
+
];
|
|
27
|
+
// Approval/denial detection
|
|
28
|
+
const APPROVAL_WORDS = ["yes", "yeah", "yep", "ok", "okay", "sure", "go ahead",
|
|
29
|
+
"do it", "proceed", "sounds good", "perfect", "great", "thanks", "good",
|
|
30
|
+
"correct", "right", "continue"];
|
|
31
|
+
const DENIAL_WORDS = ["no", "nope", "don't", "stop", "cancel", "wait", "hold on", "not", "wrong"];
|
|
32
|
+
export class SessionAnalyzer {
|
|
33
|
+
copilotDir;
|
|
34
|
+
sessionStateDir;
|
|
35
|
+
constructor() {
|
|
36
|
+
this.copilotDir = path.join(os.homedir(), ".copilot");
|
|
37
|
+
this.sessionStateDir = path.join(this.copilotDir, "session-state");
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get list of session directories
|
|
41
|
+
*/
|
|
42
|
+
getSessionDirs() {
|
|
43
|
+
if (!fs.existsSync(this.sessionStateDir)) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
return fs.readdirSync(this.sessionStateDir)
|
|
47
|
+
.filter(name => {
|
|
48
|
+
const fullPath = path.join(this.sessionStateDir, name);
|
|
49
|
+
return fs.statSync(fullPath).isDirectory();
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Load events from a session
|
|
54
|
+
*/
|
|
55
|
+
async loadSessionEvents(sessionId) {
|
|
56
|
+
const eventsFile = path.join(this.sessionStateDir, sessionId, "events.jsonl");
|
|
57
|
+
if (!fs.existsSync(eventsFile)) {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
const events = [];
|
|
61
|
+
const fileStream = fs.createReadStream(eventsFile);
|
|
62
|
+
const rl = readline.createInterface({
|
|
63
|
+
input: fileStream,
|
|
64
|
+
crlfDelay: Infinity
|
|
65
|
+
});
|
|
66
|
+
for await (const line of rl) {
|
|
67
|
+
if (line.trim()) {
|
|
68
|
+
try {
|
|
69
|
+
events.push(JSON.parse(line));
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
// Skip malformed lines
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return events;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Analyze sessions within a date range
|
|
80
|
+
*/
|
|
81
|
+
async analyzeRange(days) {
|
|
82
|
+
const cutoff = new Date();
|
|
83
|
+
cutoff.setDate(cutoff.getDate() - days);
|
|
84
|
+
const result = {
|
|
85
|
+
totalSessions: 0,
|
|
86
|
+
totalMessages: 0,
|
|
87
|
+
totalToolCalls: 0,
|
|
88
|
+
userMessages: [],
|
|
89
|
+
toolExecutions: [],
|
|
90
|
+
activeHours: new Map()
|
|
91
|
+
};
|
|
92
|
+
const sessionDirs = this.getSessionDirs();
|
|
93
|
+
for (const sessionId of sessionDirs) {
|
|
94
|
+
const events = await this.loadSessionEvents(sessionId);
|
|
95
|
+
if (events.length === 0)
|
|
96
|
+
continue;
|
|
97
|
+
// Check if session is within date range
|
|
98
|
+
const firstEvent = events[0];
|
|
99
|
+
const sessionStart = new Date(firstEvent.timestamp);
|
|
100
|
+
if (sessionStart < cutoff)
|
|
101
|
+
continue;
|
|
102
|
+
result.totalSessions++;
|
|
103
|
+
for (const event of events) {
|
|
104
|
+
const timestamp = new Date(event.timestamp);
|
|
105
|
+
if (event.type === "user.message") {
|
|
106
|
+
const content = event.data.content || "";
|
|
107
|
+
result.userMessages.push({ content, timestamp });
|
|
108
|
+
result.totalMessages++;
|
|
109
|
+
// Track active hours
|
|
110
|
+
const hour = timestamp.getHours();
|
|
111
|
+
result.activeHours.set(hour, (result.activeHours.get(hour) || 0) + 1);
|
|
112
|
+
}
|
|
113
|
+
if (event.type === "tool.execution_start") {
|
|
114
|
+
const toolName = event.data.toolName || "";
|
|
115
|
+
result.toolExecutions.push({ toolName, timestamp, success: true });
|
|
116
|
+
result.totalToolCalls++;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// Sort messages by timestamp (most recent first)
|
|
121
|
+
result.userMessages.sort((a, b) => b.timestamp.getTime() - a.timestamp.getTime());
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get user's Copilot personality profile
|
|
126
|
+
*/
|
|
127
|
+
async getProfile(days) {
|
|
128
|
+
const analysis = await this.analyzeRange(days);
|
|
129
|
+
if (analysis.totalSessions === 0) {
|
|
130
|
+
return "No Copilot sessions found. Start using GitHub Copilot CLI to build your profile!";
|
|
131
|
+
}
|
|
132
|
+
// Activity categories
|
|
133
|
+
const categories = this.categorizeActivities(analysis.userMessages);
|
|
134
|
+
const topCategories = Object.entries(categories)
|
|
135
|
+
.sort((a, b) => b[1] - a[1])
|
|
136
|
+
.slice(0, 4);
|
|
137
|
+
// Projects
|
|
138
|
+
const projects = this.detectProjects(analysis.userMessages).slice(0, 4);
|
|
139
|
+
// Approval pattern
|
|
140
|
+
const approvals = this.analyzeApprovals(analysis.userMessages);
|
|
141
|
+
// Schedule
|
|
142
|
+
const schedule = this.analyzeSchedule(analysis.activeHours);
|
|
143
|
+
// Tool usage
|
|
144
|
+
const toolCounts = this.countTools(analysis.toolExecutions);
|
|
145
|
+
const topTools = Object.entries(toolCounts)
|
|
146
|
+
.sort((a, b) => b[1] - a[1])
|
|
147
|
+
.slice(0, 5);
|
|
148
|
+
let profile = `# Your Copilot Profile (Last ${days} days)\n\n`;
|
|
149
|
+
profile += `## 🎯 What You Do Most\n`;
|
|
150
|
+
for (const [cat, count] of topCategories) {
|
|
151
|
+
profile += `- ${cat}: ${count} requests\n`;
|
|
152
|
+
}
|
|
153
|
+
profile += `\n## 📁 Your Main Projects\n`;
|
|
154
|
+
for (const proj of projects) {
|
|
155
|
+
profile += `- ${proj.name} (${proj.count} mentions)\n`;
|
|
156
|
+
}
|
|
157
|
+
profile += `\n## ✅ Your Approval Style\n`;
|
|
158
|
+
profile += `- Approval rate: ${(approvals.rate * 100).toFixed(0)}%\n`;
|
|
159
|
+
profile += `- You ${approvals.rate >= 0.9 ? "fully trust" : approvals.rate >= 0.7 ? "mostly trust" : "are selective with"} Copilot\n`;
|
|
160
|
+
profile += `- Common responses: ${approvals.commonResponses.slice(0, 3).map(r => `"${r}"`).join(", ")}\n`;
|
|
161
|
+
profile += `\n## 🕐 Your Coding Schedule\n`;
|
|
162
|
+
profile += `- Peak hour: ${schedule.peakHour}:00\n`;
|
|
163
|
+
profile += `- You're a ${schedule.coderType}\n`;
|
|
164
|
+
profile += `- Morning: ${schedule.morning} | Afternoon: ${schedule.afternoon} | Evening: ${schedule.evening} | Night: ${schedule.night}\n`;
|
|
165
|
+
profile += `\n## 🔧 Your Top Tools\n`;
|
|
166
|
+
for (const [tool, count] of topTools) {
|
|
167
|
+
profile += `- ${tool}: ${count} uses\n`;
|
|
168
|
+
}
|
|
169
|
+
profile += `\n## 📊 Stats\n`;
|
|
170
|
+
profile += `- Sessions: ${analysis.totalSessions}\n`;
|
|
171
|
+
profile += `- Requests: ${analysis.totalMessages}\n`;
|
|
172
|
+
profile += `- Tool calls: ${analysis.totalToolCalls}\n`;
|
|
173
|
+
return profile;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Get recent activity
|
|
177
|
+
*/
|
|
178
|
+
async getActivity(days, limit) {
|
|
179
|
+
const analysis = await this.analyzeRange(days);
|
|
180
|
+
if (analysis.userMessages.length === 0) {
|
|
181
|
+
return "No recent activity found.";
|
|
182
|
+
}
|
|
183
|
+
let activity = `# Your Recent Activity (Last ${days} days)\n\n`;
|
|
184
|
+
activity += `## Recent Requests\n`;
|
|
185
|
+
for (const msg of analysis.userMessages.slice(0, limit)) {
|
|
186
|
+
const content = msg.content.length > 80 ? msg.content.slice(0, 80) + "..." : msg.content;
|
|
187
|
+
const time = msg.timestamp.toLocaleString();
|
|
188
|
+
activity += `- [${time}] ${content}\n`;
|
|
189
|
+
}
|
|
190
|
+
// Projects mentioned
|
|
191
|
+
const projects = this.detectProjects(analysis.userMessages.slice(0, 20));
|
|
192
|
+
if (projects.length > 0) {
|
|
193
|
+
activity += `\n## Projects Mentioned\n`;
|
|
194
|
+
for (const proj of projects.slice(0, 5)) {
|
|
195
|
+
activity += `- ${proj.name} (${proj.count} times)\n`;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return activity;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Get user's patterns
|
|
202
|
+
*/
|
|
203
|
+
async getPatterns(days) {
|
|
204
|
+
const analysis = await this.analyzeRange(days);
|
|
205
|
+
if (analysis.totalSessions === 0) {
|
|
206
|
+
return "No patterns detected yet. Keep using Copilot to build your pattern profile!";
|
|
207
|
+
}
|
|
208
|
+
// Activity categories
|
|
209
|
+
const categories = this.categorizeActivities(analysis.userMessages);
|
|
210
|
+
// Tool usage
|
|
211
|
+
const toolCounts = this.countTools(analysis.toolExecutions);
|
|
212
|
+
const topTools = Object.entries(toolCounts)
|
|
213
|
+
.sort((a, b) => b[1] - a[1])
|
|
214
|
+
.slice(0, 10);
|
|
215
|
+
// Common phrases
|
|
216
|
+
const phrases = this.extractPhrases(analysis.userMessages);
|
|
217
|
+
let patterns = `# Your Patterns (Last ${days} days)\n\n`;
|
|
218
|
+
patterns += `## Activity Categories\n`;
|
|
219
|
+
for (const [cat, count] of Object.entries(categories).sort((a, b) => b[1] - a[1])) {
|
|
220
|
+
if (count > 0) {
|
|
221
|
+
patterns += `- ${cat}: ${count} requests\n`;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
patterns += `\n## Tool Usage\n`;
|
|
225
|
+
for (const [tool, count] of topTools) {
|
|
226
|
+
patterns += `- ${tool}: ${count} calls\n`;
|
|
227
|
+
}
|
|
228
|
+
if (phrases.length > 0) {
|
|
229
|
+
patterns += `\n## Common Phrases\n`;
|
|
230
|
+
for (const [phrase, count] of phrases.slice(0, 10)) {
|
|
231
|
+
patterns += `- "${phrase}" (${count}x)\n`;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return patterns;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Get coding schedule
|
|
238
|
+
*/
|
|
239
|
+
async getSchedule(days) {
|
|
240
|
+
const analysis = await this.analyzeRange(days);
|
|
241
|
+
const schedule = this.analyzeSchedule(analysis.activeHours);
|
|
242
|
+
let output = `# Your Coding Schedule (Last ${days} days)\n\n`;
|
|
243
|
+
output += `## Summary\n`;
|
|
244
|
+
output += `- You're a **${schedule.coderType}**\n`;
|
|
245
|
+
output += `- Peak productivity: ${schedule.peakHour}:00\n\n`;
|
|
246
|
+
output += `## Time Distribution\n`;
|
|
247
|
+
output += `- 🌅 Morning (6am-12pm): ${schedule.morning} messages\n`;
|
|
248
|
+
output += `- 🌆 Afternoon (12pm-6pm): ${schedule.afternoon} messages\n`;
|
|
249
|
+
output += `- 🌙 Evening (6pm-12am): ${schedule.evening} messages\n`;
|
|
250
|
+
output += `- 🌃 Night (12am-6am): ${schedule.night} messages\n\n`;
|
|
251
|
+
output += `## Hourly Breakdown\n`;
|
|
252
|
+
const sortedHours = Array.from(analysis.activeHours.entries())
|
|
253
|
+
.sort((a, b) => b[1] - a[1])
|
|
254
|
+
.filter(([_, count]) => count >= 5);
|
|
255
|
+
for (const [hour, count] of sortedHours) {
|
|
256
|
+
output += `- ${hour.toString().padStart(2, '0')}:00 - ${count} messages\n`;
|
|
257
|
+
}
|
|
258
|
+
return output;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Get approval patterns
|
|
262
|
+
*/
|
|
263
|
+
async getApprovals(days) {
|
|
264
|
+
const analysis = await this.analyzeRange(days);
|
|
265
|
+
const approvals = this.analyzeApprovals(analysis.userMessages);
|
|
266
|
+
let output = `# Your Approval Patterns (Last ${days} days)\n\n`;
|
|
267
|
+
output += `## Trust Level\n`;
|
|
268
|
+
if (approvals.rate >= 0.9) {
|
|
269
|
+
output += `You **fully trust** Copilot (${(approvals.rate * 100).toFixed(0)}% approval rate)\n`;
|
|
270
|
+
output += `- You rarely say "no" - Copilot is your coding partner\n`;
|
|
271
|
+
output += `- Consider: Auto-approve common operations to save time\n`;
|
|
272
|
+
}
|
|
273
|
+
else if (approvals.rate >= 0.7) {
|
|
274
|
+
output += `You're a **careful reviewer** (${(approvals.rate * 100).toFixed(0)}% approval rate)\n`;
|
|
275
|
+
output += `- You approve most suggestions but stay vigilant\n`;
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
output += `You're **very selective** (${(approvals.rate * 100).toFixed(0)}% approval rate)\n`;
|
|
279
|
+
output += `- You prefer to maintain control over changes\n`;
|
|
280
|
+
}
|
|
281
|
+
output += `\n## Statistics\n`;
|
|
282
|
+
output += `- Approvals: ${approvals.approvals}\n`;
|
|
283
|
+
output += `- Denials: ${approvals.denials}\n`;
|
|
284
|
+
output += `- Other responses: ${approvals.other}\n`;
|
|
285
|
+
output += `\n## Your Common Responses\n`;
|
|
286
|
+
for (const resp of approvals.commonResponses.slice(0, 8)) {
|
|
287
|
+
output += `- "${resp}"\n`;
|
|
288
|
+
}
|
|
289
|
+
return output;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Get project focus
|
|
293
|
+
*/
|
|
294
|
+
async getProjects(days) {
|
|
295
|
+
const analysis = await this.analyzeRange(days);
|
|
296
|
+
const projects = this.detectProjects(analysis.userMessages);
|
|
297
|
+
let output = `# Your Projects (Last ${days} days)\n\n`;
|
|
298
|
+
if (projects.length === 0) {
|
|
299
|
+
output += "No specific projects detected in your requests.\n";
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
output += `## Projects by Mention Count\n`;
|
|
303
|
+
for (const proj of projects) {
|
|
304
|
+
const bar = "█".repeat(Math.min(proj.count, 20));
|
|
305
|
+
output += `- ${proj.name}: ${proj.count} mentions ${bar}\n`;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return output;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Suggest skills based on patterns
|
|
312
|
+
*/
|
|
313
|
+
async suggestSkills(days, limit) {
|
|
314
|
+
const analysis = await this.analyzeRange(days);
|
|
315
|
+
const approvals = this.analyzeApprovals(analysis.userMessages);
|
|
316
|
+
const categories = this.categorizeActivities(analysis.userMessages);
|
|
317
|
+
const suggestions = [];
|
|
318
|
+
// Based on approval rate
|
|
319
|
+
if (approvals.rate >= 0.9) {
|
|
320
|
+
suggestions.push({
|
|
321
|
+
skill: "Auto-run tests before every commit without asking",
|
|
322
|
+
reason: `You approve test runs ${(approvals.rate * 100).toFixed(0)}% of the time`,
|
|
323
|
+
priority: 1
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
// Based on activity categories
|
|
327
|
+
if (categories["Git Operations"] > 20) {
|
|
328
|
+
suggestions.push({
|
|
329
|
+
skill: "Always use conventional commit messages (feat:, fix:, docs:, etc.)",
|
|
330
|
+
reason: `You do ${categories["Git Operations"]} git operations`,
|
|
331
|
+
priority: 1
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
if (categories["Testing"] > 15) {
|
|
335
|
+
suggestions.push({
|
|
336
|
+
skill: "Run tests before committing any changes",
|
|
337
|
+
reason: `You do ${categories["Testing"]} testing operations`,
|
|
338
|
+
priority: 1
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
if (categories["PR/Code Review"] > 20) {
|
|
342
|
+
suggestions.push({
|
|
343
|
+
skill: "Create detailed PR descriptions from commit messages",
|
|
344
|
+
reason: `You do ${categories["PR/Code Review"]} PR/review operations`,
|
|
345
|
+
priority: 1
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
if (categories["Fixing Issues"] > 15) {
|
|
349
|
+
suggestions.push({
|
|
350
|
+
skill: "Add regression tests for every bug fix",
|
|
351
|
+
reason: `You do ${categories["Fixing Issues"]} fix operations`,
|
|
352
|
+
priority: 2
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
// Based on schedule
|
|
356
|
+
const schedule = this.analyzeSchedule(analysis.activeHours);
|
|
357
|
+
if (schedule.peakHour >= 21 || schedule.peakHour <= 5) {
|
|
358
|
+
suggestions.push({
|
|
359
|
+
skill: "Double-check changes during late-night sessions before committing",
|
|
360
|
+
reason: `You code late at night (peak: ${schedule.peakHour}:00)`,
|
|
361
|
+
priority: 3
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
// Sort by priority and limit
|
|
365
|
+
suggestions.sort((a, b) => a.priority - b.priority);
|
|
366
|
+
const limitedSuggestions = suggestions.slice(0, limit);
|
|
367
|
+
let output = `# Suggested Skills for You\n\n`;
|
|
368
|
+
output += `Based on your patterns, add these to \`~/.copilot/copilot-instructions.md\`:\n\n`;
|
|
369
|
+
output += "```markdown\n";
|
|
370
|
+
for (const s of limitedSuggestions) {
|
|
371
|
+
output += `- ${s.skill}\n`;
|
|
372
|
+
}
|
|
373
|
+
output += "```\n\n";
|
|
374
|
+
output += `## Why These Suggestions?\n`;
|
|
375
|
+
for (const s of limitedSuggestions) {
|
|
376
|
+
const icon = s.priority === 1 ? "🔴" : s.priority === 2 ? "🟡" : "🟢";
|
|
377
|
+
output += `${icon} **${s.skill}**\n Reason: ${s.reason}\n\n`;
|
|
378
|
+
}
|
|
379
|
+
return output;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Check if an action should be automated
|
|
383
|
+
*/
|
|
384
|
+
async shouldAutomate(action, days) {
|
|
385
|
+
const analysis = await this.analyzeRange(days);
|
|
386
|
+
const approvals = this.analyzeApprovals(analysis.userMessages);
|
|
387
|
+
const actionLower = action.toLowerCase();
|
|
388
|
+
// Count how many times this action appears and how user responds
|
|
389
|
+
let actionCount = 0;
|
|
390
|
+
let approvedCount = 0;
|
|
391
|
+
for (let i = 0; i < analysis.userMessages.length - 1; i++) {
|
|
392
|
+
const msg = analysis.userMessages[i].content.toLowerCase();
|
|
393
|
+
if (msg.includes(actionLower)) {
|
|
394
|
+
actionCount++;
|
|
395
|
+
// Check if next message is an approval
|
|
396
|
+
const nextMsg = analysis.userMessages[i + 1]?.content.toLowerCase() || "";
|
|
397
|
+
if (APPROVAL_WORDS.some(w => nextMsg.startsWith(w) || nextMsg === w)) {
|
|
398
|
+
approvedCount++;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
let output = `# Should You Automate: "${action}"?\n\n`;
|
|
403
|
+
if (actionCount === 0) {
|
|
404
|
+
output += `I haven't seen you request "${action}" in the last ${days} days.\n`;
|
|
405
|
+
output += `Not enough data to make a recommendation.\n`;
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
const approvalRate = actionCount > 0 ? approvedCount / actionCount : 0;
|
|
409
|
+
output += `## Analysis\n`;
|
|
410
|
+
output += `- You've requested this ${actionCount} times\n`;
|
|
411
|
+
output += `- You approved it ${approvedCount} times (${(approvalRate * 100).toFixed(0)}%)\n`;
|
|
412
|
+
output += `- Your overall approval rate: ${(approvals.rate * 100).toFixed(0)}%\n\n`;
|
|
413
|
+
output += `## Recommendation\n`;
|
|
414
|
+
if (approvalRate >= 0.9 && actionCount >= 5) {
|
|
415
|
+
output += `✅ **YES, automate this!**\n`;
|
|
416
|
+
output += `You approve "${action}" ${(approvalRate * 100).toFixed(0)}% of the time. Safe to automate.\n`;
|
|
417
|
+
}
|
|
418
|
+
else if (approvalRate >= 0.7 && actionCount >= 3) {
|
|
419
|
+
output += `🟡 **Consider automating with confirmation**\n`;
|
|
420
|
+
output += `You approve this often but not always. Maybe auto-run but show results.\n`;
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
output += `❌ **Keep manual**\n`;
|
|
424
|
+
output += `You don't consistently approve this action. Keep it manual for now.\n`;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return output;
|
|
428
|
+
}
|
|
429
|
+
// Helper methods
|
|
430
|
+
categorizeActivities(messages) {
|
|
431
|
+
const counts = {};
|
|
432
|
+
for (const cat of Object.keys(ACTIVITY_CATEGORIES)) {
|
|
433
|
+
counts[cat] = 0;
|
|
434
|
+
}
|
|
435
|
+
for (const msg of messages) {
|
|
436
|
+
const content = msg.content.toLowerCase();
|
|
437
|
+
if (content.length < 10)
|
|
438
|
+
continue;
|
|
439
|
+
for (const [category, keywords] of Object.entries(ACTIVITY_CATEGORIES)) {
|
|
440
|
+
for (const keyword of keywords) {
|
|
441
|
+
if (content.includes(keyword)) {
|
|
442
|
+
counts[category]++;
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return counts;
|
|
449
|
+
}
|
|
450
|
+
detectProjects(messages) {
|
|
451
|
+
const counts = {};
|
|
452
|
+
for (const msg of messages) {
|
|
453
|
+
const content = msg.content.toLowerCase();
|
|
454
|
+
for (const proj of PROJECT_KEYWORDS) {
|
|
455
|
+
if (content.includes(proj)) {
|
|
456
|
+
counts[proj] = (counts[proj] || 0) + 1;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return Object.entries(counts)
|
|
461
|
+
.map(([name, count]) => ({ name, count }))
|
|
462
|
+
.sort((a, b) => b.count - a.count);
|
|
463
|
+
}
|
|
464
|
+
analyzeApprovals(messages) {
|
|
465
|
+
let approvals = 0;
|
|
466
|
+
let denials = 0;
|
|
467
|
+
let other = 0;
|
|
468
|
+
const responseCounts = {};
|
|
469
|
+
for (const msg of messages) {
|
|
470
|
+
const content = msg.content.trim().toLowerCase();
|
|
471
|
+
if (content.length >= 50)
|
|
472
|
+
continue; // Only short responses
|
|
473
|
+
responseCounts[content] = (responseCounts[content] || 0) + 1;
|
|
474
|
+
const isApproval = APPROVAL_WORDS.some(w => content.startsWith(w) || content === w);
|
|
475
|
+
const isDenial = DENIAL_WORDS.some(w => content.startsWith(w) || content === w);
|
|
476
|
+
if (isApproval)
|
|
477
|
+
approvals++;
|
|
478
|
+
else if (isDenial)
|
|
479
|
+
denials++;
|
|
480
|
+
else
|
|
481
|
+
other++;
|
|
482
|
+
}
|
|
483
|
+
const total = approvals + denials;
|
|
484
|
+
const rate = total > 0 ? approvals / total : 1.0;
|
|
485
|
+
const commonResponses = Object.entries(responseCounts)
|
|
486
|
+
.sort((a, b) => b[1] - a[1])
|
|
487
|
+
.slice(0, 10)
|
|
488
|
+
.map(([resp]) => resp);
|
|
489
|
+
return { approvals, denials, other, rate, commonResponses };
|
|
490
|
+
}
|
|
491
|
+
analyzeSchedule(activeHours) {
|
|
492
|
+
let peakHour = 12;
|
|
493
|
+
let peakCount = 0;
|
|
494
|
+
for (const [hour, count] of activeHours) {
|
|
495
|
+
if (count > peakCount) {
|
|
496
|
+
peakCount = count;
|
|
497
|
+
peakHour = hour;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
const morning = Array.from({ length: 6 }, (_, i) => activeHours.get(i + 6) || 0).reduce((a, b) => a + b, 0);
|
|
501
|
+
const afternoon = Array.from({ length: 6 }, (_, i) => activeHours.get(i + 12) || 0).reduce((a, b) => a + b, 0);
|
|
502
|
+
const evening = Array.from({ length: 6 }, (_, i) => activeHours.get(i + 18) || 0).reduce((a, b) => a + b, 0);
|
|
503
|
+
const night = Array.from({ length: 6 }, (_, i) => activeHours.get(i) || 0).reduce((a, b) => a + b, 0);
|
|
504
|
+
let coderType;
|
|
505
|
+
if (peakHour >= 21 || peakHour <= 5) {
|
|
506
|
+
coderType = "NIGHT CODER 🌙";
|
|
507
|
+
}
|
|
508
|
+
else if (peakHour >= 17) {
|
|
509
|
+
coderType = "EVENING CODER 🌆";
|
|
510
|
+
}
|
|
511
|
+
else if (peakHour >= 12) {
|
|
512
|
+
coderType = "AFTERNOON CODER ☀️";
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
coderType = "MORNING CODER 🌅";
|
|
516
|
+
}
|
|
517
|
+
return { peakHour, coderType, morning, afternoon, evening, night };
|
|
518
|
+
}
|
|
519
|
+
countTools(executions) {
|
|
520
|
+
const counts = {};
|
|
521
|
+
for (const exec of executions) {
|
|
522
|
+
counts[exec.toolName] = (counts[exec.toolName] || 0) + 1;
|
|
523
|
+
}
|
|
524
|
+
return counts;
|
|
525
|
+
}
|
|
526
|
+
extractPhrases(messages) {
|
|
527
|
+
const phraseCounts = {};
|
|
528
|
+
for (const msg of messages) {
|
|
529
|
+
const words = msg.content.toLowerCase().split(/\s+/).filter(w => w.length > 2);
|
|
530
|
+
// Extract 2-3 word phrases
|
|
531
|
+
for (let n = 2; n <= 3; n++) {
|
|
532
|
+
for (let i = 0; i <= words.length - n; i++) {
|
|
533
|
+
const phrase = words.slice(i, i + n).join(" ");
|
|
534
|
+
// Skip if all stop words
|
|
535
|
+
const stopWords = new Set(["the", "a", "an", "is", "it", "to", "and", "or", "for", "in", "on"]);
|
|
536
|
+
if (words.slice(i, i + n).some(w => !stopWords.has(w))) {
|
|
537
|
+
phraseCounts[phrase] = (phraseCounts[phrase] || 0) + 1;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
return Object.entries(phraseCounts)
|
|
543
|
+
.filter(([_, count]) => count >= 3)
|
|
544
|
+
.sort((a, b) => b[1] - a[1]);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
//# sourceMappingURL=analyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyzer.js","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,O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C,EAAE,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;oBAC3C,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;oBAC/C,yBAAyB;oBACzB,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;oBAChG,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;wBACvD,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;oBACzD,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC;aAChC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,CAAC;aAClC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CPLA MCP Server - Copilot Personal Learning Agent
|
|
3
|
+
*
|
|
4
|
+
* Gives GitHub Copilot self-awareness about YOU:
|
|
5
|
+
* - What you do most often
|
|
6
|
+
* - Your coding schedule
|
|
7
|
+
* - Your approval patterns
|
|
8
|
+
* - Your projects
|
|
9
|
+
* - Skill suggestions based on YOUR behavior
|
|
10
|
+
*
|
|
11
|
+
* "AI that understands how YOU use AI"
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CPLA MCP Server - Copilot Personal Learning Agent
|
|
3
|
+
*
|
|
4
|
+
* Gives GitHub Copilot self-awareness about YOU:
|
|
5
|
+
* - What you do most often
|
|
6
|
+
* - Your coding schedule
|
|
7
|
+
* - Your approval patterns
|
|
8
|
+
* - Your projects
|
|
9
|
+
* - Skill suggestions based on YOUR behavior
|
|
10
|
+
*
|
|
11
|
+
* "AI that understands how YOU use AI"
|
|
12
|
+
*/
|
|
13
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
14
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
15
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
16
|
+
import { SessionAnalyzer } from "./analyzer.js";
|
|
17
|
+
// Initialize the analyzer
|
|
18
|
+
const analyzer = new SessionAnalyzer();
|
|
19
|
+
// Define available tools
|
|
20
|
+
const TOOLS = [
|
|
21
|
+
{
|
|
22
|
+
name: "get_my_profile",
|
|
23
|
+
description: "Get the user's Copilot personality profile - who they are as a coder, what they do most, their approval style, and coding schedule. Use this when the user asks 'what do I do?', 'who am I?', 'what's my coding style?'",
|
|
24
|
+
inputSchema: {
|
|
25
|
+
type: "object",
|
|
26
|
+
properties: {
|
|
27
|
+
days: {
|
|
28
|
+
type: "number",
|
|
29
|
+
description: "Number of days to analyze (default: 14)",
|
|
30
|
+
default: 14
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "get_my_activity",
|
|
37
|
+
description: "Get what the user has been working on recently - their recent requests, projects, and activities. Use when user asks 'what have I been doing?', 'what did I work on?', 'show my recent activity'",
|
|
38
|
+
inputSchema: {
|
|
39
|
+
type: "object",
|
|
40
|
+
properties: {
|
|
41
|
+
days: {
|
|
42
|
+
type: "number",
|
|
43
|
+
description: "Number of days to look back (default: 7)",
|
|
44
|
+
default: 7
|
|
45
|
+
},
|
|
46
|
+
limit: {
|
|
47
|
+
type: "number",
|
|
48
|
+
description: "Maximum number of recent requests to show (default: 10)",
|
|
49
|
+
default: 10
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "get_my_patterns",
|
|
56
|
+
description: "Get the user's common patterns - what tools they use, workflows they follow, and behaviors. Use when user asks 'what are my patterns?', 'how do I usually work?', 'what's my workflow?'",
|
|
57
|
+
inputSchema: {
|
|
58
|
+
type: "object",
|
|
59
|
+
properties: {
|
|
60
|
+
days: {
|
|
61
|
+
type: "number",
|
|
62
|
+
description: "Number of days to analyze (default: 14)",
|
|
63
|
+
default: 14
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "get_my_schedule",
|
|
70
|
+
description: "Get when the user codes most - their peak hours, morning/evening preferences. Use when user asks 'when do I code?', 'what's my schedule?', 'am I a morning or night coder?'",
|
|
71
|
+
inputSchema: {
|
|
72
|
+
type: "object",
|
|
73
|
+
properties: {
|
|
74
|
+
days: {
|
|
75
|
+
type: "number",
|
|
76
|
+
description: "Number of days to analyze (default: 14)",
|
|
77
|
+
default: 14
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "get_my_approvals",
|
|
84
|
+
description: "Get how the user responds to Copilot - their approval rate, common responses, trust level. Use when user asks 'do I trust you?', 'how do I respond?', 'what's my approval rate?'",
|
|
85
|
+
inputSchema: {
|
|
86
|
+
type: "object",
|
|
87
|
+
properties: {
|
|
88
|
+
days: {
|
|
89
|
+
type: "number",
|
|
90
|
+
description: "Number of days to analyze (default: 14)",
|
|
91
|
+
default: 14
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: "get_my_projects",
|
|
98
|
+
description: "Get what projects/repos the user works on most. Use when user asks 'what projects do I work on?', 'what repos?', 'what's my focus?'",
|
|
99
|
+
inputSchema: {
|
|
100
|
+
type: "object",
|
|
101
|
+
properties: {
|
|
102
|
+
days: {
|
|
103
|
+
type: "number",
|
|
104
|
+
description: "Number of days to analyze (default: 14)",
|
|
105
|
+
default: 14
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "suggest_skills",
|
|
112
|
+
description: "Suggest personal skills/instructions the user should add based on their patterns. Use when user asks 'what skills should I add?', 'how can I improve?', 'what should I automate?'",
|
|
113
|
+
inputSchema: {
|
|
114
|
+
type: "object",
|
|
115
|
+
properties: {
|
|
116
|
+
days: {
|
|
117
|
+
type: "number",
|
|
118
|
+
description: "Number of days to analyze (default: 14)",
|
|
119
|
+
default: 14
|
|
120
|
+
},
|
|
121
|
+
limit: {
|
|
122
|
+
type: "number",
|
|
123
|
+
description: "Maximum suggestions to return (default: 5)",
|
|
124
|
+
default: 5
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "should_i_automate",
|
|
131
|
+
description: "Check if a specific action should be automated based on user's history. Use when considering whether to auto-run tests, auto-commit, etc.",
|
|
132
|
+
inputSchema: {
|
|
133
|
+
type: "object",
|
|
134
|
+
properties: {
|
|
135
|
+
action: {
|
|
136
|
+
type: "string",
|
|
137
|
+
description: "The action to check (e.g., 'run tests', 'commit changes', 'create PR')"
|
|
138
|
+
},
|
|
139
|
+
days: {
|
|
140
|
+
type: "number",
|
|
141
|
+
description: "Number of days to analyze (default: 14)",
|
|
142
|
+
default: 14
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
required: ["action"]
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
];
|
|
149
|
+
// Create the MCP server
|
|
150
|
+
const server = new Server({
|
|
151
|
+
name: "cpla-mcp-server",
|
|
152
|
+
version: "1.0.0",
|
|
153
|
+
}, {
|
|
154
|
+
capabilities: {
|
|
155
|
+
tools: {},
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
// Handle tool listing
|
|
159
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
160
|
+
return { tools: TOOLS };
|
|
161
|
+
});
|
|
162
|
+
// Handle tool calls
|
|
163
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
164
|
+
const { name, arguments: args } = request.params;
|
|
165
|
+
try {
|
|
166
|
+
switch (name) {
|
|
167
|
+
case "get_my_profile":
|
|
168
|
+
return {
|
|
169
|
+
content: [{
|
|
170
|
+
type: "text",
|
|
171
|
+
text: await analyzer.getProfile(args?.days || 14)
|
|
172
|
+
}]
|
|
173
|
+
};
|
|
174
|
+
case "get_my_activity":
|
|
175
|
+
return {
|
|
176
|
+
content: [{
|
|
177
|
+
type: "text",
|
|
178
|
+
text: await analyzer.getActivity(args?.days || 7, args?.limit || 10)
|
|
179
|
+
}]
|
|
180
|
+
};
|
|
181
|
+
case "get_my_patterns":
|
|
182
|
+
return {
|
|
183
|
+
content: [{
|
|
184
|
+
type: "text",
|
|
185
|
+
text: await analyzer.getPatterns(args?.days || 14)
|
|
186
|
+
}]
|
|
187
|
+
};
|
|
188
|
+
case "get_my_schedule":
|
|
189
|
+
return {
|
|
190
|
+
content: [{
|
|
191
|
+
type: "text",
|
|
192
|
+
text: await analyzer.getSchedule(args?.days || 14)
|
|
193
|
+
}]
|
|
194
|
+
};
|
|
195
|
+
case "get_my_approvals":
|
|
196
|
+
return {
|
|
197
|
+
content: [{
|
|
198
|
+
type: "text",
|
|
199
|
+
text: await analyzer.getApprovals(args?.days || 14)
|
|
200
|
+
}]
|
|
201
|
+
};
|
|
202
|
+
case "get_my_projects":
|
|
203
|
+
return {
|
|
204
|
+
content: [{
|
|
205
|
+
type: "text",
|
|
206
|
+
text: await analyzer.getProjects(args?.days || 14)
|
|
207
|
+
}]
|
|
208
|
+
};
|
|
209
|
+
case "suggest_skills":
|
|
210
|
+
return {
|
|
211
|
+
content: [{
|
|
212
|
+
type: "text",
|
|
213
|
+
text: await analyzer.suggestSkills(args?.days || 14, args?.limit || 5)
|
|
214
|
+
}]
|
|
215
|
+
};
|
|
216
|
+
case "should_i_automate":
|
|
217
|
+
return {
|
|
218
|
+
content: [{
|
|
219
|
+
type: "text",
|
|
220
|
+
text: await analyzer.shouldAutomate(args?.action, args?.days || 14)
|
|
221
|
+
}]
|
|
222
|
+
};
|
|
223
|
+
default:
|
|
224
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
return {
|
|
229
|
+
content: [{
|
|
230
|
+
type: "text",
|
|
231
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`
|
|
232
|
+
}],
|
|
233
|
+
isError: true
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
// Start the server
|
|
238
|
+
async function main() {
|
|
239
|
+
const transport = new StdioServerTransport();
|
|
240
|
+
await server.connect(transport);
|
|
241
|
+
console.error("CPLA MCP Server running - giving Copilot self-awareness about YOU!");
|
|
242
|
+
}
|
|
243
|
+
main().catch(console.error);
|
|
244
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;iBACzE,CAAC;YACF,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,mBAAmB;AACnB,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,oEAAoE,CAAC,CAAC;AACtF,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@imransiddique/cpla",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Copilot Personal Learning Agent - Secure, private AI self-awareness. Part of the Agent-OS ecosystem.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"cpla-server": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/**/*",
|
|
12
|
+
"README.md",
|
|
13
|
+
"SECURITY.md"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/flora131/agent-os"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/flora131/agent-os",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/flora131/agent-os/issues"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc",
|
|
25
|
+
"start": "node dist/index.js",
|
|
26
|
+
"dev": "tsx src/index.ts",
|
|
27
|
+
"prepublishOnly": "npm run build",
|
|
28
|
+
"test": "jest"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"copilot",
|
|
32
|
+
"mcp",
|
|
33
|
+
"github",
|
|
34
|
+
"learning",
|
|
35
|
+
"personal",
|
|
36
|
+
"ai",
|
|
37
|
+
"model-context-protocol",
|
|
38
|
+
"secure",
|
|
39
|
+
"privacy",
|
|
40
|
+
"agent-os",
|
|
41
|
+
"agent-mesh",
|
|
42
|
+
"paceutils"
|
|
43
|
+
],
|
|
44
|
+
"author": "PaceUtils Team <contact@paceutils.com>",
|
|
45
|
+
"license": "UNLICENSED",
|
|
46
|
+
"private": false,
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/node": "^20.0.0",
|
|
52
|
+
"typescript": "^5.0.0",
|
|
53
|
+
"tsx": "^4.0.0",
|
|
54
|
+
"jest": "^29.0.0",
|
|
55
|
+
"@types/jest": "^29.0.0"
|
|
56
|
+
},
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=18.0.0"
|
|
59
|
+
},
|
|
60
|
+
"funding": {
|
|
61
|
+
"type": "github",
|
|
62
|
+
"url": "https://github.com/sponsors/flora131"
|
|
63
|
+
}
|
|
64
|
+
}
|