aios-core 4.2.13 ā 4.2.15
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/.aios-core/core/code-intel/helpers/dev-helper.js +206 -0
- package/.aios-core/core/registry/registry-schema.json +166 -166
- package/.aios-core/core/synapse/diagnostics/collectors/hook-collector.js +3 -3
- package/.aios-core/data/entity-registry.yaml +27 -0
- package/.aios-core/development/scripts/approval-workflow.js +642 -642
- package/.aios-core/development/scripts/backup-manager.js +606 -606
- package/.aios-core/development/scripts/branch-manager.js +389 -389
- package/.aios-core/development/scripts/code-quality-improver.js +1311 -1311
- package/.aios-core/development/scripts/commit-message-generator.js +849 -849
- package/.aios-core/development/scripts/conflict-resolver.js +674 -674
- package/.aios-core/development/scripts/dependency-analyzer.js +637 -637
- package/.aios-core/development/scripts/diff-generator.js +351 -351
- package/.aios-core/development/scripts/elicitation-engine.js +384 -384
- package/.aios-core/development/scripts/elicitation-session-manager.js +299 -299
- package/.aios-core/development/scripts/git-wrapper.js +461 -461
- package/.aios-core/development/scripts/manifest-preview.js +244 -244
- package/.aios-core/development/scripts/metrics-tracker.js +775 -775
- package/.aios-core/development/scripts/modification-validator.js +554 -554
- package/.aios-core/development/scripts/pattern-learner.js +1224 -1224
- package/.aios-core/development/scripts/performance-analyzer.js +757 -757
- package/.aios-core/development/scripts/refactoring-suggester.js +1138 -1138
- package/.aios-core/development/scripts/rollback-handler.js +530 -530
- package/.aios-core/development/scripts/security-checker.js +358 -358
- package/.aios-core/development/scripts/template-engine.js +239 -239
- package/.aios-core/development/scripts/template-validator.js +278 -278
- package/.aios-core/development/scripts/test-generator.js +843 -843
- package/.aios-core/development/scripts/transaction-manager.js +589 -589
- package/.aios-core/development/scripts/usage-tracker.js +673 -673
- package/.aios-core/development/scripts/validate-filenames.js +226 -226
- package/.aios-core/development/scripts/version-tracker.js +526 -526
- package/.aios-core/development/scripts/yaml-validator.js +396 -396
- package/.aios-core/development/tasks/build-autonomous.md +10 -4
- package/.aios-core/development/tasks/create-service.md +23 -0
- package/.aios-core/development/tasks/dev-develop-story.md +12 -6
- package/.aios-core/development/tasks/dev-suggest-refactoring.md +7 -1
- package/.aios-core/development/tasks/publish-npm.md +3 -3
- package/.aios-core/hooks/unified/README.md +1 -1
- package/.aios-core/install-manifest.yaml +65 -61
- package/.aios-core/manifests/schema/manifest-schema.json +190 -190
- package/.aios-core/product/templates/component-react-tmpl.tsx +98 -98
- package/.aios-core/product/templates/engine/schemas/adr.schema.json +102 -102
- package/.aios-core/product/templates/engine/schemas/dbdr.schema.json +205 -205
- package/.aios-core/product/templates/engine/schemas/epic.schema.json +175 -175
- package/.aios-core/product/templates/engine/schemas/pmdr.schema.json +175 -175
- package/.aios-core/product/templates/engine/schemas/prd-v2.schema.json +300 -300
- package/.aios-core/product/templates/engine/schemas/prd.schema.json +152 -152
- package/.aios-core/product/templates/engine/schemas/story.schema.json +222 -222
- package/.aios-core/product/templates/engine/schemas/task.schema.json +154 -154
- package/.aios-core/product/templates/eslintrc-security.json +32 -32
- package/.aios-core/product/templates/github-actions-cd.yml +212 -212
- package/.aios-core/product/templates/github-actions-ci.yml +172 -172
- package/.aios-core/product/templates/shock-report-tmpl.html +502 -502
- package/.aios-core/product/templates/token-exports-css-tmpl.css +240 -240
- package/.aios-core/quality/schemas/quality-metrics.schema.json +233 -233
- package/.aios-core/scripts/migrate-framework-docs.sh +300 -300
- package/README.en.md +747 -0
- package/README.md +4 -2
- package/bin/aios.js +7 -4
- package/package.json +1 -1
- package/packages/aios-pro-cli/src/recover.js +1 -1
- package/packages/installer/src/wizard/ide-config-generator.js +6 -6
- package/packages/installer/src/wizard/pro-setup.js +3 -3
- package/pro/license/degradation.js +220 -220
- package/pro/license/errors.js +450 -450
- package/pro/license/feature-gate.js +354 -354
- package/pro/license/index.js +181 -181
- package/pro/license/license-cache.js +523 -523
- package/pro/license/license-crypto.js +303 -303
- package/scripts/package-synapse.js +5 -5
- package/scripts/validate-package-completeness.js +3 -3
- package/.aios-core/.session/current-session.json +0 -14
- package/.aios-core/data/registry-update-log.jsonl +0 -191
- package/.aios-core/docs/SHARD-TRANSLATION-GUIDE.md +0 -335
- package/.aios-core/docs/component-creation-guide.md +0 -458
- package/.aios-core/docs/session-update-pattern.md +0 -307
- package/.aios-core/docs/standards/AIOS-FRAMEWORK-MASTER.md +0 -1963
- package/.aios-core/docs/standards/AIOS-LIVRO-DE-OURO-V2.1-SUMMARY.md +0 -1190
- package/.aios-core/docs/standards/AIOS-LIVRO-DE-OURO-V2.1.md +0 -439
- package/.aios-core/docs/standards/AIOS-LIVRO-DE-OURO.md +0 -5398
- package/.aios-core/docs/standards/V3-ARCHITECTURAL-DECISIONS.md +0 -523
- package/.aios-core/docs/template-syntax.md +0 -267
- package/.aios-core/docs/troubleshooting-guide.md +0 -625
- package/.aios-core/infrastructure/tests/utilities-audit-results.json +0 -501
- package/.aios-core/manifests/agents.csv +0 -29
- package/.aios-core/manifests/tasks.csv +0 -198
- package/.aios-core/manifests/workers.csv +0 -204
- package/.claude/rules/agent-authority.md +0 -105
- package/.claude/rules/coderabbit-integration.md +0 -93
- package/.claude/rules/ids-principles.md +0 -112
- package/.claude/rules/story-lifecycle.md +0 -139
- package/.claude/rules/workflow-execution.md +0 -150
- package/scripts/glue/README.md +0 -355
- package/scripts/glue/compose-agent-prompt.cjs +0 -362
- /package/.claude/hooks/{precompact-session-digest.js ā precompact-session-digest.cjs} +0 -0
- /package/.claude/hooks/{synapse-engine.js ā synapse-engine.cjs} +0 -0
|
@@ -1,226 +1,226 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Validate Architecture and PRD Filenames
|
|
4
|
-
*
|
|
5
|
-
* Ensures all sharded documentation files follow English naming conventions
|
|
6
|
-
* and don't contain Portuguese characters or untranslated terms.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* node .aios-core/utils/validate-filenames.js
|
|
10
|
-
* node .aios-core/utils/validate-filenames.js --fix
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
const fs = require('fs');
|
|
14
|
-
const path = require('path');
|
|
15
|
-
|
|
16
|
-
// Portuguese characters that should not appear in filenames
|
|
17
|
-
const PORTUGUESE_CHARS = /[Ôà âãéêĆóÓõúüç]/i;
|
|
18
|
-
|
|
19
|
-
// Common Portuguese terms that should be translated
|
|
20
|
-
const PORTUGUESE_TERMS = {
|
|
21
|
-
'visao': 'vision',
|
|
22
|
-
'viso': 'vision',
|
|
23
|
-
'produto': 'product',
|
|
24
|
-
'problema': 'problem',
|
|
25
|
-
'objetivos': 'objectives',
|
|
26
|
-
'glossario': 'glossary',
|
|
27
|
-
'glossrio': 'glossary',
|
|
28
|
-
'terminologia': 'terminology',
|
|
29
|
-
'premissas': 'assumptions',
|
|
30
|
-
'restricoes': 'constraints',
|
|
31
|
-
'restries': 'constraints',
|
|
32
|
-
'stakeholders': 'stakeholders', // OK
|
|
33
|
-
'requisitos': 'requirements',
|
|
34
|
-
'arquitetura': 'architecture',
|
|
35
|
-
'tecnologia': 'technology',
|
|
36
|
-
'pilha': 'stack',
|
|
37
|
-
'padroes': 'standards',
|
|
38
|
-
'padres': 'standards',
|
|
39
|
-
'estrutura': 'structure',
|
|
40
|
-
'arvore': 'tree',
|
|
41
|
-
'seguranca': 'security',
|
|
42
|
-
'desempenho': 'performance',
|
|
43
|
-
'escalabilidade': 'scalability',
|
|
44
|
-
'confiabilidade': 'reliability',
|
|
45
|
-
'conformidade': 'compliance',
|
|
46
|
-
'riscos': 'risks',
|
|
47
|
-
'tecnicos': 'technical',
|
|
48
|
-
'tecnico': 'technical',
|
|
49
|
-
'negocio': 'business',
|
|
50
|
-
'negcios': 'business',
|
|
51
|
-
'infraestrutura': 'infrastructure',
|
|
52
|
-
'dados': 'data',
|
|
53
|
-
'banco': 'database',
|
|
54
|
-
'esquema': 'schema',
|
|
55
|
-
'testes': 'tests',
|
|
56
|
-
'estrategia': 'strategy',
|
|
57
|
-
'estratgia': 'strategy',
|
|
58
|
-
'metadados': 'metadata',
|
|
59
|
-
'indice': 'index',
|
|
60
|
-
'ndice': 'index',
|
|
61
|
-
'decisoes': 'decisions',
|
|
62
|
-
'decises': 'decisions',
|
|
63
|
-
'decisao': 'decision',
|
|
64
|
-
'deciso': 'decision'
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
// Expected standard filenames (architecture)
|
|
68
|
-
const STANDARD_FILES = [
|
|
69
|
-
'tech-stack.md',
|
|
70
|
-
'coding-standards.md',
|
|
71
|
-
'source-tree.md',
|
|
72
|
-
'project-structure.md',
|
|
73
|
-
'unified-project-structure.md',
|
|
74
|
-
'testing-strategy.md',
|
|
75
|
-
'database-schema.md',
|
|
76
|
-
'data-models.md',
|
|
77
|
-
'api-design.md',
|
|
78
|
-
'architecture-diagram.md'
|
|
79
|
-
];
|
|
80
|
-
|
|
81
|
-
class FilenameValidator {
|
|
82
|
-
constructor(projectRoot) {
|
|
83
|
-
this.projectRoot = projectRoot;
|
|
84
|
-
this.errors = [];
|
|
85
|
-
this.warnings = [];
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
validateDirectory(dir) {
|
|
89
|
-
if (!fs.existsSync(dir)) {
|
|
90
|
-
this.warnings.push(`Directory not found: ${dir}`);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const files = fs.readdirSync(dir);
|
|
95
|
-
|
|
96
|
-
for (const file of files) {
|
|
97
|
-
if (!file.endsWith('.md')) continue;
|
|
98
|
-
if (file === 'index.md') continue; // index.md is always OK
|
|
99
|
-
|
|
100
|
-
this.validateFilename(file, dir);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
validateFilename(filename, directory) {
|
|
105
|
-
const basename = path.basename(filename, '.md');
|
|
106
|
-
|
|
107
|
-
// Check for Portuguese characters
|
|
108
|
-
if (PORTUGUESE_CHARS.test(basename)) {
|
|
109
|
-
this.errors.push({
|
|
110
|
-
file: path.join(directory, filename),
|
|
111
|
-
issue: 'Contains Portuguese characters (accents)',
|
|
112
|
-
suggestion: this.removeAccents(basename) + '.md'
|
|
113
|
-
});
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Check for Portuguese terms
|
|
118
|
-
const lowerBasename = basename.toLowerCase();
|
|
119
|
-
for (const [ptTerm, enTerm] of Object.entries(PORTUGUESE_TERMS)) {
|
|
120
|
-
if (lowerBasename.includes(ptTerm) && !STANDARD_FILES.includes(filename)) {
|
|
121
|
-
const suggested = lowerBasename.replace(new RegExp(ptTerm, 'g'), enTerm);
|
|
122
|
-
this.errors.push({
|
|
123
|
-
file: path.join(directory, filename),
|
|
124
|
-
issue: `Contains Portuguese term: "${ptTerm}"`,
|
|
125
|
-
suggestion: suggested + '.md'
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
removeAccents(str) {
|
|
132
|
-
return str
|
|
133
|
-
.normalize('NFD')
|
|
134
|
-
.replace(/[\u0300-\u036f]/g, '')
|
|
135
|
-
.toLowerCase();
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
report() {
|
|
139
|
-
console.log('\nš AIOS Filename Validation Report\n');
|
|
140
|
-
console.log('=' .repeat(60));
|
|
141
|
-
|
|
142
|
-
if (this.errors.length === 0 && this.warnings.length === 0) {
|
|
143
|
-
console.log('ā
All filenames are valid!\n');
|
|
144
|
-
return true;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (this.warnings.length > 0) {
|
|
148
|
-
console.log('\nā ļø Warnings:\n');
|
|
149
|
-
this.warnings.forEach(warning => {
|
|
150
|
-
console.log(` ${warning}`);
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (this.errors.length > 0) {
|
|
155
|
-
console.log('\nā Errors found:\n');
|
|
156
|
-
this.errors.forEach((error, index) => {
|
|
157
|
-
console.log(` ${index + 1}. ${error.file}`);
|
|
158
|
-
console.log(` Issue: ${error.issue}`);
|
|
159
|
-
console.log(` Suggest: ${error.suggestion}\n`);
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
console.log(`\n${this.errors.length} filename(s) need correction.\n`);
|
|
163
|
-
console.log('To fix these issues:');
|
|
164
|
-
console.log('1. Re-run the shard task with updated translation rules');
|
|
165
|
-
console.log('2. Or manually rename the files using the suggestions above');
|
|
166
|
-
console.log('3. Or run: node .aios-core/utils/validate-filenames.js --fix\n');
|
|
167
|
-
|
|
168
|
-
return false;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return true;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
fix() {
|
|
175
|
-
console.log('\nš§ Fixing filename issues...\n');
|
|
176
|
-
|
|
177
|
-
let fixed = 0;
|
|
178
|
-
for (const error of this.errors) {
|
|
179
|
-
const oldPath = error.file;
|
|
180
|
-
const dir = path.dirname(oldPath);
|
|
181
|
-
const newPath = path.join(dir, error.suggestion);
|
|
182
|
-
|
|
183
|
-
try {
|
|
184
|
-
fs.renameSync(oldPath, newPath);
|
|
185
|
-
console.log(`ā
Renamed: ${path.basename(oldPath)} ā ${path.basename(newPath)}`);
|
|
186
|
-
fixed++;
|
|
187
|
-
} catch (err) {
|
|
188
|
-
console.error(`ā Failed to rename ${oldPath}: ${err.message}`);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
console.log(`\n⨠Fixed ${fixed} of ${this.errors.length} files.\n`);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
validate() {
|
|
196
|
-
console.log('š Validating documentation filenames...\n');
|
|
197
|
-
|
|
198
|
-
// Check docs/architecture/
|
|
199
|
-
const archDir = path.join(this.projectRoot, 'docs', 'architecture');
|
|
200
|
-
console.log(`Checking: ${archDir}`);
|
|
201
|
-
this.validateDirectory(archDir);
|
|
202
|
-
|
|
203
|
-
// Check docs/prd/
|
|
204
|
-
const prdDir = path.join(this.projectRoot, 'docs', 'prd');
|
|
205
|
-
console.log(`Checking: ${prdDir}`);
|
|
206
|
-
this.validateDirectory(prdDir);
|
|
207
|
-
|
|
208
|
-
return this.report();
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// Main execution
|
|
213
|
-
const projectRoot = process.cwd();
|
|
214
|
-
const shouldFix = process.argv.includes('--fix');
|
|
215
|
-
|
|
216
|
-
const validator = new FilenameValidator(projectRoot);
|
|
217
|
-
const isValid = validator.validate();
|
|
218
|
-
|
|
219
|
-
if (shouldFix && !isValid) {
|
|
220
|
-
validator.fix();
|
|
221
|
-
// Re-validate
|
|
222
|
-
const validator2 = new FilenameValidator(projectRoot);
|
|
223
|
-
validator2.validate();
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
process.exit(isValid ? 0 : 1);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Validate Architecture and PRD Filenames
|
|
4
|
+
*
|
|
5
|
+
* Ensures all sharded documentation files follow English naming conventions
|
|
6
|
+
* and don't contain Portuguese characters or untranslated terms.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* node .aios-core/utils/validate-filenames.js
|
|
10
|
+
* node .aios-core/utils/validate-filenames.js --fix
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const fs = require('fs');
|
|
14
|
+
const path = require('path');
|
|
15
|
+
|
|
16
|
+
// Portuguese characters that should not appear in filenames
|
|
17
|
+
const PORTUGUESE_CHARS = /[Ôà âãéêĆóÓõúüç]/i;
|
|
18
|
+
|
|
19
|
+
// Common Portuguese terms that should be translated
|
|
20
|
+
const PORTUGUESE_TERMS = {
|
|
21
|
+
'visao': 'vision',
|
|
22
|
+
'viso': 'vision',
|
|
23
|
+
'produto': 'product',
|
|
24
|
+
'problema': 'problem',
|
|
25
|
+
'objetivos': 'objectives',
|
|
26
|
+
'glossario': 'glossary',
|
|
27
|
+
'glossrio': 'glossary',
|
|
28
|
+
'terminologia': 'terminology',
|
|
29
|
+
'premissas': 'assumptions',
|
|
30
|
+
'restricoes': 'constraints',
|
|
31
|
+
'restries': 'constraints',
|
|
32
|
+
'stakeholders': 'stakeholders', // OK
|
|
33
|
+
'requisitos': 'requirements',
|
|
34
|
+
'arquitetura': 'architecture',
|
|
35
|
+
'tecnologia': 'technology',
|
|
36
|
+
'pilha': 'stack',
|
|
37
|
+
'padroes': 'standards',
|
|
38
|
+
'padres': 'standards',
|
|
39
|
+
'estrutura': 'structure',
|
|
40
|
+
'arvore': 'tree',
|
|
41
|
+
'seguranca': 'security',
|
|
42
|
+
'desempenho': 'performance',
|
|
43
|
+
'escalabilidade': 'scalability',
|
|
44
|
+
'confiabilidade': 'reliability',
|
|
45
|
+
'conformidade': 'compliance',
|
|
46
|
+
'riscos': 'risks',
|
|
47
|
+
'tecnicos': 'technical',
|
|
48
|
+
'tecnico': 'technical',
|
|
49
|
+
'negocio': 'business',
|
|
50
|
+
'negcios': 'business',
|
|
51
|
+
'infraestrutura': 'infrastructure',
|
|
52
|
+
'dados': 'data',
|
|
53
|
+
'banco': 'database',
|
|
54
|
+
'esquema': 'schema',
|
|
55
|
+
'testes': 'tests',
|
|
56
|
+
'estrategia': 'strategy',
|
|
57
|
+
'estratgia': 'strategy',
|
|
58
|
+
'metadados': 'metadata',
|
|
59
|
+
'indice': 'index',
|
|
60
|
+
'ndice': 'index',
|
|
61
|
+
'decisoes': 'decisions',
|
|
62
|
+
'decises': 'decisions',
|
|
63
|
+
'decisao': 'decision',
|
|
64
|
+
'deciso': 'decision'
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// Expected standard filenames (architecture)
|
|
68
|
+
const STANDARD_FILES = [
|
|
69
|
+
'tech-stack.md',
|
|
70
|
+
'coding-standards.md',
|
|
71
|
+
'source-tree.md',
|
|
72
|
+
'project-structure.md',
|
|
73
|
+
'unified-project-structure.md',
|
|
74
|
+
'testing-strategy.md',
|
|
75
|
+
'database-schema.md',
|
|
76
|
+
'data-models.md',
|
|
77
|
+
'api-design.md',
|
|
78
|
+
'architecture-diagram.md'
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
class FilenameValidator {
|
|
82
|
+
constructor(projectRoot) {
|
|
83
|
+
this.projectRoot = projectRoot;
|
|
84
|
+
this.errors = [];
|
|
85
|
+
this.warnings = [];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
validateDirectory(dir) {
|
|
89
|
+
if (!fs.existsSync(dir)) {
|
|
90
|
+
this.warnings.push(`Directory not found: ${dir}`);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const files = fs.readdirSync(dir);
|
|
95
|
+
|
|
96
|
+
for (const file of files) {
|
|
97
|
+
if (!file.endsWith('.md')) continue;
|
|
98
|
+
if (file === 'index.md') continue; // index.md is always OK
|
|
99
|
+
|
|
100
|
+
this.validateFilename(file, dir);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
validateFilename(filename, directory) {
|
|
105
|
+
const basename = path.basename(filename, '.md');
|
|
106
|
+
|
|
107
|
+
// Check for Portuguese characters
|
|
108
|
+
if (PORTUGUESE_CHARS.test(basename)) {
|
|
109
|
+
this.errors.push({
|
|
110
|
+
file: path.join(directory, filename),
|
|
111
|
+
issue: 'Contains Portuguese characters (accents)',
|
|
112
|
+
suggestion: this.removeAccents(basename) + '.md'
|
|
113
|
+
});
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Check for Portuguese terms
|
|
118
|
+
const lowerBasename = basename.toLowerCase();
|
|
119
|
+
for (const [ptTerm, enTerm] of Object.entries(PORTUGUESE_TERMS)) {
|
|
120
|
+
if (lowerBasename.includes(ptTerm) && !STANDARD_FILES.includes(filename)) {
|
|
121
|
+
const suggested = lowerBasename.replace(new RegExp(ptTerm, 'g'), enTerm);
|
|
122
|
+
this.errors.push({
|
|
123
|
+
file: path.join(directory, filename),
|
|
124
|
+
issue: `Contains Portuguese term: "${ptTerm}"`,
|
|
125
|
+
suggestion: suggested + '.md'
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
removeAccents(str) {
|
|
132
|
+
return str
|
|
133
|
+
.normalize('NFD')
|
|
134
|
+
.replace(/[\u0300-\u036f]/g, '')
|
|
135
|
+
.toLowerCase();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
report() {
|
|
139
|
+
console.log('\nš AIOS Filename Validation Report\n');
|
|
140
|
+
console.log('=' .repeat(60));
|
|
141
|
+
|
|
142
|
+
if (this.errors.length === 0 && this.warnings.length === 0) {
|
|
143
|
+
console.log('ā
All filenames are valid!\n');
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (this.warnings.length > 0) {
|
|
148
|
+
console.log('\nā ļø Warnings:\n');
|
|
149
|
+
this.warnings.forEach(warning => {
|
|
150
|
+
console.log(` ${warning}`);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (this.errors.length > 0) {
|
|
155
|
+
console.log('\nā Errors found:\n');
|
|
156
|
+
this.errors.forEach((error, index) => {
|
|
157
|
+
console.log(` ${index + 1}. ${error.file}`);
|
|
158
|
+
console.log(` Issue: ${error.issue}`);
|
|
159
|
+
console.log(` Suggest: ${error.suggestion}\n`);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
console.log(`\n${this.errors.length} filename(s) need correction.\n`);
|
|
163
|
+
console.log('To fix these issues:');
|
|
164
|
+
console.log('1. Re-run the shard task with updated translation rules');
|
|
165
|
+
console.log('2. Or manually rename the files using the suggestions above');
|
|
166
|
+
console.log('3. Or run: node .aios-core/utils/validate-filenames.js --fix\n');
|
|
167
|
+
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
fix() {
|
|
175
|
+
console.log('\nš§ Fixing filename issues...\n');
|
|
176
|
+
|
|
177
|
+
let fixed = 0;
|
|
178
|
+
for (const error of this.errors) {
|
|
179
|
+
const oldPath = error.file;
|
|
180
|
+
const dir = path.dirname(oldPath);
|
|
181
|
+
const newPath = path.join(dir, error.suggestion);
|
|
182
|
+
|
|
183
|
+
try {
|
|
184
|
+
fs.renameSync(oldPath, newPath);
|
|
185
|
+
console.log(`ā
Renamed: ${path.basename(oldPath)} ā ${path.basename(newPath)}`);
|
|
186
|
+
fixed++;
|
|
187
|
+
} catch (err) {
|
|
188
|
+
console.error(`ā Failed to rename ${oldPath}: ${err.message}`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
console.log(`\n⨠Fixed ${fixed} of ${this.errors.length} files.\n`);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
validate() {
|
|
196
|
+
console.log('š Validating documentation filenames...\n');
|
|
197
|
+
|
|
198
|
+
// Check docs/architecture/
|
|
199
|
+
const archDir = path.join(this.projectRoot, 'docs', 'architecture');
|
|
200
|
+
console.log(`Checking: ${archDir}`);
|
|
201
|
+
this.validateDirectory(archDir);
|
|
202
|
+
|
|
203
|
+
// Check docs/prd/
|
|
204
|
+
const prdDir = path.join(this.projectRoot, 'docs', 'prd');
|
|
205
|
+
console.log(`Checking: ${prdDir}`);
|
|
206
|
+
this.validateDirectory(prdDir);
|
|
207
|
+
|
|
208
|
+
return this.report();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Main execution
|
|
213
|
+
const projectRoot = process.cwd();
|
|
214
|
+
const shouldFix = process.argv.includes('--fix');
|
|
215
|
+
|
|
216
|
+
const validator = new FilenameValidator(projectRoot);
|
|
217
|
+
const isValid = validator.validate();
|
|
218
|
+
|
|
219
|
+
if (shouldFix && !isValid) {
|
|
220
|
+
validator.fix();
|
|
221
|
+
// Re-validate
|
|
222
|
+
const validator2 = new FilenameValidator(projectRoot);
|
|
223
|
+
validator2.validate();
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
process.exit(isValid ? 0 : 1);
|