aios-core 2.1.5 ā 2.1.6
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/development/tasks/analyze-brownfield.md +456 -0
- package/.aios-core/development/tasks/setup-project-docs.md +440 -0
- package/.aios-core/infrastructure/scripts/documentation-integrity/brownfield-analyzer.js +501 -0
- package/.aios-core/infrastructure/scripts/documentation-integrity/config-generator.js +368 -0
- package/.aios-core/infrastructure/scripts/documentation-integrity/deployment-config-loader.js +308 -0
- package/.aios-core/infrastructure/scripts/documentation-integrity/doc-generator.js +331 -0
- package/.aios-core/infrastructure/scripts/documentation-integrity/gitignore-generator.js +312 -0
- package/.aios-core/infrastructure/scripts/documentation-integrity/index.js +74 -0
- package/.aios-core/infrastructure/scripts/documentation-integrity/mode-detector.js +389 -0
- package/.aios-core/infrastructure/templates/core-config/core-config-brownfield.tmpl.yaml +176 -0
- package/.aios-core/infrastructure/templates/core-config/core-config-greenfield.tmpl.yaml +127 -0
- package/.aios-core/infrastructure/templates/gitignore/gitignore-aios-base.tmpl +63 -0
- package/.aios-core/infrastructure/templates/gitignore/gitignore-brownfield-merge.tmpl +18 -0
- package/.aios-core/infrastructure/templates/gitignore/gitignore-node.tmpl +85 -0
- package/.aios-core/infrastructure/templates/gitignore/gitignore-python.tmpl +145 -0
- package/.aios-core/infrastructure/templates/project-docs/coding-standards-tmpl.md +346 -0
- package/.aios-core/infrastructure/templates/project-docs/source-tree-tmpl.md +177 -0
- package/.aios-core/infrastructure/templates/project-docs/tech-stack-tmpl.md +267 -0
- package/package.json +1 -1
- package/packages/installer/src/config/templates/env-template.js +2 -2
- package/packages/installer/src/wizard/wizard.js +185 -34
- package/packages/installer/tests/integration/environment-configuration.test.js +2 -1
- package/packages/installer/tests/unit/env-template.test.js +3 -2
- package/.aios-core/development/tasks/validate-structure.md +0 -243
- package/.aios-core/infrastructure/scripts/source-tree-guardian/index.js +0 -375
- package/.aios-core/infrastructure/scripts/source-tree-guardian/manifest-generator.js +0 -410
- package/.aios-core/infrastructure/scripts/source-tree-guardian/rules/naming-rules.yaml +0 -285
- package/.aios-core/infrastructure/scripts/source-tree-guardian/rules/placement-rules.yaml +0 -262
- package/.aios-core/infrastructure/scripts/source-tree-guardian/validator.js +0 -468
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Source-Tree Guardian - Main Entry Point
|
|
4
|
-
*
|
|
5
|
-
* CLI tool and module exports for source-tree validation.
|
|
6
|
-
*
|
|
7
|
-
* @module source-tree-guardian
|
|
8
|
-
* @version 1.0.0
|
|
9
|
-
* @story 6.8
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const path = require('path');
|
|
13
|
-
const fs = require('fs').promises;
|
|
14
|
-
|
|
15
|
-
// Import core modules
|
|
16
|
-
const {
|
|
17
|
-
SourceTreeValidator,
|
|
18
|
-
normalizePath,
|
|
19
|
-
validateNamingConvention,
|
|
20
|
-
matchesPattern,
|
|
21
|
-
loadRules,
|
|
22
|
-
shouldExclude,
|
|
23
|
-
validateFilePlacement,
|
|
24
|
-
getStagedFiles,
|
|
25
|
-
Severity,
|
|
26
|
-
} = require('./validator');
|
|
27
|
-
|
|
28
|
-
const {
|
|
29
|
-
ManifestGenerator,
|
|
30
|
-
generateTree,
|
|
31
|
-
countFilesByCategory,
|
|
32
|
-
getFileStats,
|
|
33
|
-
FILE_CATEGORIES,
|
|
34
|
-
DEFAULT_EXCLUSIONS,
|
|
35
|
-
} = require('./manifest-generator');
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* CLI argument parser
|
|
39
|
-
* @param {string[]} args - Command line arguments
|
|
40
|
-
* @returns {Object} Parsed options
|
|
41
|
-
*/
|
|
42
|
-
function parseArgs(args) {
|
|
43
|
-
const options = {
|
|
44
|
-
help: false,
|
|
45
|
-
version: false,
|
|
46
|
-
files: null,
|
|
47
|
-
stagedOnly: false,
|
|
48
|
-
generateManifest: false,
|
|
49
|
-
diff: false,
|
|
50
|
-
fix: false,
|
|
51
|
-
json: false,
|
|
52
|
-
verbose: false,
|
|
53
|
-
force: false,
|
|
54
|
-
reason: null,
|
|
55
|
-
config: null,
|
|
56
|
-
check: null,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
for (let i = 0; i < args.length; i++) {
|
|
60
|
-
const arg = args[i];
|
|
61
|
-
|
|
62
|
-
switch (arg) {
|
|
63
|
-
case '-h':
|
|
64
|
-
case '--help':
|
|
65
|
-
options.help = true;
|
|
66
|
-
break;
|
|
67
|
-
case '-v':
|
|
68
|
-
case '--version':
|
|
69
|
-
options.version = true;
|
|
70
|
-
break;
|
|
71
|
-
case '--files':
|
|
72
|
-
options.files = args[++i];
|
|
73
|
-
break;
|
|
74
|
-
case '--staged-only':
|
|
75
|
-
options.stagedOnly = true;
|
|
76
|
-
break;
|
|
77
|
-
case '--generate-manifest':
|
|
78
|
-
options.generateManifest = true;
|
|
79
|
-
break;
|
|
80
|
-
case '--diff':
|
|
81
|
-
options.diff = true;
|
|
82
|
-
break;
|
|
83
|
-
case '--fix':
|
|
84
|
-
options.fix = true;
|
|
85
|
-
break;
|
|
86
|
-
case '--json':
|
|
87
|
-
options.json = true;
|
|
88
|
-
break;
|
|
89
|
-
case '--verbose':
|
|
90
|
-
options.verbose = true;
|
|
91
|
-
break;
|
|
92
|
-
case '--force':
|
|
93
|
-
options.force = true;
|
|
94
|
-
break;
|
|
95
|
-
case '--reason':
|
|
96
|
-
options.reason = args[++i];
|
|
97
|
-
break;
|
|
98
|
-
case '--config':
|
|
99
|
-
options.config = args[++i];
|
|
100
|
-
break;
|
|
101
|
-
case '--check':
|
|
102
|
-
options.check = args[++i];
|
|
103
|
-
break;
|
|
104
|
-
default:
|
|
105
|
-
if (!arg.startsWith('-')) {
|
|
106
|
-
options.files = arg;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return options;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Prints help message
|
|
116
|
-
*/
|
|
117
|
-
function printHelp() {
|
|
118
|
-
console.log(`
|
|
119
|
-
Source-Tree Guardian - Structure Validation System
|
|
120
|
-
Version: 1.0.0 | Story: 6.8
|
|
121
|
-
|
|
122
|
-
USAGE:
|
|
123
|
-
node index.js [options]
|
|
124
|
-
npm run validate:structure [-- options]
|
|
125
|
-
|
|
126
|
-
OPTIONS:
|
|
127
|
-
-h, --help Show this help message
|
|
128
|
-
-v, --version Show version information
|
|
129
|
-
--files <glob> Validate specific files (glob pattern)
|
|
130
|
-
--staged-only Only validate git staged files
|
|
131
|
-
--generate-manifest Generate source-tree-manifest.json
|
|
132
|
-
--diff Show drift from previous manifest
|
|
133
|
-
--fix Show auto-fix suggestions
|
|
134
|
-
--json Output in JSON format
|
|
135
|
-
--verbose Enable verbose output
|
|
136
|
-
--force Bypass validation (requires --reason)
|
|
137
|
-
--reason <text> Justification for --force (logged)
|
|
138
|
-
--config <path> Custom rules file location
|
|
139
|
-
--check <path> Check a single file
|
|
140
|
-
|
|
141
|
-
EXAMPLES:
|
|
142
|
-
# Validate all files
|
|
143
|
-
npm run validate:structure
|
|
144
|
-
|
|
145
|
-
# Validate specific files
|
|
146
|
-
npm run validate:structure -- --files "src/**/*.js"
|
|
147
|
-
|
|
148
|
-
# Validate staged files only (pre-commit)
|
|
149
|
-
npm run validate:structure -- --staged-only
|
|
150
|
-
|
|
151
|
-
# Generate manifest
|
|
152
|
-
npm run validate:structure -- --generate-manifest
|
|
153
|
-
|
|
154
|
-
# Show drift from previous manifest
|
|
155
|
-
npm run validate:structure -- --diff
|
|
156
|
-
|
|
157
|
-
# JSON output for CI
|
|
158
|
-
npm run validate:structure -- --json
|
|
159
|
-
|
|
160
|
-
# Force bypass with reason
|
|
161
|
-
npm run validate:structure -- --force --reason "Hotfix deployment"
|
|
162
|
-
`);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Prints version information
|
|
167
|
-
*/
|
|
168
|
-
function printVersion() {
|
|
169
|
-
console.log('Source-Tree Guardian v1.0.0');
|
|
170
|
-
console.log('Story: 6.8 - Source-Tree Guardian - Structure Validation System');
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Logs force bypass with reason
|
|
175
|
-
* @param {string} reason - Justification for bypass
|
|
176
|
-
* @param {string} projectRoot - Project root directory
|
|
177
|
-
*/
|
|
178
|
-
async function logForceBypass(reason, projectRoot) {
|
|
179
|
-
const logDir = path.join(projectRoot, '.ai');
|
|
180
|
-
const logFile = path.join(logDir, 'force-bypass-log.md');
|
|
181
|
-
|
|
182
|
-
await fs.mkdir(logDir, { recursive: true });
|
|
183
|
-
|
|
184
|
-
const entry = `\n## Force Bypass - ${new Date().toISOString()}\n\n**Reason:** ${reason}\n\n---\n`;
|
|
185
|
-
|
|
186
|
-
try {
|
|
187
|
-
await fs.appendFile(logFile, entry);
|
|
188
|
-
console.log(`ā ļø Force bypass logged to ${logFile}`);
|
|
189
|
-
} catch (error) {
|
|
190
|
-
console.warn(`Warning: Could not log force bypass: ${error.message}`);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Main CLI entry point
|
|
196
|
-
* @param {string[]} args - Command line arguments
|
|
197
|
-
* @returns {Promise<number>} Exit code
|
|
198
|
-
*/
|
|
199
|
-
async function main(args = process.argv.slice(2)) {
|
|
200
|
-
const options = parseArgs(args);
|
|
201
|
-
const projectRoot = process.cwd();
|
|
202
|
-
|
|
203
|
-
// Handle help and version
|
|
204
|
-
if (options.help) {
|
|
205
|
-
printHelp();
|
|
206
|
-
return 0;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (options.version) {
|
|
210
|
-
printVersion();
|
|
211
|
-
return 0;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// Handle force bypass
|
|
215
|
-
if (options.force) {
|
|
216
|
-
if (!options.reason) {
|
|
217
|
-
console.error('ā --force requires --reason to be specified');
|
|
218
|
-
return 1;
|
|
219
|
-
}
|
|
220
|
-
await logForceBypass(options.reason, projectRoot);
|
|
221
|
-
console.log('ā
Validation bypassed');
|
|
222
|
-
return 0;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// Handle manifest generation
|
|
226
|
-
if (options.generateManifest) {
|
|
227
|
-
const generator = new ManifestGenerator({ projectRoot });
|
|
228
|
-
console.log('š Generating source-tree manifest...');
|
|
229
|
-
|
|
230
|
-
const manifest = await generator.generate();
|
|
231
|
-
const outputPath = await generator.save(manifest);
|
|
232
|
-
|
|
233
|
-
if (options.json) {
|
|
234
|
-
console.log(JSON.stringify(manifest, null, 2));
|
|
235
|
-
} else {
|
|
236
|
-
console.log(`ā
Manifest generated: ${outputPath}`);
|
|
237
|
-
console.log(` Files: ${manifest.summary.totalFiles}`);
|
|
238
|
-
console.log(` Directories: ${manifest.summary.totalDirectories}`);
|
|
239
|
-
console.log(` Duration: ${manifest.duration}ms`);
|
|
240
|
-
}
|
|
241
|
-
return 0;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// Handle diff
|
|
245
|
-
if (options.diff) {
|
|
246
|
-
const generator = new ManifestGenerator({ projectRoot });
|
|
247
|
-
console.log('š Comparing with previous manifest...');
|
|
248
|
-
|
|
249
|
-
try {
|
|
250
|
-
const oldManifest = await generator.load();
|
|
251
|
-
const newManifest = await generator.generate();
|
|
252
|
-
const diff = generator.compare(oldManifest, newManifest);
|
|
253
|
-
|
|
254
|
-
if (options.json) {
|
|
255
|
-
console.log(JSON.stringify(diff, null, 2));
|
|
256
|
-
} else {
|
|
257
|
-
console.log(generator.formatDiffReport(diff));
|
|
258
|
-
}
|
|
259
|
-
} catch (error) {
|
|
260
|
-
if (error.code === 'ENOENT') {
|
|
261
|
-
console.log('ā ļø No previous manifest found. Generate one first with --generate-manifest');
|
|
262
|
-
return 1;
|
|
263
|
-
}
|
|
264
|
-
throw error;
|
|
265
|
-
}
|
|
266
|
-
return 0;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// Handle single file check
|
|
270
|
-
if (options.check) {
|
|
271
|
-
const validator = new SourceTreeValidator({
|
|
272
|
-
projectRoot,
|
|
273
|
-
rulesPath: options.config,
|
|
274
|
-
verbose: options.verbose,
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
const result = await validator.validateFile(options.check);
|
|
278
|
-
|
|
279
|
-
if (options.json) {
|
|
280
|
-
console.log(JSON.stringify(result, null, 2));
|
|
281
|
-
} else {
|
|
282
|
-
if (result.isValid) {
|
|
283
|
-
console.log(`ā
${options.check}: Valid placement`);
|
|
284
|
-
} else {
|
|
285
|
-
console.log(`ā ${options.check}: Invalid placement`);
|
|
286
|
-
for (const v of result.violations) {
|
|
287
|
-
console.log(` ${v.message}`);
|
|
288
|
-
if (v.suggestedLocation) {
|
|
289
|
-
console.log(` Suggested: ${v.suggestedLocation}`);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
return result.isValid ? 0 : 1;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
// Main validation
|
|
299
|
-
const validator = new SourceTreeValidator({
|
|
300
|
-
projectRoot,
|
|
301
|
-
rulesPath: options.config,
|
|
302
|
-
verbose: options.verbose,
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
console.log('š Validating source-tree structure...');
|
|
306
|
-
|
|
307
|
-
const report = await validator.validate({
|
|
308
|
-
files: options.files,
|
|
309
|
-
stagedOnly: options.stagedOnly,
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
// Output report
|
|
313
|
-
if (options.json) {
|
|
314
|
-
console.log(validator.formatJsonReport(report));
|
|
315
|
-
} else {
|
|
316
|
-
console.log(validator.formatReport(report, { showFixHint: !options.fix }));
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
// Show fix suggestions if requested
|
|
320
|
-
if (options.fix && report.violations.length > 0) {
|
|
321
|
-
console.log('\nš FIX SUGGESTIONS:\n');
|
|
322
|
-
const suggestions = validator.generateFixSuggestions(report.violations);
|
|
323
|
-
for (const suggestion of suggestions) {
|
|
324
|
-
console.log(`File: ${suggestion.file}`);
|
|
325
|
-
console.log(` Current: ${suggestion.currentLocation}`);
|
|
326
|
-
console.log(` Suggested: ${suggestion.suggestedLocation}`);
|
|
327
|
-
if (suggestion.command) {
|
|
328
|
-
console.log(` Command: ${suggestion.command}`);
|
|
329
|
-
}
|
|
330
|
-
console.log('');
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
// Return exit code based on errors
|
|
335
|
-
return report.summary.errors > 0 ? 1 : 0;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
// Export modules
|
|
339
|
-
module.exports = {
|
|
340
|
-
// Validator exports
|
|
341
|
-
SourceTreeValidator,
|
|
342
|
-
normalizePath,
|
|
343
|
-
validateNamingConvention,
|
|
344
|
-
matchesPattern,
|
|
345
|
-
loadRules,
|
|
346
|
-
shouldExclude,
|
|
347
|
-
validateFilePlacement,
|
|
348
|
-
getStagedFiles,
|
|
349
|
-
Severity,
|
|
350
|
-
// Manifest exports
|
|
351
|
-
ManifestGenerator,
|
|
352
|
-
generateTree,
|
|
353
|
-
countFilesByCategory,
|
|
354
|
-
getFileStats,
|
|
355
|
-
FILE_CATEGORIES,
|
|
356
|
-
DEFAULT_EXCLUSIONS,
|
|
357
|
-
// CLI exports
|
|
358
|
-
main,
|
|
359
|
-
parseArgs,
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
// Run CLI if executed directly
|
|
363
|
-
if (require.main === module) {
|
|
364
|
-
main()
|
|
365
|
-
.then((exitCode) => {
|
|
366
|
-
process.exit(exitCode);
|
|
367
|
-
})
|
|
368
|
-
.catch((error) => {
|
|
369
|
-
console.error('ā Error:', error.message);
|
|
370
|
-
if (process.env.DEBUG) {
|
|
371
|
-
console.error(error.stack);
|
|
372
|
-
}
|
|
373
|
-
process.exit(1);
|
|
374
|
-
});
|
|
375
|
-
}
|