@neyugn/agent-kits 0.2.5 → 0.2.7

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.
@@ -0,0 +1,284 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Workspace Analyzer for Filter Skill
4
+
5
+ Analyzes workspace to detect techstack and recommend skill filtering.
6
+ This script provides structured JSON output for AI agents to process.
7
+
8
+ Usage:
9
+ python3 workspace_analyzer.py [workspace_path]
10
+ python3 workspace_analyzer.py .
11
+ python3 workspace_analyzer.py /path/to/project
12
+ """
13
+
14
+ import json
15
+ import os
16
+ import sys
17
+ from pathlib import Path
18
+ from datetime import datetime
19
+ from typing import Dict, List, Optional, Any
20
+
21
+ # =============================================================================
22
+ # Detection Mappings
23
+ # =============================================================================
24
+
25
+ # Config files → Techstack detection
26
+ CONFIG_MAPPINGS = {
27
+ "package.json": {"type": "package_manager", "tech": "nodejs"},
28
+ "pubspec.yaml": {"type": "package_manager", "tech": "flutter"},
29
+ "pyproject.toml": {"type": "package_manager", "tech": "python"},
30
+ "requirements.txt": {"type": "package_manager", "tech": "python"},
31
+ "Cargo.toml": {"type": "package_manager", "tech": "rust"},
32
+ "go.mod": {"type": "package_manager", "tech": "go"},
33
+ "build.gradle": {"type": "package_manager", "tech": "android"},
34
+ "build.gradle.kts": {"type": "package_manager", "tech": "android"},
35
+ "Podfile": {"type": "package_manager", "tech": "ios"},
36
+ "composer.json": {"type": "package_manager", "tech": "php"},
37
+ "Gemfile": {"type": "package_manager", "tech": "ruby"},
38
+ }
39
+
40
+ # Framework markers → Skills
41
+ FRAMEWORK_MAPPINGS = {
42
+ "next.config.js": ["react-patterns", "seo-patterns", "frontend-design"],
43
+ "next.config.mjs": ["react-patterns", "seo-patterns", "frontend-design"],
44
+ "next.config.ts": ["react-patterns", "seo-patterns", "frontend-design"],
45
+ "vite.config.js": ["react-patterns", "frontend-design"],
46
+ "vite.config.ts": ["react-patterns", "frontend-design"],
47
+ "angular.json": ["typescript-patterns", "frontend-design"],
48
+ "nuxt.config.js": ["frontend-design", "seo-patterns"],
49
+ "nuxt.config.ts": ["frontend-design", "seo-patterns"],
50
+ "tailwind.config.js": ["tailwind-patterns"],
51
+ "tailwind.config.ts": ["tailwind-patterns"],
52
+ "tailwind.config.mjs": ["tailwind-patterns"],
53
+ "Dockerfile": ["docker-patterns"],
54
+ "docker-compose.yml": ["docker-patterns"],
55
+ "docker-compose.yaml": ["docker-patterns"],
56
+ ".gitlab-ci.yml": ["gitlab-ci-patterns"],
57
+ }
58
+
59
+ # Directory patterns → Skills
60
+ DIRECTORY_MAPPINGS = {
61
+ ".github/workflows": ["github-actions"],
62
+ "k8s": ["kubernetes-patterns"],
63
+ "kubernetes": ["kubernetes-patterns"],
64
+ "terraform": ["terraform-patterns"],
65
+ "prisma": ["database-design", "postgres-patterns"],
66
+ }
67
+
68
+ # NPM dependencies → Skills (substring matching)
69
+ NPM_DEPENDENCY_MAPPINGS = {
70
+ "react": ["react-patterns"],
71
+ "next": ["react-patterns", "seo-patterns"],
72
+ "@tanstack/react-query": ["react-patterns"],
73
+ "vue": ["frontend-design"],
74
+ "graphql": ["graphql-patterns"],
75
+ "@apollo": ["graphql-patterns"],
76
+ "redis": ["redis-patterns"],
77
+ "ioredis": ["redis-patterns"],
78
+ "pg": ["postgres-patterns"],
79
+ "postgres": ["postgres-patterns"],
80
+ "@prisma/client": ["database-design", "postgres-patterns"],
81
+ "drizzle-orm": ["database-design"],
82
+ "socket.io": ["realtime-patterns"],
83
+ "ws": ["realtime-patterns"],
84
+ "bullmq": ["queue-patterns"],
85
+ "bee-queue": ["queue-patterns"],
86
+ "passport": ["auth-patterns"],
87
+ "@auth": ["auth-patterns"],
88
+ "next-auth": ["auth-patterns"],
89
+ "openai": ["ai-rag-patterns", "prompt-engineering"],
90
+ "langchain": ["ai-rag-patterns"],
91
+ "@langchain": ["ai-rag-patterns"],
92
+ "playwright": ["e2e-testing"],
93
+ "@playwright": ["e2e-testing"],
94
+ "cypress": ["e2e-testing"],
95
+ "jest": ["testing-patterns"],
96
+ "vitest": ["testing-patterns"],
97
+ "eslint": ["clean-code"],
98
+ "prettier": ["clean-code"],
99
+ "typescript": ["typescript-patterns"],
100
+ }
101
+
102
+ # All available skills (from ARCHITECTURE.md)
103
+ ALL_SKILLS = [
104
+ "clean-code", "api-patterns", "database-design", "testing-patterns",
105
+ "security-fundamentals", "performance-profiling", "brainstorming",
106
+ "plan-writing", "systematic-debugging", "realtime-patterns",
107
+ "multi-tenancy", "queue-patterns", "docker-patterns", "kubernetes-patterns",
108
+ "auth-patterns", "github-actions", "gitlab-ci-patterns", "prompt-engineering",
109
+ "react-patterns", "typescript-patterns", "e2e-testing", "postgres-patterns",
110
+ "redis-patterns", "graphql-patterns", "ai-rag-patterns",
111
+ "monitoring-observability", "terraform-patterns", "flutter-patterns",
112
+ "react-native-patterns", "seo-patterns", "accessibility-patterns",
113
+ "mermaid-diagrams", "i18n-localization", "mobile-design",
114
+ "documentation-templates", "tailwind-patterns", "frontend-design",
115
+ "ui-ux-pro-max", "nodejs-best-practices"
116
+ ]
117
+
118
+ # Core skills that should NEVER be disabled
119
+ CORE_SKILLS = [
120
+ "clean-code",
121
+ "brainstorming",
122
+ "plan-writing",
123
+ "systematic-debugging",
124
+ "testing-patterns",
125
+ "security-fundamentals"
126
+ ]
127
+
128
+ # =============================================================================
129
+ # Analyzer Class
130
+ # =============================================================================
131
+
132
+ class WorkspaceAnalyzer:
133
+ def __init__(self, workspace_path: str):
134
+ self.workspace = Path(workspace_path).resolve()
135
+ self.detected_techs: List[str] = []
136
+ self.detected_frameworks: List[str] = []
137
+ self.recommended_skills: set = set()
138
+ self.config_files_found: List[str] = []
139
+ self.dependencies: Dict[str, List[str]] = {}
140
+
141
+ def analyze(self) -> Dict[str, Any]:
142
+ """Run full workspace analysis."""
143
+ if not self.workspace.exists():
144
+ return self._error(f"Workspace not found: {self.workspace}")
145
+
146
+ # Step 1: Scan config files
147
+ self._scan_config_files()
148
+
149
+ # Step 2: Scan framework markers
150
+ self._scan_framework_markers()
151
+
152
+ # Step 3: Scan directories
153
+ self._scan_directories()
154
+
155
+ # Step 4: Parse dependencies
156
+ self._parse_dependencies()
157
+
158
+ # Step 5: Build recommendations
159
+ return self._build_result()
160
+
161
+ def _scan_config_files(self):
162
+ """Scan for package manager config files."""
163
+ for filename, info in CONFIG_MAPPINGS.items():
164
+ filepath = self.workspace / filename
165
+ if filepath.exists():
166
+ self.config_files_found.append(filename)
167
+ self.detected_techs.append(info["tech"])
168
+
169
+ def _scan_framework_markers(self):
170
+ """Scan for framework-specific config files."""
171
+ for filename, skills in FRAMEWORK_MAPPINGS.items():
172
+ filepath = self.workspace / filename
173
+ if filepath.exists():
174
+ self.config_files_found.append(filename)
175
+ self.recommended_skills.update(skills)
176
+ # Extract framework name
177
+ framework = filename.split(".")[0].replace("_", "-")
178
+ if framework not in ["Dockerfile", "docker-compose"]:
179
+ self.detected_frameworks.append(framework)
180
+
181
+ def _scan_directories(self):
182
+ """Scan for special directories."""
183
+ for dirname, skills in DIRECTORY_MAPPINGS.items():
184
+ dirpath = self.workspace / dirname
185
+ if dirpath.exists() and dirpath.is_dir():
186
+ self.config_files_found.append(f"{dirname}/")
187
+ self.recommended_skills.update(skills)
188
+
189
+ def _parse_dependencies(self):
190
+ """Parse dependencies from package managers."""
191
+ # Parse package.json
192
+ package_json = self.workspace / "package.json"
193
+ if package_json.exists():
194
+ try:
195
+ with open(package_json, 'r') as f:
196
+ data = json.load(f)
197
+
198
+ all_deps = {}
199
+ all_deps.update(data.get("dependencies", {}))
200
+ all_deps.update(data.get("devDependencies", {}))
201
+
202
+ self.dependencies["npm"] = list(all_deps.keys())
203
+
204
+ # Match dependencies to skills
205
+ for dep_name in all_deps.keys():
206
+ for pattern, skills in NPM_DEPENDENCY_MAPPINGS.items():
207
+ if pattern in dep_name:
208
+ self.recommended_skills.update(skills)
209
+ except (json.JSONDecodeError, IOError):
210
+ pass
211
+
212
+ # Parse pubspec.yaml (Flutter)
213
+ pubspec = self.workspace / "pubspec.yaml"
214
+ if pubspec.exists():
215
+ self.recommended_skills.add("flutter-patterns")
216
+ self.recommended_skills.add("mobile-design")
217
+
218
+ def _build_result(self) -> Dict[str, Any]:
219
+ """Build final analysis result."""
220
+ # Add core skills (always recommended)
221
+ self.recommended_skills.update(CORE_SKILLS)
222
+
223
+ # Determine which skills to disable
224
+ enabled = list(self.recommended_skills)
225
+ disabled = [s for s in ALL_SKILLS if s not in enabled]
226
+
227
+ # Remove core skills from disabled (safety check)
228
+ disabled = [s for s in disabled if s not in CORE_SKILLS]
229
+
230
+ return {
231
+ "success": True,
232
+ "analyzedAt": datetime.now().isoformat(),
233
+ "workspacePath": str(self.workspace),
234
+ "detection": {
235
+ "configFiles": self.config_files_found,
236
+ "technologies": list(set(self.detected_techs)),
237
+ "frameworks": list(set(self.detected_frameworks)),
238
+ "dependencies": self.dependencies
239
+ },
240
+ "recommendations": {
241
+ "enable": sorted(enabled),
242
+ "disable": sorted(disabled),
243
+ "coreSkills": CORE_SKILLS
244
+ },
245
+ "summary": {
246
+ "totalSkillsAvailable": len(ALL_SKILLS),
247
+ "recommendedEnabled": len(enabled),
248
+ "recommendedDisabled": len(disabled),
249
+ "coreSkillsCount": len(CORE_SKILLS)
250
+ }
251
+ }
252
+
253
+ def _error(self, message: str) -> Dict[str, Any]:
254
+ """Return error result."""
255
+ return {
256
+ "success": False,
257
+ "error": message,
258
+ "analyzedAt": datetime.now().isoformat()
259
+ }
260
+
261
+
262
+ # =============================================================================
263
+ # Main
264
+ # =============================================================================
265
+
266
+ def main():
267
+ # Get workspace path from args or use current directory
268
+ if len(sys.argv) > 1:
269
+ workspace_path = sys.argv[1]
270
+ else:
271
+ workspace_path = "."
272
+
273
+ analyzer = WorkspaceAnalyzer(workspace_path)
274
+ result = analyzer.analyze()
275
+
276
+ # Output as JSON for AI to parse
277
+ print(json.dumps(result, indent=2))
278
+
279
+ # Exit code based on success
280
+ sys.exit(0 if result.get("success") else 1)
281
+
282
+
283
+ if __name__ == "__main__":
284
+ main()
@@ -0,0 +1,167 @@
1
+ ---
2
+ name: scan-techstack
3
+ description: Analyze workspace to detect technologies, frameworks, and dependencies. Provides structured techstack profile for other skills (filter-skill, filter-agent).
4
+ category: common
5
+ trigger: manual
6
+ ---
7
+
8
+ # Scan Techstack Skill
9
+
10
+ > Workspace technology detection and profiling.
11
+
12
+ ---
13
+
14
+ ## 🎯 Purpose
15
+
16
+ Scan Techstack is the **first step** in the filtering workflow. It:
17
+
18
+ 1. **Scans workspace** for config files, package managers, and framework markers
19
+ 2. **Parses dependencies** from package.json, pubspec.yaml, etc.
20
+ 3. **Builds techstack profile** as structured output
21
+ 4. **Provides data** for filter-skill and filter-agent to process
22
+
23
+ ---
24
+
25
+ ## 🔍 Detection Criteria
26
+
27
+ ### Package Managers & Config Files
28
+
29
+ | File/Pattern | Detected Techstack |
30
+ | ------------------ | --------------------------------------- |
31
+ | `package.json` | Node.js, check dependencies for details |
32
+ | `pubspec.yaml` | Flutter/Dart |
33
+ | `pyproject.toml` | Python (Poetry/PDM) |
34
+ | `requirements.txt` | Python (pip) |
35
+ | `Cargo.toml` | Rust |
36
+ | `go.mod` | Go |
37
+ | `build.gradle` | Android (Java/Kotlin) |
38
+ | `Podfile` | iOS |
39
+ | `composer.json` | PHP |
40
+ | `Gemfile` | Ruby |
41
+
42
+ ### Framework Markers
43
+
44
+ | File/Pattern | Framework | Category |
45
+ | ---------------------- | -------------- | -------- |
46
+ | `next.config.*` | Next.js | Frontend |
47
+ | `vite.config.*` | Vite | Frontend |
48
+ | `angular.json` | Angular | Frontend |
49
+ | `nuxt.config.*` | Nuxt.js | Frontend |
50
+ | `tailwind.config.*` | Tailwind CSS | Styling |
51
+ | `prisma/schema.prisma` | Prisma | Database |
52
+ | `drizzle.config.*` | Drizzle | Database |
53
+ | `docker-compose.*` | Docker | DevOps |
54
+ | `Dockerfile` | Docker | DevOps |
55
+ | `k8s/`, `kubernetes/` | Kubernetes | DevOps |
56
+ | `.github/workflows/` | GitHub Actions | CI/CD |
57
+ | `.gitlab-ci.yml` | GitLab CI | CI/CD |
58
+ | `terraform/`, `*.tf` | Terraform | IaC |
59
+
60
+ ### Dependency Analysis (package.json)
61
+
62
+ | Dependency Pattern | Detected Category |
63
+ | ----------------------- | ------------------- |
64
+ | `react`, `react-dom` | React ecosystem |
65
+ | `next` | Next.js (SSR/SSG) |
66
+ | `@tanstack/react-query` | React data fetching |
67
+ | `graphql`, `@apollo` | GraphQL |
68
+ | `redis`, `ioredis` | Redis cache |
69
+ | `pg`, `postgres` | PostgreSQL |
70
+ | `socket.io*` | Real-time/WebSocket |
71
+ | `bullmq`, `bee-queue` | Message queues |
72
+ | `passport`, `@auth` | Authentication |
73
+ | `openai`, `langchain` | AI/LLM |
74
+ | `playwright`, `cypress` | E2E testing |
75
+ | `jest`, `vitest` | Unit testing |
76
+
77
+ ---
78
+
79
+ ## 📋 Output Format
80
+
81
+ The scan produces a **TechstackProfile** object:
82
+
83
+ ```json
84
+ {
85
+ "success": true,
86
+ "analyzedAt": "2026-02-05T12:00:00Z",
87
+ "workspacePath": "/path/to/project",
88
+ "detection": {
89
+ "configFiles": ["package.json", "next.config.js", "tailwind.config.js"],
90
+ "languages": ["typescript", "javascript"],
91
+ "frameworks": ["nextjs", "tailwindcss"],
92
+ "databases": ["postgresql"],
93
+ "tools": ["docker", "github-actions"],
94
+ "dependencies": {
95
+ "npm": ["react", "next", "tailwindcss", "prisma", "@tanstack/react-query"]
96
+ }
97
+ },
98
+ "categories": {
99
+ "frontend": true,
100
+ "backend": true,
101
+ "mobile": false,
102
+ "database": true,
103
+ "devops": true,
104
+ "ai": false,
105
+ "realtime": false,
106
+ "queue": false
107
+ }
108
+ }
109
+ ```
110
+
111
+ ---
112
+
113
+ ## 🔧 Usage
114
+
115
+ ### As Part of /filter Workflow (Recommended)
116
+
117
+ ```bash
118
+ /filter
119
+ # Step 1: scan-techstack runs automatically
120
+ # Step 2: filter-skill uses scan results
121
+ # Step 3: filter-agent uses scan results
122
+ ```
123
+
124
+ ### Standalone (Debug/Verify)
125
+
126
+ ```bash
127
+ # Run script directly
128
+ python3 .agent/skills/scan-techstack/scripts/techstack_scanner.py .
129
+
130
+ # AI can also scan manually
131
+ /scan-techstack
132
+ ```
133
+
134
+ ---
135
+
136
+ ## 📊 Category Detection Rules
137
+
138
+ | Category | Detected When |
139
+ | ---------- | ------------------------------------------------------ |
140
+ | `frontend` | React, Vue, Angular, Next.js, Nuxt, Tailwind detected |
141
+ | `backend` | Express, Fastify, NestJS, FastAPI, or API deps found |
142
+ | `mobile` | Flutter, React Native, iOS (Podfile), Android (Gradle) |
143
+ | `database` | Prisma, Drizzle, pg, mongodb, redis detected |
144
+ | `devops` | Docker, Kubernetes, Terraform, CI/CD configs found |
145
+ | `ai` | OpenAI, LangChain, or AI-related deps detected |
146
+ | `realtime` | Socket.IO, WebSocket dependencies found |
147
+ | `queue` | BullMQ, RabbitMQ, or queue dependencies found |
148
+
149
+ ---
150
+
151
+ ## ⚠️ Limitations
152
+
153
+ 1. **Static analysis only** - Does not execute code
154
+ 2. **Config-based** - Relies on config files, may miss dynamic setups
155
+ 3. **Monorepo support** - Basic support, scans root only
156
+ 4. **Package manager focus** - Best support for npm/yarn, basic for others
157
+
158
+ ---
159
+
160
+ ## 🔗 Integration
161
+
162
+ This skill is a **dependency** for:
163
+
164
+ - `filter-skill` - Uses techstack to recommend skill enable/disable
165
+ - `filter-agent` - Uses techstack to recommend agent disable
166
+
167
+ ---