gbu-accessibility-package 3.2.0 → 3.3.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/CHANGELOG.md CHANGED
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.2.0] - 2024-07-28
9
+
10
+ ### Added
11
+ - **Enhanced Alt Attribute Integration**: Tích hợp hoàn toàn EnhancedAltChecker và EnhancedAltGenerator vào AccessibilityFixer
12
+ - **Broken Links Detection**: Tính năng phát hiện liên kết bị hỏng và tài nguyên 404
13
+ - **Clean Architecture**: Tất cả tính năng enhanced được tích hợp trong một file duy nhất
14
+ - **Improved Performance**: Giảm overhead từ việc import nhiều module riêng biệt
15
+ - **Simplified API**: Không cần import các class enhanced riêng biệt
16
+
17
+ ### Changed
18
+ - **BREAKING**: EnhancedAltChecker và EnhancedAltGenerator không còn là class riêng biệt
19
+ - **Integrated Features**: Tất cả tính năng enhanced alt đã được tích hợp vào AccessibilityFixer
20
+ - **Cleaner Codebase**: Loại bỏ các file enhanced riêng lẻ để có kiến trúc gọn gàng hơn
21
+ - **Updated Documentation**: README và README-vi được cập nhật để phản ánh kiến trúc mới
22
+
23
+ ### Migration Guide
24
+ - **For most users**: Không cần thay đổi gì - tất cả tính năng vẫn hoạt động như cũ
25
+ - **For programmatic usage**: Chỉ cần import AccessibilityFixer, không cần import EnhancedAltChecker/Generator riêng
26
+ - **Enhanced features**: Vẫn có sẵn thông qua các config options trong AccessibilityFixer
27
+
8
28
  ## [3.1.0] - 2024-07-25
9
29
 
10
30
  ### Changed
package/QUICK_START.md CHANGED
@@ -15,6 +15,22 @@ npm install gbu-accessibility-package
15
15
  gbu-a11y
16
16
  ```
17
17
 
18
+ ## 🔄 Cài đặt lại / Cập nhật
19
+
20
+ ```bash
21
+ # Gỡ cài đặt cũ
22
+ npm uninstall -g gbu-accessibility-package
23
+
24
+ # Xóa cache
25
+ npm cache clean --force
26
+
27
+ # Cài đặt phiên bản mới nhất
28
+ npm install -g gbu-accessibility-package@latest
29
+
30
+ # Kiểm tra version
31
+ gbu-a11y --version
32
+ ```
33
+
18
34
  ## 🎯 Sử dụng cơ bản
19
35
 
20
36
  ### Cách 1: CLI (Đơn giản nhất)
@@ -115,9 +131,31 @@ gbu-a11y --dry-run
115
131
 
116
132
  **Lỗi "Cannot find module"**
117
133
  ```bash
134
+ # Cài đặt lại
135
+ npm uninstall -g gbu-accessibility-package
136
+ npm cache clean --force
118
137
  npm install -g gbu-accessibility-package
119
138
  ```
120
139
 
140
+ **Lỗi permission (macOS/Linux)**
141
+ ```bash
142
+ sudo npm install -g gbu-accessibility-package
143
+ ```
144
+
145
+ **Package không update**
146
+ ```bash
147
+ # Force update
148
+ npm cache clean --force
149
+ npm install -g gbu-accessibility-package@latest --force
150
+ ```
151
+
152
+ **Kiểm tra cài đặt**
153
+ ```bash
154
+ which gbu-a11y
155
+ npm list -g gbu-accessibility-package
156
+ gbu-a11y --version
157
+ ```
158
+
121
159
  **Duplicate attributes**
122
160
  - Tool tự động tránh duplicate
123
161
  - Nếu có, chạy lại tool sẽ tự clean up
package/README-vi.md CHANGED
@@ -9,6 +9,7 @@
9
9
  ## ✨ Tính năng
10
10
 
11
11
  ### 🎯 **Sửa lỗi Accessibility cơ bản**
12
+
12
13
  - 🖼️ **Tạo Alt Text thông minh** - Alt attributes nhận biết ngữ cảnh cho hình ảnh
13
14
  - 🏷️ **Hỗ trợ Aria Label** - Tự động tạo aria-label phù hợp với alt text
14
15
  - 🌐 **HTML Lang Attributes** - Tự động sửa thuộc tính ngôn ngữ
@@ -18,17 +19,21 @@
18
19
  - 🔗 **Link Names** - Sửa links rỗng và phát hiện text generic
19
20
  - 🏛️ **Landmarks** - Thêm main và navigation landmarks thiếu
20
21
  - 📑 **Phân tích Heading** - Phân tích cấu trúc heading với gợi ý (không tự động sửa)
22
+ - 🔍 **Broken Links Detection** - Phát hiện liên kết bị hỏng và tài nguyên 404
21
23
  - 🧹 **Dọn dẹp Duplicate** - Loại bỏ role attributes trùng lặp
22
24
 
23
- ### 🚀 **Tính năng Enhanced Alt Attribute (MỚI!)**
24
- - 🔍 **Phân tích toàn diện** - Phân loại loại hình ảnh và kiểm tra chất lượng
25
- - 🎨 **Tạo Alt đa dạng** - Nhiều chiến lược cho alt text sáng tạo
26
- - 🌐 **Hỗ trợ đa ngôn ngữ** - Từ vựng tiếng Nhật, Anh, Việt
25
+ ### 🚀 **Tính năng Enhanced Alt Attribute (Đã tích hợp!)**
26
+
27
+ - 🔍 **Phân tích toàn diện** - Phân loại loại hình ảnh kiểm tra chất lượng tích hợp sẵn
28
+ - 🎨 **Tạo Alt đa dạng** - Nhiều chiến lược cho alt text sáng tạo được tích hợp trong core
29
+ - 🌐 **Hỗ trợ đa ngôn ngữ** - Từ vựng tiếng Nhật, Anh, Việt tích hợp sẵn
27
30
  - 🎭 **Mức độ sáng tạo** - Chế độ Conservative, Balanced, Creative
28
31
  - 🧠 **Nhận biết ngữ cảnh** - Tích hợp ngữ cảnh thương hiệu, cảm xúc, kỹ thuật
29
32
  - 📊 **Trực quan hóa dữ liệu** - Mô tả chuyên biệt cho biểu đồ và đồ thị
33
+ - 🧹 **Kiến trúc gọn gàng** - Tất cả tính năng enhanced được tích hợp trong một file duy nhất
30
34
 
31
35
  ### 🛠️ **Tính năng tiện ích**
36
+
32
37
  - 📁 **Xử lý hàng loạt** - Xử lý toàn bộ thư mục đệ quy
33
38
  - 💾 **Backup tùy chọn** - Tạo file backup khi cần với flag --backup
34
39
  - 🔍 **Chế độ Dry Run** - Xem trước thay đổi trước khi áp dụng
@@ -47,6 +52,47 @@ npm install -g gbu-accessibility-package
47
52
  npm install gbu-accessibility-package
48
53
  ```
49
54
 
55
+ ### Gỡ cài đặt và Cài đặt lại
56
+
57
+ ```bash
58
+ # Gỡ cài đặt package global
59
+ npm uninstall -g gbu-accessibility-package
60
+
61
+ # Gỡ cài đặt package local
62
+ npm uninstall gbu-accessibility-package
63
+
64
+ # Xóa cache npm (khuyến nghị khi có vấn đề)
65
+ npm cache clean --force
66
+
67
+ # Cài đặt lại phiên bản mới nhất
68
+ npm install -g gbu-accessibility-package@latest
69
+
70
+ # Kiểm tra phiên bản đã cài đặt
71
+ npm list -g gbu-accessibility-package
72
+ gbu-a11y --version
73
+
74
+ # Cài đặt phiên bản cụ thể
75
+ npm install -g gbu-accessibility-package@3.2.1
76
+ ```
77
+
78
+ ### Khắc phục sự cố cài đặt
79
+
80
+ ```bash
81
+ # Nếu gặp lỗi permission (macOS/Linux)
82
+ sudo npm install -g gbu-accessibility-package
83
+
84
+ # Nếu gặp lỗi cache
85
+ npm cache clean --force
86
+ npm install -g gbu-accessibility-package --force
87
+
88
+ # Kiểm tra cài đặt
89
+ which gbu-a11y
90
+ gbu-a11y --help
91
+
92
+ # Cập nhật lên phiên bản mới nhất
93
+ npm update -g gbu-accessibility-package
94
+ ```
95
+
50
96
  ### Sử dụng cơ bản
51
97
 
52
98
  ```bash
@@ -103,6 +149,7 @@ Chế độ sửa lỗi:
103
149
  --links-only Sửa link names + dọn dẹp
104
150
  --landmarks-only Sửa landmarks + dọn dẹp
105
151
  --headings-only Phân tích cấu trúc heading (không tự động sửa)
152
+ --links-check Kiểm tra liên kết bị hỏng và tài nguyên 404
106
153
  --cleanup-only Chỉ dọn dẹp role attributes trùng lặp
107
154
 
108
155
  Tùy chọn Enhanced Alt:
@@ -131,6 +178,7 @@ gbu-a11y -l en ./public
131
178
  gbu-a11y --alt-only # Sửa alt attributes + dọn dẹp
132
179
  gbu-a11y --forms-only # Sửa form labels + dọn dẹp
133
180
  gbu-a11y --buttons-only # Sửa button names + dọn dẹp
181
+ gbu-a11y --links-check # Kiểm tra liên kết bị hỏng + dọn dẹp
134
182
 
135
183
  # Tính năng enhanced alt attribute
136
184
  gbu-a11y --enhanced-alt # Chế độ enhanced cơ bản
@@ -149,6 +197,7 @@ gbu-a11y --enhanced-alt --dry-run # Xem trước sửa
149
197
  ### Mức độ sáng tạo
150
198
 
151
199
  #### Conservative (Bảo thủ)
200
+
152
201
  - Mô tả đơn giản, thực tế
153
202
  - Tập trung vào chức năng cơ bản
154
203
  - Biến thể từ vựng tối thiểu
@@ -156,6 +205,7 @@ gbu-a11y --enhanced-alt --dry-run # Xem trước sửa
156
205
  **Ví dụ**: `alt="Biểu đồ"`, `alt="Logo"`
157
206
 
158
207
  #### Balanced (Cân bằng - Mặc định)
208
+
159
209
  - Mô tả nhận biết ngữ cảnh
160
210
  - Sáng tạo vừa phải
161
211
  - Cân bằng giữa đơn giản và chi tiết
@@ -163,6 +213,7 @@ gbu-a11y --enhanced-alt --dry-run # Xem trước sửa
163
213
  **Ví dụ**: `alt="Biểu đồ hiệu suất bán hàng"`, `alt="Logo công ty"`
164
214
 
165
215
  #### Creative (Sáng tạo)
216
+
166
217
  - Mô tả phong phú, chi tiết
167
218
  - Tích hợp ngữ cảnh cảm xúc
168
219
  - Nhận biết thương hiệu và ngữ cảnh cao
@@ -189,54 +240,51 @@ gbu-a11y --enhanced-alt --dry-run # Xem trước sửa
189
240
  ### Sử dụng cơ bản
190
241
 
191
242
  ```javascript
192
- const { AccessibilityFixer } = require('gbu-accessibility-package');
243
+ const { AccessibilityFixer } = require("gbu-accessibility-package");
193
244
 
194
245
  const fixer = new AccessibilityFixer({
195
- language: 'vi',
246
+ language: "vi",
196
247
  backupFiles: true,
197
- dryRun: false
248
+ dryRun: false,
198
249
  });
199
250
 
200
251
  // Sửa tất cả vấn đề accessibility
201
- fixer.fixAllAccessibilityIssues('./src').then(results => {
202
- console.log('Hoàn thành sửa lỗi accessibility:', results);
252
+ fixer.fixAllAccessibilityIssues("./src").then((results) => {
253
+ console.log("Hoàn thành sửa lỗi accessibility:", results);
203
254
  });
204
255
 
205
256
  // Sửa các vấn đề cụ thể
206
- await fixer.fixEmptyAltAttributes('./src');
207
- await fixer.fixFormLabels('./src');
208
- await fixer.fixButtonNames('./src');
257
+ await fixer.fixEmptyAltAttributes("./src");
258
+ await fixer.fixFormLabels("./src");
259
+ await fixer.fixButtonNames("./src");
209
260
  ```
210
261
 
211
- ### Chế độ Enhanced Alt Attribute
262
+ ### Chế độ Enhanced Alt Attribute (Tích hợp sẵn)
212
263
 
213
264
  ```javascript
214
- const { AccessibilityFixer, EnhancedAltChecker } = require('gbu-accessibility-package');
265
+ const { AccessibilityFixer } = require("gbu-accessibility-package");
215
266
 
216
- // Sử dụng AccessibilityFixer với chế độ enhanced
267
+ // Sử dụng AccessibilityFixer với chế độ enhanced (tích hợp sẵn)
217
268
  const fixer = new AccessibilityFixer({
218
- language: 'vi',
269
+ language: "vi",
219
270
  enhancedAltMode: true,
220
- altCreativity: 'creative',
271
+ altCreativity: "creative",
221
272
  includeEmotions: true,
222
- strictAltChecking: true
273
+ strictAltChecking: true,
223
274
  });
224
275
 
225
- await fixer.fixEmptyAltAttributes('./src');
226
-
227
- // Sử dụng EnhancedAltChecker riêng biệt
228
- const checker = new EnhancedAltChecker({
229
- language: 'vi',
230
- strictMode: true
231
- });
276
+ await fixer.fixEmptyAltAttributes("./src");
232
277
 
233
- const issues = checker.analyzeAltAttributes(htmlContent);
234
- console.log('Tìm thấy vấn đề alt attribute:', issues);
278
+ // Tất cả tính năng enhanced đã được tích hợp trong AccessibilityFixer
279
+ // Không cần import thêm class riêng biệt
280
+ const results = await fixer.fixAllAccessibilityIssues("./src");
281
+ console.log("Hoàn thành sửa lỗi với enhanced features:", results);
235
282
  ```
236
283
 
237
284
  ## 🎯 Những gì được sửa
238
285
 
239
286
  ### Alt Attributes (Chế độ Enhanced)
287
+
240
288
  - **Alt attributes thiếu** → Tạo alt text nhận biết ngữ cảnh
241
289
  - **Alt attributes rỗng** → Mô tả thông minh dựa trên nội dung
242
290
  - **Alt text generic** → Mô tả cụ thể, có ý nghĩa
@@ -245,21 +293,75 @@ console.log('Tìm thấy vấn đề alt attribute:', issues);
245
293
  - **Trực quan hóa dữ liệu** → Loại biểu đồ + xu hướng + dữ liệu chính
246
294
 
247
295
  ### Accessibility Form
296
+
248
297
  - **Form labels thiếu** → Tạo aria-label thông minh
249
298
  - **Input không có label** → Gợi ý label dựa trên ngữ cảnh
250
299
  - **Cấu trúc form** → Liên kết label phù hợp
251
300
 
252
301
  ### Phần tử tương tác
302
+
253
303
  - **Button rỗng** → Tên button dựa trên hành động
254
304
  - **Text link generic** → Mục đích link mô tả
255
305
  - **Tên button thiếu** → Mô tả dựa trên chức năng
256
306
 
257
307
  ### Cấu trúc tài liệu
308
+
258
309
  - **Lang attributes thiếu** → Phát hiện ngôn ngữ tự động
259
310
  - **Landmark thiếu** → Main và navigation landmarks
260
311
  - **Cấu trúc heading** → Phân tích và khuyến nghị
261
312
  - **Role attributes** → Gán role tuân thủ WCAG
262
313
 
314
+ ### Kiểm tra liên kết
315
+
316
+ - **Liên kết bị hỏng** → Phát hiện HTTP 404, 500, timeout
317
+ - **Tài nguyên không tồn tại** → Kiểm tra file local thiếu
318
+ - **URL không hợp lệ** → Phát hiện định dạng URL sai
319
+ - **Liên kết chậm** → Cảnh báo timeout và phản hồi chậm
320
+
321
+ ## 🔧 Quản lý Package
322
+
323
+ ### Kiểm tra thông tin package
324
+
325
+ ```bash
326
+ # Xem version hiện tại
327
+ gbu-a11y --version
328
+ npm list -g gbu-accessibility-package
329
+
330
+ # Xem thông tin package
331
+ npm info gbu-accessibility-package
332
+
333
+ # Kiểm tra package đã cài đặt
334
+ which gbu-a11y
335
+ npm list -g | grep gbu-accessibility-package
336
+ ```
337
+
338
+ ### Cập nhật package
339
+
340
+ ```bash
341
+ # Kiểm tra version mới
342
+ npm outdated -g gbu-accessibility-package
343
+
344
+ # Cập nhật lên version mới nhất
345
+ npm update -g gbu-accessibility-package
346
+
347
+ # Hoặc cài đặt lại version mới
348
+ npm uninstall -g gbu-accessibility-package
349
+ npm install -g gbu-accessibility-package@latest
350
+ ```
351
+
352
+ ### Quản lý cache
353
+
354
+ ```bash
355
+ # Xem cache info
356
+ npm cache verify
357
+
358
+ # Xóa cache (khi có vấn đề)
359
+ npm cache clean --force
360
+
361
+ # Xem cache location
362
+ npm config get cache
363
+ ```
364
+
263
365
  ## 🧪 Kiểm tra và Demo
264
366
 
265
367
  ```bash
@@ -329,4 +431,4 @@ Dự án này được cấp phép theo Giấy phép MIT - xem file [LICENSE](LI
329
431
 
330
432
  **Được tạo với ❤️ bởi GBU Team**
331
433
 
332
- Để biết thêm thông tin, hãy truy cập [GitHub repository](https://github.com/dangpv94/gbu-accessibility-tool) của chúng tôi.
434
+ Để biết thêm thông tin, hãy truy cập [GitHub repository](https://github.com/dangpv94/gbu-accessibility-tool) của chúng tôi.
package/README.md CHANGED
@@ -18,15 +18,17 @@
18
18
  - 🔗 **Link Names** - Fix empty links and detect generic link text
19
19
  - 🏛️ **Landmarks** - Add missing main and navigation landmarks
20
20
  - 📑 **Heading Analysis** - Analyze heading structure with suggestions (no auto-fix)
21
+ - 🔍 **Broken Links Detection** - Detect broken links and 404 resources
21
22
  - 🧹 **Duplicate Cleanup** - Remove duplicate role attributes
22
23
 
23
- ### 🚀 **Enhanced Alt Attribute Features (NEW!)**
24
- - 🔍 **Comprehensive Analysis** - Image type classification and quality checking
25
- - 🎨 **Diverse Alt Generation** - Multiple strategies for creative alt text
26
- - 🌐 **Multi-language Support** - Japanese, English, Vietnamese vocabulary
24
+ ### 🚀 **Enhanced Alt Attribute Features (Integrated!)**
25
+ - 🔍 **Comprehensive Analysis** - Image type classification and quality checking built-in
26
+ - 🎨 **Diverse Alt Generation** - Multiple strategies for creative alt text integrated in core
27
+ - 🌐 **Multi-language Support** - Japanese, English, Vietnamese vocabulary built-in
27
28
  - 🎭 **Creativity Levels** - Conservative, Balanced, Creative modes
28
29
  - 🧠 **Context Awareness** - Brand, emotional, and technical context integration
29
30
  - 📊 **Data Visualization** - Specialized descriptions for charts and graphs
31
+ - 🧹 **Clean Architecture** - All enhanced features integrated in a single file
30
32
 
31
33
  ### 🛠️ **Utility Features**
32
34
  - 📁 **Batch Processing** - Process entire directories recursively
@@ -47,6 +49,47 @@ npm install -g gbu-accessibility-package
47
49
  npm install gbu-accessibility-package
48
50
  ```
49
51
 
52
+ ### Uninstall and Reinstall
53
+
54
+ ```bash
55
+ # Uninstall global package
56
+ npm uninstall -g gbu-accessibility-package
57
+
58
+ # Uninstall local package
59
+ npm uninstall gbu-accessibility-package
60
+
61
+ # Clear npm cache (recommended when having issues)
62
+ npm cache clean --force
63
+
64
+ # Reinstall latest version
65
+ npm install -g gbu-accessibility-package@latest
66
+
67
+ # Check installed version
68
+ npm list -g gbu-accessibility-package
69
+ gbu-a11y --version
70
+
71
+ # Install specific version
72
+ npm install -g gbu-accessibility-package@3.2.1
73
+ ```
74
+
75
+ ### Installation Troubleshooting
76
+
77
+ ```bash
78
+ # If permission errors (macOS/Linux)
79
+ sudo npm install -g gbu-accessibility-package
80
+
81
+ # If cache issues
82
+ npm cache clean --force
83
+ npm install -g gbu-accessibility-package --force
84
+
85
+ # Verify installation
86
+ which gbu-a11y
87
+ gbu-a11y --help
88
+
89
+ # Update to latest version
90
+ npm update -g gbu-accessibility-package
91
+ ```
92
+
50
93
  ### Basic Usage
51
94
 
52
95
  ```bash
@@ -103,6 +146,7 @@ Fix Modes:
103
146
  --links-only Fix link names + cleanup
104
147
  --landmarks-only Fix landmarks + cleanup
105
148
  --headings-only Analyze heading structure (no auto-fix)
149
+ --links-check Check for broken links and 404 resources
106
150
  --cleanup-only Only cleanup duplicate role attributes
107
151
 
108
152
  Enhanced Alt Options:
@@ -131,6 +175,7 @@ gbu-a11y -l en ./public
131
175
  gbu-a11y --alt-only # Fix alt attributes + cleanup
132
176
  gbu-a11y --forms-only # Fix form labels + cleanup
133
177
  gbu-a11y --buttons-only # Fix button names + cleanup
178
+ gbu-a11y --links-check # Check broken links + cleanup
134
179
 
135
180
  # Enhanced alt attribute features
136
181
  gbu-a11y --enhanced-alt # Basic enhanced mode
@@ -208,12 +253,12 @@ await fixer.fixFormLabels('./src');
208
253
  await fixer.fixButtonNames('./src');
209
254
  ```
210
255
 
211
- ### Enhanced Alt Attribute Mode
256
+ ### Enhanced Alt Attribute Mode (Integrated)
212
257
 
213
258
  ```javascript
214
- const { AccessibilityFixer, EnhancedAltChecker } = require('gbu-accessibility-package');
259
+ const { AccessibilityFixer } = require('gbu-accessibility-package');
215
260
 
216
- // Use AccessibilityFixer with enhanced mode
261
+ // Use AccessibilityFixer with enhanced mode (integrated)
217
262
  const fixer = new AccessibilityFixer({
218
263
  language: 'en',
219
264
  enhancedAltMode: true,
@@ -224,14 +269,10 @@ const fixer = new AccessibilityFixer({
224
269
 
225
270
  await fixer.fixEmptyAltAttributes('./src');
226
271
 
227
- // Use EnhancedAltChecker separately
228
- const checker = new EnhancedAltChecker({
229
- language: 'ja',
230
- strictMode: true
231
- });
232
-
233
- const issues = checker.analyzeAltAttributes(htmlContent);
234
- console.log('Alt attribute issues found:', issues);
272
+ // All enhanced features are now integrated in AccessibilityFixer
273
+ // No need to import separate classes
274
+ const results = await fixer.fixAllAccessibilityIssues('./src');
275
+ console.log('Accessibility fixes completed with enhanced features:', results);
235
276
  ```
236
277
 
237
278
  ## 🎯 What Gets Fixed
@@ -260,6 +301,53 @@ console.log('Alt attribute issues found:', issues);
260
301
  - **Heading structure** → Analysis and recommendations
261
302
  - **Role attributes** → WCAG-compliant role assignments
262
303
 
304
+ ### Link Validation
305
+ - **Broken links** → Detect HTTP 404, 500, timeout errors
306
+ - **Missing resources** → Check for missing local files
307
+ - **Invalid URLs** → Detect malformed URL formats
308
+ - **Slow links** → Warn about timeouts and slow responses
309
+
310
+ ## 🔧 Package Management
311
+
312
+ ### Check package information
313
+ ```bash
314
+ # Check current version
315
+ gbu-a11y --version
316
+ npm list -g gbu-accessibility-package
317
+
318
+ # View package info
319
+ npm info gbu-accessibility-package
320
+
321
+ # Verify installation
322
+ which gbu-a11y
323
+ npm list -g | grep gbu-accessibility-package
324
+ ```
325
+
326
+ ### Update package
327
+ ```bash
328
+ # Check for new versions
329
+ npm outdated -g gbu-accessibility-package
330
+
331
+ # Update to latest version
332
+ npm update -g gbu-accessibility-package
333
+
334
+ # Or reinstall latest version
335
+ npm uninstall -g gbu-accessibility-package
336
+ npm install -g gbu-accessibility-package@latest
337
+ ```
338
+
339
+ ### Cache management
340
+ ```bash
341
+ # Verify cache
342
+ npm cache verify
343
+
344
+ # Clean cache (when having issues)
345
+ npm cache clean --force
346
+
347
+ # View cache location
348
+ npm config get cache
349
+ ```
350
+
263
351
  ## 🧪 Testing and Demo
264
352
 
265
353
  ```bash
package/cli.js CHANGED
@@ -27,6 +27,7 @@ const options = {
27
27
  linksOnly: false,
28
28
  landmarksOnly: false,
29
29
  headingsOnly: false,
30
+ brokenLinksOnly: false,
30
31
  // Enhanced alt options
31
32
  enhancedAlt: false,
32
33
  altCreativity: 'balanced', // conservative, balanced, creative
@@ -91,6 +92,10 @@ for (let i = 0; i < args.length; i++) {
91
92
  case '--headings-only':
92
93
  options.headingsOnly = true;
93
94
  break;
95
+ case '--links-check':
96
+ case '--broken-links':
97
+ options.brokenLinksOnly = true;
98
+ break;
94
99
  case '--enhanced-alt':
95
100
  options.enhancedAlt = true;
96
101
  break;
@@ -133,6 +138,7 @@ Options:
133
138
  --links-only Fix link names + cleanup
134
139
  --landmarks-only Fix landmarks + cleanup
135
140
  --headings-only Analyze heading structure (no auto-fix)
141
+ --links-check Check for broken links and 404 resources (no auto-fix)
136
142
  --enhanced-alt Use enhanced alt attribute analysis and generation
137
143
  --alt-creativity <mode> Alt text creativity: conservative, balanced, creative (default: balanced)
138
144
  --include-emotions Include emotional descriptors in alt text
@@ -162,6 +168,7 @@ Examples:
162
168
  node cli.js --links-only # Fix link names + cleanup
163
169
  node cli.js --landmarks-only # Fix landmarks + cleanup
164
170
  node cli.js --headings-only # Analyze heading structure only
171
+ node cli.js --links-check # Check for broken links and 404s
165
172
  node cli.js --cleanup-only # Only cleanup duplicate roles
166
173
  node cli.js ./src # Fix src directory (comprehensive)
167
174
  node cli.js -l en --dry-run ./dist # Preview comprehensive fixes in English
@@ -220,7 +227,8 @@ async function main() {
220
227
  try {
221
228
  // Handle different modes - All modes now include cleanup
222
229
  if (options.cleanupOnly || options.altOnly || options.langOnly || options.roleOnly ||
223
- options.formsOnly || options.buttonsOnly || options.linksOnly || options.landmarksOnly || options.headingsOnly) {
230
+ options.formsOnly || options.buttonsOnly || options.linksOnly || options.landmarksOnly ||
231
+ options.headingsOnly || options.brokenLinksOnly) {
224
232
  // Individual modes - handle each separately, then run cleanup
225
233
  } else {
226
234
  // Default mode: Run comprehensive fix (all fixes including cleanup)
@@ -390,6 +398,18 @@ async function main() {
390
398
 
391
399
  showCompletionMessage(options, 'Heading analysis');
392
400
  return;
401
+
402
+ } else if (options.brokenLinksOnly) {
403
+ // Check broken links only (no fixes, no cleanup)
404
+ console.log(chalk.blue('🔗 Running broken links check only...'));
405
+ const linkResults = await fixer.checkBrokenLinks(options.directory);
406
+ const totalBrokenLinks = linkResults.reduce((sum, r) => sum + (r.issues || 0), 0);
407
+
408
+ console.log(chalk.green(`\n✅ Checked links in ${linkResults.length} files (${totalBrokenLinks} issues found)`));
409
+ console.log(chalk.gray('💡 Broken link issues require manual review and cannot be auto-fixed'));
410
+
411
+ showCompletionMessage(options, 'Broken links check');
412
+ return;
393
413
  }
394
414
 
395
415
  } catch (error) {
@@ -0,0 +1,41 @@
1
+ <!DOCTYPE html>
2
+ <html lang="ja">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Broken Links Test</title>
6
+ <!-- Broken CSS -->
7
+ <link rel="stylesheet" href="missing-style.css">
8
+ <!-- Working CSS (if exists) -->
9
+ <link rel="stylesheet" href="../package.json">
10
+ </head>
11
+ <body>
12
+ <h1>Broken Links Test</h1>
13
+
14
+ <!-- Working local link -->
15
+ <a href="advanced-test.html">Working local link</a>
16
+
17
+ <!-- Broken local link -->
18
+ <a href="non-existent-page.html">Broken local link</a>
19
+
20
+ <!-- Working external link -->
21
+ <a href="https://www.google.com">Working external link</a>
22
+
23
+ <!-- Broken external link -->
24
+ <a href="https://this-domain-does-not-exist-12345.com">Broken external link</a>
25
+
26
+ <!-- Working image -->
27
+ <img src="advanced-test.html" alt="Working image reference">
28
+
29
+ <!-- Broken image -->
30
+ <img src="missing-image.jpg" alt="Broken image">
31
+
32
+ <!-- Broken script -->
33
+ <script src="missing-script.js"></script>
34
+
35
+ <!-- Skip patterns -->
36
+ <a href="#anchor">Anchor link (should skip)</a>
37
+ <a href="mailto:test@example.com">Email link (should skip)</a>
38
+ <a href="tel:+1234567890">Phone link (should skip)</a>
39
+ <a href="javascript:void(0)">JavaScript link (should skip)</a>
40
+ </body>
41
+ </html>