@mison/ag-kit-cn 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/.shared/ui-ux-pro-max/data/charts.csv +26 -0
- package/.agent/.shared/ui-ux-pro-max/data/colors.csv +97 -0
- package/.agent/.shared/ui-ux-pro-max/data/icons.csv +101 -0
- package/.agent/.shared/ui-ux-pro-max/data/landing.csv +31 -0
- package/.agent/.shared/ui-ux-pro-max/data/products.csv +97 -0
- package/.agent/.shared/ui-ux-pro-max/data/prompts.csv +24 -0
- package/.agent/.shared/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.agent/.shared/ui-ux-pro-max/data/styles.csv +59 -0
- package/.agent/.shared/ui-ux-pro-max/data/typography.csv +58 -0
- package/.agent/.shared/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/.agent/.shared/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.agent/.shared/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/core.py +258 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/search.py +106 -0
- package/.agent/ARCHITECTURE.md +285 -0
- package/.agent/agents/backend-specialist.md +268 -0
- package/.agent/agents/code-archaeologist.md +106 -0
- package/.agent/agents/database-architect.md +225 -0
- package/.agent/agents/debugger.md +225 -0
- package/.agent/agents/devops-engineer.md +242 -0
- package/.agent/agents/documentation-writer.md +104 -0
- package/.agent/agents/explorer-agent.md +73 -0
- package/.agent/agents/frontend-specialist.md +618 -0
- package/.agent/agents/game-developer.md +162 -0
- package/.agent/agents/mobile-developer.md +382 -0
- package/.agent/agents/orchestrator.md +438 -0
- package/.agent/agents/penetration-tester.md +188 -0
- package/.agent/agents/performance-optimizer.md +187 -0
- package/.agent/agents/product-manager.md +112 -0
- package/.agent/agents/product-owner.md +95 -0
- package/.agent/agents/project-planner.md +405 -0
- package/.agent/agents/qa-automation-engineer.md +103 -0
- package/.agent/agents/security-auditor.md +170 -0
- package/.agent/agents/seo-specialist.md +111 -0
- package/.agent/agents/test-engineer.md +158 -0
- package/.agent/mcp_config.json +12 -0
- package/.agent/rules/GEMINI.md +273 -0
- package/.agent/scripts/auto_preview.py +148 -0
- package/.agent/scripts/checklist.py +217 -0
- package/.agent/scripts/session_manager.py +120 -0
- package/.agent/scripts/verify_all.py +327 -0
- package/.agent/skills/api-patterns/SKILL.md +84 -0
- package/.agent/skills/api-patterns/api-style.md +42 -0
- package/.agent/skills/api-patterns/auth.md +24 -0
- package/.agent/skills/api-patterns/documentation.md +26 -0
- package/.agent/skills/api-patterns/graphql.md +41 -0
- package/.agent/skills/api-patterns/rate-limiting.md +31 -0
- package/.agent/skills/api-patterns/response.md +37 -0
- package/.agent/skills/api-patterns/rest.md +40 -0
- package/.agent/skills/api-patterns/scripts/api_validator.py +211 -0
- package/.agent/skills/api-patterns/security-testing.md +122 -0
- package/.agent/skills/api-patterns/trpc.md +41 -0
- package/.agent/skills/api-patterns/versioning.md +22 -0
- package/.agent/skills/app-builder/SKILL.md +75 -0
- package/.agent/skills/app-builder/agent-coordination.md +74 -0
- package/.agent/skills/app-builder/feature-building.md +53 -0
- package/.agent/skills/app-builder/project-detection.md +34 -0
- package/.agent/skills/app-builder/scaffolding.md +118 -0
- package/.agent/skills/app-builder/tech-stack.md +40 -0
- package/.agent/skills/app-builder/templates/SKILL.md +39 -0
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +122 -0
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +122 -0
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +169 -0
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +134 -0
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +119 -0
- package/.agent/skills/architecture/SKILL.md +57 -0
- package/.agent/skills/architecture/context-discovery.md +43 -0
- package/.agent/skills/architecture/examples.md +94 -0
- package/.agent/skills/architecture/pattern-selection.md +68 -0
- package/.agent/skills/architecture/patterns-reference.md +50 -0
- package/.agent/skills/architecture/trade-off-analysis.md +77 -0
- package/.agent/skills/bash-linux/SKILL.md +201 -0
- package/.agent/skills/behavioral-modes/SKILL.md +264 -0
- package/.agent/skills/brainstorming/SKILL.md +164 -0
- package/.agent/skills/brainstorming/dynamic-questioning.md +359 -0
- package/.agent/skills/clean-code/SKILL.md +200 -0
- package/.agent/skills/code-review-checklist/SKILL.md +125 -0
- package/.agent/skills/database-design/SKILL.md +54 -0
- package/.agent/skills/database-design/database-selection.md +43 -0
- package/.agent/skills/database-design/indexing.md +39 -0
- package/.agent/skills/database-design/migrations.md +50 -0
- package/.agent/skills/database-design/optimization.md +36 -0
- package/.agent/skills/database-design/orm-selection.md +30 -0
- package/.agent/skills/database-design/schema-design.md +56 -0
- package/.agent/skills/database-design/scripts/schema_validator.py +172 -0
- package/.agent/skills/deployment-procedures/SKILL.md +241 -0
- package/.agent/skills/doc.md +177 -0
- package/.agent/skills/documentation-templates/SKILL.md +194 -0
- package/.agent/skills/frontend-design/SKILL.md +418 -0
- package/.agent/skills/frontend-design/animation-guide.md +331 -0
- package/.agent/skills/frontend-design/color-system.md +307 -0
- package/.agent/skills/frontend-design/decision-trees.md +418 -0
- package/.agent/skills/frontend-design/motion-graphics.md +306 -0
- package/.agent/skills/frontend-design/scripts/accessibility_checker.py +183 -0
- package/.agent/skills/frontend-design/scripts/ux_audit.py +727 -0
- package/.agent/skills/frontend-design/typography-system.md +345 -0
- package/.agent/skills/frontend-design/ux-psychology.md +1118 -0
- package/.agent/skills/frontend-design/visual-effects.md +383 -0
- package/.agent/skills/game-development/2d-games/SKILL.md +119 -0
- package/.agent/skills/game-development/3d-games/SKILL.md +135 -0
- package/.agent/skills/game-development/SKILL.md +167 -0
- package/.agent/skills/game-development/game-art/SKILL.md +185 -0
- package/.agent/skills/game-development/game-audio/SKILL.md +190 -0
- package/.agent/skills/game-development/game-design/SKILL.md +129 -0
- package/.agent/skills/game-development/mobile-games/SKILL.md +108 -0
- package/.agent/skills/game-development/multiplayer/SKILL.md +132 -0
- package/.agent/skills/game-development/pc-games/SKILL.md +144 -0
- package/.agent/skills/game-development/vr-ar/SKILL.md +123 -0
- package/.agent/skills/game-development/web-games/SKILL.md +150 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +155 -0
- package/.agent/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
- package/.agent/skills/i18n-localization/SKILL.md +154 -0
- package/.agent/skills/i18n-localization/scripts/i18n_checker.py +241 -0
- package/.agent/skills/intelligent-routing/SKILL.md +335 -0
- package/.agent/skills/lint-and-validate/SKILL.md +44 -0
- package/.agent/skills/lint-and-validate/scripts/lint_runner.py +184 -0
- package/.agent/skills/lint-and-validate/scripts/type_coverage.py +173 -0
- package/.agent/skills/mcp-builder/SKILL.md +176 -0
- package/.agent/skills/mobile-design/SKILL.md +394 -0
- package/.agent/skills/mobile-design/decision-trees.md +516 -0
- package/.agent/skills/mobile-design/mobile-backend.md +491 -0
- package/.agent/skills/mobile-design/mobile-color-system.md +420 -0
- package/.agent/skills/mobile-design/mobile-debugging.md +122 -0
- package/.agent/skills/mobile-design/mobile-design-thinking.md +355 -0
- package/.agent/skills/mobile-design/mobile-navigation.md +458 -0
- package/.agent/skills/mobile-design/mobile-performance.md +767 -0
- package/.agent/skills/mobile-design/mobile-testing.md +356 -0
- package/.agent/skills/mobile-design/mobile-typography.md +432 -0
- package/.agent/skills/mobile-design/platform-android.md +666 -0
- package/.agent/skills/mobile-design/platform-ios.md +561 -0
- package/.agent/skills/mobile-design/scripts/mobile_audit.py +670 -0
- package/.agent/skills/mobile-design/touch-psychology.md +537 -0
- package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +311 -0
- package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +241 -0
- package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +489 -0
- package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +263 -0
- package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
- package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +431 -0
- package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +683 -0
- package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +149 -0
- package/.agent/skills/nextjs-react-expert/SKILL.md +286 -0
- package/.agent/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
- package/.agent/skills/nextjs-react-expert/scripts/react_performance_checker.py +252 -0
- package/.agent/skills/nodejs-best-practices/SKILL.md +333 -0
- package/.agent/skills/parallel-agents/SKILL.md +194 -0
- package/.agent/skills/performance-profiling/SKILL.md +149 -0
- package/.agent/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
- package/.agent/skills/plan-writing/SKILL.md +152 -0
- package/.agent/skills/powershell-windows/SKILL.md +166 -0
- package/.agent/skills/python-patterns/SKILL.md +441 -0
- package/.agent/skills/red-team-tactics/SKILL.md +203 -0
- package/.agent/skills/rust-pro/SKILL.md +190 -0
- package/.agent/skills/seo-fundamentals/SKILL.md +135 -0
- package/.agent/skills/seo-fundamentals/scripts/seo_checker.py +215 -0
- package/.agent/skills/server-management/SKILL.md +161 -0
- package/.agent/skills/systematic-debugging/SKILL.md +114 -0
- package/.agent/skills/tailwind-patterns/SKILL.md +269 -0
- package/.agent/skills/tdd-workflow/SKILL.md +149 -0
- package/.agent/skills/testing-patterns/SKILL.md +178 -0
- package/.agent/skills/testing-patterns/scripts/test_runner.py +219 -0
- package/.agent/skills/vulnerability-scanner/SKILL.md +276 -0
- package/.agent/skills/vulnerability-scanner/checklists.md +131 -0
- package/.agent/skills/vulnerability-scanner/scripts/security_scan.py +459 -0
- package/.agent/skills/web-design-guidelines/SKILL.md +57 -0
- package/.agent/skills/webapp-testing/SKILL.md +187 -0
- package/.agent/skills/webapp-testing/scripts/playwright_runner.py +173 -0
- package/.agent/workflows/brainstorm.md +113 -0
- package/.agent/workflows/create.md +59 -0
- package/.agent/workflows/debug.md +103 -0
- package/.agent/workflows/deploy.md +176 -0
- package/.agent/workflows/enhance.md +63 -0
- package/.agent/workflows/orchestrate.md +242 -0
- package/.agent/workflows/plan.md +89 -0
- package/.agent/workflows/preview.md +80 -0
- package/.agent/workflows/restore-localize-compat.md +525 -0
- package/.agent/workflows/status.md +86 -0
- package/.agent/workflows/test.md +144 -0
- package/.agent/workflows/ui-ux-pro-max.md +295 -0
- package/AGENT_FLOW.md +609 -0
- package/CHANGELOG.md +68 -0
- package/LICENSE +21 -0
- package/README.md +260 -0
- package/bin/adapters/base.js +63 -0
- package/bin/adapters/codex.js +391 -0
- package/bin/adapters/gemini.js +137 -0
- package/bin/ag-kit.js +1336 -0
- package/bin/core/builder.js +80 -0
- package/bin/core/generator.js +59 -0
- package/bin/core/resource-loader.js +64 -0
- package/bin/core/transformer.js +208 -0
- package/bin/interactive.js +65 -0
- package/bin/utils/atomic-writer.js +97 -0
- package/bin/utils/git-helper.js +68 -0
- package/bin/utils/managed-block.js +65 -0
- package/bin/utils/manifest.js +241 -0
- package/bin/utils.js +82 -0
- package/docs/codex-rules-template.md +36 -0
- package/docs/mapping-spec.md +68 -0
- package/docs/multi-target-adapter.md +80 -0
- package/docs/official/README.md +53 -0
- package/docs/official/antigravity/agent-modes-settings.md +64 -0
- package/docs/official/antigravity/rules-workflows.md +96 -0
- package/docs/official/antigravity/skills.md +147 -0
- package/docs/official/codex/agents-md.md +119 -0
- package/docs/official/codex/config-advanced.md +358 -0
- package/docs/official/codex/config-basic.md +141 -0
- package/docs/official/codex/config-reference.md +223 -0
- package/docs/official/codex/config-sample.md +216 -0
- package/docs/official/codex/mcp.md +107 -0
- package/docs/official/codex/rules.md +79 -0
- package/docs/official/codex/skills.md +114 -0
- package/docs/official/sources-index.md +32 -0
- package/docs/operations.md +145 -0
- package/docs/terminology-style-guide.md +69 -0
- package/package.json +51 -0
- package/scripts/postinstall-check.js +112 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
SEO Checker - Search Engine Optimization Audit
|
|
4
|
+
Checks HTML/JSX/TSX pages for SEO best practices.
|
|
5
|
+
|
|
6
|
+
PURPOSE:
|
|
7
|
+
- Verify meta tags, titles, descriptions
|
|
8
|
+
- Check Open Graph tags for social sharing
|
|
9
|
+
- Validate heading hierarchy
|
|
10
|
+
- Check image accessibility (alt attributes)
|
|
11
|
+
|
|
12
|
+
WHAT IT CHECKS:
|
|
13
|
+
- HTML files (actual web pages)
|
|
14
|
+
- JSX/TSX files (React page components)
|
|
15
|
+
- Only files that are likely PUBLIC pages
|
|
16
|
+
|
|
17
|
+
Usage:
|
|
18
|
+
python seo_checker.py <project_path>
|
|
19
|
+
"""
|
|
20
|
+
import sys
|
|
21
|
+
import json
|
|
22
|
+
import re
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
from datetime import datetime
|
|
25
|
+
|
|
26
|
+
# Fix Windows console encoding
|
|
27
|
+
try:
|
|
28
|
+
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
|
|
29
|
+
except:
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Directories to skip
|
|
34
|
+
SKIP_DIRS = {
|
|
35
|
+
'node_modules', '.next', 'dist', 'build', '.git', '.github',
|
|
36
|
+
'__pycache__', '.vscode', '.idea', 'coverage', 'test', 'tests',
|
|
37
|
+
'__tests__', 'spec', 'docs', 'documentation', 'examples', 'reference'
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
# Files to skip (not pages)
|
|
41
|
+
SKIP_PATTERNS = [
|
|
42
|
+
'config', 'setup', 'util', 'helper', 'hook', 'context', 'store',
|
|
43
|
+
'service', 'api', 'lib', 'constant', 'type', 'interface', 'mock',
|
|
44
|
+
'.test.', '.spec.', '_test.', '_spec.'
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def is_page_file(file_path: Path) -> bool:
|
|
49
|
+
"""Check if this file is likely a public-facing page."""
|
|
50
|
+
name = file_path.name.lower()
|
|
51
|
+
stem = file_path.stem.lower()
|
|
52
|
+
|
|
53
|
+
# Skip utility/config files
|
|
54
|
+
if any(skip in name for skip in SKIP_PATTERNS):
|
|
55
|
+
return False
|
|
56
|
+
|
|
57
|
+
# Skip files in common component/UI directories
|
|
58
|
+
parts = [p.lower() for p in file_path.parts]
|
|
59
|
+
if any(d in parts for d in ['components', 'ui', 'fragments', 'elements', 'header', 'footer']):
|
|
60
|
+
return False
|
|
61
|
+
|
|
62
|
+
# Check path - pages in specific directories are likely pages
|
|
63
|
+
page_dirs = ['pages', 'app', 'routes', 'views', 'screens']
|
|
64
|
+
|
|
65
|
+
if any(d in parts for d in page_dirs):
|
|
66
|
+
# Even in app dir, skip layout/template/loading/error for main SEO check
|
|
67
|
+
# but keep them for global meta tags
|
|
68
|
+
if stem in ['page', 'layout', 'index']:
|
|
69
|
+
return True
|
|
70
|
+
|
|
71
|
+
return False
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def find_pages(project_path: Path) -> list:
|
|
75
|
+
"""Find page files to check."""
|
|
76
|
+
patterns = ['**/*.html', '**/*.htm', '**/*.jsx', '**/*.tsx']
|
|
77
|
+
|
|
78
|
+
files = []
|
|
79
|
+
for pattern in patterns:
|
|
80
|
+
for f in project_path.glob(pattern):
|
|
81
|
+
# Skip excluded directories
|
|
82
|
+
if any(skip in f.parts for skip in SKIP_DIRS):
|
|
83
|
+
continue
|
|
84
|
+
|
|
85
|
+
# Check if it's likely a page
|
|
86
|
+
if is_page_file(f):
|
|
87
|
+
files.append(f)
|
|
88
|
+
|
|
89
|
+
return files[:50] # Limit to 50 files
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def check_page(file_path: Path) -> dict:
|
|
93
|
+
"""Check a single page for SEO issues."""
|
|
94
|
+
issues = []
|
|
95
|
+
|
|
96
|
+
try:
|
|
97
|
+
content = file_path.read_text(encoding='utf-8', errors='ignore')
|
|
98
|
+
except Exception as e:
|
|
99
|
+
return {"file": str(file_path.name), "issues": [f"Error: {e}"]}
|
|
100
|
+
|
|
101
|
+
# Detect if this is a layout/template file (has Head component or metadata export)
|
|
102
|
+
is_layout = 'Head>' in content or '<head' in content.lower() or 'export const metadata' in content
|
|
103
|
+
|
|
104
|
+
# 1. Title tag
|
|
105
|
+
has_title = '<title' in content.lower() or 'title:' in content or 'Head>' in content or 'metadata' in content
|
|
106
|
+
if not has_title and is_layout:
|
|
107
|
+
issues.append("Missing <title> tag")
|
|
108
|
+
|
|
109
|
+
# 2. Meta description
|
|
110
|
+
has_description = 'description' in content.lower() or 'name="description"' in content.lower()
|
|
111
|
+
if not has_description and is_layout:
|
|
112
|
+
issues.append("Missing meta description")
|
|
113
|
+
|
|
114
|
+
# 3. Open Graph tags
|
|
115
|
+
has_og = 'og:' in content or 'property="og:' in content.lower() or 'openGraph' in content
|
|
116
|
+
if not has_og and is_layout:
|
|
117
|
+
issues.append("Missing Open Graph tags")
|
|
118
|
+
|
|
119
|
+
# 4. Heading hierarchy - multiple H1s
|
|
120
|
+
h1_matches = re.findall(r'<h1[^>]*>', content, re.I)
|
|
121
|
+
if len(h1_matches) > 1:
|
|
122
|
+
issues.append(f"Multiple H1 tags ({len(h1_matches)})")
|
|
123
|
+
|
|
124
|
+
# 5. Images without alt
|
|
125
|
+
img_pattern = r'<img[^>]+>'
|
|
126
|
+
imgs = re.findall(img_pattern, content, re.I)
|
|
127
|
+
for img in imgs:
|
|
128
|
+
if 'alt=' not in img.lower():
|
|
129
|
+
issues.append("Image missing alt attribute")
|
|
130
|
+
break
|
|
131
|
+
if 'alt=""' in img or "alt=''" in img:
|
|
132
|
+
issues.append("Image has empty alt attribute")
|
|
133
|
+
break
|
|
134
|
+
|
|
135
|
+
# 6. Check for canonical link (nice to have)
|
|
136
|
+
# has_canonical = 'rel="canonical"' in content.lower()
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
"file": str(file_path.name),
|
|
140
|
+
"issues": issues
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def main():
|
|
145
|
+
project_path = Path(sys.argv[1] if len(sys.argv) > 1 else ".").resolve()
|
|
146
|
+
|
|
147
|
+
print(f"\n{'='*60}")
|
|
148
|
+
print(f" SEO CHECKER - Search Engine Optimization Audit")
|
|
149
|
+
print(f"{'='*60}")
|
|
150
|
+
print(f"Project: {project_path}")
|
|
151
|
+
print(f"Time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
|
152
|
+
print("-"*60)
|
|
153
|
+
|
|
154
|
+
# Find pages
|
|
155
|
+
pages = find_pages(project_path)
|
|
156
|
+
|
|
157
|
+
if not pages:
|
|
158
|
+
print("\n[!] No page files found.")
|
|
159
|
+
print(" Looking for: HTML, JSX, TSX in pages/app/routes directories")
|
|
160
|
+
output = {"script": "seo_checker", "files_checked": 0, "passed": True}
|
|
161
|
+
print("\n" + json.dumps(output, indent=2))
|
|
162
|
+
sys.exit(0)
|
|
163
|
+
|
|
164
|
+
print(f"Found {len(pages)} page files to analyze\n")
|
|
165
|
+
|
|
166
|
+
# Check each page
|
|
167
|
+
all_issues = []
|
|
168
|
+
for f in pages:
|
|
169
|
+
result = check_page(f)
|
|
170
|
+
if result["issues"]:
|
|
171
|
+
all_issues.append(result)
|
|
172
|
+
|
|
173
|
+
# Summary
|
|
174
|
+
print("=" * 60)
|
|
175
|
+
print("SEO ANALYSIS RESULTS")
|
|
176
|
+
print("=" * 60)
|
|
177
|
+
|
|
178
|
+
if all_issues:
|
|
179
|
+
# Group by issue type
|
|
180
|
+
issue_counts = {}
|
|
181
|
+
for item in all_issues:
|
|
182
|
+
for issue in item["issues"]:
|
|
183
|
+
issue_counts[issue] = issue_counts.get(issue, 0) + 1
|
|
184
|
+
|
|
185
|
+
print("\nIssue Summary:")
|
|
186
|
+
for issue, count in sorted(issue_counts.items(), key=lambda x: -x[1]):
|
|
187
|
+
print(f" [{count}] {issue}")
|
|
188
|
+
|
|
189
|
+
print(f"\nAffected files ({len(all_issues)}):")
|
|
190
|
+
for item in all_issues[:5]:
|
|
191
|
+
print(f" - {item['file']}")
|
|
192
|
+
if len(all_issues) > 5:
|
|
193
|
+
print(f" ... and {len(all_issues) - 5} more")
|
|
194
|
+
else:
|
|
195
|
+
print("\n[OK] No SEO issues found!")
|
|
196
|
+
|
|
197
|
+
total_issues = sum(len(item["issues"]) for item in all_issues)
|
|
198
|
+
passed = total_issues == 0
|
|
199
|
+
|
|
200
|
+
output = {
|
|
201
|
+
"script": "seo_checker",
|
|
202
|
+
"project": str(project_path),
|
|
203
|
+
"files_checked": len(pages),
|
|
204
|
+
"files_with_issues": len(all_issues),
|
|
205
|
+
"issues_found": total_issues,
|
|
206
|
+
"passed": passed
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
print("\n" + json.dumps(output, indent=2))
|
|
210
|
+
|
|
211
|
+
sys.exit(0 if passed else 1)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
if __name__ == "__main__":
|
|
215
|
+
main()
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: server-management
|
|
3
|
+
description: 服务器管理原则与决策方法。涵盖进程管理、监控策略与扩缩容判断。强调思维方式,而非死记命令。
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 服务器管理
|
|
8
|
+
|
|
9
|
+
> 面向生产运维的服务器管理原则。
|
|
10
|
+
> **学习如何思考,不是背命令。**
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 1. 进程管理原则
|
|
15
|
+
|
|
16
|
+
### 工具选型
|
|
17
|
+
|
|
18
|
+
| 场景 | 工具 |
|
|
19
|
+
|------|------|
|
|
20
|
+
| **Node.js 应用** | PM2(集群 clustering、重载 reload) |
|
|
21
|
+
| **任意应用** | systemd(Linux 原生) |
|
|
22
|
+
| **容器** | Docker/Podman |
|
|
23
|
+
| **编排** | Kubernetes, Docker Swarm |
|
|
24
|
+
|
|
25
|
+
### 进程管理目标
|
|
26
|
+
|
|
27
|
+
| 目标 | 含义 |
|
|
28
|
+
|------|------|
|
|
29
|
+
| **崩溃后重启(Restart on crash)** | 自动恢复(Auto-recovery) |
|
|
30
|
+
| **零停机重载(Zero-downtime reload)** | 服务不中断 |
|
|
31
|
+
| **集群(Clustering)** | 用满 CPU 多核 |
|
|
32
|
+
| **持久化(Persistence)** | 服务器重启后仍可恢复 |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 2. 监控原则
|
|
37
|
+
|
|
38
|
+
### 监控什么
|
|
39
|
+
|
|
40
|
+
| 类别 | 关键指标 |
|
|
41
|
+
|------|----------|
|
|
42
|
+
| **可用性(Availability)** | 在线率(Uptime)、健康检查 |
|
|
43
|
+
| **性能(Performance)** | 响应时间、吞吐量 |
|
|
44
|
+
| **错误(Errors)** | 错误率、错误类型 |
|
|
45
|
+
| **资源(Resources)** | CPU、内存、磁盘 |
|
|
46
|
+
|
|
47
|
+
### 告警分级策略
|
|
48
|
+
|
|
49
|
+
| 级别 | 响应 |
|
|
50
|
+
|------|------|
|
|
51
|
+
| **Critical(严重)** | 立即处理 |
|
|
52
|
+
| **Warning(警告)** | 尽快排查 |
|
|
53
|
+
| **Info(信息)** | 每日审查 |
|
|
54
|
+
|
|
55
|
+
### 监控工具选择
|
|
56
|
+
|
|
57
|
+
| 需求 | 可选工具 |
|
|
58
|
+
|------|----------|
|
|
59
|
+
| 简单/免费 | PM2 metrics, htop |
|
|
60
|
+
| 全链路可观测 | Grafana, Datadog |
|
|
61
|
+
| 错误追踪 | Sentry |
|
|
62
|
+
| 在线率监控 | UptimeRobot, Pingdom |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 3. 日志管理原则
|
|
67
|
+
|
|
68
|
+
### 日志策略
|
|
69
|
+
|
|
70
|
+
| 日志类型 | 用途 |
|
|
71
|
+
|----------|------|
|
|
72
|
+
| **应用日志(Application logs)** | 调试、审计 |
|
|
73
|
+
| **访问日志(Access logs)** | 流量分析 |
|
|
74
|
+
| **错误日志(Error logs)** | 问题发现 |
|
|
75
|
+
|
|
76
|
+
### 日志原则
|
|
77
|
+
|
|
78
|
+
1. 进行 **日志轮转(Rotate logs)**,避免磁盘打满
|
|
79
|
+
2. 使用 **结构化日志(Structured logging)**(如 JSON)便于解析
|
|
80
|
+
3. 合理划分日志级别(error/warn/info/debug)
|
|
81
|
+
4. 日志中不得出现敏感数据
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 4. 扩缩容决策
|
|
86
|
+
|
|
87
|
+
### 何时扩缩容
|
|
88
|
+
|
|
89
|
+
| 症状 | 应对 |
|
|
90
|
+
|------|------|
|
|
91
|
+
| CPU 持续高负载 | 增加实例(水平扩展 horizontal) |
|
|
92
|
+
| 内存持续高占用 | 增加 RAM 或修复内存泄漏 |
|
|
93
|
+
| 响应变慢 | 先做性能分析(Profile)再扩容 |
|
|
94
|
+
| 流量突增 | 自动扩缩容(Auto-scaling) |
|
|
95
|
+
|
|
96
|
+
### 扩缩容策略
|
|
97
|
+
|
|
98
|
+
| 类型 | 适用场景 |
|
|
99
|
+
|------|----------|
|
|
100
|
+
| **垂直扩展(Vertical)** | 快速止血、单实例场景 |
|
|
101
|
+
| **水平扩展(Horizontal)** | 长期可持续、分布式场景 |
|
|
102
|
+
| **自动扩缩容(Auto)** | 流量波动明显 |
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 5. 健康检查原则
|
|
107
|
+
|
|
108
|
+
### 健康状态判定
|
|
109
|
+
|
|
110
|
+
| 检查项 | 含义 |
|
|
111
|
+
|--------|------|
|
|
112
|
+
| **HTTP 200** | 服务可响应 |
|
|
113
|
+
| **数据库已连接** | 数据可访问 |
|
|
114
|
+
| **依赖可用** | 外部服务可达 |
|
|
115
|
+
| **资源正常** | CPU/内存未耗尽 |
|
|
116
|
+
|
|
117
|
+
### 健康检查实现方式
|
|
118
|
+
|
|
119
|
+
- 简单模式:仅返回 200
|
|
120
|
+
- 深度模式:检查所有关键依赖
|
|
121
|
+
- 按负载均衡器(Load Balancer)的接入需求选择
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## 6. 安全原则
|
|
126
|
+
|
|
127
|
+
| 领域 | 原则 |
|
|
128
|
+
|------|------|
|
|
129
|
+
| **访问控制(Access)** | 仅用 SSH key,禁用口令登录 |
|
|
130
|
+
| **防火墙(Firewall)** | 只开放必要端口 |
|
|
131
|
+
| **更新(Updates)** | 定期打安全补丁 |
|
|
132
|
+
| **密钥管理(Secrets)** | 放环境变量,不落地文件 |
|
|
133
|
+
| **审计(Audit)** | 记录访问与变更 |
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 7. 故障排查优先级
|
|
138
|
+
|
|
139
|
+
当系统异常时按顺序排查:
|
|
140
|
+
|
|
141
|
+
1. **先看是否在运行**(进程状态)
|
|
142
|
+
2. **再看日志**(错误信息)
|
|
143
|
+
3. **检查资源**(磁盘、内存、CPU)
|
|
144
|
+
4. **检查网络**(端口、DNS)
|
|
145
|
+
5. **检查依赖**(数据库、外部 API)
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## 8. 反模式
|
|
150
|
+
|
|
151
|
+
| ❌ 不要这样做 | ✅ 推荐做法 |
|
|
152
|
+
|--------------|-----------|
|
|
153
|
+
| 以 root 身份直接运行服务 | 使用非 root 账号运行 |
|
|
154
|
+
| 忽略日志管理 | 配置日志轮转 |
|
|
155
|
+
| 不做监控 | 从第一天就接入监控 |
|
|
156
|
+
| 手工重启服务 | 配置自动重启 |
|
|
157
|
+
| 没有备份策略 | 制定并执行定期备份 |
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
> **牢记:** 管得好的服务器应当“平平无奇”。这正是目标。
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: systematic-debugging
|
|
3
|
+
description: 4 阶段系统化调试方法,包含根因分析与基于证据的验证。用于调试复杂问题。
|
|
4
|
+
allowed-tools: Read, Glob, Grep
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 系统化调试
|
|
8
|
+
|
|
9
|
+
> 来源:obra/superpowers
|
|
10
|
+
|
|
11
|
+
## 概览
|
|
12
|
+
|
|
13
|
+
本技能提供结构化的调试方法,避免随机猜测,确保在修复前已充分理解问题。
|
|
14
|
+
|
|
15
|
+
## 4 阶段调试流程
|
|
16
|
+
|
|
17
|
+
### 阶段 1:复现
|
|
18
|
+
|
|
19
|
+
修复前,必须稳定复现问题。
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
## 复现步骤
|
|
23
|
+
1. [精确复现步骤]
|
|
24
|
+
2. [下一步]
|
|
25
|
+
3. [预期结果 vs 实际结果]
|
|
26
|
+
|
|
27
|
+
## 复现率
|
|
28
|
+
- [ ] 必现 (100%)
|
|
29
|
+
- [ ] 经常 (50-90%)
|
|
30
|
+
- [ ] 偶发 (10-50%)
|
|
31
|
+
- [ ] 罕见 (<10%)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 阶段 2:隔离
|
|
35
|
+
|
|
36
|
+
缩小问题来源范围。
|
|
37
|
+
|
|
38
|
+
```markdown
|
|
39
|
+
## 隔离问题提问
|
|
40
|
+
- 问题从什么时候开始出现?
|
|
41
|
+
- 最近改了什么?
|
|
42
|
+
- 所有环境都会出现吗?
|
|
43
|
+
- 能否用最小代码复现?
|
|
44
|
+
- 触发问题的最小改动是什么?
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 阶段 3:理解
|
|
48
|
+
|
|
49
|
+
找到根因,而不只停留在症状层。
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+
## 根因分析
|
|
53
|
+
### 5 个为什么
|
|
54
|
+
1. 为什么:[第一层观测]
|
|
55
|
+
2. 为什么:[更深层原因]
|
|
56
|
+
3. 为什么:[继续深入]
|
|
57
|
+
4. 为什么:[接近根因]
|
|
58
|
+
5. 为什么:[锁定根因]
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 阶段 4:修复与验证
|
|
62
|
+
|
|
63
|
+
修复后,验证问题已真正解决。
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
## 修复验证
|
|
67
|
+
- [ ] Bug 不再复现
|
|
68
|
+
- [ ] 关联功能仍然正常
|
|
69
|
+
- [ ] 未引入新问题
|
|
70
|
+
- [ ] 已添加防回归测试
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 调试检查清单
|
|
74
|
+
|
|
75
|
+
```markdown
|
|
76
|
+
## 开始前
|
|
77
|
+
- [ ] 能稳定复现
|
|
78
|
+
- [ ] 有最小复现用例
|
|
79
|
+
- [ ] 明确预期行为
|
|
80
|
+
|
|
81
|
+
## 调查中
|
|
82
|
+
- [ ] 检查最近改动 (git log)
|
|
83
|
+
- [ ] 检查日志报错
|
|
84
|
+
- [ ] 必要时增加日志
|
|
85
|
+
- [ ] 使用调试器/断点
|
|
86
|
+
|
|
87
|
+
## 修复后
|
|
88
|
+
- [ ] 已记录根因
|
|
89
|
+
- [ ] 已验证修复
|
|
90
|
+
- [ ] 已添加回归测试
|
|
91
|
+
- [ ] 已排查相似代码
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 常用调试命令
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Recent changes
|
|
98
|
+
git log --oneline -20
|
|
99
|
+
git diff HEAD~5
|
|
100
|
+
|
|
101
|
+
# Search for pattern
|
|
102
|
+
grep -r "errorPattern" --include="*.ts"
|
|
103
|
+
|
|
104
|
+
# Check logs
|
|
105
|
+
pm2 logs app-name --err --lines 100
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## 反模式
|
|
109
|
+
|
|
110
|
+
❌ **随机改动** - “也许改这里就好了”
|
|
111
|
+
❌ **忽视证据** - “这不可能是原因”
|
|
112
|
+
❌ **主观断言** - 没有证据就说“肯定是 X”
|
|
113
|
+
❌ **未先复现** - 盲修
|
|
114
|
+
❌ **止步症状** - 没有挖到根因
|