faf-cli 4.3.0 → 4.3.2
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/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +40 -22
- package/dist/cli.js.map +1 -1
- package/dist/commands/readme.d.ts +11 -6
- package/dist/commands/readme.d.ts.map +1 -1
- package/dist/commands/readme.js +167 -120
- package/dist/commands/readme.js.map +1 -1
- package/dist/commands/show.d.ts.map +1 -1
- package/dist/commands/show.js +22 -7
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/sixws.d.ts +6 -0
- package/dist/commands/sixws.d.ts.map +1 -0
- package/dist/commands/sixws.js +154 -0
- package/dist/commands/sixws.js.map +1 -0
- package/dist/utils/file-utils.d.ts.map +1 -1
- package/dist/utils/file-utils.js +1 -4
- package/dist/utils/file-utils.js.map +1 -1
- package/package.json +6 -2
- package/project.faf +4 -4
- package/scripts/ANTHROPIC-DEMO.sh +203 -0
- package/scripts/boris-ready.sh +169 -0
- package/scripts/bundle-yaml.js +87 -0
- package/scripts/check-version.js +88 -0
- package/scripts/clean-build.js +34 -0
- package/scripts/cleanup-unused.sh +54 -0
- package/scripts/debug-django.txt +9 -0
- package/scripts/debug-mongo.txt +9 -0
- package/scripts/debug-react.txt +9 -0
- package/scripts/debug-rust.txt +9 -0
- package/scripts/debug-whisper.cpp.txt +9 -0
- package/scripts/evaluate-family-member.ts +300 -0
- package/scripts/generate-docs.ts +358 -0
- package/scripts/generate-drift-reports.sh +111 -0
- package/scripts/industry-showcase.json +122 -0
- package/scripts/mcp-ecosystem-research.sh +58 -0
- package/scripts/migrate-yaml-imports.sh +55 -0
- package/scripts/migrate-yaml.ts +132 -0
- package/scripts/performance-validation.ts +460 -0
- package/scripts/postinstall.js +30 -0
- package/scripts/prepare-release.ts +421 -0
- package/scripts/run-industry-showcase.ts +237 -0
- package/scripts/run-test-showcase.ts +244 -0
- package/scripts/setup-github-watch.sh +43 -0
- package/scripts/sync-version.js +35 -0
- package/scripts/test-integration-detection.ts +93 -0
- package/scripts/test-integration-simple.js +93 -0
- package/scripts/test-medal-progression.sh +143 -0
- package/scripts/test-showcase-results.json +109 -0
- package/scripts/test-showcase.json +32 -0
- package/scripts/update-version.js +148 -0
- package/scripts/verify-build.js +343 -0
- package/scripts/version-check.js +78 -0
- package/scripts/watch-discussions.sh +86 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# 📊 Generate Real Drift Reports for Social Media
|
|
3
|
+
# Championship-grade proof of context-drift impact
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "🍊 FAF DRIFT REPORT GENERATOR"
|
|
8
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
9
|
+
echo ""
|
|
10
|
+
|
|
11
|
+
# Output directory for reports
|
|
12
|
+
REPORT_DIR="/tmp/faf-drift-reports"
|
|
13
|
+
mkdir -p "$REPORT_DIR"
|
|
14
|
+
|
|
15
|
+
echo "📁 Reports will be saved to: $REPORT_DIR"
|
|
16
|
+
echo ""
|
|
17
|
+
|
|
18
|
+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
19
|
+
# Report 1: FAF CLI itself
|
|
20
|
+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
21
|
+
|
|
22
|
+
echo "🏎️ REPORT 1: FAF CLI (Self-Analysis)"
|
|
23
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
24
|
+
echo ""
|
|
25
|
+
|
|
26
|
+
cd "$(dirname "$0")/.."
|
|
27
|
+
node dist/cli.js drift --export "$REPORT_DIR/faf-cli-drift.json" | tee "$REPORT_DIR/faf-cli-drift.txt"
|
|
28
|
+
|
|
29
|
+
echo ""
|
|
30
|
+
echo "✅ Report saved:"
|
|
31
|
+
echo " - JSON: $REPORT_DIR/faf-cli-drift.json"
|
|
32
|
+
echo " - Text: $REPORT_DIR/faf-cli-drift.txt"
|
|
33
|
+
echo ""
|
|
34
|
+
|
|
35
|
+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
36
|
+
# Report 2: Other FAF projects (if available)
|
|
37
|
+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
38
|
+
|
|
39
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
40
|
+
echo "🔍 Scanning for other FAF projects..."
|
|
41
|
+
echo ""
|
|
42
|
+
|
|
43
|
+
# Check if faf-dev-tools exists
|
|
44
|
+
if [ -d "/Users/wolfejam/FAF/faf-dev-tools" ]; then
|
|
45
|
+
echo "🌐 REPORT 2: faf-dev-tools"
|
|
46
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
47
|
+
echo ""
|
|
48
|
+
|
|
49
|
+
cd /Users/wolfejam/FAF/faf-dev-tools
|
|
50
|
+
node /Users/wolfejam/FAF/cli/dist/cli.js drift --export "$REPORT_DIR/faf-dev-tools-drift.json" | tee "$REPORT_DIR/faf-dev-tools-drift.txt"
|
|
51
|
+
|
|
52
|
+
echo ""
|
|
53
|
+
echo "✅ Report saved:"
|
|
54
|
+
echo " - JSON: $REPORT_DIR/faf-dev-tools-drift.json"
|
|
55
|
+
echo " - Text: $REPORT_DIR/faf-dev-tools-drift.txt"
|
|
56
|
+
echo ""
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
# Check if claude-faf-mcp exists
|
|
60
|
+
if [ -d "/Users/wolfejam/FAF/claude-faf-mcp" ]; then
|
|
61
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
62
|
+
echo "🔌 REPORT 3: claude-faf-mcp"
|
|
63
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
64
|
+
echo ""
|
|
65
|
+
|
|
66
|
+
cd /Users/wolfejam/FAF/claude-faf-mcp
|
|
67
|
+
node /Users/wolfejam/FAF/cli/dist/cli.js drift --export "$REPORT_DIR/claude-faf-mcp-drift.json" | tee "$REPORT_DIR/claude-faf-mcp-drift.txt"
|
|
68
|
+
|
|
69
|
+
echo ""
|
|
70
|
+
echo "✅ Report saved:"
|
|
71
|
+
echo " - JSON: $REPORT_DIR/claude-faf-mcp-drift.json"
|
|
72
|
+
echo " - Text: $REPORT_DIR/claude-faf-mcp-drift.txt"
|
|
73
|
+
echo ""
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
77
|
+
# Generate Summary
|
|
78
|
+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
79
|
+
|
|
80
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
81
|
+
echo "📊 SUMMARY"
|
|
82
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
83
|
+
echo ""
|
|
84
|
+
echo "All reports saved to: $REPORT_DIR"
|
|
85
|
+
echo ""
|
|
86
|
+
echo "Reports generated:"
|
|
87
|
+
ls -lh "$REPORT_DIR"
|
|
88
|
+
echo ""
|
|
89
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
90
|
+
echo "🎯 READY FOR SOCIAL MEDIA"
|
|
91
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
92
|
+
echo ""
|
|
93
|
+
echo "Text reports (ready to copy/paste):"
|
|
94
|
+
for file in "$REPORT_DIR"/*.txt; do
|
|
95
|
+
if [ -f "$file" ]; then
|
|
96
|
+
echo " 📄 $(basename "$file")"
|
|
97
|
+
fi
|
|
98
|
+
done
|
|
99
|
+
echo ""
|
|
100
|
+
echo "JSON reports (for web visualization):"
|
|
101
|
+
for file in "$REPORT_DIR"/*.json; do
|
|
102
|
+
if [ -f "$file" ]; then
|
|
103
|
+
echo " 📊 $(basename "$file")"
|
|
104
|
+
fi
|
|
105
|
+
done
|
|
106
|
+
echo ""
|
|
107
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
108
|
+
echo "Context-drift makes you pay."
|
|
109
|
+
echo ".faf keeps you drift-free."
|
|
110
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
111
|
+
echo ""
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "FAF Industry Showcase",
|
|
3
|
+
"description": "Proof that FAF works across every language, framework, and project type",
|
|
4
|
+
"updated": "2026-02-08",
|
|
5
|
+
"categories": [
|
|
6
|
+
{
|
|
7
|
+
"name": "JavaScript/TypeScript",
|
|
8
|
+
"repos": [
|
|
9
|
+
"facebook/react",
|
|
10
|
+
"vuejs/core",
|
|
11
|
+
"angular/angular",
|
|
12
|
+
"sveltejs/svelte",
|
|
13
|
+
"vercel/next.js",
|
|
14
|
+
"nuxt/nuxt",
|
|
15
|
+
"microsoft/TypeScript",
|
|
16
|
+
"nodejs/node",
|
|
17
|
+
"denoland/deno",
|
|
18
|
+
"oven-sh/bun",
|
|
19
|
+
"expressjs/express",
|
|
20
|
+
"nestjs/nest"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "Python",
|
|
25
|
+
"repos": [
|
|
26
|
+
"python/cpython",
|
|
27
|
+
"django/django",
|
|
28
|
+
"pallets/flask",
|
|
29
|
+
"tiangolo/fastapi",
|
|
30
|
+
"huggingface/transformers",
|
|
31
|
+
"openai/whisper",
|
|
32
|
+
"pytorch/pytorch",
|
|
33
|
+
"tensorflow/tensorflow",
|
|
34
|
+
"scikit-learn/scikit-learn",
|
|
35
|
+
"jupyter/notebook"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "Systems/Low-level",
|
|
40
|
+
"repos": [
|
|
41
|
+
"ggml-org/whisper.cpp",
|
|
42
|
+
"rust-lang/rust",
|
|
43
|
+
"golang/go",
|
|
44
|
+
"ziglang/zig",
|
|
45
|
+
"redis/redis",
|
|
46
|
+
"nginx/nginx",
|
|
47
|
+
"curl/curl",
|
|
48
|
+
"git/git"
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "Mobile",
|
|
53
|
+
"repos": [
|
|
54
|
+
"facebook/react-native",
|
|
55
|
+
"flutter/flutter",
|
|
56
|
+
"ionic-team/ionic-framework",
|
|
57
|
+
"expo/expo",
|
|
58
|
+
"realm/realm-swift",
|
|
59
|
+
"square/okhttp"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "Databases",
|
|
64
|
+
"repos": [
|
|
65
|
+
"postgres/postgres",
|
|
66
|
+
"mongodb/mongo",
|
|
67
|
+
"elastic/elasticsearch",
|
|
68
|
+
"clickhouse/clickhouse",
|
|
69
|
+
"cockroachdb/cockroach",
|
|
70
|
+
"supabase/supabase"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "DevOps/Cloud",
|
|
75
|
+
"repos": [
|
|
76
|
+
"kubernetes/kubernetes",
|
|
77
|
+
"docker/cli",
|
|
78
|
+
"hashicorp/terraform",
|
|
79
|
+
"ansible/ansible",
|
|
80
|
+
"prometheus/prometheus",
|
|
81
|
+
"grafana/grafana",
|
|
82
|
+
"vercel/vercel",
|
|
83
|
+
"netlify/cli"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "Web Frameworks",
|
|
88
|
+
"repos": [
|
|
89
|
+
"rails/rails",
|
|
90
|
+
"laravel/laravel",
|
|
91
|
+
"spring-projects/spring-boot",
|
|
92
|
+
"phoenixframework/phoenix",
|
|
93
|
+
"gin-gonic/gin",
|
|
94
|
+
"actix/actix-web"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "Developer Tools",
|
|
99
|
+
"repos": [
|
|
100
|
+
"neovim/neovim",
|
|
101
|
+
"prettier/prettier",
|
|
102
|
+
"eslint/eslint",
|
|
103
|
+
"webpack/webpack",
|
|
104
|
+
"vitejs/vite",
|
|
105
|
+
"vercel/turborepo",
|
|
106
|
+
"changesets/changesets",
|
|
107
|
+
"jestjs/jest"
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "AI/ML Infrastructure",
|
|
112
|
+
"repos": [
|
|
113
|
+
"openai/openai-python",
|
|
114
|
+
"anthropics/anthropic-sdk-python",
|
|
115
|
+
"langchain-ai/langchain",
|
|
116
|
+
"run-llama/llama_index",
|
|
117
|
+
"chroma-core/chroma",
|
|
118
|
+
"pinecone-io/pinecone-python-client"
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# MCP Ecosystem Research - Get stats for all major MCP servers
|
|
3
|
+
|
|
4
|
+
echo "🔍 MCP ECOSYSTEM RESEARCH"
|
|
5
|
+
echo "========================="
|
|
6
|
+
echo ""
|
|
7
|
+
|
|
8
|
+
packages=(
|
|
9
|
+
"@modelcontextprotocol/sdk"
|
|
10
|
+
"@playwright/mcp"
|
|
11
|
+
"chrome-devtools-mcp"
|
|
12
|
+
"@mastra/mcp"
|
|
13
|
+
"n8n-mcp"
|
|
14
|
+
"mcp-proxy"
|
|
15
|
+
"@langchain/mcp-adapters"
|
|
16
|
+
"mcp-handler"
|
|
17
|
+
"tavily-mcp"
|
|
18
|
+
"n8n-nodes-mcp"
|
|
19
|
+
"@supabase/mcp-utils"
|
|
20
|
+
"@upstash/context7-mcp"
|
|
21
|
+
"mcp-framework"
|
|
22
|
+
"@hono/mcp"
|
|
23
|
+
"gemini-mcp-tool"
|
|
24
|
+
"@expo/mcp-tunnel"
|
|
25
|
+
"@browsermcp/mcp"
|
|
26
|
+
"@agent-infra/mcp-server-browser"
|
|
27
|
+
"@mobilenext/mobile-mcp"
|
|
28
|
+
"mcp-hello-world"
|
|
29
|
+
"@mzxrai/mcp-webresearch"
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
for pkg in "${packages[@]}"; do
|
|
33
|
+
echo "📦 $pkg"
|
|
34
|
+
|
|
35
|
+
# Get package info
|
|
36
|
+
info=$(npm view "$pkg" version description 2>/dev/null)
|
|
37
|
+
if [ $? -eq 0 ]; then
|
|
38
|
+
echo " $info" | sed 's/^/ /'
|
|
39
|
+
|
|
40
|
+
# Get download stats
|
|
41
|
+
downloads=$(curl -s "https://api.npmjs.org/downloads/point/last-week/$pkg" 2>/dev/null)
|
|
42
|
+
if [ $? -eq 0 ]; then
|
|
43
|
+
dl_count=$(echo "$downloads" | grep -o '"downloads":[0-9]*' | cut -d: -f2)
|
|
44
|
+
if [ -n "$dl_count" ]; then
|
|
45
|
+
# Format with commas
|
|
46
|
+
formatted=$(printf "%'d" $dl_count 2>/dev/null || echo $dl_count)
|
|
47
|
+
echo " 📊 Weekly downloads: $formatted"
|
|
48
|
+
fi
|
|
49
|
+
fi
|
|
50
|
+
else
|
|
51
|
+
echo " ⚠️ Package not found"
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
echo ""
|
|
55
|
+
sleep 0.2 # Rate limit
|
|
56
|
+
done
|
|
57
|
+
|
|
58
|
+
echo "✅ Research complete!"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# 🔥 ROCK SOLID YAML FIX - Migrate all files to use fix-once/yaml
|
|
3
|
+
# FIX ONCE, DONE FOREVER
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "🔧 Migrating all YAML imports to fix-once/yaml..."
|
|
8
|
+
echo ""
|
|
9
|
+
|
|
10
|
+
# Find all TypeScript files with yaml imports
|
|
11
|
+
FILES=$(grep -r "import.*yaml" src/ --include="*.ts" -l || true)
|
|
12
|
+
|
|
13
|
+
COUNT=0
|
|
14
|
+
for file in $FILES; do
|
|
15
|
+
# Skip the fix-once/yaml.ts file itself
|
|
16
|
+
if [[ "$file" == *"fix-once/yaml.ts"* ]]; then
|
|
17
|
+
continue
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
echo "📝 Processing: $file"
|
|
21
|
+
|
|
22
|
+
# Pattern 1: import * as YAML from 'yaml'
|
|
23
|
+
sed -i '' "s|import \* as YAML from ['\"]yaml['\"]|import { parse as parseYAML, stringify as stringifyYAML } from '../fix-once/yaml'|g" "$file"
|
|
24
|
+
sed -i '' "s|import \* as YAML from ['\"]yaml['\"]|import { parse as parseYAML, stringify as stringifyYAML } from '../../fix-once/yaml'|g" "$file"
|
|
25
|
+
sed -i '' "s|import \* as YAML from ['\"]yaml['\"]|import { parse as parseYAML, stringify as stringifyYAML } from '../../../fix-once/yaml'|g" "$file"
|
|
26
|
+
|
|
27
|
+
# Pattern 2: import * as yaml from 'yaml'
|
|
28
|
+
sed -i '' "s|import \* as yaml from ['\"]yaml['\"]|import { parse as parseYAML, stringify as stringifyYAML } from '../fix-once/yaml'|g" "$file"
|
|
29
|
+
sed -i '' "s|import \* as yaml from ['\"]yaml['\"]|import { parse as parseYAML, stringify as stringifyYAML } from '../../fix-once/yaml'|g" "$file"
|
|
30
|
+
sed -i '' "s|import \* as yaml from ['\"]yaml['\"]|import { parse as parseYAML, stringify as stringifyYAML } from '../../../fix-once/yaml'|g" "$file"
|
|
31
|
+
|
|
32
|
+
# Pattern 3: import yaml from 'yaml'
|
|
33
|
+
sed -i '' "s|import yaml from ['\"]yaml['\"]|import { parse as parseYAML, stringify as stringifyYAML } from '../fix-once/yaml'|g" "$file"
|
|
34
|
+
sed -i '' "s|import yaml from ['\"]yaml['\"]|import { parse as parseYAML, stringify as stringifyYAML } from '../../fix-once/yaml'|g" "$file"
|
|
35
|
+
sed -i '' "s|import yaml from ['\"]yaml['\"]|import { parse as parseYAML, stringify as stringifyYAML } from '../../../fix-once/yaml'|g" "$file"
|
|
36
|
+
|
|
37
|
+
# Pattern 4: import { parse, stringify } from 'yaml'
|
|
38
|
+
sed -i '' "s|import { parse, stringify } from ['\"]yaml['\"]|import { parse as parseYAML, stringify as stringifyYAML } from '../fix-once/yaml'|g" "$file"
|
|
39
|
+
sed -i '' "s|import { parse, stringify } from ['\"]yaml['\"]|import { parse as parseYAML, stringify as stringifyYAML } from '../../fix-once/yaml'|g" "$file"
|
|
40
|
+
sed -i '' "s|import { parse, stringify } from ['\"]yaml['\"]|import { parse as parseYAML, stringify as stringifyYAML } from '../../../fix-once/yaml'|g" "$file"
|
|
41
|
+
|
|
42
|
+
COUNT=$((COUNT + 1))
|
|
43
|
+
done
|
|
44
|
+
|
|
45
|
+
echo ""
|
|
46
|
+
echo "✅ Migrated $COUNT files to use fix-once/yaml"
|
|
47
|
+
echo ""
|
|
48
|
+
echo "⚠️ MANUAL STEP REQUIRED:"
|
|
49
|
+
echo " Replace all instances of:"
|
|
50
|
+
echo " - YAML.parse(x) → parseYAML(x, { filepath: path })"
|
|
51
|
+
echo " - yaml.parse(x) → parseYAML(x, { filepath: path })"
|
|
52
|
+
echo " - YAML.stringify(x) → stringifyYAML(x)"
|
|
53
|
+
echo " - yaml.stringify(x) → stringifyYAML(x)"
|
|
54
|
+
echo ""
|
|
55
|
+
echo "🏎️ YAML is now ROCK SOLID - FIX ONCE, DONE FOREVER"
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#!/usr/bin/env ts-node
|
|
2
|
+
/**
|
|
3
|
+
* 🔥 ROCK SOLID YAML FIX - Automated Migration
|
|
4
|
+
* FIX ONCE, DONE FOREVER
|
|
5
|
+
*
|
|
6
|
+
* This script migrates ALL yaml imports to use fix-once/yaml
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import * as fs from 'fs';
|
|
10
|
+
import * as path from 'path';
|
|
11
|
+
|
|
12
|
+
const SRC_DIR = path.join(__dirname, '../src');
|
|
13
|
+
|
|
14
|
+
function getAllTypeScriptFiles(dir: string): string[] {
|
|
15
|
+
const files: string[] = [];
|
|
16
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
17
|
+
|
|
18
|
+
for (const entry of entries) {
|
|
19
|
+
const fullPath = path.join(dir, entry.name);
|
|
20
|
+
if (entry.isDirectory()) {
|
|
21
|
+
files.push(...getAllTypeScriptFiles(fullPath));
|
|
22
|
+
} else if (entry.isFile() && entry.name.endsWith('.ts')) {
|
|
23
|
+
files.push(fullPath);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return files;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface MigrationResult {
|
|
31
|
+
file: string;
|
|
32
|
+
changed: boolean;
|
|
33
|
+
errors: string[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getRelativeImportPath(filePath: string): string {
|
|
37
|
+
// Get relative path from file to src/fix-once/yaml
|
|
38
|
+
const fileDir = path.dirname(filePath);
|
|
39
|
+
const targetPath = path.join(SRC_DIR, 'fix-once', 'yaml');
|
|
40
|
+
const relativePath = path.relative(fileDir, targetPath);
|
|
41
|
+
|
|
42
|
+
// Convert to Unix-style path for imports
|
|
43
|
+
return relativePath.replace(/\\/g, '/').replace(/\.ts$/, '');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function migrateFile(filePath: string): MigrationResult {
|
|
47
|
+
const result: MigrationResult = {
|
|
48
|
+
file: filePath,
|
|
49
|
+
changed: false,
|
|
50
|
+
errors: []
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// Skip the fix-once/yaml.ts file itself
|
|
54
|
+
if (filePath.includes('fix-once/yaml.ts')) {
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let content = fs.readFileSync(filePath, 'utf-8');
|
|
59
|
+
const originalContent = content;
|
|
60
|
+
|
|
61
|
+
// Calculate correct relative path
|
|
62
|
+
const relativePath = getRelativeImportPath(filePath);
|
|
63
|
+
|
|
64
|
+
// Pattern 1: import * as YAML from 'yaml'
|
|
65
|
+
content = content.replace(
|
|
66
|
+
/import \* as YAML from ['"]yaml['"]/g,
|
|
67
|
+
`import { parse as parseYAML, stringify as stringifyYAML } from '${relativePath}'`
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
// Pattern 2: import * as yaml from 'yaml'
|
|
71
|
+
content = content.replace(
|
|
72
|
+
/import \* as yaml from ['"]yaml['"]/g,
|
|
73
|
+
`import { parse as parseYAML, stringify as stringifyYAML } from '${relativePath}'`
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
// Pattern 3: import yaml from 'yaml'
|
|
77
|
+
content = content.replace(
|
|
78
|
+
/import yaml from ['"]yaml['"]/g,
|
|
79
|
+
`import { parse as parseYAML, stringify as stringifyYAML } from '${relativePath}'`
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
// Pattern 4: import { parse, stringify } from 'yaml'
|
|
83
|
+
content = content.replace(
|
|
84
|
+
/import { parse, stringify } from ['"]yaml['"]/g,
|
|
85
|
+
`import { parse as parseYAML, stringify as stringifyYAML } from '${relativePath}'`
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
// Replace usage patterns (basic - may need manual fixes)
|
|
89
|
+
content = content.replace(/YAML\.parse\(/g, 'parseYAML(');
|
|
90
|
+
content = content.replace(/yaml\.parse\(/g, 'parseYAML(');
|
|
91
|
+
content = content.replace(/YAML\.stringify\(/g, 'stringifyYAML(');
|
|
92
|
+
content = content.replace(/yaml\.stringify\(/g, 'stringifyYAML(');
|
|
93
|
+
|
|
94
|
+
if (content !== originalContent) {
|
|
95
|
+
fs.writeFileSync(filePath, content);
|
|
96
|
+
result.changed = true;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Find all TypeScript files
|
|
103
|
+
const files = getAllTypeScriptFiles(SRC_DIR);
|
|
104
|
+
|
|
105
|
+
console.log('🔥 ROCK SOLID YAML MIGRATION');
|
|
106
|
+
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
107
|
+
console.log(`Found ${files.length} TypeScript files`);
|
|
108
|
+
console.log('');
|
|
109
|
+
|
|
110
|
+
const results: MigrationResult[] = [];
|
|
111
|
+
let changedCount = 0;
|
|
112
|
+
|
|
113
|
+
for (const file of files) {
|
|
114
|
+
const result = migrateFile(file);
|
|
115
|
+
if (result.changed) {
|
|
116
|
+
console.log(`✅ ${file.replace(SRC_DIR, 'src')}`);
|
|
117
|
+
changedCount++;
|
|
118
|
+
}
|
|
119
|
+
results.push(result);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
console.log('');
|
|
123
|
+
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
124
|
+
console.log(`✅ Migration complete: ${changedCount} files updated`);
|
|
125
|
+
console.log('');
|
|
126
|
+
console.log('⚠️ NEXT STEPS (Manual):');
|
|
127
|
+
console.log(' 1. Search for parseYAML( calls');
|
|
128
|
+
console.log(' 2. Add { filepath: <path> } option where appropriate');
|
|
129
|
+
console.log(' 3. Example: parseYAML(content, { filepath: fafPath })');
|
|
130
|
+
console.log(' 4. Run: npm test to verify');
|
|
131
|
+
console.log('');
|
|
132
|
+
console.log('🏎️ YAML IS NOW ROCK SOLID - FIX ONCE, DONE FOREVER');
|